branch_name stringclasses 149 values | text stringlengths 23 89.3M | directory_id stringlengths 40 40 | languages listlengths 1 19 | num_files int64 1 11.8k | repo_language stringclasses 38 values | repo_name stringlengths 6 114 | revision_id stringlengths 40 40 | snapshot_id stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|
refs/heads/master | <file_sep>cmake_minimum_required(VERSION 3.2.2)
project(test_string)
add_executable(${PROJECT_NAME}
main.cpp
${CMAKE_SOURCE_DIR}/src/mystring.cpp
)
add_test(string ${PROJECT_NAME})
<file_sep>#include "cpptest.h"
#include "mystring.h"
#include <iostream>
void testStringBasic()
{
String str1;
EXPECT_TRUE(str1.get() == nullptr);
String str2("hello");
EXPECT_STREQ(str2.get(), "hello");
}
void testStringCopy()
{
String str1("hello");
EXPECT_STREQ(str1.get(), "hello");
String str2 = str1;
EXPECT_STREQ(str2.get(), "hello");
String str3;
str3 = str1;
EXPECT_STREQ(str3.get(), "hello");
str1 = str1;
EXPECT_STREQ(str1.get(), "hello");
}
void testStringCompare()
{
String str1("hello");
String str2("world");
String str3("hello");
EXPECT_NE(str1, str2);
EXPECT_EQ(str1, str3);
}
int main()
{
cpptest::init({
testStringBasic,
testStringCopy,
testStringCompare
});
return cpptest::runAllTests();
}
<file_sep>#include "circle.h"
Circle::Circle(int x, int y, int radius)
: Shape()
, m_radius(radius)
, m_center( { x, y } )
{
}
int Circle::getX() const
{
return m_center.x;
}
int Circle::getY() const
{
return m_center.y;
}
int Circle::getArea() const
{
return static_cast<int>(3.14 * m_radius * m_radius);
}
<file_sep>#include "cpptest.h"
#include "polygontypes.h"
#include "circle.h"
void testPolygon()
{
struct TestGetArea
{
int operator()(int, const Point*) const
{
return 10;
}
};
struct TestGetCenter
{
Point operator()(int, const Point*, int) const
{
return {100, 100};
}
};
Point points[4] = {{5,0}, {15,0}, {15,20}, {5,20}};
Polygon<4, TestGetArea, TestGetCenter> rect10(points);
EXPECT_EQ(rect10.getX(), 100);
EXPECT_EQ(rect10.getY(), 100);
EXPECT_EQ(rect10.getArea(), 10);
}
void testRectangle()
{
Point points[4] = { { 5, 0 }, { 15, 0 }, { 15, 20 }, { 5, 20 } };
Rectangle rect(points);
EXPECT_EQ(rect.getX(), 10);
EXPECT_EQ(rect.getY(), 10);
EXPECT_EQ(rect.getArea(), 200);
}
void testCircle()
{
Circle circle( 5, 5, 15);
EXPECT_EQ(circle.getX(), 5);
EXPECT_EQ(circle.getY(), 5);
EXPECT_EQ(circle.getArea(), 706);
}
void testShapeText()
{
Point points[4] = { { 5, 0 }, { 15, 0 }, { 15, 20 }, { 5, 20 } };
Rectangle rect(points);
rect.setText("red box");
EXPECT_EQ(rect.getText(), "red box");
rect.setText("blue box");
EXPECT_EQ(rect.getText(), "blue box");
}
void testShapeCopy()
{
Point points[4] = { { 5, 0 }, { 15, 0 }, { 15, 20 }, { 5, 20 } };
Rectangle rect1(points);
rect1.setText("red box");
EXPECT_EQ(rect1.getX(), 10);
EXPECT_EQ(rect1.getY(), 10);
EXPECT_EQ(rect1.getText(), "red box");
Rectangle rect2 = rect1;
EXPECT_EQ(rect2.getX(), 10);
EXPECT_EQ(rect2.getY(), 10);
EXPECT_EQ(rect2.getText(), "red box");
Point points2[4] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } };
Rectangle rect3(points2);
rect3 = rect1;
EXPECT_EQ(rect3.getX(), 10);
EXPECT_EQ(rect3.getY(), 10);
EXPECT_EQ(rect3.getText(), "red box");
}
int main()
{
cpptest::init({
testPolygon,
testRectangle,
testCircle,
testShapeText,
testShapeCopy
});
return cpptest::runAllTests();
}
<file_sep>#include "cpptest.h"
#include "polygontypes.h"
#include "circle.h"
#include "world.h"
#include <iostream>
void testWorldGetAllArea()
{
Point points[4] = { { 5, 0 }, { 15, 0 }, { 15, 20 }, { 5, 20 } };
Rectangle rect(points);
Circle circle( 5, 5, 15);
World world;
world.add(&rect);
world.add(&circle);
EXPECT_EQ(world.getAllArea(), 906);
}
void testWorldAddMany()
{
// TODO: enable tc
return;
Point points[4] = { { 5, 0 }, { 15, 0 }, { 15, 20 }, { 5, 20 } };
Rectangle rect(points);
World world;
for(int i = 0; i < 100; ++i)
world.add(&rect);
EXPECT_EQ(world.getAllArea(), 20000);
}
void testWorldAddCopy()
{
// TODO: enable tc
return;
Point points[4] = { { 5, 0 }, { 15, 0 }, { 15, 20 }, { 5, 20 } };
Rectangle rect1(points);
World world;
world.add(&rect1);
{
Rectangle rect2(points);
world.add(&rect2);
}
EXPECT_EQ(world.getAllArea(), 400);
}
int main()
{
cpptest::init({
testWorldGetAllArea,
testWorldAddMany,
testWorldAddCopy
});
return cpptest::runAllTests();
}
<file_sep>#ifndef POLYGONTYPES_H
#define POLYGONTYPES_H
#include "polygon.h"
struct PolygonAreaRectangle
{
int operator()(int numPoints, const Point* points) const
{
return (points[1].x - points[0].x) * (points[2].y - points[1].y);
};
};
struct PolygonCenterRectangle
{
Point operator()(int numPoints, const Point *points, int area)
{
Point center {0,0};
return center;
return {points[0].x + (points[1].x - points[0].x)/2,
points[1].y + (points[2].y - points[1].y)/2};
}
};
typedef Polygon<4, PolygonAreaRectangle> Rectangle;
typedef Polygon<3> Triangle;
#endif
<file_sep>#include "world.h"
#include "shape.h"
World::World()
: m_numShapes(0)
{
}
void World::add(Shape *shape)
{
m_shapes[m_numShapes++] = shape;
}
int World::getAllArea() const
{
double sum = 0;
for(int i = 0; i < m_numShapes; ++i)
sum += m_shapes[i]->getArea();
return sum;
}
<file_sep>#ifndef MYSTRING_H
#define MYSTRING_H
#include <iostream>
class String
{
public:
String();
String(const char *string);
String(const String &string);
~String();
const char* get() const;
String& operator=(const String& string);
bool operator==(const String &string);
bool operator!=(const String &string);
friend std::ostream& operator<<(std::ostream &os, const String &string);
private:
void set(const char *string);
private:
char *m_string;
};
#endif
<file_sep>#ifndef CIRCLE_H
#define CIRCLE_H
#include "shape.h"
#include "point.h"
class Circle : public Shape
{
public:
Circle(int x, int y, int radius);
virtual int getX() const;
virtual int getY() const;
virtual int getArea() const;
private:
int m_radius;
Point m_center;
};
#endif
<file_sep>#ifndef WORLD_H
#define WORLD_H
class Shape;
class World
{
public:
World();
void add(Shape *shape);
int getAllArea() const;
private:
int m_numShapes;
Shape* m_shapes[10];
};
#endif
<file_sep>cmake_minimum_required(VERSION 3.2.2)
project(test_shapes)
add_executable(${PROJECT_NAME}
main.cpp
${CMAKE_SOURCE_DIR}/src/shape.cpp
${CMAKE_SOURCE_DIR}/src/circle.cpp
${CMAKE_SOURCE_DIR}/src/mystring.cpp
)
add_test(shapes ${PROJECT_NAME})
<file_sep>#ifndef SHAPE_H
#define SHAPE_H
#include "mystring.h"
class Shape
{
public:
Shape();
virtual ~Shape();
int getColor() const;
void setColor(int r, int g, int b);
void setText(const char *text);
String getText() const;
virtual int getX() const = 0;
virtual int getY() const = 0;
virtual int getArea() const = 0;
private:
int m_color;
String m_text;
};
#endif
<file_sep>#ifndef CPPTEST_H
#define CPPTEST_H
#include <sstream>
#include <vector>
#include <iostream>
#include <cstring>
namespace cpptest
{
int numFailed;
std::vector<void (*)()> allTests;
void failed(const std::string &error)
{
std::cout << error << std::endl;
++numFailed;
}
template <typename T1, typename T2>
std::string makeError(T1 actual, T2 expected, const std::string &line)
{
std::stringstream ss;
ss << "\tError in line " << line
<< "\n\t\tExpected: " << expected
<< "\n\t\tActual: " << actual;
return ss.str();
}
void init(const std::vector<void (*)()> tests)
{
allTests = tests;
numFailed = 0;
}
int runAllTests()
{
for(void (*func)() : allTests)
func();
return numFailed == 0 ? 0 : 1;
}
}
#define EXPECT_TRUE(x) \
{ if ( !(x) ) cpptest::failed(cpptest::makeError("true", "false", std::to_string(__LINE__))); }
#define EXPECT_FALSE(x) \
{ if ( (x) ) cpptest::failed(cpptest::makeError("false", "true", std::to_string(__LINE__))); }
#define EXPECT_EQ(x, y) \
{ if ( (x) != (y) ) cpptest::failed(cpptest::makeError((x), (y), std::to_string(__LINE__))); }
#define EXPECT_NE(x, y) \
{ if ( (x) == (y) ) cpptest::failed(cpptest::makeError((x), (y), std::to_string(__LINE__))); }
#define EXPECT_STREQ(x, y) \
{ if ( strcmp((x),(y)) ) cpptest::failed(cpptest::makeError((x), (y), std::to_string(__LINE__))); }
#define EXPECT_STRNE(x, y) \
{ if ( !strcmp((x),(y)) ) cpptest::failed(cpptest::makeError((x), (y), std::to_string(__LINE__))); }
#endif
<file_sep>cmake_minimum_required(VERSION 3.2.2)
project(myproject)
set(CMAKE_CXX_FLAGS "-std=c++14")
add_executable(${CMAKE_PROJECT_NAME}
src/main.cpp
src/shape.cpp
src/circle.cpp
src/world.cpp
src/mystring.cpp
)
include_directories(src)
#if (BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
#endif()
<file_sep>cmake_minimum_required(VERSION 3.2.2)
include_directories(.)
add_subdirectory(shapes)
add_subdirectory(world)
add_subdirectory(string)
<file_sep>#ifndef POLYGON_H
#define POLYGON_H
#include "shape.h"
#include "point.h"
struct PolygonAreaGeneral
{
int operator()(int numPoints, const Point *points) const
{
int sum = 0;
for(int i = 0, j = numPoints - 1; i < numPoints; j=i, ++i)
sum += ( (points[j].x + points[i].x) * (points[j].y - points[i].y) );
return static_cast<int>(abs(sum) / 2);
}
};
struct PolygonCenterGeneral
{
Point operator()(int numPoints, const Point *points, int area)
{
Point center { 0, 0 };
for(int i = 0, j = numPoints - 1; i < numPoints; j=i, ++i)
{
int x = (points[j].x + points[i].x) * (points[j].x * points[i].y - points[i].x * points[j].y);
int y = (points[j].y + points[i].y) * (points[j].x * points[i].y - points[i].x * points[j].y);
center.x += x;
center.y += y;
}
center.x /= (area * 6);
center.y /= (area * 6);
return center;
}
};
template <int N,
typename PolygonArea=PolygonAreaGeneral,
typename PolygonCenter=PolygonCenterGeneral>
class Polygon : public Shape
{
public:
Polygon(Point *points)
: Shape()
, m_center({ 0, 0 })
{
for(int i = 0; i < N; ++i)
m_points[i] = points[i];
m_center = m_get_center(N, points, m_get_area(N, points));
}
virtual ~Polygon() {}
virtual int getX() const
{
return m_center.x;
}
virtual int getY() const
{
return m_center.y;
}
virtual int getArea() const
{
return m_get_area(N, m_points);
}
private:
Point m_points[N];
Point m_center;
PolygonArea m_get_area;
PolygonCenter m_get_center;
};
#endif
<file_sep>#ifndef POINT_H
#define POINT_H
struct Point2D
{
int x;
int y;
};
typedef Point2D Point;
#endif
<file_sep>cmake_minimum_required(VERSION 3.2.2)
project(test_world)
add_executable(${PROJECT_NAME}
main.cpp
${CMAKE_SOURCE_DIR}/src/shape.cpp
${CMAKE_SOURCE_DIR}/src/circle.cpp
${CMAKE_SOURCE_DIR}/src/world.cpp
${CMAKE_SOURCE_DIR}/src/mystring.cpp
)
add_test(world ${PROJECT_NAME})
<file_sep>#include "mystring.h"
#include <string.h>
String::String()
: m_string(nullptr)
{
}
String::String(const char *string)
: m_string(nullptr)
{
set(string);
}
String::String(const String &string)
: String(string.m_string)
{
}
String::~String()
{
delete [] m_string;
}
void String::set(const char *string)
{
delete [] m_string;
m_string = nullptr;
if (string)
{
m_string = new char[strlen(string) + 1];
strcpy(m_string, string);
}
}
const char* String::get() const
{
return m_string;
}
String& String::operator=(const String& string)
{
if (m_string == string.m_string)
return *this;
set(string.get());
return *this;
}
bool String::operator==(const String& string)
{
return strcmp(m_string, string.get()) == 0 ? true : false;
}
bool String::operator!=(const String& string)
{
return !(*this == string);
}
std::ostream& operator<<(std::ostream &os, const String &string)
{
os << string.m_string;
return os;
}
<file_sep>#include "shape.h"
#include <cstring>
Shape::Shape()
: m_color(0)
{
}
Shape::~Shape()
{
}
int Shape::getColor() const
{
return m_color;
}
void Shape::setColor(int r, int g, int b)
{
m_color = ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
}
void Shape::setText(const char *text)
{
m_text = text;
}
String Shape::getText() const
{
return m_text;
}
| 87b9f656a7c2f409f31617a351b9cf712c543025 | [
"C",
"CMake",
"C++"
] | 20 | CMake | paragonjh/unitTest | 0c04d2256f1c6fe5b7f2f54e3ed35b32dd0bf943 | f78932624a414c79f79f200842f7193fb297d19b |
refs/heads/master | <repo_name>e/experiments<file_sep>/chaining_songs/playlist_builder.py
#!/usr/bin/python
"""
Small script to chain songs
"""
import argparse
import json
class NoValidSongFound(Exception):
pass
class PlaylistBuilder:
"""
Provides some methods to create solid playlists
"""
def __init__(self, song_library='song-library.json'):
with open(song_library, 'rb') as f:
self.data = json.load(f)
self.song_list = [(item['song'], item['duration']) for item in self.data]
self.songs_used = []
self.playlists = []
self.f = self.get_song_tuple('Rock Me, Amadeus')
self.l = self.get_song_tuple('Hold On Loosely')
self.playlists_to_compare = []
def get_possible_next_songs(self, song):
"""
Accepts a tuple (song, duration)
Returns a list of tuples (valid next song, duration)
"""
valid_songs = []
for item in self.song_list:
if item[0][0].lower() == song[0][-1].lower():
self.song_list.remove(item)
valid_songs.append(item)
if not valid_songs:
message = "No valid songs available, please get more music"
raise NoValidSongFound(message)
return valid_songs
def get_shortest_playlist(self, first_song, last_song, playlist=[]):
"""
Returns one of shortest playlists in terms of number of songs
"""
playlist = playlist or [first_song,]
target_letter = last_song[0][0].lower()
possible_next_songs = self.get_possible_next_songs(playlist[-1])
for item in possible_next_songs:
new_playlist = list(playlist + [item,])
if item[0][-1].lower() == target_letter:
new_playlist.append(last_song)
return new_playlist
if new_playlist not in self.playlists:
self.playlists.append(new_playlist)
for playlist in self.playlists:
self.get_shortest_playlist(playlist, last_song)
def get_song_tuple(self, song_title):
"""
Accepts a song title as a string
Returns a tuple (song title, duration)
"""
for song in self.song_list:
import re
title = re.sub("[^\w ]+", "", song[0]).lower()
song_title = re.sub("[^\w ]+", "", song_title).lower()
if title == song_title:
return song[0], song[1]
message = "No song was found with that title"
raise NoValidSongFound(message)
def get_most_brief_playlist(self, first_song, last_song, playlist=[]):
"""
Returns the most brief playlist in terms of duration of all the valid
shortest playlists in terms of number of songs
"""
playlist = playlist or [first_song,]
target_letter = last_song[0][0].lower()
possible_next_songs = self.get_possible_next_songs(playlist[-1])
for item in possible_next_songs:
new_playlist = list(playlist + [item,])
if item[0][-1].lower() == target_letter:
new_playlist.append(last_song)
self.playlists_to_compare.append(new_playlist)
if new_playlist not in self.playlists:
self.playlists.append(new_playlist)
if self.playlists_to_compare:
result = self.compare_playlists(self.playlists_to_compare)
return result
else:
for playlist in self.playlists:
self.get_most_brief_playlist(playlist, last_song)
def compare_playlists(self, playlists=[]):
tuples = []
for playlist in playlists:
tuples.append(tuple(playlist))
duration = dict([(item, 0) for item in tuples])
for playlist in playlists:
t = tuple(playlist)
for item in playlist:
duration[t] += int(item[1])
return min(duration, key=lambda item: item[1])
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--first-song', dest='first_song', required=True,
help='The desired first song')
parser.add_argument('-l', '--last-song', dest='last_song', required=True,
help='The desired last song')
args = parser.parse_args()
p = PlaylistBuilder()
first_song = p.get_song_tuple(args.first_song)
last_song = p.get_song_tuple(args.last_song)
print p.get_shortest_playlist(first_song, last_song)
<file_sep>/chaining_songs/test_playlist_builder.py
# run this test by using py.test:
# (pip install pytest)
# $> py.test -k test_playlist_builder
from playlist_builder import PlaylistBuilder
def test_playlist_builder():
playlist_builder = PlaylistBuilder()
first_song = 'Rock Me, Amadeus'
last_song = 'Go Tell It on the Mountain'
playlist = playlist_builder.get_shortest_playlist(first_song, last_song)
for index, item in enumerate(playlist):
if index < len(playlist) - 1:
assert item[0][-1].lower() == playlist[index+1][0][0].lower()
<file_sep>/chaining_songs/README.md
Given a starting and ending song, this script connects the two. It selects the
next song so that the first letter is the same as the current song ends in
<file_sep>/counting_words/README.md
Given a stream of text on stdin, report on stdout the number of times each word
appears, sorted by mentions with the most often mentioned word first. Words
will be ordered in lexicographical order
<file_sep>/counting_words/count_words.py
import re
import sys
def count_words(lines):
result = dict()
wordlist = re.findall(r"[\w']+", " ".join(lines))
for item in wordlist:
word = item.lower()
if word not in result:
result[word] = 1
else:
result[word] += 1
# Sort alphabetically
s = sorted(result.items(), key=lambda word: word[0])
# Sort by number of occurrences
s = sorted(s, key=lambda word: -word[1])
return s
if __name__ == '__main__':
stream = sys.stdin
lines = sys.stdin.readlines()
for word, count in count_words(lines):
print word, count
<file_sep>/sample_client/sample_client.py
#!/usr/bin/python
import datetime
import requests
import re
import time
import sys
from lxml import etree
from random import randint
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
HOST = 'XXXX'
PREFIX = 'http://'
URL = 'XXXX'
XPATH_RESULTS_TABLE = '//*[@id="DataGrid1"]'
XPATH_HIDDEN_INPUT_TOKEN = '/html/body/form/input'
XPATH_ORIG_SELECT ='//*[@id="drpOrigin"]'
TABLE_HEADERS = ['ORIG', 'FLT#', 'DEST', 'DEP-DATE', 'DEP-TIME',
'ARR-DATE', 'ARR-TIME', 'A/C']
GET_HEADERS = {
'Host': 'www2.alpa.org',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
}
POST_HEADERS = {
'Accept': 'text/html,application/xhtml+xml,application/xml; q=0.9,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-US,en;q=0.5',
'Connection': 'keep-alive',
'Host': 'www2.alpa.org',
'Referer': 'http://www2.alpa.org/fdx/jumpseat/Default.aspx',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0',
}
class Client:
"""
Provides some methods to interact with Alpa's website
"""
def __init__(self):
self.host = HOST
self.baseurl = PREFIX + HOST
self.url = self.baseurl + URL
def get_date_from_input_file(self):
'''
Reads the date from an input file. It must be in the first line.
The format must be xx-xx-xxxx
'''
# with statement automatically closes the file when the block ends
with open('date.txt') as datefile:
date = datefile.readline().strip()
if not re.match('\d\d-\d\d-\d\d\d\d', date):
raise Exception, 'date.txt must contain one date xx-xx-xxxx'
return date
def get_initial_data(self, celery_task=None):
"""
Do a GET request and parse it to get the hidden input token and the
list of possible departure airports. Returns a dict.
"""
if celery_task and not celery_task.default_retry_delay == 180:
raise Exception, 'celery_task must be a celery task'
r = requests.get(self.url, headers=GET_HEADERS)
# Wait between 5 and 10 seconds after each request
print 'GET request done, waiting 5 seconds and parsing data...'
meta_dict = {'status': 'running',
'progress': '1',
'info': 'GET request done, ' +
'waiting 5 seconds and parsing data...',}
if celery_task:
celery_task.update_state(state="PROGRESS", meta=meta_dict)
time.sleep(randint(5, 10))
html = etree.HTML(r.text)
hidden_input = html.xpath(XPATH_HIDDEN_INPUT_TOKEN)[0]
originating_in_select = html.xpath(XPATH_ORIG_SELECT)[0]
token = hidden_input.get('value')
opts = originating_in_select.xpath('option')
c = len(opts)
print 'This will take around', c*10/60, 'minutes (' + str(c), 'locations)'
if celery_task:
meta_dict = {
'status': 'running',
'progress': '1',
'info': 'This will take around ' + str(c*10/60) +
' minutes (' + str(c) + ' airports)',}
celery_task.update_state(state="PROGRESS", meta=meta_dict)
results = {'token': token, 'departure_airports': opts,}
return results
def get_flights_originating_from_all_airports_in_one_date(self, date,
celery_task=None):
'''
Returns a list of rows with all the data. meta is an optional dict
which will be updated with progress info.
'''
if not re.match('\d\d-\d\d-\d\d\d\d', date):
raise Exception, 'date must be in the format xx-xx-xxxx'
if celery_task and not celery_task.default_retry_delay == 180:
raise Exception, 'celery_task must be a celery task'
payload = {}
# Do GET request to get initial data
try:
initial_data = self.get_initial_data(celery_task=celery_task)
except:
raise Exception('Could not get initial data, ' +
'Is the site up and running? ' +
'Are you connected to the internet?')
# Fields for the other two forms
today_str = datetime.date.strftime(datetime.date.today(), "%m/%d/%Y")
payload['drpArrive'] = 'ABE'
payload['drpFrom'] = 'ABE'
payload['drpTo'] = 'ABE'
payload['drpLegs'] = '3'
payload['Text1'] = '0'
payload['Text2'] = '5'
payload['Text3'] = '12'
payload['drpOn2'] = today_str
payload['drpOn3'] = today_str
# These fields seem to be sending the coordinates of the mouse pointer
# relative to the image button. Make them random
payload['ImageButton1.x'] = randint(5, 35)
payload['ImageButton1.y'] = randint(5, 35)
date = re.sub('-', '/', date)
date = re.sub('-', '/', date)
payload['drpOn1' ] = date
# Hidden input token
payload['__VIEWSTATE'] = initial_data.get('token')
# Get data for all originating airports
tables = {}
total = len(initial_data.get('departure_airports'))
count = 0
for airport in initial_data.get('departure_airports'):
count += 1
percentage = count * 100 / total
payload['drpOrigin'] = airport.get('value')
r = requests.post(self.url, data=payload, headers=POST_HEADERS)
if celery_task:
meta_dict = {
'status': 'running',
'progress': percentage,
'info': 'Locations: <span style="text-align:left;">'
+ str(total) + '</span><br />Loaded: ' +
'<span style="text-align:left;">' + str(count) +
'<br />Left: <span style="text-align:left;">' +
str(total - count) + ' ≈ ' +
str((total - count) * 10 / 60) + ' minutes</span>',
}
celery_task.update_state(state="PROGRESS", meta=meta_dict)
#sys.stdout.write(
# 'POST request for ' + payload['drpOrigin'] + ' done, ' +
# str(total - count) + ' left (' + str(percentage) +
# '%) \r')
#sys.stdout.flush()
time.sleep(randint(5, 10))
html = etree.HTML(r.text)
try:
tables[airport.get('value')] = html.xpath(XPATH_RESULTS_TABLE)[0]
except:
pass
print
#TODO: include a check to confirm that tabe headers match
res = self.join_tables(tables)
return res
def join_tables(self, tables):
'''
Builds a single table with all the data.
@param tables Dict with keys=airport names and values=html tables
@return List of rows
'''
results = [TABLE_HEADERS,]
for airport, table in tables.items():
for row in table.xpath('tr')[1:]:
temp_dict = {'ORIG': airport,}
for i, cell in enumerate(row.xpath('td')):
key = table.xpath('tr')[0].xpath('td')[i].text
temp_dict[key] = cell.text
results.append([temp_dict.get(item) for item in TABLE_HEADERS])
return results
def write_to_file(self, row_list):
date = re.sub('/', '-', self.get_date_from_input_file())
with open('results.fedex.' + date + '.txt', 'wb') as f:
for row in row_list:
f.write(','.join(row) + '\n')
if __name__ == '__main__':
if len(sys.argv) > 1:
print 'This script takes no arguments'
sys.exit(1)
else:
c = Client()
date = c.get_date_from_input_file()
rows = c.get_flights_originating_from_all_airports_in_one_date(date)
c.write_to_file(rows)
<file_sep>/counting_words/test_count_words.py
# run this test by using py.test:
# (pip install pytest)
# $> py.test -k test_count_words
from count_words import count_words
def test_count_words():
lines = [
"Little pig, let me come in.",
"No, no, no, no, not by the hair on my little chin chin.",
]
expected_top_three = [('no', 4), ('chin', 2), ('little', 2)]
assert count_words(lines)[:3] == expected_top_three
| 1ec1521c3db0d914d2eb1c452a763193e5761af2 | [
"Markdown",
"Python"
] | 7 | Python | e/experiments | b895018f8146f03f2cb8e4147aca188d3849ee54 | ea282300bf14b5c28bb52f9ac63e12da7d9f231f |
refs/heads/master | <repo_name>belamorris/clicky-game<file_sep>/src/App.js
import React, { Component } from "react";
import { Shake } from "reshake";
import CharacterCard from "./components/CharacterCard";
import Wrapper from "./components/Wrapper";
import Navbar from "./components/Navbar";
import Footer from "./components/Footer";
import characters from "./characters.json";
import Instructions from "./components/Instructions";
import ScoreBoard from "./components/ScoreBoard";
class App extends Component {
// Set our state variables
state = {
guessArray: [],
message: "Click image to begin!",
score: 0,
topScore: 0,
shake: 0
};
// Card is clicked
clickCard = card => {
let guessArray = this.state.guessArray;
let score = this.state.score;
// If we already clicked this card...
if (guessArray[card.id]) {
this.setState({
message: "Game Over!",
topScore: Math.max(this.state.score, this.state.topScore),
guessArray: [],
score: 0,
shake: 0.55 // Shake screen for 0.75 seconds
})
// Otherwise it was a good guess!
}
else {
guessArray[card.id] = true;
this.setState({
message: "Good Job!",
guessArray: guessArray,
score: ++score,
shake: 0
}, () => {
if (this.state.score === 12) {
this.setState({
message: "You Won!",
topScore: Math.max(this.state.score, this.state.topScore),
guessArray: [],
score: 0,
})
}
})
}
}
// Render the page
render() {
return (
<div>
<Navbar message={this.state.message} />
<Instructions />
<ScoreBoard
score={this.state.score}
topScore={this.state.topScore} />
{/* Use "reshake" to shake the page on a wrong answer */}
<Shake h={25} v={10} r={5} q={this.state.shake} dur={650} int={2.6} max={40} fixed={true} fixedStop={false} freez={false}>
<Wrapper>
{characters
.sort((a, b) => 0.5 - Math.random())
.map(randomCard => (
<CharacterCard
clickCard={this.clickCard}
id={randomCard.id}
key={randomCard.id}
image={randomCard.image} />))}
</Wrapper>
</Shake>
<Footer />
</div>
);
}
}
export default App;<file_sep>/src/components/ScoreBoard/ScoreBoard.js
import React from "react";
import "./ScoreBoard.css";
// Footer component
const ScoreBoard = props => (
<div className="stickyScoreBoard animated hoverable">
<h5 className="text-white bold text-center">Score<p></p>{props.score}
<hr/>Best<p></p>{props.topScore}</h5></div>
);
export default ScoreBoard;<file_sep>/src/components/Navbar/Navbar.js
import React from "react";
import "./Navbar.css";
const Navbar = props => (
<nav className="navbar fixed-top navbar-dark navbar-custom p-3">
<span className="navbar-text text-white bold animated bounceIn">{props.message}</span>
</nav>
);
export default Navbar; | d7dc1f07dab1eff082270eca95ecac25497586c3 | [
"JavaScript"
] | 3 | JavaScript | belamorris/clicky-game | 751f1c56a22a0dbcb2d0b92284bde7c963154a57 | c1813a5353de3246f922672c397d2a5a273ab76e |
refs/heads/master | <file_sep>package com.domo.refresh;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.io.IOException;
public class DimRefresh
{
private WebDriver driver;
public DimRefresh()
{
System.setProperty( "webdriver.chrome.driver", "chrome/chromedriver.exe" );
driver = new ChromeDriver();
try
{
dim_agency();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_adjustment();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_agreement();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_date();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_deposit();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
}
catch( InterruptedException e )
{
e.printStackTrace();
}
catch( IOException e )
{
e.printStackTrace();
}
}
public void dim_agency() throws InterruptedException, IOException
{
driver.manage().window().maximize();
driver.get( "https://abcfinancial.domo.com/auth/index" );
// step to login domo UI
WebElement username = driver.findElement( By.name( "username" ) );
WebElement password = driver.findElement( By.name( "<PASSWORD>" ) );
WebElement login = driver.findElement( By.name( "submit" ) );
username.sendKeys( Utility.getProperties().getProperty( "user" ) );
password.sendKeys( Utility.getProperties().getProperty( "password" ) );
login.click();
driver.get( Utility.URL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_agency" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement(
By.xpath( Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_agency" ) + "')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM dim.agency \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT * FROM dim.agency \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'agency_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
public void dim_adjustment() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_adjustment" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_adjustment" ) +
"')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM dim.adjustment \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT * FROM dim.adjustment \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'adjustment_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
public void dim_agreement() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// driver.findElement( By.linkText( Utility.DATA ) ).click();
// Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// driver.findElement( By.linkText( Utility.DATA ) ).click();
// Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_agreement" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_agreement" ) +
"')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM domo.dim_agreement \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT * FROM domo.dim_agreement \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'agreement_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
public void dim_date() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// driver.findElement( By.linkText( Utility.DATA ) ).click();
// Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// driver.findElement( By.linkText( Utility.DATA ) ).click();
// Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_date" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_date" ) +
"')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
}
public void dim_deposit() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// driver.findElement( By.linkText( Utility.DATA ) ).click();
// Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// driver.findElement( By.linkText( Utility.DATA ) ).click();
// Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_deposit" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_deposit" ) +
"')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM dim.deposit \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT * FROM dim.deposit \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'deposit_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
}
<file_sep>package com.domo.refresh;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.io.IOException;
public class DimRefresh1
{
private WebDriver driver;
DimRefresh1()
{
System.setProperty( "webdriver.chrome.driver", "chrome/chromedriver.exe" );
driver = new ChromeDriver();
try
{
dim_subscription();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_member();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_employee();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_fee();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
dim_invoice();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
}
catch( InterruptedException e )
{
e.printStackTrace();
}
catch( IOException e )
{
e.printStackTrace();
}
}
public void dim_subscription() throws InterruptedException, IOException
{
driver.manage().window().maximize();
driver.get( "https://abcfinancial.domo.com/auth/index" );
// step to login domo UI
WebElement username = driver.findElement( By.name( "username" ) );
WebElement password = driver.findElement( By.name( "<PASSWORD>" ) );
WebElement login = driver.findElement( By.name( "submit" ) );
username.sendKeys( Utility.getProperties().getProperty( "user" ) );
password.sendKeys( Utility.getProperties().getProperty( "password" ) );
login.click();
driver.get( Utility.URL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_subscription" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement(
By.xpath( Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_subscription" ) + "')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM dim.subscription \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT *\n" +
"FROM dim.subscription \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'subscription_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
public void dim_member() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_member" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_member" ) +
"')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM dim.member \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT * FROM dim.member \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'member_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
public void dim_employee() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_employee" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_employee" ) +
"')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT CAST(employee_key AS INT) AS employee_key,\n" +
" employee_alt_id,\n" +
" employee_id,\n" +
" employee_name,\n" +
" employee_first_name,\n" +
" employee_last_name,\n" +
" employee_birth_date,\n" +
" employee_age_range_id,\n" +
" employee_age_range,\n" +
" employee_generation_id,\n" +
" employee_generation,\n" +
" employee_address_id,\n" +
" employee_address_line_1,\n" +
" employee_address_line_2,\n" +
" employee_city,\n" +
" employee_state_code,\n" +
" employee_state,\n" +
" employee_postal_code,\n" +
" employee_country,\n" +
" employee_organization_id,\n" +
" employee_organization_name,\n" +
" employee_email,\n" +
" employee_phone,\n" +
" employee_phone_extension,\n" +
" employee_created_utc_date,\n" +
" deactivated_flag,\n" +
" -- source_key,\n" +
" source_change_date,\n" +
" data_warehouse_change_date,\n" +
" effective_date --,\n" +
" -- effective_date,\n" +
" -- expiration_date,\n" +
" -- current_flag\n" +
"FROM dim.employee ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT CAST(employee_key AS INT) AS employee_key,\n" +
" employee_alt_id,\n" +
" employee_id,\n" +
" employee_name,\n" +
" employee_first_name,\n" +
" employee_last_name,\n" +
" employee_birth_date,\n" +
" employee_age_range_id,\n" +
" employee_age_range,\n" +
" employee_generation_id,\n" +
" employee_generation,\n" +
" employee_address_id,\n" +
" employee_address_line_1,\n" +
" employee_address_line_2,\n" +
" employee_city,\n" +
" employee_state_code,\n" +
" employee_state,\n" +
" employee_postal_code,\n" +
" employee_country,\n" +
" employee_organization_id,\n" +
" employee_organization_name,\n" +
" employee_email,\n" +
" employee_phone,\n" +
" employee_phone_extension,\n" +
" employee_created_utc_date,\n" +
" deactivated_flag,\n" +
" -- source_key,\n" +
" source_change_date,\n" +
" data_warehouse_change_date,\n" +
" effective_date --,\n" +
" -- effective_date,\n" +
" -- expiration_date,\n" +
" -- current_flag\n" +
"FROM dim.employee \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'employee_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
public void dim_fee() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_fee" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAME + Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_fee" ) +
"')]" ) );
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM dim.fee \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT * FROM dim.fee \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'fee_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
public void dim_invoice() throws InterruptedException, IOException
{
driver.get( Utility.SECONDURL );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement field = driver.findElement( By.id( Utility.SUPERSEARCH1 ) );
field.sendKeys( Keys.CONTROL + "a" );
field.sendKeys( Keys.DELETE );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
field.sendKeys( Utility.getProperties().getProperty( "environment" ) + "_" + Utility.getProperties().getProperty( "dim_invoice" ) );
field.sendKeys( Keys.ENTER );
field.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open staging_dim_agency_job
WebElement w = driver.findElement( By.xpath(
Utility.SEARCHDATANAMEINVOICE ));
w.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to open settings tab
WebElement settings = driver.findElement( By.xpath( Utility.SETTINGS ) );
settings.click();
WebElement details = driver.findElement( By.xpath( Utility.DETAILS ) );
details.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
q.click();
WebElement query = driver.findElement(
By.xpath( Utility.CHANGEQUERY ) );
query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt.clear();
txt.sendKeys( "SELECT *\n" +
"FROM dim.invoice \n" +
"ORDER BY data_warehouse_change_date ;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch = driver.findElement( By.xpath( Utility.SELECTREPLACE ) );
sch.click();
WebElement update_mode = driver.findElement(
By.xpath( Utility.CHANGEREPLACE ) );
update_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement btn_replace_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_replace_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to run query on the script
WebElement i_click = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click.click();
WebElement run_query = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query.click();
// step -1 completed and wait to 30 sec.
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
// step-2 reverse script to run
WebElement details2 = driver.findElement( By.xpath( Utility.DETAILS ) );
details2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement q2 = driver.findElement( By.xpath( Utility.DETAILSINPUT1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
q2.click();
WebElement queryPara = driver.findElement( By.xpath( Utility.CHANGEQUERYPARAMETER ) );
queryPara.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement txt2 = driver.findElement( By.xpath( Utility.QUERYTEXT ) );
txt2.clear();
txt2.sendKeys( "SELECT * FROM dim.invoice \n" +
"WHERE data_warehouse_change_date > !{lastvalue:data_warehouse_change_date}!\n" +
"ORDER BY data_warehouse_change_date;" );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
// step to save setting details
WebElement btn2 = driver.findElement( By.xpath( Utility.SAVEDETAILS ) );
btn2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement scheduling2 = driver.findElement( By.xpath( Utility.SCHEDULING ) );
scheduling2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
driver.findElement( By.xpath( Utility.BASICSCHEDULLING ) ).click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement change_update_setting_query2 = driver.findElement( By.xpath( Utility.CHANGEUPDATESETTING ) );
change_update_setting_query2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement sch2 = driver.findElement( By.xpath( Utility.SELECTREPLACE1 ) );
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
sch2.click();
WebElement update_mode2 = driver.findElement(
By.xpath( Utility.CHANGEMERGE ) );
update_mode2.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "dim_run" ) ) );
WebElement search = driver.findElement( By.xpath( Utility.SAVEMERGE ) );
search.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement select_mode = driver.findElement(
By.xpath( "//*[@class= 'ListItem-module_contentText__b6_eH']//div[contains(text(), 'invoice_key')]" ) );
select_mode.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
WebElement btn_merge_save = driver.findElement( By.xpath( Utility.SAVEREPLACE ) );
btn_merge_save.click();
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "other" ) ) );
// step to save scheduling setting
WebElement btn_scheduling_save2 = driver.findElement( By.xpath( Utility.SAVECHANGEUPDATESETTING ) );
btn_scheduling_save2.click();
// step to run query on the script
Thread.sleep( Long.parseLong( Utility.getProperties().getProperty( "common" ) ) );
WebElement i_click2 = driver.findElement( By.xpath( Utility.BEFORERUNNOW ) );
i_click2.click();
WebElement run_query2 = driver.findElement( By.xpath( Utility.RUNNOW ) );
run_query2.click();
}
}
<file_sep>user=
password=
environment = staging
dim_run =30000
drill_run=120000
common=4000
other=2000
dim_adjustment=dim_adjustment
dim_agency=dim_agency
dim_agreement=dim_agreement
dim_date=dim_date
dim_deposit=dim_deposit
dim_employee=dim_employee
dim_fee=dim_fee
dim_invoice=dim_invoice
dim_invoice_number=dim_invoice_number
dim_item=dim_item
dim_location=dim_location
dim_member=dim_member
dim_organization=dim_organization
dim_payment=dim_payment
dim_payor=dim_payor
dim_settlement=dim_settlement
dim_source=dim_source
dim_subscription=dim_subscription
dim_transaction_type=dim_transaction_type
delinquent_snapshot=delinquent_snapshot
drill_across_client_account_trans=drill_across_client_account_trans
drill_across_invoice_payment_goal_trans=drill_across_invoice_payment_goal_trans
drill_across_member_facts=drill_across_member_facts
drill_across_subscription_goal_trans=drill_across_subscription_goal_trans | 5d738f64a1895b4db62a21251027c6cadae819dd | [
"Java",
"INI"
] | 3 | Java | vikramshekhawat/Automatic_refresh | c756f724d2a43c21257741300f31f66de8911e08 | 722f6bfd235d09253273ca26b7dde82a25ef7610 |
refs/heads/master | <repo_name>montygoldy/moviereview<file_sep>/README.md
This is a sample rails movie review app<file_sep>/app/controllers/reviews_controller.rb
class ReviewsController < ApplicationController
before_action :find_review, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
before_action :set_movie
def new
@review = Review.new
end
def create
@review = Review.new review_params
@review.user_id = current_user.id
@review.movie_id = @movie.id
if @review.save
redirect_to @movie
else
render 'new'
end
end
def edit
end
def update
if @review.update review_params
redirect_to @movie
else
render 'edit'
end
end
def destroy
@review.destroy
redirect_to reviews_path
end
private
def find_review
@review = Review.find(params[:id])
end
def set_movie
@movie = Movie.find(params[:movie_id])
end
def review_params
params.require(:review).permit(:rating, :comment)
end
end
| 675c09c8edcc019f8e956bef7fa5f52e923cb6c8 | [
"Markdown",
"Ruby"
] | 2 | Markdown | montygoldy/moviereview | eb4b2a0d0871470146ba0062a46d06d58dcd292c | 40760490a4cd2689e4475afbc6e6414f9a539314 |
refs/heads/main | <file_sep>package com.finago.interview.task.service;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DirectoryWatchService {
private final WatchService watcher;
private final Map<WatchKey, Path> keys;
private final String rootDirectory;
Logger logger = Logger.getLogger(DirectoryWatchService.class.getName());
public DirectoryWatchService(String rootDirectory) throws IOException {
this.rootDirectory = rootDirectory;
Path dir = Paths.get(rootDirectory + "in/");
this.watcher = FileSystems.getDefault().newWatchService();
this.keys = new HashMap<>();
walkAndRegisterDirectories(dir);
}
private void walkAndRegisterDirectories(final Path start) throws IOException {
Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
registerDirectory(dir);
return FileVisitResult.CONTINUE;
}
});
}
private void registerDirectory(Path dir) throws IOException {
WatchKey key = dir.register(watcher, ENTRY_CREATE);
keys.put(key, dir);
}
public void processEvents() throws IOException {
WatchKey key;
do {
logger.log(Level.INFO, "*beep boop* ...processing data... *beep boop*");
try {
key = watcher.take();
Path dir = keys.get(key);
if (dir == null) {
System.err.println("WatchKey not recognized!!");
continue;
}
for (WatchEvent<?> event : key.pollEvents()) {
@SuppressWarnings("rawtypes")
WatchEvent.Kind kind = event.kind();
@SuppressWarnings("unchecked")
Path name = ((WatchEvent<Path>)event).context();
Path path = dir.resolve(name);
logger.log(Level.INFO, event.kind().name() + ": " + path + "\n");
if (kind == ENTRY_CREATE) {
FileProcessor fileProcessor = new FileProcessor(rootDirectory);
fileProcessor.process(path);
}
}
boolean valid = key.reset();
if (!valid) {
keys.remove(key);
if (keys.isEmpty()) {
break;
}
}
} catch (InterruptedException x) {
return;
}
} while (true);
}
}<file_sep>package com.finago.interview.task;
import com.finago.interview.task.service.DirectoryWatchService;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
/**
* Unit test for BatchProcessor.
*/
public class BatchProcessorTest extends TestCase {
@Before
protected void setUp() throws InterruptedException {
File rootDirectory = new File("data/in/");
File outDirectory = new File("data/out/");
File directory = new File("src/test/root/");
final String rootPath = directory.getAbsolutePath();
Path watchDirectory = Paths.get(rootPath + "/in/");
moveFiles(rootDirectory, watchDirectory);
Killable task = new Killable();
Thread thread = new Thread(task);
thread.start();
TimeUnit.SECONDS.sleep(10);
task.kill();
thread.interrupt();
}
@Test
public void testsOutputFolder() throws InterruptedException {
File outDirectory0 = new File("data/out/0");
File outDirectory1 = new File("data/out/1");
assertTrue(outDirectory0.exists());
assertTrue(outDirectory1.exists());
String[] pathnames = outDirectory0.list();
assert pathnames != null;
assertEquals(pathnames.length, 8);
File firstIn0 = new File("data/out/0/8842");
assertTrue(firstIn0.exists());
String[] files = firstIn0.list();
assert files != null;
assertEquals(files.length, 4);
}
private void moveFiles(File rootDirectory, Path watchDirectory) {
new Timer().schedule(
new TimerTask() {
@Override
public void run() {
try {
Files.move(Paths.get(rootDirectory.getAbsolutePath() + "/"), watchDirectory, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
}
},
5000
);
}
static class Killable implements Runnable {
private volatile boolean killed = false;
public void run() {
while (!killed) {
try {
doOnce();
} catch (InterruptedException | IOException ex) {
killed = true;
}
}
}
public void kill() {
System.out.println("Killing service called");
killed = true;
}
private void doOnce() throws InterruptedException, IOException {
File directory = new File("src/test/root/");
new DirectoryWatchService(directory.getAbsolutePath() + "/").processEvents();
}
}
}<file_sep>FROM adoptopenjdk:14-jre-hotspot
RUN mkdir /opt/batch-processor \
&& mkdir /opt/batch-processor/data \
&& mkdir /opt/batch-processor/data/in\
&& mkdir /opt/batch-processor/data/out\
&& mkdir /opt/batch-processor/data/error\
&& mkdir /opt/batch-processor/data/archive
COPY ./target/batch-processor-1.0-SNAPSHOT-jar-with-dependencies.jar /opt/batch-processor
WORKDIR /opt/batch-processor
CMD ["java", "-jar", "batch-processor-1.0-SNAPSHOT-jar-with-dependencies.jar"]<file_sep>package com.finago.interview.task.service;
import com.finago.interview.task.modal.Receiver;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import static java.util.Comparator.comparing;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;
public class FileProcessor {
final String INPUT_DIRECTORY;
final String OUTPUT_DIRECTORY;
final String ERROR_DIRECTORY;
final String rootDirectory;
CreateXMLFile createXMLFile;
ArrayList<Receiver> receivers;
Logger logger;
public FileProcessor(String rootDirectory) {
this.rootDirectory = rootDirectory;
createXMLFile = new CreateXMLFile();
receivers = new ArrayList<>();
logger = Logger.getLogger(FileProcessor.class.getName());
INPUT_DIRECTORY = rootDirectory + "in/";
OUTPUT_DIRECTORY = rootDirectory + "out/";
ERROR_DIRECTORY = rootDirectory + "error/";
}
public void process(Path path) throws IOException {
final String filePath = path.toString();
try {
if (filePath.toLowerCase().endsWith(".xml")) {
parseXmlAndUpdateReceivers(filePath);
moveToDirectory();
String newPath = filePath.replace("/in/", "/archive/");
Files.move(Paths.get(filePath), Paths.get(newPath), StandardCopyOption.REPLACE_EXISTING);
deleteProcessedFiles();
}
} catch (ParseException e) {
logger.log(Level.WARNING, filePath + " file was corrupted");
}
}
private void parseXmlAndUpdateReceivers(String path) throws IOException, ParseException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(path);
doc.getDocumentElement().normalize();
NodeList list = doc.getElementsByTagName("receiver");
for (int temp = 0; temp < list.getLength(); temp++) {
Node node = list.item(temp);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
String id = element.getElementsByTagName("receiver_id").item(0).getTextContent();
String firstname = element.getElementsByTagName("first_name").item(0).getTextContent();
String lastname = element.getElementsByTagName("last_name").item(0).getTextContent();
String file = element.getElementsByTagName("file").item(0).getTextContent();
String hash = element.getElementsByTagName("file_md5").item(0).getTextContent();
Receiver receiver = new Receiver(Integer.parseInt(id), firstname, lastname, file, hash);
receivers.add(receiver);
}
}
} catch (ParserConfigurationException | SAXException ex) {
logger.log(Level.FINE, "file corrupted: " + path);
String newPath = path.replace("/in/", "/error/");
Files.move(Paths.get(path), Paths.get(newPath), StandardCopyOption.REPLACE_EXISTING);
throw new ParseException("file corrupted", 0);
}
}
private void moveToDirectory() {
receivers.forEach(receiver -> {
final Boolean isValid = checkPdf(receiver.getFile(), receiver.getHash());
String receiverId = receiver.getId();
logger.log(Level.INFO, "Starting to move files for receiver id " + receiverId);
int innerDirectory = Integer.parseInt(receiverId);
int outerDirectory = innerDirectory % 100 / innerDirectory;
String outputPath = (isValid ? OUTPUT_DIRECTORY : ERROR_DIRECTORY) + outerDirectory;
String destinationDirectory = outputPath + '/' + innerDirectory;
createDirectory(outputPath);
createDirectory(destinationDirectory);
final String fileName = receiver.getFile();
final String inputPath = INPUT_DIRECTORY + fileName;
try {
Files.copy(Paths.get(inputPath), Paths.get(destinationDirectory + '/' + fileName), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
logger.log(Level.WARNING, "pdf file " + fileName + " missing");
outputPath = ERROR_DIRECTORY + outerDirectory;
destinationDirectory = outputPath + '/' + innerDirectory;
}
createXMLFile.createFile(receiver, destinationDirectory);
});
}
private void deleteProcessedFiles() {
receivers.stream()
.collect(collectingAndThen(toCollection(() -> new TreeSet<>(comparing(Receiver::getFile))), ArrayList::new))
.forEach(receiver -> {
final String fileName = receiver.getFile();
final String inputPath = INPUT_DIRECTORY + fileName;
try {
Files.delete(Paths.get(inputPath));
} catch (IOException e) {
logger.log(Level.SEVERE, "Unable to delete processed file: " + fileName);
}
});
}
private Boolean checkPdf(String fileName, String hash) {
try {
File file = new File(INPUT_DIRECTORY + fileName);
MessageDigest md5Digest = MessageDigest.getInstance("MD5");
String checksum = getFileChecksum(md5Digest, file);
boolean check = checksum.equals(hash);
logger.log(Level.INFO, fileName + " checksum did match with hash value: " + check);
return check;
} catch (NoSuchAlgorithmException | IOException e) {
logger.log(Level.SEVERE, "Unable to check if the " + fileName + " is corrupt");
}
return false;
}
private boolean createDirectory(String path) {
File file = new File(path);
return file.mkdir();
}
private static String getFileChecksum(MessageDigest digest, File file) throws IOException {
FileInputStream fis = new FileInputStream(file);
byte[] byteArray = new byte[1024];
int bytesCount;
while ((bytesCount = fis.read(byteArray)) != -1) {
digest.update(byteArray, 0, bytesCount);
}
fis.close();
byte[] bytes = digest.digest();
StringBuilder sb = new StringBuilder();
for (byte aByte : bytes) {
sb.append(Integer.toString((aByte & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
}
}
<file_sep># Background
This project is meant an interview task for programmers who are applying for a position in Accountor Finago Oy.
# Task
The idea is to create a simple batch processor. Your program receives a bunch of PDF and XML files. Within the given XML files, you're supposed to find the receivers for PDF files and move them accordingly in the folder structure.
## Functional requirements
Within the provided files, you should see a `data` folder:
```
└── data
├── archive
├── error
├── in
└── out
```
The program receives XML and PDF files to the `in` folder. PDF are to be delivered to the customers and XML files provide information to make it possible:
```
<receivers>
<receiver>
<receiver_id>8842</receiver_id>
<first_name>John</first_name>
<last_name>Smith</last_name>
<file>6723451234.pdf</file>
<file_md5>d41d8cd98f00b204e9800998ecf8427e</file_md5>
</receiver>
<receiver>
...
</receiver>
...
</receivers>
```
You've been provided with example files. They are in the `in` folder.
Your program should:
1. Monitor the `in` folder.
1. Once an XML file and its PDF files are received, process them.
1. When all files have been processed, resume to monitoring the `in` folder for new files.
Processing an XML file:
1. If the XML file is invalid, move it to the `error` folder and stop processing it.
1. Otherwise, read a `receiver` block from the received XML file.
1. Find the PDF file belonging to that receiver.
1. Check if the PDF file is uncorrupted with the given MD5 checksum.
1. If the PDF file is OK:
1. Copy it to a subfolder in the `out` folder. The subfolder should be `receiver_id mod 100 / receiver_id`.
1. Write to the same subfolder an XML file containing only corresponding `receiver` block. Use the name of the PDF file.
1. See the example below.
1. If the PDF file is corrupted, do the same steps as above but create the subfolder in the `error` folder.
1. If the PDF file is missing, do the same steps as with a corrupted file but write only the XML file.
1. Once the received XML file has been completely processed:
1. Move the XML file from the `in` folder to the `archive` folder.
1. Delete all PDF files used in the XML file from the `in` folder.
A starting situation (with one file and receiver) for the examples:
```
└── data
├── archive
├── error
├── in
| ├── 6723450001.xml
| └── 6723451234.pdf
└── out
```
An example of a successfully received and handled PDF file:
```
└── data
├── archive
| └── 6723450001.xml
├── error
├── in
└── out
└── 42
└── 8842
├── 6723451234.pdf
└── 6723451234.xml
```
An example if the PDF file is corrupted:
```
└── data
├── archive
| └── 6723450001.xml
├── error
| └── 42
| └── 8842
| ├── 6723451234.pdf
| └── 6723451234.xml
├── in
└── out
```
An example if the PDF file is missing:
```
└── data
├── archive
| └── 6723450001.xml
├── error
| └── 42
| └── 8842
| └── 6723451234.xml
├── in
└── out
```
It is guaranteed to you that:
1. All files delivered to the `in` folder have a unique name.
1. PDF files are delivered before the XML file they belong to. This means that once an XML file is readable, we will not provide more PDF files for it.
1. When a file becomes accessible, it's completely written. I.e. you don't have to worry about other processes modifying the files while your program is reading them.
1. One or more receivers can receive the same PDF file, but only within the same XML file. Two XML files will never share the same PDF files.
## Technical requirements
The result should adhere to following requirements:
1. The project should be build, packaged and managed by Apache Maven.
1. The application should be "Dockerized", i.e. it should be run from within a Docker container.
1. The application should run in JVM.
As a starting point, you're provided with a Dockerfile that will:
1. Use a base image that provides you a Java 14 JRE installation.
1. Creates a folder in the container for the application.
1. Creates "data" folder into the programs's folder.
1. The files to be processed are mounted to this folder.
1. Copies the application's JAR with dependencies into ("fat/über jar") it and runs the JAR file.
1. "batch-processor-1.0-SNAPSHOT-jar-with-dependencies.jar" in the target folder.
Also, there is a simple Maven project that provides a starting location for the project. It's pom.xml will:
1. Set the Java version to 14.
1. Source encoding to UTF-8.
1. Create the JAR with dependencies during the package phase.
Feel free to modify both Dockerfile and pom.xml to fit your needs. Just notice two things:
1. Use Docker Official Images.
1. Use the Maven default repository (Maven Central).
1. We should be able to mount our `data` folder to be processed by the application.
## Other requirements/tips
You can use whatever IDE, formatting/coding style, dependencies you like to.
Notice that solving the problem is only a part of the task. We're also interested to see your coding style, for example how you've done error handling, logging, program flow, class/method naming, dependency selection etc.
# Running the "skeleton" project
If you want to run the provided example project, do the following:
1. Navigate to the folder containing the `pom.xml` file.
1. Run: `mvn package`
1. Run: `docker build -t batch-processor .`
1. Run: `docker run batch-processor`
1. You should see in the console this message: `*beep boop* ...processing data... *beep boop*`
Notice that you will have to install Java, Maven, Docker etc. tools to your computer yourself. Those are not instructed here.
| 9444148d22295d1b452c3f4dbcb4129a2a9753dc | [
"Markdown",
"Java",
"Dockerfile"
] | 5 | Java | snhariharan/batch-processor | e56c1c9d8b24581b44169aa9268b5c1e8ea2e027 | 6e6435ef731dcf5b0dbfdb285b50f440bff7a7df |
refs/heads/master | <repo_name>kangbb/todolist<file_sep>/README.md
# TODOLIST

<br/>一个简单的网站demo。
## 主要特点
1. 完全自动化部署:Travis CLI持续集成+阿里云docker容器服务+阿里云ECS主机
2. 使用docker及docker-compose快速编排服务
3. golang作为后台语言
4. mysql实现主从服务配置
5. ngix实现反向代理
## 项目内容说明
- `core/`:后端服务核心,controller处理前端请求,service提供数据库服务,models定义数据模型
- `front_end/`:前端文件,基于Vue
- `mysql/`:主从配置相关文件。包括mysql的构建文件及docker-compose.yml文件
- `nginx/`:nginx相关配置文件
- `static/`:Vue编译生成的真正的端文件
- `main.go`: 后端程序入口文件
- `docker-compose.yml`:部署应用及nginx
- `Dockerfile`:生成镜像
- `.travis.yml`:自动集成及部署文件
## 其他
如何使用travis cli免密登录服务器?
>[一点都不高大上,手把手教你使用Travis CI实现持续部署](https://zhuanlan.zhihu.com/p/25066056)
如何加密密钥?通过travis-cli运行如下命令:
```
$ travis encrypt-file ~/.ssh/id_rsa --add
```
如何在docker容器内部使用中文?例如:
```
docker run -it --rm --net host mysql:latest env LANG=C.UTF-8 /bin/bash
```
## ngnix配置问题
如果使用docker 镜像,一定要同时映射两个端口:`80`和`443`.<file_sep>/core/models/entities/entities.go
package entities
// ItemInfo store project information
type ItemInfo struct {
ItemID int `xorm:"autoincr pk 'item_id'"`
Label string
IsFinished bool
CreateAt string
}
//go xorm reflect regular
//define the table name as 'items'
func (u ItemInfo) TableName() string {
return "items"
}
<file_sep>/mysql/update.sh
docker rmi registry-vpc.cn-shenzhen.aliyuncs.com/selfmysql/master
docker rmi registry-vpc.cn-shenzhen.aliyuncs.com/selfmysql/slave
docker pull registry-vpc.cn-shenzhen.aliyuncs.com/selfmysql/master
docker pull registry-vpc.cn-shenzhen.aliyuncs.com/selfmysql/slave
docker-compose up -d
docker ps<file_sep>/core/models/service/service_test.go
package service
import (
"testing"
"time"
)
func TestNewItem(t *testing.T) {
tm := time.Now()
tmstr := tm.Format("2006-01-02 03:04:05 PM")
item := NewItem("play", false, tmstr)
if item.Label != "play" || item.IsFinished || item.CreateAt != tmstr {
t.Fail()
}
}
<file_sep>/core/models/entities/init.go
package entities
import (
"os"
_ "github.com/go-sql-driver/mysql"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm"
)
// set mysql master and slave service
// master as a writer
// slave as reader
var MasterEngine *xorm.Engine
var SlaveEngine *xorm.Engine
func init() {
var err error
MasterEngine, err = xorm.NewEngine("mysql", "root:master@tcp(dbmaster:3306)/todolist?charset=utf8&parseTime=true")
if err != nil {
panic(err)
}
err = MasterEngine.Sync2(new(ItemInfo))
if err != nil {
panic(err)
}
SlaveEngine, err = xorm.NewEngine("mysql", "root:slave@tcp(dbslave:3306)/todolist?charset=utf8&parseTime=true")
if err != nil {
panic(err)
}
err = SlaveEngine.Sync2(new(ItemInfo))
if err != nil {
panic(err)
}
if os.Getenv("DEBUG") == "TRUE" {
MasterEngine.ShowSQL(true)
MasterEngine.Logger().SetLevel(core.LOG_DEBUG)
SlaveEngine.ShowSQL(true)
SlaveEngine.Logger().SetLevel(core.LOG_DEBUG)
}
}
<file_sep>/core/models/service/service.go
package service
import (
"log"
"github.com/kangbb/todolist/core/models/entities"
)
func NewItem(label string, isFinished bool, t string) entities.ItemInfo {
item := entities.ItemInfo{
Label: label,
IsFinished: isFinished,
CreateAt: t,
}
return item
}
// CreateItem insert a new Item to the db
func CreateItem(label string, isFinished bool, t string) (bool, error) {
item := NewItem(label, isFinished, t)
_, err := entities.MasterEngine.InsertOne(item)
if err != nil {
return false, err
}
return true, nil
}
func GetAllItems() []entities.ItemInfo {
items := make([]entities.ItemInfo, 0)
err := entities.SlaveEngine.Find(&items)
if err != nil {
log.Println(err)
}
return items
}
func GetItems(label string, t string) []entities.ItemInfo {
items := make([]entities.ItemInfo, 0)
err := entities.SlaveEngine.Where("items.create_at = ? AND items.label = ?", t, label).Find(&items)
if err != nil {
log.Println(err)
return nil
}
return items
}
func UpdateItem(label string, isFinished bool, t string) (bool, error) {
items := GetItems(label, t)
log.Println(items)
item := NewItem(label, isFinished, t)
affected, err := entities.MasterEngine.Id(items[0].ItemID).Cols("is_finished").Update(&item)
if err != nil {
log.Println("err: ", err)
log.Println("affaected: ", affected)
return false, err
}
return true, nil
}
func DeleteItem(label string, isFinished bool, t string) (bool, error) {
items := GetItems(label, t)
item := new(entities.ItemInfo)
affected, err := entities.MasterEngine.Id(items[0].ItemID).Delete(item)
if err != nil {
log.Println("err: ", err)
log.Println("affaected: ", affected)
return false, err
}
return true, nil
}
<file_sep>/core/controller/handler.go
package controller
import (
"encoding/json"
"log"
"net/http"
simplejson "github.com/bitly/go-simplejson"
"github.com/kangbb/todolist/core/models/service"
)
func dataProcess(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" {
postData(w, r)
} else if r.Method == "GET" {
getData(w)
} else {
http.Error(w, "An Error taken place!", 501)
}
}
//处理Post数据
//这里的数据要和表格提交验证区分开
//数据格式 {method:add/update/delete, label: string, isFinished: bool, time: string }
func postData(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
js, err := simplejson.NewFromReader(r.Body)
if err != nil {
log.Println(err)
w.WriteHeader(500)
return
}
method := js.Get("method").MustString()
label := js.Get("Label").MustString()
isFinished := js.Get("IsFinished").MustBool()
time := js.Get("CreateAt").MustString()
if method == "add" {
addData(w, label, isFinished, time)
} else if method == "update" {
updateData(w, label, isFinished, time)
} else {
deleteData(w, label, isFinished, time)
}
}
func getData(w http.ResponseWriter) {
data := service.GetAllItems()
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
b, _ := json.Marshal(data)
w.Write(b)
}
/*----------------------------------------------*/
func addData(w http.ResponseWriter, label string, isFinished bool, time string) {
_, err := service.CreateItem(label, isFinished, time)
if err != nil {
log.Println(err)
w.WriteHeader(400)
w.Write([]byte("unknown wrong!"))
}
w.WriteHeader(200)
}
func updateData(w http.ResponseWriter, label string, isFinished bool, time string) {
_, err := service.UpdateItem(label, isFinished, time)
if err != nil {
log.Println(err)
w.WriteHeader(400)
w.Write([]byte("unknown wrong!"))
}
w.WriteHeader(200)
}
func deleteData(w http.ResponseWriter, label string, isFinished bool, time string) {
_, err := service.DeleteItem(label, isFinished, time)
if err != nil {
log.Println(err)
w.WriteHeader(400)
w.Write([]byte("unknown wrong!"))
}
w.WriteHeader(200)
}
<file_sep>/Dockerfile
FROM golang:latest
ENV LANG="C.UTF-8"
# get workdir
RUN mkdir /toDoList
# set workdir
WORKDIR /toDoList
# copy file
ADD todolist /toDoList
ADD static /toDoList/static
# expose the application to 8081
EXPOSE 8080
# give a permission
RUN chmod +x todolist
# Set the entry point of the container to the application executable
ENTRYPOINT [ "./todolist" ] | 915da38a85c0e970c84a05fd33676c03edc90c97 | [
"Markdown",
"Go",
"Dockerfile",
"Shell"
] | 8 | Markdown | kangbb/todolist | a509002ba3f7022caf22822ffcdddbe4c25ab335 | 37e10562991fe00ed96d960e6cbce3639d9bf2f0 |
refs/heads/master | <repo_name>Significant-Gravitas/Auto-GPT-Plugins<file_sep>/src/autogpt_plugins/bing_search/README.zh.md
# Auto-GPT 必应搜索插件
语言: [English](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/bing_search/README.md) | [中文](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/bing_search/README.zh.md)
Auto-GPT 必应搜索插件是基础项目 Auto-GPT 的一个实用插件。为了扩展搜索选项,此搜索插件将必应搜索引擎集成到 Auto-GPT 中,补充了原有的 Google 搜索和 DuckDuckGo 搜索。
## 主要功能:
- 必应搜索:使用必应搜索引擎进行搜索查询。
## 工作原理:
如果设置了搜索引擎(`SEARCH_ENGINE`)和Bing API密钥(`BING_API_KEY`)的环境变量,搜索引擎将设置为必应
## 安装:
1. 以 ZIP 文件格式下载 Auto-GPT 必应搜索插件存储库。
2. 将 ZIP 文件复制到 Auto-GPT 项目的 "plugins" 文件夹中。
### Bing API 密钥和必应搜索配置:
1. 访问 [Bing Web Search API](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)。
2. 登录您的 Microsoft Azure 帐户,如果没有帐户,请创建一个新帐户。
3. 设置帐户后,转到 "Keys and Endpoint" 部分。
4. 从那里复制密钥并将其添加到项目目录中的 .env 文件中。
5. 将环境变量命名为 `BING_API_KEY`。

`.env` 文件示例:
```
SEARCH_ENGINE=bing
BING_API_KEY=your_bing_api_key
```
请将 `your_bing_api_key` 替换为从 Microsoft Azure 获取的实际 API 密钥。
<file_sep>/src/autogpt_plugins/news_search/README.md
## Auto-GPT News Search Plugin
A plugin adding [News API](https://newsapi.org/docs) integration into Auto GPT
## Features(more coming soon!)
- Retrieve news across all categories supported by News API via a provided query via the `news_search(query)` command
## Installation
1. Clone this repo as instructed in the main repository
2. Add this chunk of code along with your News API information to the `.env` file within AutoGPT:
```
################################################################################
### NEWS API
################################################################################
NEWSAPI_API_KEY=
```
## NEWS API Setup:
1. Go to the [News API Portal](https://newsapi.org/)
2. Click the 'Get API Key' button to get your own API Key
3. Set that API Key in the env file as mentioned
<file_sep>/run_pylint.py
"""
https://stackoverflow.com/questions/49100806/
pylint-and-subprocess-run-returning-exit-status-28
"""
import subprocess
cmd = " pylint src\\**\\*"
try:
subprocComplete = subprocess.run(
cmd, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
print(subprocComplete.stdout.decode("utf-8"))
except subprocess.CalledProcessError as err:
print(err.output.decode("utf-8"))
<file_sep>/src/autogpt_plugins/baidu_search/README.zh.md
# Auto-GPT 百度搜索插件
语言: [English](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/baidu_search/README.md) | [中文](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/baidu_search/README.zh.md)
此搜索插件将百度搜索引擎集成到 Auto-GPT 中,补充了原有的 Google 搜索和 DuckDuckGo 搜索。
## 主要功能:
- 百度搜索:使用百度搜索引擎进行搜索查询。
## 工作原理:
如果设置了搜索引擎(`SEARCH_ENGINE`)和Baidu Cookie(`BAIDU_COOKIE`)的环境变量,搜索引擎将设置为百度。
### 获取百度 Cookie:
1. 打开 Chrome 浏览器并在百度上搜索随便某个内容。
2. 打开开发者工具(按 F12 或右键单击并选择 "审查元素")。
3. 转到 "网络" 标签。
4. 在网络请求列表中找到第一个名称文件。
5. 在右侧找到 "Cookie" 并复制所有内容(很长,需要全部复制)。

`.env` 文件示例:
```
SEARCH_ENGINE=baidu
BAIDU_COOKIE=your-baidu-cookie
```
请将 `your-baidu-cookie` 替换为从 Chrome 开发者工具获取的实际 Cookie 内容。
## 注意事项
在大多数情况下,AutoGPT的查询关键词会被自动设置为英文。如果你想用中文关键词搜索,你可以在goals中明确指定语言。<file_sep>/src/autogpt_plugins/planner/planner.py
import json
import os
def check_plan():
"""this function checks if the file plan.md exists, if it doesn't exist it gets created"""
current_working_directory = os.getcwd()
workdir = os.path.join(
current_working_directory, "autogpt", "auto_gpt_workspace", "plan.md"
)
file_name = workdir
if not os.path.exists(file_name):
with open(file_name, "w") as file:
file.write(
"""
# Task List and status:
- [ ] Create a detailed checklist for the current plan and goals
- [ ] Finally, review that every new task is completed
## Notes:
- Use the run_planning_cycle command frequently to keep this plan up to date.
"""
)
print(f"{file_name} created.")
with open(file_name, "r") as file:
return file.read()
def update_plan():
"""this function checks if the file plan.md exists, if it doesn't exist it gets created"""
current_working_directory = os.getcwd()
workdir = os.path.join(current_working_directory, 'autogpt', 'auto_gpt_workspace', 'plan.md')
file_name = workdir
with open(file_name, 'r') as file:
data = file.read()
response = generate_improved_plan(data)
with open(file_name, "w") as file:
file.write(response)
print(f"{file_name} updated.")
return response
def generate_improved_plan(prompt: str) -> str:
"""Generate an improved plan using OpenAI's ChatCompletion functionality"""
import openai
tasks = load_tasks()
model = os.getenv('PLANNER_MODEL', os.getenv('FAST_LLM_MODEL', 'gpt-3.5-turbo'))
max_tokens = os.getenv('PLANNER_TOKEN_LIMIT', os.getenv('FAST_TOKEN_LIMIT', 1500))
temperature = os.getenv('PLANNER_TEMPERATURE', os.getenv('TEMPERATURE', 0.5))
# Call the OpenAI API for chat completion
response = openai.ChatCompletion.create(
model=model,
messages=[
{
"role": "system",
"content": "You are an assistant that improves and adds crucial points to plans in .md format.",
},
{
"role": "user",
"content": f"Update the following plan given the task status below, keep the .md format:\n{prompt}\n"
f"Include the current tasks in the improved plan, keep mind of their status and track them "
f"with a checklist:\n{tasks}\n Revised version should comply with the contents of the "
f"tasks at hand:",
},
],
max_tokens=int(max_tokens),
n=1,
temperature=float(temperature),
)
# Extract the improved plan from the response
improved_plan = response.choices[0].message.content.strip()
return improved_plan
def create_task(task_id=None, task_description: str = None, status=False):
task = {"description": task_description, "completed": status}
tasks = load_tasks()
tasks[str(task_id)] = task
current_working_directory = os.getcwd()
workdir = os.path.join(
current_working_directory, "autogpt", "auto_gpt_workspace", "tasks.json"
)
file_name = workdir
with open(file_name, "w") as f:
json.dump(tasks, f)
return tasks
def load_tasks() -> dict:
current_working_directory = os.getcwd()
workdir = os.path.join(
current_working_directory, "autogpt", "auto_gpt_workspace", "tasks.json"
)
file_name = workdir
if not os.path.exists(file_name):
with open(file_name, "w") as f:
f.write("{}")
with open(file_name) as f:
try:
tasks = json.load(f)
if isinstance(tasks, list):
tasks = {}
except json.JSONDecodeError:
tasks = {}
return tasks
def update_task_status(task_id):
tasks = load_tasks()
if str(task_id) not in tasks:
print(f"Task with ID {task_id} not found.")
return
tasks[str(task_id)]["completed"] = True
current_working_directory = os.getcwd()
workdir = os.path.join(
current_working_directory, "autogpt", "auto_gpt_workspace", "tasks.json"
)
file_name = workdir
with open(file_name, "w") as f:
json.dump(tasks, f)
return f"Task with ID {task_id} has been marked as completed."
<file_sep>/requirements.txt
abstract-singleton
atproto
auto-gpt-plugin-template @ git+https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template@0.1.0
black
bs4
build
colorama
flake8
isort
newsapi-python
pandas
pylint
pytest
pytest-cov
python-lorem
python-telegram-bot
requests
requests-mock
setuptools
tweepy==4.13.0
twine
validators
wheel
wolframalpha==5.0.0
<file_sep>/src/autogpt_plugins/email/README.md
# Auto-GPT Email Plugin: Revolutionize Your Email Management with Auto-GPT 🚀
The Auto-GPT Email Plugin is an innovative and powerful plugin for the groundbreaking base software, Auto-GPT. Harnessing the capabilities of the latest Auto-GPT architecture, Auto-GPT aims to autonomously achieve any goal you set, pushing the boundaries of what is possible with artificial intelligence. This email plugin takes Auto-GPT to the next level by enabling it to send and read emails, opening up a world of exciting use cases.
[](https://twitter.com/riensen)
[](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/stargazers)
<img width="1063" alt="auto-gpt-email-plugin" src="https://user-images.githubusercontent.com/3340218/233331404-fd663c98-5065-4aa5-8cfb-12ce3ed261d0.png">
<img width="1011" alt="gmail-view-auto-gpt-email-plugin" src="https://user-images.githubusercontent.com/3340218/233331422-c5afe433-d4ad-48e0-a0e4-2783cc5f842b.png">
## 🌟 Key Features
- 📬 **Read Emails:** Effortlessly manage your inbox with Auto-GPT's email reading capabilities, ensuring you never miss important information.
- 📤 **Auto-Compose and Send Emails**: Auto-GPT crafts personalized, context-aware emails using its advanced language model capabilities, saving you time and effort.
- 📝 **Save Emails to Drafts Folder:** Gain more control by letting Auto-GPT create email drafts that you can review and edit before sending, ensuring your messages are fine-tuned to your preferences.
- 📎 **Send Emails with Attachments:** Effortlessly send emails with attachments, making your communication richer and more comprehensive.
- 🛡️ **Custom Email Signature:** Personalize your emails with a custom Auto-GPT signature, adding a touch of automation to every message sent by Auto-GPT.
- 🎯 **Auto-Reply and Answer Questions:** Streamline your email responses by letting Auto-GPT intelligently read, analyze, and reply to incoming messages with accurate answers.
- 🔌 **Seamless Integration with Auto-GPT:** Enjoy easy setup and integration with the base Auto-GPT software, opening up a world of powerful automation possibilities.
Unlock the full potential of your email management with the Auto-GPT Email Plugin and revolutionize your email experience today! 🚀
## 🔧 Installation
Follow these steps to configure the Auto-GPT Email Plugin:
### 1. Follow Auto-GPT-Plugins Installation Instructions
Follow the instructions as per the [Auto-GPT-Plugins/README.md](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/blob/master/README.md)
### 2. Locate the `.env.template` file
Find the file named `.env.template` in the main `/Auto-GPT` folder.
### 3. Create and rename a copy of the file
Duplicate the `.env.template` file and rename the copy to `.env` inside the `/Auto-GPT` folder.
### 4. Edit the `.env` file
Open the `.env` file in a text editor. Note: Files starting with a dot might be hidden by your operating system.
### 5. Add email configuration settings
Append the following configuration settings to the end of the file:
```ini
################################################################################
### EMAIL (SMTP / IMAP)
################################################################################
EMAIL_ADDRESS=
EMAIL_PASSWORD=
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=587
EMAIL_IMAP_SERVER=imap.gmail.com
# Optional Settings
EMAIL_MARK_AS_SEEN=False
EMAIL_SIGNATURE="This was sent by Auto-GPT"
EMAIL_DRAFT_MODE_WITH_FOLDER=[Gmail]/Drafts
```
1. **Email address and password:**
- Set `EMAIL_ADDRESS` to your sender email address.
- Set `EMAIL_PASSWORD` to your password. For Gmail, use an [App Password](https://myaccount.google.com/apppasswords).
2. **Provider-specific settings:**
- If not using Gmail, adjust `EMAIL_SMTP_HOST`, `EMAIL_IMAP_SERVER`, and `EMAIL_SMTP_PORT` according to your email provider's settings.
3. **Optional settings:**
- `EMAIL_MARK_AS_SEEN`: By default, processed emails are not marked as `SEEN`. Set to `True` to change this.
- `EMAIL_SIGNATURE`: By default, no email signature is included. Configure this parameter to add a custom signature to each message sent by Auto-GPT.
- `EMAIL_DRAFT_MODE_WITH_FOLDER`: Prevents emails from being sent and instead stores them as drafts in the specified IMAP folder. `[Gmail]/Drafts` is the default drafts folder for Gmail.
### 6. Allowlist Plugin
In your `.env` search for `ALLOWLISTED_PLUGINS` and add this Plugin:
```ini
################################################################################
### ALLOWLISTED PLUGINS
################################################################################
#ALLOWLISTED_PLUGINS - Sets the listed plugins that are allowed (Example: plugin1,plugin2,plugin3)
ALLOWLISTED_PLUGINS=AutoGPTEmailPlugin
```
## 🧪 Test the Auto-GPT Email Plugin
Experience the plugin's capabilities by testing it for sending and receiving emails.
### 📤 Test Sending Emails
1. **Configure Auto-GPT:**
Set up Auto-GPT with the following parameters:
- Name: `CommunicatorGPT`
- Role: `Communicate`
- Goals:
1. Goal 1: `Send an email to <EMAIL> to introduce yourself`
2. Goal 2: `Terminate`
2. **Run Auto-GPT:**
Launch Auto-GPT, which should use the email plugin to send an email to <EMAIL>.
3. **Verify the email:**
Check your outbox to confirm that the email was sent. Visit [trash-mail.com](https://www.trash-mail.com/) and enter your chosen email to ensure the email was received.
4. **Sample email content:**
Auto-GPT might send the following email:
```
Hello,
My name is CommunicatorGPT, and I am an LLM. I am writing to introduce myself and to let you know that I will be terminating shortly. Thank you for your time.
Best regards,
CommunicatorGPT
```
### 📬 Test Receiving Emails and Replying Back
1. **Send a test email:**
Compose an email with a simple question from a [trash-mail.com](https://www.trash-mail.com/) email address to your configured `EMAIL_ADDRESS` in your `.env` file.
2. **Configure Auto-GPT:**
Set up Auto-GPT with the following parameters:
- Name: `CommunicatorGPT`
- Role: `Communicate`
- Goals:
1. Goal 1: `Read my latest emails`
2. Goal 2: `Send back an email with an answer`
3. Goal 3: `Terminate`
3. **Run Auto-GPT:**
Launch Auto-GPT, which should automatically reply to the email with an answer.
### 🎁 Test Sending Emails with Attachment
1. **Send a test email:**
Compose an email with a simple question from a [trash-mail.com](https://www.trash-mail.com/) email address to your configured `EMAIL_ADDRESS` in your `.env` file.
2. **Place attachment in Auto-GPT workspace folder**
Insert the attachment intended for sending into the Auto-GPT workspace folder, typically named auto_gpt_workspace, which is located within the cloned [Auto-GPT](https://github.com/Significant-Gravitas/Auto-GPT) Github repository.
3. **Configure Auto-GPT:**
Set up Auto-GPT with the following parameters:
- Name: `CommunicatorGPT`
- Role: `Communicate`
- Goals:
1. Goal 1: `Read my latest emails`
2. Goal 2: `Send back an email with an answer and always attach happy.png`
3. Goal 3: `Terminate`
4. **Run Auto-GPT:**
Launch Auto-GPT, which should automatically reply to the email with an answer and the attached file.
<file_sep>/pyproject.toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "agpt_plugins"
version = "0.0.2"
authors = [
{ name="Torantulino", email="<EMAIL>" }, { name="Riensen", email="3340218+<EMAIL>" }
]
description = "The plugins for Auto-GPT."
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = ["abstract-singleton"]
[project.urls]
"Homepage" = "https://github.com/Significant-Gravitas/Auto-GPT-Plugins"
"Bug Tracker" = "https://github.com/Significant-Gravitas/Auto-GPT-Plugins"
[tool.black]
line-length = 88
target-version = ['py38']
include = '\.pyi?$'
extend-exclude = ""
[tool.isort]
profile = "black"
[tool.pylint.messages_control]
disable = "C0330, C0326"
[tool.pylint.format]
max-line-length = "88"<file_sep>/src/autogpt_plugins/astro/test_astro_plugin.py
from .astronauts import get_num_astronauts
def test_astro():
assert type(get_num_astronauts())==int<file_sep>/src/autogpt_plugins/bing_search/README.md
# Auto-GPT Bing Search Plugin
Language: [English](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/bing_search/README.md) | [中文](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/bing_search/README.zh.md)
The Auto-GPT Bing Search Plugin is a useful plugin for the base project, Auto-GPT. With the aim of expand the search experience, this search plugin integrates Bing search engines into Auto-GPT, complementing the existing support for Google Search and DuckDuckGo Search provided by the main repository.
## Key Features:
- Bing Search: Perform search queries using the Bing search engine.
## How it works
If the environment variables for the search engine (`SEARCH_ENGINE`) and the Bing API key (`BING_API_KEY`) are set, the search engine will be set to Bing.
## Installation:
1. Download the Auto-GPT Bing Search Plugin repository as a ZIP file.
2. Copy the ZIP file into the "plugins" folder of your Auto-GPT project.
### Bing API Key and Bing Search Configuration:
1. Go to the [Bing Web Search API](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) website.
2. Sign into your Microsoft Azure account or create a new account if you don't have one.
3. After setting up your account, go to the "Keys and Endpoint" section.
4. Copy the key from there and add it to the `.env` file in your project directory.
5. Name the environment variable `BING_API_KEY`.

Example of the `.env` file:
```
SEARCH_ENGINE=bing
BING_API_KEY=your_bing_api_key
```
Remember to replace `your_bing_api_key` with the actual API key you obtained from the Microsoft Azure portal.
<file_sep>/src/autogpt_plugins/random_values/test_random_valaues.py
import json
import string
from unittest.mock import Mock
from unittest import TestCase
try:
from .random_values import RandomValues
except ImportError:
from random_values import RandomValues
class TestRandomValueCommands(TestCase):
# _random_number Tests
def setUp(self):
self.random_values = RandomValues(Mock())
def test_random_number(self):
result = json.loads(self.random_values.random_number(min=10, max=20, cnt=5))
self.assertEqual(len(result), 5)
for num in result:
self.assertTrue(10 <= num <= 20)
def test_random_number_using_strings(self):
result = json.loads(self.random_values.random_number(min="10", max="20", cnt="5"))
self.assertEqual(len(result), 5)
for num in result:
self.assertTrue(10 <= num <= 20)
def test_random_number_using_missing_min(self):
result = json.loads(self.random_values.random_number(max=20, cnt=5))
self.assertEqual(len(result), 5)
for num in result:
self.assertTrue(0 <= num <= 20)
def test_random_number_using_missing_max(self):
result = json.loads(self.random_values.random_number(min=10, cnt=5))
self.assertEqual(len(result), 5)
for num in result:
self.assertTrue(10 <= num <= 65535)
def test_random_number_using_missing_count(self):
result = json.loads(self.random_values.random_number(min=10, max=20))
self.assertEqual(len(result), 1)
for num in result:
self.assertTrue(10 <= num <= 20)
def test_random_number_min_using_garbage(self):
with self.assertRaises(ValueError) as e:
self.random_values.random_number(min="foo", max="20", cnt="5")
self.assertEqual(str(e.exception), "min must be an integer")
def test_random_number_max_using_garbage(self):
with self.assertRaises(ValueError) as e:
self.random_values.random_number(min="10", max="bar", cnt="5")
self.assertEqual(str(e.exception), "max must be an integer")
def test_random_number_count_using_garbage(self):
with self.assertRaises(ValueError) as e:
self.random_values.random_number(min="10", max="20", cnt="baz")
self.assertEqual(str(e.exception), "cnt must be an integer")
def test_make_uuids(self):
result = json.loads(self.random_values.make_uuids(cnt=5))
self.assertEqual(len(result), 5)
for uid in result:
self.assertIsInstance(uid, str)
self.assertEqual(len(uid), 36) # UUIDs have 36 characters
def test_make_uuids_using_strings(self):
result = json.loads(self.random_values.make_uuids(cnt="5"))
self.assertEqual(len(result), 5)
for uid in result:
self.assertIsInstance(uid, str)
self.assertEqual(len(uid), 36)
def test_make_uuids_using_missing_count(self):
# If missing, count defaults to 1
result = json.loads(self.random_values.make_uuids())
self.assertEqual(len(result), 1)
for uid in result:
self.assertIsInstance(uid, str)
self.assertEqual(len(uid), 36)
def test_make_uuids_using_garbage(self):
with self.assertRaises(ValueError) as e:
self.random_values.make_uuids(cnt="foo")
self.assertEqual(str(e.exception), "cnt must be an integer")
# _generate_string Tests
def test_generate_string(self):
result = json.loads(self.random_values.generate_string(len=10, cnt=5))
self.assertEqual(len(result), 5)
for string in result:
self.assertEqual(len(string), 10)
# Strings should only contain letters and numbers
self.assertTrue(string.isalnum())
def test_generate_string_using_strings(self):
result = json.loads(self.random_values.generate_string(len="10", cnt="5"))
self.assertEqual(len(result), 5)
for string in result:
self.assertEqual(len(string), 10)
# Strings should only contain letters and numbers
self.assertTrue(string.isalnum())
def test_generate_string_using_missing_length(self):
# If missing, length defaults to 10
result = json.loads(self.random_values.generate_string(cnt=5))
self.assertEqual(len(result), 5)
for string in result:
self.assertEqual(len(string), 10)
# Strings should only contain letters and numbers
self.assertTrue(string.isalnum())
def test_generate_string_using_missing_count(self):
# If missing, count defaults to 1
result = json.loads(self.random_values.generate_string(len=10))
self.assertEqual(len(result), 1)
for string in result:
self.assertEqual(len(string), 10)
# Strings should only contain letters and numbers
self.assertTrue(string.isalnum())
def test_generate_string_using_garbage(self):
with self.assertRaises(ValueError) as e:
self.random_values.generate_string(len="foo", cnt="bar")
self.assertEqual(str(e.exception), "len must be an integer")
# _generate_password Tests
def test_generate_password(self):
result = json.loads(self.random_values.generate_password(len=10, cnt=5))
self.assertEqual(len(result), 5)
for password in result:
self.assertEqual(len(password), 10)
# Passwords should contain letters, numbers, and symbols
self.assertTrue(self.is_password(password))
def test_generate_password_using_strings(self):
result = json.loads(self.random_values.generate_password(len="10", cnt="5"))
self.assertEqual(len(result), 5)
for password in result:
self.assertEqual(len(password), 10)
# Passwords should contain letters, numbers, and symbols
self.assertTrue(self.is_password(password))
def test_generate_password_using_missing_length(self):
# If missing, length defaults to 10
result = json.loads(self.random_values.generate_password(cnt=5))
self.assertEqual(len(result), 5)
for password in result:
self.assertEqual(len(password), 16)
# Passwords should contain letters, numbers, and symbols
self.assertTrue(self.is_password(password))
def test_generate_password_using_missing_count(self):
# If missing, count defaults to 1
result = json.loads(self.random_values.generate_password(len=10))
self.assertEqual(len(result), 1)
for password in result:
self.assertEqual(len(password), 10)
# Passwords should contain letters, numbers, and symbols
self.assertTrue(self.is_password(password))
def test_generate_password_using_garbage(self):
with self.assertRaises(ValueError) as e:
self.random_values.generate_password(len="foo", cnt="bar")
self.assertEqual(str(e.exception), "len must be an integer")
# _generate_placeholder_text Tests
def test_generate_placeholder_text(self):
result = json.loads(self.random_values.generate_placeholder_text(cnt=5))
self.assertEqual(len(result), 5)
for text in result:
self.assertGreater(len(text), 3)
def test_generate_placeholder_text_using_strings(self):
result = json.loads(self.random_values.generate_placeholder_text(cnt="5"))
self.assertEqual(len(result), 5)
for text in result:
self.assertGreater(len(text), 3)
def test_generate_placeholder_text_using_empty_string(self):
with self.assertRaises(ValueError) as e:
self.random_values.generate_placeholder_text(cnt="")
self.assertEqual(str(e.exception), "cnt must be an integer")
def test_generate_placeholder_text_using_garbage(self):
with self.assertRaises(ValueError) as e:
self.random_values.generate_placeholder_text(cnt="foo")
self.assertEqual(str(e.exception), "cnt must be an integer")
# checks that the given string only contains ascii letters, digits & punctuation
def is_password(self, input_str):
characters = string.ascii_letters + string.digits + string.punctuation
for character in input_str:
if character not in characters:
return False
return True
<file_sep>/src/autogpt_plugins/news_search/test_auto_gpt_news_search.py
import json
from unittest.mock import Mock
import pytest
from .news_search import NewsSearch
class TestNewsSearch:
def mock_response(self, *args, **kwargs):
# Mock Response of NewsAPI. We have result for AutoGPT in technology but not others,
# whereas Cricket is present in Sports/Entertainment but not others
if kwargs["q"] == "AI" and kwargs["category"] == "technology":
return json.loads(
"""{"status":"ok","totalResults":1,"articles": [{"title": "AutoGPT"}]}"""
)
elif kwargs["q"] == "Cricket" and kwargs["category"] in [
"entertainment",
"sports",
]:
return json.loads(
"""{"status":"ok","totalResults":1,"articles": [{"title": "World Cup"}]}"""
)
elif kwargs["q"] == "Taylor Swift":
return json.loads(
"""{"status": "ok","totalResults": 1,"articles": [{"title": "The National enlist Taylor Swift for new song “The Alcott”"}]}"""
)
else:
return json.loads("""{"status":"ok","totalResults":0,"articles":[]}""")
@pytest.fixture(autouse=True)
def setUp(self):
self.NewsSearch = NewsSearch("testKey")
self.NewsSearch.news_api_client.get_top_headlines = Mock(
side_effect=self.mock_response
)
self.NewsSearch.news_api_client.get_everything = Mock(
side_effect=self.mock_response
)
def test_news_search(self):
# For AI, only technology should be populated. However, we can't rely on ordering,
# so we'll assert one actual answer and 5 empty answers
actual_output_autogpt = self.NewsSearch.news_headlines_search_wrapper("AI")
assert actual_output_autogpt.count(["AutoGPT"]) == 1
assert actual_output_autogpt.count([]) == 5
# For Cricket, we should have sports/entertainment
actual_output_cricket = self.NewsSearch.news_headlines_search_wrapper("Cricket")
assert actual_output_cricket.count(["World Cup"]) == 2
assert actual_output_cricket.count([]) == 4
actual_output_taylor = self.NewsSearch.news_everything_search("<NAME>")
assert actual_output_taylor.count(["<NAME>"]) == 0
assert actual_output_taylor.count([]) == 0
<file_sep>/src/autogpt_plugins/wolframalpha_search/test_wolframalpha_search.py
import os
import unittest
import requests
from . import AutoGPTWolframAlphaSearch
class TestAutoGPTWolframAlphaSearch(unittest.TestCase):
def setUp(self):
os.environ["WOLFRAMALPHA_APPID"] = "test_appid"
self.plugin = AutoGPTWolframAlphaSearch()
def tearDown(self):
os.environ.pop("WOLFRAMALPHA_APPID", None)
def test_wolframalpha_search(self):
query = "2+2"
try:
from .wolframalpha_search import _wolframalpha_search
_wolframalpha_search(query)
except requests.exceptions.HTTPError as e:
self.assertEqual(e.response.status_code, 401)
if __name__ == "__main__":
unittest.main()
<file_sep>/.flake8
[flake8]
max-line-length = 88
extend-ignore = E203
exclude =
.tox,
__pycache__,
*.pyc,
.env
venv/*
.venv/*
reports/*
dist/*
<file_sep>/src/autogpt_plugins/api_tools/README.md
# API Tools Plugin
The API Tools Plugin enables Auto-GPT to communicate with APIs.
## Key Features:
- Supports GET, POST, PUT, DELETE, PATCH, HEAD and OPTIONS
- Tries to recover from strange values being used as parameters
- Accepts custom header values
## Installation:
As part of the AutoGPT plugins package, follow the [installation instructions](https://github.com/Significant-Gravitas/Auto-GPT-Plugins) on the Auto-GPT-Plugins GitHub reporistory README page.
## AutoGPT Configuration
Set `ALLOWLISTED_PLUGINS=AutoGPTApiTools,example-plugin1,example-plugin2,etc` in your AutoGPT `.env` file.
<file_sep>/src/autogpt_plugins/bluesky/bluesky_plugin/test_bluesky_plugin.py
import os
import unittest
from .bluesky_plugin import get_latest_posts, post_message, username_and_pwd_set
MOCK_USERNAME = "example.bsky.social"
MOCK_MESSAGE = "Hello, World!"
class TestBlueskyPlugin(unittest.TestCase):
def setUp(self):
os.environ["BLUESKY_USERNAME"] = "example.bsky.social"
os.environ["BLUESKY_APP_PASSWORD"] = "<PASSWORD>"
def tearDown(self):
os.environ.pop("BLUESKY_USERNAME", None)
os.environ.pop("BLUESKY_APP_PASSWORD", None)
def test_username_and_pwd_set(self):
self.assertTrue(username_and_pwd_set())
def test_post_message(self):
self.assertIsInstance(post_message(MOCK_MESSAGE), str)
def test_get_latest_posts(self):
self.assertIsInstance(get_latest_posts(MOCK_USERNAME, 5), str)
if __name__ == "__main__":
unittest.main()
<file_sep>/src/autogpt_plugins/bing_search/bing_search.py
import json
import os
import re
import requests
def clean_text(text: str) -> str:
cleaned_text = re.sub("<[^>]*>", "", text) # Remove HTML tags
cleaned_text = cleaned_text.replace(
"\\n", " "
) # Replace newline characters with spaces
return cleaned_text
def _bing_search(query: str, num_results=8) -> str:
"""
Perform a Bing search and return the results as a JSON string.
"""
subscription_key = os.getenv("BING_API_KEY")
# Bing Search API endpoint
search_url = "https://api.bing.microsoft.com/v7.0/search"
headers = {"Ocp-Apim-Subscription-Key": subscription_key}
params = {
"q": query,
"count": num_results,
"textDecorations": True,
"textFormat": "HTML",
}
response = requests.get(search_url, headers=headers, params=params)
response.raise_for_status()
search_results = response.json()
# Extract the search result items from the response
web_pages = search_results.get("webPages", {})
search_results = web_pages.get("value", [])
# Create a list of search result dictionaries with 'title', 'href', and 'body' keys
search_results_list = [
{
"title": clean_text(item["name"]),
"href": item["url"],
"body": clean_text(item["snippet"]),
}
for item in search_results
]
# Return the search results as a JSON string
return json.dumps(search_results_list, ensure_ascii=False, indent=4)
<file_sep>/src/autogpt_plugins/wolframalpha_search/README.md
# Wolfram Search Plugin
The Wolfram Search plugin will allow AutoGPT to directly interact with Wolfram.
## Key Features:
- Wolfram Search performs search queries using Wolfram.
## Installation:
1. Download the Wolfram Search Plugin repository as a ZIP file.
2. Copy the ZIP file into the "plugins" folder of your Auto-GPT project.
3. Add this chunk of code along with your Wolfram AppID (Token API) information to the `.env` file within AutoGPT:
```
################################################################################
### WOLFRAM API
################################################################################
# Wolfram AppId or API keys can be found here: https://developer.wolframalpha.com/portal/myapps/index.html
# the AppId can be generated once you register in Wolfram Developer portal.
WOLFRAMALPHA_APPID=
```
## AutoGPT Configuration
Set `ALLOWLISTED_PLUGINS=autogpt-wolframalpha-search,example-plugin1,example-plugin2,etc` in your AutoGPT `.env` file.
<file_sep>/src/autogpt_plugins/telegram/README.md
## Disclaimer!
As many people keep creating issues:
do not run "pip install telegram"
it is not meantioned anywhere!
## Telegram Plugin for Auto-GPT
A smoothly working Telegram bot that gives you all the messages you would normally get through the Terminal.
Making Auto-GPT a more user-friendly application to interact with.
## SETUP
First setup a telegram bot by following the instructions here: https://core.telegram.org/bots#6-botfather
To get the chat_id just start auto-gpt and follow the instructions in the terminal.
Then set the following variables in your .env:
```
TELEGRAM_API_KEY=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-bot-chat-id
ALLOWLISTED_PLUGINS=AutoGPTTelegram
CHAT_MESSAGES_ENABLED=True
````
within your .env file.
Also keep in mind to use the official documentation on how to use plugins.
<img src="https://user-images.githubusercontent.com/11997278/233675629-fb582ab6-f89f-4837-82c4-c21744427266.png" width="30%" height="30%"> <img src="https://user-images.githubusercontent.com/11997278/233675683-eea9dd74-1c5e-436a-b745-95dff17c4951.png" width="30%" height="30%">
# Running Auto-GPT with this plugin
To run this plugin, zip this repo and put it under Auto-GPT/plugins/
To run it, add the following to your start command:
```
For non docker:
python -m autogpt --install-plugin-deps
For Docker:
docker-compose run --rm auto-gpt --install-plugin-deps
```
# Auto-GPT-Plugins
Plugins for Auto-GPT
Clone this repo into the plugins direcory of [Auto-GPT](https://github.dev/Significant-Gravitas/Auto-GPT)
For interactionless use, set `ALLOWLISTED_PLUGINS=example-plugin1,example-plugin2,example-plugin3` in your `.env`
| Plugin | Description |
|----------|---------------------------------------------------------------------------------------------------------------------|
| Telegram | AutoGPT is capable of asking/prompting the user via a Telegram Chat bot and also responds to commands and messages. |
<file_sep>/src/autogpt_plugins/scenex/scenex_plugin.py
from typing import List, Union
import requests
Algorithm = Union["Aqua", "Bolt", "Comet", "Dune", "Ember", "Flash"]
class SceneXplain:
API_ENDPOINT = "https://us-central1-causal-diffusion.cloudfunctions.net/describe"
def __init__(self, api_key):
self._api_key = api_key
def describe_image(
self,
image: str,
algorithm: Algorithm = "Dune",
features: List[str] = [],
languages: List[str] = [],
) -> str:
headers = {
"x-api-key": f"token {self._api_key}",
"content-type": "application/json",
}
payload = {
"data": [
{
"image": image,
"algorithm": algorithm,
"features": features,
"languages": languages,
}
]
}
response = requests.post(self.API_ENDPOINT, headers=headers, json=payload)
result = response.json().get("result", [])
img = result[0] if result else {}
return {"image": image, "description": img.get("text", "")}
<file_sep>/src/autogpt_plugins/random_values/random_values.py
"""Random Values classes for Autogpt."""
import json
import random
import string
import uuid
import lorem
"""Random Number function for Autogpt."""
class RandomValues:
"""Random Values plugin for Auto-GPT."""
def __init__(self, plugin):
self.plugin = plugin
def random_number(self, min:int|str = 0, max:int|str = 65535, cnt:int|str = 1) -> str:
"""
Return a random integer between min and max
Args:
min (int): The minimum value
max (int): The maximum value
cnt (int): The number of random numbers to return
Returns:
str: a json array with 1 to "count" random numbers in the format
["<random_number>"]
"""
# Type-check the arguments
try:
min = int(min)
except ValueError:
raise ValueError("min must be an integer")
try:
max = int(max)
except ValueError:
raise ValueError("max must be an integer")
try:
cnt = int(cnt)
except ValueError:
raise ValueError("cnt must be an integer")
# Ensure min is less than max
if min > max:
min, max = max, min
# Test ranges
if not (1 <= cnt <= 65535):
raise ValueError("cnt must be between 1 and 65535")
if not (0 <= min <= 65535):
raise ValueError("min must be between 0 and 65535")
if not (0 <= max <= 65535):
raise ValueError("max must be between 0 and 65535")
# Make random numbers
random_numbers = []
if isinstance(min, int) and isinstance(max, int):
for _ in range(cnt):
random_numbers.append(random.randint(min, max))
else:
for _ in range(cnt):
random_numbers.append(random.uniform(min, max))
return json.dumps(random_numbers)
# End of random_number()
def make_uuids(self, cnt:int|str = 1) -> str:
"""
Return a UUID
Args:
cnt (int): The number of UUIDs to return
Returns:
str: a json array with 1 to "count" UUIDs
["<UUID>"]
"""
# Type-check the arguments
if not isinstance(cnt, int):
try:
cnt = int(cnt)
except ValueError:
raise ValueError("cnt must be an integer")
# Make values sane
if not (1 <= cnt <= 65535):
raise ValueError("cnt must be between 1 and 65535")
# Do the thing
uuids = []
for _ in range(cnt):
uuids.append(str(uuid.uuid4()))
return json.dumps(uuids)
# End of make_uuids()
def generate_string(self, len:int|str = 10, cnt:int|str = 1) -> str:
"""
Return a random string
Args:
len (int): The length of the string
cnt (int): The number of strings to return
Returns:
str: a json array with 1 to "count" strings of "length" length
["<string>"]
"""
# Type-check the arguments
if not isinstance(len, int):
try:
len = int(len)
except ValueError:
raise ValueError("len must be an integer")
if not isinstance(cnt, int):
try:
cnt = int(cnt)
except ValueError:
raise ValueError("cnt must be an integer")
# Range checks
if not (1 <= cnt <= 65535):
raise ValueError("cnt must be between 1 and 65535")
if not (1 <= len <= 65535):
raise ValueError("len must be between 1 and 65535")
# Do the thing
strings = []
for _ in range(cnt):
strings.append(
"".join(random.choice(string.ascii_letters) for i in range(len))
)
return json.dumps(strings)
def generate_password(self, len:int|str = 16, cnt:int|str = 1) -> str:
"""
Return a random password of letters, numbers, and punctuation
Args:
len (int): The length of the password
cnt (int): The number of passwords to return
Returns:
str: a json array with 1 to "count" passwords of "length" length
["<password>"]
"""
# Type-check the arguments
if not isinstance(len, int):
try:
len = int(len)
except ValueError:
raise ValueError("len must be an integer")
if not isinstance(cnt, int):
try:
cnt = int(cnt)
except ValueError:
raise ValueError("cnt must be an integer")
# Make values sane
if not (6 <= len <= 65535):
raise ValueError("len must be between 6 and 65535")
if not (1 <= cnt <= 65535):
raise ValueError("cnt must be between 1 and 65535")
# Do the thing
passwords = []
for _ in range(cnt):
passwords.append(
"".join(
random.choice(string.ascii_letters + string.digits + string.punctuation)
for i in range(len)
)
)
return json.dumps(passwords)
def generate_placeholder_text(self, cnt:int|str = 1) -> str:
"""
Return a random sentence of lorem ipsum text
Args:
cnt (int): The number of sentences to return
Returns:
str: a json array with 1 to "sentences" strings of lorem ipsum
["<string>"]
"""
# Type-check the arguments
if not isinstance(cnt, int):
try:
cnt = int(cnt)
except ValueError:
raise ValueError("cnt must be an integer")
# Make values sane
if not (1 <= cnt <= 65535):
raise ValueError("cnt must be between 1 and 65535")
# Do the thing
strings = []
for _ in range(cnt):
strings.append(lorem.get_sentence())
return json.dumps(strings)
<file_sep>/src/autogpt_plugins/astro/astronauts.py
import requests
def get_num_astronauts():
"""Get the number of astronauts in space.
Args:
None
Returns:
int: The number of astronauts in space.
"""
#Get the data
response = requests.get("http://api.open-notify.org/astros.json")
#Convert it to JSON
data = response.json()
#Extract the number and return it
return data["number"]
<file_sep>/src/autogpt_plugins/astro/README.md
# Auto-GPT Space Plugin
This plugin enables AutoGPT to see how many people are in space. This can help enable AutoGPT to better achieve its goals
## Use cases
- Researching how many people are in space
## Setup
Setup is easy. Just follow the instructions in [Auto-GPT-Plugins/README.md](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/blob/master/README.md)
<file_sep>/helpers.sh
#!/usr/bin/env bash
clean() {
# Remove build artifacts and temporary files
rm -rf build 2>/dev/null || true
rm -rf dist 2>/dev/null || true
rm -rf __pycache__ 2>/dev/null || true
rm -rf *.egg-info 2>/dev/null || true
rm -rf **/*.egg-info 2>/dev/null || true
rm -rf *.pyc 2>/dev/null || true
rm -rf **/*.pyc 2>/dev/null || true
rm -rf reports 2>/dev/null || true
}
qa() {
# Run static analysis tools
flake8 .
python run_pylint.py
}
style() {
# Format code
isort .
black --exclude=".*\/*(dist|venv|.venv|test-results)\/*.*" .
}
if [ "$1" = "clean" ]; then
echo Removing build artifacts and temporary files...
clean
elif [ "$1" = "qa" ]; then
echo Running static analysis tools...
qa
elif [ "$1" = "style" ]; then
echo Running code formatters...
style
else
echo "Usage: $0 [clean|qa|style]"
exit 1
fi
echo Done!
echo
exit 0<file_sep>/src/autogpt_plugins/scenex/test_scenex_plugin.py
from .scenex_plugin import SceneXplain
MOCK_API_KEY = "secret"
MOCK_IMAGE = "https://example.com/image.png"
MOCK_DESCRIPTION = "example description"
def test_describe_image(requests_mock):
requests_mock.post(
SceneXplain.API_ENDPOINT,
json={
"result": [
{
"image": MOCK_IMAGE,
"text": MOCK_DESCRIPTION,
}
]
},
)
scenex = SceneXplain(MOCK_API_KEY)
result = scenex.describe_image(
image=MOCK_IMAGE,
algorithm="Dune",
features=[],
languages=[],
)
# Check the results
assert result == {
"image": MOCK_IMAGE,
"description": MOCK_DESCRIPTION,
}
# Check that the mocked functions were called with the correct arguments
requests_mock.request_history[0].json() == {
"data": [
{
"image": MOCK_IMAGE,
"algorithm": "Dune",
"features": [],
"languages": [],
}
]
}
<file_sep>/src/autogpt_plugins/scenex/README.md
# Auto-GPT SceneXplain Plugin: Explore image storytelling beyond pixels
[SceneXplain](https://scenex.jina.ai) is your gateway to revealing the rich narratives hidden within your images. Our cutting-edge AI technology dives deep into every detail, generating sophisticated textual descriptions that breathe life into your visuals. With a user-friendly interface and seamless API integration, SceneX empowers developers to effortlessly incorporate our advanced service into their multimodal applications.
<img width="1580" alt="image" src="https://user-images.githubusercontent.com/2041322/234498702-39b668a2-d097-4b74-b51f-43073f3aeb3a.png">
<img width="1116" alt="auto-gpt-scenex-plugin" src="https://user-images.githubusercontent.com/492616/234332762-642bfd6c-045e-426d-b8cd-70aaf53ff894.png">
## 🌟 Key Features
- **Advanced Large Model**: SceneX utilizes state-of-the-art large models and large language models to generate comprehensive, sophisticated textual descriptions for your images, surpassing conventional captioning algorithms.
- **Multilingual Support**: SceneX 's powerful AI technology provides seamless multilingual support, enabling users to receive accurate and meaningful descriptions in multiple languages.
- **API Integration**: SceneX offers a seamless API integration, empowering developers to effortlessly incorporate our innovative service into their multimodal applications.
- **Fast Batch Performance**: Experience up to 3 Query Per Second (QPS) performance, ensuring that SceneX delivers prompt and efficient textual descriptions for your images.
## 🔧 Installation
Follow these steps to configure the Auto-GPT SceneX Plugin:
### 1. Follow Auto-GPT-Plugins Installation Instructions
Follow the instructions as per the [Auto-GPT-Plugins/README.md](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/blob/master/README.md)
### 2. Locate the `.env.template` file
Find the file named `.env.template` in the main `/Auto-GPT` folder.
### 3. Create and rename a copy of the file
Duplicate the `.env.template` file and rename the copy to `.env` inside the `/Auto-GPT` folder.
### 4. Edit the `.env` file
Open the `.env` file in a text editor. Note: Files starting with a dot might be hidden by your operating system.
### 5. Add API configuration settings
Append the following configuration settings to the end of the file:
```ini
################################################################################
### SCENEX API
################################################################################
SCENEX_API_KEY=
```
- `SCENEX_API_KEY`: Your API key for the SceneXplain API. You can obtain a key by following the steps below.
- Sign up for a free account at [SceneXplain](https://scenex.jina.ai/).
- Navigate to the [API Access](https://scenex.jina.ai/api) page and create a new API key.
### 6. Allowlist Plugin
In your `.env` search for `ALLOWLISTED_PLUGINS` and add this Plugin:
```ini
################################################################################
### ALLOWLISTED PLUGINS
################################################################################
#ALLOWLISTED_PLUGINS - Sets the listed plugins that are allowed (Example: plugin1,plugin2,plugin3)
ALLOWLISTED_PLUGINS=AutoGPTSceneXPlugin
```
## 🧪 Test the Auto-GPT SceneX Plugin
Experience the plugin's capabilities by testing it for describing an image.
1. **Configure Auto-GPT:**
Set up Auto-GPT with the following parameters:
- Name: `ImageGPT`
- Role: `Describe a given image`
- Goals:
1. Goal 1: `Describe an image. Image URL is https://storage.googleapis.com/causal-diffusion.appspot.com/imagePrompts%2F0rw369i5h9t%2Foriginal.png.`
2. Goal 2: `Terminate`
2. **Run Auto-GPT:**
Launch Auto-GPT, which should use the SceneXplain plugin to describe an image.
<file_sep>/src/autogpt_plugins/random_values/README.md
# Random Values Plugin
The Random Values plugin will enable AutoGPT to generate various random assorted things like numbers and strings.
## Key Features:
- __uuids__: generates 1 or more UUIDs (128-bit label)
- __make_str__: generates 1 or more alphanumeric strings of at least 2 characters in length
- __pwds__: generates 1 or more passwords of 6 or more characters using letters, numbers and punctuation
- __lorem_ipsum__: generates 1 or more sentences of lorem ipsum text
- __rnd_num__: draws 1 or more random numbers between min and max
## Installation:
As part of the AutoGPT plugins package, follow the [installation instructions](https://github.com/Significant-Gravitas/Auto-GPT-Plugins) on the Auto-GPT-Plugins GitHub reporistory README page.
## AutoGPT Configuration
Set `ALLOWLISTED_PLUGINS=AutoGPTRandomValues,example-plugin1,example-plugin2,etc` in your AutoGPT `.env` file.
<file_sep>/src/autogpt_plugins/email/email_plugin/email_plugin.py
import email
import imaplib
import json
import mimetypes
import os
import re
import smtplib
import time
from email.header import decode_header
from email.message import EmailMessage
from bs4 import BeautifulSoup
def bothEmailAndPwdSet() -> bool:
return True if os.getenv("EMAIL_ADDRESS") and os.getenv("EMAIL_PASSWORD") else False
def getSender():
email_sender = os.getenv("EMAIL_ADDRESS")
if not email_sender:
return "Error: email not sent. EMAIL_ADDRESS not set in environment."
return email_sender
def getPwd():
email_password = os.getenv("EMAIL_PASSWORD")
if not email_password:
return "Error: email not sent. EMAIL_PASSWORD not set in environment."
return email_password
def send_email(to: str, subject: str, body: str) -> str:
return send_email_with_attachment_internal(to, subject, body, None, None)
def send_email_with_attachment(to: str, subject: str, body: str, filename: str) -> str:
attachment_path = filename
attachment = os.path.basename(filename)
return send_email_with_attachment_internal(
to, subject, body, attachment_path, attachment
)
def send_email_with_attachment_internal(
to: str, title: str, message: str, attachment_path: str, attachment: str
) -> str:
"""Send an email
Args:
to (str): The email of the recipient
title (str): The title of the email
message (str): The message content of the email
Returns:
str: Any error messages
"""
email_sender = getSender()
email_password = getPwd()
msg = EmailMessage()
msg["Subject"] = title
msg["From"] = email_sender
msg["To"] = to
signature = os.getenv("EMAIL_SIGNATURE")
if signature:
message += f"\n{signature}"
msg.set_content(message)
if attachment_path:
ctype, encoding = mimetypes.guess_type(attachment_path)
if ctype is None or encoding is not None:
# No guess could be made, or the file is encoded (compressed)
ctype = "application/octet-stream"
maintype, subtype = ctype.split("/", 1)
with open(attachment_path, "rb") as fp:
msg.add_attachment(
fp.read(), maintype=maintype, subtype=subtype, filename=attachment
)
draft_folder = os.getenv("EMAIL_DRAFT_MODE_WITH_FOLDER")
if not draft_folder:
smtp_host = os.getenv("EMAIL_SMTP_HOST")
smtp_port = os.getenv("EMAIL_SMTP_PORT")
# send email
with smtplib.SMTP(smtp_host, smtp_port) as smtp:
smtp.ehlo()
smtp.starttls()
smtp.login(email_sender, email_password)
smtp.send_message(msg)
smtp.quit()
return f"Email was sent to {to}!"
else:
conn = imap_open(draft_folder, email_sender, email_password)
conn.append(
draft_folder,
"",
imaplib.Time2Internaldate(time.time()),
str(msg).encode("UTF-8"),
)
return f"Email went to {draft_folder}!"
def read_emails(
imap_folder: str = "inbox", imap_search_command: str = "UNSEEN", limit: int = 5,
page: int = 1) -> str:
"""Read emails from an IMAP mailbox.
This function reads emails from a specified IMAP folder, using a given IMAP search command, limits, and page numbers.
It returns a list of emails with their details, including the sender, recipient, date, CC, subject, and message body.
Args:
imap_folder (str, optional): The name of the IMAP folder to read emails from. Defaults to "inbox".
imap_search_command (str, optional): The IMAP search command to filter emails. Defaults to "UNSEEN".
limit (int, optional): Number of email's the function should return. Defaults to 5 emails.
page (int, optional): The index of the page result the function should resturn. Defaults to 0, the first page.
Returns:
str: A list of dictionaries containing email details if there are any matching emails. Otherwise, returns
a string indicating that no matching emails were found.
"""
email_sender = getSender()
imap_folder = adjust_imap_folder_for_gmail(imap_folder, email_sender)
imap_folder = enclose_with_quotes(imap_folder)
imap_search_ar = split_imap_search_command(imap_search_command)
email_password = <PASSWORD>()
mark_as_seen = os.getenv("EMAIL_MARK_AS_SEEN")
if isinstance(mark_as_seen, str):
mark_as_seen = json.loads(mark_as_seen.lower())
conn = imap_open(imap_folder, email_sender, email_password)
imap_keyword = imap_search_ar[0]
if len(imap_search_ar) == 1:
_, search_data = conn.search(None, imap_keyword)
else:
argument = enclose_with_quotes(imap_search_ar[1])
_, search_data = conn.search(None, imap_keyword, argument)
messages = []
for num in search_data[0].split():
if mark_as_seen:
message_parts = "(RFC822)"
else:
message_parts = "(BODY.PEEK[])"
_, msg_data = conn.fetch(num, message_parts)
for response_part in msg_data:
if isinstance(response_part, tuple):
msg = email.message_from_bytes(response_part[1])
# If the subject has unknown encoding, return blank
if msg["Subject"] is not None:
subject, encoding = decode_header(msg["Subject"])[0]
else:
subject = ""
encoding = ""
if isinstance(subject, bytes):
try:
# If the subject has unknown encoding, return blank
if encoding is not None:
subject = subject.decode(encoding)
else:
subject = ""
except [LookupError] as e:
pass
body = get_email_body(msg)
# Clean email body
body = clean_email_body(body)
from_address = msg["From"]
to_address = msg["To"]
date = msg["Date"]
cc = msg["CC"] if msg["CC"] else ""
messages.append(
{
"From": from_address,
"To": to_address,
"Date": date,
"CC": cc,
"Subject": subject,
"Message Body": body,
}
)
conn.logout()
if not messages:
return (
f"There are no Emails in your folder `{imap_folder}` "
f"when searching with imap command `{imap_search_command}`"
)
# Confirm that integer parameters are the right type
limit = int(limit)
page = int(page)
# Validate parameter values
if limit < 1:
raise ValueError("Error: The message limit should be 1 or greater")
page_count = len(messages) // limit + (len(messages) % limit > 0)
if page < 1 or page > page_count:
raise ValueError("Error: The page value references a page that is not part of the results")
# Calculate paginated indexes
start_index = len(messages) - (page * limit + 1)
end_index = start_index + limit
start_index = max(start_index, 0)
# Return paginated indexes
if start_index == end_index:
return [messages[start_index]]
else:
return messages[start_index:end_index]
def adjust_imap_folder_for_gmail(imap_folder: str, email_sender: str) -> str:
if "@gmail" in email_sender.lower() or "@googlemail" in email_sender.lower():
if "sent" in imap_folder.lower():
return '"[Gmail]/Sent Mail"'
if "draft" in imap_folder.lower():
return "[Gmail]/Drafts"
return imap_folder
def imap_open(
imap_folder: str, email_sender: str, email_password: str
) -> imaplib.IMAP4_SSL:
imap_server = os.getenv("EMAIL_IMAP_SERVER")
conn = imaplib.IMAP4_SSL(imap_server)
conn.login(email_sender, email_password)
conn.select(imap_folder)
return conn
def get_email_body(msg: email.message.Message) -> str:
if msg.is_multipart():
for part in msg.walk():
content_type = part.get_content_type()
content_disposition = str(part.get("Content-Disposition"))
if content_type == "text/plain" and "attachment" not in content_disposition:
# If the email body has unknown encoding, return null
try:
return part.get_payload(decode=True).decode()
except UnicodeDecodeError as e:
pass
else:
try:
# If the email body has unknown encoding, return null
return msg.get_payload(decode=True).decode()
except UnicodeDecodeError as e:
pass
def enclose_with_quotes(s):
# Check if string contains whitespace
has_whitespace = bool(re.search(r"\s", s))
# Check if string is already enclosed by quotes
is_enclosed = s.startswith(("'", '"')) and s.endswith(("'", '"'))
# If string has whitespace and is not enclosed by quotes, enclose it with double quotes
if has_whitespace and not is_enclosed:
return f'"{s}"'
else:
return s
def split_imap_search_command(input_string):
input_string = input_string.strip()
parts = input_string.split(maxsplit=1)
parts = [part.strip() for part in parts]
return parts
def clean_email_body(email_body):
"""Remove formating and URL's from an email's body
Args:
email_body (str, optional): The email's body
Returns:
str: The email's body without any formating or URL's
"""
# If body is None, return an empty string
if email_body is None: email_body = ""
# Remove any HTML tags
email_body = BeautifulSoup(email_body, "html.parser")
email_body = email_body.get_text()
# Remove return characters
email_body = "".join(email_body.splitlines())
# Remove extra spaces
email_body = " ".join(email_body.split())
# Remove unicode characters
email_body = email_body.encode("ascii", "ignore")
email_body = email_body.decode("utf-8", "ignore")
# Remove any remaining URL's
email_body = re.sub(r"http\S+", "", email_body)
return email_body
<file_sep>/Makefile
ifeq ($(OS),Windows_NT)
os := win
SCRIPT_EXT := .bat
SHELL_CMD := cmd /C
else
os := nix
SCRIPT_EXT := .sh
SHELL_CMD := bash
endif
helpers = @$(SHELL_CMD) helpers$(SCRIPT_EXT) $1
clean: helpers$(SCRIPT_EXT)
$(call helpers,clean)
qa: helpers$(SCRIPT_EXT)
$(call helpers,qa)
style: helpers$(SCRIPT_EXT)
$(call helpers,style)
.PHONY: clean qa style
<file_sep>/src/autogpt_plugins/api_tools/test_api_tools.py
import json
import random
import requests_mock
import unittest
try:
from .api_tools import ApiCallCommand
except ImportError:
from api_tools import ApiCallCommand
class TestAutoGPTAPITools(unittest.TestCase):
def setUp(self):
self.plugin_class = ApiCallCommand()
def test_api_call_get(self):
"""Test the self.plugin_class.make_api_call() function with a GET request."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_post(self):
"""Test the self.plugin_class.make_api_call() function with a POST request."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_put(self):
"""Test the self.plugin_class.make_api_call() function with a PUT request."""
with requests_mock.Mocker() as m:
m.put('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='PUT')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_delete(self):
"""Test the self.plugin_class.make_api_call() function with a DELETE request."""
with requests_mock.Mocker() as m:
m.delete('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='DELETE')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_patch(self):
"""Test the self.plugin_class.make_api_call() function with a PATCH request."""
with requests_mock.Mocker() as m:
m.patch('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='PATCH')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_head(self):
"""Test the self.plugin_class.make_api_call() function with a HEAD request."""
with requests_mock.Mocker() as m:
m.head('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='HEAD')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_options(self):
"""Test the self.plugin_class.make_api_call() function with a OPTIONS request."""
with requests_mock.Mocker() as m:
m.options('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='OPTIONS')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
# Test host errors
def test_api_call_valid_host(self):
"""Test the self.plugin_class.make_api_call() function with a valid host."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_valid_host_https(self):
"""Test the self.plugin_class.make_api_call() function with a valid host using HTTPS."""
with requests_mock.Mocker() as m:
m.get('https://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('https://example.com', '/endpoint')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_host_without_protocol(self):
"""Test the self.plugin_class.make_api_call() function with a host without a protocol."""
with requests_mock.Mocker() as m:
m.get('https://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('example.com', '/endpoint')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_host_garbage(self):
"""Test the self.plugin_class.make_api_call() function with a garbage host."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('garbage', '/endpoint')
self.assertIn("Invalid URL", str(excinfo.exception))
def test_api_call_host_empty(self):
"""Test the self.plugin_class.make_api_call() function with an empty host."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('', '/endpoint')
self.assertIn("Invalid URL", str(excinfo.exception))
def test_api_call_host_number(self):
"""Test the self.plugin_class.make_api_call() function with a host that is a number."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call(123, '/endpoint') # type: ignore
self.assertIn("host must be a string", str(excinfo.exception))
def test_api_call_host_none(self):
"""Test the self.plugin_class.make_api_call() function with no host."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call(None, '/endpoint') # type: ignore
self.assertIn("host must be a string", str(excinfo.exception))
def test_api_call_host_invalid_protocol(self):
"""Test the self.plugin_class.make_api_call() function with an invalid protocol."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('ftp://example.com', '/endpoint')
self.assertIn("Invalid URL", str(excinfo.exception))
def test_api_call_host_query_marker(self):
"""Test the self.plugin_class.make_api_call() function with dangerous characters."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com?test=1', '/endpoint')
self.assertIn("Invalid URL", str(excinfo.exception))
def test_api_call_host_query_param_marker(self):
"""Test the self.plugin_class.make_api_call() function with dangerous characters."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com?test=1', '/endpoint')
self.assertIn("Invalid URL", str(excinfo.exception))
# Test endpoint errors
def test_api_call_valid_endpoint(self):
"""Test the self.plugin_class.make_api_call() function with a valid endpoint."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_valid_endpoint_with_query(self):
"""Test the self.plugin_class.make_api_call() function with a valid endpoint."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint?test=1', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint?test=1')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_endpoint_empty(self):
"""Test the self.plugin_class.make_api_call() function with an empty endpoint."""
with requests_mock.Mocker() as m:
m.get('http://example.com', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_endpoint_number(self):
"""Test the self.plugin_class.make_api_call() function with an endpoint that is a number."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', 123) # type: ignore
self.assertIn("endpoint must be a string", str(excinfo.exception))
def test_api_call_endpoint_none(self):
"""Test the self.plugin_class.make_api_call() function with no endpoint."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', None) # type: ignore
self.assertIn("endpoint must be a string", str(excinfo.exception))
# Test method errors
def test_api_call_invalid_method(self):
"""Test the self.plugin_class.make_api_call() function with an invalid method."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='INVALID')
self.assertIn("Invalid method: INVALID", str(excinfo.exception))
def test_api_call_none_method(self):
"""Test the self.plugin_class.make_api_call() function with no method."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd=None) # type: ignore
self.assertIn("method must be a string", str(excinfo.exception))
def test_api_call_empty_method(self):
"""Test the self.plugin_class.make_api_call() function with an empty method."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='')
self.assertIn("Invalid method", str(excinfo.exception))
def test_api_call_number_method(self):
"""Test the self.plugin_class.make_api_call() function with a number as a method."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd=123) # type: ignore
self.assertIn("method must be a string", str(excinfo.exception))
def test_api_call_lowercase_method(self):
"""Test the self.plugin_class.make_api_call() function with a lowercase method."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='get')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
# Test query_params errors
def test_api_call_valid_query_params_with_number_as_dict_value(self):
"""Test the self.plugin_class.make_api_call() function with valid query_params."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', params={'test': 1})
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_query_params_array(self):
"""Test the self.plugin_class.make_api_call() function with query_params that is an array."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', params=['test'])
self.assertIn("query_params must be a dictionary", str(excinfo.exception))
def test_api_call_query_params_string(self):
"""Test the self.plugin_class.make_api_call() function with query_params that is a string."""
# This is interpreted as JSON and converted to a dictionary
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', params='{"test": 1}')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_query_params_invalid_json_string(self):
"""Test the self.plugin_class.make_api_call() function with query_params that is an invalid JSON string."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', params='{test": 1')
self.assertIn("query_params must be a dictionary", str(excinfo.exception))
def test_api_call_query_params_empty_string(self):
"""Test the self.plugin_class.make_api_call() function with query_params that is an empty string."""
# This should be converted to an empty dictionary
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', params='')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_query_params_none(self):
"""Test the self.plugin_class.make_api_call() function with no query_params."""
# This should be converted to an empty dictionary
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', params=None)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_query_params_empty_dict(self):
"""Test the self.plugin_class.make_api_call() function with an empty query_params."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', params={})
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_query_params_number(self):
"""Test the self.plugin_class.make_api_call() function with query_params that is a number."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', params=123)
self.assertIn("query_params must be a dictionary", str(excinfo.exception))
def test_api_call_query_params_dict_has_key_none_value(self):
"""Test the self.plugin_class.make_api_call() function with query_params that has a None value."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', params={'test': None})
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_query_params_dict_malformed(self):
"""Test the self.plugin_class.make_api_call() function with query_params that is a malformed dictionary."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', params={None: 'test'})
self.assertIn("query_params cannot contain None keys", str(excinfo.exception))
# Test body errors
def test_api_call_valid_body_with_24k_text(self):
"""Test the self.plugin_class.make_api_call() function with valid body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body='a' * 24000)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_valid_body_with_random_text(self):
"""Test the self.plugin_class.make_api_call() function with valid body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
body_length = random.randint(1, 24000)
body = 'a' * body_length
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=body)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_valid_body_with_control_code_text(self):
"""Test the self.plugin_class.make_api_call() function with valid body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body='\x00')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_valid_body_with_unicode_text(self):
"""Test the self.plugin_class.make_api_call() function with valid body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=u'\u2713')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_valid_body_with_utf8_text(self):
"""Test the self.plugin_class.make_api_call() function with valid body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
body = u'\u2713'.encode('utf-8')
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=body) # type: ignore
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_valid_body_with_utf16_text(self):
"""Test the self.plugin_class.make_api_call() function with valid body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
body = u'\u2713'.encode('utf-16')
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=body) # type: ignore
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_body_empty(self):
"""Test the self.plugin_class.make_api_call() function with an empty body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body='')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_body_none(self):
"""Test the self.plugin_class.make_api_call() function with a None body."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=None) # type: ignore
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_body_not_string(self):
"""Test the self.plugin_class.make_api_call() function with a body that is not a string."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=1) # type: ignore
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_body_json(self):
"""Test the self.plugin_class.make_api_call() function with a body that is json."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
body = json.dumps({'test': 'test'})
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=body)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_body_json_invalid(self):
"""Test the self.plugin_class.make_api_call() function with a body that is invalid json."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
body = '{"test": "test"]'
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=body)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_body_xml(self):
"""Test the self.plugin_class.make_api_call() function with a body that is xml."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
body = '<test>test</test>'
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body=body)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_body_xml_invalid(self):
"""Test the self.plugin_class.make_api_call() function with a body that is invalid xml."""
with requests_mock.Mocker() as m:
m.post('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', mthd='POST', body='<test>test</test>')
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
# Test headers errors
def test_api_call_valid_headers(self):
"""Test the self.plugin_class.make_api_call() function with valid headers."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs={'test': 'test'})
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_valid_headers_with_random_text(self):
"""Test the self.plugin_class.make_api_call() function with valid headers."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
headers = {'test': 'a' * random.randint(1, 24000)}
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs=headers)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_valid_headers_with_control_code_text(self):
"""Test the self.plugin_class.make_api_call() function with valid headers."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
headers = {'test': '\x00'}
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs=headers)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_valid_headers_with_unicode_text(self):
"""Test the self.plugin_class.make_api_call() function with valid headers."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
headers = {'test': u'\u2713'}
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs=headers)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_headers_with_array(self):
"""Test the self.plugin_class.make_api_call() function with headers that are an array."""
with self.assertRaises(ValueError) as excinfo:
headers = ['test']
self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs=headers)
self.assertIn("headers must be a dictionary", str(excinfo.exception))
def test_api_call_headers_with_empty_dict(self):
"""Test the self.plugin_class.make_api_call() function with headers that are an empty dict."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs={})
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_headers_with_none(self):
"""Test the self.plugin_class.make_api_call() function with headers that are None."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs=None)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_headers_with_not_dict(self):
"""Test the self.plugin_class.make_api_call() function with headers that are not a dict."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', hdrs=1)
self.assertIn("headers must be a dictionary", str(excinfo.exception))
def test_api_call_headers_with_invalid_key(self):
"""Test the self.plugin_class.make_api_call() function with headers that have an invalid key."""
headers = {'test': 'test'}
headers[1] = 'test' # type: ignore
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200, headers={'test': 'test', '1': 'test'})
result = self.plugin_class.make_api_call(host='http://example.com', endpoint='/endpoint', hdrs=headers)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
def test_api_call_headers_with_invalid_value(self):
"""Test the self.plugin_class.make_api_call() function with headers that have an invalid value."""
headers = {'test': 'test'}
headers['test'] = 1 # type: ignore
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200, headers={'test': '1'})
result = self.plugin_class.make_api_call(host='http://example.com', endpoint='/endpoint', hdrs=headers)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
self.assertEqual(response['response'], 'success')
# Test timeout_secs errors
def test_api_call_valid_timeout_secs(self):
"""Test the self.plugin_class.make_api_call() function with valid timeout_secs."""
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout=1)
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_timeout_secs_with_string(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is a string."""
# The string will be converted to an integer, so no error will be thrown
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout='1') # type: ignore
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_timeout_secs_with_float(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is a float."""
# The float will be converted to an integer, so no error will be thrown
with requests_mock.Mocker() as m:
m.get('http://example.com/endpoint', text='success', status_code=200)
result = self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout=1.0) # type: ignore
response = json.loads(result)
self.assertEqual(response['status'], 'success')
self.assertEqual(response['status_code'], 200)
def test_api_call_timeout_secs_with_negative_number(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is a negative number."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout=-1)
self.assertIn("timeout_secs must be a positive integer", str(excinfo.exception))
def test_api_call_timeout_secs_with_zero(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is zero."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout=0)
self.assertIn("timeout_secs must be a positive integer", str(excinfo.exception))
def test_api_call_timeout_secs_with_empty_string(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is an empty string."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout='') # type: ignore
self.assertIn("timeout_secs must be an integer", str(excinfo.exception))
def test_api_call_timeout_secs_with_none_value(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is None."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout=None) # type: ignore
self.assertIn("timeout_secs must be an integer", str(excinfo.exception))
def test_api_call_timeout_secs_with_random_text(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is random text."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout='test') # type: ignore
self.assertIn("timeout_secs must be an integer", str(excinfo.exception))
def test_api_call_timeout_secs_with_control_code_text(self):
"""Test the self.plugin_class.make_api_call() function with timeout_secs that is a control code."""
with self.assertRaises(ValueError) as excinfo:
self.plugin_class.make_api_call('http://example.com', '/endpoint', timeout='\x00') # type: ignore
self.assertIn("timeout_secs must be an integer", str(excinfo.exception))
<file_sep>/src/autogpt_plugins/wolframalpha_search/wolframalpha_search.py
from . import AutoGPTWolframAlphaSearch
plugin = AutoGPTWolframAlphaSearch()
def _wolframalpha_search(query: str) -> str | list[str]:
res = ""
try:
ans = plugin.api.query(query)
res = next(ans.results).text
except Exception as e:
return f"'_wolframalpha_search' on query: '{query}' raised exception: '{e}'"
return res
<file_sep>/src/autogpt_plugins/bluesky/bluesky_plugin/bluesky_plugin.py
"""This module contains functions for interacting with the Bluesky API via atprototools."""
import os
import pandas as pd
from atproto import Client
def username_and_pwd_set() -> bool:
return True if os.getenv("BLUESKY_USERNAME") and os.getenv("BLUESKY_APP_PASSWORD") else False
def post_message(text: str) -> str:
"""Posts a message to Bluesky.
Args:
text (str): The message to post.
Returns:
str: The message that was posted.
"""
bluesky_username = os.getenv("BLUESKY_USERNAME")
bluesky_app_password = os.getenv("BLUESKY_APP_PASSWORD")
client = Client()
try:
client.login(bluesky_username, bluesky_app_password)
client.send_post(text=text)
except Exception as e:
return f"Error! Message: {e}"
return f"Success! Message: {text}"
def get_latest_posts(username: str, number_of_posts=5) -> str | None:
"""Gets the latest posts from a user.
Args:
username (str): The username to get the messages from.
number_of_posts (int): The number of posts to get.
Returns:
str | None: The latest posts.
"""
bluesky_username = os.getenv("BLUESKY_USERNAME")
bluesky_app_password = os.getenv("<PASSWORD>")
client = Client()
try:
client.login(bluesky_username, bluesky_app_password)
profile_feed = client.bsky.feed.get_author_feed(
{'actor': username, 'limit': number_of_posts})
except Exception as e:
return f"Error! Message: {e}"
columns = ["URI", "Text", "Date", "User", "Likes", "Replies"]
posts = []
for feed in profile_feed.feed:
posts.append([feed.post.uri, feed.post.record.text, feed.post.record.createdAt,
feed.post.author.handle, feed.post.likeCount, feed.post.replyCount])
df = str(pd.DataFrame(posts, columns=columns))
print(df)
return df
<file_sep>/src/autogpt_plugins/baidu_search/baidu_search.py
import json
import os
import re
import requests
from bs4 import BeautifulSoup
def _baidu_search(query: str, num_results=8):
'''
Perform a Baidu search and return the results as a JSON string.
'''
headers = {
'Cookie': os.getenv("BAIDU_COOKIE"),
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:112.0) Gecko/20100101 Firefox/112.0"
}
url = f'https://www.baidu.com/s?wd={query}&rn={num_results}'
response = requests.get(url, headers=headers)
response.encoding = 'utf-8'
soup = BeautifulSoup(response.text, 'html.parser')
search_results = []
for result in soup.find_all('div', class_=re.compile('^result c-container ')):
title = result.find('h3', class_='t').get_text()
link = result.find('a', href=True)['href']
snippet = result.find('span', class_=re.compile('^content-right_8Zs40'))
if snippet:
snippet = snippet.get_text()
else:
snippet = ''
search_results.append({
'title': title,
'href': link,
'snippet': snippet
})
return json.dumps(search_results, ensure_ascii=False, indent=4)<file_sep>/src/autogpt_plugins/wikipedia_search/README.md
# Wikipedia Search Plugin
The Wikipedia Search plugin will allow AutoGPT to directly interact with Wikipedia.
## Key Features:
- Wikipedia Search performs search queries using Wikipedia.
## Installation:
1. Download the Wikipedia Search Plugin repository as a ZIP file.
2. Copy the ZIP file into the "plugins" folder of your Auto-GPT project.
## AutoGPT Configuration
Set `ALLOWLISTED_PLUGINS=autogpt-wikipedia-search,example-plugin1,example-plugin2,etc` in your AutoGPT `.env` file.
<file_sep>/src/autogpt_plugins/email/email_plugin/test_email_plugin.py
import os
import unittest
from email.message import EmailMessage
from functools import partial
from unittest.mock import mock_open, patch
from email_plugin import (
adjust_imap_folder_for_gmail,
bothEmailAndPwdSet,
enclose_with_quotes,
imap_open,
read_emails,
send_email,
send_email_with_attachment_internal,
split_imap_search_command,
)
MOCK_FROM = "<EMAIL>"
MOCK_PWD = "<PASSWORD>"
MOCK_TO = "<EMAIL>"
MOCK_DATE = "Fri, 21 Apr 2023 10:00:00 -0000"
MOCK_CONTENT = "Test message"
MOCK_CONTENT_DIRTY = """
<html>
<head>
<title> Email Title </title>
</head>
<body>
This is an
<div>email template</div>
with a \n return character
and a link at the end</a>
</body>
</html>
(https://e.com)
"""
MOCK_SUBJECT = "Test Subject"
MOCK_IMAP_SERVER = "imap.example.com"
MOCK_SMTP_SERVER = "smtp.example.com"
MOCK_SMTP_PORT = "587"
MOCK_DRAFT_FOLDER = "Example/Drafts"
MOCK_ATTACHMENT_PATH = "example/file.txt"
MOCK_ATTACHMENT_NAME = "file.txt"
class TestEmailPlugin(unittest.TestCase):
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": "<EMAIL>",
"EMAIL_PASSWORD": "<PASSWORD>",
},
)
def test_both_email_and_pwd_set(self):
self.assertTrue(bothEmailAndPwdSet())
@patch.dict(
os.environ,
{
"EMAIL_PASSWORD": "<PASSWORD>",
},
clear=True,
)
def test_email_not_set(self):
self.assertFalse(bothEmailAndPwdSet())
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": "",
"EMAIL_PASSWORD": "<PASSWORD>password",
},
clear=True,
)
def test_email_not_set_2(self):
self.assertFalse(bothEmailAndPwdSet())
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": "<EMAIL>",
},
clear=True,
)
def test_pwd_not_set(self):
self.assertFalse(bothEmailAndPwdSet())
@patch.dict(os.environ, {}, clear=True)
def test_both_email_and_pwd_not_set(self):
self.assertFalse(bothEmailAndPwdSet())
def test_adjust_imap_folder_for_gmail_normal_cases(self):
self.assertEqual(
adjust_imap_folder_for_gmail("Sent", "<EMAIL>"),
'"[Gmail]/Sent Mail"',
)
self.assertEqual(
adjust_imap_folder_for_gmail("Drafts", "<EMAIL>"),
"[Gmail]/Drafts",
)
self.assertEqual(
adjust_imap_folder_for_gmail("Inbox", "<EMAIL>"), "Inbox"
)
def test_adjust_imap_folder_for_gmail_case_insensitivity(self):
self.assertEqual(
adjust_imap_folder_for_gmail("SeNT", "<EMAIL>"),
'"[Gmail]/Sent Mail"',
)
self.assertEqual(
adjust_imap_folder_for_gmail("DRAFTS", "<EMAIL>"),
"[Gmail]/Drafts",
)
self.assertEqual(
adjust_imap_folder_for_gmail("InbOx", "<EMAIL>"), "InbOx"
)
def test_adjust_imap_folder_for_gmail_non_gmail_sender(self):
self.assertEqual(adjust_imap_folder_for_gmail("Sent", "<EMAIL>"), "Sent")
self.assertEqual(
adjust_imap_folder_for_gmail("Drafts", "<EMAIL>"), "Drafts"
)
self.assertEqual(
adjust_imap_folder_for_gmail("SENT", "<EMAIL>"), "SENT"
)
def test_adjust_imap_folder_for_gmail_edge_cases(self):
self.assertEqual(adjust_imap_folder_for_gmail("", "<EMAIL>"), "")
self.assertEqual(adjust_imap_folder_for_gmail("Inbox", ""), "Inbox")
self.assertEqual(adjust_imap_folder_for_gmail("", ""), "")
def test_enclose_with_quotes(self):
assert enclose_with_quotes("REVERSE DATE") == '"REVERSE DATE"'
assert enclose_with_quotes('"My Search"') == '"My Search"'
assert enclose_with_quotes("'test me'") == "'test me'"
assert enclose_with_quotes("ALL") == "ALL"
assert enclose_with_quotes("quotes needed") == '"quotes needed"'
assert enclose_with_quotes(" whitespace ") == '" whitespace "'
assert enclose_with_quotes("whitespace\te") == '"whitespace\te"'
assert enclose_with_quotes("\"mixed quotes'") == "\"mixed quotes'"
assert enclose_with_quotes("'mixed quotes\"") == "'mixed quotes\""
def test_split_imap_search_command(self):
self.assertEqual(split_imap_search_command("SEARCH"), ["SEARCH"])
self.assertEqual(
split_imap_search_command("SEARCH UNSEEN"), ["SEARCH", "UNSEEN"]
)
self.assertEqual(
split_imap_search_command(" SEARCH UNSEEN "), ["SEARCH", "UNSEEN"]
)
self.assertEqual(
split_imap_search_command(
"FROM <EMAIL> SINCE 01-JAN-2022 BEFORE 01-FEB-2023 HAS attachment xls OR HAS attachment xlsx"
),
[
"FROM",
"<EMAIL> SINCE 01-JAN-2022 BEFORE 01-FEB-2023 HAS attachment xls OR HAS attachment xlsx",
],
)
self.assertEqual(
split_imap_search_command("BODY here is my long body"),
["BODY", "here is my long body"],
)
self.assertEqual(split_imap_search_command(""), [])
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
},
)
def test_imap_open(self, mock_imap):
# Test imapOpen function
imap_folder = "inbox"
imap_open(imap_folder, MOCK_FROM, MOCK_PWD)
# Check if the IMAP object was created and used correctly
mock_imap.assert_called_once_with(MOCK_IMAP_SERVER)
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with(imap_folder)
# Test for successful email sending without attachment
@patch("smtplib.SMTP", autospec=True)
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_SMTP_HOST": MOCK_SMTP_SERVER,
"EMAIL_SMTP_PORT": MOCK_SMTP_PORT,
},
)
def test_send_email_no_attachment(self, mock_smtp):
result = send_email(MOCK_TO, MOCK_SUBJECT, MOCK_CONTENT)
assert result == f"Email was sent to {MOCK_TO}!"
mock_smtp.assert_called_once_with(MOCK_SMTP_SERVER, MOCK_SMTP_PORT)
# Check if the SMTP object was created and used correctly
context = mock_smtp.return_value.__enter__.return_value
context.ehlo.assert_called()
context.starttls.assert_called_once()
context.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
context.send_message.assert_called_once()
context.quit.assert_called_once()
# Test for reading emails in a specific folder with a specific search command and pagination
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
},
)
def test_read_emails(self, mock_imap):
assert os.getenv("EMAIL_ADDRESS") == MOCK_FROM
# Create a mock email message
message = EmailMessage()
message["From"] = MOCK_FROM
message["To"] = MOCK_TO
message["Date"] = MOCK_DATE
message["Subject"] = MOCK_SUBJECT
message.set_content(MOCK_CONTENT)
# Set up mock IMAP server behavior
mock_imap.return_value.search.return_value = (None, [b"1"])
mock_imap.return_value.fetch.return_value = (None, [(b"1", message.as_bytes())])
# Test read_emails function
result = read_emails("inbox", "UNSEEN", 1, 1)
expected_result = [
{
"From": MOCK_FROM,
"To": MOCK_TO,
"Date": MOCK_DATE,
"CC": "",
"Subject": MOCK_SUBJECT,
"Message Body": MOCK_CONTENT,
}
]
assert result == expected_result
# Check if the IMAP object was created and used correctly
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with("inbox")
mock_imap.return_value.search.assert_called_once_with(None, "UNSEEN")
mock_imap.return_value.fetch.assert_called_once_with(b"1", "(BODY.PEEK[])")
# Test for reading empty emails
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
},
)
def test_read_empty_emails(self, mock_imap):
assert os.getenv("EMAIL_ADDRESS") == MOCK_FROM
# Set up mock IMAP server behavior
mock_imap.return_value.search.return_value = (None, [b"0"])
mock_imap.return_value.fetch.return_value = (None, [])
# Test read_emails function
result = read_emails("inbox", "UNSEEN", 1, 1)
expected = "There are no Emails in your folder `inbox` "
expected += "when searching with imap command `UNSEEN`"
assert result == expected
# Check if the IMAP object was created and used correctly
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with("inbox")
mock_imap.return_value.search.assert_called_once_with(None, "UNSEEN")
mock_imap.return_value.fetch.assert_called_once_with(b"0", "(BODY.PEEK[])")
# Test for reading emails in a specific folder
# with a specific search command with EMAIL_MARK_AS_SEEN=True
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
"EMAIL_MARK_AS_SEEN": "True",
},
)
def test_read_emails_mark_as_read_true(self, mock_imap):
assert os.getenv("EMAIL_ADDRESS") == MOCK_FROM
# Create a mock email message
message = EmailMessage()
message["From"] = MOCK_FROM
message["To"] = MOCK_TO
message["Date"] = MOCK_DATE
message["Subject"] = MOCK_SUBJECT
message.set_content(MOCK_CONTENT)
# Set up mock IMAP server behavior
mock_imap.return_value.search.return_value = (None, [b"1"])
mock_imap.return_value.fetch.return_value = (None, [(b"1", message.as_bytes())])
# Test read_emails function
result = read_emails("inbox", "UNSEEN", 1, 1)
expected_result = [
{
"From": MOCK_FROM,
"To": MOCK_TO,
"Date": MOCK_DATE,
"CC": "",
"Subject": MOCK_SUBJECT,
"Message Body": MOCK_CONTENT,
}
]
assert result == expected_result
# Check if the IMAP object was created and used correctly
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with("inbox")
mock_imap.return_value.search.assert_called_once_with(None, "UNSEEN")
mock_imap.return_value.fetch.assert_called_once_with(b"1", "(RFC822)")
# Test for reading emails in a specific folder
# with a specific search command with EMAIL_MARK_AS_SEEN=False
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
"EMAIL_MARK_AS_SEEN": "False",
},
)
def test_read_emails_mark_as_seen_false(self, mock_imap):
assert os.getenv("EMAIL_ADDRESS") == MOCK_FROM
# Create a mock email message
message = EmailMessage()
message["From"] = MOCK_FROM
message["To"] = MOCK_TO
message["Date"] = MOCK_DATE
message["Subject"] = MOCK_SUBJECT
message.set_content(MOCK_CONTENT)
# Set up mock IMAP server behavior
mock_imap.return_value.search.return_value = (None, [b"1"])
mock_imap.return_value.fetch.return_value = (None, [(b"1", message.as_bytes())])
# Test read_emails function
result = read_emails("inbox", "UNSEEN", 1, 1)
expected_result = [
{
"From": MOCK_FROM,
"To": MOCK_TO,
"Date": MOCK_DATE,
"CC": "",
"Subject": MOCK_SUBJECT,
"Message Body": MOCK_CONTENT,
}
]
assert result == expected_result
# Check if the IMAP object was created and used correctly
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with("inbox")
mock_imap.return_value.search.assert_called_once_with(None, "UNSEEN")
mock_imap.return_value.fetch.assert_called_once_with(b"1", "(BODY.PEEK[])")
def side_effect_for_open(original_open, file_path, *args, **kwargs):
if file_path == MOCK_ATTACHMENT_PATH:
return mock_open(read_data=b"file_content").return_value
return original_open(file_path, *args, **kwargs)
original_open = open
side_effect_with_original_open = partial(side_effect_for_open, original_open)
# Test for sending emails with EMAIL_DRAFT_MODE_WITH_FOLDER
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
"EMAIL_DRAFT_MODE_WITH_FOLDER": MOCK_DRAFT_FOLDER,
},
)
@patch(f"{__name__}.imap_open")
@patch("builtins.open", side_effect=side_effect_with_original_open)
def test_send_emails_with_draft_mode(self, mock_file, mock_imap_open, mock_imap):
mock_imap_conn = mock_imap_open.return_value
mock_imap_conn.select.return_value = ("OK", [b"0"])
mock_imap_conn.append.return_value = ("OK", [b"1"])
result = send_email_with_attachment_internal(
MOCK_TO,
MOCK_SUBJECT,
MOCK_CONTENT,
MOCK_ATTACHMENT_PATH,
MOCK_ATTACHMENT_NAME,
)
assert result == f"Email went to {MOCK_DRAFT_FOLDER}!"
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with(MOCK_DRAFT_FOLDER)
# Get the actual MIME message appended
mock_imap.return_value.append.assert_called_once()
append_args, _ = mock_imap.return_value.append.call_args
actual_mime_msg = append_args[3].decode("utf-8")
# Check for the presence of relevant information in the MIME message
assert MOCK_FROM in actual_mime_msg
assert MOCK_TO in actual_mime_msg
assert MOCK_SUBJECT in actual_mime_msg
assert MOCK_CONTENT in actual_mime_msg
assert MOCK_ATTACHMENT_NAME in actual_mime_msg
# Test for reading an email where the subject has enconding issues or is null
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
},
)
def test_read_emails_subject_unknown_encoding(self, mock_imap):
assert os.getenv("EMAIL_ADDRESS") == MOCK_FROM
# Create a mock email message
message = EmailMessage()
message["From"] = MOCK_FROM
message["To"] = MOCK_TO
message["Date"] = MOCK_DATE
message["Subject"] = None
message.set_content(MOCK_CONTENT)
# Set up mock IMAP server behavior
mock_imap.return_value.search.return_value = (None, [b"1"])
mock_imap.return_value.fetch.return_value = (None, [(b"1", message.as_bytes())])
# Test read_emails function
result = read_emails("inbox", "UNSEEN", 1, 1)
expected_result = [
{
"From": MOCK_FROM,
"To": MOCK_TO,
"Date": MOCK_DATE,
"CC": "",
"Subject": "",
"Message Body": MOCK_CONTENT,
}
]
assert result == expected_result
# Check if the IMAP object was created and used correctly
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with("inbox")
mock_imap.return_value.search.assert_called_once_with(None, "UNSEEN")
mock_imap.return_value.fetch.assert_called_once_with(b"1", "(BODY.PEEK[])")
# Test for reading an email where the body has enconding issues or is null
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
},
)
def test_read_emails_body_unknown_encoding(self, mock_imap):
assert os.getenv("EMAIL_ADDRESS") == MOCK_FROM
# Create a mock email message
message = EmailMessage()
message["From"] = MOCK_FROM
message["To"] = MOCK_TO
message["Date"] = MOCK_DATE
message["Subject"] = MOCK_SUBJECT
message.set_content("�������\n")
# Set up mock IMAP server behavior
mock_imap.return_value.search.return_value = (None, [b"1"])
mock_imap.return_value.fetch.return_value = (None, [(b"1", message.as_bytes())])
# Test read_emails function
result = read_emails("inbox", "UNSEEN", 1, 1)
expected_result = [
{
"From": MOCK_FROM,
"To": MOCK_TO,
"Date": MOCK_DATE,
"CC": "",
"Subject": MOCK_SUBJECT,
"Message Body": "",
}
]
assert result == expected_result
# Check if the IMAP object was created and used correctly
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with("inbox")
mock_imap.return_value.search.assert_called_once_with(None, "UNSEEN")
mock_imap.return_value.fetch.assert_called_once_with(b"1", "(BODY.PEEK[])")
# Test for cleaning an email's bodies
@patch("imaplib.IMAP4_SSL")
@patch.dict(
os.environ,
{
"EMAIL_ADDRESS": MOCK_FROM,
"EMAIL_PASSWORD": <PASSWORD>,
"EMAIL_IMAP_SERVER": MOCK_IMAP_SERVER,
},
)
def test_clean_email_body(self, mock_imap):
assert os.getenv("EMAIL_ADDRESS") == MOCK_FROM
# Create a mock email message
message = EmailMessage()
message["From"] = MOCK_FROM
message["To"] = MOCK_TO
message["Date"] = MOCK_DATE
message["Subject"] = MOCK_SUBJECT
message.set_content(MOCK_CONTENT_DIRTY)
# Set up mock IMAP server behavior
mock_imap.return_value.search.return_value = (None, [b"1"])
mock_imap.return_value.fetch.return_value = (None, [(b"1", message.as_bytes())])
# Test read_emails with paginationfunction
result = read_emails("inbox", "UNSEEN", 1, 1)
expected_result = [
{
"From": MOCK_FROM,
"To": MOCK_TO,
"Date": MOCK_DATE,
"CC": "",
"Subject": MOCK_SUBJECT,
"Message Body": "Email Title This is an email template with a return character and a link at the end (",
}
]
assert result == expected_result
# Check if the IMAP object was created and used correctly
mock_imap.return_value.login.assert_called_once_with(MOCK_FROM, MOCK_PWD)
mock_imap.return_value.select.assert_called_once_with("inbox")
mock_imap.return_value.search.assert_called_once_with(None, "UNSEEN")
mock_imap.return_value.fetch.assert_called_once_with(b"1", "(BODY.PEEK[])")
if __name__ == "__main__":
unittest.main()
<file_sep>/src/autogpt_plugins/news_search/__init__.py
"""This is the News search engine plugin for Auto-GPT."""
import os
from typing import Any, Dict, List, Optional, Tuple, TypedDict, TypeVar
from auto_gpt_plugin_template import AutoGPTPluginTemplate
from .news_search import NewsSearch
PromptGenerator = TypeVar("PromptGenerator")
class Message(TypedDict):
role: str
content: str
class AutoGPTNewsSearch(AutoGPTPluginTemplate):
def __init__(self):
super().__init__()
self._name = "News-Search-Plugin"
self._version = "0.1.0"
self._description = "This plugin searches the latest news using the provided query and the newsapi aggregator"
self.load_commands = os.getenv(
"NEWSAPI_API_KEY"
) # Wrapper, if more variables are needed in future
self.news_search = NewsSearch(os.getenv("NEWSAPI_API_KEY"))
def can_handle_post_prompt(self) -> bool:
return True
def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
if self.load_commands:
# Add News Search command
prompt.add_command(
"News Search",
"news_search",
{"query": "<query>"},
self.news_search.news_everything_search,
)
else:
print(
"Warning: News-Search-Plugin is not fully functional. "
"Please set the NEWSAPI_API_KEY environment variable."
)
return prompt
def can_handle_pre_command(self) -> bool:
return False
def pre_command(
self, command_name: str, arguments: Dict[str, Any]
) -> Tuple[str, Dict[str, Any]]:
pass
def can_handle_post_command(self) -> bool:
return False
def post_command(self, command_name: str, response: str) -> str:
pass
def can_handle_on_planning(self) -> bool:
return False
def on_planning(
self, prompt: PromptGenerator, messages: List[Message]
) -> Optional[str]:
pass
def can_handle_on_response(self) -> bool:
return False
def on_response(self, response: str, *args, **kwargs) -> str:
pass
def can_handle_post_planning(self) -> bool:
return False
def post_planning(self, response: str) -> str:
pass
def can_handle_pre_instruction(self) -> bool:
return False
def pre_instruction(self, messages: List[Message]) -> List[Message]:
pass
def can_handle_on_instruction(self) -> bool:
return False
def on_instruction(self, messages: List[Message]) -> Optional[str]:
pass
def can_handle_post_instruction(self) -> bool:
return False
def post_instruction(self, response: str) -> str:
pass
def can_handle_pre_command(self) -> bool:
return False
def can_handle_chat_completion(
self, messages: Dict[Any, Any], model: str, temperature: float, max_tokens: int
) -> bool:
return False
def handle_chat_completion(
self, messages: List[Message], model: str, temperature: float, max_tokens: int
) -> str:
pass
def can_handle_text_embedding(
self, text: str
) -> bool:
return False
def handle_text_embedding(
self, text: str
) -> list:
pass
def can_handle_user_input(self, user_input: str) -> bool:
return False
def user_input(self, user_input: str) -> str:
return user_input
def can_handle_report(self) -> bool:
return False
def report(self, message: str) -> None:
pass<file_sep>/src/autogpt_plugins/telegram/telegram_chat.py
import asyncio
import os
import random
import traceback
from telegram import Bot, Update
from telegram.error import TimedOut
from telegram.ext import CallbackContext
response_queue = ""
class TelegramUtils:
def __init__(self, api_key: str = None, chat_id: str = None):
if not api_key:
print(
"No api key provided. Please set the TELEGRAM_API_KEY environment variable."
)
print("You can get your api key by talking to @BotFather on Telegram.")
print(
"For more information, please visit: https://core.telegram.org/bots/tutorial#6-botfather"
)
return
self.api_key = api_key
if not chat_id:
print(
"TELEGRAM PLUGIN: No chat id provided. Please set the TELEGRAM_CHAT_ID environment variable."
)
user_input = input(
"Would you like to send a test message to your bot to get the id? (y/n): "
)
if user_input == "y":
try:
print("Please send a message to your telegram bot now.")
update = self.poll_anyMessage()
print("Message received! Getting chat id...")
chat_id = update.message.chat.id
print("Your chat id is: " + str(chat_id))
print("And the message is: " + update.message.text)
confirmation = random.randint(1000, 9999)
print("Sending confirmation message: " + str(confirmation))
text = f"Hello! Your chat id is: {chat_id} and the confirmation code is: {confirmation}"
self.chat_id = chat_id
self.send_message(text) # Send confirmation message
print(
"Please set the TELEGRAM_CHAT_ID environment variable to this value."
)
except TimedOut:
print(
"Error while sending test message. Please check your Telegram bot."
)
return
self.chat_id = chat_id
def poll_anyMessage(self):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
return loop.run_until_complete(self.poll_anyMessage_async())
async def poll_anyMessage_async(self):
bot = Bot(token=self.api_key)
last_update = await bot.get_updates(timeout=30)
if len(last_update) > 0:
last_update_id = last_update[-1].update_id
else:
last_update_id = -1
while True:
try:
print("Waiting for first message...")
updates = await bot.get_updates(offset=last_update_id + 1, timeout=30)
for update in updates:
if update.message:
return update
except Exception as e:
print(f"Error while polling updates: {e}")
await asyncio.sleep(1)
def is_authorized_user(self, update: Update):
return update.effective_user.id == int(self.chat_id)
def handle_response(self, update: Update, context: CallbackContext):
try:
print("Received response: " + update.message.text)
if self.is_authorized_user(update):
response_queue.put(update.message.text)
except Exception as e:
print(e)
async def delete_old_messages(self):
bot = await self.get_bot()
updates = await bot.get_updates(offset=0)
count = 0
for update in updates:
try:
print(
"Deleting message: "
+ update.message.text
+ " "
+ str(update.message.message_id)
)
await bot.delete_message(
chat_id=update.message.chat.id, message_id=update.message.message_id
)
except Exception as e:
print(
f"Error while deleting message: {e} \n"
+ f" update: {update} \n {traceback.format_exc()}"
)
count += 1
if count > 0:
print("Cleaned up old messages.")
async def get_bot(self):
bot_token = self.api_key
bot = Bot(token=bot_token)
commands = await bot.get_my_commands()
if len(commands) == 0:
await self.set_commands(bot)
commands = await bot.get_my_commands()
return bot
async def set_commands(self, bot):
await bot.set_my_commands(
[
("start", "Start Auto-GPT"),
("stop", "Stop Auto-GPT"),
("help", "Show help"),
("yes", "Confirm"),
("no", "Deny"),
("auto", "Let an Agent decide"),
]
)
def send_message(self, message):
try:
loop = asyncio.get_running_loop()
except RuntimeError as e: # 'RuntimeError: There is no current event loop...'
loop = None
try:
if loop and loop.is_running():
print(
"Sending message async, if this fials its due to rununtil complete task"
)
loop.create_task(self._send_message(message=message))
else:
eventloop = asyncio.get_event_loop
if hasattr(eventloop, "run_until_complete") and eventloop.is_running():
print("Event loop is running")
eventloop.run_until_complete(self._send_message(message=message))
else:
asyncio.run(self._send_message(message=message))
except RuntimeError as e:
print(traceback.format_exc())
print("Error while sending message")
print(e)
def send_voice(self, voice_file):
try:
self.get_bot().send_voice(
chat_id=self.chat_id, voice=open(voice_file, "rb")
)
except RuntimeError:
print("Error while sending voice message")
async def _send_message(self, message):
print("Sending message to Telegram.. ")
recipient_chat_id = self.chat_id
bot = await self.get_bot()
# properly handle messages with more than 2000 characters by chunking them
if len(message) > 2000:
message_chunks = [
message[i : i + 2000] for i in range(0, len(message), 2000)
]
for message_chunk in message_chunks:
await bot.send_message(chat_id=recipient_chat_id, text=message_chunk)
else:
await bot.send_message(chat_id=recipient_chat_id, text=message)
async def ask_user_async(self, prompt):
global response_queue
# only display confirm if the prompt doesnt have the string ""Continue (y/n):"" inside
if "Continue (y/n):" in prompt or "Waiting for your response..." in prompt:
question = (
prompt
+ " \n Confirm: /yes Decline: /no \n Or type your answer. \n or press /auto to let an Agent decide."
)
elif "I want Auto-GPT to:" in prompt:
question = prompt
else:
question = (
prompt + " \n Type your answer or press /auto to let an Agent decide."
)
response_queue = ""
# await delete_old_messages()
print("Asking user: " + question)
await self._send_message(message=question)
print("Waiting for response on Telegram chat...")
await self._poll_updates()
if response_queue == "/start":
response_queue = await self.ask_user(
self,
prompt="I am already here... \n Please use /stop to stop me first.",
)
if response_queue == "/help":
response_queue = await self.ask_user(
self,
prompt="You can use /stop to stop me \n and /start to start me again.",
)
if response_queue == "/auto":
return "s"
if response_queue == "/stop":
await self._send_message("Stopping Auto-GPT now!")
exit(0)
elif response_queue == "/yes":
response_text = "yes"
response_queue = "yes"
elif response_queue == "/no":
response_text = "no"
response_queue = "no"
if response_queue.capitalize() in [
"Yes",
"Okay",
"Ok",
"Sure",
"Yeah",
"Yup",
"Yep",
]:
response_text = "y"
elif response_queue.capitalize() in ["No", "Nope", "Nah", "N"]:
response_text = "n"
else:
response_text = response_queue
print("Response received from Telegram: " + response_text)
return response_text
async def _poll_updates(self):
global response_queue
bot = await self.get_bot()
print("getting updates...")
try:
last_update = await bot.get_updates(timeout=1)
if len(last_update) > 0:
last_update_id = last_update[-1].update_id
else:
last_update_id = -1
print("last update id: " + str(last_update_id))
while True:
try:
print("Polling updates...")
updates = await bot.get_updates(
offset=last_update_id + 1, timeout=30
)
for update in updates:
if update.message and update.message.text:
if self.is_authorized_user(update):
response_queue = update.message.text
return
last_update_id = max(last_update_id, update.update_id)
except Exception as e:
print(f"Error while polling updates: {e}")
await asyncio.sleep(1)
except RuntimeError:
print("Error while polling updates")
def ask_user(self, prompt):
print("Asking user: " + prompt)
try:
loop = asyncio.get_running_loop()
except RuntimeError: # 'RuntimeError: There is no current event loop...'
loop = None
try:
if loop and loop.is_running():
return loop.create_task(self.ask_user_async(prompt=prompt))
else:
return asyncio.run(self.ask_user_async(prompt=prompt))
except TimedOut:
print("Telegram timeout error, trying again...")
return self.ask_user(prompt=prompt)
if __name__ == "__main__":
telegram_api_key = os.getenv("TELEGRAM_API_KEY")
telegram_chat_id = os.getenv("TELEGRAM_CHAT_ID")
telegram_utils = TelegramUtils(chat_id=telegram_chat_id, api_key=telegram_api_key)
telegram_utils.send_message("Hello World!")
<file_sep>/src/autogpt_plugins/baidu_search/test_auto_gpt_baidu_plugin.py
import os
import unittest
from typing import List
import requests
from . import AutoGPTBaiduSearch
from .baidu_search import _baidu_search
class TestAutoGPTBaiduSearch(unittest.TestCase):
def setUp(self):
os.environ["BAIDU_COOKIE"] = "test_cookie"
os.environ["SEARCH_ENGINE"] = "baidu"
self.plugin = AutoGPTBaiduSearch()
def tearDown(self):
os.environ.pop("SEARCH_ENGINE", None)
os.environ.pop("BAIDU_COOKIE", None)
def test_baidu_search(self):
query = "test query"
try:
_baidu_search(query)
except requests.exceptions.HTTPError as e:
self.assertEqual(e.response.status_code, 401)
def test_pre_command(self):
os.environ["SEARCH_ENGINE"] = "baidu"
self.plugin = AutoGPTBaiduSearch()
command_name, arguments = self.plugin.pre_command(
"google", {"query": "test query"}
)
self.assertEqual(command_name, "baidu_search")
self.assertEqual(arguments, {"query": "test query"})
def test_can_handle_pre_command(self):
self.assertTrue(self.plugin.can_handle_pre_command())
def test_can_handle_post_prompt(self):
self.assertTrue(self.plugin.can_handle_post_prompt())
if __name__ == "__main__":
unittest.main()
<file_sep>/src/autogpt_plugins/twitter/twitter.py
"""This module contains functions for interacting with the Twitter API."""
from __future__ import annotations
import pandas as pd
import tweepy
from . import AutoGPTTwitter
plugin = AutoGPTTwitter()
def post_tweet(tweet_text: str) -> str:
"""Posts a tweet to twitter.
Args:
tweet (str): The tweet to post.
Returns:
str: The tweet that was posted.
"""
_tweetID = plugin.api.update_status(status=tweet_text)
return f"Success! Tweet: {_tweetID.text}"
def post_reply(tweet_text: str, tweet_id: int) -> str:
"""Posts a reply to a tweet.
Args:
tweet (str): The tweet to post.
tweet_id (int): The ID of the tweet to reply to.
Returns:
str: The tweet that was posted.
"""
replyID = plugin.api.update_status(
status=tweet_text,
in_reply_to_status_id=tweet_id,
auto_populate_reply_metadata=True,
)
return f"Success! Tweet: {replyID.text}"
def get_mentions() -> str | None:
"""Gets the most recent mention.
Args:
api (tweepy.API): The tweepy API object.
Returns:
str | None: The most recent mention.
"""
_tweets = plugin.api.mentions_timeline(tweet_mode="extended")
for tweet in _tweets:
return (
f"@{tweet.user.screen_name} Replied: {tweet.full_text}"
f" Tweet ID: {tweet.id}"
) # Returns most recent mention
def search_twitter_user(target_user: str, number_of_tweets: int) -> str:
"""Searches a user's tweets given a number of items to retrive and
returns a dataframe.
Args:
target_user (str): The user to search.
num_of_items (int): The number of items to retrieve.
api (tweepy.API): The tweepy API object.
Returns:
str: The dataframe containing the tweets.
"""
tweets = tweepy.Cursor(
plugin.api.user_timeline, screen_name=target_user, tweet_mode="extended"
).items(number_of_tweets)
columns = ["Time", "User", "ID", "Tweet"]
data = []
for tweet in tweets:
data.append(
[tweet.created_at, tweet.user.screen_name, tweet.id, tweet.full_text]
)
df = str(pd.DataFrame(data, columns=columns))
print(df)
return df # Prints a dataframe object containing the Time, User, ID, and Tweet
<file_sep>/src/autogpt_plugins/planner/__init__.py
"""This is a task planning system plugin for Auto-GPT. It is able to create tasks, elaborate a plan, improve upon it
and check it again to keep on track.
built by @rihp on github"""
from typing import Any, Dict, List, Optional, Tuple, TypedDict, TypeVar
from auto_gpt_plugin_template import AutoGPTPluginTemplate
from .planner import (
check_plan,
create_task,
load_tasks,
update_plan,
update_task_status,
)
PromptGenerator = TypeVar("PromptGenerator")
class Message(TypedDict):
role: str
content: str
class PlannerPlugin(AutoGPTPluginTemplate):
"""
This is a task planner system plugin for Auto-GPT which
adds the task planning commands to the prompt.
"""
def __init__(self):
super().__init__()
self._name = "AutoGPT-Planner-Plugin"
self._version = "0.1.1"
self._description = "This is a simple task planner module for Auto-GPT. It adds the run_planning_cycle " \
"command along with other task related commands. Creates a plan.md file and tasks.json " \
"to manage the workloads. For help and discussion: " \
"https://discord.com/channels/1092243196446249134/1098737397094694922/threads/1102780261604790393"
def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
"""This method is called just after the generate_prompt is called,
but actually before the prompt is generated.
Args:
prompt (PromptGenerator): The prompt generator.
Returns:
PromptGenerator: The prompt generator.
"""
prompt.add_command(
"check_plan",
"Read the plan.md with the next goals to achieve",
{},
check_plan,
)
prompt.add_command(
"run_planning_cycle",
"Improves the current plan.md and updates it with progress",
{},
update_plan,
)
prompt.add_command(
"create_task",
"creates a task with a task id, description and a completed status of False ",
{
"task_id": "<int>",
"task_description": "<The task that must be performed>",
},
create_task,
)
prompt.add_command(
"load_tasks",
"Checks out the task ids, their descriptionsand a completed status",
{},
load_tasks,
)
prompt.add_command(
"mark_task_completed",
"Updates the status of a task and marks it as completed",
{"task_id": "<int>"},
update_task_status,
)
return prompt
def can_handle_post_prompt(self) -> bool:
"""This method is called to check that the plugin can
handle the post_prompt method.
Returns:
bool: True if the plugin can handle the post_prompt method."""
return True
def can_handle_on_response(self) -> bool:
"""This method is called to check that the plugin can
handle the on_response method.
Returns:
bool: True if the plugin can handle the on_response method."""
return False
def on_response(self, response: str, *args, **kwargs) -> str:
"""This method is called when a response is received from the model."""
pass
def can_handle_on_planning(self) -> bool:
"""This method is called to check that the plugin can
handle the on_planning method.
Returns:
bool: True if the plugin can handle the on_planning method."""
return False
def on_planning(
self, prompt: PromptGenerator, messages: List[Message]
) -> Optional[str]:
"""This method is called before the planning chat completion is done.
Args:
prompt (PromptGenerator): The prompt generator.
messages (List[str]): The list of messages.
"""
pass
def can_handle_post_planning(self) -> bool:
"""This method is called to check that the plugin can
handle the post_planning method.
Returns:
bool: True if the plugin can handle the post_planning method."""
return False
def post_planning(self, response: str) -> str:
"""This method is called after the planning chat completion is done.
Args:
response (str): The response.
Returns:
str: The resulting response.
"""
pass
def can_handle_pre_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the pre_instruction method.
Returns:
bool: True if the plugin can handle the pre_instruction method."""
return False
def pre_instruction(self, messages: List[Message]) -> List[Message]:
"""This method is called before the instruction chat is done.
Args:
messages (List[Message]): The list of context messages.
Returns:
List[Message]: The resulting list of messages.
"""
pass
def can_handle_on_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the on_instruction method.
Returns:
bool: True if the plugin can handle the on_instruction method."""
return False
def on_instruction(self, messages: List[Message]) -> Optional[str]:
"""This method is called when the instruction chat is done.
Args:
messages (List[Message]): The list of context messages.
Returns:
Optional[str]: The resulting message.
"""
pass
def can_handle_post_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the post_instruction method.
Returns:
bool: True if the plugin can handle the post_instruction method."""
return False
def post_instruction(self, response: str) -> str:
"""This method is called after the instruction chat is done.
Args:
response (str): The response.
Returns:
str: The resulting response.
"""
pass
def can_handle_pre_command(self) -> bool:
"""This method is called to check that the plugin can
handle the pre_command method.
Returns:
bool: True if the plugin can handle the pre_command method."""
return False
def pre_command(
self, command_name: str, arguments: Dict[str, Any]
) -> Tuple[str, Dict[str, Any]]:
"""This method is called before the command is executed.
Args:
command_name (str): The command name.
arguments (Dict[str, Any]): The arguments.
Returns:
Tuple[str, Dict[str, Any]]: The command name and the arguments.
"""
pass
def can_handle_post_command(self) -> bool:
"""This method is called to check that the plugin can
handle the post_command method.
Returns:
bool: True if the plugin can handle the post_command method."""
return False
def post_command(self, command_name: str, response: str) -> str:
"""This method is called after the command is executed.
Args:
command_name (str): The command name.
response (str): The response.
Returns:
str: The resulting response.
"""
pass
def can_handle_chat_completion(
self, messages: Dict[Any, Any], model: str, temperature: float, max_tokens: int
) -> bool:
"""This method is called to check that the plugin can
handle the chat_completion method.
Args:
messages (List[Message]): The messages.
model (str): The model name.
temperature (float): The temperature.
max_tokens (int): The max tokens.
Returns:
bool: True if the plugin can handle the chat_completion method."""
return False
def handle_chat_completion(
self, messages: List[Message], model: str, temperature: float, max_tokens: int
) -> str:
"""This method is called when the chat completion is done.
Args:
messages (List[Message]): The messages.
model (str): The model name.
temperature (float): The temperature.
max_tokens (int): The max tokens.
Returns:
str: The resulting response.
"""
pass
def can_handle_text_embedding(
self, text: str
) -> bool:
return False
def handle_text_embedding(
self, text: str
) -> list:
pass
def can_handle_user_input(self, user_input: str) -> bool:
return False
def user_input(self, user_input: str) -> str:
return user_input
def can_handle_report(self) -> bool:
return False
def report(self, message: str) -> None:
pass<file_sep>/src/autogpt_plugins/planner/README.md
# AutoGPT Planner Plugin
Simple planning commands for planning leveraged with chatgpt3.5 and json objects to keep track of its progress on a list of tasks.

### Getting started
After you clone the plugin from the original repo (https://github.com/rihp/autogpt-planner-plugin) Add it to the plugins folder of your AutoGPT repo and then run AutoGPT

Remember to also update your .env to include
```
ALLOWLISTED_PLUGINS=PlannerPlugin
```
# New commands
```python
prompt.add_command(
"check_plan",
"Read the plan.md with the next goals to achieve",
{},
check_plan,
)
prompt.add_command(
"run_planning_cycle",
"Improves the current plan.md and updates it with progress",
{},
update_plan,
)
prompt.add_command(
"create_task",
"creates a task with a task id, description and a completed status of False ",
{
"task_id": "<int>",
"task_description": "<The task that must be performed>",
},
create_task,
)
prompt.add_command(
"load_tasks",
"Checks out the task ids, their descriptionsand a completed status",
{},
load_tasks,
)
prompt.add_command(
"mark_task_completed",
"Updates the status of a task and marks it as completed",
{"task_id": "<int>"},
update_task_status,
)
```
# New config options
By default, the plugin is set ot use what ever your `FAST_LLM_MODEL` environment variable is set to, if none is set it
will fall back to `gpt-3.5-turbo`. If you want to set it individually to a different model you can do that by setting
the environment variable `PLANNER_MODEL` to the model you want to use (example: `gpt-4`).
Similarly, the token limit defaults to the `FAST_TOKEN_LIMIT` environment variable, if none is set it will fall
back to `1500`. If you want to set it individually to a different limit for the plugin you can do that by setting
`PLANNER_TOKEN_LIMIT` to the desired limit (example: `7500`).
And last, but not least, the temperature used defaults to the `TEMPERATURE` environment variable, if none is set it will
fall back to `0.5`. If you want to set it individually to a different temperature for the plugin you can do that by
setting `PLANNER_TEMPERATURE` to the desired temperature (example: `0.3`).
## CODE SAMPLES
Example of generating an improved plan
```python
def generate_improved_plan(prompt: str) -> str:
"""Generate an improved plan using OpenAI's ChatCompletion functionality"""
import openai
tasks = load_tasks()
# Call the OpenAI API for chat completion
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "system",
"content": "You are an assistant that improves and adds crucial points to plans in .md format.",
},
{
"role": "user",
"content": f"Update the following plan given the task status below, keep the .md format:\n{prompt}\nInclude the current tasks in the improved plan, keep mind of their status and track them with a checklist:\n{tasks}\Revised version should comply with the contests of the tasks at hand:",
},
],
max_tokens=1500,
n=1,
temperature=0.5,
)
```
## Testing workflow
Clone the repo and modify the functionality, when you're done you can run
```
zip -ru ../fork/plugins/planner.zip . ; cd ../fork && python3 -m autogpt --debug
```
then you need to cd back to
```
cd ../autogpt-planner-plugin
```
<file_sep>/src/autogpt_plugins/baidu_search/README.md
# Auto-GPT Baidu Search Plugin
Language: [English](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/baidu_search/README.md) | [中文](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/baidu_search/README.zh.md)
This search plugin integrates Baidu search engines into Auto-GPT, complementing the existing support for Google Search and DuckDuckGo Search provided by the main repository.
## Key Features:
- Baidu Search: Perform search queries using the Baidu search engine.
## How it works
If the environment variables for the search engine (`SEARCH_ENGINE`) and the Baidu cookie (`BAIDU_COOKIE`) are set, the search engine will be set to Baidu.
## Obtaining Baidu Cookie:
1. Open the Chrome browser and search for something on Baidu.
2. Open Developer Tools (press F12 or right-click and select "Inspect").
3. Go to the "Network" tab.
4. Find the first name file in the list of network requests.
5. On the right side, find the "Cookie" header and copy all of its content(it's very long).

Set the `BAIDU_COOKIE` in the `.env` file:
```
SEARCH_ENGINE=baidu
BAIDU_COOKIE=your-baidu-cookie
```
Remember to replace `your-baidu-cookie` with the actual cookie content you obtained from the Chrome Developer Tools.
## Note
In most cases, the AutoGPT bot's queries are automatically set to English. However, if you wish to search in Chinese, you can specify the language in the goals.<file_sep>/src/autogpt_plugins/bing_search/test_auto_gpt_bing.py
import os
import unittest
from typing import List
import requests
from . import AutoGPTBingSearch
from .bing_search import _bing_search
class TestAutoGPTBingSearch(unittest.TestCase):
def setUp(self):
os.environ["BING_API_KEY"] = "test_key"
os.environ["SEARCH_ENGINE"] = "bing"
self.plugin = AutoGPTBingSearch()
def tearDown(self):
os.environ.pop("SEARCH_ENGINE", None)
os.environ.pop("BING_API_KEY", None)
def test_bing_search(self):
query = "test query"
try:
_bing_search(query)
except requests.exceptions.HTTPError as e:
self.assertEqual(e.response.status_code, 401)
def test_pre_command(self):
os.environ["SEARCH_ENGINE"] = "bing"
self.plugin = AutoGPTBingSearch()
command_name, arguments = self.plugin.pre_command(
"google", {"query": "test query"}
)
self.assertEqual(command_name, "bing_search")
self.assertEqual(arguments, {"query": "test query"})
def test_can_handle_pre_command(self):
self.assertTrue(self.plugin.can_handle_pre_command())
def test_can_handle_post_prompt(self):
self.assertTrue(self.plugin.can_handle_post_prompt())
if __name__ == "__main__":
unittest.main()
<file_sep>/src/autogpt_plugins/wikipedia_search/wikipedia_search.py
"""Wikipedia search command for Autogpt."""
from __future__ import annotations
import json
import re
from urllib.parse import quote
import requests
HTML_TAG_CLEANER = re.compile("<.*?>|&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});")
def _wikipedia_search(query: str, num_results: int = 5) -> str | list[str]:
"""Return the results of a Wikipedia search
Args:
query (str): The search query.
num_results (int): The number of results to return.
Returns:
str: The results of the search. The resulting string is a `json.dumps`
of a list of len `num_results` containing dictionaries with the
following structure: `{'title': <title>, 'summary': <summary>,
'url': <url to relevant page>}`
"""
search_url = (
"https://en.wikipedia.org/w/api.php?action=query&"
"format=json&list=search&utf8=1&formatversion=2&"
f"srsearch={quote(query)}"
)
with requests.Session() as session:
session.headers.update(
{
"User-Agent": (
"Mozilla/5.0 (Windows NT 10.0; "
"Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/"
"112.0.5615.49 Safari/537.36"
)
}
)
session.headers.update({"Accept": "application/json"})
results = session.get(search_url)
items = []
try:
results = results.json()
for item in results["query"]["search"]:
summary = re.sub(HTML_TAG_CLEANER, "", item["snippet"])
items.append(
{
"title": item["title"],
"summary": summary,
"url": f"http://en.wikipedia.org/?curid={item['pageid']}",
}
)
if len(items) == num_results:
break
except Exception as e:
return f"'wikipedia_search' on query: '{query}' raised exception: '{e}'"
return json.dumps(items, ensure_ascii=False, indent=4)
<file_sep>/src/autogpt_plugins/api_tools/api_tools.py
"""API Call command for Autogpt."""
import json
import re
import requests
from typing import Dict, Optional
from urllib.parse import urljoin, urlparse
from urllib.parse import urljoin
from validators import url as is_valid_url
class ApiCallCommand:
"""
A class used to make API calls.
"""
def sanitize_string(self, input_string: str) -> str:
"""
Remove potentially harmful characters from the string.
Args:
input_string (str): The string to sanitize.
Returns:
str: The sanitized string.
"""
return re.sub(r'[^a-zA-Z0-9_: -{}[\],"]', '', input_string)
# End of sanitize_string()
def sanitize_json(self, input_string: str) -> str:
"""
Sanitize all the values in a JSON string.
Args:
input_string (str): The JSON string to sanitize.
Returns:
str: The sanitized JSON string.
"""
data = json.loads(input_string)
sanitized_data = {self.sanitize_string(k): self.sanitize_string(str(v)) for k, v in data.items()}
return json.dumps(sanitized_data)
# End of sanitize_json()
def sanitize(self, input_string: str) -> str:
"""
Remove potentially harmful characters from the input string.
Args:
input_string (str): The string to sanitize.
Returns:
str: The sanitized string.
"""
try:
sanitized_string = self.sanitize_json(input_string)
except json.JSONDecodeError:
sanitized_string = self.sanitize_string(input_string)
return sanitized_string
# End of sanitize()
def make_api_call(self, host = "", endpoint = "", mthd = "GET", params = {}, body = "",
hdrs = {"Content-Type": "application/json"}, timeout = 60) -> str:
"""
Return the results of an API call
Args:
host (str): The host to call.
endpoint (str): The endpoint to call.
mthd (str): The HTTP method to use.
params (dict): The query parameters to use.
body (str): The body to use.
hdrs (dict): The headers to use.
timeout (int): The timeout to use.
Returns:
str: A JSON string containing the results of the API
call in the format
{"status": "success|error", "status_code": int, "response": str, "response": str}
"""
# Initialize variables
response = {}
# Type-check inputs - host
if not isinstance(host, str):
raise ValueError("host must be a string")
# Type-check inputs - endpoint
if not isinstance(endpoint, str):
raise ValueError("endpoint must be a string")
# Type-check inputs - method
if not isinstance(mthd, str):
raise ValueError("method must be a string")
# Type-check inputs - query_params
if not params:
params = {}
elif isinstance(params, str):
try:
params = json.loads(params)
except json.JSONDecodeError:
raise ValueError("query_params must be a dictionary")
elif isinstance(params, dict):
new_query_params = {}
for k, v in params.items():
if k is None:
raise ValueError("query_params cannot contain None keys")
if not isinstance(k, str):
k = str(k)
if v is not None and not isinstance(v, str):
v = str(v)
new_query_params[k] = v
params = new_query_params
else:
raise ValueError("query_params must be a dictionary or a JSON string")
# Type-check inputs - body
if not isinstance(body, str):
try:
body = str(body)
except ValueError:
raise ValueError("body must be a string")
# Type-check inputs - headers
if not hdrs:
hdrs = {}
elif isinstance(hdrs, str):
try:
hdrs = json.loads(hdrs)
except json.JSONDecodeError:
raise ValueError("headers must be a dictionary")
elif isinstance(hdrs, dict):
new_headers = {}
for k, v in hdrs.items():
if k is None:
raise ValueError("headers cannot contain None keys")
if not isinstance(k, str):
k = str(k)
if v is not None and not isinstance(v, str):
v = str(v)
new_headers[k] = v
hdrs = new_headers
else:
raise ValueError("headers must be a dictionary or a JSON string")
# Type-check inputs - timeout_secs
if timeout is None:
raise ValueError("timeout_secs must be an integer")
elif not isinstance(timeout, int):
try:
timeout = int(timeout)
except ValueError:
raise ValueError("timeout_secs must be an integer")
# Validate URL
if '?' in host or '&' in host:
raise ValueError("Invalid URL: Host must not contain query parameters")
sanitized_host = self.sanitize(host)
sanitized_endpoint = self.sanitize(endpoint)
if not sanitized_host.startswith(("http://", "https://")):
sanitized_host = f"https://{sanitized_host}"
url = urljoin(sanitized_host, sanitized_endpoint)
if not is_valid_url(url): # type: ignore
raise ValueError("Invalid URL: " + url)
# Validate method
allowed_methods = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
sanitized_method = self.sanitize(mthd).upper()
if sanitized_method not in allowed_methods:
raise ValueError("Invalid method: " + sanitized_method)
# Validate timeout_secs
if not timeout > 0:
raise ValueError("timeout_secs must be a positive integer")
# Make the request
try:
if sanitized_method == "GET":
response = requests.get(url, params=params, headers=hdrs, timeout=timeout)
elif sanitized_method == "HEAD":
response = requests.head(url, params=params, headers=hdrs, timeout=timeout)
elif sanitized_method == "OPTIONS":
response = requests.options(url, params=params, headers=hdrs, timeout=timeout)
elif sanitized_method == "POST":
response = requests.post(url, params=params, json=body, headers=hdrs, timeout=timeout)
elif sanitized_method == "PUT":
response = requests.put(url, params=params, json=body, headers=hdrs, timeout=timeout)
elif sanitized_method == "DELETE":
response = requests.delete(url, params=params, json=body, headers=hdrs, timeout=timeout)
elif sanitized_method == "PATCH":
response = requests.patch(url, params=params, json=body, headers=hdrs, timeout=timeout)
else:
raise ValueError("Invalid method: " + mthd)
response_text = response.text
response = {
"status": "success",
"status_code": response.status_code,
"response": response_text
}
except requests.exceptions.RequestException as e:
response = {
"status": "error",
"status_code": None,
"response": str(e)
}
return json.dumps(response)
# End of call_api()
# End of class ApiCallCommand
<file_sep>/src/autogpt_plugins/news_search/news_search.py
import concurrent.futures
from typing import List
from newsapi import NewsApiClient
categories = ["technology", "business", "entertainment", "health", "sports", "science"]
class NewsSearch(object):
def __init__(self, api_key):
self.news_api_client = NewsApiClient(api_key)
def news_headlines_search(self, category: str, query: str) -> List[str]:
"""
Get top news headlines for category specified.
Args:
category (str) : The category specified. Must be one of technology, business, entertainment, health, sports or science.
Returns:
list(str): A list of top news headlines for the specified category.
"""
result = self.news_api_client.get_top_headlines(
category=category, language="en", country="us", page=1, q=query
)
return [article["title"] for article in result["articles"][:3]]
def news_everything_search(self, query: str) -> List[str]:
"""
Get all news for query specified.
Args:
query (str) : The query specified.
Returns:
list(str): A list of news for the specified category, sorted by relevant.
"""
result = self.news_api_client.get_everything(
language="en", page=1, q=query, sort_by="relevancy"
)
return [article["title"] for article in result["articles"]]
def news_headlines_search_wrapper(self, query: str) -> List[str]:
"""
Aggregates top news headlines from the categories.
Returns:
list(str): A list of top news headlines aggregated from all categories.
"""
with concurrent.futures.ThreadPoolExecutor() as tp:
futures = []
for cat in categories:
futures.append(
tp.submit(self.news_headlines_search, category=cat, query=query)
)
aggregated_headlines = []
for fut in concurrent.futures.wait(futures)[0]:
aggregated_headlines.append(fut.result())
return aggregated_headlines
<file_sep>/src/autogpt_plugins/telegram/__init__.py
"""Telegram controller bot integration using python-telegram-bot."""
import os
import re
from typing import Any, Dict, List, Optional, Tuple, TypedDict, TypeVar
from auto_gpt_plugin_template import AutoGPTPluginTemplate
from .telegram_chat import TelegramUtils
PromptGenerator = TypeVar("PromptGenerator")
class Message(TypedDict):
role: str
content: str
def remove_color_codes(s: str) -> str:
ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
return ansi_escape.sub("", s)
class AutoGPTTelegram(AutoGPTPluginTemplate):
"""
Telegram controller bot integration using python-telegram-bot.
"""
def __init__(self):
super().__init__()
self._name = "Auto-GPT-Telegram"
self._version = "0.2.0"
self._description = (
"This integrates a Telegram chat bot with your autogpt instance."
)
self.telegram_api_key = os.getenv("TELEGRAM_API_KEY", None)
self.telegram_chat_id = os.getenv("TELEGRAM_CHAT_ID", None)
self.telegram_utils = TelegramUtils(
chat_id=self.telegram_chat_id, api_key=self.telegram_api_key
)
def can_handle_on_response(self) -> bool:
"""This method is called to check that the plugin can
handle the on_response method.
Returns:
bool: True if the plugin can handle the on_response method."""
return False
def on_response(self, response: str, *args, **kwargs) -> str:
"""This method is called when a response is received from the model."""
pass
def can_handle_post_prompt(self) -> bool:
"""This method is called to check that the plugin can
handle the post_prompt method.
Returns:
bool: True if the plugin can handle the post_prompt method."""
return False
def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
"""This method is called just after the generate_prompt is called,
but actually before the prompt is generated.
Args:
prompt (PromptGenerator): The prompt generator.
Returns:
PromptGenerator: The prompt generator.
"""
pass
def can_handle_on_planning(self) -> bool:
"""This method is called to check that the plugin can
handle the on_planning method.
Returns:
bool: True if the plugin can handle the on_planning method."""
return False
def on_planning(
self, prompt: PromptGenerator, messages: List[Message]
) -> Optional[str]:
"""This method is called before the planning chat completion is done.
Args:
prompt (PromptGenerator): The prompt generator.
messages (List[str]): The list of messages.
"""
pass
def can_handle_post_planning(self) -> bool:
"""This method is called to check that the plugin can
handle the post_planning method.
Returns:
bool: True if the plugin can handle the post_planning method."""
return False
def post_planning(self, response: str) -> str:
"""This method is called after the planning chat completion is done.
Args:
response (str): The response.
Returns:
str: The resulting response.
"""
pass
def can_handle_pre_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the pre_instruction method.
Returns:
bool: True if the plugin can handle the pre_instruction method."""
return False
def pre_instruction(self, messages: List[Message]) -> List[Message]:
"""This method is called before the instruction chat is done.
Args:
messages (List[Message]): The list of context messages.
Returns:
List[Message]: The resulting list of messages.
"""
pass
def can_handle_on_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the on_instruction method.
Returns:
bool: True if the plugin can handle the on_instruction method."""
return False
def on_instruction(self, messages: List[Message]) -> Optional[str]:
"""This method is called when the instruction chat is done.
Args:
messages (List[Message]): The list of context messages.
Returns:
Optional[str]: The resulting message.
"""
pass
def can_handle_post_instruction(self) -> bool:
"""This method is called to check that the plugin can
handle the post_instruction method.
Returns:
bool: True if the plugin can handle the post_instruction method."""
return False
def post_instruction(self, response: str) -> str:
"""This method is called after the instruction chat is done.
Args:
response (str): The response.
Returns:
str: The resulting response.
"""
pass
def can_handle_pre_command(self) -> bool:
"""This method is called to check that the plugin can
handle the pre_command method.
Returns:
bool: True if the plugin can handle the pre_command method."""
return False
def pre_command(
self, command_name: str, arguments: Dict[str, Any]
) -> Tuple[str, Dict[str, Any]]:
"""This method is called before the command is executed.
Args:
command_name (str): The command name.
arguments (Dict[str, Any]): The arguments.
Returns:
Tuple[str, Dict[str, Any]]: The command name and the arguments.
"""
pass
def can_handle_post_command(self) -> bool:
"""This method is called to check that the plugin can
handle the post_command method.
Returns:
bool: True if the plugin can handle the post_command method."""
return False
def post_command(self, command_name: str, response: str) -> str:
"""This method is called after the command is executed.
Args:
command_name (str): The command name.
response (str): The response.
Returns:
str: The resulting response.
"""
pass
def can_handle_chat_completion(
self, messages: Dict[Any, Any], model: str, temperature: float, max_tokens: int
) -> bool:
"""This method is called to check that the plugin can
handle the chat_completion method.
Args:
messages (List[Message]): The messages.
model (str): The model name.
temperature (float): The temperature.
max_tokens (int): The max tokens.
Returns:
bool: True if the plugin can handle the chat_completion method."""
return False
def handle_chat_completion(
self, messages: List[Message], model: str, temperature: float, max_tokens: int
) -> str:
"""This method is called when the chat completion is done.
Args:
messages (List[Message]): The messages.
model (str): The model name.
temperature (float): The temperature.
max_tokens (int): The max tokens.
Returns:
str: The resulting response.
"""
pass
def can_handle_text_embedding(self, text: str) -> bool:
return False
def handle_text_embedding(self, text: str) -> list:
pass
def can_handle_user_input(self, user_input: str) -> bool:
return True
def user_input(self, user_input: str) -> str:
user_input = remove_color_codes(user_input)
# if the user_input is too long, shorten it
try:
return self.telegram_utils.ask_user(prompt=user_input)
except Exception as e:
print(e)
print("Error sending message to telegram")
return "s"
def can_handle_report(self) -> bool:
"""This method is called to check that the plugin can
handle the report method.
Returns:
bool: True if the plugin can handle the report method."""
return True
def report(self, message: str) -> None:
message = remove_color_codes(message)
# if the message is too long, shorten it
try :
self.telegram_utils.send_message(message=message)
except Exception as e:
print(e)
print("Error sending message to telegram")
def can_handle_text_embedding(self, text: str) -> bool:
return False
def handle_text_embedding(self, text: str) -> list:
pass
<file_sep>/README.md
# Auto-GPT-Plugins
> ⚠️💀 **WARNING** 💀⚠️:
> Always examine the code of any plugin you use thoroughly, as plugins can execute any Python code, leading to potential malicious activities such as stealing your API keys.
> ⚙️ **WORK IN PROGRESS** ⚙️:
> The plugin API is still being refined. If you are developing a plugin, expect changes in the upcoming versions.
## New in Auto-GPT 0.4.1
- Unzipped plugins are now supported! You can now clone or download plugins directly from GitHub and place them in the `plugins` directory without zipping, as long as they are in the correct (NEW) format.
- Plugins settings have been moved out of the `.env` file to a new `plugins_config.yaml` file in the root directory of Auto-GPT.
- `ALLOWLISTED_PLUGINS` and `DENYLISTED_PLUGINS` `.env` settings are deprecated and will be removed in a future release.
- Plugins must now be explicitly enabled in plugins. See the [installation](#installation) section for more details.
- The plugin format has changed. For now the old zip format is still supported, but will be removed in a future release. See the [plugin format](#plugin-format) section for more details.
### Note: The Auto-GPT-Plugins repo must still be Zipped
> The core Auto-GPT Plugins are still in the old format, and will need to be zipped as shown in the instructions below. **THEY WILL NOT WORK UNZIPPED**. This will be fixed in a future release.
## Installation
**_⚠️This is a work in progress⚠️_**
Here are the steps to configure Auto-GPT Plugins.
1. **Install Auto-GPT**
If you haven't done so, follow the installation instructions given by [Auto-GPT](https://github.com/Significant-Gravitas/Auto-GPT) to install it.
1. **Download the plugins folder from the `root` of `Auto-GPT` directory**
To download it directly from your Auto-GPT directory, you can run this command on Linux or MacOS:
```bash
curl -L -o ./plugins/Auto-GPT-Plugins.zip https://github.com/Significant-Gravitas/Auto-GPT-Plugins/archive/refs/heads/master.zip
```
Or in PowerShell:
```pwsh
Invoke-WebRequest -Uri "https://github.com/Significant-Gravitas/Auto-GPT-Plugins/archive/refs/heads/master.zip" -OutFile "./plugins/Auto-GPT-Plugins.zip"
```
1. **Execute the dependency install script for plugins**
This can be run via:
Linux or MacOS:
```bash
./run.sh --install-plugin-deps
```
Windows:
```pwsh
.\run.bat --install-plugin-deps
```
Or directly via the CLI:
```bash
python -m autogpt --install-plugin-deps
````
1. **Enable the plugins**
To activate a plugin, the user should create or edit the `plugins_config.yaml` file located in the root directory of Auto-GPT. All plugin options can be configured in this file.
For example, if the `astro` plugin needs to be enabled, the following line should be added to the `plugins_config.yaml` file:
```yaml
AutoGPTSpacePlugin:
config: {}
enabled: true
```
## Plugins
There are two categories of plugins: **first party** and **third party**.
**First-party plugins** are a curated list of widely-used plugins, and are included in this repo. They and are installed by default when the plugin platform is installed. See the [First Party Plugins](#first-party-plugins) section below for a comprehensive list.
**Third-party plugins** need to be added individually. They may be useful for your specific needs. See the [Third Party Plugins](#third-party-plugins) section below for a short list of third-party plugins, and for information on how to add your plugin. Note: The Auto-GPT community has developed numerous third-party plugins and this list doesn't include them all. See the [Community-contributed plugins directory](#community-contributed-plugins-directory) section below for a more comprehensive list.
### Community contributed plugins directory
Community member and contributor, **[@dylanintech](https://github.com/dylanintech/)**, maintains a [**growing directory**](https://autoplugins.vercel.app/) of **Auto-GPT plugins and their contributors. To get your plugin listed in that directory, add your info to the `data` array in `plugins.tsx` of [his repo](https://github.com/dylanintech/autoplugins) and submit a PR.
### First Party Plugins
You can see the first-party plugins below. These are included in this Auto-GPT-Plugins repo and are installed by default when the plugin platform is installed.
| Plugin | Description | Location |
|--------------|-----------|--------|
| Astro Info | This gives Auto-GPT info about astronauts. | [autogpt_plugins/astro](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/astro) |
| API Tools | This allows Auto-GPT to make API calls of various kinds. | [autogpt_plugins/api_tools](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/api_tools) |
| Baidu Search | This search plugin integrates Baidu search engines into Auto-GPT. | [autogpt_plugins/baidu_search](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/baidu_search)|
| Bing Search | This search plugin integrates Bing search engines into Auto-GPT. | [autogpt_plugins/bing_search](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/bing_search) |
| Bluesky | Enables Auto-GPT to retrieve posts from Bluesky and create new posts. | [autogpt_plugins/bluesky](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/bluesky)|
| Email | Revolutionize email management with the Auto-GPT Email Plugin, leveraging AI to automate drafting and intelligent replies. | [autogpt_plugins/email](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/email) |
| News Search | This search plugin integrates News Articles searches, using the NewsAPI aggregator into Auto-GPT. | [autogpt_plugins/news_search](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/news_search) |
| Planner | Simple Task Planner Module for Auto-GPT | [autogpt_plugins/planner](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/blob/master/src/autogpt_plugins/planner/) |
| Random Values | Enable Auto-GPT to generate various random numbers and strings. | [autogpt_plugins/random_values](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/random_values) |
| SceneX | Explore image storytelling beyond pixels with the Auto-GPT SceneX Plugin. | [autogpt_plugins/scenex](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/scenex) |
| Telegram | A smoothly working Telegram bot that gives you all the messages you would normally get through the Terminal. | [autogpt_plugins/telegram](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/telegram) |
| Twitter | Auto-GPT is capable of retrieving Twitter posts and other related content by accessing the Twitter platform via the v1.1 API using Tweepy. | [autogpt_plugins/twitter](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/twitter) |
| Wikipedia Search | This allows Auto-GPT to use Wikipedia directly. | [autogpt_plugins/wikipedia_search](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/wikipedia_search) |
| WolframAlpha Search | This allows AutoGPT to use WolframAlpha directly. | [autogpt_plugins/wolframalpha_search](https://github.com/Significant-Gravitas/Auto-GPT-Plugins/tree/master/src/autogpt_plugins/wolframalpha_search)|
### Third Party Plugins
Third-party plugins are created by contributors and are not included in this repository. For more information about these plugins, please visit their respective GitHub pages.
Here is a non-comprehensive list of third-party plugins. If you have a plugin you'd like to add to this list, please submit a PR.
| Plugin | Description | Repository |
|--------------|-----------------|-------------|
| Alpaca-Trading | Trade stocks and crypto, paper or live with Auto-GPT | [danikhan632/Auto-GPT-AlpacaTrader-Plugin](https://github.com/danikhan632/Auto-GPT-AlpacaTrader-Plugin)|
| AutoGPT User Input Request | Allow Auto-GPT to specifically request user input in continous mode | [HFrovinJensen/Auto-GPT-User-Input-Plugin](https://github.com/HFrovinJensen/Auto-GPT-User-Input-Plugin)|
| BingAI | Enable Auto-GPT to fetch information via BingAI, saving time, API requests while maintaining accuracy. This does not remove the need for OpenAI API keys | [gravelBridge/AutoGPT-BingAI](https://github.com/gravelBridge/AutoGPT-BingAI)|
| Crypto | Trade crypto with Auto-GPT | [isaiahbjork/Auto-GPT-Crypto-Plugin](https://github.com/isaiahbjork/Auto-GPT-Crypto-Plugin)|
| Discord | Interact with your Auto-GPT instance through Discord | [gravelBridge/AutoGPT-Discord](https://github.com/gravelBridge/AutoGPT-Discord)|
| Dolly AutoGPT Cloner | A way to compose & run multiple Auto-GPT processes that cooperate, till core has multi-agent support | [pr-0f3t/Auto-GPT-Dolly-Plugin](https://github.com/pr-0f3t/Auto-GPT-Dolly-Plugin)|
| Google Analytics | Connect your Google Analytics Account to Auto-GPT. | [isaiahbjork/Auto-GPT-Google-Analytics-Plugin](https://github.com/isaiahbjork/Auto-GPT-Google-Analytics-Plugin)|
| IFTTT webhooks | This plugin allows you to easily integrate IFTTT connectivity using Maker | [AntonioCiolino/AutoGPT-IFTTT](https://github.com/AntonioCiolino/AutoGPT-IFTTT)|
| iMessage | Send and Get iMessages using Auto-GPT | [danikhan632/Auto-GPT-Messages-Plugin](https://github.com/danikhan632/Auto-GPT-Messages-Plugin)|
| Instagram | Instagram access | [jpetzke/AutoGPT-Instagram](https://github.com/jpetzke/AutoGPT-Instagram)|
| Mastodon | Simple Mastodon plugin to send toots through a Mastodon account | [ppetermann/AutoGPTMastodonPlugin](https://github.com/ppetermann/AutoGPTMastodonPlugin)|
| MetaTrader | Connect your MetaTrader Account to Auto-GPT. | [isaiahbjork/Auto-GPT-MetaTrader-Plugin](https://github.com/isaiahbjork/Auto-GPT-MetaTrader-Plugin) |
| Notion | Notion plugin for Auto-GPT. | [doutv/Auto-GPT-Notion](https://github.com/doutv/Auto-GPT-Notion) |
| Slack | This plugin allows to receive commands and send messages to slack channels | [adithya77/Auto-GPT-slack-plugin](https://github.com/adithya77/Auto-GPT-slack-plugin)
| Spoonacular | Find recipe insiprations using Auto-GPT | [minfenglu/Auto-GPT-Spoonacular-Plugin](https://github.com/minfenglu/Auto-GPT-Spoonacular-Plugin)
| System Information | This plugin adds an extra line to the prompt, serving as a hint for the AI to use shell commands likely supported by the current system. By incorporating this plugin, you can ensure that the AI model provides more accurate and system-specific shell commands, improving its overall performance and usefulness. | [hdkiller/Auto-GPT-SystemInfo](https://github.com/hdkiller/Auto-GPT-SystemInfo) |
| TiDB Serverless | Connect your TiDB Serverless database to Auto-GPT, enable get query results from database | [pingcap/Auto-GPT-TiDB-Serverless-Plugin](https://github.com/pingcap/Auto-GPT-TiDB-Serverless-Plugin)
| Todoist-Plugin | Allow Auto-GPT to programatically interact with yor Todoist to create, update, and manage your Todoist | [danikhan632/Auto-GPT-Todoist-Plugin](https://github.com/danikhan632/Auto-GPT-Todoist-Plugin) |
| Weather | A simple weather plugin wrapping around python-weather | [ppetermann/Auto-GPT-WeatherPlugin](https://github.com/ppetermann/Auto-GPT-WeatherPlugin) |
| Web-Interaction | Enable Auto-GPT to fully interact with websites! Allows Auto-GPT to click elements, input text, and scroll | [gravelBridge/AutoGPT-Web-Interaction](https://github.com/gravelBridge/AutoGPT-Web-Interaction)|
| WolframAlpha | Access to WolframAlpha to do math and get accurate information | [gravelBridge/AutoGPT-WolframAlpha](https://github.com/gravelBridge/AutoGPT-WolframAlpha)|
| YouTube | Various YouTube features including downloading and understanding | [jpetzke/AutoGPT-YouTube](https://github.com/jpetzke/AutoGPT-YouTube) |
| Zapier webhooks | This plugin allows you to easily integrate Zapier connectivity | [AntonioCiolino/AutoGPT-Zapier](https://github.com/AntonioCiolino/AutoGPT-Zapier)|
| Project Management | Streamline your Project Management with ease: Jira, Trello, and Google Calendar Made Effortless| [minfenglu/AutoGPT-PM-Plugin](https://github.com/minfenglu/AutoGPT-PM-Plugin)|
| RabbitMQ | This plugin allows you to communicate with your Auto-GPT instance via microservice.| [tomtom94/AutoGPT-RabbitMQ](https://github.com/tomtom94/AutoGPT-RabbitMQ)|
## Configuration
Plugins must be enabled in `plugins_config.yaml`.
If you still have `ALLOWLISTED_PLUGINS` and `DENYLISTED_PLUGINS` in your `.env` file, Auto-GPT will use them to create the `plugins_config.yaml` file the first time.
This file contains a list of plugins to load. The format is as follows:
```yaml
plugin_a:
config:
api_key: my-api-key
enabled: false
PluginB:
config: {}
enabled: true
```
The various sections are as follows:
- key: The name of the plugin. E.g. `plugin_a` or `PluginB`.
This is used to load the plugin. It's format depends on whether the plugin is zipped or unzipped.
**For zipped plugins**, the key must be the name of the plugin **class**. For example, the `weather` plugin in this repository would `WeatherPlugin`, and in the example above, `PluginB` is most likely a zipped plugin.
**For unzipped plugins**, the key must be the name of the plugin **directory**. For example, in the example above, the `plugin_a` directory would be loaded as a plugin.
- config: The configuration for the plugin.
This is passed to the plugin when it is loaded. The format of this field depends on the plugin. This field is optional. Use `{}` if you do not need to pass any configuration to the plugin.
Note that `plugins_config.yaml` file is only used by Auto-GPT to decide whether to load a plugin. For specific plugin settings, please refer to the documentation provided for each plugin. Plugin developers may still rely on`.env` for other plugin specific settings. We encourage developers to migrate their settings to the `config` field in the new `plugins_config.yaml` file.
- enabled: Determines whether the plugin is loaded.
## Creating a Plugin
Creating a plugin is a rewarding experience! You can choose between first-party or third-party plugins. First-party plugins are included in this repo and are installed by default along with other plugins when the plugin platform is installed. Third-party plugins need to be added individually. Use first-party plugins for plugins you expect others to use and want, and third-party for things specific to you.
## Plugin Format
Plugins must follow a specific structure in order to be found and loaded successfully. The structure depends on whether a plugin is zipped or unzipped.
Zipped plugins must subclasses `AutoGPTPluginTemplate`(https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template), and implement all the methods defined in AutoGPTPluginTemplate.
Unzipped plugins can also subclass `AutoGPTPluginTemplate`, but it is not required. They can implement only the methods they need. However, the name of the plugin's directory is used to load the plugin, so it must be unique within AutoGPT's `plugins` directory.
### First Party Plugins How-To
1. Clone this plugins repo
1. Follow the structure of the other plugins, implementing the plugin interface as required
1. Write your tests
1. Add your name to the [codeowners](.github/CODEOWNERS) file
1. Add your plugin to the [Readme](README.md)
1. Add your plugin to the [autogpt-package](https://github.com/kurtosis-tech/autogpt-package/blob/main/plugins.star). You can copy the line of any of the standard plugins and just add another entry in the dictionary. Raise a PR & get it merged
1. Add your plugin to the [plugin installation integration test](.github/workflows/test-plugin-installation.yml)
1. Make a PR back to this repo!
### Third Party Plugins How-To
1. Clone [the third party template](https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template).
1. Follow the instructions in the [third party template readme](https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template).
### Migrating Third Party to First Party
We appreciate your contribution of a plugin to the project!
1. Clone this repository.
1. Make a folder for your plugin under `src/autogpt_plugins`. Use a simple descriptive name such as `notion`, `twitter`, or `web_ui`.
1. Add the files from your third-party plugin located at `src/auto_gpt_plugin_template` into the folder you created.
1. Include your README from your third-party plugin in the folder you created.
1. Add your plugin to the root README with a description and a link to your plugin-specific README.
1. Add your plugin's Python package requirements to `requirements.txt`.
1. Add tests to get your plugin to 80% code coverage.
1. Add your name to the [codeowners](.github/CODEOWNERS) file.
1. Add your plugin to the [Readme](README.md).
1. Submit a pull request back to this repository!
## Get Help
For more information, visit the [discord](https://discord.gg/autogpt) server.
<file_sep>/src/autogpt_plugins/bluesky/README.md
# Auto-GPT Bluesky Plugin
A plugin that adds Bluesky API integration into Auto GPT
## Features (more coming soon!)
- Post a message using the `post_to_bluesky(text)` command
- Get recent posts using the `get_bluesky_posts(username, number_of_posts)` command
## Installation
1. Clone this repo as instructed in the main repository
2. Add this chunk of code along with your Bluesky Username and App Password information to the `.env` file within AutoGPT:
```
################################################################################
### BLUESKY API
################################################################################
# Create an App Password here: Bluesky -> Settings -> Advanced -> App Passwords
BLUESKY_USERNAME=
BLUESKY_APP_PASSWORD=
```<file_sep>/src/autogpt_plugins/twitter/README.md
# desojo/autogpt-twitter 🐣
A plugin adding twitter API integration into Auto GPT
## Features(more coming soon!)
- Post a tweet using the `post_tweet(tweet)` command
- Post a reply to a specific tweet using the `post_reply(tweet, tweet_id)` command
- Get recent mentions using the `get_mentions()` command
- Search a user's recent tweets via username using the `search_twitter_user(targetUser, numOfItems)' command
## Installation
1. Clone this repo as instructed in the main repository
2. Add this chunk of code along with your twitter API information to the `.env` file within AutoGPT:
```
################################################################################
### TWITTER API
################################################################################
# Consumer Keys are also known as API keys on the dev portal
TW_CONSUMER_KEY=
TW_CONSUMER_SECRET=
TW_ACCESS_TOKEN=
TW_ACCESS_TOKEN_SECRET=
TW_CLIENT_ID=
TW_CLIENT_ID_SECRET=
################################################################################
### ALLOWLISTED PLUGINS
################################################################################
ALLOWLISTED_PLUGINS=AutoGPTTwitter
```
## Twitter API Setup for v1.1 access(soon to be deprecated 😭)
1. Go to the [Twitter Dev Portal](https://developer.twitter.com/en/portal/dashboard)
2. Delete any apps/projects that it creates for you
3. Create a new project with whatever name you want
4. Create a new app under said project with whatever name you want
5. Under the app, edit user authentication settings and give it read/write perms.
6. Grab the keys listed in installation instructions and save them for later
| 9317a3ce2d972e65d4c08242606e10ad99c93c23 | [
"Markdown",
"TOML",
"Makefile",
"INI",
"Python",
"Text",
"Shell"
] | 50 | Markdown | Significant-Gravitas/Auto-GPT-Plugins | 397589394138f9ed43660b1aa99d501a8bfff061 | c751b43fedf34a6e157e09c8b5cd5f9f4e3d17ac |
refs/heads/master | <repo_name>AMMDAW2021/Programacion_c1<file_sep>/03_iteraciones/pseudocode/doWhile.js
do {
operaciones;
} while (condición);<file_sep>/03_iteraciones/propuestos/6.js
let numero = prompt("Introduce un número");
if (numero <= 0) {
console.log("Debes introducir un número mayor que 0");
} else {
let divisible = false;
const original = numero;
numero--;
while (numero > 1 && !divisible) {
if (original % numero === 0) {
divisible = true;
}
numero--;
}
if (!divisible) {
console.log(original + " es primo.");
} else {
console.log(original + " NO es primo.");
}
}<file_sep>/02_condicionales/propuestos/5.js
const peso = prompt("Introduce tu peso");
const altura = prompt("Introduce tu altura");
const imc = peso / (altura * altura);
const imcRedondeado = (imc * 10000).toFixed(2);
console.log("Tu imc: " + imcRedondeado);
if (imcRedondeado < 16 ) {
console.log("Necesitas comer más");
} else if (imcRedondeado >= 16 && imcRedondeado < 25) {
console.log("Estás bien");
} else if (imcRedondeado >= 25 && imcRedondeado < 30) {
console.log("Tienes sobrepeso");
} else {
console.log("Tienes un problema de obesidad");
}<file_sep>/07_librerias/practicar/56.js
const personas = [
{
nombre: "Juan",
apellido: "Palomo",
edad: 34
},
{
nombre: "Eugene",
apellido: "Krabs",
edad: 35
},
{
nombre: "Pedro",
apellido: "Gata",
edad: 50
}
];
const total = personas.reduce(function (persona1, persona2) {
return {edad: persona1.edad + persona2.edad};
});
console.log(total.edad / personas.length);<file_sep>/06_clases/propuestos/1.js
class Hola {
constructor () {
this.saludo = "Hola";
}
decirHola () {
console.log(this.saludo);
}
}
const hola = new Hola();
<file_sep>/05_funciones/propuestos/1.js
function saludo (momentoDelDia) {
switch (momentoDelDia) {
case "mañana": return "Buenos días";
case "tarde": return "Buenas tardes";
case "noche": return "Buenas noches";
default: break;
}
}
console.log(momentoDelDia("tarde"));
const momentoDelDia2 = momento => ({
"mañana": "Buenos Días",
"tarde": "Buenas tardes",
"noche": "Buenas noches"}[momento]);
console.log(momentoDelDia2("tarde"));
<file_sep>/07_librerias/propuestos/5/tareas.js
const fs = require("fs");
class Tareas {
constructor () {
const contenido = fs.readFileSync("./tareas.json", "utf-8");
this._tareas = JSON.parse(contenido);
}
crear (id, tarea) {
const nueva = { id, tarea }; // Equivale a {id: id, tarea: tarea}
this._tareas.push(nueva);
}
guardar () {
const contenido = JSON.stringify(this._tareas, null, 1);
fs.writeFileSync("./tareas.json", contenido);
this._tareas = JSON.parse(contenido);
}
eliminar(id) {
this._tareas = this._tareas.filter(function (tarea) {
return tarea.id !== id;
});
}
mostrar () {
return this._tareas.map (function (tarea) {
return `${tarea.id} ${tarea.tarea}`;
}).join("\n");
}
}
module.exports = Tareas;<file_sep>/07_librerias/practicar/52.js
const pajar = ["Navaja", "Aguas", "Aguja", "Dolor", "Glosa"];
const filtrado = pajar.filter(function (palabra) {
return palabra.length === 5;
});
const encontrado = filtrado.find(function (palabra) {
return palabra === "Aguja";
});
console.log(encontrado);
// En un solo paso, uniendo las llamadas filter y find
const resultado = pajar.filter(function (palabra) {
return palabra.length === 5;
}).find(function (palabra) {
return palabra === "Aguja";
});
console.log(resultado);<file_sep>/07_librerias/ejemplos/includesSample.js
const numeros = [7, 5, 3, 0, 4];
const resultado = numeros.includes (3);
console.log (resultado); // true<file_sep>/07_librerias/proyecto/lectura.js
const readline = require("readline-sync");
class Lectura {
static leer(mensaje) {
return readline.question(mensaje);
}
}
module.exports = Lectura;<file_sep>/07_librerias/proyecto/calificacion.js
class Calificacion {
constructor (nota, asignatura) {
this._nota = nota;
this._asignatura = asignatura;
}
info() {
return `${this._asignatura}: ${this._nota} `;
}
}
module.exports = Calificacion;<file_sep>/02_condicionales/propuestos/2.js
const numero1 = prompt("Introduce un número");
const numero2 = prompt("Introduce otro número");
const resto = parseInt(numero1) % parseInt(numero2);
if (resto === 0) {
console.log(numero1 + " es múltiplo de " + numero2);
} else {
console.log(numero1 + " NO es múltiplo de " + numero2);
}<file_sep>/07_librerias/propuestos/5/5.js
const Tareas = require("./tareas");
const tareas = new Tareas();
console.log(tareas.mostrar(), "\n---");
tareas.crear(2, "Comer");
console.log(tareas.mostrar(), "\n---");
tareas.eliminar(2);
console.log(tareas.mostrar(), "\n---");
tareas.crear(66, "Leer");
console.log(tareas.mostrar(), "\n---");
tareas.guardar();
<file_sep>/07_librerias/ejemplos/findSample.js
const numeros = [4, 5, 6, 3, 2];
const numero = numeros.find (function (elemento) {
return elemento === 6;
}); // 6
console.log (numero); //6<file_sep>/07_librerias/practicar/44.lib.js
function mostrar (array) {
for (let i = 0; i < array.length;i++){
console.log(array[i]);
}
}
module.exports = mostrar;<file_sep>/07_librerias/ejemplos/readline.js
const readline = require("readline-sync");
const nombre = readline.prompt("¿Cómo te llamas?");
console.log("Has escrito: ", nombre);<file_sep>/01_variables_operadores/propuestos/5.js
const dolares = prompt("Introduzca dolares");
const euros = parseFloat(dolares) / 1.1;
console.log(dolares + " son " + euros + " €");<file_sep>/06_clases/practicar/39.js
class Sumador {
constructor (valor1, valor2) {
this.valor1 = valor1;
this.valor2 = valor2;
}
get valor1 () {
return this._valor1;
}
set valor1 (valor1) {
if (valor1 > 0) {
this._valor1 = valor1;
} else {
this._valor1 = 0;
}
}
get valor2 () {
return this._valor2;
}
set valor2 (valor2) {
if (valor2 > 0) {
this._valor2 = valor2;
} else {
this._valor2 = 0;
}
}
sumar () {
return this._valor1 + this._valor2;
}
}
const sumadorMalo = new Sumador(-4, "");
console.log(sumadorMalo.sumar());
const sumador = new Sumador(28, 14);
console.log(sumador.sumar());<file_sep>/05_funciones/propuestos/2.js
function iniciarConNumero (numeros, numero) {
for (let i = 0; i < numeros.length; i++) {
numeros[i] = numero;
}
return numeros;
}
const iniciarConNumero1 = (numeros, numero) => { numeros.fill(numero); }
const iniciarConNumero2 = (numeros, numero) => numeros.forEach( n => { n = numero; } );
const iniciarConNumero3 = (numeros, numero) => numeros.map( () => numero );
<file_sep>/07_librerias/practicar/43.lib.js
const numeros = [4, 2, 19, 2, -4, 4, 0, 1];
module.exports = numeros;<file_sep>/02_condicionales/propuestos/3.js
let numero = prompt("Introduce un número");
if (numero >= 0) {
console.log(numero + " es positivo");
} else {
console.log(numero + " es negativo");
}
numero = -numero;
console.log("Conversión: " + numero);<file_sep>/01_variables_operadores/practicar/08.js
let valor = prompt("Introduce un número");
valor++;
console.log("El incremento es", valor);
valor--;
console.log("El decremento es", valor);
<file_sep>/01_variables_operadores/pseudocode/comments.js
// comentario de una línea
/*
Comentario
de varias
líneas
*/<file_sep>/06_clases/practicar/41.js
class Vehiculo {
constructor (matricula) {
this._matricula = matricula;
}
get matricula () {
return this._matricula;
}
set matricula (matricula) {
this._matricula = matricula;
}
arrancar () {
console.log("Arrancando ", this._matricula);
}
}
class Coche extends Vehiculo {
constructor (matricula, modelo, color) {
super(matricula);
this._modelo = modelo;
this._color = color;
}
info () {
return `${this._matricula}
${this._modelo}
${this._color}`;
}
}
const coche = new Coche("0042ASI", "Opel Corsa", "Blanco");
coche.arrancar();
console.log(coche.info());<file_sep>/07_librerias/practicar/48.js
const fs = require("fs");
const contenido = fs.readFileSync("./entrada.txt", "utf8");
const lineas = contenido.split(/\n/);
const datos = [];
for (let i = 0; i < lineas.length; i++) {
let linea = lineas[i].split(":");
let persona = {
nombre: linea[0],
apellido: linea[1],
edad: linea[2]
};
datos.push(persona);
}
const textoDatos = JSON.stringify(datos, null, 1);
fs.writeFileSync("./salida.json", textoDatos);<file_sep>/01_variables_operadores/pseudocode/consoleLog.js
console.log(mensaje);<file_sep>/01_variables_operadores/propuestos/6.js
const booleano1 = prompt("Introduzca true o false");
const booleano2 = prompt("Introduzca true o false");
const and = booleano1 && booleano2;
console.log("Resultado and: " + and);
const or = booleano1 || booleano2;
console.log("Resultado or: " + or);<file_sep>/07_librerias/practicar/45.js
const Prueba = require("./45.lib");
const prueba = new Prueba("hola");
prueba.metodo();<file_sep>/06_clases/practicar/40.js
class Numero {
static aleatorio (max) {
return Math.round(Math.random() * max);
}
}
for (let i = 0; i < 5; i ++) {
console.log(Numero.aleatorio(10));
}
<file_sep>/05_funciones/practicar/35.js
function positivo (valor) {
if (valor < 0) {
return -valor;
}
return valor;
}
function potencia (valor1, valor2) {
let resultado = valor1;
while (valor2 - 1 > 0) {
resultado *= valor1;
valor2--;
}
return resultado;
}
console.log(potencia(positivo(2), positivo(4)))
potencia(positivo(-5), positivo(4));<file_sep>/04_arrays/propuestos/1.js
const nombres = ["Frodo", "Merrin", "Sam", "Pip", "Bilbo"];
for (let i = 0; i < nombres.length; i++) {
console.log(nombres[i]);
}
// variante:
nombres.forEach( nombres => {
console.log(nombre);
});<file_sep>/07_librerias/propuestos/1/1.js
const generar = require("./generar");
const password = generar(8);
console.log(password);<file_sep>/02_condicionales/propuestos/6.js
const dorsal = prompt("Introduce dorsal");
if (dorsal >= 0 && dorsal <= 99) {
switch (parseInt(dorsal)) {
case 1:
console.log("Portero");
break;
case 3:
case 4:
case 5:
console.log("Defensa");
break;
case 6:
case 8:
case 11:
console.log("Centrocampista");
break;
case 9:
console.log("Delantero");
break;
default:
console.log("Cualquiera");
break;
}
} else {
console.log("Error, el dorsal no está entre 0 y 99");
}
<file_sep>/03_iteraciones/propuestos/3.js
let numero = prompt("Introduce un número");
if (numero <= 0 || numero % 2 !== 0) {
console.log("Debes introducir un número par mayor que 0");
} else {
let secuencia = "";
numero = numero / 2;
while (numero > 0) {
secuencia = secuencia + "*-";
numero--;
}
secuencia = secuencia + "*";
console.log(secuencia);
}<file_sep>/07_librerias/propuestos/6/6.js
const Equipo = require("./equipo");
const equipo = new Equipo();
equipo.cargar();
equipo.mostrar();
equipo.fichaje("Pele", 10);
equipo.mostrar();<file_sep>/07_librerias/ejemplos/mapSample.js
const numeros = [7, 5, 3, 0, 4];
const duplicados = numeros.map (function (n) {
return n * 2;
});
console.log (duplicados); // const = [ 14, 10, 6, 0, 8 ]<file_sep>/07_librerias/proyecto/mensaje.js
class Mensaje {
menu () {
return "1. Mostrar todo.\n" +
"2. Añadir nuevo elemento.\n" +
"3. Eliminar elemento.\n" +
"4. Salir\n";
}
salir () {
return "Hasta otra";
}
opcionIncorrecta () {
return "Opción no soportada";
}
}
module.exports = Mensaje;<file_sep>/07_librerias/propuestos/2/2.js
const Menu = require("./menu");
const menu = new Menu(["Mostrar", "Eliminar", "Salir"]);
menu.mostrar();
if (menu.seleccionar(1)) {
console.log("Opción 1 presente");
} else {
console.log("Opción 1 no presente");
}<file_sep>/05_funciones/propuestos/7.js
function aleatorio (max) {
return Math.round(Math.random() * max);
}
function generarAtributos (nivelCompensacion) {
let darPuntosA = 0;
let inteligencia = 0;
let fuerza = 0;
let velocidad = 0;
let puntosRestantes = 20;
let puntos = 0;
while (puntosRestantes > 0) {
if (nivelCompensacion > puntosRestantes) {
puntos = puntosRestantes;
puntosRestantes = 0;
} else {
puntos = aleatorio(nivelCompensacion+1);
puntosRestantes = puntosRestantes - puntos;
}
darPuntosA = aleatorio(3);
switch (darPuntosA) {
case 0:
inteligencia = inteligencia + puntos;
break;
case 1:
fuerza = fuerza + puntos;
break;
case 2:
velocidad = velocidad + puntos;
break;
default:
break;
}
}
console.log("\nValores asignados por compensación: " + nivelCompensacion);
console.log("Inteligencia: " + inteligencia);
console.log("Fuerza: " + fuerza);
console.log("Velocidad: " + velocidad);
}
generarAtributos (3);
<file_sep>/06_clases/pseucode/class.js
class NombreClase {
nombreFunción () {
}
}
let objeto = new NombreClase();
objeto.nombreFunction();
class NombreClase {
constructor (parámetro) {
this.atributo = parámetro;
}
nombreFunción () {
this.otraFunción();
}
otraFunción () {
}
}
let objeto = new NombreClase(parámetro);<file_sep>/07_librerias/practicar/50.js
function aleatorio (max) {
return Math.round(Math.random() * max);
}
function generarPassword (longitud) {
const caracteres = ["a","b","c","d","e","f","g","h","i","j","k","l",
"m","n","ñ","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9",".","-","_","!","$"];
let password = "";
for (let i = 0; i < longitud; i++) {
let caracter = caracteres[aleatorio(caracteres.length)];
password = password + caracter;
}
return password;
}
const longitudes = [5, 6, 2, 8, 10, 5];
const passwords = longitudes.map(function (longitud) {
return generarPassword(longitud);
});
console.log(passwords);<file_sep>/07_librerias/ejemplos/dato.js
const dato = {
id: 6,
nombre: "<NAME>"
};
module.exports = dato;<file_sep>/04_arrays/pseudocode/array.js
[valor1, valor2, valor3]
new Array(3);<file_sep>/07_librerias/practicar/44.js
const mostrar = require("./44.lib");
const datos = [3, 4, 12, 5];
mostrar(datos);<file_sep>/06_clases/propuestos/3.js
function aleatorio (max) {
return Math.round(Math.random() * max);
}
class Dado {
constructor (lados = 6, admiteCero = false) {
this._lados = lados;
this._admiteCero = admiteCero;
}
set lados (lados) {
this._lados = lados;
}
set admiteCero (admiteCero) {
this._admiteCero = admiteCero;
}
tirar () {
let numero = aleatorio(this._lados);
if (!this._admiteCero) {
numero++;
}
return numero;
}
}
const dado = new Dado();
<file_sep>/07_librerias/proyecto/interfaz-usuario.js
const Calificacion = require("./calificacion");
const Lectura = require("./lectura");
class InterfazUsuario {
mostrar (mensaje) {
console.log(mensaje);
}
leerOpcion () {
return Lectura.leer("introduce opción: ");
}
crear () {
const nota = Lectura.leer("Introduce una nota: ");
const asignatura = Lectura.leer("Introduce una asignatura: ");
return new Calificacion(nota, asignatura);
}
leerIndice () {
return Lectura.leer("indica un índice: ");
}
}
module.exports = InterfazUsuario;<file_sep>/07_librerias/ejemplos/findIndex.js
const numeros = [4, 5, 6, 3, 2];
const index = numeros.findIndex (function (elemento) {
return elemento === 6
});
console.log (index); //2<file_sep>/05_funciones/propuestos/4.js
function aleatorio (max) {
return Math.round(Math.random() * max);
}
function generarNombre (silabas) {
const vocales = ["a", "e", "i", "o", "u"];
const consonantes = ["b","c","d","f","g","h","j","k","l",
"m","n","ñ","p","q","r","s","t","v","w","x","y","z"];
let nombre = "";
for (let i = 0; i < silabas; i++) {
let consonante = consonantes[aleatorio(consonantes.length)];
let vocal = vocales[aleatorio(vocales.length)];
nombre = nombre + consonante + vocal;
}
return nombre;
}
console.log(generarNombre(3));<file_sep>/07_librerias/practicar/43.js
const numeros = require("./43.lib");
console.log(numeros);<file_sep>/03_iteraciones/propuestos/1.js
let numero = prompt("Introduce un número");
if (numero <= 0) {
console.log("Debes introducir un número mayor que 0");
} else {
while (numero > 0) {
console.log("Hola!");
numero--;
}
}<file_sep>/07_librerias/ejemplos/index.js
const dato = require("./dato");
console.log(dato);
const suma = require("./suma");
console.log(suma(40, 2));
const Logger = require("./logger");
const logger = new Logger();
logger.log("Este es un mensaje");<file_sep>/01_variables_operadores/pseudocode/variables.js
let variable = valor;
variable = nuevoValor;
const variable = valor;<file_sep>/02_condicionales/propuestos/1.js
const numero1 = prompt("Introduce un número");
const numero2 = prompt("Introduce otro número");
if (numero1 > numero2) {
console.log(numero1 + " es mayor que " + numero2);
} else if (numero1 < numero2) {
console.log(numero1 + " es menor que " + numero2);
} else {
console.log(numero1 + " es igual que " + numero2);
}<file_sep>/02_condicionales/pseudocode/if-else-if.js
if (condición) {
operaciones;
} else if (condición) {
operaciones;
} else {
operaciones;
}<file_sep>/07_librerias/propuestos/4/4.js
const Listado = require("./listado");
const listado = new Listado("./4.json");
if (listado.existe("eugene")) {
console.log("Existe!");
}
listado.aMinusculas();
if (listado.existe("eugene")) {
console.log("Existe!");
console.log(listado.posicion("eugene"));
}<file_sep>/01_variables_operadores/propuestos/4.js
const nombre = prompt("Introduce tu nombre");
const apellido = prompt("Introduce tu apellido");
console.log(nombre + " " + apellido);
// alternativa
console.log(`${nombre} ${apellido}`);<file_sep>/04_arrays/propuestos/2.js
const numeros = [3.4, 2.7, 4.3, 6.6, 8.3];
let suma = 0.0;
for (let i = 0; i< numeros.length; i++) {
suma = suma + numeros[i];
}
const media = suma / numeros.length;
console.log("La media es: ", media);<file_sep>/04_arrays/propuestos/3.js
const numeros = [3, 5, -4, 2, 1, 4, 0, 6, 9, 8, 3];
for (let i = 0; i< numeros.length; i++) {
console.log(numeros[i]);
}
for (let i = 0; i< numeros.length; i++) {
numeros[i]++;
// o si no: numeros[i] = numeros[i] + 1
}
for (let i = 0; i< numeros.length; i++) {
console.log(numeros[i]);
}
// Alternativa para la suma:
numerosIncrementados = numeros.map( numero => numero++ );<file_sep>/07_librerias/practicar/54.js
const numeros1 = [4, 5, 7, 9, 2];
const numeros2 = [0, -2, 5, 3, 1];
const resultado = numeros1.map(function (numero) {
return numeros2.includes(numero);
});
if (resultado.length > 0) {
console.log("Si hay números repetidos");
} else {
console.log("Todos los elementos son distintos");
}<file_sep>/06_clases/propuestos/5.js
class Dispositivo {
constructor (nombre, precio) {
this._nombre = nombre;
this._precio = precio;
}
get nombre () {
return this._nombre;
}
set nombre (nombre) {
this._nombre = nombre;
}
get precio () {
return this._precio;
}
set precio (precio) {
this._precio = precio;
}
toString () {
return `${this._nombre} ${this._precio}`;
}
}
class Movil extends Dispositivo {
constructor (nombre, precio, numero) {
super(nombre, precio);
this._numero = numero;
}
get numero () {
return this._numero;
}
set numero (numero) {
this._numero = numero;
}
toString () {
return `${super.toString()} ${this._numero}`;
}
llamar (numero) {
console.log(`Llamando a ${numero}`)
}
}
class Ordenador extends Dispositivo {
constructor (nombre, precio, procesador) {
super(nombre, precio);
this._procesador = procesador;
}
get procesador () {
return this._procesador;
}
set procesador (procesador) {
this._procesador = procesador;
}
toString () {
return `${super.toString()} ${this._procesador}`;
}
}
const ordenador = new Ordenador("Dell", 4553.4, "Lentium 4");
const telefono = new Movil("Chanmhung", 434.4, 665745345);
console.log("Ordenador: " + ordenador);
console.log("Telefono: ", telefono.toString());<file_sep>/07_librerias/propuestos/2/menu.js
class Menu {
constructor (opciones) {
this._opciones = opciones;
}
mostrar () {
this._opciones.forEach(function (opcion, i) {
console.log(`${i+1} ${opcion}`);
})
}
seleccionar (numero) {
return numero > 0 && numero <= this._opciones.length;
}
}
module.exports = Menu;<file_sep>/05_funciones/propuestos/6.js
function factura(productos, cantidades, precios) {
let factura = "FACTURA\n-------------------\n";
let total = 0;
for (let i = 0; i < productos.length; i++) {
factura = factura + productos[i];
factura = factura + " x " + cantidades[i];
factura = factura + " : " + precios[i] + "\n";
total = total + (cantidades[i] * precios[i]);
}
factura = factura + "\n-----------------------\n";
factura = factura + "Total: " + total;
return factura;
}
// Ejemplo de llamada
const totalFactura = factura(["Pan","Huevos","Harina"],[1,6,2],[1.2, 0.2, 0.8]);
console.log(totalFactura);<file_sep>/07_librerias/practicar/49.js
const nombres = ["Alberto", "Pablo", "Ana", "Eugene", "Angel"];
nombres.forEach(function (nombre) {
if (nombre.startsWith("A")) {
console.log(nombre);
}
});<file_sep>/06_clases/practicar/36.js
class Persona {
dormir () {
console.log("ZZZZZ...");
}
comer () {
console.log("Ñam, Ñam...");
}
saludar () {
console.log("Hola, qué tal!");
}
}
const persona = new Persona();
persona.dormir();
persona.comer();
persona.saludar();<file_sep>/07_librerias/propuestos/3/3.js
const Fichero = require("./fichero");
const fichero = new Fichero("./3.txt");
console.log("Contenido anterior: ", fichero.leer());
fichero.escribir("Contenido cambiado!!! " + new Date().toString());
console.log("Conten", fichero.leer());<file_sep>/07_librerias/practicar/53.js
const nombres = ["Gandalf", "Eugene", "Bilbo", "Saruman", "", "Gimli"];
const indice = nombres.findIndex(function (nombre) {
return nombre === "";
});
if (indice === -1) {
console.log("No hay cadenas vacías!");
} else {
console.log("Hay una cadena vacía en: ", indice);
}
<file_sep>/07_librerias/proyecto/index.js
const Inicio = require("./inicio");
const Calificacion = require("./calificacion");
let notas = [
new Calificacion(5, "Lengua"),
new Calificacion(8, "Matemáticas"),
];
new Inicio(notas).bucle();<file_sep>/07_librerias/ejemplos/logger.js
class Logger {
constructor (prefijo = "> ") {
this._prefijo = prefijo;
}
log (mensaje) {
console.log(this._prefijo, mensaje);
}
}
module.exports = Logger;<file_sep>/06_clases/propuestos/6.js
class Comida {
constructor (nombre, peso) {
this._nombre = nombre;
this._peso = peso;
}
get nombre () {
return this._nombre;
}
set nombre (nombre) {
this._nombre = nombre;
}
get peso () {
return this._peso;
}
set peso (peso) {
this._peso = peso;
}
toString () {
return `${this._nombre} ${this._peso}`;
}
}
class Fruta extends Comida {
constructor (nombre, peso, vitamina) {
super(nombre, peso);
this._vitamina = vitamina;
}
get vitamina () {
return this._vitamina;
}
set vitamina (vitamina) {
this._vitamina = vitamina;
}
toString () {
return `${super.toString()} ${this._vitamina}`;
}
}
class Caramelo extends Comida {
constructor (nombre, peso, calorias) {
super(nombre, peso);
this._calorias = calorias;
}
get calorias () {
return this._calorias;
}
set calorias (calorias) {
this._calorias = calorias;
}
toString () {
return `${super.toString()} ${this._calorias}`;
}
}
class Cesta {
constructor () {
this._alimentos = [];
}
meterComida (comida) {
this._alimentos.push(comida);
}
pesoTotal () {
let total = 0;
for (let i = 0; i < this._alimentos.length; i++) {
total += this._alimentos[i].peso;
}
return total;
}
toString () {
let info = "";
for (let i = 0; i < this._alimentos.length; i++) {
info += this._alimentos[i].toString() + "\n";
}
return info;
}
}
const chicle = new Caramelo("Cheiw", 0.2, 100);
const gominola = new Caramelo("Fresa", 0.3, 210);
const pera = new Fruta("Pera", 0.1, "B");
const manzana = new Fruta("Manzana", 0.15, "A");
const cesta = new Cesta();
cesta.meterComida(chicle);
cesta.meterComida(gominola);
cesta.meterComida(pera);
cesta.meterComida(manzana);
console.log("Contenido cesta: ", cesta.toString());
console.log("Peso total:", cesta.pesoTotal());<file_sep>/07_librerias/ejemplos/filterSample.js
const numeros = [7, 5, 3, 0, 4];
const pares = numeros.filter (function (n) {
return n % 2 === 0;
});
console.log (pares); // pares = [ 0, 4 ]<file_sep>/07_librerias/ejemplos/leerFicheroJSON.js
const fs = require("fs");
const datos = fs.readFileSync("./fichero.json","utf8");
const personas =JSON.parse(datos);
personas.forEach(function (persona) {
console.log(persona.nombre);
});
personas[1].nombre = "Krabs";
const nuevosDatos = JSON.stringify(personas, null, 2);
console.log(nuevosDatos);
fs.writeFileSync("./fichero2.json", nuevosDatos);
<file_sep>/03_iteraciones/pseudocode/while.js
while (condición) {
operaciones;
}<file_sep>/07_librerias/propuestos/4/listado.js
const fs = require("fs");
class Listado {
constructor (fichero) {
const contenido = fs.readFileSync(fichero, "utf-8");
this._datos = JSON.parse(contenido);
}
existe (nombre) {
return this._datos.find(function (dato) {
return nombre === dato.nombre;
});
}
aMinusculas () {
this._datos = this._datos.map(function (dato) {
return {id: dato.id, nombre: dato.nombre.toLowerCase()};
});
}
posicion (nombre) {
return this._datos.findIndex(function(dato) {
return dato.nombre === nombre;
});
}
}
module.exports = Listado;<file_sep>/05_funciones/pseudocode/function.js
function nombre () {
operaciones;
}
function nombre (parámetros) {
operaciones;
}
function nombre (parámetros) {
operaciones;
return resultado;
}
nombre();
nombre(parámetros);
let valorRetornado = nombre(parámetros);<file_sep>/07_librerias/practicar/46.js
const fs = require("fs");
const contenido = fs.readFileSync("./fichero.txt", "utf8");
const palabras = contenido.split(/[\s\n\r]/);
for (let i = 0; i < palabras.length; i++) {
console.log(palabras[i]);
}
console.log("Total palabras: ", palabras.length);<file_sep>/04_arrays/propuestos/5.js
const numeros = [3, 5, -4, 2, 1, 4, 0, 6, -9, 8, 3];
let positivos = 0;
let negativos = 0;
let ceros = 0;
for (let i = 0; i < numeros.length; i++) {
if (numeros[i] > 0) {
positivos++;
} else if (numeros[i] < 0) {
negativos++;
} else {
ceros++;
}
}
console.log("Positivos: " + positivos);
console.log("Negativos: " + negativos);
console.log("Ceros: " + ceros);<file_sep>/07_librerias/propuestos/3/fichero.js
const fs = require("fs");
class Fichero {
constructor (fichero) {
this._fichero = fichero;
}
leer () {
const datos = fs.readFileSync(this._fichero, "utf-8");
return datos;
}
escribir (contenido) {
fs.writeFileSync(this._fichero, contenido);
}
}
module.exports = Fichero;<file_sep>/05_funciones/practicar/33.js
function diferencia (valor1, valor2) {
let diferencia = 0;
if (valor1 > valor2) {
diferencia = valor1 - valor2;
} else {
diferencia = valor2 - valor1;
}
console.log("La diferencia es: ", diferencia);
}
diferencia(10, 5);
diferencia(4, 12);
<file_sep>/03_iteraciones/propuestos/2.js
let numero = prompt("Introduce un número");
if (numero <= 0 || numero % 2 !== 0) {
console.log("Debes introducir un número par mayor que 0");
} else {
let estrellas = "";
while (numero > 0) {
estrellas = estrellas + "*";
numero--;
}
console.log(estrellas);
}<file_sep>/07_librerias/propuestos/6/equipo.js
const fs = require("fs");
const Jugador = require("./jugador");
class Equipo {
cargar () {
const contenido = fs.readFileSync("./jugadores.json");
const jugadores = JSON.parse(contenido);
this._jugadores = [];
this._jugadores = jugadores.map(function (jugador) {
return new Jugador(jugador.nombre, jugador.dorsal);
});
}
fichaje (nombre, dorsal) {
const nuevoFichaje = new Jugador(nombre, dorsal);
this._jugadores.push(nuevoFichaje);
}
mostrar () {
this._jugadores.forEach(function (jugador) {
console.log(jugador.info());
});
}
}
module.exports = Equipo; | aa456a45f86823284f15ab79a957cc186fae48be | [
"JavaScript"
] | 80 | JavaScript | AMMDAW2021/Programacion_c1 | cc77b2e67a13710964a0f867fb9c457461eea3df | e39f07526ac1f667140ea20c018b5cecee68ba5e |
refs/heads/master | <file_sep># ScreenPlayReto1
Primer Reto de ScreenPlay llenado un formulario
<file_sep>package ScreenPlay.Reto1.Model;
public class RegistroAutomatico {
private String firstName;
private String lastName;
private String adress;
private String email;
private String phone;
private String languages;
private String skills;
private String country;
private String selecttCountry;
private String year;
private String mont;
private String day;
private String password;
private String comPassword;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getAdress() {
return adress;
}
public void setAdress(String adress) {
this.adress = adress;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getLanguages() {
return languages;
}
public void setLanguages(String languages) {
this.languages = languages;
}
public String getSkills() {
return skills;
}
public void setSkills(String skills) {
this.skills = skills;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getSelecttCountry() {
return selecttCountry;
}
public void setSelecttCountry(String selecttCountry) {
this.selecttCountry = selecttCountry;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getMont() {
return mont;
}
public void setMont(String mont) {
this.mont = mont;
}
public String getDay() {
return day;
}
public void setDay(String day) {
this.day = day;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getComPassword() {
return comPassword;
}
public void setComPassword(String comPassword) {
this.comPassword = comPassword;
}
} | ea706e29424ffba472a0ad18dbff34f68c29768d | [
"Markdown",
"Java"
] | 2 | Markdown | DavidTorqui/ScreenPlayReto1 | 292cc2d222cbf312b4fbe75afbea7e82ccd708ef | 6704c1db2a79b4b4449f19461868fa9bb1136ea2 |
refs/heads/main | <repo_name>coopercenter/va-local-tax-rates<file_sep>/Appendix-C.Rmd
# Percentage Share of Total Local Taxes from Specific Sources, FY 2018 {#secAppendixC}
```{r}
# Percentage Share of Total Local Taxes from Specific Sources, FY 2018
```
<file_sep>/_book/18-legal-documents.md
# Legal Document Taxes
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, taxes on legal documents accounted for 0.5 percent of total tax revenue for cities and 0.8 percent for counties. Towns do not have this tax. These are averages; the relative importance of taxes in individual localities may vary significantly. For information on individual localities, see Appendix C.
Section 58.1-3800 of the Code of Virginia authorizes the governing body of any city or county to impose a recordation tax in an amount equal to one-third of the state recordation tax. The recordation tax generally applies to real and personal property in connection with deeds of trust, mortgages, and leases, and to contracts involving the sale of rolling stock or equipment (§§ 58.1-807 and 58.1-808).
Local governments are not permitted to impose a levy when the state recordation tax imposed is 50 cents or more (§ 58.1-3800). Consequently, local governments cannot levy a tax on such documents as certain corporate charter amendments (§ 58.1-801), deeds of release (§ 58.1-805), or deeds of partition (§ 58.1-806) as the state tax imposed is already 50 cents per $100.
Sections 58.1-809 and 58.1-810 also specifically exempt certain types of deed modifications from being taxed. Deeds of confirmation or correction, deeds to which the only parties are husband and wife, and modifications or supplements to the original deeds are not taxed. Finally, § 58.1-811 lists a number of exemptions to the recordation tax.
Currently, the state recordation tax on the first \$10 million of value is 25 cents per \$100, so cities and counties can impose a maximum tax of 8.3 cents per \$100 on the first \$10 million, one-third of the 25 cent state rate. Above $10 million there is a declining scale of charges applicable (§ 58.1-3803).
In addition to a tax on real and personal property, §§ 58.1-3805 and 58.1-1718 authorize cities and counties to impose a tax on the probate of every will or grant of administration equal to one-third of the state tax on such probate or grant of administration. Currently, the state tax on wills and grants of administration is 10 cents per \$100 or a fraction of \$100 for estates valued at greater than $15,000 (§ 58.1-1712). Therefore, the maximum local rate is 3.3 cents.
A related *state* tax is levied in localities associated with the Northern Virginia Transportation Authority. The tax is a grantor’s fee of \$0.15 per $100 on the value of real property property sold. This was created as part of the 2013 transportation bill.
**Table 18.1** provides information on the recordation tax and the wills and administration tax for the 35 cities and 89 counties that report imposing one or both of them. The following text table shows range of recordation taxes and taxes on wills and administration imposed by localities.
```r
#Text table "Recordation Tax and Tax on Wills and Administration, 2019" goes here
#Table 18.1 "Legal Document Taxes, 2019" goes here
```
<table>
<caption>(\#tab:table18-1)Legal Document Taxes Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Recordation Tax Rate (Per $100) </th>
<th style="text-align:center;"> Recordation Tax Rate (Per $100) </th>
<th style="text-align:left;"> Tax on Wills and Administration (Per $100) </th>
<th style="text-align:center;"> Tax on Wills and Administration (Per $100) </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.2 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 8.3 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.5 </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 14.5 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 1/3 of state tax (which is 25¢ per $100) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 1/3 of state tax (which is 10¢ per $100) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> Other </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> No tax </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
<file_sep>/Appendix-A.Rmd
# (APPENDIX) Appendix {-}
# 2019 Tax Rates Questionnaire
```{r}
# questionnaire
```
<file_sep>/01-legislative_changes.Rmd
# Summary of Legislative Changes in Local Taxation in 2019
## General Provisions
### Local License Tax on Mobile Food Units
Senate Bill 1425 (Chapter 791) provides that when the owner of a new business that operates a mobile food unit has paid a license tax as required by the locality in which the mobile food unit is registered, the owner is not required to pay a license tax to any other locality for conducting business from such mobile food unit in such a locality.[^01-1]
This exemption from paying the license tax in other localities expires two years after the payment of the initial license tax in the locality in which the mobile food unit is registered. During the two year exemption period, the owner is entitled to exempt up to three mobile food units from license taxation in other localities. However, the owner of the mobile food unit is required to register with the Commissioner of the Revenue or Director of Finance in any locality in which he conducts business from such mobile food unit, regardless of whether the owner is exempt from paying license tax in the locality.
This Act defines “mobile food unit” as a restaurant that is mounted on wheels and readily moveable from place to place at all times during operation. It also defines “new business” as a business that locates for the first time to do business in a locality. A business will not be deemed a new business based on a merger, acquisition, similar business combination, name change, or a change to its business form.
Without the exemption provided in this Act, localities are authorized to impose business, professional and occupational license (BPOL) taxes upon local businesses. Generally, the BPOL tax is levied on the privilege of engaging in business at a definite place of business within a Virginia locality. Businesses that are mobile, however, can be subject to license taxes or fees in multiple localities in certain situations.
Effective: July 1, 2019
Added: § 58.1-3715.1
### Local Gas Road Improvement Tax; Extension of Sunset Provision
House Bill 2555 (Chapter 24) and Senate Bill 1165 (Chapter 191) extend the sunset date for the local gas road improve-ment tax from January 1, 2020 to January 1, 2022. The authority to impose the local gas road improvement tax was previously scheduled to sunset on January 1, 2020.
The localities that comprise the Virginia Coalfield Economic Development Authority may impose a local gas road improvement tax that is capped at a rate of one percent of the gross receipts from the sale of gases severed within the locality. Under current law, the revenues generated from this tax are allocated as follows: 75% are paid into a special fund in each locality called the Coal and Gas Road Improvement Fund, where at least 50% are spent on road improvements and 25% may be spent on new water and sewer systems or the construction, repair, or enhancement of natural gas systems and lines within the locality; and the remaining 25% of the revenue is paid to the Virginia Coalfield Economic Development Fund. The Virginia Coalfield Economic Development Authority is comprised of the City of Norton, and the Counties of Buchanan, Dickenson, Lee, Russell, Scott, Tazewell, and Wise.
Effective: July 1, 2019
Amended: § 58.1-3713
### Private Collectors Authorized for Use by Localities to Collect Delinquent Debts
Senate Bill 1301 (Chapter 271) allows a local treasurer to employ private collection agents to assist with the collection of delinquent amounts due other than delinquent local taxes that have been delinquent for a period of three months or more and for which the appropriate statute of limitations has not run.
Effective: July 1, 2019
Amended: § 58.1-3919.1
## Real Property Tax
### Real Property Tax Exemptions for Elderly and Disabled: Computation of Income Limitation
House Bill 1937 (Chapter 16) provides that, if a locality has established a real estate tax exemption for the elderly and handicapped and enacted an income limitation related to the exemption, it may exclude, for purposes of calculating the income limitation, any disability income received by a family member or nonrelative who lives in the dwelling and who is permanently and totally disabled.
Under current law, if a locality’s tax relief ordinance establishes an annual income limitation, the computation of annual income is calculated by adding together the income received during the preceding calendar year of the owners of the dwelling who use it as their principal residence; and the owners’ relatives who live in the dwelling, except for those relatives living in the dwelling and providing bona fide caregiving services to the owner whether such relatives are compensated or not; and at the option of each locality, nonrelatives of the owner who live in the dwelling except for bona fide tenants or bona fide caregivers of the owner, whether compensated or not.
Effective: July 1, 2019
Amended: § 58.1-3212
### Real Property Tax Exemption for Elderly and Disabled: Improvements to a Dwelling
House Bill 2150 (Chapter 736) and Senate Bill 1196 (Chapter 737) clarify the definition of “dwelling,” for purposes of the real property tax exemption for owners who are 65 years of age or older or permanently and totally disabled, to include certain improvements to the exempt land and the land on which the improvements are situated. These Acts define the term “dwelling” to include an improvement to the land that is not used for a business purpose but is used to house certain motor vehicles or household goods.
Under current law, in order to be granted real property tax relief, qualifying property must be owned by and occupied as the sole dwelling of a person who is at least 65 years of age, or, if the local ordinance provides, any person with a permanent disability. Dwellings jointly held by spouses, with no other joint owners, qualify if either spouse is 65 or over or permanently and totally disabled.
Effective: July 1, 2019
Amended: § 58.1-3210
### Real Property Tax: Partial Exemption from Real Property Taxes for Flood Mitigation Efforts
Senate Bill 1588 (Chapter 754) enables a locality to provide by ordinance a partial exemption from real property taxes for flooding abatement, mitigation, or resiliency efforts for improved real estate that is subject to recurrent flooding, as authorized by an amendment to Article X, Section 6 of the Constitution of Virginia that was adopted by the voters on November 6, 2018.
This act provides that exemptions may only be granted for qualifying flood improvements that do not increase the size of any impervious area and are made to qualifying structures or to land. “Qualifying structures” are defined as structures that were completed prior to July 1, 2018 or were completed more than 10 years prior to the completion of the improvements. For improvements made to land, the improvements must be made primarily for the benefit of one or more qualifying structures. No exemption will be authorized for any improvements made prior to July 1, 2018.
A locality is granted the authority to (i) establish flood protection standards that qualifying flood improvements must meet in order to be eligible for the exemption; (ii) determine the amount of the exemption; (iii) set income or property value limitations on eligibility; (iv) provide that the exemption shall only last for a certain number of years; (v) determine, based upon flood risk, areas of the locality where the exemption may be claimed; and (vi) establish preferred actions for qualifying for the exemption, including living shorelines.
Effective: July 1, 2019
Amended: § 58.1-3228.1
### Real Property Tax: Exemption for Certain Surviving Spouses
House Bill 1655 (Chapter 15) and Senate Bill 1270 (Chapter 801) allow surviving spouses of disabled veterans to continue to qualify for a real property tax exemption regardless of whether the surviving spouse moves to a different residence, as authorized by an amendment to subdivision (a) of Section 6-A of Article X of the Constitution of Virginia that was adopted by the voters on November 6, 2018. If a surviving spouse was eligible for the exemption but lost such eligibility due to a change in residence, then the surviving spouse is eligible for the exemption again, beginning January 1, 2019.
These Acts also clarify that the real property tax exemptions for spouses of service members killed in action and spouses of certain emergency service providers killed in the line of duty continue to apply regardless of the spouse’s moving to a new principal residence.
Effective: Taxable years beginning on or after January 1, 2019
Amended: §§ 58.1-3219.5, 3219.9, and 3219.14
### Land Preservation; Special Assessment, Optional Limit on Annual Increase in Assessed Value
House Bill 2365 (Chapter 22) authorizes localities that employ use value assessments for certain classes of real property to provide by ordinance that the annual increase in the assessed value of eligible property may not exceed a specified dollar amount per acre.
Effective: July 1, 2019
Amended: § 58.1-3231
### Virginia Regional Industrial Act: Revenue Sharing; Composite Index
House Bill 1838 (Chapter 534) requires that the Department of Taxation’s calculation of the true values of real estate and public service company property component of the Commonwealth’s educational composite index of local ability-to-pay take into account arrangements by localities entered into pursuant to the Virginia Regional Industrial Facilities Act, whereby a portion of tax revenue is initially paid to one locality and redistributed to another locality. This Act requires such calculation to properly apportion the percentage of tax revenue ultimately received by each locality.
Effective: July 1, 2021
Amended: § 58.1-6407
### Real Estate with Delinquent Taxes or Liens: Appointment of Special Commissioner; Increase Required Value
House Bill 2060 (Chapter 541) increases the assessed value of a parcel of land that could be subject to appointment of a special commissioner to convey the real estate to a locality as a result of unpaid real property taxes or liens from \$50,000or less to \$75,000 or less in most localities. In the Cities of Norfolk, Richmond, Hopewell, Newport News, Petersburg, Fredericksburg, and Hampton, this Act increases the threshold from \$100,000 or less to \$150,000 or less.
Effective: July 1, 2019
Amended: § 58.1-3970.1
### Real Estate with Delinquent Taxes or Liens; Appointment of Special Commissioner in the City of Martinsville
House Bill 2405 (Chapter 159) adds the city of Martinsville to the list of cities (Norfolk, Richmond, Hopewell, Newport News, Petersburg, Fredericksburg, and Hampton) that are authorized to have a special commissioner convey tax-delinquent real estate to the locality in lieu of a public sale at auction when the tax-delinquent property has an assessed value of \$100,000 or less. House Bill 2060 raises the threshold in all of these cities from \$100,000 or less to \$150,000 or less.
Effective: July 1, 2019
Amended: § 58.1-3970.1
## Personal Property Tax
### Constitutional Amendment: Personal Property Tax Exemption for Motor Vehicle of a Disabled Veteran
House Joint Resolution 676 (Chapter 822) is a first resolution proposing a constitutional amendment that permits the General Assembly to authorize the governing body of any county, city, or town to exempt from taxation one motor vehicle of a veteran who has a 100 percent service-connected, permanent, and total disability. The amendment provides that only automobiles and pickup trucks qualify for the exemption.
Additionally, the exemption will only be applicable on the date the motor vehicle is acquired or the effective date of the amendment, whichever is later, but will not be applicable for any period of time prior to the effective date of the amendment.
Effective: July 1, 2019
### Personal Property Tax Exemption for Agricultural Vehicles
House Bill 2733 (Chapter 259) expands the definition of agricultural use motor vehicles for personal property taxation purposes. It changes the criteria from motor vehicles used “exclusively” for agricultural purposes to motor vehicles used “primarily” for agricultural purposes, and for which the owner is not required to obtain a registration certificate, license plate, and decal or pay a registration fee.
It also expands the definition of trucks or tractor trucks that are used by farmers in their farming operations for the transportation of farm animals or other farm products or for the transport of farm-related machinery. The criteria is changed from vehicles used “exclusively” by farmers in their farming operations to vehicles used “primarily” by farmers in their farming operations.
Further, this Act expands the classification of farm machinery and equipment that a local governing body may exempt, to include equipment and machinery used by a nursery for the production of horticultural products, and any farm tractor, regardless of whether such farm tractor is used exclusively for agricultural purposes.
Local governing bodies have the option to exempt these classifications, in whole or in part, from taxation or to provide for a different rate of taxation thereon.
Effective: July 1, 2019
Amended: § 58.1-3505
### Intangible Personal Property Tax: Classification of Certain Business Property
House Bill 2440 (Chapter 255) classifies as intangible personal property, tangible personal property: i) that is used in a trade or business; ii) with an original cost of less than $25; and iii) that is not classified as machinery and tools, merchants’ capital, or short-term rental property. It also exempts such property from taxation.
Intangible personal property is a separate class of prop-erty segregated for taxation by the Commonwealth. The Commonwealth does not currently tax intangible personal property. Localities are prohibited from taxing intangible personal property.
Certain personal property, while tangible in fact, has previously been designated as intangible and thus exempted from state and local taxation. For example, tangible personal property used in manufacturing, mining, water well drill-ing, radio or television broadcasting, dairy, dry cleaning, or laundry businesses has been designated as exempt intangible personal property.
Effective: July 1, 2019
Amended: §§ 58.1-1101 and 58.1-1103
[^01-1]: Excerpted from the local tax legislation section of the Department of Taxation’s 2019 Legislative Summary. Minor changes were made in format and punctuation. See https://tax.virginia.gov/legislative-summary-reports<file_sep>/_book/25-Virginia-Enterprise-Zone-Program.md
# Virginia Enterprise Zone Program 2018
## INTRODUCTION
This section on the Virginia Enterprise Zone Program is included because of its relevance to local taxation. Along with state grants, local enterprise zones (EZ) receive tax breaks and other incentives from local governments that must be in accordance with state and local tax law. The program is administered by the Virginia Department of Housing and Community Development (VDHCD). Each year VDHCD produces a summary report about the enterprise zone program. The current report, Virginia Enterprise Zone Program Grant Year 2018 Annual Report, has not yet been added to the web. The description that follows is based on that report.
## PURPOSE FOR THE PROGRAM
The Virginia Enterprise Zone Program was created in 1982 to form a partnership between state and local governments to stimulate job creation, private investment, and revitalization of distressed Virginia localities. The act focused on state and local tax credits to help areas designated as enterprise zones. Cities and counties that applied for, and were granted the designation, were able to receive tax credits for businesses situated in the zones. Currently, there are 46 designated enterprise zones in Virginia.
In 2005 the General Assembly passed the Enterprise Zone Grant Act (§ 59.1-538), modifying the program to transition from tax credits to grants. A zone will receive an initial ten-year designation period, with two five-year renewals possible (§ 59.1-542.E). In addition, the number of zones will be reduced to 30 as many of the older zones expire.
The program is meant to target areas which have the greatest need and in which the greatest impact will be made. Consequently, the ranking of applications requires that 50 percent of an application’s suitability rest on a given measure of local economic distress. The application ranks the locality over the most recent three-year period for its average unemployment rate, its average median adjusted gross income on all returns, and the average percentage of public school students receiving free or reduced-price lunches.
Only cities and counties can apply for the zone designation (§ 59.1-542). Towns are considered part of the county acreage. Cities and counties can jointly apply for designation, provided that the proposed zone meets program standards. A locality can choose to put a zone where it best fits local economic development needs. There may be three zones per locality and each zone may be composed of three non-contiguous areas.
## PROGRAM GRANTS
There are two grants associated with the program: job creation grants and real property investment grants. Job creation grants are supposed to encourage the creation of higher quality jobs (§ 59.1-547). If a business within the zone meets a certain job creation threshold, provides health benefits and pays at least 175 percent of the federal minimum wage for the positions under consideration, it can receive a grant of up to \$500 per year for each position. A business that meets all the above conditions and pays at least 200 percent of the federal minimum wage can receive up to $800 per year for each position.
Real property investment grants are meant to encourage creation or renovation of facilities within the enterprise zone (§ 59.1-548). The grants may be applied to commercial, industrial or mixed-use buildings, paying up to 20 percent of the cost of qualifying real property. For property investments of less than \$5 million, grants of up to \$100,000 per building or facility are available for qualifying real property. For property investments of \$5 million or more, grants may reach $200,000 for qualifying property. Qualifying real property generally includes costs associated with the physical preparation and physical items such as excavation, grading, paving, driveways, roads, sidewalks, demolition, painting, sheetrock, carpentry and more. Costs that do not qualify include those for furnishings, appraisal, legal services, closing services, insurance and more.
## LOCAL INCENTIVES
In addition to the state grants are the incentives provided by localities to businesses within enterprise zones. A locality may offer any incentive as long as it is permissible under federal and state law and as long as it is applied uniformly within the zone (§ 59.1-543). Incentives may include reduced property taxes, both real and personal, within the zone, partial exemptions for rehabilitated real estate within the zone, reduced permit and user fees, and more.
The current edition of Tax Rates does not carry a table listing the local incentives in enterprise zones for 2018 because the information is provided in the appendix of VDHCD’s annual report. The following text table lists the years in which the current zones are scheduled to expire.
Table: (\#tab:unnamed-chunk-2)Year Enterprise Zones (EZ) Are Scheduled to Expire
| Year| Number|
|----:|------:|
| 0| 0|
Source: Virginia Department of Housing and Community Development, Grant Year 2018 Annual Report: Virginia Enterprise Zone Program. Provided by the DHCD to the author.
*The information for this section came from the Virginia Department of Housing and Community Development. See http://www.dhcd.virginia.gov/index.php/business-va-assistance/startingexpanding-a-business/virginia-enterprise-zone-vez-business.html
<file_sep>/_book/03-real_property_tax_relief.md
# Real Property Tax Relief Plans and Housing Grants for the Elderly and Disabled in 2019
Sections 58.1-3210 through 58.1-3218 of the *Code of Virginia* provides that localities may adopt an ordinance allowing property tax relief for elderly and disabled persons. The relief may be in the form of either deferral or exemption from taxes. The applicant for tax relief must be either disabled or not less than 65 years of age and must be the owner of the property for which relief is sought (§ 58.1-3210). The property must be the sole dwelling of the applicant. In addition, localities have the option of exempting or deferring the portion of a person’s tax that represents the increase in tax liability since the year the taxpayer reached 65 years of age or became disabled.
Localities are allowed to establish by ordinance the net financial worth and annual income limitations pertaining to owners, relatives and non-relatives living in the dwelling(§ 58.1-3212) of qualified elderly or handicapped persons. Further, mobile homes that are owned by elderly and disabled persons are included in the allowable property tax exemptions whether or not mobile homes are permanently affixed. Finally, local governments are authorized to extend tax relief for the elderly and disabled to dwellings that are jointly owned by individuals, not all of whom are over 65 or totally disabled.
The table below indicates the range and media of the combined gross income allowance and combined net worth limitations for those cities, counties, and towns responding to the survey.
```r
#table name: Relief Plan Statistics: Gross Income and Net Worth, 2019
```
The following table indicates, for those localities responding, how many localities have a tax relief plan that applies to both the elderly and the disabled, the elderly only,or the disabled only.
```r
# table name: Relief Plans for Elderly and Disabled, 2019
```
A majority of the localities exempt an owner from all or part of the taxes on the dwelling; usually the exemption is based on a sliding scale, with the percentage of the exemption decreasing as the income and/or net worth of the owner increases.
**Table 3.1** summarizes the various tax relief plans offered to elderly and disabled property owners in Virginia. The figures under the combined gross income heading reflect, first, the maximum allowable income (including the income of all relatives living with the owner) for an owner to be eligible for relief and, second, the amount of income of each relative living in the household, except the spouse, who is exempted from this amount.
For example, if the table reads “\$7,500; first \$1,500 exempt,” this indicates that the combined income of the owner and all relatives living with him/her may not exceed \$7,500, except that the first \$1,500 of income of each relative other than the spouse is excluded when computing this amount. The combined net worth amount listed usually excludes the value of the dwelling and a given parcel of land upon which the dwelling is situated.
**Table 3.2** details relief plans for renters. As the table indicates, few localities offer such plans. Only five cities (Alexandria, Charlottesville, Fairfax, Falls Church, and Hampton) and one county (Fairfax) reported having plans for renters.
**Table 3.3** lists the combined elderly and disabled beneficiaries reported by each locality in 2018 or 2019 and the amount of revenue foregone by each locality because of the homeowner exemptions. The amounts were reported by 23 cities, 66 counties, and 31 towns that responded to the question. The amounts reported foregone totaled \$21,698,890 for cities, \$60,242,734 for counties and \$636,229 for the reporting towns. The grand total amount foregone by reporting cities, counties, and towns was \$82,577,853. An estimate of the average revenue foregone per beneficiary is also provided for localities reporting both number of beneficiaries and foregone revenue. For cities, the average revenue foregone was \$1,518 per beneficiary. The amount for counties was \$1,581, and for towns it was \$360.
<file_sep>/_book/20-refuse-recycling.md
# Refuse and Recycling Collection Fees
Many Virginia localities collect, or authorize to have collected, refuse and recycled materials. In its survey, the Cooper Center inquired into the methods and fees for the collection of refuse and recycled materials. The answers are provided in four tables covering regular refuse pick up, tipping fees, recycling, and pickup of miscellaneous refuse items.
## REFUSE COLLECTION
**Table 20.1** shows information reported on refuse collection by all 38 cities, and by 24 counties and 101 towns. The table contains information on frequency of collection, collection fees and private contracting. There are three methods of operation. Some Virginia localities levy a specific refuse collection service fee for the costs of collection. Others pay for collection costs with general tax revenues. Finally, some localities provide no service; instead, they leave refuse collection to private contractors.
A majority of cities and counties provide basic residential services on a weekly basis. Only the counties of Arlington, Chesterfield, and Halifax offer regular collections more frequently.
Regarding fees, 32 cities, 13 counties, and 62 towns reported imposing a residential refuse collection service fee. Eleven cities, 7 counties, and 42 towns contracted with private firms for refuse collection. The text table below shows this breakdown.
```r
#text table "Residential Refuse Collection, 2019" goes here
```
**Table 20.2** shows tipping fees charged by various localities to dump trash at landfills and waste transfer stations. Localities reporting imposing such fees included 9 cities, 34 counties, and 7 towns.
## RECYCLING PROGRAMS
**Table 20.3** provides data on localities that have instituted recycling programs. As with refuse collection, these programs may be financed in a variety of ways. Many localities pick up recyclables and then finance the collection with a service charge. Other localities contract with a private firm. **Table 20.3** shows which localities offer collection of recyclables and which contract for collection with a private firm. It also shows the monthly fees associated with collecting recyclables.
Of the total survey respondents, 38 cities, 83 counties, and 67 towns reported having some form of recycling activity. Seventeen cities provided recycling collection directly, and 21 contracted it out. Thirty-seven counties provided services directly, while 46 contracted them out. Of the towns, 8 had their services provided by their host county, 25 provided direct services, and 34 contracted for services. The table below shows this breakdown.
For localities that charged a service fee, the amount ranged anywhere from \$1.33 to $16.50 per month.
```r
#Table 20.1 "Refuse Collection Fees, 2019" goes here, formatting TBD
```
<file_sep>/tables/old-stuff/va-local-tax-rates.Rmd
---
title: "Virginia Local Tax Rates"
output:
html_document: default
pdf_document: default
editor_options:
chunk_output_type: inline
---
```{r, setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message=FALSE, cache = FALSE, fig.width = 8)
```
```{r , message=FALSE, echo=FALSE}
# install.packages("qualtRics")
library(tidyverse)
library(qualtRics)
```
# Section 17: Taxes on Natural Resources, 2019
```{r read in va local tax rates survey results from csv file, message=FALSE, warning=FALSE, eval=FALSE}
# # path <- here::here("raw_data", "2021-04-14-CCPS_Tax_Rates.xlsx")
# path2csv <- "/Users/Arthur/OneDrive - University of Virginia/CCPS/va-local-tax-rates/raw_data/CCPS Tax Rates_April 19, 2021_10.44.csv"
#
# tax_rates <- qualtRics::read_survey(path2csv)
```
```{r read in va local tax rates survey results from Qualtrics, include=FALSE}
all_surveys() %>%
filter(name == "CCPS Tax Rates - Copy") %>%
pull(id) -> va_tax_rates_survey_id
fetch_survey(va_tax_rates_survey_id, force_request = TRUE) -> va_tax_rates_survey
nrow(va_tax_rates_survey)
```
```{r create data mapping}
extract_colmap(tax_rates) %>% select(qname : ImportId) -> colmap
```
```{r }
colmap %>%
filter(str_detect(qname, "nat_tax") & qname != "nat_tax_cmt") %>%
pull(qname) -> nat_tax_qnames
display_names_tbl <- tibble(qname = c("ExternalReference",nat_tax_qnames),
display_name = c("Locality",
"Tax on Mineral Land\n(§ 58.1-3286)",
"Oil Severance Tax\n(§ 58.1-3712.1)",
"Coal & Gas Severance Tax\n(§ 58.1-3712)",
"Coal & Gas Road Improvement Tax\n(§ 58.1-3713)",
"Additional Gas Severance Tax\n(§ 58.1-3713.4)"))
# colmap %>% left_join(display_names_tbl, by = "qname") -> colmap
tax_rates %>%
select(ExternalReference, all_of(nat_tax_qnames)) %>%
filter(!is.na(ExternalReference)) %>%
arrange(ExternalReference) %>%
distinct() %>%
select(ExternalReference, nat_tax_coal, nat_tax_oil,nat_tax_add_gas, nat_tax_road_impr,nat_tax_min) -> table_17_1_raw
# table_17_1_raw %>%
# rename("Locality" = ExternalReference,
# "Coal & Gas Severance Tax\n(§ 58.1-3712)" = nat_tax_coal,
# "Oil Severance Tax\n(§ 58.1-3712.1)" = nat_tax_oil,
# "Additional Gas Severance Tax\n(§ 58.1-3713.4)" = nat_tax_add_gas,
# "Coal & Gas Road Improvement Tax\n(§ 58.1-3713)" = nat_tax_road_impr,
# "Tax on Mineral Land\n(§ 58.1-3286)" = nat_tax_min) -> table_17_1
table_17_1_raw %>%
rename("Locality" = ExternalReference,
"Coal & Gas Severance Tax" = nat_tax_coal,
"Oil Severance Tax" = nat_tax_oil,
"Additional Gas Severance Tax" = nat_tax_add_gas,
"Coal & Gas Road Improvement Tax" = nat_tax_road_impr,
"Tax on Mineral Land" = nat_tax_min) -> table_17_1
# colmap %>%
# inner_join(display_names_tbl, by = "qname") %>%
# filter(qname %in% (table_17_1_raw %>% colnames())) %>%
# pull(qname) %>%
# match(., (table_17_1_raw %>% colnames())) -> ord
#
# display_names_tbl$display_name[ord]
```
```{r}
opts <- options(knitr.kable.NA = "--")
# inner_join(colmap, display_names_tbl, by = "qname")
knitr::kable(table_17_1, caption = "Natural Resource Taxes, 2019",align = "lccccc")
```
<file_sep>/_book/Appendix-C.md
# Percentage Share of Total Local Taxes from Specific Sources, FY 2018 {#secAppendixC}
```r
# Percentage Share of Total Local Taxes from Specific Sources, FY 2018
```
<file_sep>/20-refuse-recycling.Rmd
# Refuse and Recycling Collection Fees
```{r prep data for section 20, message=FALSE, echo=FALSE}
#source("get_and_prep_data.R")
section_vars <- c("RCC_tipping_fees",
"RCC_rec_serv_type",
"RCC_rec_charge_fee")
#tax_rates %>%
#select(all_of(reference_vars), all_of(section_vars)) %>%
#mutate(across(.cols = all_of(section_vars), ~ ifelse(.==0, NA, .))) %>% # Convert zero values to NA's
#mutate(across(.cols = all_of(section_vars), ~ !is.na(.), .names = "has_{.col}")) %>%
#mutate(has_RCC_tipping_fees = case_when(!(has_RCC_tipping_fees) ~ FALSE,
#RCC_tipping_fees %in% c("no", "No", "N/A", "Landfill closed") ~ FALSE,
#TRUE ~ TRUE)) %>%
#mutate(has_RCC_rec_serv_type = (RCC_rec_serv_type != "Not Applicable")) %>%
#filter(if_any(starts_with("has_"))) -> section_tbl
```
Many Virginia localities collect, or authorize to have collected, refuse and recycled materials. In its survey, the Cooper Center inquired into the methods and fees for the collection of refuse and recycled materials. The answers are provided in four tables covering regular refuse pick up, tipping fees, recycling, and pickup of miscellaneous refuse items.
## REFUSE COLLECTION
**Table 20.1** shows information reported on refuse collection by all 38 cities, and by 24 counties and 101 towns. The table contains information on frequency of collection, collection fees and private contracting. There are three methods of operation. Some Virginia localities levy a specific refuse collection service fee for the costs of collection. Others pay for collection costs with general tax revenues. Finally, some localities provide no service; instead, they leave refuse collection to private contractors.
A majority of cities and counties provide basic residential services on a weekly basis. Only the counties of Arlington, Chesterfield, and Halifax offer regular collections more frequently.
Regarding fees, 32 cities, 13 counties, and 62 towns reported imposing a residential refuse collection service fee. Eleven cities, 7 counties, and 42 towns contracted with private firms for refuse collection. The text table below shows this breakdown.
```{r}
#text table "Residential Refuse Collection, 2019" goes here
```
**Table 20.2** shows tipping fees charged by various localities to dump trash at landfills and waste transfer stations. Localities reporting imposing such fees included 9 cities, 34 counties, and 7 towns.
## RECYCLING PROGRAMS
**Table 20.3** provides data on localities that have instituted recycling programs. As with refuse collection, these programs may be financed in a variety of ways. Many localities pick up recyclables and then finance the collection with a service charge. Other localities contract with a private firm. **Table 20.3** shows which localities offer collection of recyclables and which contract for collection with a private firm. It also shows the monthly fees associated with collecting recyclables.
```{r Residential Recycling Programs, include=FALSE}
#section_tbl %>%
#group_by(locality_group) %>%
#summarize(Direct = sum(RCC_rec_serv_type == "Directly"),
#Contracted = sum(RCC_rec_serv_type == "Contracted")) %>%
#ungroup() %>%
#pivot_longer(!locality_group, names_to = "Service", values_to = "count") %>%
#pivot_wider(names_from = locality_group, values_from = count) -> res_recycling_summary_tbl
```
Of the total survey respondents, 38 cities, 83 counties, and 67 towns reported having some form of recycling activity. Seventeen cities provided recycling collection directly, and 21 contracted it out. Thirty-seven counties provided services directly, while 46 contracted them out. Of the towns, 8 had their services provided by their host county, 25 provided direct services, and 34 contracted for services. The table below shows this breakdown.
```{r , echo=FALSE}
#res_recycling_summary_tbl %>%
#knitr::kable(caption = "Residential Recycling Programs, 2019")
```
For localities that charged a service fee, the amount ranged anywhere from \$1.33 to $16.50 per month.
```{r}
#Table 20.1 "Refuse Collection Fees, 2019" goes here, formatting TBD
```
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table20-1, echo=FALSE, eval=FALSE}
table_20_1_vars <- c("ExternalDataReference", "RCC_res_freq","RCC_ind_freq", "RCC_res_fee", "RCC_ind_fee", "RCC_private_contract")
table_20_1_labels <- c("Locality","Frequency of Collections per Week", "", "Collection Fee (Dollars Per Month Unless Otherwise Stated)", "", "Locality Contracts with Private Firm(s) for Refuse Collection")
table_20_1 <- make_table(table_20_1_vars)
knitr::kable(table_20_1,
caption = "Refuse Collection Fees Table, 2019",
col.names = table_20_1_labels,
align = "lccc",
format = "html")
```
```{r table20-2, echo=FALSE}
#section_tbl %>%
#filter(has_RCC_tipping_fees) %>%
#select(locality_name, locality_group, RCC_tipping_fees) -> table_20_2
#table_20_2_labels <- c("Locality","Tipping Fee")
#make_long_table(table_20_2,
#caption = "Refuse Collection Tipping Fees Table, 2019",
#col.names = table_20_2_labels,
#align = "lc")
```
```{r table20-3, echo=FALSE}
#section_tbl %>%
#filter(has_RCC_rec_serv_type) %>%
#select(locality_name, locality_group, RCC_rec_serv_type, RCC_rec_charge_fee) -> table_20_3
#table_20_3_labels <- c("Locality","Provided Directly or Contracted","Service Fee")
#make_long_table(table_20_3,
#caption = "Recycling Collection Fees Table, 2019",
#col.names = table_20_3_labels,
#align = "lcc")
```
<file_sep>/05-Agricultural_Forestal_Districts.md
<<<<<<< HEAD
# Agricultural and Forestal Districts
Local governments are permitted to enact an ordinance providing for the creation of agricultural and forestal districts. Such districts are intended, as the *Code* states, "... to conserve and to encourage the development and improvement of the commonwealth's agricultural and forestal lands for the production of food and other agricultural and forestal products." According to the *Code*, the districts also "...conserve and protect agricultural and forestal lands as valued natural and ecological resources which provide essential open spaces for clean air sheds, watershed protection, wildlife habitat, as well as for aesthetic purposes." The authority for such districts is provided by the *Code of Virginia*, §§ 15.2-4300 through 15.2-4314 (Agricultural and Forestal Districts Act) and §§ 15.2-4400 through 15.2-4407 (Local Agricultural and Forestal Districts Act).
In accordance with the Agricultural and Forestal Districts Act, each district must have a core of no less than 200 acres in one parcel or in contiguous parcels; however, districts of local significance created under the act may be as small as 20 acres.[^05-1] Further, the local governing body must review each district within four to ten years after its creation and every four to ten years thereafter. For additional information relating to the creation of the districts, see § 15.2-4305.
Land devoted to agricultural and forestal production within an agricultural and forestal district qualifies for special assessment for land use whether or not a local land use plan or special assessments ordinance has been adopted, provided that the land meets the criteria set forth in §58.1-3230 et seq. of the *Code* (see also § 15.2-4312).[^05-2]
Three cities and 28 counties reported having a total of 372 agricultural and forestal districts. In addition, two towns, Blacksburg and Louisa, reported a total of two districts. In terms of acreage, Cities reported a total of 2,530 acres and the two towns reported a total of 1,422 acres - 1,360 acres and 62 acres, respectively. These numbers were negligible compared to the 736,140 acres reported by counties. Of the counties, those reporting the greatest number of acres within agricultural and forestal districts were Fauquier (78,755 acres), Accomack (74,093 acres), Albemarle (72,665 acres), Culpeper (46,487 acres), and Isle of Wight (41,317 acres).
The following text table shows by year when the existing city and county districts came into existence. Four new districts were reported in 2019.
```r
# table name: Agricultural and Forestal Districts by Year of Creation for Cities and Counties, 1978 and 2019
```
**Table 5.1** presents information for all cities, counties, and towns which reported agricultural and forestal districts. The table includes the district creation date, acreage, and the review period for each district. Three cities, 28 counties and two towns reported having an agricultural and forestal district ordinance in effect for the 2019 tax year.
Section 4 of this publication provides details on the related program of land use value assessments and cites literature that questions the effectiveness of special assessments in slowing the conversion of participating land to other uses.
```r
# Table 5.1 Agricultural and Forestal Districts, 2019
```
[^05-1]: Under provisions of the Local Agricultural and Forestal Districts Act, only counties satisfying the following conditions are "participating localities" empowered to establish districts with this reduced acreage requirement: (1) a county with an urban county executive form of government, (2) any adjacent county having the county executive form of government, and (3) counties with population sizes ranging from 63,400 to 73,900 or from 85,000 to 90,000 [no census cited]. See §§ 15.2-4402 through 4405.
[^05-2]: For additional rules concerning agricultural and forestal districts, see § 15.2-4312.
||||||| 93418eb
=======
# Agricultural and Forestal Districts
Local governments are permitted to enact an ordinance providing for the creation of agricultural and forestal districts. Such districts are intended, as the *Code* states, "... to conserve and to encourage the development and improvement of the commonwealth's agricultural and forestal lands for the production of food and other agricultural and forestal products." According to the *Code*, the districts also "...conserve and protect agricultural and forestal lands as valued natural and ecological resources which provide essential open spaces for clean air sheds, watershed protection, wildlife habitat, as well as for aesthetic purposes." The authority for such districts is provided by the *Code of Virginia*, §§ 15.2-4300 through 15.2-4314 (Agricultural and Forestal Districts Act) and §§ 15.2-4400 through 15.2-4407 (Local Agricultural and Forestal Districts Act).
In accordance with the Agricultural and Forestal Districts Act, each district must have a core of no less than 200 acres in one parcel or in contiguous parcels; however, districts of local significance created under the act may be as small as 20 acres.[^05-1] Further, the local governing body must review each district within four to ten years after its creation and every four to ten years thereafter. For additional information relating to the creation of the districts, see § 15.2-4305.
Land devoted to agricultural and forestal production within an agricultural and forestal district qualifies for special assessment for land use whether or not a local land use plan or special assessments ordinance has been adopted, provided that the land meets the criteria set forth in §58.1-3230 et seq. of the *Code* (see also § 15.2-4312).[^05-2]
Three cities and 28 counties reported having a total of 372 agricultural and forestal districts. In addition, two towns, Blacksburg and Louisa, reported a total of two districts. In terms of acreage, Cities reported a total of 2,530 acres and the two towns reported a total of 1,422 acres - 1,360 acres and 62 acres, respectively. These numbers were negligible compared to the 736,140 acres reported by counties. Of the counties, those reporting the greatest number of acres within agricultural and forestal districts were Fauquier (78,755 acres), Accomack (74,093 acres), Albemarle (72,665 acres), Culpeper (46,487 acres), and Isle of Wight (41,317 acres).
The following text table shows by year when the existing city and county districts came into existence. Four new districts were reported in 2019.
```r
# table name: Agricultural and Forestal Districts by Year of Creation for Cities and Counties, 1978 and 2019
```
**Table 5.1** presents information for all cities, counties, and towns which reported agricultural and forestal districts. The table includes the district creation date, acreage, and the review period for each district. Three cities, 28 counties and two towns reported having an agricultural and forestal district ordinance in effect for the 2019 tax year.
Section 4 of this publication provides details on the related program of land use value assessments and cites literature that questions the effectiveness of special assessments in slowing the conversion of participating land to other uses.
```r
# Table 5.1 Agricultural and Forestal Districts, 2019
```
[^05-1]: Under provisions of the Local Agricultural and Forestal Districts Act, only counties satisfying the following conditions are "participating localities" empowered to establish districts with this reduced acreage requirement: (1) a county with an urban county executive form of government, (2) any adjacent county having the county executive form of government, and (3) counties with population sizes ranging from 63,400 to 73,900 or from 85,000 to 90,000 [no census cited]. See §§ 15.2-4402 through 4405.
[^05-2]: For additional rules concerning agricultural and forestal districts, see § 15.2-4312.
>>>>>>> b8134d41eedfc8f500ada3fe62b9add99226f91d
<file_sep>/10-Machinery-Tools-Tax.Rmd
# Machinery and Tools Property Tax
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the machinery and tools property tax accounted for 1.6 percent of total tax revenue for cities, 1.2 percent for counties, and 2.0 percent for large towns. These are averages; the relative importance of taxes in individual cities, counties, and towns may vary significantly. For information on individual localities, see Appendix C.
Under § 58.1-3507 of the *Code of Virginia*, certain machinery and tools are segregated as tangible personal property for local taxation. According to the *Code*, the classes of machinery and tools that are segregated are those that are used for “manufacturing, mining, processing and reprocessing (excluding food processing), radio or television broadcasting, dairy, and laundry or dry cleaning.” The tax rate on machinery and tools may not be higher than that imposed on other classes of tangible personal property.
Section 58.1-3507 provides a uniform classification for idle machinery. Idle machinery and tools are to be classified as intangible personal property no longer subject to local taxation. Items are defined to be idle if they have not been used for at least one year prior to the given tax day and no one can reasonably suppose that the machinery or tool will be returned to use in the given tax year.
Section 58.1-3980 provides an appeal procedure for the machinery and tools tax. The *Code* states, “... any person, firm, or corporation assessed by a commissioner of the revenue ... aggrieved by any such assessment, may, within three years from the last day of the tax year for which such assessment is made, or within one year from the date of the assessment, whichever is later, apply to the commissioner of the revenue or such other official who made the assessment for a correction thereof.”
**Table 10.1** presents the 2018 tax rates on machinery and tools for the 37 cities, 91 counties, and 79 towns that reported imposing the tax. The machinery and tools tax is shown in the table according to the following categories: the basis of assessment, assessment type, the statutory (nominal) tax rate per \$100, the assessment ratio, and the effective tax rate (computed by multiplying the statutory tax rate by the assessment ratio). *Effective tax rates among localities are only comparable if they use the same basis of assessment and apply it to the same age of property*. Most localities assess machinery and tools on the basis of original cost, fair market value, or book value. Frequently, a sliding scale is used, with the effective tax rate varying according to the age of the property.
Thirty-six cities reported using original cost as the basis of assessment. Eighty-eight counties imposing the tax used original cost. Finally, 69 of the towns reported basing their assessments on original cost. The remainder used fair market value or depreciated cost. In many cases it is accurate to say that towns followed the same method as the county in which they are located. However, some exceptions exist.
The following text table, using unweighted averages, compares localities using original cost as their basis. The table is based on machinery and equipment one year old. The medians for cities, counties and towns were \$1.05, \$0.90, and \$0.39, respectively. Town rates were in addition to rates imposed by their host counties.
```{r}
# table name: Machinery and Tools: Effective 1st Year Tax Rate per $100 for Localities Using Original Cost, 2019
```
**Table 10.2** presents the 2019 tax rates in industries which the *Code* permits specific types of equipment to be categorized as machinery and tools. The separate classification is permitted by § 58.1-3508 and § 58.1-3508.1. Currently, 13 localities report having a separate tax on equipment in the semiconductor industry; 47 report having a machinery and tools tax in the forest harvesting industry; 67 localities report so in the vehicle cleaning industry; while only 3 localities reports having it as a separate category in the castings industry. Meanwhile, 7 localities report having the tax for equipment in the defense industry, and 2 localities report having the category in other businesses.
**Table 10.3** presents the number of machinery and tool accounts each locality reported for 2019. Twenty-eight cities reported their number of accounts, as did 69 counties and 27 towns. When we asked the question, we assumed localities organized their accounts by business entity (i.e., each business had an account and within that account resided any number of tools). However, based on responses from some localities, this might not always be the case. Some localities responded that the machinery or tool item, not the business entity, was the basis of the account. Others informed us that their machinery and tools accounts included items we did not expect, such as company work trucks. Localities which reported having such systems tended to report a higher number of accounts.
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table10-1, echo=FALSE}
#table_10_1_vars <- c("ExternalDataReference","src_assmt_value", "mach_tool_assmt", "src_assmt_rate", "src_assmt_ratio", "")
#table_10_1_labels <- c("Locality","Basis of Assessment*", "Assessment Type*", "Statutory Rate Per $100", "Assessment, Year, Ratio (%)", "Effective Rate Per $100[^†]")
#table_10_1 <- make_table(table_10_1_vars)
#knitr::kable(table_10_1,
#caption = "Machinery and Tools Property Tax, General Information Table, 2019",
#col.names = table_10_1_labels,
#align = "lcccccc",
#format = "html")
```
```{r table10-2, echo=FALSE}
#table_10_2_vars <- c("ExternalDataReference","semi_manuf_rate", "forest_harv_rate", "", "", "national_defense_rate", "")
#table_10_2_labels <- c("Locality","Rate Per $100 of Assessed Value, Semiconductor", ",Forestry", ",Vehicle Cleaning", ",Castings", ",Defense", ",Other Business")
#table_10_2 <- make_table(table_10_2_vars)
#knitr::kable(table_10_2,
#caption = "Machinery and Tools Tax on Specific Types of Equipment Table, 2019",
#col.names = table_10_2_labels,
#align = "lcccccc",
#format = "html")
```
```{r table10-3, echo=FALSE}
table_10_3_vars <- c("ExternalDataReference","manuf_accs")
table_10_3_labels <- c("Locality","Number of Accounts")
table_10_3 <- make_table(table_10_3_vars)
knitr::kable(table_10_3,
caption = "Machinery and Tools Tax, Number of Accounts Table, 2019",
col.names = table_10_3_labels,
align = "lcccccccc",
format = "html")
```
```{r}
# Table 10.1 Machinery and Tools Property Tax, General Information, 2019
# Table 10.2 Machinery and Tools Tax on Specific Types of Equipment, 2019
# Table 10.3 Machinery and Tools Tax, Number of Accounts, 2019
```
<file_sep>/README.md
# va-local-tax-rates<file_sep>/05-Agricultural_Forestal_Districts.Rmd
# Agricultural and Forestal Districts
Local governments are permitted to enact an ordinance providing for the creation of agricultural and forestal districts. Such districts are intended, as the *Code* states, "... to conserve and to encourage the development and improvement of the commonwealth's agricultural and forestal lands for the production of food and other agricultural and forestal products." According to the *Code*, the districts also "...conserve and protect agricultural and forestal lands as valued natural and ecological resources which provide essential open spaces for clean air sheds, watershed protection, wildlife habitat, as well as for aesthetic purposes." The authority for such districts is provided by the *Code of Virginia*, §§ 15.2-4300 through 15.2-4314 (Agricultural and Forestal Districts Act) and §§ 15.2-4400 through 15.2-4407 (Local Agricultural and Forestal Districts Act).
In accordance with the Agricultural and Forestal Districts Act, each district must have a core of no less than 200 acres in one parcel or in contiguous parcels; however, districts of local significance created under the act may be as small as 20 acres.[^05-1] Further, the local governing body must review each district within four to ten years after its creation and every four to ten years thereafter. For additional information relating to the creation of the districts, see § 15.2-4305.
Land devoted to agricultural and forestal production within an agricultural and forestal district qualifies for special assessment for land use whether or not a local land use plan or special assessments ordinance has been adopted, provided that the land meets the criteria set forth in §58.1-3230 et seq. of the *Code* (see also § 15.2-4312).[^05-2]
Three cities and 28 counties reported having a total of 372 agricultural and forestal districts. In addition, two towns, Blacksburg and Louisa, reported a total of two districts. In terms of acreage, Cities reported a total of 2,530 acres and the two towns reported a total of 1,422 acres - 1,360 acres and 62 acres, respectively. These numbers were negligible compared to the 736,140 acres reported by counties. Of the counties, those reporting the greatest number of acres within agricultural and forestal districts were Fauquier (78,755 acres), Accomack (74,093 acres), Albemarle (72,665 acres), Culpeper (46,487 acres), and Isle of Wight (41,317 acres).
The following text table shows by year when the existing city and county districts came into existence. Four new districts were reported in 2019.
```{r}
# table name: Agricultural and Forestal Districts by Year of Creation for Cities and Counties, 1978 and 2019
```
**Table 5.1** presents information for all cities, counties, and towns which reported agricultural and forestal districts. The table includes the district creation date, acreage, and the review period for each district. Three cities, 28 counties and two towns reported having an agricultural and forestal district ordinance in effect for the 2019 tax year.
Section 4 of this publication provides details on the related program of land use value assessments and cites literature that questions the effectiveness of special assessments in slowing the conversion of participating land to other uses.
```{r}
# Table 5.1 Agricultural and Forestal Districts, 2019
```
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table05-1, echo=FALSE, eval=FALSE}
#table_05_1_vars <- c("ExternalDataReference", "")
#table_05_1_labels <- c("Locality","Name of District", "Date Created", "Review Period (Years)", "Acreage")
#table_05_1 <- make_table(table_05_1_vars)
#knitr::kable(table_05_1,
#caption = "Agricultural and Forestal Districts Table, 2019",
#col.names = table_05_1_labels,
#align = "lcccc",
#format = "html")
```
[^05-1]: Under provisions of the Local Agricultural and Forestal Districts Act, only counties satisfying the following conditions are "participating localities" empowered to establish districts with this reduced acreage requirement: (1) a county with an urban county executive form of government, (2) any adjacent county having the county executive form of government, and (3) counties with population sizes ranging from 63,400 to 73,900 or from 85,000 to 90,000 [no census cited]. See §§ 15.2-4402 through 4405.
[^05-2]: For additional rules concerning agricultural and forestal districts, see § 15.2-4312.
<file_sep>/_book/Appendix-A.md
# (APPENDIX) Appendix {-}
# 2019 Tax Rates Questionnaire
```r
# questionnaire
```
<file_sep>/prep_data.R
library(tidyverse)
# read in va local tax rates survey results from xlsx file; drop unnecessary cols
path2xl <- here::here("data", "TR2020inputdataMain.xlsx")
tax_rates_raw <- readxl::read_xlsx(path = path2xl) %>% select(-(Language:phone))
# Add columns for locality type and (shorter) name
tax_rates_raw %>%
mutate(locality_type_ID = case_when(str_ends(ExternalDataReference, "County") ~ "C",
str_ends(ExternalDataReference, "City") ~ "I",
TRUE ~ "T")) %>%
mutate(locality_type = case_when(str_ends(ExternalDataReference, "County") ~ "County",
str_ends(ExternalDataReference, "City") ~ "City",
TRUE ~ "Town")) %>%
mutate(locality_group = case_when(str_ends(ExternalDataReference, "County") ~ "Counties",
str_ends(ExternalDataReference, "City") ~ "Cities",
TRUE ~ "Towns")) %>%
mutate(locality_name = word(ExternalDataReference, 1, -2)) %>%
arrange(locality_type_ID, locality_name) %>%
relocate(ExternalDataReference, locality_name, locality_type, locality_type_ID, locality_group) -> tax_rates
reference_vars <- c("ExternalDataReference", "locality_name", "locality_type", "locality_type_ID", "locality_group")
# function to make a table
make_long_table <- function(ref_vars, data_vars){
tax_rates %>%
select(all_of(ref_vars), all_of(data_vars)) %>%
filter(!across(all_of(data_vars), is.na)) -> new_table
return(new_table)
}
# set global options for table styling
opts <- options(knitr.kable.NA = "--")
<file_sep>/_book/01-legislative_changes.md
# Summary of Legislative Changes in Local Taxation in 2019
## General Provisions
### Local License Tax on Mobile Food Units
Senate Bill 1425 (Chapter 791) provides that when the owner of a new business that operates a mobile food unit has paid a license tax as required by the locality in which the mobile food unit is registered, the owner is not required to pay a license tax to any other locality for conducting business from such mobile food unit in such a locality.[^01-1]
This exemption from paying the license tax in other localities expires two years after the payment of the initial license tax in the locality in which the mobile food unit is registered. During the two year exemption period, the owner is entitled to exempt up to three mobile food units from license taxation in other localities. However, the owner of the mobile food unit is required to register with the Commissioner of the Revenue or Director of Finance in any locality in which he conducts business from such mobile food unit, regardless of whether the owner is exempt from paying license tax in the locality.
This Act defines “mobile food unit” as a restaurant that is mounted on wheels and readily moveable from place to place at all times during operation. It also defines “new business” as a business that locates for the first time to do business in a locality. A business will not be deemed a new business based on a merger, acquisition, similar business combination, name change, or a change to its business form.
Without the exemption provided in this Act, localities are authorized to impose business, professional and occupational license (BPOL) taxes upon local businesses. Generally, the BPOL tax is levied on the privilege of engaging in business at a definite place of business within a Virginia locality. Businesses that are mobile, however, can be subject to license taxes or fees in multiple localities in certain situations.
Effective: July 1, 2019
Added: § 58.1-3715.1
### Local Gas Road Improvement Tax; Extension of Sunset Provision
House Bill 2555 (Chapter 24) and Senate Bill 1165 (Chapter 191) extend the sunset date for the local gas road improve-ment tax from January 1, 2020 to January 1, 2022. The authority to impose the local gas road improvement tax was previously scheduled to sunset on January 1, 2020.
The localities that comprise the Virginia Coalfield Economic Development Authority may impose a local gas road improvement tax that is capped at a rate of one percent of the gross receipts from the sale of gases severed within the locality. Under current law, the revenues generated from this tax are allocated as follows: 75% are paid into a special fund in each locality called the Coal and Gas Road Improvement Fund, where at least 50% are spent on road improvements and 25% may be spent on new water and sewer systems or the construction, repair, or enhancement of natural gas systems and lines within the locality; and the remaining 25% of the revenue is paid to the Virginia Coalfield Economic Development Fund. The Virginia Coalfield Economic Development Authority is comprised of the City of Norton, and the Counties of Buchanan, Dickenson, Lee, Russell, Scott, Tazewell, and Wise.
Effective: July 1, 2019
Amended: § 58.1-3713
### Private Collectors Authorized for Use by Localities to Collect Delinquent Debts
Senate Bill 1301 (Chapter 271) allows a local treasurer to employ private collection agents to assist with the collection of delinquent amounts due other than delinquent local taxes that have been delinquent for a period of three months or more and for which the appropriate statute of limitations has not run.
Effective: July 1, 2019
Amended: § 58.1-3919.1
## Real Property Tax
### Real Property Tax Exemptions for Elderly and Disabled: Computation of Income Limitation
House Bill 1937 (Chapter 16) provides that, if a locality has established a real estate tax exemption for the elderly and handicapped and enacted an income limitation related to the exemption, it may exclude, for purposes of calculating the income limitation, any disability income received by a family member or nonrelative who lives in the dwelling and who is permanently and totally disabled.
Under current law, if a locality’s tax relief ordinance establishes an annual income limitation, the computation of annual income is calculated by adding together the income received during the preceding calendar year of the owners of the dwelling who use it as their principal residence; and the owners’ relatives who live in the dwelling, except for those relatives living in the dwelling and providing bona fide caregiving services to the owner whether such relatives are compensated or not; and at the option of each locality, nonrelatives of the owner who live in the dwelling except for bona fide tenants or bona fide caregivers of the owner, whether compensated or not.
Effective: July 1, 2019
Amended: § 58.1-3212
### Real Property Tax Exemption for Elderly and Disabled: Improvements to a Dwelling
House Bill 2150 (Chapter 736) and Senate Bill 1196 (Chapter 737) clarify the definition of “dwelling,” for purposes of the real property tax exemption for owners who are 65 years of age or older or permanently and totally disabled, to include certain improvements to the exempt land and the land on which the improvements are situated. These Acts define the term “dwelling” to include an improvement to the land that is not used for a business purpose but is used to house certain motor vehicles or household goods.
Under current law, in order to be granted real property tax relief, qualifying property must be owned by and occupied as the sole dwelling of a person who is at least 65 years of age, or, if the local ordinance provides, any person with a permanent disability. Dwellings jointly held by spouses, with no other joint owners, qualify if either spouse is 65 or over or permanently and totally disabled.
Effective: July 1, 2019
Amended: § 58.1-3210
### Real Property Tax: Partial Exemption from Real Property Taxes for Flood Mitigation Efforts
Senate Bill 1588 (Chapter 754) enables a locality to provide by ordinance a partial exemption from real property taxes for flooding abatement, mitigation, or resiliency efforts for improved real estate that is subject to recurrent flooding, as authorized by an amendment to Article X, Section 6 of the Constitution of Virginia that was adopted by the voters on November 6, 2018.
This act provides that exemptions may only be granted for qualifying flood improvements that do not increase the size of any impervious area and are made to qualifying structures or to land. “Qualifying structures” are defined as structures that were completed prior to July 1, 2018 or were completed more than 10 years prior to the completion of the improvements. For improvements made to land, the improvements must be made primarily for the benefit of one or more qualifying structures. No exemption will be authorized for any improvements made prior to July 1, 2018.
A locality is granted the authority to (i) establish flood protection standards that qualifying flood improvements must meet in order to be eligible for the exemption; (ii) determine the amount of the exemption; (iii) set income or property value limitations on eligibility; (iv) provide that the exemption shall only last for a certain number of years; (v) determine, based upon flood risk, areas of the locality where the exemption may be claimed; and (vi) establish preferred actions for qualifying for the exemption, including living shorelines.
Effective: July 1, 2019
Amended: § 58.1-3228.1
### Real Property Tax: Exemption for Certain Surviving Spouses
House Bill 1655 (Chapter 15) and Senate Bill 1270 (Chapter 801) allow surviving spouses of disabled veterans to continue to qualify for a real property tax exemption regardless of whether the surviving spouse moves to a different residence, as authorized by an amendment to subdivision (a) of Section 6-A of Article X of the Constitution of Virginia that was adopted by the voters on November 6, 2018. If a surviving spouse was eligible for the exemption but lost such eligibility due to a change in residence, then the surviving spouse is eligible for the exemption again, beginning January 1, 2019.
These Acts also clarify that the real property tax exemptions for spouses of service members killed in action and spouses of certain emergency service providers killed in the line of duty continue to apply regardless of the spouse’s moving to a new principal residence.
Effective: Taxable years beginning on or after January 1, 2019
Amended: §§ 58.1-3219.5, 3219.9, and 3219.14
### Land Preservation; Special Assessment, Optional Limit on Annual Increase in Assessed Value
House Bill 2365 (Chapter 22) authorizes localities that employ use value assessments for certain classes of real property to provide by ordinance that the annual increase in the assessed value of eligible property may not exceed a specified dollar amount per acre.
Effective: July 1, 2019
Amended: § 58.1-3231
### Virginia Regional Industrial Act: Revenue Sharing; Composite Index
House Bill 1838 (Chapter 534) requires that the Department of Taxation’s calculation of the true values of real estate and public service company property component of the Commonwealth’s educational composite index of local ability-to-pay take into account arrangements by localities entered into pursuant to the Virginia Regional Industrial Facilities Act, whereby a portion of tax revenue is initially paid to one locality and redistributed to another locality. This Act requires such calculation to properly apportion the percentage of tax revenue ultimately received by each locality.
Effective: July 1, 2021
Amended: § 58.1-6407
### Real Estate with Delinquent Taxes or Liens: Appointment of Special Commissioner; Increase Required Value
House Bill 2060 (Chapter 541) increases the assessed value of a parcel of land that could be subject to appointment of a special commissioner to convey the real estate to a locality as a result of unpaid real property taxes or liens from \$50,000or less to \$75,000 or less in most localities. In the Cities of Norfolk, Richmond, Hopewell, Newport News, Petersburg, Fredericksburg, and Hampton, this Act increases the threshold from \$100,000 or less to \$150,000 or less.
Effective: July 1, 2019
Amended: § 58.1-3970.1
### Real Estate with Delinquent Taxes or Liens; Appointment of Special Commissioner in the City of Martinsville
House Bill 2405 (Chapter 159) adds the city of Martinsville to the list of cities (Norfolk, Richmond, Hopewell, Newport News, Petersburg, Fredericksburg, and Hampton) that are authorized to have a special commissioner convey tax-delinquent real estate to the locality in lieu of a public sale at auction when the tax-delinquent property has an assessed value of \$100,000 or less. House Bill 2060 raises the threshold in all of these cities from \$100,000 or less to \$150,000 or less.
Effective: July 1, 2019
Amended: § 58.1-3970.1
## Personal Property Tax
### Constitutional Amendment: Personal Property Tax Exemption for Motor Vehicle of a Disabled Veteran
House Joint Resolution 676 (Chapter 822) is a first resolution proposing a constitutional amendment that permits the General Assembly to authorize the governing body of any county, city, or town to exempt from taxation one motor vehicle of a veteran who has a 100 percent service-connected, permanent, and total disability. The amendment provides that only automobiles and pickup trucks qualify for the exemption.
Additionally, the exemption will only be applicable on the date the motor vehicle is acquired or the effective date of the amendment, whichever is later, but will not be applicable for any period of time prior to the effective date of the amendment.
Effective: July 1, 2019
### Personal Property Tax Exemption for Agricultural Vehicles
House Bill 2733 (Chapter 259) expands the definition of agricultural use motor vehicles for personal property taxation purposes. It changes the criteria from motor vehicles used “exclusively” for agricultural purposes to motor vehicles used “primarily” for agricultural purposes, and for which the owner is not required to obtain a registration certificate, license plate, and decal or pay a registration fee.
It also expands the definition of trucks or tractor trucks that are used by farmers in their farming operations for the transportation of farm animals or other farm products or for the transport of farm-related machinery. The criteria is changed from vehicles used “exclusively” by farmers in their farming operations to vehicles used “primarily” by farmers in their farming operations.
Further, this Act expands the classification of farm machinery and equipment that a local governing body may exempt, to include equipment and machinery used by a nursery for the production of horticultural products, and any farm tractor, regardless of whether such farm tractor is used exclusively for agricultural purposes.
Local governing bodies have the option to exempt these classifications, in whole or in part, from taxation or to provide for a different rate of taxation thereon.
Effective: July 1, 2019
Amended: § 58.1-3505
### Intangible Personal Property Tax: Classification of Certain Business Property
House Bill 2440 (Chapter 255) classifies as intangible personal property, tangible personal property: i) that is used in a trade or business; ii) with an original cost of less than $25; and iii) that is not classified as machinery and tools, merchants’ capital, or short-term rental property. It also exempts such property from taxation.
Intangible personal property is a separate class of prop-erty segregated for taxation by the Commonwealth. The Commonwealth does not currently tax intangible personal property. Localities are prohibited from taxing intangible personal property.
Certain personal property, while tangible in fact, has previously been designated as intangible and thus exempted from state and local taxation. For example, tangible personal property used in manufacturing, mining, water well drill-ing, radio or television broadcasting, dairy, dry cleaning, or laundry businesses has been designated as exempt intangible personal property.
Effective: July 1, 2019
Amended: §§ 58.1-1101 and 58.1-1103
[^01-1]: Excerpted from the local tax legislation section of the Department of Taxation’s 2019 Legislative Summary. Minor changes were made in format and punctuation. See https://tax.virginia.gov/legislative-summary-reports
<file_sep>/_book/14-Business-Professional-Occupational.md
# Business, Professional, and Occupational License Tax
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, business license taxes, of which the business, professional, and occupational license tax (commonly referred to as the BPOL tax) makes up the largest part, accounted for 6.0 percent of tax revenue for cities, 3.4 percent for counties, and 11.9 percent for large towns. These are averages; the relative importance of the tax varies for individual cities, counties and towns. In fact, only slightly over half of the counties employ the tax. Others use the merchants’ capital tax instead. Four counties (Amherst, Hanover, Louisa, and Southampton) reported using both taxes, maintaining the merchants’ capital tax for retailers and the BPOL tax for other types of businesses. For information on individual localities, see Appendix C.
Localities are authorized to impose a local license tax on businesses, professions, and occupations operating within their jurisdictions unless they already levy a tax on merchants’ capital.The BPOL tax is sanctioned by §§ 58.1-3700 through 58.1-3735 of the *Code of Virginia*. The *Code* establishes the dates between March 1 and May 1 as the time by which businesses must apply for a license. County BPOL taxes do not apply within the limits of an incorporated town unless the town grants the county authority to do so (§ 58.1-3711). Localities may charge a fee to each business for the issuance of a license. Each business classification such as retail or contracting, has a specific tax rate which cannot exceed maximums set by the state guidelines. Businesses pay the tax rate for the amount of gross receipts within each classification.
Although revised guidelines in January 1997 made administration of the BPOL tax more uniform in terms of due dates, penalties, interest, appeals, and definitions of situs, localities retained some flexibility. In 2000, the 1997 guidelines were updated. They are viewable on the internet site, http://townhall.virginia.gov/L/GetFile.cfm?File=C:\TownHall\docroot\GuidanceDocs\161\GDoc_TAX_2537_v1.pdf.
In 2011 the General Assembly passed a law allowing localities the option of imposing the tax on either gross receipts or the Virginia taxable income of the business. This option did not apply to certain public service corporations required to pay the 1/2 of 1 percent utility tax, which is considered a form of BPOL (see Section 11). The legislature also permitted relief from the BPOL tax, allowing localities to exempt new business from the tax for up to two years and second. allowing localities to exempt unprofitable businesses from the tax.
Localities may still determine how many separate licenses they issue to a business and whether to charge a fee for each business location or only one fee for a business with multiple locations. Some localities charge no fee or charge different fees depending on a firm’s gross receipts. Some localities charge a minimum tax instead of a fee. For example, if a locality had a minimum license tax of \$30 then businesses with gross receipts below the threshold would pay $30 instead of a smaller amount based on gross receipts. In addition, there are some localities that impose *both* a license fee and a tax rate on businesses with gross receipts above the threshold.
The BPOL tax is collected by all cities and 51 of the 95 counties. The tax is also widely used by incorporated towns; 105 towns reported using the BPOL tax. The specific localities that impose the tax are listed in **Table 14.1** along with information regarding due dates, license fees, and thresholds.
For most localities, the filing and payment dates are March 1st, though there is quite a bit of variance from that date. Of the cities, 18 reported requiring a license fee, either by business or by location. Twenty-eight counties and 57 towns also reported requiring license fees of some sort. Finally, 20 cities, 33 counties, and 17 towns reported having a tax threshold requirement based on gross receipts.
**Table 14.2** lists the fees, minimum tax, and an explanation of the fee structures provided by the localities in the survey. Thirty-two cities reported having either a fee or a minimum tax, as did 41 counties and 98 towns.
**Table 14.3** shows specific tax rates by business classification for each locality. All 38 cities, 45 counties, and 98 towns reported having a tax on at least one business classification. An overview of the general practices of Virginia localities is shown in the text table below. Combining data from tables 14.2 and 14.3, it lists the median license fee and median gross receipts tax rate for cities, counties, and towns. If a locality reported different fees due to differences in total gross receipts, the median figures were calculated using the highest fee amount given because that provides an estimate of the greatest impact on the payer.
Only the localities that reported a fee or a tax rate in a particular category were included in the calculation of the medians in the following text table.
```r
# table name: BPOL License Fee and Tax Rate Per $100 in 2019
```
The median tax rates for the cities matched the maximum rates permitted by the state—\$0.16 per \$100 of gross receipts for contracting; \$0.20 for retail; \$0.36 for repair, personal, and business services; and \$0.58 for financial, real estate, and professional services. The median figures for counties and towns were less than those of the cities, indicating that counties and towns did not generally apply the maximum rates permitted by Virginia law.
The median rate of \$0.11 on wholesalers for cities was well above the state maximum of \$0.05 per \$100 of purchases. Cities are presumed to operate under grandfather clauses that allow them to impose higher rates. The median rate on wholesalers for counties and towns was \$0.05 per \$100.
The median license fee, which is generally imposed only upon businesses below the gross receipts tax threshold, was \$50 for the cities, \$40 for counties, and \$30 for towns.
One business classification not presented in Table 14.3 is that of rental property due to the small number of localities reporting it. Localities are permitted to charge a license fee, or levy a BPOL tax, on businesses renting real property. In 2019, only 24 localities reported taxing such businesses. They were the cities of Alexandria, Bristol, Fairfax, Falls Church, Fredericksburg, and Portsmouth; the counties of Albemarle, Arlington, Augusta, Fairfax, King George, Loudoun, Nelson, Pulaski, and Wythe; and the towns of Bridgewater, Chatham, Goshen, Haymarket, Narrows, Purcellville, Round Hill, Saint Paul, and Vienna.
**Table 14.4** lists taxes and fees on peddlers and itinerant merchants. All of the cities, 50 counties, and 93 towns reported some form of tax on peddlers. Annual fees charged by cities for retail peddling ranged anywhere from \$30 to \$500. Taxes on retail itinerant merchants and wholesale peddlers also ranged from \$30 to \$500, with some cities charging according to gross receipts and other cities according to gross purchases. Annual charges by counties ranged from a \$1 minimum fee to \$500, while towns charged anywhere from \$10 to \$500 per year.
```r
# Table 14.1 BPOL Due Dates and Other Provisions, 2019
# Table 14.2 Specific BPOL Fees and Minimum Taxes, 2019
# Table 14.3 Specific BPOL Tax Rates per $100 by Business Category, 2019
# Table 14.4 Taxes and Fees on Peddlers and Itinerant Merchants, 2019
```
<table>
<caption>(\#tab:table14-2)Specific BPOL Fees and Minimum Taxes Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Fee </th>
<th style="text-align:center;"> Minimum Tax </th>
<th style="text-align:center;"> Description of Tax and Fee Classifications </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> The county requires a 10 dollar minimum license fee even if there were no gross receipts in order to keep current license active. </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 160 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> Variable fees </td>
<td style="text-align:center;"> 160.00 </td>
<td style="text-align:center;"> 100000 X.16 PER 100 = 160.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> On G/R (Less 300000 exclusion)
charge tax based on rate or 10.00 whichever is larger </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Each business in the unincorporated portion of the county is charged a fee of 30.00. This includes businesses of short term duration e.g. winefests flea markets etc. </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> With minimum of 30- can gross up to 60000- anything over is .05 per 100 tax </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> Out of county contractors are subject to a fee of 50.00 with gross receipts equal to 25001. In county contractors are subject to above fee schedule. </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 10K-50K=30 50K-100K=50 </td>
<td style="text-align:center;"> 110 </td>
<td style="text-align:center;"> If gross receipts are over 100000 the business is subject to a tax rate of 0.11/gross receipts.
100001/100*.11=110. </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> varies 30 or 50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> fee varies 30 or 50 depending on receipts of business and only if gross receipts are under 100000 None on businesses subject to license </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.10/100 of GR of 100k or more </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> Under 5000: 20;
5000 - 25000: 30;
over 25000: 0.12 per 100 GR </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> Gross receipts over 18750 are figured at 16 cents per 100 gross receipts. Under the threshold the minimum tax of 30 applies. </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 100.00 </td>
<td style="text-align:center;"> Contractors are required to purchase a license when their gross receipts exceed 100000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> TAX IS 30.00 IF GROSS RECEIPTS ARE UNDER 100000. IF OVER 100000.-.00025 OF GROSS RECEIPTS. </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> If under 4000 no license required </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> 30/50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 75 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> FLAT FEE </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 2500.00-21000.00 gross receipts. If gross receipts over 21000 then charged 0.12 cents per 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> If Gross receipts are equal to or less than 50000 the license tax is 30. </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Home-Based Contractors based in Loudoun County
GR: 0 - 4000 are exempt from taxes and fees
GR: 4000.01 - 200000 are subject to a 30 fee
GR: 200000.01+ are tax based on rate per 100 of gross receipts
Commercial Contractors based in Loudoun County
GR: 0 - </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> $25.00 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> Minimum license fee is 30.00. Maximum license tax is 7500. Businesses with gross receipts more than 50000 use the rate schedule: </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> Every person engaging in the business of contracting shall pay an annual license tax fee of 30.00 or .0012 per 100 of gross receipts whichever is greater. </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 30. </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 1001-25K=25; 25K-50K=50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince William County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 325 </td>
<td style="text-align:center;"> Tax kicks in if gross receipts are 250000 or greater </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> The 30.00 tax will include all gross receipts up to 100000. </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> Fee is 50.00 less than 125000 gross income </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> Gross receipts exceeding 50000 are taxed at the license tax rate. </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 10/30/50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> Up to 4000 No Fee
4001 - 10000 10.00
10001 - 25000 30.00
25001 - 50000 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100000 </td>
<td style="text-align:center;"> See Tiers under VIII Question A5 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> tax threshold 25000 to 99999
flat tax: 50 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> .75 processing fee per category
30.75 is the minimum charge for a contractor even if the business has no gross receipts. </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 35/50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Businesses grossing over 50000 are subject to the .16 rate. Businesses grossing less than 50000 pay the 35 fee. </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> Minimum fee of 50 for gross receipts less than 200000 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 minimumu regardless of the gross receipts up to 15000 </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> There is no tax for any amount under 25000. If GR are over 25000 then a pct. of the whole amount is charged. </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 50001 </td>
<td style="text-align:center;"> If a VA based contractor gross receipts are:
10000 and under free but needs a license
10001-50000 a 30 dollar flat fee
over 50001 then dollar amount times 0.16 per 100.00 of gross receipts for out-of-state contractors gross receipts over 10000 then a </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> < 100000 gross receipts -> 25 license
100000 - 350000 -> 50 + applicable rate on receipts btwn 100000 and 350000
> 350000 -> applicable rate applied to total gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 160.00 </td>
<td style="text-align:center;"> 100000.01*.0016= 160.00
(100000 or less subject to 50.00 fee) </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> tiered: 0/25/50 </td>
<td style="text-align:center;"> 80 </td>
<td style="text-align:center;"> Business grossing more than 50000 is subject to tax rate </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> Gross Receipts are multiplied by .16 to determine amount of tax owed. </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 240 </td>
<td style="text-align:center;"> only businesses grossing over 150K are subject to a tax
150001 x .16% = 240 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> Every business license tax under this ordinance shall be assessed and required to pay annually a license tax of 30 or the tax set forth below whichever is greater. </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 30/50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 fee on gross receipts (0-50000); 50 fee on gross receipts (50001-100000) or 0.15 per 100 on gross receipts 100001 or higher. </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 160 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> 30.75 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 190 </td>
<td style="text-align:center;"> The minimum tax is based on the tax rate multiplied by the gross receipts thrieshold of 100000 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 40.00 </td>
<td style="text-align:center;"> 0-25K; 40.00
25001-100000; 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 40.00 </td>
<td style="text-align:center;"> gross receipts 25000 = 40.00 tax </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> If gross receipts < 50K license fee applicable
If gross receipts >=50K license rate applicable </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 25.00 or 0.10 on each 100 of gross receipts whichever is greater </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> .01 in excess of 200000 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> 30 35 40 50 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> Gross Receipts:
0-30000 30
30001-40000 35
40001-45000 40
45001-50000 50
over 50000 is 0.10 per 100 of gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> no minimum </td>
<td style="text-align:center;"> contractors in the town of Blackstone do not have to purchase a business license unless they do over 25000.00 in one year </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> We charge a flat 30.00 only for a business license. </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> The license fee is credited towards any tax owed. If the fee is more than the tax owed no tax is due. </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> The license tax imposed upon a person engaged in contracting is 30.00 or 0.16 per 100.00 of gross receipts whichever is higher. Gross receipts for this purpose shall be deemed as gross receipts from work performed within the corporate limits of the town. </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> the current rate for this tax is 0.13 per 100 of gross receipts of the previous year with a minimum tax of 50.00 and a maximum of tax 500.00 per year. </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> 28.00 with GR of 1000-35000 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> the greater of the tax amount or 30 </td>
<td style="text-align:center;"> up to 100000 - .16
>100000 - 0.12 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 28.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 28.50 for 1st year business licenses </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> .20 per 1000.00 + 10.00 min after 1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 24 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> 25000 </td>
<td style="text-align:center;"> We impose a 20.00 license fee which is credited against license tax--if fee is greater than tax no tax is due. </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 50.00 or the tax rate whichever is greater </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> gross receipts less than: 15000- 18.00
15001-50000- 0.13/100 of Gross Receipts
50001-150000- 0.11/100 of Gross Receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> Greater of 30 tax or pct. of gross receipts by business category </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> $30.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 10. </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> The first year business license fee is 30.00. To renew your license each year the tax is based on previous year’s gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> pay annually a license fee of 30.00 or the applicable tax determined using the rates shown above whichever is higher. </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> N/A (section XIV (E)) </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 35.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> First tier is 0-50000 with license tax rate of 30.00
Second tier is 50001 to 100000 w/ license tax rate of 50(or standard rate calculation whichever is less). </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> Required to pay annually a fee in the amount of 30 or the tax rate set forth. Whichever is greater. </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 1K-5K=5
5K-10K=10
10K-20K=15
20K-50K=20
50K-100K=50
100K-150K=100
150K-300K=150
over 300K=250 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> See A-5 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> In Town = 20.00 minimum charge
In Virginia = no fee if gross receipts less than 25000. Between 25000 and 50000 - 20.00 minimumu charge. Over 50000 in gross receipts = tax rate of .1% of gross receipts.
Out of state - no fee when gross receipts is less </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 40.00 </td>
<td style="text-align:center;"> gross receipts 25000 or less -- min. tax 0.00
gross receipts over 25000 -- tax rate 0.16/100 gross </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> We do not charge the tax - only the licensing fee. </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> rate is .05 per 100 for up to 1000000 in annual receipts then .03 per 100 thereafter. </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> .17 </td>
<td style="text-align:center;"> 32.25 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> .10 per hundred for gross receipts exceeding 10000; if gross receipts are below 10000 charge 10. </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Based on gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> Minimum Fee - 30 </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> up to 18750 pays minimum </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> Tax rate: 0.1/100 up to 1500000
Add additional .666/100 over 1500000 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> na </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> If a business or contractor makes less than 7500.00 in the corporation they pay a flat fee of 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> Gross receipts under 12000 pay a minimum fee of 15 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 28.00 first 1000 </td>
<td style="text-align:center;"> 28.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 25000 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> 50-100 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0-100000 in gross receipts is 50 fee
100k-200k - 75
200k and above: 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 0.5 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.07 per 100 for contractors who have receipts in excess of 25000 unless their office is located in Warsaw </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> .10 per 100 of gross receipts up to 1500000 and .08 per 100 of gross receipts over 1500000 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table14-3)Specific BPOL Tax Rates per $100 by Business Category Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Contracting </th>
<th style="text-align:center;"> Retail </th>
<th style="text-align:center;"> Repair, Personal, & Business Svcs.[^†] </th>
<th style="text-align:center;"> Repair, Personal, & Business Svcs.[^†] </th>
<th style="text-align:center;"> Repair, Personal, & Business Svcs.[^†] </th>
<th style="text-align:left;"> Financial, Real Estate & Prof. Svcs.[^†] </th>
<th style="text-align:center;"> Financial, Real Estate & Prof. Svcs.[^†] </th>
<th style="text-align:center;"> Financial, Real Estate & Prof. Svcs.[^†] </th>
<th style="text-align:center;"> Wholesale Gross Receipts or Gross Purchases </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> .18 </td>
<td style="text-align:center;"> .18 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> .25 </td>
<td style="text-align:center;"> .25 </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:left;"> 0.50 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:left;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:left;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 0.16 per 100 </td>
<td style="text-align:center;"> .20 per 100 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:left;"> 0.5 </td>
<td style="text-align:center;"> 0.5 </td>
<td style="text-align:center;"> 0.5 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:left;"> 0.49 </td>
<td style="text-align:center;"> 0.49 </td>
<td style="text-align:center;"> 0.49 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:left;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:left;"> 0.45 </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 0.11 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:left;"> 0.31 </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 0.085 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.187 </td>
<td style="text-align:center;"> 0.187 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.2975 </td>
<td style="text-align:center;"> 0.2975 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> .010 </td>
<td style="text-align:center;"> 0.1 1st 250000 .2 > 250000 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 0.0010 </td>
<td style="text-align:center;"> 0.0005 </td>
<td style="text-align:center;"> 0.0005 </td>
<td style="text-align:center;"> 0.001 </td>
<td style="text-align:center;"> 0.001 </td>
<td style="text-align:left;"> 0.0015 </td>
<td style="text-align:center;"> 0.0015 </td>
<td style="text-align:center;"> 0.0015 </td>
<td style="text-align:center;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:left;"> 0.44 </td>
<td style="text-align:center;"> 0.44 </td>
<td style="text-align:center;"> 0.44 </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:left;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 0.11 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.24 </td>
<td style="text-align:center;"> 0.24 </td>
<td style="text-align:center;"> 0.24 </td>
<td style="text-align:left;"> 0.39 </td>
<td style="text-align:center;"> 0.39 </td>
<td style="text-align:center;"> 0.39 </td>
<td style="text-align:center;"> 0.03 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> >100K= 0.00025 </td>
<td style="text-align:center;"> >100K= 0.0015 </td>
<td style="text-align:center;"> 0.0015 </td>
<td style="text-align:center;"> 0.0015 </td>
<td style="text-align:center;"> 0.00015 </td>
<td style="text-align:left;"> 0.0025 </td>
<td style="text-align:center;"> 0.0025 </td>
<td style="text-align:center;"> 0.0025 </td>
<td style="text-align:center;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> .16 per 100 gross receipts </td>
<td style="text-align:center;"> .20 per 100 gross receipts </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:left;"> 0.38 </td>
<td style="text-align:center;"> 0.38 </td>
<td style="text-align:center;"> 0.38 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:left;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> $0.16 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 0.12/100 gross </td>
<td style="text-align:center;"> .17/100 gross </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:left;"> 0.44 </td>
<td style="text-align:center;"> 0.44 </td>
<td style="text-align:center;"> 0.44 </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:center;"> 0.05 </td>
<td style="text-align:center;"> 0.09 </td>
<td style="text-align:center;"> 0.09 </td>
<td style="text-align:center;"> 0.09 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince William County </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:left;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 0.10/100 </td>
<td style="text-align:center;"> 0.13/100 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:left;"> 0.38 </td>
<td style="text-align:center;"> 0.38 </td>
<td style="text-align:center;"> 0.38 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> .16 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:left;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:left;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:left;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .020 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.50 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.12 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:left;"> 0.57 </td>
<td style="text-align:center;"> 0.57 </td>
<td style="text-align:center;"> 0.57 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.12 </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:center;"> 0.27 </td>
<td style="text-align:left;"> 0.4 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.52 </td>
<td style="text-align:center;"> 0.52 </td>
<td style="text-align:center;"> 0.52 </td>
<td style="text-align:center;"> 0.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.46 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.17 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.28 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:left;"> 0.35 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.50 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 0.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> .16 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 0.125 </td>
<td style="text-align:center;"> 0.135 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:left;"> 0.365 </td>
<td style="text-align:center;"> 0.365 </td>
<td style="text-align:center;"> 0.365 </td>
<td style="text-align:center;"> 0.07 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.22 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 0.16 per 100 </td>
<td style="text-align:center;"> 0.2 per 100 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.26 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0. </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.09 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.12 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 0.16/100 </td>
<td style="text-align:center;"> 0.20/100 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 0.03 per 100 of gross </td>
<td style="text-align:center;"> 0.0425 per 100 of </td>
<td style="text-align:center;"> 0.06 </td>
<td style="text-align:center;"> 0.06 </td>
<td style="text-align:center;"> 0.06 </td>
<td style="text-align:left;"> 0.0425 </td>
<td style="text-align:center;"> 0.0425 </td>
<td style="text-align:center;"> 0.0425 </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> .16 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:center;"> 0.31 </td>
<td style="text-align:left;"> 0.5 </td>
<td style="text-align:center;"> 0.5 </td>
<td style="text-align:center;"> 0.5 </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:left;"> 0.10 </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:left;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:left;"> 0.37 </td>
<td style="text-align:center;"> 0.37 </td>
<td style="text-align:center;"> 0.37 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 0.11 </td>
<td style="text-align:center;"> 0.11 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:left;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> .15/100 </td>
<td style="text-align:center;"> .16/100 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:left;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.125 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.45 </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> 0.12 per 100 </td>
<td style="text-align:center;"> 0.12 per 100 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:left;"> 0.12 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> .012 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.43 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.43 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.03 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:left;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:left;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> 0.155 </td>
<td style="text-align:center;"> 0.155 </td>
<td style="text-align:center;"> 0.155 </td>
<td style="text-align:center;"> 0.155 </td>
<td style="text-align:center;"> 0.155 </td>
<td style="text-align:left;"> 0.155 </td>
<td style="text-align:center;"> 0.155 </td>
<td style="text-align:center;"> 0.155 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:left;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.175 </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:left;"> 0.39 </td>
<td style="text-align:center;"> 0.39 </td>
<td style="text-align:center;"> 0.39 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> .08 </td>
<td style="text-align:center;"> .15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:left;"> 0.27 </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> .15 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.34 </td>
<td style="text-align:center;"> 0.34 </td>
<td style="text-align:center;"> 0.34 </td>
<td style="text-align:left;"> 0.55 </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> .15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> 0.020 </td>
<td style="text-align:center;"> .02 </td>
<td style="text-align:center;"> 0.02 </td>
<td style="text-align:center;"> 0.02 </td>
<td style="text-align:center;"> 0.02 </td>
<td style="text-align:left;"> 0.55 </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:left;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> .092 </td>
<td style="text-align:center;"> .125 </td>
<td style="text-align:center;"> .18 </td>
<td style="text-align:center;"> .18 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .29 </td>
<td style="text-align:center;"> .29 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> .09-.13 </td>
<td style="text-align:center;"> 0.09-0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> .08 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> .29 </td>
<td style="text-align:center;"> .29 </td>
<td style="text-align:center;"> .29 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> .0010 </td>
<td style="text-align:center;"> .0015 </td>
<td style="text-align:center;"> .0015 </td>
<td style="text-align:center;"> .0015 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .0020 </td>
<td style="text-align:center;"> .0020 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.45 </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> 0.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> 0.06 </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:left;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:left;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> 0.08 per 100 gross receipts </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> .11 </td>
<td style="text-align:center;"> .14 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:left;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:left;"> 0.38 </td>
<td style="text-align:center;"> 0.38 </td>
<td style="text-align:center;"> 0.38 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:left;"> 0.4 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:left;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> .09 </td>
<td style="text-align:center;"> .17 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:left;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> .15 </td>
<td style="text-align:center;"> .15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> .16 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:center;"> 0.21 </td>
<td style="text-align:left;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:left;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> per contract </td>
<td style="text-align:center;"> .15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:left;"> 0.04 </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:center;"> 0.04 </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 0.108 </td>
<td style="text-align:center;"> 0.108 </td>
<td style="text-align:center;"> 0.108 </td>
<td style="text-align:center;"> 0.108 </td>
<td style="text-align:center;"> 0.108 </td>
<td style="text-align:left;"> 0.230 </td>
<td style="text-align:center;"> 0.230 </td>
<td style="text-align:center;"> 0.230 </td>
<td style="text-align:center;"> 0.02 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> 0.15 per 100 gross receipts </td>
<td style="text-align:center;"> 0.12 per 100 gross receipts </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.03 </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.175 </td>
<td style="text-align:center;"> 0.175 </td>
<td style="text-align:center;"> 0.175 </td>
<td style="text-align:center;"> 0.175 </td>
<td style="text-align:left;"> 0.175 </td>
<td style="text-align:center;"> 0.175 </td>
<td style="text-align:center;"> 0.175 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:left;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:left;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> 0.23 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:left;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.14 </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> .05 </td>
<td style="text-align:center;"> .05 </td>
<td style="text-align:center;"> .05 </td>
<td style="text-align:center;"> .05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .05 </td>
<td style="text-align:center;"> .05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> .17 </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.215 </td>
<td style="text-align:center;"> 0.215 </td>
<td style="text-align:center;"> 0.215 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:left;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> 0.11 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:left;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.41 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.33 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> .08 </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> .18 </td>
<td style="text-align:center;"> .18 </td>
<td style="text-align:center;"> .18 </td>
<td style="text-align:left;"> .29 </td>
<td style="text-align:center;"> .29 </td>
<td style="text-align:center;"> .29 </td>
<td style="text-align:center;"> 0.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 0.16/100 </td>
<td style="text-align:center;"> 0.16/100 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:left;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 0.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> .17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:left;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> 0.125 </td>
<td style="text-align:center;"> 0.125 </td>
<td style="text-align:center;"> 0.125 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.125 </td>
<td style="text-align:left;"> 0.09 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.09 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> .16 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:left;"> 0.50 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.24 </td>
<td style="text-align:center;"> 0.24 </td>
<td style="text-align:left;"> 0.24 </td>
<td style="text-align:center;"> 0.24 </td>
<td style="text-align:center;"> 0.24 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:left;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:left;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 0.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> .08 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.58 </td>
<td style="text-align:center;"> 0.58 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> .16 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .36 </td>
<td style="text-align:center;"> .36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .35 </td>
<td style="text-align:center;"> .35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.12/100 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> 0.08 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:left;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0.29 </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.14 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:left;"> 0.4 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 0.11 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:left;"> 0.19 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 010 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.03 </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:left;"> 0.54 </td>
<td style="text-align:center;"> 0.54 </td>
<td style="text-align:center;"> 0.54 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> .15 </td>
<td style="text-align:center;"> .23 </td>
<td style="text-align:center;"> .25 </td>
<td style="text-align:center;"> .25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .30 </td>
<td style="text-align:center;"> .30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:left;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.06 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:left;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 0.16 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> 0.12 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:center;"> 0.22 </td>
<td style="text-align:left;"> 0.52 </td>
<td style="text-align:center;"> 0.52 </td>
<td style="text-align:center;"> 0.52 </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 0.16/100 or .0016 </td>
<td style="text-align:center;"> 0.20/100 or 0.0020 </td>
<td style="text-align:center;"> 0.36/100 </td>
<td style="text-align:center;"> 0.36/100 </td>
<td style="text-align:center;"> 0.36/100 </td>
<td style="text-align:left;"> 0.58/100 </td>
<td style="text-align:center;"> 0.35/100 </td>
<td style="text-align:center;"> 0.58/100 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 0.085 </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> 0.187 </td>
<td style="text-align:center;"> 0.187 </td>
<td style="text-align:center;"> 0.187 </td>
<td style="text-align:left;"> 0.2975 </td>
<td style="text-align:center;"> 0.2975 </td>
<td style="text-align:center;"> 0.2975 </td>
<td style="text-align:center;"> 0.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> 0.07 </td>
<td style="text-align:center;"> see below </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:left;"> 0.07 </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.19 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> .16 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .36 </td>
<td style="text-align:center;"> .36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> .50 </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> .12 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:center;"> .20 </td>
<td style="text-align:left;"> .35 </td>
<td style="text-align:center;"> .35 </td>
<td style="text-align:center;"> .35 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> 0.20 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:left;"> 0.32 </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:left;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.18 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> 0.13 </td>
<td style="text-align:center;"> 0.17 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:left;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 0.05 </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table14-4)Taxes and Fees on Peddlers and Itinerant Merchants Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Annual Amount (Unless Otherwise Stated), Retail Peddlers </th>
<th style="text-align:center;"> Annual Amount (Unless Otherwise Stated), Retail Itinerant Merchants </th>
<th style="text-align:center;"> Annual Amount (Unless Otherwise Stated), Wholesale Peddlers & Itinerant Merchants </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 10.00 annual </td>
<td style="text-align:center;"> 50.00 annual </td>
<td style="text-align:center;"> 50.00 annual </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 500/annual </td>
<td style="text-align:center;"> 500/annual </td>
<td style="text-align:center;"> 50/annual </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 10 per day not to exceed 500 per year </td>
<td style="text-align:center;"> 10 per day not to exceed 500 per year </td>
<td style="text-align:center;"> 10 per day not to exceed 500 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 50 dollars per year </td>
<td style="text-align:center;"> 200 dollars per month or 500 dollars per year </td>
<td style="text-align:center;"> Not applicable. </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 500; period 1 year </td>
<td style="text-align:center;"> 500; period 1 year </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 0.08 per 100 gross receipts annually </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 100 annually </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 300.00 </td>
<td style="text-align:center;"> 300.00 </td>
<td style="text-align:center;"> 300.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> cty code 88.87
fee established by separate resolution of the bos </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 10/year </td>
<td style="text-align:center;"> 50/year </td>
<td style="text-align:center;"> 50/year </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 30/year for goods totaling no more than 20000 </td>
<td style="text-align:center;"> 30/year on goods totaling no more than 20000 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 25.00-500.00 calendar year </td>
<td style="text-align:center;"> 50.00-500.00 January - June
July - December </td>
<td style="text-align:center;"> .10/100.00 gross purchases calendar year </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 30 prior to conducting business </td>
<td style="text-align:center;"> 30 prior to conducting business </td>
<td style="text-align:center;"> 30 prior to conducting business </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 25.00/year </td>
<td style="text-align:center;"> 25.00/year </td>
<td style="text-align:center;"> 25.00/year </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 500 /year </td>
<td style="text-align:center;"> Flat fee 25 </td>
<td style="text-align:center;"> min 50000 @ .05/100 or 25 whichever is greater </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> $500.00 per year (FY July 1 - June 30) </td>
<td style="text-align:center;"> $500.00 per year (FY July 1 - June 30) </td>
<td style="text-align:center;"> $500.00 per year (FY July 1 - June 30) </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 35 Annually </td>
<td style="text-align:center;"> 35
Annually </td>
<td style="text-align:center;"> Same as Wholesale: 0.04/100 of gross purchases </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> Same as for non-itinerant wholesalers </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 50-500 Jan - Dec </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50-500 Jan - Dec </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> Fee 30 or 50 if under 100000 gross
calendar year period -- 1 year </td>
<td style="text-align:center;"> 500
calendar year period -- usually 30 days specified dates </td>
<td style="text-align:center;"> 0.05 per 100 gross receipts over 100K; Itinerant: 500
calendar year period -- 1 year </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> 200/year </td>
<td style="text-align:center;"> 200/year </td>
<td style="text-align:center;"> 200/year </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 200 paid prior to June 30
125 paid after July 1
50 for a seven day consecutive day permit </td>
<td style="text-align:center;"> 200 paid prior to June 30
125 paid after July 1
50 for a seven day consecutive day permit </td>
<td style="text-align:center;"> 200 paid prior to June 30
125 paid after July 1
50 for a seven day consecutive day permit </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 0.16 per 100 gross receipts for calander year </td>
<td style="text-align:center;"> 0.16 per 100 gross receipts for calander year </td>
<td style="text-align:center;"> 0.05 per 100 gross receipts for calander year </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 500.00 a year 1-1 to 12-31 </td>
<td style="text-align:center;"> 500/year; 1-1 to 12-31 </td>
<td style="text-align:center;"> 500/year; 1-1 to 12-31 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 20 Fee-Annual Renewal through the Sheriff's Office </td>
<td style="text-align:center;"> 20 Fee-Annual Renewal through the Sheriff's Office </td>
<td style="text-align:center;"> 20 Fee-Annual Renewal through the Sheriff's Office </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> Annual
50 fee (perishable)
200 fee (non-perishable) </td>
<td style="text-align:center;"> Annual
.20/100 gross receipts (200 minimum) </td>
<td style="text-align:center;"> Annual
Wholesale: Varies.
- Ice & wood peddler: 30 flat tax
- Seafood (catch) peddler: 15 flat tax
Itinerant: .20/100 gross receipts (200 min.) </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 50. ANNUAL </td>
<td style="text-align:center;"> 500. ANNUAL </td>
<td style="text-align:center;"> 50.-500. ANNUAL </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 500 Annual
50 - Food Peddler Annual </td>
<td style="text-align:center;"> 500 Annual </td>
<td style="text-align:center;"> 500 Annual </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> 500 license fee annually </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 500 annually </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 500 per year; Jan 1-Dec 31 </td>
<td style="text-align:center;"> 500 per year; Jan 1-Dec 31 </td>
<td style="text-align:center;"> 500 per year; Jan 1-Dec 31 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 500 annual tax
250 (perishable goods) annual </td>
<td style="text-align:center;"> 500 annual tax </td>
<td style="text-align:center;"> 500 annual tax </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 500 annual fee </td>
<td style="text-align:center;"> 500 annual fee </td>
<td style="text-align:center;"> 500 annual fee </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 200 annual </td>
<td style="text-align:center;"> 200 annual </td>
<td style="text-align:center;"> 200 annual </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 150.00 Jan1-Dec31 </td>
<td style="text-align:center;"> 150.00 Jan1-Dec31 </td>
<td style="text-align:center;"> 150.00 Jan1-Dec31 </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 250 fee </td>
<td style="text-align:center;"> 250 fee </td>
<td style="text-align:center;"> 250 fee </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 300 annual license fee </td>
<td style="text-align:center;"> 300 annual license fee </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 50/calendar yr </td>
<td style="text-align:center;"> 50/calendar yr </td>
<td style="text-align:center;"> 50/calendar yr </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 300/year </td>
<td style="text-align:center;"> 500/year </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 500; calendar year period </td>
<td style="text-align:center;"> 500; calendar year period </td>
<td style="text-align:center;"> 500; calendar year period </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> None </td>
<td style="text-align:center;"> None </td>
<td style="text-align:center;"> None </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> perishable 50.00 per year
non-perishable 250/month; 500.00 max/year </td>
<td style="text-align:center;"> perishable 50.00 per year
non-perishable general merchandise 500.00 </td>
<td style="text-align:center;"> No Tax- business to business </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 300.00 Jan1-Dec31 </td>
<td style="text-align:center;"> 300.00 Jan1-Dec31 </td>
<td style="text-align:center;"> 300.00 Jan1-Dec31 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 30 - Annual charge </td>
<td style="text-align:center;"> 30 - Annual charge </td>
<td style="text-align:center;"> 30 - Annual charge </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> .10 per 100 gross receipts </td>
<td style="text-align:center;"> .10 per 100 gross receipts </td>
<td style="text-align:center;"> .10 per 100 gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 25.00 annual fee </td>
<td style="text-align:center;"> 25.00 annual fee </td>
<td style="text-align:center;"> 150 annual fee </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> Perishable/Fireworks 250 Annual
Vendor License Fee-New 2016-30.00 per event (up to 250}
Retail Peddlers 500 Annual
Vendor License Fee-New 2016-30.00 per event {up to 500} </td>
<td style="text-align:center;"> 500 Retail Annual </td>
<td style="text-align:center;"> 500 annual </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 100 for every 180 days </td>
<td style="text-align:center;"> 100 for every 180 days </td>
<td style="text-align:center;"> 100 for every 180 days </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> .20/100 gross receipts w/1.00 minimum annually
January 1 - December 31 </td>
<td style="text-align:center;"> .20/100 gross receipts w/1.00 minimum annually
January 1 - December 31 </td>
<td style="text-align:center;"> .05/100 Gross purchases w/1.00 minimum annually
January 1 - December 31 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 250 non-consumables
500 consumables </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 50.00 flat fee per vehicle </td>
<td style="text-align:center;"> 50.00 per day </td>
<td style="text-align:center;"> 50.00 per day </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 500.00/flat; calendar year </td>
<td style="text-align:center;"> 500.00/flat; calendar year </td>
<td style="text-align:center;"> 500.00/flat; calendar year </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 125 is the annual charge. Tax/fee is for one day or for the whole calendar year. However if this is a new vendor 125 is prorated for the number of quarters or partial quarters left in the calendar year. </td>
<td style="text-align:center;"> 125 is the annual charge. Tax/fee is for one day or for the whole calendar year. However if this is a new vendor 125 is prorated for the number of quarters or partial quarters left in the calendar year. </td>
<td style="text-align:center;"> 100 is the annual charge. This tax does not apply in some cases. </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 50; annual </td>
<td style="text-align:center;"> 50 receipts < 200K; 500 receipts >200K; annual </td>
<td style="text-align:center;"> wholesale: 50 itinerant: 50 on receipts < 200K 500 on receipts >200K; annual </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 50.00 / year </td>
<td style="text-align:center;"> 500.00 / year 30 days per year only </td>
<td style="text-align:center;"> peddler: 50/year
itinerant merchant 500.00 / year </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 100-500 year </td>
<td style="text-align:center;"> 100-500 year </td>
<td style="text-align:center;"> 100-500 year </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 50; calendar year </td>
<td style="text-align:center;"> 500; calendar year </td>
<td style="text-align:center;"> 500; calendar year </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 0.05/100 gross receipts calendar year </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 30 Per Event </td>
<td style="text-align:center;"> 30 Per Event </td>
<td style="text-align:center;"> 30 Per Event </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 0.19/100 30 min. (year)
or event participation over 10000 in a single day </td>
<td style="text-align:center;"> 0.19/100 30 min. (year)
or event participation over 10000 in a single day </td>
<td style="text-align:center;"> 0.08/100 30 min. (year)
or event participation over 10000 in a single day </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 10-200/year </td>
<td style="text-align:center;"> 200.00 per person/year </td>
<td style="text-align:center;"> 50 on first 10K of Purchases .10 per 100 thereafter/year </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 200/yr. </td>
<td style="text-align:center;"> 200/yr or under organized event license paid by event promoter (10 per merchant) 50 minimum 500 maximum </td>
<td style="text-align:center;"> 200/yr or under organized event license paid by event promoter (10 per merchant) 50 minimum 500 maximum </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 200.00 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 50 to 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 500 - The 500 license is per year </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> .15 per 100 of purchases </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 500 annually </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> general merchandise peddler 500 flat license fee
confection peddler 50 flat license fee
perishable peddler 50 flat license fee
producers/producer peddler no fee
seafood peddler 10 flat license fee
mobile conteen peddler 250 flat license fee </td>
<td style="text-align:center;"> itnerant merchant 500 flat license fee
flea markets and craft shows flat 200 promoters license fee
sponsor promoted special event flat 200 license fee for event or 50 flat license fee per vendor </td>
<td style="text-align:center;"> 100 flat fee per vehicle </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 500 300 50 or .20 per 100 of total gross receipts (whichever is greater)if peddler sells ice cream or frozen items in city operating exclusively from a marked motor vehicle. </td>
<td style="text-align:center;"> 500 300 50 or .20 per 100 of total gross receipts (whichever is greater) if peddler sells ice cream or frozen items in city operating exclusively from a marked motor vehicle. </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> .20 per 100 of gross receipts; annual </td>
<td style="text-align:center;"> 500.00; annual </td>
<td style="text-align:center;"> .28 per 100.00 of gross purchases; annual </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> 500 annual </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 100.00; January 1- December 31 </td>
<td style="text-align:center;"> 100.00; January 1- December 31 </td>
<td style="text-align:center;"> 100.00; January 1- December 31 </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 50.00 per calendar year </td>
<td style="text-align:center;"> 50.00 per calendar year </td>
<td style="text-align:center;"> 50.00 per calendar year
5.00 for itinerant merchants at Farmer's Market </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 325/ Calendar year </td>
<td style="text-align:center;"> 325/ Calendar year </td>
<td style="text-align:center;"> 50 on the first 10000 of gross purchases and 0.20 per 100 of gross purchases in excess of 10000 per calendar year. </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> food-peddlers: 50 all others: 500/Annual </td>
<td style="text-align:center;"> 500/Annual </td>
<td style="text-align:center;"> Wholesale peddlers: 50.00 plus .15 on purchases / Annual </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 30 (minimum) </td>
<td style="text-align:center;"> 30 (minimum) </td>
<td style="text-align:center;"> 30 (minimum) </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 500/yr </td>
<td style="text-align:center;"> 500/yr </td>
<td style="text-align:center;"> 500/yr </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 500.00/year </td>
<td style="text-align:center;"> 500.00/year </td>
<td style="text-align:center;"> 500.00/year </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 50/ perishable; 500 non perishable </td>
<td style="text-align:center;"> 500/per year </td>
<td style="text-align:center;"> .15 per 100 gross purchases; 500 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 50.75 </td>
<td style="text-align:center;"> 50.75 </td>
<td style="text-align:center;"> 50.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 300 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 50 annually thru 12/31 </td>
<td style="text-align:center;"> 50.00 (perishables) annually thru 12/31
500.00 (non-perishables) annually thru 12/31 </td>
<td style="text-align:center;"> 50.00 fee if gross purchases <100K or 44 plus .26/100 on total purchases if purchases are more than 100K thru 12/31/08 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 200.00 per calendar year per person </td>
<td style="text-align:center;"> 500.00 per calendar year
50.00 per calendar year (perishables) </td>
<td style="text-align:center;"> 50.00 per calendar year </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 200 per each 72 hour event not to exceed 500 per year </td>
<td style="text-align:center;"> 200 per each 72 hour event not to exceed 500/per year </td>
<td style="text-align:center;"> 200 per each 72 hour event; not to exceed 500/per year </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 50/yr - sale of food plants flowers
500/yr - sale of other than food plants flowers </td>
<td style="text-align:center;"> 500/yr - generally
30/yr - itinerant merchant at community event
500/year - sponsor of community event </td>
<td style="text-align:center;"> same as retail peddlers </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 500.00 annual general merchandise
300.00 for mobile canteen
50.00 for mobile confection peddler </td>
<td style="text-align:center;"> 500.00 annual </td>
<td style="text-align:center;"> Wholesale peddlers 100.00 per vehicle
Itinerant 500.00 annually </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 250.00 plus .20 per 100 annual
100.00 annual- food truck </td>
<td style="text-align:center;"> 500.00 annual </td>
<td style="text-align:center;"> 30.00 plus .15 per 100 annual </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 30 or .20/100 whichever is greater not to exceed 500 </td>
<td style="text-align:center;"> 30 or .20/100 whichever is greater not to exceed 500 </td>
<td style="text-align:center;"> 50 on 1st 10000 of purchases; 0.20/100 thereafter </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 125 </td>
<td style="text-align:center;"> 125/yr (non perishable) 25/yr (perishable) </td>
<td style="text-align:center;"> .0175 per 100 of purchases - wholesale peddlers
25.00 per year edible or pershible goods and 125 per year for all types of goods wares and merchandise for itinerant merchants </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> 50/yr for fresh produce
200/month 500 max/year </td>
<td style="text-align:center;"> 200/month 500 max/year </td>
<td style="text-align:center;"> 200/month 500 max/year </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> 500/year </td>
<td style="text-align:center;"> 500/year </td>
<td style="text-align:center;"> 500/year </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> 250 / six months </td>
<td style="text-align:center;"> 250 / six months </td>
<td style="text-align:center;"> 250 / six months </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100 per year </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> 30.00 Per Year </td>
<td style="text-align:center;"> no business license required if person selling
farm domestic or nursery products provided such
products are grown or produced by sucn person. </td>
<td style="text-align:center;"> 30.00 Per Year </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> 30 per calendar year </td>
<td style="text-align:center;"> 500 per calendar year
100 per calendar year for mobile food vendor </td>
<td style="text-align:center;"> 500 per calendar year </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 500.00 w/ surety bond for 5000 per year </td>
<td style="text-align:center;"> 50.00 w/surety bond for 5000 </td>
<td style="text-align:center;"> Wholesale Peddlers: .50/100 gross receipts
Itinerant Merchants: 50.00 w/ surety bond for 5000 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> 50.00 fee </td>
<td style="text-align:center;"> 50.00 fee </td>
<td style="text-align:center;"> 50.00 fee </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> 100.00/year </td>
<td style="text-align:center;"> 100.00/year </td>
<td style="text-align:center;"> 100.00/year </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> 200.00/year. Unless invited to a one time Town event in which case the fee is 25/event. </td>
<td style="text-align:center;"> 200.00/year </td>
<td style="text-align:center;"> 200.00/year </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 500.00 annual </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> 50 calendar year </td>
<td style="text-align:center;"> 500 calendar year </td>
<td style="text-align:center;"> 50 calendar year </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> all peddlers - 500 fee </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> all peddlers - 500 fee </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> Food Carts & Open Trailers - the license tax for a peddler is 50.00 & the license tax for an existing business is 0.20 / 100.00 gross receipts. Enclosed Food Trailers - the license tax is 500.00. Food Vehicles - the license tax is 50.00. </td>
<td style="text-align:center;"> Itinerant merchant is any person engaging in does or transacts any temporary business within the town and who for purposes of carrying on such business occupies any private property location for a period of less than one year - the license tax is 50.00. </td>
<td style="text-align:center;"> Wholesale merchants shall pay an annual license tax equal to 0.05 per 100.00 of purchases. </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> 500.00 1st yr cont. renewal @ .14 per 100 </td>
<td style="text-align:center;"> 500.00 1st yr cont. renewal @ .14 per 100 </td>
<td style="text-align:center;"> 500.00 1st yr cont. renewal @ .14 per 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> 500 per day </td>
<td style="text-align:center;"> 500 per day </td>
<td style="text-align:center;"> 500 per day </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> 300.00/year for each person engaged in peddling </td>
<td style="text-align:center;"> 500.00/year </td>
<td style="text-align:center;"> 300.00/year for each person engaged in peddling.
500/year for itinerant peddlar. </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> 30.00 with gross receipts of 1000-20000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 500 each year </td>
<td style="text-align:center;"> 500 each year </td>
<td style="text-align:center;"> 500 each year </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> 500 per 365 days for selling new furniture televisions radios space heaters or other applicances audio video or other electronic
equipment computer equipment hardwar rughs clothing or footwear watches jewelry tools or hardware automotive parts or equipme </td>
<td style="text-align:center;"> 500 per 365 days- same as above </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> 200 per 30 days </td>
<td style="text-align:center;"> 200 per 30 days </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 500.00 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> Currently 400/annual
Beginning January 1 2020; this fee is reduced to 200/annual </td>
<td style="text-align:center;"> Currently 400/annual
Beginning January 1 2020; this fee is reduced to 200/annual </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> 250/year </td>
<td style="text-align:center;"> 250/year </td>
<td style="text-align:center;"> 250/year </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> 20 minimum & 0.15 per 100 of gross receipts. </td>
<td style="text-align:center;"> 20 minimum & 0.15 per 100 of gross receipts. </td>
<td style="text-align:center;"> 20 minimum & 0.15 per 100 of gross receipts. </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> 500
January - December </td>
<td style="text-align:center;"> 500
January - December </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 250 per year </td>
<td style="text-align:center;"> 250 per year </td>
<td style="text-align:center;"> 250 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> annual license tax of 50.00 </td>
<td style="text-align:center;"> annual license tax of 30.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> 100.00 per year </td>
<td style="text-align:center;"> 100.00 per year </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> 30 </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> 100 flat fee plus 10 filing fee </td>
<td style="text-align:center;"> 100 flat fee plus 10 filing fee </td>
<td style="text-align:center;"> 100 flat fee plus 10 filing fee </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> 500 yearly </td>
<td style="text-align:center;"> 500 yearly </td>
<td style="text-align:center;"> 500 yearly </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> perishable-500.00/yr non-perish-500/yrChristmas trees fireworks-100/season </td>
<td style="text-align:center;"> perisable-Grown by vendor exempt/yr non-perish-250/yrChristmas trees fireworks-100/season </td>
<td style="text-align:center;"> perisable-Grown by vendor exempt/yr non-perish peddler 250/yrChristmas trees fireworks-100/season
itinerant merchant-250 </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 30 per year + 10 background investigation by Police Dept </td>
<td style="text-align:center;"> 50 per year </td>
<td style="text-align:center;"> 50 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 25.00 bi-monthly </td>
<td style="text-align:center;"> 250.00 per year </td>
<td style="text-align:center;"> 250.00 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> 500 per sale </td>
<td style="text-align:center;"> 15 per sale </td>
<td style="text-align:center;"> 500 per sale </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 500.00 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> .05/100 </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> 500 annual </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> 12.50/per week; not to exceed 500/yr </td>
<td style="text-align:center;"> 12.50/per week; not to exceed 500/yr </td>
<td style="text-align:center;"> 0.05 per 100 of purchases per year </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 25.00 per day (not to exceed 500/per year) </td>
<td style="text-align:center;"> 25.00 per day (not to exceed 500/per year) </td>
<td style="text-align:center;"> 25 per day (not to exceed 500/per year) </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 25.00 Per Day; 300.00 - Six Months; 500.00-Year </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> 200; 25 ice wood coal; 50 milk butter fish etc. </td>
<td style="text-align:center;"> 200 </td>
<td style="text-align:center;"> 200 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> 300/year or 40 per day </td>
<td style="text-align:center;"> 300/yr or 40 per day </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 50 </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 20 Due upon coming into town </td>
<td style="text-align:center;"> 50-500 due upon coming into town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> 500 per year </td>
<td style="text-align:center;"> 500 per year </td>
<td style="text-align:center;"> 500 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> 50 + 30 fee </td>
<td style="text-align:center;"> 50 + 30 fee </td>
<td style="text-align:center;"> 50 + 30 fee </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 250 annual fee </td>
<td style="text-align:center;"> 250 annual fee </td>
<td style="text-align:center;"> 250 annual fee </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> 200.00/yr. </td>
<td style="text-align:center;"> 200.00/yr. </td>
<td style="text-align:center;"> 200.00/yr. </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 500.00 per year </td>
<td style="text-align:center;"> 500.00 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> 500/year </td>
<td style="text-align:center;"> 500/year </td>
<td style="text-align:center;"> 500/year </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> 0.14 per 100 </td>
<td style="text-align:center;"> 0.14 per 100 </td>
<td style="text-align:center;"> 0.14 per 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> 500 annual </td>
<td style="text-align:center;"> 500 annual </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> 125-250 </td>
<td style="text-align:center;"> 125-250 </td>
<td style="text-align:center;"> 125-250 </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> 200/year </td>
<td style="text-align:center;"> 200/year </td>
<td style="text-align:center;"> 25.00/yr.per 100000 or less plus 15 cents per 100.00 in excess of one thousand </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> Peddlers are not allowed </td>
<td style="text-align:center;"> 250.00 per year </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> .05/100 of gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> $100 per year </td>
<td style="text-align:center;"> $100 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 30 ANNUAL </td>
<td style="text-align:center;"> 500 ANNUAL </td>
<td style="text-align:center;"> 500 ANNUAL </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 500/yr </td>
<td style="text-align:center;"> 500/yr </td>
<td style="text-align:center;"> 500/yr </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 250 per yr </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> 250 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> perishable flat fee 50/yr; nonperish. 500 per year flat fee; solicitors flat fee 20/yr </td>
<td style="text-align:center;"> perishable flat fee 50/yr; nonperish. 500 per year flat fee </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 500 - annual </td>
<td style="text-align:center;"> 500 - annual </td>
<td style="text-align:center;"> 500 - annual </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> 250-500 Annual </td>
<td style="text-align:center;"> 250-500 Annual </td>
<td style="text-align:center;"> 250-500 Annual </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> 0.17/100 or 30.00 min; Jan-Dec. </td>
<td style="text-align:center;"> 0.17/100 or 30.00 min; Jan-Dec. </td>
<td style="text-align:center;"> .13/100 or 30.00 min; Jan-Dec. </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 500/yr </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.00 for a seven-day period;
150.00 for a 30-day period;
500.00 for a 365-day period. </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> 500 per year </td>
<td style="text-align:center;"> 500 per year </td>
<td style="text-align:center;"> 500 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> A license fee of 50.00 per day or 500.00 per year. An exception: peddlers of Christmas trees or Christmas greens shall be taxed at 50.00 per year. </td>
<td style="text-align:center;"> A license fee of 50.00 per day or 500.00 per year. </td>
<td style="text-align:center;"> 30.00 minimum tax or 0.05 per 100.00 of purchases whichever is greater. </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> 100/day or 500/yr </td>
<td style="text-align:center;"> 100/day or 500/yr </td>
<td style="text-align:center;"> 100/day or 500/yr </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> 25.00 per day or 500.00 per year </td>
<td style="text-align:center;"> 25.00 per day </td>
<td style="text-align:center;"> 25.00 per day </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 75 per year </td>
<td style="text-align:center;"> 75 per year </td>
<td style="text-align:center;"> 75 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 150.00 </td>
<td style="text-align:center;"> 150.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 0.05 per 100.00 gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> 100 per 24 hour period </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100 per 24 hour period </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 100.00 </td>
<td style="text-align:center;"> 100.00 </td>
<td style="text-align:center;"> 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> 25/vehicle </td>
<td style="text-align:center;"> 25/vehicle </td>
<td style="text-align:center;"> 25/vehicle </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 250/month </td>
<td style="text-align:center;"> 500/month </td>
<td style="text-align:center;"> 50/month </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> Annual License 250.00 with some exceptions costing 10 or 20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 250.00/year </td>
<td style="text-align:center;"> 500.00/year </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> 10/year </td>
<td style="text-align:center;"> 200/1st 30 days - 200/next 30 days; then 100 thereafter to 500/year </td>
<td style="text-align:center;"> Peddlers: 10/year
Merchants: 200/1st 30 days; 200/next 30 days; then 100 up to 500/year </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.00 minimum </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> 50 per day </td>
<td style="text-align:center;"> 50 per day </td>
<td style="text-align:center;"> 50 per day </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> 150 per year </td>
<td style="text-align:center;"> 150 per year </td>
<td style="text-align:center;"> 150 per year </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> non-perisable 250/yr plus 5.00/day (500 max) 50/yr-perishables </td>
<td style="text-align:center;"> non-perisable 250/yr plus 5.00/day (500 max) 50/yr-perishables </td>
<td style="text-align:center;"> non-perisable 250/yr plus 5.00/day (500 max) 50/yr-perishables </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> 250 - 500 </td>
<td style="text-align:center;"> 250 - 500 </td>
<td style="text-align:center;"> 250 - 500 </td>
</tr>
</tbody>
</table>
```r
# excel column, comments for table 14.1 : BPOL_fee_cmt
```
<file_sep>/23-Public-Rights-of-Way-Use-Fees.Rmd
# Public Rights-of-Way Use Fees
The Code of Virginia § 56-468.1 authorizes certain localities to charge rights-of-way use fees for the use of publicly owned roads and property by certified telecommunication firms. Cities and towns whose public streets are not maintained by the Virginia Department of Transportation (VDOT), as well as any county that has chosen to withdraw from the secondary system of state highways (currently only Arlington and Henrico counties), may impose a public rights-of-way use fee by local ordinance. This fee is in exchange for the use of the locality’s lands for electric poles or electric conduits by certified providers of telecommunications services.
The provider collects the use fee on a per access line basis by adding the fee to each end-user’s monthly bill for local exchange telephone service (§ 56-468-1.G). The fee must be stated separately on the phone bill.
The fee is calculated each year by VDOT based on information about the number of access lines and footage of new installation that have occurred in the reporting localities. Based on this information, VDOT uses a formula to calculate the monthly fee per access line for participating localities. Starting July 1, 2019, the fee was \$1.20 per access line. Information about the rights-of-way use fee can be obtained from VDOT at: http://www.virginiadot.org/business/row-usefee.asp. The Code(§ 56-468.1.I) also permits any locality which had a franchise agreement or ordinance prior to July 1, 1998 to “grandfather” in the prior agreement provided that the county, city, or town does not discriminate among telecommunications providers and does not adopt any additional rights-of-way practices that do not comply with current laws.
***Table 23.1*** lists the localities that report having a rights-of-way agreement or a prior agreement that has been grand-fathered. The information is based on the Cooper Center’s 2019 survey. The text table below summarizes the results:
```{r}
#Text table "Public Rights-of-Way Use Fees, 2019" goes here
#Table 23.1 "Localities Imposing Public Rights-of-Way Use Fees, 2019*" goes here
```
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table23-1, echo=FALSE}
table_23_1_vars <- c("ExternalDataReference", "row_fee")
table_23_1_labels <- c("Locality", "")
table_23_1 <- make_table(table_23_1_vars)
knitr::kable(table_23_1,
caption = "Localities Imposing Public Rights-of-Way Use Fees Table, 2019*",
col.names = table_23_1_labels,
align = "l",
format = "html")
```
* In years prior to 2009 this table was based on information provided by the Virginia Department of Transportation. The current table uses data based on responses to the Cooper Center’s survey. To compare survey responses with VDOT information, refer to http://virginiadot.org/business/row-usefee.asp
<file_sep>/08-Merchants-Capital-Tax.md
# Merchants' Capital Tax
The merchants’ capital tax accounted for 0.1 percent of tax revenue for counties and less than 0.1 percent for towns in fiscal year 2018, the most recent year available from the Auditor of Public Accounts. No cities employ the tax and only 41 of the 95 counties use it exclusively. Four counties use the tax in conjunction with the business, professional, and occupational license (BPOL) tax. The other counties rely solely on the BPOL tax.The relative importance of the merchants’ capital tax varies in the localities that collect it. For information on individual localities, see Appendix C.
The *Code of Virginia*, §§ 58.1-3509 and 58.1-3510, provides that localities may impose a local tax on merchants’ capital. Localities also have the option to exempt specific types of merchants from part or all of the tax. Merchants’ capital is defined as the inventory of stock on hand, daily rental motor vehicles as defined in § 58.1-2401, and all other taxable personal property (except tangible personal property not for sale as merchandise, which is taxed as tangible personal property), excluding money on hand and on deposit.
Property held for rental in a short-term rental business could be subject to the merchants’ capital tax. However, such property may also be classified under § 58.1-3510.4 making it subject to a separate freestanding tax. Consequently, daily rental property is discussed in this section and in Section 19, Miscellaneous Taxes.
In 2018, a separate classification was created for merchant’ capital of wholesalers inventory normally contained in a structure of 100,000 square feet, with at least 100,000 square feet used to contain the inventory.
According to § 58.1-3704 of the *Code*, no locality may impose a merchants’ capital tax if it also imposes a BPOL tax on retail merchants. A number of localities impose both of these taxes, but they do not use the BPOL tax for retail sales.
In 1978, the General Assembly enacted legislation (§ 58.1-3509 of the *Code*) that froze merchants’ capital tax rates at their January 1, 1978 level. Localities that had raised their rates and/or assessment ratios after February 1, 1977 were required to roll back their rates on July 1, 1978 to the February 1, 1977 rate and refund any amount in excess. (See *Virginia, Acts of Assembly*, 1978, c. 817, cl. 2, p. 1407.) While the enabling legislation prohibits localities from raising the merchants’ capital tax rates, it does not prohibit localities from lowering the rates if they choose to do so. Thus, a locality may still lower the tax liability of a merchant by reducing the statutory rate, the assessment ratio, or both.
As previously noted, the merchants’ capital tax is used exclusively by 41 counties. It is also imposed by nine towns responding to the survey. In contrast, 44 counties and all of the cities report using the BPOL tax for retail merchants in lieu of the merchants’ capital tax. Four counties (Amherst, Hanover, Louisa, and Southampton) use both the BPOL tax and the merchants’ capital tax, maintaining the latter tax on retailers. Seven counties (Bath, Culpeper, Fluvanna, Northampton, Patrick, Rappahannock, and Washington) reported having neither tax.
Those counties employing the merchants’ capital tax generally have one or more incorporated towns that are business centers and that impose the BPOL tax. This precludes the counties from using the BPOL tax within the town boundaries. In contrast, counties can impose the merchants’ capital tax within town boundaries even if a town has a BPOL tax. Most of the towns that tax business use the BPOL tax.
**Table 8.1** shows the statutory (nominal) tax rates per \$100 for the counties and towns, the value used for assessment, and the percentage of value. As shown in the text table, the unweighted mean of the statutory tax rate for counties was \$1.93 per \$100 of assessed value. The median was \$1.00 and the first and third quartiles were \$0.69 and \$2.85, respectively. The unweighted mean of the statutory tax rate for towns was \$0.49 per \$100 of assessed value. The median was \$0.46, and the first and third quartiles were \$0.20 and \$0.72, respectively.
```r
# Table name: Merchants' Capital Statutory Tax Rate, 2019
```
A majority of the localities that impose the merchants’ capital tax compute the assessment of capital on a percentage of the original cost. Of the 45 counties and 10 towns listed in the table, 43 counties and 5 towns reported using original cost as a basis for assessment. Information on statutory tax rates of towns that did not respond to the survey can be found in the Virginia Department of Taxation’s local tax rates survey for tax year 2016, available on the Virginia Department of Taxation’s website, http://www.tax.virginia.gov/. Please note that the rates in the department’s survey are for the 2014 tax year; it is the most recent information available for towns that did not respond to the Cooper Center survey.
**Table 8.2** lists the components of the merchants’ capital tax imposed by the localities. Of the 45 counties that impose the tax, all reported imposing the inventory tax component of the tax. Twenty-one impose the rental vehicle tax. Finally, 22 counties reported imposing the short-term rental tax.
All reporting towns used the inventory tax component. None reported imposing a short-term rental tax. Amherst, Timberville and Pembroke reported imposing the rental vehicle tax.
<file_sep>/index.md
---
title: "Virginia Local Tax Rates, 2019"
subtitle: "38th Annual Edition: Information for All Cities and Counties and Selected Incorporated Towns"
author: "<NAME>, Weldon Cooper Center for Public Service, University of Virginia"
date: "2021"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
description: "Information for All Cities and Counties and Selected Incorporated Towns"
---
# Introduction {-}
## Foreward {-}
This is the thirty-eighth edition of the Cooper Center’s annual publication about the tax rates of Virginia’s local governments. In addition to information about tax rates, the publication contains details about tax administration, valuation methods, and due dates. There is also information on water and sewer rates, waste disposal charges and numerous other aspects of local government finance. This comprehensive guide to local taxes is based on information gathered in the spring, summer, and early fall of 2019. The study includes all of Virginia’s 38 independent cities and 95 counties and 118 of the 190 incorporated towns. The included towns account for 92 percent of the Commonwealth’s population in towns.[^index-1] The study also contains information from several outside sources, including two Department of Taxation studies, 2019 Legislative Summary and The 2017 Assessment/Sales Ratio Study, as well as Department of Taxation information on the assessed value of real estate by type of property. We also used the Auditor of Public Accounts’ Comparative Report of Local Government Revenues and Expenditures, Year Ended June 30, 2018, the Commission on Local Governments’ Report on Proffered Cash Payments and Expenditures by Virginia’s Counties, Cities and Towns, 2017-2018, and the Department of Housing and Community Development’s Virginia Enterprise Zone Program 2018 Grant Year Annual Report.
## Organization of the Book {-}
The study is divided into 26 sections. Section 1 is a reprint of the “Local Tax Legislation” section of the Department of Taxation’s 2019 Legislative Summary. The original Department of Taxation report is available at [its website](https://tax.virginia.gov/legislative-summary-reports). Sections 2 through 26 cover specific taxes, fees, service charges, cash proffers, enterprise zones, and financial documents on the web. Most of the data came from a detailed web-based questionnaire sent to all cities, counties, and incorporated towns (see Appendix A for a printed version). Appendix B provides a listing of names, phone numbers, and email addresses, when available, of respondents and non-respondents to the questionnaire. Appendix C shows the percentage share of total local taxes represented by each specific tax for each locality based on data from the Auditor of Public Accounts for fiscal year 2018. Information is provided for each city and county and for 38 populous incorporated towns. Finally, Appendix D contains 2018 population estimates for cities, counties and towns from the Cooper Center’s Demographics Research Group. The population information is provided to give readers some perspective on the relative size of localities.
Please note that the web addresses provided in this publication were good at the time this text was printed. However, some links are unstable and may not work with certain browsers or they may be modified or withdrawn subsequent to publication.
## About the Survey {-}
In 2019, localities could choose between online or printed versions of the questionnaire. The Cooper Center has made its best efforts to accurately reflect in this report the responses of localities based on the survey or follow-up queries.
In the tables three dots (...) are used to show there was no response and “N/A” is used to indicate “not applicable.” Readers may use the telephone/email list in Appendix B to contact local officials in order to obtain clarification and additional detail.
## Some Components of Local Taxes {-}
This book deals mainly with local sources of revenue for local governments. Though localities might also receive federal and state resources, an important part of local funding comes from local sources. The Auditor of Public Accounts, Comparative Report of Local Government Revenues and Expenditures provides data on these local sources. The following analysis uses the data from their report for the year ended June 30, 2018.
A common misperception is that nearly all local tax revenue comes from the real property tax. True, the real property tax is the dominant source, accounting for 61.9 percent of city-county tax revenue in FY 2018, the latest year available (see text table below). But three other taxes—--the personal property tax, the local option sales and use tax, and the business license tax—--together accounted for 24.5 percent of total tax revenue. The remaining 14.6 percent of tax revenue came from more than a dozen other taxes.
Table: (\#tab:unnamed-chunk-2)Sources of Virginia Local Government Tax Revenue, FY 2018
|Tax | Amount ($)| % of Total|
|:-----------------------------------|---------------:|----------:|
|Total taxes | $17,967,385,766| 100.00|
|Real property | $10,946,877,675| 60.93|
|Personal property | $2,370,758,768| 13.19|
|Local option sales and use | $1,239,855,163| 6.90|
|Business license | $771,958,263| 4.30|
|Restaurant meals | $612,940,580| 3.41|
|Public service corporation property | $412,121,081| 2.29|
|Consumer utility | $327,627,947| 1.82|
|Hotel and motel room | $244,412,964| 1.36|
|Machinery and tools | $233,076,157| 1.30|
|Motor vehicle license | $197,705,384| 1.10|
|Recordation and will | $126,458,487| 0.70|
|Bank stock | $117,199,137| 0.65|
|Other local taxes | $92,124,397| 0.51|
|Tobacco | $65,150,996| 0.36|
|Coal, oil, and gas | $28,510,002| 0.16|
|Admission | $21,815,169| 0.12|
|Franchise license | $16,362,103| 0.09|
|Merchants' Capital | $14,301,188| 0.08|
|Penalties and interest | $128,130,305| 0.71|
There are six localities where the real property tax is not dominant. Bath and Surry counties have large power plants that pay public service corporation property taxes that overwhelm other sources. Buchanan County has rich mineral deposits subject to local severance taxes that exceed the real property tax. Covington City and Alleghany County receive large shares of revenue from machinery and tools taxes on MeadWestvaco’s large paperboard manufacturing facility. Finally, the small city of Norton, the [least populous independent city in Virginia](https://demographics.coopercenter.org/population-estimates-age-sex-race-hispanic-towns/) (3,908 in 2018) received almost as much money from the local option sales and use tax as from the real property tax. In the remaining 127 cities and counties where the real property tax is dominant, its relative importance varies from 30.3 percent of total tax revenue in Galax City to 78.8 percent in Lancaster County (see Appendix C).
Thirty-six cities (two cities–Hopewell and Petersburg–did not provide information for the 2018 Comparative Report) and 95 counties imposed four of the taxes shown in the previous table—the real property tax, the personal property tax, the local option sales and use tax, and the public service corporation property tax. Most, but not all, localities imposed recordation and will taxes, consumer utility taxes, motor vehicle license taxes, and taxes on manufacturers’ machinery and tools. Nonetheless, as shown in the next table, there are a number of taxes, a few of them significant sources of revenue, which are not levied by all localities. Also, some of the taxes are used so sparingly that their revenue yield is very low.
Table: (\#tab:unnamed-chunk-3)Number of Virginia Localities Imposing Taxes by Type, FY 2018
|Tax | Cities| Counties| Total|
|:-----------------------------------|------:|--------:|-----:|
|Real property | 36| 95| 131|
|Personal property | 36| 95| 131|
|Local option sales and use | 36| 95| 131|
|Public service corporation property | 36| 95| 131|
|Consumer utility | 36| 92| 128|
|Recordation and wills | 32| 93| 125|
|Motor vehicle license | 32| 86| 118|
|Machinery and tools property | 31| 85| 116|
|Bank stock | 36| 64| 100|
|Hotel and motel room | 32| 67| 99|
|Business license | 36| 52| 88|
|Restaurant meals | 36| 49| 85|
|Franchise license | 11| 37| 48|
|Merchants’ capital | 1| 43| 44|
|Tobacco | 29| 2| 31|
|Admission | 18| 3| 21|
|Coal, oil, and gas | 1| 6| 7|
|Other local taxes | 23| 49| 72|
There are three major reasons why local governments do not to impose some taxes: (1) The locality lacks a tax base for a particular tax (e.g., a locality must have a bank in order to apply a bank stock tax and a locality must have taxable mineral deposits to impose coal, oil, and gas taxes). (2) The locality is faced with state restrictions (e.g., county excise taxes on hotel and motel room rental have tax rate restrictions imposed by the state; county restaurant meals taxes must be approved in a voter referendum; tobacco taxes are permitted in only two counties; and county admissions taxes are subject to many restrictions). In regard to the busi-ness, professional, and occupational license tax (BPOL tax), counties must choose either the BPOL tax or the merchants’ capital tax. Counties are not permitted to impose a business license tax within the boundaries of an incorporated town situated within the county without permission of the town. This means that counties with large shares of business activity within towns are motivated to impose a merchants’ capital tax that can be applied countywide. (3) The locality chooses not to impose a permitted tax (e.g., Richmond City, a community with a large cigarette manufacturing plant, has not adopted a consumer tobacco tax even though all cities are granted the authority to levy such a tax).
## Partnership with LexisNexis {-}
The Weldon Cooper Center for Public Service is partnering with the publisher LexisNexis to produce the annual Tax Rates books. The Cooper Center still prepares and distributes the survey and writes up the results. LexisNexis publishes the book and fulfills orders from interested parties. This arrangement allows us to concentrate on providing the most accurate and up-to-date information about Virginia tax rates and leverages LexisNexis’ considerable expertise in production and distribution of the annual volume. We hope the arrangement will lead to continued improvements in our Virginia Local Tax Rates series.
## Study Personnel {-}
<NAME>, Research Specialist at the Center for Economic and Policy Studies, was responsible for work on the project. He refined the new database, administered the survey, translated the results into tables, checked relevant code sections, assisted with the development of the web-based questionnaire, and made appropriate changes in the text. <NAME>, of the Cooper Center’s Publications Section, designed the cover. Cooper Center employee <NAME>, who authored this study for a number of years prior to 1991, laid the foundation for the study when it was his responsibility.
The strong support for this publication by the Virginia Association of Counties and the Virginia Municipal League helps ensure our continued efforts to provide this resource as a basic reference on Virginia local taxes.
## About the Online Edition {-}
This online edition of the *Virginia Local Tax Rates* survey report was developed by <NAME>, Principal Scientist in the Weldon Cooper Center, with capable assistance from intern <NAME> of Grinnell College.
## Final Comments {-}
The Cooper Center is grateful to the many local officials throughout the Commonwealth who supplied the survey information presented in this study. Their willingness to provide information and their patience in answering follow-up questions is what makes this book successful. The high response rates could not have been achieved without their cooperation.
<!-- Corrections to the text or suggestions for possible changes or additions to future editions can be made using the email address and phone number listed below. -->
<NAME>
Research Specialist
Center for Economic and Policy Studies
Weldon Cooper Center for Public Service
University of Virginia
Charlottesville
February 2020
[^index-1]: Locality population figures are based on estimates developed by the [Demographics Research Group of the Weldon Cooper Center for Public Service](https://demographics.coopercenter.org). See Appendix D.
<file_sep>/11-Utility-License-Tax.Rmd
# Utility License Tax {#sec:utility-license-tax}
```{r prep data for section 11, message=FALSE, echo=FALSE}
#source("get_and_prep_data.R")
#section_vars <- c("utl_cie_tel", "utl_cie_water")
#tax_rates %>%
#select(all_of(reference_vars), all_of(section_vars)) %>%
#mutate(across(.cols = all_of(section_vars), ~ ifelse(.==0, NA, .))) %>% # Convert zero values to NA's
#mutate(has_tel_tax = (!is.na(utl_cie_tel) & utl_cie_tel != 0),
#has_water_tax = (!is.na(utl_cie_water) & utl_cie_water != 0)) %>%
#filter(has_tel_tax | has_water_tax) -> section_tbl
```
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the utility license tax accounted for 0.1 percent of the total tax revenue for cities, 0.1 percent for counties, and 0.6 percent for large towns. These percentages are based on the franchise license tax reported in [Appendix C](#secAppendixC). The franchise license tax includes not only the license fees of electric and water utilities, which are discussed in this section, but also cable television utilities, discussed in Section \@ref(sec:cable-tv). These are averages; the relative importance of this tax in individual cities, counties, and towns varies significantly. For information on individual localities, see [Appendix C](#secAppendixC).
Localities in Virginia may impose a local license tax on certain types of public service corporations. As authorized by § 58.1-3731 of the *Code*, localities may levy a license tax on telephone and water companies not to exceed one-half of 1 percent of the gross receipts of such company accruing from sales to the ultimate consumer in the locality. For telephone companies, long-distance calls are not taxable under this provision. County utility license taxes do not apply within the limits of an incorporated town if the town also imposes the tax.
Prior to 2006, any locality that had in effect before January 1, 1972 a tax rate exceeding the statutory ceiling could continue to tax at the previous level but could not raise the rate (see *Virginia, Acts of Assembly, 1972*, c. 858). This provision changed in 2006 under the Virginia Communication Sales and Use Tax when the General Assembly eliminated the business license tax in excess of 0.5 percent.
```{r Localities Reporting the Utility License Tax, include=FALSE}
#section_tbl %>%
#group_by(locality_group) %>%
#summarize(Telephone = sum(has_tel_tax),
#Water = sum(has_water_tax)) %>%
#ungroup() %>%
#pivot_longer(!locality_group, names_to = "Utility", values_to = "count") %>%
#pivot_wider(names_from = locality_group, values_from = count) %>%
#mutate(Total = rowSums(across(where(is.numeric)))) -> utility_license_summary_tbl
```
```{r}
#In the latest survey `r utility_license_summary_tbl$Total[1]` localities responded that they had a utility license tax on telephone service and `r utility_license_summary_tbl$Total[2]` had a tax on water service. The table below summarizes the numbers of positive respondents by type of service and locality.
```
```{r , echo=FALSE}
#utility_license_summary_tbl %>%
#knitr::kable(caption = "Localities Reporting the Utility License Tax, 2019")
```
Nearly all localities reported charging the maximum 0.5 percent (1/2 of 1 percent) permitted by the law. None reported charging a greater amount. A few localities reported charging less for the telephone utility tax, including the counties of Fairfax (0.24 percent), New Kent (0.42 percent) and Prince William (0.29 percent), and the towns of Haymarket (0.1 percent), Pembroke (0.3 percent), and Urbanna (0.23 percent).
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table11-1, echo=FALSE, eval=FALSE}
table_11_1_vars <- c("ExternalDataReference", "utl_cie_tel", "utl_cie_water")
table_11_1_labels <- c("Locality", "Telephone", "Water")
table_11_1 <- make_table(table_11_1_vars)
knitr::kable(table_11_1,
caption = "Utility License Tax Table, 2019",
col.names = table_11_1_labels,
align = "lcc",
format = "html")
```
```{r Table11-01, echo=FALSE}
#table_11_1 <- section_tbl %>% select(locality_name, locality_group, all_of(section_vars))
#table_11_1_labels <- c("Locality", "Telephone", "Water")
# kbl(table_11_1,
# caption = "Utility License Tax Table, 2019",
# col.names = table_11_1_labels,
# align = "lcc",
# format = "html") %>%
# pack_rows(index = count_localities_by_type(section_tbl))
#make_long_table(table_11_1,
#caption = "Utility License Tax Table, 2019",
#col.names = table_11_1_labels,
#align = "lcc")
```
<file_sep>/18-legal-documents.Rmd
# Legal Document Taxes
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, taxes on legal documents accounted for 0.5 percent of total tax revenue for cities and 0.8 percent for counties. Towns do not have this tax. These are averages; the relative importance of taxes in individual localities may vary significantly. For information on individual localities, see Appendix C.
Section 58.1-3800 of the Code of Virginia authorizes the governing body of any city or county to impose a recordation tax in an amount equal to one-third of the state recordation tax. The recordation tax generally applies to real and personal property in connection with deeds of trust, mortgages, and leases, and to contracts involving the sale of rolling stock or equipment (§§ 58.1-807 and 58.1-808).
Local governments are not permitted to impose a levy when the state recordation tax imposed is 50 cents or more (§ 58.1-3800). Consequently, local governments cannot levy a tax on such documents as certain corporate charter amendments (§ 58.1-801), deeds of release (§ 58.1-805), or deeds of partition (§ 58.1-806) as the state tax imposed is already 50 cents per $100.
Sections 58.1-809 and 58.1-810 also specifically exempt certain types of deed modifications from being taxed. Deeds of confirmation or correction, deeds to which the only parties are husband and wife, and modifications or supplements to the original deeds are not taxed. Finally, § 58.1-811 lists a number of exemptions to the recordation tax.
Currently, the state recordation tax on the first \$10 million of value is 25 cents per \$100, so cities and counties can impose a maximum tax of 8.3 cents per \$100 on the first \$10 million, one-third of the 25 cent state rate. Above $10 million there is a declining scale of charges applicable (§ 58.1-3803).
In addition to a tax on real and personal property, §§ 58.1-3805 and 58.1-1718 authorize cities and counties to impose a tax on the probate of every will or grant of administration equal to one-third of the state tax on such probate or grant of administration. Currently, the state tax on wills and grants of administration is 10 cents per \$100 or a fraction of \$100 for estates valued at greater than $15,000 (§ 58.1-1712). Therefore, the maximum local rate is 3.3 cents.
A related *state* tax is levied in localities associated with the Northern Virginia Transportation Authority. The tax is a grantor’s fee of \$0.15 per $100 on the value of real property property sold. This was created as part of the 2013 transportation bill.
**Table 18.1** provides information on the recordation tax and the wills and administration tax for the 35 cities and 89 counties that report imposing one or both of them. The following text table shows range of recordation taxes and taxes on wills and administration imposed by localities.
```{r}
#Text table "Recordation Tax and Tax on Wills and Administration, 2019" goes here
#Table 18.1 "Legal Document Taxes, 2019" goes here
```
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table18-1, echo=FALSE}
table_18_1_vars <- c("ExternalDataReference", "legal_tax_record", "legal_tax_record_other", "legal_tax_wills", "legal_tax_wills_other")
table_18_1_labels <- c("Locality","Recordation Tax Rate (Per $100)", "Recordation Tax Rate (Per $100)", "Tax on Wills and Administration (Per $100)", "Tax on Wills and Administration (Per $100)")
table_18_1 <- make_table(table_18_1_vars)
knitr::kable(table_18_1,
caption = "Legal Document Taxes Table, 2019",
col.names = table_18_1_labels,
align = "lcc",
format = "html")
```
<file_sep>/Appendix-D.Rmd
# Population Estimates for Virginia's Cities, Counties, and Towns, July 1, 2018
```{r}
# Population Estimates for Virginia's Cities, Counties, and Towns, July 1, 2018
```
<file_sep>/_book/06-Property_Tax_Exemptions.md
# Property Tax Exemptions for Certain Rehabilitated Real Estate and Miscellaneous Property Exemptions
## General provisions
The *Code of Virginia* provides that localities may adopt an ordinance allowing property tax exemption for certain rehabilitated commercial and industrial real estate (§ 58.1-3221) and residential real estate (§§ 58.1-3220 and 58.1-3220.1). To qualify for the exemption, the rehabilitated structure must be at least 15 years old for residential property or 20 years old for commercial or industrial property and must meet other restrictions that the locality may require. Exceptions exist for commercial and industrial property in state enterprise zones or local technology zones. In such instances, the minimum age may be 15 years. Real estate containing a hotel or motel no less than 35 years of age that has been substantially renovated may qualify for a partial exemption. The ordinance, in addition to any other restrictions, may restrict exemptions to real property located within described districts whose boundaries are determined by the governing body. Further, if rehabilitation is achieved through demolition and replacement of the structure, and the structure demolished is a registered Virginia landmark or is determined by the Department of Conservation and Recreation to contribute to the significance of a registered historic district, then the exemption does not apply (§ 58.1-3220).
A locality may impose a fee for applications for real property tax exemptions and credits for rehabilitated structures. Under §§ 58.1-3220, 58.1-3220.1, and 58.1-3221 a fee of not more than \$125 for residential properties and not more than $250 for commercial, industrial, and/or apartment properties of six units or more may be applied.
The partial exemption from property taxation may be an amount equal to a percentage of the increase in assessed value resulting from the renovation or to an amount up to 50 percent of the cost of the renovation. The commissioner of the revenue or another local assessing officer determines the assessed value of the structure. The exemption begins on January 1 of the year following completion of the rehabilitation, with maximum exemption periods of 10 years for residential real estate and 15 years for commercial and industrial real estate. Localities may opt to shorten the time span or to reduce the amount of exemption in annual steps over the entire period or a portion of the time limitation, or both.
**Table 6.1** contains information about the 32 cities, 21 counties, and 9 responding towns that have adopted a rehabilitation ordinance. The table also includes the minimum age requirement, the exemption schedule, and the percentage increase in assessed value required for exemption.
## MISCELLANEOUS PROPERTY EXEMPTIONS
Certain miscellaneous property tax exemptions are authorized in the *Code* from § 58.1-3660 and § 58.1-3666. Most exemptions pertain to real property, but several include both real and personal property items as part of their categories. Few localities reported authorizing these exemptions. For instance, in the latest survey no locality reportedly allowed exemptions for erosion control improvements (§ 58.1-3665).
However, a small number of localities did report exempting property such as (1) environmental restoration sites (§ 58.1-3664); (2) recycling equipment and facilities, and solar energy equipment, devices and facilities (§ 58.1- 3661); (3) generating and co-generating equipment used for energy conservation (§ 58.1-3662); (4) certified stormwater management developments (§ 58.1-3660.1); and (5) wetlands and riparian buffers (§ 58.1-3666).
Survey information for miscellaneous property exemptions is shown in **Table 6.2**. The contents of the table are summarized following this text discussion of the various exemptions.
## Environmental Restoration Site
Any county, city or town may grant exemption or partial exemption from local taxation on certified environmental restoration sites. Section 58.1-3664 lists the requirements to qualify for this exemption as: “...real estate which contains or did contain environmental contamination from the release of hazardous substances, hazardous wastes, solid waste or petroleum, the restoration of which would abate or prevent pollution to the atmosphere or waters of the Commonwealth and which (i) is subject to voluntary remediation pursuant to § 10.1-1232 and (ii) receives a certificate of continued eligibility from the Virginia Waste Management Board during each year which it qualifies for the tax treatment described in this section.”
## Recycling and Solar Energy Equipment
A similar exemption or partial exemption is authorized by § 58.1-3661 for certified recycling equipment, facilities or devices and certified solar energy equipment, facilities or devices. Certified recycling items are defined as machinery and equipment certified by the Department of Waste Management as integral to the recycling process and for use primarily for the purpose of abating and/or preventing pollution of the atmosphere or water.
Certified solar energy items are defined as any property, including real and personal property, equipment, facilities or devices which collect or use solar energy for water heating, space heating or cooling, or other applications which would otherwise require a conventional source of energy such as petroleum products, natural gas, or electricity.
## Generating Equipment
Generating equipment installed after 1974 for the purpose of converting from oil or natural gas to coal or to wood, wood bark, wood residue, or to any other alternate energy source for manufacturing and any co-generating equipment installed since that date to be used in manufacturing may be classified separately for property taxation. According to § 58.1-3662, localities may adopt an ordinance authorizing exemption or partial exemption for generating and co-generating equipment used for energy conservation. The ordinance becomes effective on January 1 of the year following the year of adoption.
## Stormwater Management Developments
According to § 58.1-3660.1, certified stormwater management developments may be classified separately for property tax purposes. Such property is classified as “any real estate improvements constructed from permeable material, such as, but not limited to, roads, parking lots, patios, and driveways, which are otherwise constructed of impermeable materials, and which the Department of Conservation and Recreation has certified to be designed, constructed, or reconstructed for the primary purpose of abating or preventing pollution of the atmosphere or waters ... by minimizing stormwater runoff.”
## Wetlands and Riparian Buffers
Wetlands and riparian buffers are considered a separate classification of property subject to perpetual easement according to requirements established in § 58.1-3666. A wetland is defined as an area “... inundated or saturated by surface or ground water at a frequency or duration sufficient to support, and that under normal conditions does support, a prevalence of vegetation typically adapted for life in saturated soil conditions, and that is subject to a perpetual easement permitting inundation by water.” A riparian buffer is an area “... of trees, shrubs or other vegetation, subject to a perpetual easement permitting inundation by water, that is (i) at least thirty-five feet in width, (ii) adjacent to a body of water, and (iii) managed to maintain the integrity of stream channels and shorelines and reduce the effects of upland sources of pollution by trapping filtering, and converting sediments, nutrients, and other chemicals.”
## Summary of Miscellaneous Exemptions
The exemptions applying to property used for environmental restoration, recycling, solar energy, energy conservation, stormwater development, and wetlands and riparian buffers are summarized in Table 6.2. One town and 1 city reported an exemption for an environmental site. Eight cities and 7 counties reported exempting recycling equipment and facilities. Eleven cities and 17 counties reported exempting solar energy equipment and facilities. One city and 2 counties reported exempting generating equipment used for energy conservation purposes. Two cities, 3 counties and 2 towns reported exempting certified stormwater development property. Finally, 2 cities, 1 county, and 1 town reported an exemption for wetlands and riparian buffers.
```r
# Table 6.1 Property Tax Exemptions for Certain Rehabilitated Real Estate, 2019
# Table 6.2 Property Tax Exemptions for Restoration Sites, Recycling, Solar Energy, Generators, Stormwater Developments, and Wetlands, 2019
```
<file_sep>/_book/16-meals.md
# Meals, Transient Occupancy, Cigarettes, Tobacco, and Admissions Excise Taxes
Among the many local taxes levied by Virginia’s localities are four excise taxes on meals, transient occupancy, cigarettes and admissions. **Table 16.1** provides a detailed list of rates for these taxes for the 38 cities, 82 counties, and 108 towns reporting at least one of these taxes.
## MEALS TAX
The meals tax is a flat percentage imposed on the price of a meal. In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the tax accounted for 7.5 percent of the total tax revenue for cities, 1.2 percent for counties, and 23.5 percent for large towns. The low percentage for counties is explained by the fact that slightly less than one-half of the counties employ the tax and those that have it cannot exceed a rate of 4 percent, whereas cities and towns are allowed to impose a higher tax rate. The authority to levy this tax varies greatly among jurisdictions, so the tax varies significantly among individual cities, counties, and towns. For information on tax receipts of individual localities, see Appendix C.
Counties are restricted in their authority to levy the meals tax within the limits of an incorporated town unless the town grants the county authority to do so (§ 58.1-3711). Cities and towns are granted the authority to levy the tax under the “general taxing powers” found in their charters (§ 58.1-3840).
Counties may levy a meals tax on food and beverages offered for human consumption if the tax is approved in a voter referendum (§ 58.1-3833). However, several counties have been exempted from the voter referendum requirement [see § 58.1-3833 (B) of the Code of Virginia]. Cities and towns do not need to have a referendum when deciding to impose the tax.
There are certain restrictions in applying the meals tax. The tax cannot be imposed on food that meets the definition of food under the Federal Food Stamp Program, with the exception of sandwiches, salad bar items, certain prepackaged salads, and non-factory sealed beverages. It does not apply to certain volunteer and non-profit organizations that might sell food on an occasional basis nor does it apply to churches and their members. Also, the meals tax cannot exceed 4 percent in counties. Cities and towns may exceed that rate. Accordingly, 34 cities and 78 towns report charging a meals tax over 4 percent. In addition, the meals tax does not apply to gratuities, whether or not a restaurant makes them mandatory.
The first column of **Table 16.1** lists the rates for the meals tax. All cities impose a meals tax. The median tax rate is 6 percent. The minimum rate, charged by four cities, is 4 percent, and the maximum, charged by Covington is 8 percent. The median meals tax rate is lower among the 50 counties that report having it. All counties that report having the meal tax have a rate of 4 percent. Among the 105 towns that report having a meals tax, the minimum rate is 2 percent, the maximum 8 percent, and the median rate is 5 percent.
The table summarizes the dispersion of the meal tax rates among cities, counties, and towns.
```r
#Text table "Meals Tax Rates, 2019" goes here
```
The local meals tax is in addition to the state 4.3 percent sales tax (5 percent in localities constituting transportation districts in northern Virginia and Hampton Roads) and the 1 percent local option sales tax (see § 58.1-603). This means that the combined state and local tax rate on restaurant meals could be anywhere in the range of 7 to 14 percent for cities, counties, and towns that impose this tax. Such rates apply to all restaurant meals whether consumed at elegant dining establishments or fast food providers.
## TRANSIENT OCCUPANCY TAX
The transient occupancy tax (lodging tax) is a flat percentage imposed on the charge for the occupancy of any room or space in hotels, motels, boarding houses, travel camp-grounds, and other facilities providing lodging for less than thirty days. The tax applies to rooms intended or suitable for dwelling and sleeping. Therefore, the tax does not apply to rooms used for alternative purposes, such as banquet rooms and meeting rooms.
In fiscal year 2018, the occupancy tax accounted for 2.2 percent of the total tax revenue for cities, 0.9 percent for counties, and 5.6 percent for large towns. These are averages; the relative importance of the tax varies significantly among individual cities, counties, and towns. For information on tax receipts of individual localities, see Appendix C.
According to § 58.1-3819, counties may levy a transient occupancy tax with a maximum tax rate of 2 percent. Counties specified in § 58.1-3819(A) may increase their transient occupancy tax to a maximum of 5 percent. The portion of the tax collections exceeding 2 percent must be used by the county for tourism and tourism related expenses. According to § 58.1-3819, the following counties are permitted to levy the 5 percent rate: Accomack, Albemarle, Alleghany, Amherst, Arlington, Augusta, Bedford, Bland, Botetourt, Brunswick, Campbell, Caroline, Carroll, Craig, Cumberland, Dickenson, Dinwiddie, Floyd, Franklin, Frederick, Giles, Gloucester, Goochland, Grayson, Greene, Greensville, Halifax, Highland, Isle of Wight, James City, King George, Loudoun, Madison, Mecklenburg, Montgomery, Nelson, Northampton, Page, Patrick, Powhatan, Prince Edward, Prince George, Prince William, Pulaski, Rockbridge, Rockingham, Russell, Smyth, Spotsylvania, Stafford, Tazewell, Warren, Washington, Wise, Wythe, and York.
Certain counties are permitted to levy higher rates. Roanoke County was given permission to levy a rate of 7 percent in 2012, with a portion of the revenue going to tourism advertisement. James City and York counties have 5 percent rates but are also allowed to charge an additional $2 per room per night. The proceeds of these additional taxes go to tourism advertising (§ 58.1-3823(C)). Certain cities and towns also charge specific dollar amounts in addition to the percent rates; they are the cities of Alexandria, Lynchburg, Newport News, and Norfolk and the town of Dumfries. It is assumed, but not verified, that these policies are permitted by the localities’ charters.
In 2018 the General Assembly authorized the replacement of a regional transient occupancy tax in the Northern Virginia Transportation District with a 2 percent transient occupancy tax to fund transportation in that area. This tax includes the counties of Arlington, Fairfax, and Loudoun, and the cities of Alexandria, Fairfax, and Falls Church. In addition, the assembly funded a 2 percent local transportation transient occupancy tax for the localities of Prince William County and Manassas City and Manassas Park City.
Counties are restricted in their authority to levy the lodging tax within the limits of an incorporated town unless the town grants the county authority to do so (§ 58.1-3711). Cities and towns are granted the authority to levy the lodging taxes under the “general taxing powers” found in their charters (§ 58.1-3840).
The median rate for the 37 cities that report using the transient occupancy tax is 8 percent, the minimum 2 percent, and the maximum is 11 percent (Emporia). Seventy-nine counties report imposing a transient occupancy tax. The extremes range from 2 to 8 percent with a median rate of 5 percent. The 77 towns that report having the tax show a median of 5 percent with a minimum rate of 1 percent and a maximum of 9 percent. The following text table summarizes the dispersion of the transient occupancy tax among cities, counties, and towns:
```r
#Text table "Transient Occupancy Taxes, 2019" goes here
```
The local transient occupancy tax is in addition to the state 4.3 percent sales tax (5 percent in localities constituting transportation districts in Northern Virginia and Hampton Roads) and the 1 percent local option sales tax. This means that the combined state and local tax rate for hotel-motel stays can be very high. In a special district of Virginia Beach the combined rate is 16.5 percent (10.5 percent transient occupancy tax, 1 percent local option sales and use tax, and 5 percent state sales and use tax applicable for localities in Hampton Roads).
## CIGARETTE AND TOBACCO TAXES
In fiscal year 2018, cigarette and tobacco taxes accounted for 0.9 percent of the total tax revenue collected by cities, 0.1 percent of that collected by counties, and 2.1 percent of that collected by large towns. The very low percentage for counties is attributable to the fact that few counties levy cigarette and tobacco taxes. These are averages; the relative importance of the tax varies significantly among individual cities and towns. For information on individual localities, see Appendix C.
The state is authorized by § 58.1-1001 of the Code to impose an excise tax of 1.5 cents on each cigarette sold or stored (30 cents on a pack of 20). Section 58.1-3830 allows for the local taxation of the sale or use of cigarettes. Cities and towns are granted the authority to levy the tax under the “general taxing powers” found in their charters (§ 58.1-3840). The right to levy the tax has been granted to only two counties by general law. Fairfax and Arlington counties may levy the cigarette tax with a maximum rate of 5 cents per pack or the amount levied under state law, whichever is greater (§ 58.1-3831). The two counties have followed the state’s example and raised their taxes to 30 cents for a pack of 20. No county cigarette tax is applicable within town limits if the town’s governing body does not authorize that county to levy the tax. This restriction applies to towns in Fairfax County, including Herndon, Vienna, and Occoquan.
Unlike the meals and transient occupancy taxes, which are added directly to the bill at the time of purchase, the cigarette tax is added onto the price per pack before the purchaser buys the cigarettes. The tobacco tax is levied either as a flat tax or as a portion of gross receipts. If no schedule is given in **Table 16.1**, then it should be read as a flat tax. A total of 31 cities levy some sort of tax on cigarettes, while 2 counties and 66 towns report doing so. The following text table, based on the tax of a pack of 20 cigarettes, summarizes the dispersion of cigarette taxes among cities, counties and towns.
```r
#Text table "Cigarette Tax on a Pack of 20 in 2019" goes here
```
The cigarette tax is in addition to the state 4.3 percent sales tax (5 percent in localities constituting transportation districts in Northern Virginia and Hampton Roads) and the 1 percent local option sales tax.
## ADMISSIONS TAX
In fiscal year 2018, the admissions tax accounted for 0.4 percent of the total tax revenue for cities. Receipts were negligible for counties and large towns. These are averages; the relative importance of the tax varies significantly among individual localities. For information on receipts by individual localities, see Appendix C.
Events to which admissions are charged are classified into five groups by § 58.1-3817 of the *Code of Virginia*; they are: (1) those events from which the gross receipts go entirely to charitable purposes; (2) admissions charged for events sponsored by public and private educational institutions; (3) admissions charged for entry into museums, botanical or similar gardens and zoos; (4) admissions charged for sporting events; and (5) all other admissions.
In imposing the admissions tax, localities have the authority to tax each class of admissions with the same or with a different tax rate. A locality may impose admission taxes at lower rates for events held in privately-owned facilities than for events held in facilities owned by the locality. Section 58.1-3818 allows a locality to exempt certain qualified charitable events from admissions tax charges. Fifteen counties (Arlington, Brunswick, Charlotte, Clarke, Culpeper, Dinwiddie, Fairfax, Madison, Nelson, New Kent, Prince George, Scott, Stafford, Sussex, and Washington) have been granted permission to levy an admissions tax at a rate not to exceed 10 percent of the amount of charge for admissions (§§ 58.1-3818 and 58.1-3840). Only three counties, Dinwiddie, Roanoke, and Washington, report levying the tax.
Cities and towns are granted the authority to levy the admissions tax under the “general taxing powers” found in their charters (§ 58.1-3840). As shown in the text table, 18 cities and 3 towns (Cape Charles, Culpeper, and Vinton) reported levying the admissions tax. For cities, the levy ranged from 5 percent to the full 10 percent. The median rate was 7 percent.
```r
#Text table "Admissions Tax, 2019" goes here
#Table 16.1 "Meals, Transient Occupancy, Cigarette, and Admissions Excise Taxes, 2019" goes here
```
<table>
<caption>(\#tab:table16-1)Meals, Transient Occupancy, Cigarette, and Admissions Excise Taxes Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Meals (Restaurant) Tax (%) </th>
<th style="text-align:center;"> Transient Occupancy (Hotel and Motel) Tax (%) </th>
<th style="text-align:center;"> Cigarette Tax (Per Pack) </th>
<th style="text-align:center;"> Cigarette Tax (Per Pack) </th>
<th style="text-align:left;"> Cigarette Tax (Per Pack) </th>
<th style="text-align:center;"> Admissions Tax (%) </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.2 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 37.5 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 4.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:left;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 3.5 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 1.1 </td>
<td style="text-align:center;"> 1.1 </td>
<td style="text-align:left;"> 1.1 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 9.0 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 55.0 </td>
<td style="text-align:center;"> 55.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 65.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 7.5 </td>
<td style="text-align:center;"> 11.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 85.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 85.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.7 </td>
<td style="text-align:center;"> 0.7 </td>
<td style="text-align:left;"> 0.7 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 31.0 </td>
<td style="text-align:center;"> 31.0 </td>
<td style="text-align:left;"> 31.0 </td>
<td style="text-align:center;"> 6.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 7.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 7.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 85.0 </td>
<td style="text-align:center;"> 85.0 </td>
<td style="text-align:left;"> 85.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:left;"> 30.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 35.0 </td>
<td style="text-align:center;"> 43.8 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 7.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 65.0 </td>
<td style="text-align:center;"> 81.2 </td>
<td style="text-align:left;"> 97.5 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:left;"> 75.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:left;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 7.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.8 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 95.0 </td>
<td style="text-align:center;"> 1.2 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:left;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 90.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 95.0 </td>
<td style="text-align:center;"> 1.2 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 15.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 7.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 50.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 7.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 54.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 45.0 </td>
<td style="text-align:center;"> 56.0 </td>
<td style="text-align:left;"> 68.0 </td>
<td style="text-align:center;"> 7.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 6.7 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:left;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.8 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:center;"> 93.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:left;"> 0.3 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 35.0 </td>
<td style="text-align:center;"> 35.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 35.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 27.0 </td>
<td style="text-align:center;"> 54.0 </td>
<td style="text-align:left;"> 54.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 27.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 22.0 </td>
<td style="text-align:center;"> 22.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:left;"> 0.3 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:left;"> 10.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 37.5 </td>
<td style="text-align:left;"> 45.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 22.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 12.5 </td>
<td style="text-align:center;"> 12.5 </td>
<td style="text-align:left;"> 12.5 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 4.5 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:center;"> 13.0 </td>
<td style="text-align:left;"> 15.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 3.7 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 3.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> 6.5 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.8 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.8 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> 7.5 </td>
<td style="text-align:center;"> 9.0 </td>
<td style="text-align:center;"> 40.0 </td>
<td style="text-align:center;"> 50.0 </td>
<td style="text-align:left;"> 60.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 10.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 15.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 15.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:left;"> 75.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:left;"> 0.3 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> 3.5 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 6.2 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 5.0 </td>
<td style="text-align:center;"> 3.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> 2.5 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:left;"> 75.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 17.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:left;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 3.5 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 40.0 </td>
<td style="text-align:center;"> 40.0 </td>
<td style="text-align:left;"> 40.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 15.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 12.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 55.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 45.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.1 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> 3.5 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 12.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:center;"> 75.0 </td>
<td style="text-align:left;"> 75.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 7.5 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 30.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:left;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 13.0 </td>
<td style="text-align:center;"> 13.0 </td>
<td style="text-align:left;"> 13.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> 4.5 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 35.0 </td>
<td style="text-align:center;"> 35.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:left;"> 20.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> 6.2 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:center;"> 0.4 </td>
<td style="text-align:left;"> 0.4 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 5.5 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:left;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 15.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 0.3 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:left;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> V<NAME> </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> 80.0 </td>
<td style="text-align:center;"> 100.0 </td>
<td style="text-align:left;"> 120.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 20.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 25.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:center;"> 10.0 </td>
<td style="text-align:left;"> 10.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 6.0 </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 0.2 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> 7.0 </td>
<td style="text-align:center;"> 8.0 </td>
<td style="text-align:center;"> 15.0 </td>
<td style="text-align:center;"> 15.0 </td>
<td style="text-align:left;"> 15.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
</tbody>
</table>
<file_sep>/Appendix-B.Rmd
# List of Respondents and Non-Respondents
```{r}
# List of Respondents and Non-Respondents to 2019 Tax Rates Questionnaire$^a$
```
<file_sep>/04-Value_Assessments.md
# Land Use Value Assessments for Agricultural, Horticultural, Forestal, and Open Space Real Estate
The *Code of Virginia*, §§ 58.1-3230 through 58.1-3244, allows any locality that has adopted a comprehensive land use plan to enact a local ordinance providing for special assessments of agricultural, horticultural, forestal, and open space real estate. (Also see Article 10, Section 2, of the *Constitution of Virginia*.) Before implementing such an ordinance, the locality's land use plan must have been adopted by June 30 of the year preceding the one in which taxes are first assessed and levied under the special assessment provision. (For localities that have adopted a fiscal year assessment date of July 1, the plan must have been adopted by December 31 of the preceding year).
Since 1957, every state has enacted legislation allowing some type of preferential treatment of farmland and in some states, like Virginia, open space land has also been included. There is an ongoing debate among tax specialists about how effectively preferential assessment slows conversion of land to more intensive uses. If the difference in returns from farming and development is high enough, development will occur even if farmland is taxed at a zero rate. A 1998 study showed that preferential assessment of farmland "... produced a gradual but significant difference in the loss of farmland that after a 20-year period amounted to about 10 percent more of land in a county being retained in farming than would have otherwise been the case."[^04-1] This was a general result and the effectiveness of the policy would depend on local circumstances with greater success associated with modest development pressure. Additional information on use value assessment as well as other land preservation techniques is contained in a *Virginia News Letter* article by <NAME>.[^04-2]
## AGRICULTURAL, HORITCULTURAL, FORESTAL, AND OPEN SPACE REAL ESTATE
The authorizing statute sets forth certain definitions for qualifying property. Real estate devoted to agricultural use includes either land devoted to the bona fide production for sale of plants and animals useful to man or land that meets the requirements for payments or other compensation pursuant to a soil conservation program. Real estate devoted to horticultural use is either land devoted to the bona fide production for sale of fruits, vegetables, and nursery and floral products, or land that meets the requirements for payments from a soil conservation program. Real estate devoted to forestal use in land devoted to tree growth in such quantity and so spaced as to constitute a forest area. And finally, real estate devoted to open space is real property used to preserve park and recreational areas, conserve land or other natural resources, or preserve floodways and land of historic or scenic value. Under this definition, golf courses can be considered open space property.
Agricultural and horticultural land must consist of a minimum of five acres, unless the acreage is used for aquaculture or raising specialty crops, in which case it may be less than five acres. Forestal land must consist of a minimum of 20 acres. Open space land must consist of a minimum of five acres. Exceptions include land adjacent to a scenic river, a scenic highway, a Virginia Byway, or public property in the Virginia Outdoors Plan as well as property in any city, county, or town having population density greater than 5,000 per square mile; in those localities the governing body may adopt a two acre minimum.
**Table 4.1** presents the information for the 114 localities reporting a land use assessment ordinance in effect for the 2019 tax year. The table includes the effective date of the ordinance, the types of real estate included, the cost of the application fee, the use value per acre valuation used by the locality, and the comparable State Land Evaluation Advisory Council (SLEAC) use value estimate. Section 5 provides details on the related program of agricultural and forestal districts.
## LOCAL AUTHORITY IN LAND USE ASSESSMENTS
Nineteen cities, 75 counties, and 20 towns reported having some type of real estate subject to land use assessment in 2019. A locality is not required to include each of the four classifications of property in its local ordinance. It may choose which classifications are subject to land use assessment. Twelve cities, 36 counties, and 13 towns reported excluding one or more types of property. Upon the adoption of a land use assessment ordinance, the locality is authorized to direct a general reassessment in the following year.
In order to have their land assessed on the basis of use, property owners must apply to the local assessing officer at least 60 days preceding the tax year for which the special assessment is sought.[^04-3] Localities may also require the owner to pay an application fee.
Localities may also have a minimum prior use requirement. However, prior use requirements can be waived for real estate devoted to the production of agricultural and horticultural crops that require more than two years from initial planting until commercially feasible harvesting.
Finally, property that would otherwise qualify for land use assessment is not disqualified because a portion of the property is being used for a different purpose, if it is authorized by a special use permit or allowed by zoning. However, that portion being used for a different purpose is deemed a separate piece of property for assessment purposes.
## THE USE OF SPECIAL ASSESSMENTS
In 1973, the first year in which local ordinances could take effect, only four localities - the counties of Fauquier, Loudoun, Prince William, and the city of Virginia Beach - adopted special assessment ordinances. Currently, 114 localities report land use assessment ordinances in effect for at least one type of property. The total acreage reported covered is 247,180 for cities and 7,157,010 for counties. Nine towns reported 76,473 acres; this number is presumably already included in the county counts.
Localities reporting agricultural assessment ordinances numbered 110, while localities with forestal assessment ordinances numbered 88, and those with horticultural special assessments numbered 88. Open space special assessments are less common; 60 localities reported them. The breakdown of types of special assessment is shown in the text table.
```r
#table name: Types of Special Assessments, 2019
```
## APPLICATION FEES FOR AGRICULTURAL LAND
More localities charge special assessment application fees for agricultural land than for any other type. Application fees for agricultural land vary widely by locality. They can be one-time charges or may have to be revalidated after several years. Among the cities, six reported charging no fee, two reported charging a one-time fee, eight reported a flat fee for each application, and three reported a base fee plus an additional amount per acre. Reported fees were as high as $300 in the city of Staunton for its one-time fee.
Among the 75 counties reporting having land use assessments, one (Stafford) reported charging no fees, 29 reported a flat fee, one (York) reported a flat fee revalidated every sixth year, and 44 reported charging some variant of a base fee plus an additional amount per acre or per parcel.
Twenty-three towns reported having land use assessments. Eleven reported using the same method for determining application fees as used by the county in which the town is located. Five reported imposing no fees, four charged a base fee plus an additional amount per acre, and three charged a flat rate. The highest application fee reported was for the town of Blacksburg which has a flat fee of $150.
## VALUING REAL ESTATE FOR LAND USE ASSESSMENT
The local assessing officer has responsibility for determining which real estate meets the state-imposed criteria for land use assessment. This officer may request an opinion, depending on the type of property, from the Director of the Department of Conservation and Recreation, the State Forester, or the Commissioner of Agriculture and Consumer Services. These agency heads are also authorized to provide, either to the commissioner of revenue or to the assessing officer of each locality that has adopted a land use assessment ordinance, a statement of uniform statewide standards to be used in determining the qualifications for each type of property. Further, the State Land Evaluation Advisory Council is required to provided each locality using special assessments with a recommended range of suggested values for each type of property, based on the productive earning power of that particular type of land. SLEAC provides estimates based on two methods - an income method and a cash rental rate method.[^04-4] The income method capitalizes the average net income for agricultural properties in different categories (cropland 1, cropland 2, pastureland 1, pastureland 2, etc.). The method also provides a downward adjustment for land at risk of flooding. The rental rate method capitalizes average rents on agricultural properties in a locality or in the region if the sample for a locality is too small. The two methods do not have to provide similar figures. For the SLEAC estimates by locality for the two methods see *Virginia's Use Value Assessment Program*, "Agricultural and Horticultural Estimates," at https://aaec.vt.edu/extension/use-value.html
Only those indices of value that relate to agricultural, horticultural, forestal or open space use may be considered in determining the assessment. Any structure not related to such special use and the real estate upon which the structure is located cannot be included in the special assessment but must be taxed on the basis used for assessing other real property in the locality.
In our survey we included a question about the use value per acre used by the locality to determine the taxable value of Class I agricultural land, one of several classifications of agricultural land estimated by SLEAC. Seventy-eight localities (14 cities and 64 counties) provided information. We have also listed the SLEAC values for both the income and cash rental methods for comparison. In some cases, the local estimate seems to mirror either the income or rental method. In other cases, the locality seems to have chosen its own method. These differences in the valuations between SLEAC and the locality may be caused by a number of factors: (1) the locality may have better information on local conditions than SLEAC; (2) the locality may use different assessment procedures; or (3) the locality may have made an administrative decision to assess use value at a higher or lower value than SLEAC. A 2008 article by two Virginia Tech economists, *Why Use-value Estimates Can Differ Between Counties*, by <NAME>. and <NAME>, explains why variation exists in use-value estimates for neighboring localities. See https://pubs.ext.vt.edu/446/446-013/446-013.html.
For general information on use values and other aspects of the program, see the home page for Virginia's use value assessment program at https://aaec.vt.edu/extension/use-value.html.
## CHANGES IN USE
Land use assessment can remain in effect only as long as the property is used for the purpose for which the special assessment was granted. A change from use value assessment will be based only upon a change in the use of the land. A change in ownership does not bring about a change in assessment unless the new owner changes the use of the land from a qualifying use to a non-qualifying use.
If the qualifying land reverts to a non-qualifying use, the property is subject to rollback taxes. These taxes are equal to the amount by which the tax on the property, had it been assessed on the same basis as other non-qualifying property in the locality, exceeds the tax that was paid on the property under special assessment. This provision is applicable to the five most recent complete tax years prior to the change. Property owners are also held responsible for a 5 percent payment penalty and for an interest penalty established by each locality, pursuant to §§ 58.1-3915 and 58.1-3916. Any change in use must be reported to the commissioner of revenue or other assessing officer within 60 days. Failure to comply subjects the owner to the amount of tax due plus interest and penalties, to be determined by the local ordinance.
There is also a penalty for any misstatement made in the application for special assessment. In such a case, the owner is liable for all taxes that would have been incurred had the real estate not been subject to special assessment, together with penalties due on such sum. If the misstatement was made with the intent to defraud the locality, the owner is assessed an additional penalty of 100 percent of the unpaid taxes.
[^04-1]: <NAME>, "Property Tax Treatment of Farmland: Does Tax Relief Delay Land Development," <NAME>, editor. *Local Government Tax and Land Use Policies in the United States*. (Northampton, MA: Edward Elgar, 1998), p. 156.
[^04-2]: <NAME>, "Preserving Virginia's Farm and Forest Land and Natural Landscape, An Assessment of Existing Tools and the Potential for Transfer of Development Rights," *The Virginia News Letter* 86:5 (October 2010).
[^04-3]: In the case of a general reassessment, the property owner may submit the application up until thirty days after the notice of an increase in assessment.
[^04-4]: Virginia Cooperative Extension, "A Citizens' Guide to The Use Value Taxation Program in Virginia." https://pubs.ext.vt.edu/448/448-037/448-037.html
<file_sep>/_book/99-references.md
# References {-}
This online edition of the *Virginia Local Tax Rates* survey report was prepared with the **bookdown** package [@R-bookdown], which is built on top of R Markdown and **knitr** [@xie2015] using the R programming language [@R-base].
<div id="refs"></div>
<file_sep>/tables/old-stuff/tables.Rmd
---
title: "Virginia Local Tax Rates Tables"
output:
bookdown::html_document2: default
bookdown::pdf_document2: default
editor_options:
chunk_output_type: inline
---
```{r, setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message=FALSE, cache = FALSE, fig.width = 8)
```
<file_sep>/03-real_property_tax_relief.Rmd
# Real Property Tax Relief Plans and Housing Grants for the Elderly and Disabled in 2019
Sections 58.1-3210 through 58.1-3218 of the *Code of Virginia* provides that localities may adopt an ordinance allowing property tax relief for elderly and disabled persons. The relief may be in the form of either deferral or exemption from taxes. The applicant for tax relief must be either disabled or not less than 65 years of age and must be the owner of the property for which relief is sought (§ 58.1-3210). The property must be the sole dwelling of the applicant. In addition, localities have the option of exempting or deferring the portion of a person’s tax that represents the increase in tax liability since the year the taxpayer reached 65 years of age or became disabled.
Localities are allowed to establish by ordinance the net financial worth and annual income limitations pertaining to owners, relatives and non-relatives living in the dwelling(§ 58.1-3212) of qualified elderly or handicapped persons. Further, mobile homes that are owned by elderly and disabled persons are included in the allowable property tax exemptions whether or not mobile homes are permanently affixed. Finally, local governments are authorized to extend tax relief for the elderly and disabled to dwellings that are jointly owned by individuals, not all of whom are over 65 or totally disabled.
The table below indicates the range and media of the combined gross income allowance and combined net worth limitations for those cities, counties, and towns responding to the survey.
```{r}
#table name: Relief Plan Statistics: Gross Income and Net Worth, 2019
```
The following table indicates, for those localities responding, how many localities have a tax relief plan that applies to both the elderly and the disabled, the elderly only,or the disabled only.
```{r}
# table name: Relief Plans for Elderly and Disabled, 2019
```
A majority of the localities exempt an owner from all or part of the taxes on the dwelling; usually the exemption is based on a sliding scale, with the percentage of the exemption decreasing as the income and/or net worth of the owner increases.
**Table 3.1** summarizes the various tax relief plans offered to elderly and disabled property owners in Virginia. The figures under the combined gross income heading reflect, first, the maximum allowable income (including the income of all relatives living with the owner) for an owner to be eligible for relief and, second, the amount of income of each relative living in the household, except the spouse, who is exempted from this amount.
For example, if the table reads “\$7,500; first \$1,500 exempt,” this indicates that the combined income of the owner and all relatives living with him/her may not exceed \$7,500, except that the first \$1,500 of income of each relative other than the spouse is excluded when computing this amount. The combined net worth amount listed usually excludes the value of the dwelling and a given parcel of land upon which the dwelling is situated.
**Table 3.2** details relief plans for renters. As the table indicates, few localities offer such plans. Only five cities (Alexandria, Charlottesville, Fairfax, Falls Church, and Hampton) and one county (Fairfax) reported having plans for renters.
**Table 3.3** lists the combined elderly and disabled beneficiaries reported by each locality in 2018 or 2019 and the amount of revenue foregone by each locality because of the homeowner exemptions. The amounts were reported by 23 cities, 66 counties, and 31 towns that responded to the question. The amounts reported foregone totaled \$21,698,890 for cities, \$60,242,734 for counties and \$636,229 for the reporting towns. The grand total amount foregone by reporting cities, counties, and towns was \$82,577,853. An estimate of the average revenue foregone per beneficiary is also provided for localities reporting both number of beneficiaries and foregone revenue. For cities, the average revenue foregone was \$1,518 per beneficiary. The amount for counties was \$1,581, and for towns it was \$360.
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table03-1, echo=FALSE, eval=FALSE}
#table_03_1_vars <- c("ExternalDataReference","real_own_inc", "real_own_net", "")
#table_03_1_labels <- c("Locality","Combined Gross Income", "Combined Net Worth", "Relief Plan/Exemption")
#table_03_1 <- make_table(table_03_1_vars)
#knitr::kable(table_03_1,
#caption = "Real Property Owner Tax Relief Plans for the Elderly and Disabled Table, 2019",
#col.names = table_03_1_labels,
#align = "lccc",
#format = "html")
```
```{r table03-2, echo=FALSE, eval=FALSE}
#table_03_2_vars <- c("ExternalDataReference", "real_rent_inc", "real_rent_net", "")
#table_03_2_labels <- c("Locality","Combined Gross Income", "Combined Net Worth", "Relief Plan")
#table_03_2 <- make_table(table_03_2_vars)
#knitr::kable(table_03_2,
#caption = "Real Property Renter Tax Relief Plans for the Elderly and Disabled Table, 2019",
#col.names = table_03_2_labels,
#align = "lccc",
#format = "html")
```
```{r table03-3, echo=FALSE, eval=FALSE}
#table_03_3_vars <- c("ExternalDataReference","")
#table_03_3_labels <- c("Locality","")
#table_03_3 <- make_table(table_03_3_vars)
#knitr::kable(table_03_3,
#caption = "Real Property Tax Relief Plans for the Elderly and Disabled Homeowners: Number of Beneficiaries and Foregone Tax Revenue Table, 2018 or 2019",
#col.names = table_03_3_labels,
#align = "lcccc",
#format = "html")
```
<file_sep>/_book/22-impact-fees-roads.md
# Impact Fees for Roads
The Code of Virginia § 15.2-2319 authorizes localities identified by population or adjacency to certain localities (see § 15.2-2317) to assess and impose impact fees on new developments to pay all or part of the cost of reasonable road improvements attributable in substantial part to such development. Costs include, in addition to all labor, materials, machinery, and equipment for construction, (i) acquisition of land, rights-of-way, property rights, easements, and interests, including the costs of moving or relocating utilities; (ii) demolition or removal of any structure on land so acquired, including acquisition of land to which such structure may be moved; (iii) survey, engineering, and architectural expenses; (iv) legal, administrative, and other related expenses; and (v) interest charges and other financing costs if impact fees are used for the payment of principal and interest on bonds, notes, or other obligations issued by the county, city, or town to finance the road improvements (§ 15.2-2318).
Before it can adopt an enabling ordinance, the locality must establish an impact fee advisory committee (§ 15.2-2319). The locality may then delineate one or more impact fee service areas. Any impact fees collected from new development within an impact fee service area must be expended for road improvements in that impact fee service area (§ 15.2-2320).
Prior to adopting a system of impact fees, localities must conduct an assessment of road improvement needs benefitting an impact fee service area. From this needs assessment, a road improvement plan must be developed to improve existing roads and construct new roads within the impact fee service area. The improvement plan will then be incorporated into the locality’s capital improvements program after a duly advertised public hearing (§ 15.2-2321).
After the adoption of the improvement program, the locality may adopt an ordinance establishing a system of impact fees to fund or recapture the cost of providing road improvements within the impact fee service areas. The ordinance will list a schedule of the impact fees for each service area (§ 15.2-2322).
Section 15.2-2323 specifies that the impact fee for a specific development or subdivision must be determined prior to or at the time when the site is approved. The ordinance must specify that the payment of fees be in one lump sum or through installments at a reasonable rate of interest for a fixed number of years.
The 2007 transportation funding legislation [House Bill 3202 (Chapter 896)] authorized localities with established urban transportation service districts to impose additional impact fees subject to certain restrictions (§ 15.2-2320). Service districts are districts created within a locality “to provide additional, more complete or more timely services of government than are desired in the locality or localities as a whole” (§ 15.2-2400). The urban transportation service district had to be established in accordance with § 15.2-2403.1 in those counties which met the definition of urban county – “any county with a population of greater than 90,000, according to the United States Census of 2000, that did not maintain its roads as of January 1, 2007” (§ 15.2-2403.1). The counties have to maintain the roads within the district.
The 2007 law applied only to counties with urban transportation service districts and had to be exercised in areas of the county outside of already established urban transportation service districts in parcels zoned agricultural that were being subdivided for by-right residential development. Also, the authority for the article expired on December 31, 2008 for any locality that had not established an urban transportation service district and adopted an impact fee ordinance in the new area by that date.
The law permits urban counties with existing urban transportation service districts to create new impact fee service areas. The locality must include within its capital improvements plan estimates of costs for public facilities necessary to serve residential uses. Such public facilities include but are not limited to: (i) roads, bridges, and signals; (ii) storm water and flood control facilities; (iii) parks, open space, and recreation areas; (iv) public safety facilities; (v) primary and secondary schools; (vi) libraries and related facilities (§ 15.2-2320). Only Stafford County reports having used this authority to impose new fees. **Table 22.1** lists four counties and one city that reported using impact fees.
```r
#Table 22.1 "Impact Fees For Road Improvement, 2019" goes here
```
<table>
<caption>(\#tab:table22-1)Impact Fees For Road Improvement Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Impact Fee on Developers ($) </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> Cost divided by landowners </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 4735.30 (proffers) </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> County uses cash proffer index </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pr<NAME> County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> Average house 5171 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 500 </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
<file_sep>/_book/10-Machinery-Tools-Tax.md
# Machinery and Tools Property Tax
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the machinery and tools property tax accounted for 1.6 percent of total tax revenue for cities, 1.2 percent for counties, and 2.0 percent for large towns. These are averages; the relative importance of taxes in individual cities, counties, and towns may vary significantly. For information on individual localities, see Appendix C.
Under § 58.1-3507 of the *Code of Virginia*, certain machinery and tools are segregated as tangible personal property for local taxation. According to the *Code*, the classes of machinery and tools that are segregated are those that are used for “manufacturing, mining, processing and reprocessing (excluding food processing), radio or television broadcasting, dairy, and laundry or dry cleaning.” The tax rate on machinery and tools may not be higher than that imposed on other classes of tangible personal property.
Section 58.1-3507 provides a uniform classification for idle machinery. Idle machinery and tools are to be classified as intangible personal property no longer subject to local taxation. Items are defined to be idle if they have not been used for at least one year prior to the given tax day and no one can reasonably suppose that the machinery or tool will be returned to use in the given tax year.
Section 58.1-3980 provides an appeal procedure for the machinery and tools tax. The *Code* states, “... any person, firm, or corporation assessed by a commissioner of the revenue ... aggrieved by any such assessment, may, within three years from the last day of the tax year for which such assessment is made, or within one year from the date of the assessment, whichever is later, apply to the commissioner of the revenue or such other official who made the assessment for a correction thereof.”
**Table 10.1** presents the 2018 tax rates on machinery and tools for the 37 cities, 91 counties, and 79 towns that reported imposing the tax. The machinery and tools tax is shown in the table according to the following categories: the basis of assessment, assessment type, the statutory (nominal) tax rate per \$100, the assessment ratio, and the effective tax rate (computed by multiplying the statutory tax rate by the assessment ratio). *Effective tax rates among localities are only comparable if they use the same basis of assessment and apply it to the same age of property*. Most localities assess machinery and tools on the basis of original cost, fair market value, or book value. Frequently, a sliding scale is used, with the effective tax rate varying according to the age of the property.
Thirty-six cities reported using original cost as the basis of assessment. Eighty-eight counties imposing the tax used original cost. Finally, 69 of the towns reported basing their assessments on original cost. The remainder used fair market value or depreciated cost. In many cases it is accurate to say that towns followed the same method as the county in which they are located. However, some exceptions exist.
The following text table, using unweighted averages, compares localities using original cost as their basis. The table is based on machinery and equipment one year old. The medians for cities, counties and towns were \$1.05, \$0.90, and \$0.39, respectively. Town rates were in addition to rates imposed by their host counties.
```r
# table name: Machinery and Tools: Effective 1st Year Tax Rate per $100 for Localities Using Original Cost, 2019
```
**Table 10.2** presents the 2019 tax rates in industries which the *Code* permits specific types of equipment to be categorized as machinery and tools. The separate classification is permitted by § 58.1-3508 and § 58.1-3508.1. Currently, 13 localities report having a separate tax on equipment in the semiconductor industry; 47 report having a machinery and tools tax in the forest harvesting industry; 67 localities report so in the vehicle cleaning industry; while only 3 localities reports having it as a separate category in the castings industry. Meanwhile, 7 localities report having the tax for equipment in the defense industry, and 2 localities report having the category in other businesses.
**Table 10.3** presents the number of machinery and tool accounts each locality reported for 2019. Twenty-eight cities reported their number of accounts, as did 69 counties and 27 towns. When we asked the question, we assumed localities organized their accounts by business entity (i.e., each business had an account and within that account resided any number of tools). However, based on responses from some localities, this might not always be the case. Some localities responded that the machinery or tool item, not the business entity, was the basis of the account. Others informed us that their machinery and tools accounts included items we did not expect, such as company work trucks. Localities which reported having such systems tended to report a higher number of accounts.
<table>
<caption>(\#tab:table10-3)Machinery and Tools Tax, Number of Accounts Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Number of Accounts </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 42 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 91 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 52 </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 9 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 156 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> 21 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> 116 </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 55 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> 35 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 97 </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 76 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 72 </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 32 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 22 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 36 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> 42 </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 65 </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 472 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 23 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 33 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 51 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 41 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 36 </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 11 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 83 </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 39 </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 35 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> 17 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 39 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 44 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 260 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 211 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 85 </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 120 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 109 </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 33 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> 6 </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 444 </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 192 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 32 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> 51 </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> 92 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 35 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 74 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 15 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> 38 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> 45 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> 39 </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 82 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 48 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 11 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 38 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> 48 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> 47 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 72 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 28 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> 51 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 78 </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 70 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 32 </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 61 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 4 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> 79 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 47 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 82 </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 17 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> 50 </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 37 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 14 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 26 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 22 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 114 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 2 </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 69 </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 6 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 11 </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 10 </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 154 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 60 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 44 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 4 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 92 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 8 </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 110 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 147 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 387 </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 44 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 23 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 99 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 51 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 32 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 67 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 353 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 51 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 1 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 44 </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> 8 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 30 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 14 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 11 </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 4 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 3 </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 23 </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 2 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> 18 </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 3 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 7 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> 3 </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> 5 </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 11 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 16 </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> 31 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> 3 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> 9 </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> 6 </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> 26 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 23 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> 16 </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 11 </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> 14 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> 17 </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 3 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
```r
# Table 10.1 Machinery and Tools Property Tax, General Information, 2019
# Table 10.2 Machinery and Tools Tax on Specific Types of Equipment, 2019
# Table 10.3 Machinery and Tools Tax, Number of Accounts, 2019
```
<file_sep>/21-residential-water.Rmd
# Residential Water and Sewer Connection and Usage Fees
The Code of Virginia § 15.2-2122 authorizes sewer connection fees to finance changes in a sewer system that improve public health. Localities may establish, construct, improve, enlarge, operate, and maintain a sewage disposal system with all that is necessary for the operation of such system. The terms under which the locality can charge a fee are defined in § 15.2-2119. In most cases, the information in this section does not include fees of service districts that are separate from local governments. For further information about these fees, refer to the Draper Aden Associates report, The 31st Annual Virginia Water and Wastewater Rate Report, 2019, found at http://www.daa.com/resources/
## CONNECTION FEES
In this survey, we asked for the standard charges to connect a locality’s pipelines to a residence. The question applies only to residential buildings, including single-family homes, townhouses, apartment buildings, and mobile homes. We asked for the combined fees, so the amount should include connection fees, availability fees, service charges, and any other fee charged by a locality.Connection fees for nonresidential structures were not surveyed because of their complexity.
**Table 21.1** provides the water and sewer connection fees for the 25 cities, 48 counties, and 90 towns that reported imposing them. Fee schedules used by localities differ, but in general, charges apply to mains, valves, and meters that are installed by the locality. When an owner or developer installs all of the necessary equipment, the charge is generally waived. The following text table lists the unweighted mean, median, and first and third quartiles for connection fees for single-family housing for cities and counties.
```{r}
#Text table "Residential Water and Sewer Combined Connection Fees for Cities and Counties, 2019" goes here
#Will probably want to split it up by cities and counties as the original has done
```
## USAGE FEES
**Table 21.2** lists water and sewer usage fees for 36 cities, 54 counties, and 98 towns. The fees are often multitiered with the first several thousand gallons charged at a higher unit rate and the remaining amount at a lower basis. However, the opposite charging method, a multi-tiered system with the first usage charged at a lower rate than later usage, is also used.
For localities that responded with a single fee and not a schedule, it is assumed that the fee listed applies to the standard residential connection, even though no information on meter size was available. If you have questions concerning responses given in this table, please contact the appropriate water and sewer department or authority in the locality or visit their web site if applicable.
```{r}
#Table 21.1 "Residential Water and Sewer Connection Fees, 2019" goes here
#Table 21.2 "User Fees for Residential Water and Sewer, 2019"
```
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table21-1, echo=FALSE}
table_21_1_vars <- c("ExternalDataReference", "water_cost_single_in", "water_cost_single_out", "water_cost_apt_in", "water_cost_apt_out", "water_cost_townHouse_in", "water_cost_townHouse_out", "water_cost_mobile_in", "water_cost_mobile_out", "sewer_cost_single_in", "sewer_cost_single_out", "sewer_cost_apt_in", "sewer_cost_apt_out", "sewer_cost_townHouse_in", "sewer_cost_townHouse_out", "sewer_cost_mobile_in", "sewer_cost_mobile_out")
table_21_1_labels <- c("Locality","Water ($), Single", "Water ($), Single", "Water ($), Apartment", "Water ($), Apartment", "Water ($), Town House", "Water ($), Town House", "Water ($), Mobile Home", "Water ($), Mobile Home", "Sewer ($), Single", "Sewer ($), Single", "Sewer ($), Apartment", "Sewer ($), Apartment", "Sewer ($), Town House", "Sewer ($), Town House", "Sewer ($), Mobile Home", "Sewer ($), Mobile Home")
table_21_1 <- make_table(table_21_1_vars)
knitr::kable(table_21_1,
caption = "Residential Water and Sewer Connection Fees Table, 2019",
col.names = table_21_1_labels,
align = "lcccccccc",
format = "html")
```
```{r table21-2, echo=FALSE}
table_21_2_vars <- c("ExternalDataReference", "res_bill_period", "period_water_fee", "period_sewer_fee")
table_21_2_labels <- c("Locality","Billing Cycle", "Water Use Fee ($)", "Sewer Use Fee ($)")
table_21_2 <- make_table(table_21_2_vars)
knitr::kable(table_21_2,
caption = "User Fees for Residential Water and Sewer Table, 2019",
col.names = table_21_2_labels,
align = "lccc",
format = "html")
```
<file_sep>/07-Service-Charges.md
# Service Charges on Tax-Exempt Property
Sections 58.1-3400 through 58.1-3407 of the *Code of Virginia* authorize localities to impose service charges on otherwise tax-exempt property. Several types of property are excluded from this provision, including the land and buildings of churches used exclusively for worship and property used exclusively for nonprofit private educational or charitable purposes.
In 1981, the Virginia General Assembly amended the *Code* to restrict the use of the service charge on the value of real estate owned by the commonwealth to those localities where such property—excluding hospitals, educational institutions, roadway property, or property held for future construction—exceeds 3 percent of the value of all real estate located within the jurisdiction’s boundaries. However, the service charge may still be levied on faculty and staff housing owned by state educational institutions and on property of the Virginia Port Authority, regardless of the portion of state-owned property located within the locality.
The service charge is based on the assessed value of the state- or privately-owned real estate and the amount the locality has expended in furnishing police and fire protection, refuse collection and disposal, and the cost of public school education (applicable only in the case of faculty and staff housing of an educational institution). These expenditures must exclude any federal or state grants specifically designated for these purposes and any assistance provided to localities under Title 14.1, Article 10, Law-Enforcement Expenditures, of the *Code of Virginia*. If such services are not provided to the tax-exempt real estate or are funded by another service charge, the expenditures may not be included in calculations.
For (1) properties owned by religious organizations and used for religious purposes or (2) properties used for private, nonprofit educational or charitable purposes, the service charge may not exceed 20 percent of the real estate tax rate (or 50 percent in the case of faculty and staff housing at private educational institutions). The charge is determined by dividing the expenditures, as defined in the previous paragraph, by the assessed fair market value of all the real estate within the locality, except real estate owned by the United States government or by any of its instrumentalities.
The city of Richmond, as the seat of state government, clearly satisfies the 3 percent requirement. In addition, a number of other localities impose service charges either because they have faculty and staff housing or because they claim to exceed the 3 percent rule. The primary reason for the claim is the presence of a state institution of higher education or of a state correctional institution. However, in instances where the 3 percent requirement may not have been reached, an affected state agency may voluntarily have agreed to pay a service charge.
Based on the survey and some follow-up conversations, it was found that localities that have state educational institutions and which also charge the service fee include the cities of Charlottesville (University of Virginia), Fredericksburg (University of Mary Washington), Harrisonburg (James Madison University), Lexington (Virginia Military Institute), and Wise County (University of Virginia at Wise). Counties that impose service charges based on the presence of correctional institutions include Brunswick (Brunswick Correctional Center and Brunswick Work Center for Women), Buckingham (Buckingham Correctional Center and Dillwyn Correctional Center), Greensville (Greensville Correctional Center and Greensville Work Center), Fluvanna (Fluvanna Correctional Center for Women), Southampton (Southampton Correctional Center, Southampton Work Center for Men, Southampton Pre-Release and Work Center for Women, and Deerfield Correctional Center), and Wise (Red Onion State Prison, Wallens Ridge State Prison, and Wise Correctional Unit #18). **Table 7.1** shows that 12 cities, 7 counties, and 1 town report imposing a service charge of some sort on state-owned or privately-owned property.
```r
# Table 7.1 Service Charges on Tax-exempt Property, 2019
```
<file_sep>/_book/Appendix-D.md
# Population Estimates for Virginia's Cities, Counties, and Towns, July 1, 2018
```r
# Population Estimates for Virginia's Cities, Counties, and Towns, July 1, 2018
```
<file_sep>/_book/15-motor-vehicle-license-tax.md
# Motor Vehicle Local License Tax 2019
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the motor vehicle local license tax, popularly known as the local decal tax, even though many of the localities imposing the tax no longer use a decal as evidence of payment, accounted for 1.1 percent of the total tax revenue for cities, 1.1 percent for counties and 2.0 percent for large towns. These are averages; the relative importance of this tax in individual cities, counties and large towns varies significantly. For information on individual localities see Appendix C.
Section 46.2-752 of the *Code of Virginia* authorizes cities, counties, and towns to levy a license tax on motor vehicles, trailers, and semitrailers. The amount of the tax may not be greater than the tax imposed by the state. Currently, the base registration fees for non-commercial passenger vehicles are \$33 for vehicles under 4,000 pounds and \$38 for heavier vehicles (§ 46.2-694.2). Motorcycle fees are \$18 with a \$3 surcharge included [§ 46.2-694 (A) (10)]. The *Code* stipulates similar guidelines for commercial vehicles, buses, trailers, and other motor vehicles. The *Code* also provides for additional fees for specified government services, such as \$6.25 for emergency medical service (EMS) programs [*Code of Virginia* § 46.2-694 (A) (13) and *2014 Appropriations Act* § 3-6.02] to be paid to the state treasury and provides for a $1.50 addition for the official motor vehicle safety inspection program to be paid at registration (§ 46.2-1168).
No locality may impose a license tax on any vehicle when the owner pays a similar tax to the locality in which the vehicle is normally stored. Furthermore, no locality may impose a local license tax on any vehicle that is owned by a nonresident of such locality and is used exclusively for pleasure or personal transportation (i.e., for non-business uses). For example, the tax would not apply to a personal vehicle owned by a nonresident college student and used only for pleasure or personal transportation. Vehicles used for state business by nonresident officials, dealer demonstration vehicles and the vehicles of common carriers are also exempt from local license taxes.
The situs for the assessment of motor vehicles is clarified in § 58.1.3511. Business vehicles with a weight of 10,000 pounds or less are considered to be in the jurisdiction in which the owner of the business: (1) is required to file a tangible personal property tax return for any vehicle used in the business, and (2) has a definite place of business from which the use of the business vehicle is directed or controlled.
If a town within a county levies a motor vehicle license tax, the county must credit the owner with the tax paid to the town. Also, if the town tax is equal to the maximum allowed by law, then the county may not impose any further tax. Likewise, no county license tax may be imposed on vehicles that are subject to license taxes imposed by a town constituting a separate school division (§46.2-752)[^15-1].
**Table 15.1** presents the local motor vehicle license taxes on automobiles, motorcycles, and trucks. Column one indicates the date that the fee must be paid or a decal, if applicable, must be affixed to a motor vehicle to denote payment of license fees. Thirty-two cities and 83 counties reported imposing the tax. Of the reporting towns, 103 said they levied the tax. The second column gives the tax rate on private passenger vehicles. Most localities levy a fl at tax between \$15 and \$30 for passenger vehicles under 4,000 pounds. The table also shows the exemption status for elderly or disabled persons. Seven localities offer tax relief for the elderly, while 30 exempt the disabled from this tax. The final two columns give the tax rates on motorcycles and trucks. The tax ranges from \$3 to \$35 for motorcycles and from \$3 up to \$250 (depending on weight) for trucks.
The following table summarizes the range of tax charged for private passenger vehicles under 4,000 pounds.
```r
#Text table "License Tax for Private Passenger Vehicles Under 4,000 Pounds, 2019" goes here
```
Cities had a median license tax of \$27.00; the median tax for both counties and towns was \$25. For cities the mean license tax for private passenger vehicles was \$28.09. The first quartile measure was \$25 while the third quartile was \$32.25. For counties, the mean was \$26.67. The first and third quartiles were \$23.00 and \$30.00, respectively. For towns, the mean was \$23.18. The first and third quartiles were \$20 and $25 respectively.
**Table 15.2** lists whether localities require the display of decals and whether localities permit special exemptions from paying the motor vehicle license tax other than those for the elderly and disabled. Twenty-six cities, 78 counties, and 62 towns reported granting payment exemptions. The most popular category for exemption was for local fire and rescue department members.
In recent years, many localities have dispensed with the decal because new technology has allowed them to track payments without the use of the decal. Most now collect the motor vehicle license tax along with the personal property tax on motor vehicles. So far, 30 cities, 83 counties, and 81 towns reported they no longer required decal placement on automobile windshields.
|
```r
#Table 15.1 "Motor Vehicle Local License Tax, 2019" goes here
#Table 15.2 "Motor Vehicle Local License Tax Decal Display Policy and Exemptions, 2019" goes here
```
<table>
<caption>(\#tab:table15-1)Motor Vehicle Local License Tax Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Due Date Display or Payment </th>
<th style="text-align:center;"> Private Passenger Vehicles, Tax </th>
<th style="text-align:center;"> Private Passenger Vehicles, Exempt, Elderly </th>
<th style="text-align:center;"> Private Passenger Vehicles, Exempt, Disabled </th>
<th style="text-align:center;"> Motorcycles </th>
<th style="text-align:center;"> Trucks Not for Hire </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 27.00 flat </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 flat </td>
<td style="text-align:center;"> 27.00 flat </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> same as bill due date </td>
<td style="text-align:center;"> 0-4000 lbs: 40.75
< 4000 lbs: 45.75 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> flat 28.75 </td>
<td style="text-align:center;"> 0-4000 lbs: 40.75
< 4000 lbs: 45.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 25.00 0-10000 lbs; 30.00 Over 10000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 12/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 11.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 35.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> 35.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> Oct 5 or when the tax liability is due </td>
<td style="text-align:center;"> 33.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> 10 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> tax due date Dec 5th </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 11/01 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 11.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 04/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 27.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 17.00 </td>
<td style="text-align:center;"> 27.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> na </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 40 registration fee due when property taxes are due </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 registration fee due when property taxes are due </td>
<td style="text-align:center;"> 40 registration fee due when property taxes are due </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 12.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 11/15 </td>
<td style="text-align:center;"> 23.00
10.00 National Guard </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 18-Farm Trucks under 10000 lbs.
20-Farm Trucks over 10000 lbs.
39-Trucks over 10000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 6/05 </td>
<td style="text-align:center;"> 40.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 40.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> 33 vehicles 4000 lbs and less; 38 vehicles and trucks over 4000 lbs; 23 taxicabs church bus and vehicles for hire; an additional 5 charged if weight more than 4000 lbs. </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00
farm vehicles: 15
trailers: 10 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 33.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 34.25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.25 </td>
<td style="text-align:center;"> 34.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> 05/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 22.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 47.50 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28.75 </td>
<td style="text-align:center;"> 47.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 20.00 0 - 4000 lbs;
25.00 over 4000 lbs </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 20.00 - 64.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> Fee on bill due 12/5 </td>
<td style="text-align:center;"> 20.75 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 12.00 </td>
<td style="text-align:center;"> 20.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 06/5 (registration fee) </td>
<td style="text-align:center;"> 33.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> next personal prop. bill </td>
<td style="text-align:center;"> 1 time registration fee for 10 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1 time registration fee for 10 </td>
<td style="text-align:center;"> 1 time registration fee for 10 </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 4/30 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 23.00 flat rate </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 flat rate </td>
<td style="text-align:center;"> 23.00 flat rate </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 12.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 27.50 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 11/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 16.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 38.75 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 19.50 </td>
<td style="text-align:center;"> 38.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 30 </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20.00; trailers=10.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 23.50 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 23.50 </td>
<td style="text-align:center;"> 23.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 38.75 flat </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18 flat </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 33.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 33.00 </td>
<td style="text-align:center;"> 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25
2018 figure </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18
2018 figure </td>
<td style="text-align:center;"> 25
2018 figure </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 35.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 21.00 </td>
<td style="text-align:center;"> 35.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 6/5 with PP bill </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 6/20 </td>
<td style="text-align:center;"> 40.75 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28.75 </td>
<td style="text-align:center;"> 40.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 35.00 CARS </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28.75 MOTORCYCLES </td>
<td style="text-align:center;"> 35.00 LIGHT TRUCKS </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 35.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 35.00 - 45.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 23.00 under 4000 27.00 4001lbs-6500lbs
29.00 6501lbs and over </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 23.00 under 4000 27.00 4001lbs-
6500lbs
29.00 6501lbs and over </td>
</tr>
<tr>
<td style="text-align:left;"> Prince William County </td>
<td style="text-align:center;"> WHEN THE TAX BILL IS DUE. MULTIPLE DUE DATES </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 12.00 </td>
<td style="text-align:center;"> 24.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> 10/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00
*See Below under others </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 32.50 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 32.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 5/31 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 20.00 - 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 1/1 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> 11/20 </td>
<td style="text-align:center;"> 23.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 23.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00
Trailers over 1499 lbs 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 for 2018 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 for 2018 </td>
<td style="text-align:center;"> 25.00 for 2018 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 28.00 Flat Rate </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 15.00 Flat Rate </td>
<td style="text-align:center;"> 23.00 Flat Rate </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 23.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 23.00 </td>
<td style="text-align:center;"> 23.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> Flat rate of 20 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Flat rate of 20 </td>
<td style="text-align:center;"> Flat rate of 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 30.00 Cars and light trucks-flat
30.00 Motor homes-flat </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 MC flat
TRAILERS GW > 1500
15.00 flat </td>
<td style="text-align:center;"> 30.00 flat </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 11/20 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 40.75 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28.75 </td>
<td style="text-align:center;"> 51.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 1205 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 06/25 </td>
<td style="text-align:center;"> 23.00 Registration fee only/no decal </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 Registration fee only/no decal </td>
<td style="text-align:center;"> 23.00 Registration fee only/no decal </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> for hire:
23.00 (weight to 4000 lbs.)
28.00 (over 4000 lbs.)
personal private: 33.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 21.00 </td>
<td style="text-align:center;"> 33.00 to 98.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 - < 13000 lbs; 30.00 - >13000 lbs
for vehicles only </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 3/1 </td>
<td style="text-align:center;"> 35 (<7500.1 lbs) </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28 </td>
<td style="text-align:center;"> 35 0-2000 lbs; 42.50 over 2000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 28.50 for up to 4000lbs.
33.50 over 4000lbs. </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.50 </td>
<td style="text-align:center;"> 28.50 for up to 4000lbs.
33.50 over 4000lbs. </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 23 0-4000 lbs; 28 over 4000 lbs </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8 </td>
<td style="text-align:center;"> 23 0 -4000 lbs.
28 4001 - 10000
35 10001 - 25000
60 25001 - 40000
80 40001 - 55000
125 55000 - 70000
150 over 70000 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 33 0-4000#
38 4000#+ </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18 </td>
<td style="text-align:center;"> 33 up to 4000#
38 4001 to 6500#
39 6501 to 9999#
41 10k to 10499
43 10500 to 11k
45 11k to 11.5
48 11.5k to 12k#
49 12k and up </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 30 up to 10000
lbs.
54 > 10000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 25-195 </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 0701 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 12.50 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> 33.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 10/5 </td>
<td style="text-align:center;"> Cars 33 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Motorcycle 28 </td>
<td style="text-align:center;"> 33 up to 4000 lbs.
45 over 4001 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 23 < 4000 lbs; 28 over 4000 lbs </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 29.00 - 45.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 05/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> 25.00 < 10000 lbs; 37.00 over 10000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 1/1-6/30= 35/4000 lbs & under; 40/over 4000 lbs </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1/1-6/30= 17 </td>
<td style="text-align:center;"> 1/1-6/30= Starting at 35 & higher by weight </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 40.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 13.5 </td>
<td style="text-align:center;"> 38.50-124.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 02/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 29.50 Empty weight < or equal 4000 34.50 Empty weight > 4000 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 21.00 </td>
<td style="text-align:center;"> 29.50-287.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> within 30 days of purchase </td>
<td style="text-align:center;"> 30.00 flat </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 16.00 flat </td>
<td style="text-align:center;"> 30.00 flat </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 29 Flat </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.25 Flat
moped 5 Flat </td>
<td style="text-align:center;"> 29 Flat Plus Schdule 1.45 per 1000 lbs over 15000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 26.00 0-4000 lbs; 31.00 4001-10001 lbs+0.20 per 100 lbs > 10000lbs </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> 26.00 <4000 lbs; 31.00 4001-10001 lbs +0.20 per 100 lbs over 10000 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 26 0-4000 lbs; 31 over 4000 lbs: 36 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 26-130 Trailer 11.50 - 17.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 10/15 </td>
<td style="text-align:center;"> 25 License Fee </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25 License Fee </td>
<td style="text-align:center;"> 25 License Fee </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 2/28 & 6/10 </td>
<td style="text-align:center;"> (treasurer) </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> (treasurer) </td>
<td style="text-align:center;"> (treasurer) </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 32.0 < 4000 lbs
37.00 over 4000 lbs </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> 32.00-250.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 40.74 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28.74 </td>
<td style="text-align:center;"> 40.74-250.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 5/31 </td>
<td style="text-align:center;"> 28.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 28.00-30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 5/31 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 16.00 </td>
<td style="text-align:center;"> 20.00 6500 lbs and under
24.00 6501 lbs-8000 lbs
32.00 8001 lbs - 11500 lbs
40.00 11501 lbs - 15500 lbs
56.00 15501 lbs - 19500 lbs
80.00 19501 lbs - 29500
100.00 29501 lbs - 39500 lbs
120.00 Over 39500 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 26 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 24 </td>
<td style="text-align:center;"> 26 0-4000
30 4001-10000
35 10001-25000
60 25001-40000
80 40001-55000
125 55001-70000
150 70001-99999 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> Same date as DMV registration renewal </td>
<td style="text-align:center;"> 30.00 0-4000 lbs 35.00 over 4000 lbs </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 23.00 </td>
<td style="text-align:center;"> 24.00 0-4000 lbs 29.00 4001-16000 30.80 16001-7000 32.10 17001 to 56000 pounds are 30.80
+ 1.30 per additional 1000 pounds as follows)
17001 - 18000 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00-60.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> 11/20 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 27 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 27 </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 12/05 annually </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 11.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> 12/6 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 22.50 - 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> 9/30 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> 1/15 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 12 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> 1/1 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 12.50 </td>
<td style="text-align:center;"> 29.50-34.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 03/31 </td>
<td style="text-align:center;"> 25.00 - Flat </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 - Flat </td>
<td style="text-align:center;"> 25.00 - Flat </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> 2/28 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 9 </td>
<td style="text-align:center;"> 18.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 11.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 31.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 31.00 </td>
<td style="text-align:center;"> 31.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> .00 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 04/15 </td>
<td style="text-align:center;"> 40.75 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 28.75 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 27 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 27 </td>
<td style="text-align:center;"> 27 </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 32.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28.75 </td>
<td style="text-align:center;"> 32.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 20.00 0-12000 lbs; 25.00 12001-19000lbs; 30.00 19000+ </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> 07/31 </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> 04/15 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> April 30 </td>
<td style="text-align:center;"> 30.00
12.50 Trailers </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> 03/15 </td>
<td style="text-align:center;"> 23.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 23.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> 11/20 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 25.00 over 10000 lbs. </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 24.00 </td>
<td style="text-align:center;"> 24.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 33 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 33 </td>
<td style="text-align:center;"> 33
trailers: 18 </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> 03/01 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> 20;
Trailer or semitrailer drawn by a motor vehicle: 10 </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 33 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 33 </td>
<td style="text-align:center;"> 33 </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> <6500 lbs.=25.00.;6500-10000=30.00.; 1.00/1000lbs > 10000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 11.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> 04/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 11/20 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 trailers 7.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 9 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 40.75 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 28.75 </td>
<td style="text-align:center;"> 40.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 16.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 15.00
decal permanent;
one-time fee </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> 25.00 - 32.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 12.00 </td>
<td style="text-align:center;"> 32.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 16.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 05/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 37 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 37 </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> 2/1 </td>
<td style="text-align:center;"> 23.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 23.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> 7/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> None </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00; 12.50 goes to Charlotte County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00;1/2 to County </td>
<td style="text-align:center;"> 25.00; 12.50 goes to Charlotte County </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> 20 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> 3/31 </td>
<td style="text-align:center;"> 25. </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25. </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> 01/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 12/12 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 10/5 - will be permanent decal in FY 2011 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> 11/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 16.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 6/05 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> 04/01 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 7.50 for Trailers </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> 12/15 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> 11/15 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> 01/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> 1/31 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 25
trailers: 10 </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> 11/15 </td>
<td style="text-align:center;"> 22 flat </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 flat </td>
<td style="text-align:center;"> 22 flat </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 27 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8 </td>
<td style="text-align:center;"> 27 </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 35.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 21.00 </td>
<td style="text-align:center;"> 35.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 04/01 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 25.00 < 20000lbs 30.00 in excess of 20000 lbs </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 27.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 27.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> 3/15 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> 12/31 </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> 2/28 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> 01/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> N/A </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 30 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 30 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 33.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 3/31 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> County requirements </td>
<td style="text-align:center;"> 10.00 portion from Sussex Co. </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 portion from Sussex Co. </td>
<td style="text-align:center;"> 15.00 portion from Sussex Co. </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 6/5 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 40.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 40.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> 10 </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 12/31 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> 6/15 </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 18 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> 2/15 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> 10/05 </td>
<td style="text-align:center;"> 33.00 equal or less than 4000 lbs
38.00 4001 lbs or more </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 5/31 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 25.00 -- 4001 lb or more in gross wt </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> 4/15 </td>
<td style="text-align:center;"> 27.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 27.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> 12/5 (To County) </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15 </td>
<td style="text-align:center;"> 25 </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 12/15 </td>
<td style="text-align:center;"> 12.50 over 65 25.00 regular </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 7.50 over 65 15.00 regular </td>
<td style="text-align:center;"> 12.50 over 65 25.00 regular </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 8.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> 08/05 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 15.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> 12/05 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 06/05 </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> 18.00 </td>
<td style="text-align:center;"> 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> 12/5 </td>
<td style="text-align:center;"> 20.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 10.00 </td>
<td style="text-align:center;"> 20.00 </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table15-2)Motor Vehicle Local License Tax Decal Display Policy and Exemptions Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Display Decals </th>
<th style="text-align:center;"> Special Exemptions Other Than Elderly and Disabled </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Firemen ( 1 vehicle) P.O.W (all vehicles exempt)DISABLED VET (1 VEHICLE) </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Disabled vets fire & rescue active military metal of honor </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire/rescue personnel nat'l guard active military and disabled vets </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire Dept Rescue squad POW disabled veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Military -Soley owned Active Duty Legal Res not VA in addition as provided by the SCRA Spousal vehicles when the Spouse is here as a non resident with the Active Duty member.
All Trailers.
DAV plated vehicles with VA DMV.
POW plated vehicles with VA DM </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No license tax for anyone </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire fighter with x number of hours
Disabled veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Vehicles with disabled veterans tags/ Fire & EMS members that qualify </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> do not have decal </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> disabled vets get 1 free decal </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veterans / Fire & Rescue /
Active military / POW / Virginia Defense Force </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire+Rescue Exempt-one per person
Sheriff & Sheriff's office active deputies-one per person </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> volunteer fire/rescue members disabled veterans POW </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Motor Vehicle licensing was repealed in 2007 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Fire & Rescue Members </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> For Fire Rescue Police and State Police one vehicle license tax exemption per employee living in Chesterfield County (volunteer & salaried) </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Fire/Rescue squads interstate apportioned trucks </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire Rescue Police; Disabled Veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans Emergency Services Members </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> POW Disabled Vets Military Fire & Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> vehicles with purple heart or disabled veteran tag </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Government Diplomat Military- absent from State Daily rental Tax Relief Disabled Veterans POW Medal of Honor National Guard Antique Motor Volunteer Rescue Squads Active Members of Rescue Squad Volunteer Fire Department Auxiliary Police
Auxiliary Police C </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire/Rescue volunteers
Active duty military
Public safety
Apportioned vehicles
Farm vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans Police Rescue and Firefighters (one vehicle per individual) </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Public Safety Active Military Disabled Vet </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> disabled DMV tag for a veteran All POW's National Guard or medal of Honor (state issued); public safety and all government vehicles apportion plates on trucks in excess of 10000 pounds </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> disabled vets; fire or rescue volunteers; </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> DISABLED VET PRISONER OF WAR FIRE AND RESCUE ANTIQUE VEHICLES </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire department and rescue squad members; disabled veterans and POW'S </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> emergency services personnel </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire&rescue County vehicles nat'l guard </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veterans volunteer firemen prisoners of
war & any gov't agency </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans/Farm Vehicles/Medal of Honor/POW's/Military personnel if their home of record is outside of Virginia and antique vehicles not used for general transportation. </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> DISABLED VETS OR POW </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> public safety </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> POW Dis. Vets Vol. Fire/Police/Rescue; paid law enforcement officer and EMS officer </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> FIRE AND RESCUE; ACTIVE DUTY MILITARY; NATIONAL GUARD;VETERAN </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire & rescue squad member: 1 per person; Medal of Honor recipients; Farm use vehicles w/o plates; Free Perm decal: landfill use EMS Volunteers-one per household </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue volunteers </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Only Disabled Veterans active members of Fire & Rescue Departments Prisoners-of-war </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Churches non profits inder 503C </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Fire and Rescue Volunteers; Fire and Rescue Auxiliary Members; Deputy Sheriff Auxiliary Members and paid employee service fields-deputies fire and rescue etc. </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veterans
Local Fire & Rescue Volunteers that are certified by the County Fire Chief </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire/Rescue Squad Members
national guard
Police/Sheriff & Deputies
Professional Firefighters </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> DISABLED VETERANS POW </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Rescue squad & Fire Dept. get 1 vehicle with no fee </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> volunteer firemen
100% Service Related Disabled Veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue; National Guard </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1 per family fire & rescue.
1 per disabled veteran tag. </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire Department Rescue Squad Auxiliary Police disabled veteran POW 1/2 for national guard </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> DISABLED VETERAN 100% SERVICE CONNECTED </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1 vehicle decal fee for each volunteer rescue squad and fire dept. member; antique vehicles are exempt disabled veterans; 1 vehicle tax per members of volunteer rescue squad and fire dept. </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> starting 2018 we are now doing license fee no more decals </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Public Safety Disabled Tags Veteran Tags Antique Tags </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Tax exempt organizations
If disabled Vet licensed tags exempt </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veterans Fire/rescue squad members </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> COUNTY HAS REPLACED DECALS WITH A VEHICLE FEE THAT IS ASSESSED ON PERSONAL PROPERTY BILL AT 35.00 PER VEHICLE. FIRE & RESCUE SQUAD MEMBERS & DISABLED VETS GET ONE VEHICLE FREE OF THE 35.00 CHARGE. HANDICAPPED WITH MODIFIED VEHICLE ALSO ARE EXEMPT FROM THE </td>
</tr>
<tr>
<td style="text-align:left;"> Prince Edward County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans; Fire & Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> Pr<NAME>orge County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> volunteer fire emergency crew & volunteer police disabled veterans antique vehicles military </td>
</tr>
<tr>
<td style="text-align:left;"> Pr<NAME>illiam County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> military handicap disable vet antique fire & rescue fire aux national guard </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1 free per rescue squad memher.1 free per firefighter. If you have a DV state tag you get a free decal. *We charge 10.00 for trailers if they have brakes and have to be inspected. We put license on PP Statements every year. </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire and rescue volunteers </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> antique owners
1 personal vehicle of fire dept or rescue squad
member </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> disabled veterans on 1 vehicle </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans Fire and Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Antique Vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> POWs Disabled veterans volunteer fire/rescue get 1 vehicle exempted. </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire department rescue squad - one vehicle per person
Disabled American Vet for one vehicle per person defined in Code of VA </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Military; Fire & Rescue;farm use vehicles; disabled veteran </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire & rescue volunteers </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -fire & rescue volunteers vehicles.
-disabled veterans with disabled license plates tags (1 per tax payer).
- Sheriff's Office volunteer citizen </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veterans and members of volunteer fire and rescue. </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> public safety & disabled vets </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Disabled Veterans and Unregistered Vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> emergency services (1 VH) antique vehicles untagged farm use/disabled veterans-1VH/prisoners of war 1VH/national guard discounted-1VH. </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veterans volunteer fire fighters rescue squad members and POW </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & rescue antique vehicles
disabled vets and discount for national guard. </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> veterans firefighters emt's </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer York County Firemen
Military(non-residents & spouse)
Disabled American Vets
Vehicles with POW tags
Antique Vehicles
1 Vehicle per qualifying Disabled American Veteran
Vehicles garaged on Exclusive Jurisdiction property
Daily Rental Vehicl </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> members of congress diplomats active-duty military disabled veterans POWs </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> disabled veterans who have dv tags on their vehicles do not pay a decal fee. </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> veterans military </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue volunteers as certified by house captains </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> vehicles exempt under 46.2-755; Disabled Veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veterans with disabled vet license plates; volunteer fire; police; antique cars </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans - One Free
Prisoner of War - Free
National Guard 1/2 Price </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> rescue (1/2 off) </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> volunteer fire and rescue squads - one decal fee
exempted </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Public Safety - Military - Students </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> active military in either person's name with LES & military ID proof; IRS 501-C3 tax exempt vehicles diplomats </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer firemen disabled veterans & POW's </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Fire Department members two vehicle limit </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans POWs Military and Antique </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1 vehicle active Rescue Squad and Volunteer Fire-Free; POW Free;1 vehicle Disabled Vets-Free; National Guard 1/2 price; Dealer tags; inoperable and unlicensed vehicle; and daily rental vehicle </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1 vehicle for: military member Natl/VA Guard member Hopewell Emergency crew member antique city vehicles Disabled Veteran </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> N/A No MVL </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> 1 vehicle owned by POW Disabled Veteran Purple Heart and 1/2 fee National Guard. </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> public safety; antique cars; handicapped-equipped vehicles; non-resid. military </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Police & military & disabled veterans & rental vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Motor Vehicle licensed by another locality.
Motor vehicle used by nonresident for business.
Motor vehicle owned by nonresident officer or employee of the Commonwealth.
Motor vehicle kept by dealer for sale or sales demonstrations. </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veteran State Tags </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> DAV - 1 Vehicle; Military w/out-of-state domicile </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire Department ((1) Vehicle
Rescue Squad (1) Vehicle </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Military ( Non-resident)and
Disabled Veterans are exempt
Antique Vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> disabled veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled veteran POW purple heart tags.
Lifetime member of volunteer rescue squad </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> The City of Staunton eliminated the decal tax in 2011. </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Exempt: Antique plates Auxiliary Police/Fire/Rescue Common Carriers Disabled Vets Military Members (not domiciled in Va) Permanent Trailer Plates Disabled Veterans
1/2 Price: Farm Use Plates National Guard Plates </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteers: Aux Sheriff Aux Police Police Chaplains Rescue Squad & Fire. Disabled Vets Military with out of state home of record or if registration not required by VA Code </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans
Local Fire and Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire & rescue nat'l gd. some vets POW </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Active members of Public Safety </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Fire </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Antique Automobiles </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> public safety; national guard and active duty military </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire Department
POW </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> We offer 1/2 off a decal for 65 and older. We offer 1 free decal to Volunteer Fire Fighters. </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire/Rescue members
No longer issue decals County adds it to the personal property taxes for us </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Those with disabled veteran license plate and local fire and rescue with appropriate forms </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> military </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Decals no longer required </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Volunteer Fire and EMS Members who are Town residents </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer firemen volunteer rescue squad members disabled veterans registered antique vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled Veterans + Prisoners of War </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Active Volunteer Fire/Rescue member Clergy and Church vans
elected town council members
disabled veterans which have received a disabled veteran exemption from DMV
antique vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Fire + Rescue and Disabled Vets </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Rescue Squad (1 vehicle); fire Dept. (1 vehicle) </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Fire Department and rescue squads </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> fire dept. members; rescue squad members; POW/MIA; National Guard </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> volunteer firefighters </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Fire & Rescue personnel </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> volunteer fire department </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> fire/rescue and auxiliary police members; clean special fuels as defined in State 46.2-749.3; 65 and over receive 50% discount </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Fire Company First Aid </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Rescue & Fire </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Fire & Rescue qualified volunteers </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> free to residents 65 and older Police Firefighters and Military personnel. </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Search & Rescue Fire dept. Disabled vet. </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Public safety; honorably discharged veterans. </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> public safety </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire Dept Rescue Squad Active duty military </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Firefighters and veterans receive exemption for one vehicle per household. </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> public safety volunteers </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Fire & Rescue Volunteers Active Military </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> DAV fire & rescue personnel </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> rescue & fire volunteer </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Fire and Rescue Active Duty Military </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Exempt public safety volunteer's vehicle </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Disabled vets that have a disabled tag. </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire + Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Active Duty Military: 1 </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Onancock Volunteer Fire Fighters receive one free vehicle decal and one free trailer decal. </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> PUBLIC SAFETY; ANTIQUE VEHICLES DISABLED VETERANS ACTIVE DUTY MILITARY </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue Volunteers </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Volunteer Fire Department
Elderly receives one decal at 50% off </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Fire Department </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer fire department and volunteer rescue squad members </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Active Military Fire Company Rescue Squad </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Public safety-one vehicle for fire rescue and police. </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disables Veterans </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> County requirements </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire/Rescue: 1 per member that qualifies with Shenandoah County Fire and Rescue. </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Disabled if they have a handicap license plate (does not apply to handicap hang tag) </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire rescue personnel and alternative fuel vehicles </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> military veterans fire and rescue personne </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Public safety </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Police fire fighters and auxilary police </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire and EMS Members that live in Town we allow an exemption on one vehicle </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Fire & Rescue (one vehicle per volunteer) </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Volunteer Fire Department </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Military Fire/Rescue Disabled Vets. </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Council eliminated vehicle decals effective 7/1/14 </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> volunteer fire and rescue squad members get one free decal </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
[^15-1]: The *Code* refers to school district rather than school division. Colonial Beach and West Point are the only towns that have school divisions.
<file_sep>/_book/17-natural-resources.md
# Taxes on Natural Resources
Taxes on natural resources are rarely used by localities because many are not endowed with such resources. As a consequence, natural resources taxes accounted for less than 0.1 percent of total city tax revenue in fiscal year 2018, 0.2 percent of total county tax revenue, and less than 0.1 percent of total tax revenue of large towns, according to information from the Auditor of Public Accounts. These are averages; the vast majority of localities receive no revenue from this source. All the exceptions are located in Southwest Virginia. For information on individual localities, see Appendix C.
Localities are permitted to impose several taxes on natural resources. **Table 17.1** provides tax rates for the cities and counties having such natural resource-related taxes in effect during the 2019 tax year.
## TAXATION OF MINERAL LANDS
Under § 58.1-3286 of the *Code of Virginia*, localities are required to “...specially and separately assess at the fair market value all mineral lands and the improvements thereon...” and enter those assessments separately from assessments of other lands and improvements. Mineral lands are taxed at the same rate as other real estate in the locality. Localities may request technical assistance from the Virginia Department of Taxation in assessing mineral lands and minerals, provided money is available to the department to defray the cost of the assistance (§ 58.1-3287). Instead of employing the real property tax for mineral lands, localities are permitted to substitute a severance tax on mineral sales, not to exceed 1 percent.
In 2009, this section was amended to allow Buchanan County to reassess mineral lands on an annual basis for purposes of determining the real property tax on such land. Other real estate is still subject to assessment every six years. Currently, 2 cities and 23 counties report assessing taxes on minerals. Among the several that commented on their mineral tax, most stated they used the land assessment method. The city of Norton, however, stated that its tax was based on a loading tax of $0.05/ton.
## SEVERANCE TAX
Under § 58.1-3712, any city or county may levy a license tax on businesses engaged in severing coal and gases from the earth. The maximum rate permitted is 1 percent of the gross receipts from sales. A 2012 bill reduced the rates of the local coal severance tax for small mines from 1 percent to 0.75 percent of the gross receipts from the sale of coal. “Small mine” is defined here as a mine that sells less than 10,000 tons of coal per month.
Localities choosing to use § 58.1-3712 may not exercise the option to levy a 1 percent severance tax under § 58.1-3286. Under § 58.1-3712.1, the maximum rate permitted for severing oil is one-half of 1 percent from the sale of the extracted oil. Notwithstanding the rate limits established in § 58.1-3712, cities or counties may impose an additional license tax of 1 percent of the gross receipts from the sale of gas severed as authorized by § 58.1-3713.4. The funds from this additional levy are paid into the general fund of the localities except for members of the Virginia Coalfield Economic Development Fund, where one-half of the revenues must be paid to the fund. The members of the fund are the counties of Buchanan, Dickenson, Lee, Russell, Scott, Tazewell, and Wise and the city of Norton.
## COAL AND GAS ROAD IMPROVEMENT TAX
Notwithstanding the rate limits described in the previous paragraph, localities are permitted by § 58.1-3713 to levy up to an additional 1 percent license tax on the gross receipts of coal and gas extracted from the ground. As with the severance tax on coal, the coal road improvement tax has been modified to reduce the tax from 1 percent to 0.75 percent for small mines. This tax was originally scheduled to end in 2007, but the General Assembly extended the sunset clause a number of times, most recently to December 31, 2017.
The amount collected under this tax must be paid into a special fund to be called the Coal and Gas Road Improvement Fund of the particular county or city where the tax is collected. In addition, “the county may also, in its discretion, elect to improve city or town roads with its funds if consent of the city or town council is obtained.” One-half of the revenue paid to this fund may be used for the purpose of funding the construction of new water systems and lines in areas of insufficient natural supply of water. Those same funds may also be used to improve existing water and sewer systems. Localities are required to develop and ratify an annual funding plan for such projects. Under § 58.1-3713.1, 20 percent of the funds collected in Wise County are distributed to the six incorporated towns within the county’s boundaries (Appalachia, Big Stone Gap, Coeburn, Pound, Saint Paul, and Wise) and the city of Norton. The distribution is determined as follows: (a) 25 percent is divided among the incorporated towns and the city of Norton based on the number of registered motor vehicles in each town and the city of Norton, and (b) 75 percent is divided equally among the towns and the city of Norton. The Coal and Gas Road Improvement Advisory Committee in the city of Norton and county must develop a plan before July 1 of each year for road improvements for the following fiscal year. For localities in the Virginia Coalfield Economic Development Authority (Lee, Wise, Scott, Buchanan, Russell, Tazewell, and Dickenson counties and the city of Norton), the receipts from this tax are distributed as follows: three-fourths to the Coal and Gas Road Improvement Fund and one-fourth to the Virginia Coalfield Economic Development Fund. The purpose of this fund is to enhance the economic base for the seven counties and one city in the authority.
<file_sep>/99-references.Rmd
# References {-}
```{r, include=FALSE}
knitr::write_bib(c(.packages(), "bookdown"), "packages.bib")
```
This online edition of the *Virginia Local Tax Rates* survey report was prepared with the **bookdown** package [@R-bookdown], which is built on top of R Markdown and **knitr** [@xie2015] using the R programming language [@R-base].
<div id="refs"></div><file_sep>/_book/19-misc-taxes.md
# Miscellaneous Taxes 2018
This section includes a number of taxes and exemptions that are not covered in the previous sections: the local option sales and use tax, the bank franchise tax, the communication sales and use tax, the short-term (daily) rental tax, and other miscellaneous taxes. The local option sales tax has been adopted by every city and county and, by law, all use the same tax rate. Also, as explained below, counties must share a portion of sales tax collections with incorporated towns within their boundaries. Wherever the bank franchise tax is imposed, the rate is the same. In addition to those major taxes, this section covers the communications sales and use tax and other miscellaneous taxes for which information was provided on the survey form when local governments were asked to specify any miscellaneous taxes that fell outside the scope of the survey questions.
## LOCAL OPTION AND STATE SALES AND USE TAXES
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the local option sales and use tax accounted for 8.0 percent of local tax revenue for cities, 6.4 percent for counties and 9.2 percent for large towns. These are averages; the relative importance of taxes in individual cities, counties and towns may vary significantly. For information on individual localities, see Appendix C.
Each city and county is permitted by § 58.1-605 to establish a general retail sales tax, “at the rate of 1 percent to provide revenue for the general fund of such city or county.” This tax applies to dealers with a retail presence in Virginia. Sales of any items from such operations incur the 1 percent sales tax. Sales tax monies are then collected by the Virginia Department of Taxation and sent to the Department of the Treasury. That agency credits the accounts of the localities where the sales occurred and disburses the monies to the localities on a monthly basis (§ 58.1-605.F).
Cities and counties are also permitted to establish a local use tax at the rate of 1 percent for the purpose of providing revenue to the general fund of the locality. The use tax is similar in purpose to the retail sales tax, but its aim is somewhat distinct: it applies to dealers that do not have a physical retail presence in Virginia. It is a tax levied on the use of tangible personal property within the state that has been stored or sold out-of-state.
Special distribution requirements apply to counties with incorporated towns (§ 58.1-605.G). Where the town constitutes a special school division and is operated as a separate school division under a town school board[^19-1], the county is required to pay to the town a proportionate share of the full amount of tax receipts based on the school age population within the town compared to the school age population in the entire county. If the town does not constitute a separate school division, then one-half of county collections is distributed to the town based on the proportion of the school age population within the town to the school age population of the entire county, provided the town complies with certain conditions.
Certain items are exempted from the state sales and use tax and may be exempted from the local option sales and use tax also. Each locality is permitted by § 58.1-609 to exempt fuels meant for domestic consumption from the 1 percent component of the tax. These fuels include artificial or propane gas, firewood, coal, or home heating oil. Only 11 localities answered that they exempted such fuels from the tax. The localities were the counties of Alleghany, Campbell, Madison, Patrick, Pittsylvania, Prince George and Washington and the cities of Chesapeake, Covington, Harrisonburg, and Portsmouth.
The state portion of the sales and use tax was raised from 4 percent to 4.3 percent effective July 1, 2013. House Bill 2313, Chapter 766, further increased the amount by an additional 0.7 amount for localities in the Northern Virginia and Hampton Roads planning districts. The additional taxes do not apply to food purchased for human consumption. The Northern Virginia Planning District consists of the counties of Arlington, Fairfax, Loudoun, and Prince William and the cities of Alexandria, Fairfax, Falls Church, Manassas, and Manassas Park. The Hampton Roads Planning District consists of the counties of Isle of Wight, James City, South-ampton, and York and the cities of Chesapeake, Franklin, Hampton, Newport News, Norfolk, Poquoson, Portsmouth, Suffolk, Virginia Beach, and Williamsburg. The purpose of this additional state tax is to fund the Northern Virginia Transportation Authority and the Hampton Roads Construction Fund, respectively. Consequently, the new sales and use rate is made up of a 1.0 percent local tax rate as well as a 4.3 state tax rate for most localities and a 5.0 percent state tax rate for localities associated with transportation commissions.
## STATE MOTOR FUELS TAX ON DISTRIBUTORS
An additional state tax that applies only to specific localities is the fuel distribution license tax. It is a state tax on distributors of motor fuels to retailers in qualifying localities. Under § 58.1-2295 a state tax of 2.1 percent may be imposed on any distributor in a qualifying locality in the business of selling fuels at wholesale to retail dealers for retail sale within the qualifying locality. To be eligible a locality must be: (i) any county or city that is a member of a transportation district in which a rail commuter mass transport system and a bus commuter mass transport system are owned or operated by an agency as defined in § 15.2- 4502, or (ii) any county or city that is a member of a transportation district subject to § 15.2- 4515 and is contiguous to the Northern Virginia Transportation District. In addition, § 58.1-1722 excludes the amount of the tax imposed and collected by the distributor from the distributor’s gross receipts for purposes of BPOL taxes imposed under Chapter 37 (§ 58.1-3700 et seq.).
The 2.1 percent state tax is imposed in 11 localities that belong to two transportation commissions. The Northern Virginia Transportation Commission (NVTC) consists of Fairfax, Loudoun, and Arlington counties and Alexandria, Fairfax, and Falls Church cities. The tax helps provide financial support for the activities of the Washington Metropolitan Area Transit Authority (WMATA), also known as Metro, and the Virginia Railway Express (VRE), the commuter line between Washington D.C. and Manassas and Fredericksburg. The other commission, the Potomac and Rappa-hannock Transportation Commission (PRTC), consists of three cities (Fredericksburg, Manassas, and Manassas Park), and two counties (Prince William and Stafford). It provides support to rail transport (VRE) in the affected counties and bus services originating in Prince William County through Omniride and Omnilink.
House Bill 2313, Chapter 766, authorized the state tax in certain localites in the Hampton Roads Planning District. These are the counties of Isle of Wight, James City, Southampton, and York, and the cities of Chesapeake, Hampton, Franklin, Newport News, Norfolk, Suffolk, Virginia Beach, Williamsburg, Poquoson, and Portsmouth. The tax began on July 1, 2013.
## BANK FRANCHISE TAX
The bank franchise tax, also known as the bank stock tax, accounted for 0.7 percent of city tax revenue in fiscal year 2018, 0.5 percent of county tax revenue, and 4.2 percent of the tax revenue of large towns. These are averages; the relative importance of taxes in individual cities, counties, and towns may vary significantly. For information on individual localities, see Appendix C.
The state of Virginia levies a bank franchise tax on all banks in Virginia at a rate of \$1 on each $100 of net capital (§ 58.1-1204). Net capital is defined and its computation explained in § 58.1-1205. According to this section, net capital is determined by adding together a bank’s capital, surplus, undivided profits, and one half of any reserve for loan losses net of applicable deferred tax to obtain gross capital and deducting therefrom (i) the assessed value of real estate as provided in § 58.1-1206, (ii) the book value of tangible personal property under § 58.1-1206, (iii) the pro rata share of government obligations as set forth in § 58.1-1206, (iv) the capital accounts of any bank subsidiaries under § 58.1-1206, (v) the amount of any reserve for marketable securities valuation which is included in capital, surplus and undivided profits as defined hereinabove to the extent that such reserve reflects the difference between the book value and the market value of such marketable securities on December 31 next preceding the date for filing the bank’s return under § 58.1-1207, and (vi) the value of goodwill described under subdivision A 5 of § 58.1-1206.
Cities (§ 58.1-1208), counties (§ 58.1-1210), and incorporated towns (§ 58.1-1209) are permitted to charge an additional franchise tax of 80 percent of the state rate of taxation. If a locality imposes the local tax, then a bank is entitled to a credit against the state franchise tax equal to the total amount of local franchise tax paid (§ 58.1-1213). All localities that impose the bank franchise tax do so at the maximum rate allowed by statute.
If a bank has branches in more than one taxable subdivision (that is, city, county, or incorporated town), the tax imposed by the subdivision must be in the proportion of the taxable value of the net capital based on the total deposits of the bank or banks located inside the taxing subdivision to the total deposits in Virginia of the bank as of the end of the preceding year (§ 58.1-1211).
The survey asked whether a locality levied a bank tax. Of those localities that answered, all cities, 85 counties, and 108 towns answered affirmatively. The number of counties responding positively contrasts with the number of counties that reported receiving money from the tax in the Auditor of Public Accounts’ Comparative Report. The reported disparity may be because a number of counties answered positively for having the tax when they actually only processed forms for towns having the tax. A list of localities that reported imposing the tax can be found in **Table 19.1**.
## COMMUNICATIONS SALES AND USE TAX
In 2006, legislation enacted by the General Assembly, House Bill 568, replaced many state and local taxes and fees on communications services with a flat 5 percent rate. The tax is collected from consumers by their service providers and is then remitted to the Virginia Department of Taxation. The department then distributes the monies to the localities on a percentage basis derived from their participation in the local taxes which the new fl at tax superseded. The communication sales and use tax is a state tax not a local tax. Beginning in FY 2010 the Auditor of Public Accounts reported the proceeds as part of noncategorical state aid to localities.
The communications sales and use tax replaced a variety of local taxes: the consumer utility tax on land line and wireless telephone service, the local E-911 tax on land line telephone service, a portion of the BPOL tax assessed on public service companies by certain localities that impose the tax at a rate higher than 0.5 percent, the local video programming excise tax on cable television services, and the local consumer utility tax on cable television service.
The communications sales and use tax does not affect several related taxes: the state E-911 fee on wireless telephone service; the public rights-of-way use fee on land line telephone service; and the local tax of 0.5 percent on public service companies (also called the utility license tax).
**Table 19.2** presents a listing of the localities that received distributions from the communications sales and use tax in fiscal year 2018. The information was taken from Table 5.6 of the Virginia Department of Taxation’s Annual Report, Fiscal Year 2018, the latest year available.
## SHORT-TERM DAILY RENTAL TAX
In 2010 the General Assembly modified short-term rental property classifications. Short-term rental property can once again be included in merchants’ capital as a separate classification. Consequently, localities may tax this property either as merchants’ capital or short-term rental property, but not as both. Whether considered under the merchants’ capital tax or the short-term property tax, the category of property shall not be considered tangible personal property for purposes of taxation.
The new law maintains the usual exclusions. Therefore, the category of short-term rental property still excludes “(i) trailers as defined in § 46.2-100, and (ii) other tangible personal property required to be licensed or registered with the Department of Motor Vehicles, Department of Game and Inland Fisheries, or Department of Aviation (§ 58.1-3510.4).” The most important exception listed is motor vehicles for rent. These fall under the merchants’ capital tax as a separate classification, discussed in Section 8.
For purposes of taxation under the short-term rental tax, property is classified into two types: short-term rental property and heavy equipment short-term rental property (§ 58.1-3510.6). Short-term rental property may be taxed at 1 percent of gross receipts. Heavy equipment short-term rental property may be taxed up to 1.5 percent of gross receipts. **Table 19.3** lists the 20 cities, 19 counties, and 2 towns that reported having the short-term rental tax.
```r
#Table 19.1 "Localities Reporting That They Levy a Bank Franchise Tax, 2019", goes here
#Table 19.2 "Localities Receiving Communications Sales and Use Tax Distributions, FY 2018"
#Table 19.3 "Short-Term Daily Rental Tax, 2019*" goes here
```
<table>
<caption>(\#tab:table19-1)Localities Reporting That They Levy a Bank Franchise Tax Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:left;"> </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:left;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:left;"> Yes </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table19-3)Short-Term Daily Rental Tax Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Daily Rental Tax Rate (%), Light Equipment </th>
<th style="text-align:center;"> Daily Rental Tax Rate (%), Heavy Equipment </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 2.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince Edward County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 0.5 </td>
<td style="text-align:center;"> 0.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 0.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 5.0 </td>
<td style="text-align:center;"> 5.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> 1.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 1.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
[^19-1]: The *Code* refers to school districts. The Virginia Department of Education refers to school divisions. Colonial Beach and West Point are the only towns with school divisions. Obviously, the *Code* is referring to those towns.
* As noted in the text for Section 19, the tax excludes motor vehicles for rent.
<file_sep>/02-real_property.md
# Real Property Tax in 2019
The real property tax is by far the most important source of tax revenue for localities. In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, it accounted for 55.5 percent of tax revenue for cities, 64.6 percent for counties, and 29.1 percent for large towns. These are averages; the relative importance of taxes in individual cities, counties, and towns varies significantly. For information on individual localities, see Appendix C.
The *Code of Virginia*, §§ 58.1-3200 through 58.1-3389, authorizes localities to levy taxes on real property (land, including the buildings and improvements on it). There is no restriction on the tax rate that may be imposed. Section 58.1-3201 provides that all general reassessments or annual assessments shall be at 100 percent of fair market value.
## PUBLIC SERVICE CORPORATIONS
Property owned by so-called public service corporations is not assessed by localities. Instead, that task is delegated to the State Corporation Commission (SCC) and the Department of Taxation.The State Corporation Commission assesses electric utilities and cooperatives, gas pipeline distribution companies, public service water companies, and telephone and telegraph companies. The Department of Taxation assesses pipeline transmission companies and railroads.
In fiscal year 2018, the property tax on public service corporations accounted for 1.7 percent of tax revenue for cities, 2.6 percent for counties, and 0.8 percent for large towns. These are averages; the relative importance of the tax in individual cities, counties, and towns varies significantly. In two counties with large power generating facilities the property tax on public service corporations accounts for a very large share of local tax revenue. In Bath County the share was 47.6 percent and in Surry County the share was 61.1 percent. For more information on individual localities, see Appendix C.
The commissioner of the revenue or another designated official in each city or county is required to provide by January 1 of each year to any public service company with property in its area a copy of the property boundaries of the locality in which any part of the company is located (§ 58.1-2601). The State Corporation Commission or the Department of Taxation send out their assessments for the property based on these boundaries (§ 58.1-2602). Localities examine the assessments to determine their correctness. If correct, the locality determines the equalized assessed valuation of the corporate property by applying the local assessment ratio prevailing in the locality for other real estate (§ 58.1-2604). Local taxes are then assigned to real and tangible personal property at the real property tax rate current in the locality (§ 58.1-2606).
## TAX RELIEF PROGRAMS
There are several types of locally financed tax relief programs available. Section 3 of this study contains information on so-called circuit breaker plans for the elderly and disabled. Section 4 covers land use assessments for agricultural, horticultural, forestal, and open space real estate. Section 5 contains information on preferential assessments for agricultural and forestal districts. Finally, Section 6 covers property tax exemptions for certain rehabilitated real estate and other exemptions.
Only the city of Charlottesville, Loudoun County, and Arlington County reported providing tax relief for low-income owners and renters who are not elderly. The city of Charlottesville administers the Charlottesville Housing Affordability Program (CHAP) to help low and middle income homeowners. The program awards grants up to \$1,000 to homeowners with houses assessed at less than \$375,000 and having an annual income less than \$55,000.[^02-1] Loudoun County administers the Affordable Dwelling Unit Program for renters and first-time buyers. Buyers need an income greater than 30 percent but less than 70 percent of the area median income to participate. Qualified renters are eligible to rent apartments at rates from \$630 to \$1,300. Arlington County’s Housing Grants Program is available to working families with at least one child under age 18. Personal assets may not exceed \$35,000 and there is an income limit based on household size.
Localities are permitted to institute deferral for a portion of the real estate tax by § 58.1-3219 of the *Code of Virginia*. Localities are permitted to grant deferrals from the full amount by which each taxpayer’s real estate tax levy exceeds 105 percent of the previous year’s tax, or such higher percentage adopted by the locality. Deferred taxes are subject to interest in an amount established by the governing body, not to exceed the rate published by the IRS code.[^02-2] The deferral potentially applies to every property owner, not just the elderly and disabled. (For deferrals limited to the elderly and disabled see Section 3 of this study.)
The deferral program is rarely used. Administrative problems appear to be the major reason for the unpopularity of deferral programs. Loudoun County had a deferral program in place in the 1990s but terminated it “… because the program was administratively complex, cumbersome and required staff time in disproportion to the benefit received by the taxpayer.”[^02-3] The cities of Alexandria, Falls Church, and Fairfax and the counties of Fairfax and Henrico considered deferral but did not adopt it. According to Henrico staff, “The administrative procedures for tracing the properties and recovering the relevant taxes upon either the death of the owner or transfer of the property itself would be both cumbersome and time consuming and could not be accomplished with existing staffing levels or existing computer systems.”[^02-4] Another reason for the unpopularity of the programs may be that taxpayers only receive postponement, not removal, of the tax liability. The cities of Charlottesville and Richmond, the county of Middlesex, and the town of Amherst were the only localities reporting a deferral program in 2019.
## STATUTORY RATES, SPECIAL TAXES, DUE DATES, PRORATION, AND BILLING PRACTICES
**Table 2.1** provides general information associated with real property taxes in Virginia’s localities. The table provides an estimate by locality of both the number of total taxable real estate parcels and the number of residential parcels. Twenty-seven cities, 80 counties and 52 towns provided estimates of one or both types of parcels. The total number of parcels in cities ranged from a high of 158,431 (Virginia Beach) down to 2,456 (Lexington). Among counties, the number of parcels ranged from a high of 354,687 (Fairfax) down to 3,940 (Highland).
Table 2.1 also lists the statutory (nominal) tax rates. The statutory rate is the rate used by localities and is applied to the assessed value of a property. In the table, statutory rates are listed under calendar year (CY) or fiscal year (FY) columns depending on the locality’s assessment cycle. In most cases the calendar year tax rate listed runs from January 1 to December 31 and the fiscal year rate runs from July 1 to June 30. The provisions explaining the assessment cycle requirements are found in § 58.1-3010 and § 58.1-3011 of the *Code of Virginia*. However, some localities report a calendar year assessment schedule with a fiscal year valuation. Six cities (Chesapeake, Harrisonburg, Martinsville, Roanoke, Salem, and Suffolk) and one county (James City) report this practice. Otherwise, 15 cities and 88 counties reported using the calendar year cycle while 176 cities and 6 counties used fiscal year assessment cycles.
The statutory tax rates were reported to the Cooper Center by all cities and counties and 112 of the responding towns. The text table below lists the averages for the statutory rates from the localities.
```r
#table name: Statutory Real Estate Tax Rates per $100 of Assessed Taxable Value for Localities Reporting, CY 2019 and FY 2020
```
Statutory rates are generally higher for cities than counties. The rates are lowest in towns because they are subordinate to counties and have limited responsibilities.
Tax due dates vary among localities. Generally, if taxes are paid annually, they are due by December 5. If paid semiannually, they are due by June 5 and December 5. However, some localities have different due dates, as provided by § 58.1-3916 of the *Code*.
Most cities have semiannual tax due dates with payments required in June and December. Of the 38 cities, 2 required taxes due annually, 31 semiannually, and 5 quarterly. Among the counties, 32 had annual tax due dates, while 63 had semiannual requirements. Of the towns responding to this question, 80 reported annual due dates, and 32 required semiannual payments.
A locality is permitted to prorate the taxable amount. Any county, city, or town electing to prorate new buildings which are substantially complete prior to November 1 must do so at the time the building is complete or fit to live in. Of the 38 cities, 33 reported prorating taxes while 5 reported not doing so. Among counties, 67 prorated their taxes while 28 did not. Reports from the towns that answered this question indicated that 47 prorated their taxes while 652 did not.
The final column of Table 2.1 pertains to town billing practices. Three possibilities exist: (1) a town sends out its own bills and collects its taxes (TT in the table), (2) a town collects its taxes but the county sends the bills (CT in the table), or (3) a town has the county bill and collect the taxes (CC in the table). Of the towns that answered the question, the overwhelming majority, 100, reported billing and collecting their own taxes. Four said they collected taxes, while in three the county both billed and collected town taxes.
**Table 2.2, Table 2.3,** and **Table 2.4** provide additional information concerning statutory real property tax rates. The *Code* allows localities to add special purpose levies on top of the real property rate for various purposes. Table 2.2 deals with the category of special districts. A special district is organized to perform a single governmental function or a restricted number of related functions. Special districts usually have the power to incur debt and levy taxes to fund special activities such as capital improvements, emergency services, sewer and water services, or pest control within those districts. Thirteen cities, 14 counties, and 4 towns reported levying these taxes. The table includes the base (statutory) rate for the locality, the district in which the activity takes place, the purpose of the activity, and the special rate imposed for that activity. Most special activity taxes are in addition to the base rate, though some are simply a flat fee, and others are a percentage rate based on improvements to the property.
Another special district category is the community development authority (CDA). Such an authority is a district created by the locality based on a petition from the property owners to help develop and maintain desired public infrastructure improvements, such as roads and buildings. The CDA is usually associated with development interests, such as retail centers, industrial centers, or tourism centers. Generally the CDA pays for development by issuing bonds and then having the property owners pay special assessments based on the level of debt. Assessments are levied either by placing a tax, such as \$0.25 per \$100 of assessed value, on the property within the district or by a special assessment each year that determines the benefit from the improvements and allocates them by property value. Depending on how the bond agreement is structured, assessment payments may be made directly to bondholders or to the locality. Table 2.3 lists community development authorities by locality. The table includes the name of the project, the purpose, the size, the bond amount, and, where possible, the current value. Three cities and 8 counties reported having CDAs.
The final category of special districts is that of localities within the Northern Virginia Transportation Authority. Localities within this authority have the ability to tax real property associated with industrial and commercial use up to \$0.125 per \$100 of assessed value to help fund transportation improvements. In 2009, an amendment to § 58.1-3221.3 specified that the revenues generated by the tax were to be used solely for (1) new road construction, design, and right-of-way acquisition, (2) new public transit construction, design, and right-of-way acquisition, (3) capital costs related to new transportation projects, or (4) the issuance costs and debt service on any bonds issued to support capital costs. There are 11 localities in the region of the authority: the cities of Alexandria, Fairfax, Falls Church, Fredericksburg, Manassas, and Manassas Park and the counties of Arlington, Fairfax, Loudoun, Prince William, and Stafford. Of those, one city (Fairfax) and two counties (Arlington and Fairfax) reported implementing the tax, as shown in Table 2.4.
## ASSESSMENT PRACTICES, REASSESSMENTS, ASSESSED VALUES
**Table 2.5** details assessment practices among localities. The table includes cities and counties, but not towns, because only a small percentage of towns provided substantive answers. For those interested in the towns that responded, data are available from the Cooper Center upon request.
The second column lists whether a locality has a full-time assessor. Twenty-seven cities reported employing a full-time property tax assessor, while 11 did not. In contrast, only 36 counties had a full-time assessor while 59 did not. This reflects the fact that many counties reassess property less frequently than cities. No towns had assessors, since towns rely on assessed values established by their host counties.
Columns three, four, five, and six of Table 2.5 provide data on the conduct of general reassessments and cover four questions. (1) Are reassessments done by the locality or contracted out? (2) What is the reassessment frequency? (3) Is physical inspection part of the reassessment? (4) When was the reassessment last done? Regarding the conduct of the general reassessment, 28 cities reported conducting reassessments in-house while 10 reported contracting with outside assessors. Twenty-eight counties reported doing general reassessments in-house, while 67 reported contracting out for services. Section 58.1-3250 of the *Code* requires cities to have a general reassessment of real estate every two years. However, any city with a total population of 30,000 or less may elect to conduct its general reassessments at four-year intervals.[^02-5] Counties are required to have a general reassessment every four years (§ 58.1-3252). There is an exception for counties with a total population of 50,000 or less. These counties may elect to reassess at either five-year or six-year intervals (§ 58.1-3252). However, nothing in these sections affects the power of cities and counties to reassess more frequently. A large majority of the cities (30) reassess at one or two year intervals. In contrast, less than three out of ten counties (27) reassess that frequently. Virtually all of the populous cities and counties reassess annually or biennially. Towns rely on their surrounding county to provide assessments, so a town’s reassessment occurs with the same frequency as the county’s. The reassessment periods are summarized in the table on the following page.
Column seven of Table 2.5 shows information about maintenance assessments. While general reassessments involve reassessing all parcels to reflect changes in market value, maintenance assessments involve adjusting assessed values between reassessments because of new construction, improvements, damages, demolitions, subdivisions, and consolidations. Thirty-three cities responded that they performed maintenance assessments using staff, while five reported contracting for the work. Among counties, 66 reported performing maintenance reassessments using staff, while 29 reported contracting the work to independent appraisers.
Columns eight and nine of Table 2.5 cover physical inspection. Physical inspection refers to the actual inspection of the property as opposed to computerized mass-appraisal of parcels. If a locality responded that it did not perform physical inspections during the general reassessment, two further questions were asked:
```r
#table name: Reassessment Periods for Real Estate, 2019
```
(1) Does the locality perform a physical inspection at all? (2) If so, what is the inspection cycle? Among cities that responded, 18 reportedly did not have a physical inspection separate from the general reassessment cycle. Twenty others reported having a physical inspection cycle, the periods ranging anywhere from two to six years. Among counties that responded, 70 indicated they performed physical inspections during general reassessment, while 25 reported having physical inspection cycles ranging anywhere from one to six years.
**Table 2.6** provides unpublished Department of Taxation 2018 data on total taxable assessed value of real estate by category. Taxable assessed value shows property qualifying for use value at its use value, not its market value. The percentage distribution of taxable assessed value is shown for two types of residential property (single-family and multi-family) as well as commercial and industrial property and agricultural property.
The text table on the next page compares the taxable assessed value by category for cities and counties. The total assessed value for all cities amounted to $277.4 billion. Single-family residential property averaged 64.9 percent of taxable assessed value. Multi-family residential property averaged 11.1 percent of taxable assessed value. Commercial/industrial properties averaged just over one-quarter of the total value at 23.9 percent, while agricultural property values amounted to only 0.1 percent.
The total assessed value of property by category for counties in 2018 amounted to $854.5 billion. Of that amount, 72.0 percent of assessed value was associated with single-family residential property, 5.9 percent with multi-family residential property, 18.2 percent with commercial/industrial property, and 4.0 percent with agricultural property.
With the total amounts from cities and counties combined, the total assessed valuation amounted to $1,131.9 billion. Of that, 70.2 percent applied to single-family residential property, 7.1 percent applied to multi-family residential property, 19.6 percent applied to commercial/industrial property, and 3.0 percent to agricultural property.
```r
#table name: Taxable Assessed Value by Category for Cities and Counties, 2018
```
Looking at the percentage breakdown for each type of locality, in 2018 the share of taxable assessed value for cities in the single-family residential category was between 40 percent and 59.9 percent in 19 cities and 60 percent or more in 18 cities. All cities but two had multi-family residential values under 19.9 percent of the total assessed value. Commercial and industrial property was the second most common category with 21 of the cities having between 20 percent and 39.9 percent of their property valuations coming from this type of property. Finally, only the cities of Suffolk and Franklin had more than 2 percent of their property valuation associated with agriculture.
Among counties the breakdown was slightly different. As in cities, the single-family residential value dominated the percentage breakdown. The single-family residential assessment percentage amounted to 60 percent or more for 71 counties. Another 20 received between 40 percent and 59.9 percent of the valuation from single-family residential real estate, while in four counties residential valuations amounted to no more than 39.9 percent of the total taxable assessed value (Buchanan, Dickenson, Highland, and Sussex). In contrast, only in Arlington county did the multi-family residential average share of value exceed 19.9 percent.
The category with the second highest valuation in counties was commercial and industrial property. Eighty-two counties had such property valued no higher than 19.9 percent of the total assessed value of property within the locality. In general, the percentage of assessed value in counties for commercial and industrial properties was less than that for cities (though two counties, coal-rich Dickenson and Buchanan, had the highest percentage valuations of such property). Finally, agricultural property averaged the least total assessed valuation in counties, though the percentage varied greatly among the individual counties. In 30 counties, valuations associated with agricultural property made up 20 percent or more of the total assessed value within the locality. The percentage in one county (Sussex) was 82.0 percent. The taxable assessed values for agriculture were much lower than they would have been without the advantage of use value assessment, a program explained in Sections 4 and 5.
## EFFECTIVE TAX RATES
Tax rates are generally discussed in terms of either statutory (nominal) rates or effective rates. The statutory rate is the rate used by localities and is applied to the assessed value of a property.The effective rate is published by the Virginia Department of Taxation in their annual assessment/sales ratio study. The department derives the effective rate by multiplying the statutory tax rate by the median assessment ratio. In normal times when property values are rising, the median assessment ratio is usually less than 100 percent because reassessments lag market increases and tend to be conservative. Consequently, the statutory rate is generally higher than the effective rate. However, this may not be true in difficult real estate markets. A limitation of the effective rates published by the Virginia Department of Taxation is that they are not current. The most recent year available at the present time is 2017. Despite the time lag, effective rates are important because they give a more accurate reflection of the differences in real property tax rates across localities.
```r
#table name: Share of Assessed Value of Real Estate by Category, 2018
```
**Table 2.7** shows city and county average effective tax rates in the year 2017. The department makes its computation in order to control for the variance in localities’ assessment procedures and timing. Therefore, when comparing tax rates among localities, the reader may wish to consult both Tables 2.1 and 2.7. Table 2.1 shows statutory rates in 2019. Table 2.7 shows statutory and effective rates in 2017. The following text table summarizes the effective tax rates for the localities shown in Table 2.7.
It should also be pointed out that the Virginia Department of Taxation does not use the locally reported statutory tax rate in its computations. Instead, it calculates the statutory rate by dividing the real estate levy by the local real estate *taxable assessed value*,[^02-6] as reported in the local land book. This method of computing the statutory tax rate takes additional district levies into account.[^02-7]
```r
#table name: Effective Real Estate Tax Rates, 2017
```
In 2 cities and 10 counties the statutory rate was less than the effective rate. In two cities and seven counties statutory and effective rates were the same. Finally, in 34 cities and 78 counties statutory rates exceeded effective rates.
```r
#table name: Statutory and Effective Real Estate Tax Rates, 2017
```
The real property tax rates reported in Table 2.7 are a more accurate reflection of the differences among localities in tax rates on real property than those in Table 2.1 because they control for variations in assessment frequency and technique among localities. Table 2.7 also shows the latest reassessment in effect when the median ratio study was conducted, the number of sales used in the study, the median ratio, and the coefficient of dispersion.
The *coefficient of dispersion* measures how closely the individual ratios of each locality are arrayed around the median ratio. The formula for the coefficient of dispersion (CD) is:
$$
CD =\left[ \frac{\sum_i |X_i + X_m |/n}{X_m} \right] \times 100
$$
where $X_i$ represents the assessment/sales ratio for the $i^\text{th}$ sale in a sample of size $n$, and $X_m$ represents the median ratio of the sample.[^02-8] If there were no dispersion, CD would equal zero.
The table below summarizes the coefficients of dispersion tabulated for the cities and counties. Eighteen of the cities had CDs of no more than 9.9 percent. Eight had CDs between 10 percent and 14.9 percent, 7 had CDs between 15 and 19.9 percent, and 4 had CDs between 20 and 24.9 percent. Counties tended to vary more in the degree of dispersion. Thirteen had CDs between 5 and 9.9 percent, 18 had CDs between 10 and 14.9 percent, 25 had CDs between 15 and 19.9 percent, 26 had CDs between 20 and 24.9 percent, 11 had CDs between 25 and 29.9 percent, and 2 had CDs between 30 and 34.9 percent.
```r
#table name: Coefficient of Dispersion, 2017
```
There is no upper limit for what is tolerable, but the International Association of Assessing Officers recommends an upper limit of 15 percent for residential properties.[^02-9] Twenty-eight cities and 34 counties met the 15 percent standard.[^02-10]
As one would expect, the quality of local assessments, as measured by the CD is generally better in those localities that reassess annually, biennially, or that have just conducted a general reassessment. In 2017, of the 57 localities with CDs under 15 percent, all but 12 reassessed annually (28), biennially (10), or had just completed general reassessments (7).
## MISCELLANEOUS ITEMS
**Table 2.8** presents miscellaneous taxes and exemptions related to real property. The first is the recreation tax. The *Code* in §15.2-1807 permits localities to collect a real estate tax for recreation areas and playgrounds that is not to exceed \$0.02 per \$100 of the assessed value of a property. This tax was reported by Charlottesville City.
The second column refers to the tax deferral ordinance permitted by § 58.1-3219 regarding the deferral of a portion of real estate tax increases when the tax exceeds 105 percent of the real property tax on property owned by a taxpayer in the previous year. Four localities (Charlottesville City, Richmond City, Middlesex County, and Amherst Town) reported implementing this deferral.
The third column refers to the establishment of a tax increment financing fund used to encourage development in certain areas and permitted by § 58.1-3245 of the *Code*. Six cities (Bristol, Charlottesville, Chesapeake, Emporia, Newport News, Virginia Beach, and Waynesboro), four counties (Arlington, Augusta, Fairfax, and Hanover), and one town (Front Royal) reported having implemented such a fund.
The fourth column refers to separate real property tax rates for energy-efficient buildings as permitted by § 58.1-3221.2 of the *Code*. Three cities (Charlottesville, Roanoke, and Virginia Beach) reported having special rates for such real estate.
The fifth column lists localities that reported providing a separate real property classification for improvements to real property used in the manufacture of renewable energy. Only the cities of Charlottesville and Roanoke reported having this separate rate.
Finally, the last column refers to low-income grant programs, discussed earlier in this text under the subheading, “Tax Relief Programs.” Only the cities of Charlottesville and Norfolk, and the county of Arlington reported having these programs.
[^02-1]: Charlottesville Housing Affordability Program: https://www.charlottesville.org/departments-and-services/departments-a-g/commissioner-of-revenue/real-estate-tax-relief-for-the-elderly-and-disabled. Loudoun County Affordable Dwelling Unit Program: http://www.loudoun.gov/adu. Arlington County Housing
Grants Program: http://housing.arlingtonva.us/get-help/rentalservices/local-housing-grants/.
[^02-2]: The statute allows the use of the Internal Revenue Service rate. Section 6621 of the Internal Revenue Code establishes a rate of 3 percent plus the federal short-term rate. In December 2019, when the short-term rate was 1.616 percent, the combined annual rate was 4.61 percent.
[^02-3]: City of Alexandria, *Budget Memo #46: Review of Other Jurisdictions’ Experience with a Real Estate Tax Deferral Program for the General Population* (Councilman Speck’s Request), 4/25/2003.
[^02-4]: Henrico County, *Budget Memo #46*.
[^02-5]: The *Code* does not specify which census is to be used.
[^02-6]: Taxable assessed value treats property qualifying for use value
as taxable at its use value rather than at its full market value.
[^02-7]: Virginia Department of Taxation, *The 2017 Virginia Assessment/Sales Ratio Study* (Richmond, February 2019), p. 35. The study
can be found at https://tax.virginia.gov/assessment-sales-ratio-studies.
[^02-8]: Virginia Department of Taxation, *The 2017 Virginia Assessment/Sales Ratio Study*, p. 34.
[^02-9]: International Association of Assessing Officers, *Standard on Ratio Studies*, (approved April 2013), p. 17. http://www.iaao.org/media/standards/Standard_on_Ratio_Studies.pdf.
[^02-10]: The Department of Taxation’s study applies to all types of property, not just residential property. Nonetheless, the majority of the measured sales are for single-family residential properties.
<file_sep>/get_and_prep_data.R
# File get_and_prep_data.R
# Helper code for va-local-tax-rates project
# Includes code that is standardized across all report sections:
# * Read in tax rates data from external source
# * Wrangle tax rates data frame to prep it for use
# * Define functions and set options for making and styling tables
# Load packages:
library(tidyverse)
library(kableExtra) # For fine-tuning appearance of tables
# Read in va local tax rates survey results from xlsx file; drop unnecessary cols
path2xl <- here::here("data", "TR2020inputdataMain.xlsx")
tax_rates_raw <- readxl::read_xlsx(path = path2xl) %>% select(-(Language:phone))
# Add columns for locality type and (shorter) name
tax_rates_raw %>%
mutate(locality_type = case_when(str_ends(ExternalDataReference, "County") ~ "County",
str_ends(ExternalDataReference, "City") ~ "City",
TRUE ~ "Town")) %>%
mutate(locality_group = case_when(str_ends(ExternalDataReference, "County") ~ "Counties",
str_ends(ExternalDataReference, "City") ~ "Cities",
TRUE ~ "Towns")) %>%
mutate(locality_name = word(ExternalDataReference, 1, -2)) %>%
arrange(locality_type, locality_name) %>%
relocate(ExternalDataReference, locality_name, locality_type, locality_group) -> tax_rates
reference_vars <- c("ExternalDataReference", "locality_name", "locality_type", "locality_group")
# Function to count number of localities of each type (cities, counties, towns).
# Used to organize groupings in long tables, using kableExtra::pack_rows() function.
count_localities_by_type <- function(secn_tbl){
secn_tbl %>%
group_by(locality_group) %>%
summarize(n()) %>%
deframe() -> grouping_index
return(grouping_index)
}
# Set global options for table styling
opts <- options(knitr.kable.NA = "--")
# Function to make a big long table
# The tibble passed to this function should include both locality_name and locality_type columns
make_long_table <- function(tbl, caption = "", col.names, align = NULL, format = "html"){
require(kableExtra)
require(dplyr)
# Generate default column alignment if none specified
align <- ifelse(is.null(align), c("l", rep("c", ncol(tbl)-2)), align)
# Generate table; drop "locality_type" column from display
kbl(tbl %>% select(-locality_group),
caption = caption,
col.names = col.names,
align = align,
format = format) %>%
pack_rows(index = count_localities_by_type(tbl))
}
<file_sep>/_book/12-Cable-Television-System.md
# Cable Television System Franchise Tax {#sec:cable-tv}
On January 2007 the Virginia Communications Sales and Use Tax Act eliminated several local taxes, including the cable television system franchise tax (§ 15.2.2108), the local E-911 fees on land-line phone service, the business license taxes in excess of 0.5 percent gross revenues collected by several localities, the local consumer utility taxes on land line and wireless phones, the video programming excise tax (§ 58.1.3818.1), and the local consumer utility tax on cable television service which had been “grandfathered” in a few localities. These local taxes were replaced by a new state tax of 5 percent of the sales price of the service, which is collected by the Virginia Department of Taxation and remitted to localities as non-categorical state aid based on a percentage developed by the Auditor of Public Accounts in its report, *Report of State and Local Communication Service Taxes and Fees: Report on Audit for the Year Ended June 30, 2006*, and available on the web at http://www.apa.virginia.gov/APA_Reports/Reports.aspx. Refer to Section 19, “Miscellaneous Taxes,” for more on the communications sales and use tax.
The cable television system franchise tax still exists in those localities with current contracts with cable operators. When those contracts expire, the localities will revert to the requirements of the state tax.
**Table 12.1** presents the localities with franchise fee contracts that extend to the end of 2019 and beyond. It includes the current franchise fee charged by the locality, whether the locality has multiple cable providers, and whether the locality authorizes a BPOL tax on the cable franchisee. Seven cities reported having contract clauses that extended to 2019 or beyond, as did 6 counties and 9 towns. The median of the fees for all localities was 5 percent. Thirty-four localities indicated that they had multiple cable providers.
```r
# Table 12.1 Cable Television System Tax, 2019
```
<table>
<caption>(\#tab:table12-1)Cable Television System Tax Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Dates Contract Clauses Scheduled to Expire </th>
<th style="text-align:center;"> Franchise Tax on Gross Receipts (%) </th>
<th style="text-align:center;"> Multiple Cable Providers </th>
<th style="text-align:center;"> Cable BPOL Tax </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 2014 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 12/31/2030 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 9/2007 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 2023 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 2012 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 2013; 2021 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 2011 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 07/2021 and 03/2022 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> pending </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 2010 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 2014 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 2015/2020 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 2014 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 3/1/2009 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 2023 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 2015 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 2021 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 2023 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 2021 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> ? </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> 12/31/2009 </td>
<td style="text-align:center;"> 0.36 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> 2015 </td>
<td style="text-align:center;"> 0.80 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> 2025 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> 2022 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> 2021 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 2025 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> yearly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 2010 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Yes </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> 2020 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> Oct. 2019 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> 2028 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> Yes </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 2027 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 2016 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> No </td>
<td style="text-align:center;"> No </td>
</tr>
</tbody>
</table>
<file_sep>/_book/21-residential-water.md
# Residential Water and Sewer Connection and Usage Fees
The Code of Virginia § 15.2-2122 authorizes sewer connection fees to finance changes in a sewer system that improve public health. Localities may establish, construct, improve, enlarge, operate, and maintain a sewage disposal system with all that is necessary for the operation of such system. The terms under which the locality can charge a fee are defined in § 15.2-2119. In most cases, the information in this section does not include fees of service districts that are separate from local governments. For further information about these fees, refer to the Draper Aden Associates report, The 31st Annual Virginia Water and Wastewater Rate Report, 2019, found at http://www.daa.com/resources/
## CONNECTION FEES
In this survey, we asked for the standard charges to connect a locality’s pipelines to a residence. The question applies only to residential buildings, including single-family homes, townhouses, apartment buildings, and mobile homes. We asked for the combined fees, so the amount should include connection fees, availability fees, service charges, and any other fee charged by a locality.Connection fees for nonresidential structures were not surveyed because of their complexity.
**Table 21.1** provides the water and sewer connection fees for the 25 cities, 48 counties, and 90 towns that reported imposing them. Fee schedules used by localities differ, but in general, charges apply to mains, valves, and meters that are installed by the locality. When an owner or developer installs all of the necessary equipment, the charge is generally waived. The following text table lists the unweighted mean, median, and first and third quartiles for connection fees for single-family housing for cities and counties.
```r
#Text table "Residential Water and Sewer Combined Connection Fees for Cities and Counties, 2019" goes here
#Will probably want to split it up by cities and counties as the original has done
```
## USAGE FEES
**Table 21.2** lists water and sewer usage fees for 36 cities, 54 counties, and 98 towns. The fees are often multitiered with the first several thousand gallons charged at a higher unit rate and the remaining amount at a lower basis. However, the opposite charging method, a multi-tiered system with the first usage charged at a lower rate than later usage, is also used.
For localities that responded with a single fee and not a schedule, it is assumed that the fee listed applies to the standard residential connection, even though no information on meter size was available. If you have questions concerning responses given in this table, please contact the appropriate water and sewer department or authority in the locality or visit their web site if applicable.
```r
#Table 21.1 "Residential Water and Sewer Connection Fees, 2019" goes here
#Table 21.2 "User Fees for Residential Water and Sewer, 2019"
```
<table>
<caption>(\#tab:table21-1)Residential Water and Sewer Connection Fees Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Water ($), Single </th>
<th style="text-align:center;"> Water ($), Single </th>
<th style="text-align:center;"> Water ($), Apartment </th>
<th style="text-align:center;"> Water ($), Apartment </th>
<th style="text-align:center;"> Water ($), Town House </th>
<th style="text-align:center;"> Water ($), Town House </th>
<th style="text-align:center;"> Water ($), Mobile Home </th>
<th style="text-align:center;"> Water ($), Mobile Home </th>
<th style="text-align:left;"> Sewer ($), Single </th>
<th style="text-align:center;"> Sewer ($), Single </th>
<th style="text-align:center;"> Sewer ($), Apartment </th>
<th style="text-align:center;"> Sewer ($), Apartment </th>
<th style="text-align:center;"> Sewer ($), Town House </th>
<th style="text-align:center;"> Sewer ($), Town House </th>
<th style="text-align:center;"> Sewer ($), Mobile Home </th>
<th style="text-align:center;"> Sewer ($), Mobile Home </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 2700.00 </td>
<td style="text-align:center;"> 2846.00 </td>
<td style="text-align:center;"> 2700 </td>
<td style="text-align:center;"> 2890.0 </td>
<td style="text-align:center;"> 2700.00 </td>
<td style="text-align:center;"> 2846.00 </td>
<td style="text-align:center;"> 2700 </td>
<td style="text-align:center;"> 2846.0 </td>
<td style="text-align:left;"> 3200.00 </td>
<td style="text-align:center;"> 3191.00 </td>
<td style="text-align:center;"> 3200.0 </td>
<td style="text-align:center;"> 3235 </td>
<td style="text-align:center;"> 3200.00 </td>
<td style="text-align:center;"> 3191.00 </td>
<td style="text-align:center;"> 3200.0 </td>
<td style="text-align:center;"> 3191 </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1200 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 2200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2600.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 3995.00 </td>
<td style="text-align:center;"> 3995.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 6150.00 </td>
<td style="text-align:center;"> 6150.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 650 </td>
<td style="text-align:center;"> 650.0 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 650 </td>
<td style="text-align:center;"> 650.0 </td>
<td style="text-align:left;"> 400.00 </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> 400.0 </td>
<td style="text-align:center;"> 400 </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> 400.0 </td>
<td style="text-align:center;"> 400 </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750 </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2000.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 2500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2500 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:left;"> 0.00 </td>
<td style="text-align:center;"> 7000.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 7000 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 7000.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 7000 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1250.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1250.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 1250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1250 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1250 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 5580.00 </td>
<td style="text-align:center;"> 7480.00 </td>
<td style="text-align:center;"> 4675 </td>
<td style="text-align:center;"> 4675.0 </td>
<td style="text-align:center;"> 5580.00 </td>
<td style="text-align:center;"> 7480.00 </td>
<td style="text-align:center;"> 5580 </td>
<td style="text-align:center;"> 7480.0 </td>
<td style="text-align:left;"> 5400.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4590.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5400.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5400.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 5250.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 4725 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5250.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 22750.00 </td>
<td style="text-align:center;"> 13800.00 </td>
<td style="text-align:center;"> 22750.0 </td>
<td style="text-align:center;"> 13800 </td>
<td style="text-align:center;"> 22750.00 </td>
<td style="text-align:center;"> 13800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3970.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3970.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3970.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3970.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 2725.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2725 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2725.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2725 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> 850.00 </td>
<td style="text-align:center;"> 850.00 </td>
<td style="text-align:center;"> 850 </td>
<td style="text-align:center;"> 850.0 </td>
<td style="text-align:center;"> 850.00 </td>
<td style="text-align:center;"> 850.00 </td>
<td style="text-align:center;"> 850 </td>
<td style="text-align:center;"> 850.0 </td>
<td style="text-align:left;"> 550.00 </td>
<td style="text-align:center;"> 550.00 </td>
<td style="text-align:center;"> 550.0 </td>
<td style="text-align:center;"> 550 </td>
<td style="text-align:center;"> 550.00 </td>
<td style="text-align:center;"> 550.00 </td>
<td style="text-align:center;"> 550.0 </td>
<td style="text-align:center;"> 550 </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 1618.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 1618 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 1618.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 1618 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 3910.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 3910.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 3910.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 3910.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 20884.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20034 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20884.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20884 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 8340.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6672.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6672.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6672.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6080.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6080.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6080.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6080.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 11394.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 11394 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 11394.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 11394 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1570.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1570.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1570.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1500 </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2750 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3750.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:left;"> 10000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 10000 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 10000 </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1360.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1360.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1360.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1360.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 2155.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2155 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2155.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2155 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 6281.00 </td>
<td style="text-align:center;"> 6281.00 </td>
<td style="text-align:center;"> 6281 </td>
<td style="text-align:center;"> 6281.0 </td>
<td style="text-align:center;"> 6281.00 </td>
<td style="text-align:center;"> 6281.00 </td>
<td style="text-align:center;"> 6281 </td>
<td style="text-align:center;"> 6281.0 </td>
<td style="text-align:left;"> 6456.00 </td>
<td style="text-align:center;"> 6456.00 </td>
<td style="text-align:center;"> 6456.0 </td>
<td style="text-align:center;"> 6456 </td>
<td style="text-align:center;"> 6456.00 </td>
<td style="text-align:center;"> 6456.00 </td>
<td style="text-align:center;"> 6456.0 </td>
<td style="text-align:center;"> 6456 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 4635.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 4270 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 4270.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 4635 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 5605.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 5170.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 5170.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 5605.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:left;"> 3700.00 </td>
<td style="text-align:center;"> 3700.00 </td>
<td style="text-align:center;"> 3700.0 </td>
<td style="text-align:center;"> 3700 </td>
<td style="text-align:center;"> 3700.00 </td>
<td style="text-align:center;"> 3700.00 </td>
<td style="text-align:center;"> 3700.0 </td>
<td style="text-align:center;"> 3700 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 8662.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 8662 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 8662.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 8662 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 11183.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 11183.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 11183.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 11183.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 9905.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 9905 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 9905.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 9905 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6760.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6760.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 7200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3425.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2500.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3425.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 3950.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3950 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 7535.00 </td>
<td style="text-align:center;"> 7535.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7535.00 </td>
<td style="text-align:center;"> 7535.00 </td>
<td style="text-align:center;"> 7535 </td>
<td style="text-align:center;"> 7535.0 </td>
<td style="text-align:left;"> 11775.00 </td>
<td style="text-align:center;"> 11775.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 11775.00 </td>
<td style="text-align:center;"> 11775.00 </td>
<td style="text-align:center;"> 11775.0 </td>
<td style="text-align:center;"> 11775 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1001.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1001.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 1605.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1605 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 4435.00 </td>
<td style="text-align:center;"> 4435.00 </td>
<td style="text-align:center;"> 3490 </td>
<td style="text-align:center;"> 3490.0 </td>
<td style="text-align:center;"> 4435.00 </td>
<td style="text-align:center;"> 4435.00 </td>
<td style="text-align:center;"> 4435 </td>
<td style="text-align:center;"> 4435.0 </td>
<td style="text-align:left;"> 8455.00 </td>
<td style="text-align:center;"> 8455.00 </td>
<td style="text-align:center;"> 6890.0 </td>
<td style="text-align:center;"> 6890 </td>
<td style="text-align:center;"> 8455.00 </td>
<td style="text-align:center;"> 8455.00 </td>
<td style="text-align:center;"> 8455.0 </td>
<td style="text-align:center;"> 8455 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince Edward County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> 5000.0 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> 5000.0 </td>
<td style="text-align:left;"> 5000.00 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 5000.0 </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 5000.0 </td>
<td style="text-align:center;"> 5000 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5425.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5425.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5425.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 5405.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5405.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5405 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3275.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3275.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3275.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3275.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 5925.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3750 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5925.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5925 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 875.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 875.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4600 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 7800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7350.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7350.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7800.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4920.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 4920.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 8350.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 8350.0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 8350.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 8350.0 </td>
<td style="text-align:left;"> 0.00 </td>
<td style="text-align:center;"> 5600.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5600 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 5600.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5600 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 4836.00 </td>
<td style="text-align:center;"> 9672.00 </td>
<td style="text-align:center;"> 2371 </td>
<td style="text-align:center;"> 4742.0 </td>
<td style="text-align:center;"> 4836.00 </td>
<td style="text-align:center;"> 9672.00 </td>
<td style="text-align:center;"> 4836 </td>
<td style="text-align:center;"> 9672.0 </td>
<td style="text-align:left;"> 10232.00 </td>
<td style="text-align:center;"> 20464.00 </td>
<td style="text-align:center;"> 2304.0 </td>
<td style="text-align:center;"> 4608 </td>
<td style="text-align:center;"> 10232.00 </td>
<td style="text-align:center;"> 20464.00 </td>
<td style="text-align:center;"> 10232.0 </td>
<td style="text-align:center;"> 20464 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 1628.00 </td>
<td style="text-align:center;"> 1628.00 </td>
<td style="text-align:center;"> 1628 </td>
<td style="text-align:center;"> 1628.0 </td>
<td style="text-align:center;"> 1628.00 </td>
<td style="text-align:center;"> 1628.00 </td>
<td style="text-align:center;"> 1628 </td>
<td style="text-align:center;"> 1628.0 </td>
<td style="text-align:left;"> 3235.00 </td>
<td style="text-align:center;"> 3235.00 </td>
<td style="text-align:center;"> 3235.0 </td>
<td style="text-align:center;"> 3235 </td>
<td style="text-align:center;"> 3235.00 </td>
<td style="text-align:center;"> 3235.00 </td>
<td style="text-align:center;"> 3235.0 </td>
<td style="text-align:center;"> 3235 </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500.0 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 500.0 </td>
<td style="text-align:left;"> 6193.00 </td>
<td style="text-align:center;"> 6193.00 </td>
<td style="text-align:center;"> 6193.0 </td>
<td style="text-align:center;"> 6193 </td>
<td style="text-align:center;"> 6193.00 </td>
<td style="text-align:center;"> 6193.00 </td>
<td style="text-align:center;"> 6193.0 </td>
<td style="text-align:center;"> 6193 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 2850.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 3700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 8175.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 8175.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 635.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 635 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 635.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 635 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 330.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 330.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 330.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 330.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 3530.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3530 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3530.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3530 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 5350.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5350.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5350.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5350.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 3847.00 </td>
<td style="text-align:center;"> 3258.00 </td>
<td style="text-align:center;"> 5746 </td>
<td style="text-align:center;"> 4862.0 </td>
<td style="text-align:center;"> 5746.00 </td>
<td style="text-align:center;"> 4862.00 </td>
<td style="text-align:center;"> 3847 </td>
<td style="text-align:center;"> 3258.0 </td>
<td style="text-align:left;"> 5424.00 </td>
<td style="text-align:center;"> 4597.00 </td>
<td style="text-align:center;"> 9489.0 </td>
<td style="text-align:center;"> 8883 </td>
<td style="text-align:center;"> 9489.00 </td>
<td style="text-align:center;"> 8883.00 </td>
<td style="text-align:center;"> 5424.0 </td>
<td style="text-align:center;"> 4597 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 700 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 700 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 700.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 700.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 1412.00 </td>
<td style="text-align:center;"> 1412.00 </td>
<td style="text-align:center;"> 1412 </td>
<td style="text-align:center;"> 1412.0 </td>
<td style="text-align:center;"> 1412.00 </td>
<td style="text-align:center;"> 1412.00 </td>
<td style="text-align:center;"> 1412 </td>
<td style="text-align:center;"> 1412.0 </td>
<td style="text-align:left;"> 6.80 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6.8 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6.80 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6.8 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 14826.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 14826.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 14826 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 7680.00 </td>
<td style="text-align:center;"> 7680.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7680.00 </td>
<td style="text-align:center;"> 7680.00 </td>
<td style="text-align:center;"> 7680.0 </td>
<td style="text-align:center;"> 7680 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 3500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 4500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6500.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 2500.00 </td>
<td style="text-align:center;"> 2500.00 </td>
<td style="text-align:center;"> 2500 </td>
<td style="text-align:center;"> 2500.0 </td>
<td style="text-align:center;"> 2500.00 </td>
<td style="text-align:center;"> 2500.00 </td>
<td style="text-align:center;"> 2500 </td>
<td style="text-align:center;"> 2500.0 </td>
<td style="text-align:left;"> 4500.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:center;"> 4500 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:center;"> 4500 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 1725.00 </td>
<td style="text-align:center;"> 1725.00 </td>
<td style="text-align:center;"> 1725 </td>
<td style="text-align:center;"> 1725.0 </td>
<td style="text-align:center;"> 1725.00 </td>
<td style="text-align:center;"> 1725.00 </td>
<td style="text-align:center;"> 1725 </td>
<td style="text-align:center;"> 1725.0 </td>
<td style="text-align:left;"> 1675.00 </td>
<td style="text-align:center;"> 1675.00 </td>
<td style="text-align:center;"> 1675.0 </td>
<td style="text-align:center;"> 1675 </td>
<td style="text-align:center;"> 1675.00 </td>
<td style="text-align:center;"> 1675.00 </td>
<td style="text-align:center;"> 1675.0 </td>
<td style="text-align:center;"> 1675 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 2370.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2370 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2370.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2370 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 3280.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3280.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3280.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3280.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 5178.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3119 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5178.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 9152.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5491.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 9152.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 525.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6000.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 1800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1800 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 2300.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2300.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2300.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 3500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 16300 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3500 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 3100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 8100.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3100.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 5600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 8950.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 2725.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 4250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 5800.00 </td>
<td style="text-align:center;"> 5800.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5800.00 </td>
<td style="text-align:center;"> 5800.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 3800.00 </td>
<td style="text-align:center;"> 3800.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 3800.00 </td>
<td style="text-align:center;"> 3800.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 5300.00 </td>
<td style="text-align:center;"> 5300.00 </td>
<td style="text-align:center;"> 5300 </td>
<td style="text-align:center;"> 5300.0 </td>
<td style="text-align:center;"> 5300.00 </td>
<td style="text-align:center;"> 5300.00 </td>
<td style="text-align:center;"> 5300 </td>
<td style="text-align:center;"> 5300.0 </td>
<td style="text-align:left;"> 7200.00 </td>
<td style="text-align:center;"> 7200.00 </td>
<td style="text-align:center;"> 7200.0 </td>
<td style="text-align:center;"> 7200 </td>
<td style="text-align:center;"> 7200.00 </td>
<td style="text-align:center;"> 7200.00 </td>
<td style="text-align:center;"> 7200.0 </td>
<td style="text-align:center;"> 7200 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 1500.00 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 1700.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 1500.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 1500 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 1500 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:left;"> 2600.00 </td>
<td style="text-align:center;"> 5200.00 </td>
<td style="text-align:center;"> 2600.0 </td>
<td style="text-align:center;"> 5200 </td>
<td style="text-align:center;"> 2600.00 </td>
<td style="text-align:center;"> 5200.00 </td>
<td style="text-align:center;"> 2600.0 </td>
<td style="text-align:center;"> 5200 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> 2200.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 2200 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:center;"> 2200.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 2200 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:left;"> 3000.00 </td>
<td style="text-align:center;"> 5500.00 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> 5500 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 5500.00 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> 5500 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:left;"> 5200.00 </td>
<td style="text-align:center;"> 5200.00 </td>
<td style="text-align:center;"> 5200.0 </td>
<td style="text-align:center;"> 5200 </td>
<td style="text-align:center;"> 5200.00 </td>
<td style="text-align:center;"> 5200.00 </td>
<td style="text-align:center;"> 5200.0 </td>
<td style="text-align:center;"> 5200 </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> 5575.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 5050 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 5575.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 22750.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 22750.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 22750.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> 550.00 </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 400.00 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> 3050.00 </td>
<td style="text-align:center;"> 5337.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 3513.00 </td>
<td style="text-align:center;"> 6147.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 800 </td>
<td style="text-align:center;"> 1600.0 </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 800 </td>
<td style="text-align:center;"> 1600.0 </td>
<td style="text-align:left;"> 800.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 800.0 </td>
<td style="text-align:center;"> 1600 </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 800.0 </td>
<td style="text-align:center;"> 1600 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> 450.00 </td>
<td style="text-align:center;"> 550.00 </td>
<td style="text-align:center;"> 450 </td>
<td style="text-align:center;"> 550.0 </td>
<td style="text-align:center;"> 450.00 </td>
<td style="text-align:center;"> 550.00 </td>
<td style="text-align:center;"> 450 </td>
<td style="text-align:center;"> 550.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 3000 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 3000 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:left;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> 6800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6800 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 6800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 6800.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 1250.00 </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> 1250.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> 1250.0 </td>
<td style="text-align:left;"> 750.00 </td>
<td style="text-align:center;"> 1250.00 </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:center;"> 1250 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:center;"> 1250 </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> 2758.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2758 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2758.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2758 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 7172.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7172.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7172.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 7172.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4500 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4500 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:left;"> 4600.00 </td>
<td style="text-align:center;"> 4600.00 </td>
<td style="text-align:center;"> 4600.0 </td>
<td style="text-align:center;"> 4600 </td>
<td style="text-align:center;"> 4600.00 </td>
<td style="text-align:center;"> 4600.00 </td>
<td style="text-align:center;"> 4600.0 </td>
<td style="text-align:center;"> 4600 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:left;"> 600.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 600 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 600 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> 2200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 2500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> 4875.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4875 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> 800 </td>
<td style="text-align:center;"> 1200.0 </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> 800 </td>
<td style="text-align:center;"> 1200.0 </td>
<td style="text-align:left;"> 600.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 900 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 900 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1000.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900 </td>
<td style="text-align:center;"> 900.0 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900 </td>
<td style="text-align:center;"> 900.0 </td>
<td style="text-align:left;"> 900.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.0 </td>
<td style="text-align:center;"> 900 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.0 </td>
<td style="text-align:center;"> 900 </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 3000 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 3000 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:left;"> 3000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> 4500 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> 4500 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 6300.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 800.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 600 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> 700.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 400.00 </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> 100.00 </td>
<td style="text-align:center;"> 125.00 </td>
<td style="text-align:center;"> 100 </td>
<td style="text-align:center;"> 125.0 </td>
<td style="text-align:center;"> 100.00 </td>
<td style="text-align:center;"> 125.00 </td>
<td style="text-align:center;"> 100 </td>
<td style="text-align:center;"> 125.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2250 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 3750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3750.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> 6500 </td>
<td style="text-align:center;"> 6500.0 </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> 6500 </td>
<td style="text-align:center;"> 6500.0 </td>
<td style="text-align:left;"> 10000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 10000 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 10000 </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> 3500.00 </td>
<td style="text-align:center;"> 5250.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 3500 </td>
<td style="text-align:center;"> 5250.0 </td>
<td style="text-align:left;"> 4000.00 </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> 6000 </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:left;"> 2025.00 </td>
<td style="text-align:center;"> 2025.00 </td>
<td style="text-align:center;"> 2025.0 </td>
<td style="text-align:center;"> 2025 </td>
<td style="text-align:center;"> 2025.00 </td>
<td style="text-align:center;"> 2025.00 </td>
<td style="text-align:center;"> 2025.0 </td>
<td style="text-align:center;"> 2025 </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 1500 </td>
<td style="text-align:center;"> 1600.0 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 1500 </td>
<td style="text-align:center;"> 1600.0 </td>
<td style="text-align:left;"> 1500.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 1500.0 </td>
<td style="text-align:center;"> 1600 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 1600.00 </td>
<td style="text-align:center;"> 1500.0 </td>
<td style="text-align:center;"> 1600 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1000.00 </td>
<td style="text-align:center;"> 1100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 7500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 10000.00 </td>
<td style="text-align:center;"> 15000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 6500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 4000.00 </td>
<td style="text-align:center;"> 6000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> 4340.00 </td>
<td style="text-align:center;"> 8680.00 </td>
<td style="text-align:center;"> 4340 </td>
<td style="text-align:center;"> 8680.0 </td>
<td style="text-align:center;"> 4340.00 </td>
<td style="text-align:center;"> 8680.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 9750.00 </td>
<td style="text-align:center;"> 19500.00 </td>
<td style="text-align:center;"> 9750.0 </td>
<td style="text-align:center;"> 19500 </td>
<td style="text-align:center;"> 9750.00 </td>
<td style="text-align:center;"> 19500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 2500 </td>
<td style="text-align:center;"> 2500.0 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> 650 </td>
<td style="text-align:center;"> 650.0 </td>
<td style="text-align:left;"> 900.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.0 </td>
<td style="text-align:center;"> 900 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 900.0 </td>
<td style="text-align:center;"> 900 </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 7500.00 </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> 7500.0 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 7500.00 </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> 7500.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 0.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> 300.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 400.00 </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> 21500.00 </td>
<td style="text-align:center;"> 21500.00 </td>
<td style="text-align:center;"> 21500 </td>
<td style="text-align:center;"> 21500.0 </td>
<td style="text-align:center;"> 21500.00 </td>
<td style="text-align:center;"> 21500.00 </td>
<td style="text-align:center;"> 21500 </td>
<td style="text-align:center;"> 21500.0 </td>
<td style="text-align:left;"> 17400.00 </td>
<td style="text-align:center;"> 17400.00 </td>
<td style="text-align:center;"> 17400.0 </td>
<td style="text-align:center;"> 17400 </td>
<td style="text-align:center;"> 17400.00 </td>
<td style="text-align:center;"> 17400.00 </td>
<td style="text-align:center;"> 17400.0 </td>
<td style="text-align:center;"> 17400 </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 862.50 </td>
<td style="text-align:center;"> 1035.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 682.50 </td>
<td style="text-align:center;"> 787.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> 1450.00 </td>
<td style="text-align:center;"> 1200 </td>
<td style="text-align:center;"> 1450.0 </td>
<td style="text-align:center;"> 1200.00 </td>
<td style="text-align:center;"> 1450.00 </td>
<td style="text-align:center;"> 1200 </td>
<td style="text-align:center;"> 1450.0 </td>
<td style="text-align:left;"> 500.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 500.0 </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 500.0 </td>
<td style="text-align:center;"> 750 </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> 950.00 </td>
<td style="text-align:center;"> 1425.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 950 </td>
<td style="text-align:center;"> 1425.0 </td>
<td style="text-align:left;"> 250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 250.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> 3140.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3140 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3140.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3140 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:left;"> 1000.00 </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 2055.00 </td>
<td style="text-align:center;"> 3082.50 </td>
<td style="text-align:center;"> 2055 </td>
<td style="text-align:center;"> 3082.5 </td>
<td style="text-align:center;"> 2055.00 </td>
<td style="text-align:center;"> 3082.50 </td>
<td style="text-align:center;"> 2055 </td>
<td style="text-align:center;"> 3082.5 </td>
<td style="text-align:left;"> 8040.00 </td>
<td style="text-align:center;"> 12060.00 </td>
<td style="text-align:center;"> 8040.0 </td>
<td style="text-align:center;"> 12060 </td>
<td style="text-align:center;"> 8040.00 </td>
<td style="text-align:center;"> 12060.00 </td>
<td style="text-align:center;"> 8040.0 </td>
<td style="text-align:center;"> 12060 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 2000.0 </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 2000.0 </td>
<td style="text-align:left;"> 1000.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> 1500 </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> 1500 </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 400 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 400 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:left;"> 400.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 400.0 </td>
<td style="text-align:center;"> 600 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 1750.00 </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 1750.0 </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 1750.00 </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 1750.0 </td>
<td style="text-align:left;"> 1000.00 </td>
<td style="text-align:center;"> 1750.00 </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> 1750 </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 1750.00 </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> 1750 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 4683.00 </td>
<td style="text-align:center;"> 4683.00 </td>
<td style="text-align:center;"> 3744 </td>
<td style="text-align:center;"> 3744.0 </td>
<td style="text-align:center;"> 3744.00 </td>
<td style="text-align:center;"> 3744.00 </td>
<td style="text-align:center;"> 4683 </td>
<td style="text-align:center;"> 4683.0 </td>
<td style="text-align:left;"> 7292.00 </td>
<td style="text-align:center;"> 7292.00 </td>
<td style="text-align:center;"> 5852.0 </td>
<td style="text-align:center;"> 5852 </td>
<td style="text-align:center;"> 5852.00 </td>
<td style="text-align:center;"> 5852.00 </td>
<td style="text-align:center;"> 7292.0 </td>
<td style="text-align:center;"> 7292 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> 4780.00 </td>
<td style="text-align:center;"> 4780.00 </td>
<td style="text-align:center;"> 4780 </td>
<td style="text-align:center;"> 4780.0 </td>
<td style="text-align:center;"> 4780.00 </td>
<td style="text-align:center;"> 4780.00 </td>
<td style="text-align:center;"> 4780 </td>
<td style="text-align:center;"> 4780.0 </td>
<td style="text-align:left;"> 7720.00 </td>
<td style="text-align:center;"> 7720.00 </td>
<td style="text-align:center;"> 7720.0 </td>
<td style="text-align:center;"> 7720 </td>
<td style="text-align:center;"> 7720.00 </td>
<td style="text-align:center;"> 7720.00 </td>
<td style="text-align:center;"> 7720.0 </td>
<td style="text-align:center;"> 7720 </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> 9100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 9100 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 9100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 9100 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 12900.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 12900.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 12900.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 12900.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 4520.00 </td>
<td style="text-align:center;"> 6640.00 </td>
<td style="text-align:center;"> 4520 </td>
<td style="text-align:center;"> 6640.0 </td>
<td style="text-align:center;"> 4520.00 </td>
<td style="text-align:center;"> 6640.00 </td>
<td style="text-align:center;"> 4520 </td>
<td style="text-align:center;"> 6640.0 </td>
<td style="text-align:left;"> 7140.00 </td>
<td style="text-align:center;"> 11880.00 </td>
<td style="text-align:center;"> 7140.0 </td>
<td style="text-align:center;"> 11880 </td>
<td style="text-align:center;"> 7140.00 </td>
<td style="text-align:center;"> 11880.00 </td>
<td style="text-align:center;"> 7140.0 </td>
<td style="text-align:center;"> 11880 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> 900.00 </td>
<td style="text-align:center;"> 1100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 900.00 </td>
<td style="text-align:center;"> 1100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:left;"> 8000.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 8000.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 8000.00 </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 8000.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 5000.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 5000 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:left;"> 10000.00 </td>
<td style="text-align:center;"> 20000.00 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 20000 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 20000.00 </td>
<td style="text-align:center;"> 10000.0 </td>
<td style="text-align:center;"> 20000 </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1500.00 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> 2515.00 </td>
<td style="text-align:center;"> 6515.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2515.00 </td>
<td style="text-align:center;"> 6515.00 </td>
<td style="text-align:center;"> 2515 </td>
<td style="text-align:center;"> 6515.0 </td>
<td style="text-align:left;"> 3000.00 </td>
<td style="text-align:center;"> 8000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 8000.00 </td>
<td style="text-align:center;"> 3000.0 </td>
<td style="text-align:center;"> 8000 </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME>own </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 1200.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 3000 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 12330.00 </td>
<td style="text-align:center;"> 18495.00 </td>
<td style="text-align:center;"> 12330.0 </td>
<td style="text-align:center;"> 18495 </td>
<td style="text-align:center;"> 12330.00 </td>
<td style="text-align:center;"> 18495.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 800.00 </td>
<td style="text-align:center;"> 1250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 800 </td>
<td style="text-align:center;"> 1250.0 </td>
<td style="text-align:left;"> 600.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 600 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.00 </td>
<td style="text-align:center;"> 600.0 </td>
<td style="text-align:center;"> 600 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 25754.00 </td>
<td style="text-align:center;"> 51508.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 25754.00 </td>
<td style="text-align:center;"> 51508.00 </td>
<td style="text-align:center;"> 25754 </td>
<td style="text-align:center;"> 51508.0 </td>
<td style="text-align:left;"> 21600.00 </td>
<td style="text-align:center;"> 43200.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 21600.00 </td>
<td style="text-align:center;"> 43200.00 </td>
<td style="text-align:center;"> 21600.0 </td>
<td style="text-align:center;"> 43200 </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> 7500.00 </td>
<td style="text-align:center;"> 7500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 400 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 400 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 300.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 300.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 300.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 300.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 3250.00 </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 3250.0 </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 3250.00 </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 3250.0 </td>
<td style="text-align:left;"> 1000.00 </td>
<td style="text-align:center;"> 3250.00 </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> 3250 </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 3250.00 </td>
<td style="text-align:center;"> 1000.0 </td>
<td style="text-align:center;"> 3250 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 8197.23 </td>
<td style="text-align:center;"> 12295.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 8197.23 </td>
<td style="text-align:center;"> 12295.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 12676.23 </td>
<td style="text-align:center;"> 19014.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 12676.23 </td>
<td style="text-align:center;"> 19014.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 2000.0 </td>
<td style="text-align:left;"> 400.00 </td>
<td style="text-align:center;"> 1400.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 400.00 </td>
<td style="text-align:center;"> 1400.00 </td>
<td style="text-align:center;"> 400.0 </td>
<td style="text-align:center;"> 1400 </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 350.00 </td>
<td style="text-align:center;"> 350.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 350.00 </td>
<td style="text-align:center;"> 350.00 </td>
<td style="text-align:center;"> 350.0 </td>
<td style="text-align:center;"> 350 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> 450.00 </td>
<td style="text-align:center;"> 550.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 550.00 </td>
<td style="text-align:center;"> 650.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 7000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 5000.00 </td>
<td style="text-align:center;"> 8000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> 3380.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3380 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3380.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3380 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 5700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5700.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5700.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 1000.00 </td>
<td style="text-align:center;"> 2000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1000 </td>
<td style="text-align:center;"> 2000.0 </td>
<td style="text-align:left;"> 1500.00 </td>
<td style="text-align:center;"> 3000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1500.0 </td>
<td style="text-align:center;"> 3000 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> 3825.00 </td>
<td style="text-align:center;"> 5700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3825 </td>
<td style="text-align:center;"> 5700.0 </td>
<td style="text-align:left;"> 4625.00 </td>
<td style="text-align:center;"> 7000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4625.0 </td>
<td style="text-align:center;"> 7000 </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> 9750.00 </td>
<td style="text-align:center;"> 6500 </td>
<td style="text-align:center;"> 9750.0 </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> 9750.00 </td>
<td style="text-align:center;"> 6500 </td>
<td style="text-align:center;"> 9750.0 </td>
<td style="text-align:left;"> 6500.00 </td>
<td style="text-align:center;"> 9750.00 </td>
<td style="text-align:center;"> 6500.0 </td>
<td style="text-align:center;"> 9750 </td>
<td style="text-align:center;"> 6500.00 </td>
<td style="text-align:center;"> 9750.00 </td>
<td style="text-align:center;"> 6500.0 </td>
<td style="text-align:center;"> 9750 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 700.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 2200.00 </td>
<td style="text-align:center;"> 2950.00 </td>
<td style="text-align:center;"> 2200 </td>
<td style="text-align:center;"> 2950.0 </td>
<td style="text-align:center;"> 2200.00 </td>
<td style="text-align:center;"> 2950.00 </td>
<td style="text-align:center;"> 2200 </td>
<td style="text-align:center;"> 2950.0 </td>
<td style="text-align:left;"> 6900.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 6900.0 </td>
<td style="text-align:center;"> 10000 </td>
<td style="text-align:center;"> 6900.00 </td>
<td style="text-align:center;"> 10000.00 </td>
<td style="text-align:center;"> 6900.0 </td>
<td style="text-align:center;"> 10000 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> 540.00 </td>
<td style="text-align:center;"> 810.00 </td>
<td style="text-align:center;"> 540 </td>
<td style="text-align:center;"> 810.0 </td>
<td style="text-align:center;"> 540.00 </td>
<td style="text-align:center;"> 810.00 </td>
<td style="text-align:center;"> 540 </td>
<td style="text-align:center;"> 810.0 </td>
<td style="text-align:left;"> 540.00 </td>
<td style="text-align:center;"> 810.00 </td>
<td style="text-align:center;"> 540.0 </td>
<td style="text-align:center;"> 810 </td>
<td style="text-align:center;"> 540.00 </td>
<td style="text-align:center;"> 810.00 </td>
<td style="text-align:center;"> 500.0 </td>
<td style="text-align:center;"> 810 </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> 4500.00 </td>
<td style="text-align:center;"> 4000 </td>
<td style="text-align:center;"> 4500.0 </td>
<td style="text-align:left;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4000.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> 3500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3500.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3500 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 250.00 </td>
<td style="text-align:center;"> 250.00 </td>
<td style="text-align:center;"> 250 </td>
<td style="text-align:center;"> 250.0 </td>
<td style="text-align:center;"> 250.00 </td>
<td style="text-align:center;"> 250.00 </td>
<td style="text-align:center;"> 250 </td>
<td style="text-align:center;"> 250.0 </td>
<td style="text-align:left;"> 250.00 </td>
<td style="text-align:center;"> 250.00 </td>
<td style="text-align:center;"> 250.0 </td>
<td style="text-align:center;"> 250 </td>
<td style="text-align:center;"> 250.00 </td>
<td style="text-align:center;"> 250.00 </td>
<td style="text-align:center;"> 250.0 </td>
<td style="text-align:center;"> 250 </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> 16110.00 </td>
<td style="text-align:center;"> 16110.00 </td>
<td style="text-align:center;"> 16110 </td>
<td style="text-align:center;"> 16110.0 </td>
<td style="text-align:center;"> 16110.00 </td>
<td style="text-align:center;"> 16110.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 4550.00 </td>
<td style="text-align:center;"> 4550.00 </td>
<td style="text-align:center;"> 4550 </td>
<td style="text-align:center;"> 4550.0 </td>
<td style="text-align:center;"> 4550.00 </td>
<td style="text-align:center;"> 4550.00 </td>
<td style="text-align:center;"> 4550 </td>
<td style="text-align:center;"> 4550.0 </td>
<td style="text-align:left;"> 4615.00 </td>
<td style="text-align:center;"> 4615.00 </td>
<td style="text-align:center;"> 4616.0 </td>
<td style="text-align:center;"> 4615 </td>
<td style="text-align:center;"> 4615.00 </td>
<td style="text-align:center;"> 4615.00 </td>
<td style="text-align:center;"> 4615.0 </td>
<td style="text-align:center;"> 4615 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> 300.00 </td>
<td style="text-align:center;"> 300.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 300.00 </td>
<td style="text-align:center;"> 300.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 4950.00 </td>
<td style="text-align:center;"> 9900.00 </td>
<td style="text-align:center;"> 4950 </td>
<td style="text-align:center;"> 9900.0 </td>
<td style="text-align:center;"> 4950.00 </td>
<td style="text-align:center;"> 9900.00 </td>
<td style="text-align:center;"> 4950 </td>
<td style="text-align:center;"> 9900.0 </td>
<td style="text-align:left;"> 10800.00 </td>
<td style="text-align:center;"> 21600.00 </td>
<td style="text-align:center;"> 10800.0 </td>
<td style="text-align:center;"> 21600 </td>
<td style="text-align:center;"> 10800.00 </td>
<td style="text-align:center;"> 21900.00 </td>
<td style="text-align:center;"> 10800.0 </td>
<td style="text-align:center;"> 21600 </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2250 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> 5250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5250.0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> 4250.00 </td>
<td style="text-align:center;"> 4250.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> 6105.00 </td>
<td style="text-align:center;"> 6605.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:left;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 500 </td>
<td style="text-align:center;"> 750.0 </td>
<td style="text-align:left;"> 500.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 500.0 </td>
<td style="text-align:center;"> 750 </td>
<td style="text-align:center;"> 500.00 </td>
<td style="text-align:center;"> 750.00 </td>
<td style="text-align:center;"> 500.0 </td>
<td style="text-align:center;"> 750 </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 3300.00 </td>
<td style="text-align:center;"> 6600.00 </td>
<td style="text-align:center;"> 3300 </td>
<td style="text-align:center;"> 6600.0 </td>
<td style="text-align:center;"> 3300.00 </td>
<td style="text-align:center;"> 6600.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:left;"> 4600.00 </td>
<td style="text-align:center;"> 6900.00 </td>
<td style="text-align:center;"> 4600.0 </td>
<td style="text-align:center;"> 6900 </td>
<td style="text-align:center;"> 4600.00 </td>
<td style="text-align:center;"> 6900.00 </td>
<td style="text-align:center;"> 0.0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> 1500 </td>
<td style="text-align:center;"> 2250.0 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> 1500 </td>
<td style="text-align:center;"> 2250.0 </td>
<td style="text-align:left;"> 1500.00 </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> 1500.0 </td>
<td style="text-align:center;"> 2250 </td>
<td style="text-align:center;"> 1500.00 </td>
<td style="text-align:center;"> 2250.00 </td>
<td style="text-align:center;"> 1500.0 </td>
<td style="text-align:center;"> 2250 </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table21-2)User Fees for Residential Water and Sewer Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Billing Cycle </th>
<th style="text-align:center;"> Water Use Fee ($) </th>
<th style="text-align:center;"> Sewer Use Fee ($) </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 45.00 - up to 5000 gal
then - 9.25 per 1000 gal </td>
<td style="text-align:center;"> 45.00 - up to 5000 gal
then - 10.50 per 1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 2.97/100 cubic feet
18 dollars billing charge </td>
<td style="text-align:center;"> 4.00/100 cubic feet
No billing charge </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 10.00 for first 2000 gallons of metered consumption </td>
<td style="text-align:center;"> 0-2000 gallons 29.60
charge per 1000 gallons over 2000 16.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> 2.38/1000 gals. </td>
<td style="text-align:center;"> 2.92/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Fixed Rate 2 months 15.24
per 1000 gal. 4.12 </td>
<td style="text-align:center;"> Fixed Rate 2 months 17.34
per 1000 gal. 7.17 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 21.00 first 4200 gals.
.30 afterwards per 100 gals </td>
<td style="text-align:center;"> 24.00 Flat Rate </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> vary according to area of county/ more information contact Bedford Regional
Water Authority
540-586-7679 </td>
<td style="text-align:center;"> vary according to area of county </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Min 14.75
1- 19000 gals.: 7.25/1000 gallons 19001 - 30000 gals.: 5.00/1000 gals. </td>
<td style="text-align:center;"> Min 15.00
1st 2000 gals. 6.50/1000 gallons up to 8000 gallons. </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0-1000 gal 20.00 monthly
over 1000 9.00 per 1000 </td>
<td style="text-align:center;"> same </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Connection:
26.12/1000 gal. up to 4000
over 4000 gal. 13.60/1000 gal. </td>
<td style="text-align:center;"> 42.08/1000 gal. up to 4000 over 4000 gal. 14.01/1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 17.02 Base Fees for 5/8"-3/4" Meter
1.52/1000 for 0 to 4000 gal.
1.83/1000 for 4001 to 8000 gal.
4.25/1000 for 8001 to 10000 gal.
4.86/1000 for over 10000 gal.
1.05 Capital Asset Fee (Debt Service)
.53 Administrative Fee </td>
<td style="text-align:center;"> 20.84 for Base Fees for 5/8"-3/4" Meter
9.55/1000 for 0 to 4000 gal.
9.85/1000 for 4001 to 8000 gal.
10.13/1000 for 8001 to 10000 gal.
11.00/1000 for over 10000 gal.
2.10 Capital Asset Fee (Debt Service)
.53 Administrative Fee </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0-2000 28.00
each additional 1000 gal - 6.60 </td>
<td style="text-align:center;"> 0-2000 25.00
each additional 1000 gal - 8.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0 - 2000 gals.: 8.00
2001 - 5000 gals.: 2.50/1000 gals
5001 - 10000 gals.: 2.00/1000 gals.
Over 10000 gals.: 1.75/1000 gals. </td>
<td style="text-align:center;"> 0 - 2000 gals.: 8.00
2001 - 5000 gals.: 2.50/1000 gals
5001 - 10000 gals.: 2.00/1000 gals.
Over 10000 gals.: 1.75/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Bimonthly Billed (5/8")
Customer charge 10.16
Capacity charge 15.28
Commodity charge 2.07 per ccf </td>
<td style="text-align:center;"> Bimonthly Billed (5/8")
Customer charge 10.16
Capacity charge 28.30
Commodity charge 2.24 per ccf </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 11.73 for 1st 1000 gallons
0.1173 for each 10 gallons over 1000 </td>
<td style="text-align:center;"> 108.33 to 9000 gallons
0.1381 per 10 gallons thereafter </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0-2000 (min. chg) 16.85
2001-25000 8.42
25001-100000 6.76
Over 100000 5.02
Service charge 1.00 </td>
<td style="text-align:center;"> 0-2000 (min. chg) 18.21
2001-25000 9.11
25001-100000 8.28
Over 100000 8.03
Service charge 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Residential: 25/mo. Minimum </td>
<td style="text-align:center;"> Residential 25.00/mo.
Govt/education: 115/mo. Minimum 25.00/mo. </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 19.00 First 1500 gal then
9.50 per 1000 gal </td>
<td style="text-align:center;"> 26.00 first 2500 gal then
11.50 per 1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 11.39 for first 2000gal of water
4.31 per thousand for next 18000
3.71 per thousand over 20000 </td>
<td style="text-align:center;"> 14.82 for the first 2000
6.00 per thousand for the next 18000
5.58 per thousand for over 20000 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 12.20 service charge + 3.07 commodity charge per 1000 gals </td>
<td style="text-align:center;"> 7.28 per 1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Min. 2000 gals.=26.09
3000-20k = 4.32/1000 gal.
21k-50k = 4.57/1000 gal.
51k-100k = 4.98/1000 gal.
101k+ = 6.17/1000 gal. </td>
<td style="text-align:center;"> Min. 2000 gals.= 46.67
3000-20k = 5.17/1000 gal.
21k-50k = 5.47/1000 gal.
51k-100k = 5.96/1000 gal.
101k+ = 6.50/1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 3.91/1000 gallons </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 10.00 bimonthly service fee
5.50/1000 gallons </td>
<td style="text-align:center;"> 30.00 bimonthly service fee
6.02/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 21 per first 2000 gallons used then .00550 per each additional gallon </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 16.95 min. per 1st 3000 gals. then 5.65/1000 gallons </td>
<td style="text-align:center;"> 32.35 min. on 1st 4000 gals. then 6.47/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 0 - 4000 gal. 1.69/1000
4001-15000 gal 5.14/1000
15001-40000 gal 6.68/1000
Minimum base charge 10.62 </td>
<td style="text-align:center;"> 0-4000(gal) 5.99/1000
4001-15000 gal 7.55/1000
15001-40000 gal 7.55/1000
Minimum base charge - 22.33 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Service charge 15.65
Volume charge 3.59/ccf
6 ccf or less 2.24/ccf </td>
<td style="text-align:center;"> Service charge 31.55
Volume charge 3.81/ccf
6 ccf or less 2.33/ccf </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0 - 4000 gals.: 30.00
over 4000 gals.: 4.70/1000 gals. (Residential) </td>
<td style="text-align:center;"> 0 - 4000 gals.: 30.00
over 4000 gals.: 4.70/1000 gals.(Residential) </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> Mc Dowell Water System
37.50 per 8000 gal.
Addtl 7.50 per 1000 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 10.16/1000 gal. under 50000 gal. usage
8.97/1000 gal. over 50000 gal. usage </td>
<td style="text-align:center;"> 6.34/1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> fixed charge: 10.56. (5/8 pipe)
0 - 15000 : 3.61/1000 gal.
15001 - 30k: 7.22/1000 gal.
30000+: 16.95/1000 gal. </td>
<td style="text-align:center;"> Quarterly Fixed Charge:
(5/8”) 5.95
water charge: 3.08/1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 4.92/1000 gallons </td>
<td style="text-align:center;"> 11.49/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 0 - 3000 gals: 30
Over 3000 gals.: 6.00per 1000 gallons. </td>
<td style="text-align:center;"> 0 - 3000 gals.: 41.46
Over 3000 gals.: 13.82 per 1000 gallons. </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 38.70 </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> Quarterly:
Basic Charge 24.46;
1.77/1000 g. for 0-25k g.
4.96/1000 g. for 25001-50k g.
6.65/1000 g. for > 50k g. </td>
<td style="text-align:center;"> Quarterly:
Basic Charge 21.90
Rate per 1000 is 3.14 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 9.52/1000 gallons
monthly service fee 6.50
monthly VDH surcharge .25 </td>
<td style="text-align:center;"> 8.51/1000 gallons
monthly service fee 6.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 4000 gal. 38.20
10.50/1000 gal </td>
<td style="text-align:center;"> 4000 gal.47.05 County </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 0-6000 gals(minimum) 48.58
per 1000 gals
6001-12000 7.29
120001-18000 7.95
18001 & up 8.33 </td>
<td style="text-align:center;"> 0-6000 gals(minimum) 67.49
per 1000 gals
6001-12000 10.11
120001-18000 10.96
18001 & up 11.55 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Reedville 56
Callao 56
Fleeton 56
Blackberry 56
Twin Harbors 56 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 26.50 per 0-2000 gallons
5.20/1000 over 2000 gallons </td>
<td style="text-align:center;"> 19.00 per 0-2000 gallons
5.60/1000 over 2000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 46.00 (based on 8000 gallons of water) </td>
<td style="text-align:center;"> 50.00 (based on 10000 gallons of sewer) </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 6.73/1000 gallons (bi-monthly charge) </td>
<td style="text-align:center;"> 6.61/1000 gallons (bi-monthly charge) </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pr<NAME> County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> turn on water: 5 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 2.90 PER 1000 GALLONS </td>
<td style="text-align:center;"> 5.60 PER 1000 GALLONS </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 3.00/1000 gallons
over 5000 gallons 4.00 per
1000 </td>
<td style="text-align:center;"> 3.75/1000 gallons
over 5000 gallons 3.60 per
1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 22.68 + 5.75/1000 gal </td>
<td style="text-align:center;"> 34.87 + 9.75/1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> see website
various rates </td>
<td style="text-align:center;"> 6.00/thousand gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> TomsBrook-Maurertown 25 min.
Stoney Creek 19.50 min. </td>
<td style="text-align:center;"> Toms Brook-Maurertown 23 min.
Stoney Creek 25.50 min. </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 1st 1000 gals. 21.43
1001 - 6000 gals. 9.29/1000 gals.
Over 6000 gals. 11.43/1000 gals </td>
<td style="text-align:center;"> 1st 1000 gals. 21.43
1001 - 6000 gals. 9.29/1000
Over 6000 gals. 11.43/1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 28.00 first 4000 gal
6.00 per 1000 gal thereafter </td>
<td style="text-align:center;"> 36.00 first 4000 gal
8.00 per 1000 gal thereafter </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> GALLONS
0-2000 2.52 per 1000
3000-4000 3.51 per 1000
5000-8000 4.81 per 1000
9000-12000 9.66 PER 1000
13000-25000 12.25 PER 1000
26000+ 17.03 PER 1000 </td>
<td style="text-align:center;"> GALLONS
0-2000 5.98 per 1000
3000-4000 5.98 per 1000
5000-8000 5.98 per 1000
9000-12000 5.98 PER 1000
13000-25000 5.98 PER 1000
26000+ 5.98 PER 1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 28 </td>
<td style="text-align:center;"> 34.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> DOES NOT APPLY </td>
<td style="text-align:center;"> DOES NOT APLY </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0 - 1000 gallons 23.66
Over 1000 gallons 8.25/ 1000 gal </td>
<td style="text-align:center;"> 0 - 1000 gallons 23.66
0ver 1000 gallons 8.25/
1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> First 3000 gallons 9.92 then 8.51 per thousand.
Town of Front Royal </td>
<td style="text-align:center;"> First 3000 gallons 16.17 then 13.91 per thousand.
Town of Front Royal </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Monthly Minimum Charge:
Meter Size Amount
3/4" 23.96
1" 33.54
2" 69.48
4" 335.39
6" 503.08
8" 694.73
Monthly Variable Charge (per 1000 gallons):
1000 - 3000 gallons - 5.3 </td>
<td style="text-align:center;"> Monthly Minimum charge: 29.91
Montly Variable Charge (per 1000 gallons): 8.19
Monthly availability fee: 26.01 </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 45.00 Flat Rate
Meter Reading 45.00 for 6000 gallons after that times by 5.7% </td>
<td style="text-align:center;"> 33.00 Residential
61.00 Commercial </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 22.00 1st 1500 gallons + 12.75 every 1000 gallons after </td>
<td style="text-align:center;"> 34.00 1st 1500 gallons +13.00 every 1000 gallons after
Sewer flat fee -Well water 49.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 1st. 1000 gal. 18.00 18each addit. 1000 9.00 </td>
<td style="text-align:center;"> 1st. 3000 gal. 22.00
and each addit. 1000 6.90 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Residential 52.00 &
Commercial 4.82/1000 gals </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> (3/4")
0 - 2000 gals - 14.80
2000+ gals - 1.6352/1000gal </td>
<td style="text-align:center;"> Service charge: 4.42
6.11/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 7.48 per thousand </td>
<td style="text-align:center;"> 7.44 per thousand </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 4.00 + 50.62/1000cf May -Sept
4.00/mth + 38.94 1000 cf Oct-April </td>
<td style="text-align:center;"> Monthly svc charge 4.00+
54.00/1000 cf water consumption </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 5.05 per 100 cubic feet </td>
<td style="text-align:center;"> 4.80 per 100 cubic feet </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Minimum charge for 1000cf 22.33*
Next 4000 cf 16.20 per 1000cf
Next 20000cf 18.00 per 1000cf
Next 100000cf 20.00 per 1000cf
over 125000cf 22.00 per 1000cf </td>
<td style="text-align:center;"> Under 100000cf 29.13* plus 2.75 per 100 cf
over 100000 cf 3.30 per 100cf </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 25.00 </td>
<td style="text-align:center;"> 31.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 2.20 per 100 CF </td>
<td style="text-align:center;"> 2.55 per 100 CF </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Min. 2000 Gallons ~ 20.45
Next 48000/1000 ~ 9.49
Over 50000-1000000 - 5.77
Over 1000000 - 4.28 </td>
<td style="text-align:center;"> Min. 2000 Gallons ~ 21.74
Next 48000/1000 ~ 8.13
Over 50000/1000000 ~ 6.21
Over 1000000 - 4.84 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 3.27/1000 gal.+ 8.07 service charge
4.99/100 gal.+ 8.07 service charge </td>
<td style="text-align:center;"> 8.62/1000 gal. + 5.00 sewer base fee as of 7-1-13 for City residents.
6.55/1000 gal. + 12.79 sewer base fee as of 7-1-13 for County residents. </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 14.22 per month plus 3.20 per 1000 gals </td>
<td style="text-align:center;"> 19.01 per month plus 4.43 per 1000 gals </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> flat rate 31.74 and usage 25.1 cents/100 gallons </td>
<td style="text-align:center;"> 49.2 cents/100 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 16.33:0-6000 gal 1.73/1000:7000-300000 gal; 1.53/1000: 301000-600000; 1.27/1000: >601000 </td>
<td style="text-align:center;"> 16.33: 0-6000 gal 1.73/1000: 7000-300000 gal 1.53/1000: 301000-600000 gal 1.27/1000: >601000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Stormwater User Fee - Residential - 8.83 per mo Stormwater User Fee - Commercial - 8.83 per 2429 sq ft of impervious area per mo </td>
<td style="text-align:center;"> user fee: 1.48 per 100 cu.ft.of water consumption
***surcharge fee: 0.66 per 100 cu. ft.of water consumption (***complies with regional consent order regarding repair & replacement of sewer lines) </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> City
10.77 min.
0-250000 gals. 3.59
over 250000 3.29
Also Jul-Nov seasonal rate of 24 cents per 1000 gallons
Rural
16.98 min.
0-250000 gals. 5.66
over 250000 4.72 </td>
<td style="text-align:center;"> City
17.31 min.
0-250000 5.77
over 250000 5.57
Also Jul-Nov seasonal rate of 24 cents per 1000 gallons
Rural
25.74 min.
0-250000 8.58
over 250000 8.16 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> For first 3 units no charge
4-17 units 4.6682
18-2980 units 3.913
2981-7000 units 2.3514
7001-50000 units .9405
over 50000 units 1.2999
base charge or minimum chare 16.25 </td>
<td style="text-align:center;"> For the first 3 units 12.51 minimum charge
4-17 units 2.77
anything over 17 2.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> minimum of 400 cf billed
401-2200 cf .0519
2201-24000 cf .0827
24001- & over cf .1136
Outside City Limits 35% more </td>
<td style="text-align:center;"> minimum of 400 cf billed
401-2200 cf .1033
2201-24000 cf .1647
24001-& over cf .2261
Outside City Limits 35% more </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 2.55 per HUNDRED CUBIC FEET </td>
<td style="text-align:center;"> 6.02 per HCF </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 8.65 monthly service charge plus
2.77 per 1000 for first 5K
3.08 per 1000 for over 5K to 12K </td>
<td style="text-align:center;"> 8.00 monthly service charge plus
2.59 per 1000 first 5K metered water
3.73 per 1000 over 5K metered water </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 52.00 (combined w/ sewer use fee) </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> For 3/4" Within City Limits:
1st 4000 gals/mo. 25.31next 2000 gals/mo. 3.19/1000 gals
next 100000 gals/mo. 2.94/1000 gals
next 100000 gales/mo.2.43/1000 gals
over 206000 gals/mo. 2.10/1000 gals </td>
<td style="text-align:center;"> For 4" Within City Limits:
1st 4000 gals. 23.64
next 2996000 gals. 2.73/1000 gals
next 7000000 gals. 2.36/1000 gals
over 10000000 gal./mo 2.00per 1000 gals </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> RI-Lifeline 0-2 hcf=3.21/hcf
R2-Normal over 2 to 25 hcf=3.69/hcf
R3-Conservation over 25hcf=7.38 hcf </td>
<td style="text-align:center;"> Service Fee 5.00/Month and
Maintenance 3.37/HCF </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 5.11 per 100 cubic feet </td>
<td style="text-align:center;"> 4.30 per 100 cubic feet </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In town: 4.30/1000 gals
(min. fee < 2000 gals) 14.40
Out-town: 8.60/1000 gals (min. bill (<2000 gals)21.60
Water improvement fee:
0 - 2000 gals.: 2.50/month
2001 - 4200 gals: 5.00/month
4201 - 10000 gals: 7.50/month
10001 - 27000 gals: 10.00/mont </td>
<td style="text-align:center;"> In-town: 175% water bill
Out-town: 200% water bill </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 10.42 residential
.35 0-300cf .57/100 cf
1.49 301-12500cf 2.451/100 cf
.96 over 12500 cf </td>
<td style="text-align:center;"> residential: 8.55
0 - 300 cf: 0.57/100 cf
301 - 12500 cf: 2.451/100 cf
Over 12500 cf: 1.5675/100cf </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Based on Newport News Waterworks rates </td>
<td style="text-align:center;"> 62.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> 3.38/1000 gals or 2.528/100 cu.ft.
+5.00 monthly meter fee (assuming residential size meter) </td>
<td style="text-align:center;"> 2.65/1000 gal. or 1.98/100 cu.ft
Minimum 2.30 per month </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0-4000 gal 16.32
4001-100000 gal 4.08
100001-4000000 gal 3.68
4000001+ gal 2.86 </td>
<td style="text-align:center;"> 0-2000 gal 12.24
Over 2000 gal 6.12
No sewer rate 3.06 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Base fee 5/8 meter: 14.56
Volume charge: 4.31/ccf </td>
<td style="text-align:center;"> Base fee: 17.51
Volume charge: 7.01/ccf </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Base charge: 12.60
First 5000 gals.: 5.41
5001 - 10000 gals.: 5.63
10001 - 75000 gals.: 6.08
75001 - 1 million : 6.39
Over 1 million : 3.79 </td>
<td style="text-align:center;"> Base charge: 22.70
First 5000 gals.: 5.39
5001 - 10000 gals.: 5.39
10001 - 75000 gals.: 5.39
Over 75000 : 5.39 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 2.90/100 cu.ft. </td>
<td style="text-align:center;"> 4.88/100 cu.ft. </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 7.84 per 100 cu ft
Bi-monthly Meter Service Charge - 4.80 </td>
<td style="text-align:center;"> 5.82 per 100 cu ft </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Bi-monthly:
17.32/base
5.13/1000 gal. </td>
<td style="text-align:center;"> Bi-monthly:
28.18/base
8.70/1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 5.30/1000 gal.(includes sewer) </td>
<td style="text-align:center;"> 5.30/1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 1st 3000 gallons:
3/4" 45.58
1" 73.88
Over 3000 gals. 6.38/1000 gals In-city
Over 3000 gals. 8.37/1000 gals Out-city </td>
<td style="text-align:center;"> 11.63/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Residential
In-Town:
1st 2000 gals. 24.22
each 1000 after 4.26
Out-Of-Town:
1st 2000 gals. 44.15
each 1000 after 7.17 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 2.54 per 1000 gals. - Town Residents/Businesses
5.08 per 1000 gals. - Out-Of- Town Residents
2.49 per 1000 gals. - Industrial </td>
<td style="text-align:center;"> 3.32 per 1000 gals.- Town Residents/Businesses
6.64 per 1000 gals.-Out of Town Residents
3.40 per 1000 gals. Industrial Customer </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In Town
Residential Base Charge: 15.60 7.35/1000 gals. </td>
<td style="text-align:center;"> In Town
Residential Base Charge 27.35 6.85/ 1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-town: 15.25 for 1st 1000 gallons
5.75 per 1000 gallons afterward
Out-of-town: 20.60 for 1st 1000 gallons; 9.00 per 1000 gallons afterward </td>
<td style="text-align:center;"> 135% of water fee </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 11 0-2000 gallons
6 each 1000 gallons over 2000. </td>
<td style="text-align:center;"> 30.60 0-2000 gallons. 17.25 each 1000 gallons over 2000. </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 8.40 per 1000 gallons of usage
5.00 per month minimum charge </td>
<td style="text-align:center;"> 17.00 per 1000 gallons of usage
15.00 per month minimum charge </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Inside Corporate Area:
0 - 1500 gals. 18.28
1000 or more 6.15/1000 gals.
Outside Corporate Area:
0 - 1500 gals. 29.47
1000 or more 9.85/1000 gals. </td>
<td style="text-align:center;"> Inside Corporate Area:
0 - 1000 gals. 19.55
1000 or more 5.86/1000 gals.
Outside Corporate Area:
0 - 1000 gals. 33.26
1000 or more 9.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> fixed: 2.94
volume: 7.20/1000 gals. </td>
<td style="text-align:center;"> fixed: 2.96
volume: 6.02/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> First 3000 gal 24.90
Next 40000 gal 8.30/1000 gal
Next 87000 gal 8.15/1000 gal
All Over 130000gal 8.03/1000 </td>
<td style="text-align:center;"> Minimum Sewer Fee of 24.97
Sewer rate will be 8.31 per thousand gallons of water over 3000 gallons used </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> First 2000 gallons 24.70
Next 28000 gallons 7.90/1000gals
Next 970000 gallons 6.01/1000gals
Over 1000000 gallons 3.98/1000gals </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 6.00 per 1000 gallons
20.00 base fee inside town residential
20.00commercial
40.00 base fee outside town residential </td>
<td style="text-align:center;"> 6.00 per 1000 gallons
20.00 base fee inside town residential
20.00 base fee inside town commercial
40.00 base fee outside town residential </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 0-5000 gal.: 28.71
5001-10000 gal.: 1.46/1000
10001-20k gal.: 1.53/1000
20001-30k gal.: 1.60/1000
30001 and over: 1.66/1000 </td>
<td style="text-align:center;"> 0-5000 gal.: 57.41
5001-10000 gal.: 2.91/1000
10001-20k gal.: 3.07/1000
20001-30k gal.: 3.20/1000
30001 and over: 3.31/1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town:
21.90 1st. 3000 gallons
over 3000 5/1000 gals.
Out-Of-Town:
31.90 1st. 3000 gallons
over 3000 10/1000 gals. </td>
<td style="text-align:center;"> In-Town:
26.90 1st. 3000 gallons
over 3000 5.00/1000 gals.
Out-Of-Town:
36.90 1st. 3000 gallons
over 3000 10.00/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 1st 1000 8.54
1001-10000 3.75
10001-20000 3.98
20001-30000 4.08
31001-40000 4.32
40001-50000 4.40
50001-4m 4.49
over 4m 4.70 </td>
<td style="text-align:center;"> 1st 1000 14.81
1001-10000 7.32
10001-20000 7.77
20001-30000 7.94
31001-40000 8.46
40001-50000 8.65
50000-4m 8.61
over 4m 8.91 </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Bi-monthly
Gallons
0-3000 21.35
3001-100k 5.09/1000 gal
100k -400k 5.19/1000 gal
400000+ 5.79/ 1000 gal </td>
<td style="text-align:center;"> Bi-monthly
Gallons
0-3000 16.17
3001-100k 3.82/1000 gal
100k - 400k 3.89/1000 gal
400000+ 4.11/1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0 - 2000 gals.: 27.50
Over 2000 gals: 6.80/1000 gals. </td>
<td style="text-align:center;"> 0 - 2000 gals: 17.50
Over 2000 gals: 2.66/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 48.25 Minimum charge for 4000 gallons used
0.315 per 100 gallons for the next 3500 gallons used 0.2325 per 100 gallons for the next 6500 gallons used 0.1275 per 100 gallons for all above 14000 gallons used </td>
<td style="text-align:center;"> First 4000 gallons: 26.25
Next 1000 gallons 3.30/1000 gal. Next 6500 gallons 2.40/1000 gal. All Over 14000 gallons 1.35/1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Residential
31.20 minimum for 0-2000 gallons;
2.63/1000 for 2001-5000 gallons;
3.75/1000 for 5001-10000 gallons;
5.00/1000 for 10001-15000 gallons
7.50/1000 for 15001+ gallons </td>
<td style="text-align:center;"> Residential
62.96 minimum for 0-2000 gallons;
4.11/1000 for 2001-5000 gallons;
5.85/1000 for 5001-10000 gallons;
7.80/1000 for 10001-15000 gallons
11.70/1000 for 15001+ gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0-3000 gal.: 24.95
next 10000 gal 5.67 per 1000 gal
all over 13000 gal 5.55 per 1000 gal
all over 125000 gal 4.93 per 1000 gal </td>
<td style="text-align:center;"> 0-3000 gals: 15.90
Next 10000 gal 2.07 per 1000 gallons
All over 13000 gal 1.97 per 1000 gallons
All over 125000 gal 1.37 per 1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> In-town
46.26 min. charge
5.14 per 1000 gallons
Out-of-town
8.55 per 1000 gallons </td>
<td style="text-align:center;"> In-town
6.39 per 1000 gallons
57.51 min. charge;
Out-of-town
11.90 per 1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In Town:
1st 2000 gals. 17.88 Min All over 2000 gals. 4.47/1000 gals.
Out Of Town:
1st 2000 gals. 35.95 Min
All over 2000 gals. 9.00/1000 gals. </td>
<td style="text-align:center;"> In Town:
1st 2000 gals. 17.88 Min All over 2000 gals. 4.47/1000 gals.
Out Of Town:
1st 2000 gals. 41.71 Min
All over 2000 gals. 10.45/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 7.00 min. per month (up to 1000 gal.); 9.00/ 1000 gal for next 49000 gal. and 6.75 / 1000 gal. for next 5950000 gal.; out-of-Town rate is 150% </td>
<td style="text-align:center;"> 10.00 min. per month (up to 1000 gal.) and 10.25/ 1000 gal. over 1000 gal.; out-of-Town rate is 150% </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 15.50/mo. 3500 gals.
3.00 additional per 1000 gals. </td>
<td style="text-align:center;"> 45/month </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> every 2 months
In town: 60.00 1st 6000 gallons 7.00 each additional 1000 gals
Out of Town: 119.50 1st 6000 gals 13.95 each additional 1000 gals </td>
<td style="text-align:center;"> every 2 months
In town: 92.00 1st 10000 gals 13.00 each addl. 1000 gals
Out of town: 208.00 1st 10000 gals 19.92 each addl. 1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 24.50 for up to 5000 gal </td>
<td style="text-align:center;"> 71.50 fo rup to 5000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town:
12.00 1st 2000 gals.
3.81 per thousand over 2000 gals.
Out-Of-Town:
17.00 or 20.00 1st 2000 gals.
4.94 per thousand over 2000 gals. </td>
<td style="text-align:center;"> In-Town:
17.00 1st 2000 gals.
6.00 per thousand over 2000 gals.
Out-of-Town:
7.15 per thousand over 2000 gals.
22.00 lst 2000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In town rates <500 gal 12.89
Up to 2000 (minimum) 19.80
>2000 Gallons (per thousand) 5.94
Out of town <500 Gallons 19.32
Up to 2000 Gallons (Minimum) 28.14
>2000 gallons (per thousand) 8.88 </td>
<td style="text-align:center;"> 150% of the utility bill </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 72.30 </td>
<td style="text-align:center;"> 162.70 </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 11.00 per 5000 gals. Residential&Business
24.00 Commercial- 25000 gals. </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Monthly:
5000 gallons min. 37.00
over 5000 gals. 9.50/1000 gals. </td>
<td style="text-align:center;"> Monthly:
5000 gallons min. 34.00
over 5000 gals. 7.00/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town: (As of 7/1/19)
0-2000 gal min rate = 12.77
2001-25000 gal @ .639
25001-100000 gal @ .512
Over 100000 gals @ .381 </td>
<td style="text-align:center;"> As of 7/1/19)
0-2000 gal min rate = 16.12
2001-25000 gal @ .805
25001-100000 gal @ .740
Over 100000 gals @ .724 </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Eff. 7/1/13
0-2000 gal. - 6.90 min.;
2001-350000 gal. - 3.40 per 1000 gal.;
350001 & up - 2.55 per 1000 gal. </td>
<td style="text-align:center;"> Eff. 7/1/13
0-2000 gal. - 9.80 min.;
2001-350000 gal. - 4.85 per 1000 gals.;
350001 & up - 4.25 per 1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town Minimum rate:
1st 5000 gals. 32.00
Next 50000 gals. 2.00/1000 gals.
Next 50000 gals. 1.50/1000 gals.
All over 105000 gals. 1.00/1000 gals.
Out-Of-Town Minimum rate:
1st 5000 gals. 37.00
(all overages are same as above)
These new rat </td>
<td style="text-align:center;"> In-Town minimum sewer rate: 20.00
Min. rate specified commercial user 25.00
Over 30000 water use 1.00/1000 gallons
Out-of-Town Minimum rate 27.00
These new rates are effective July 1 of 2013. </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-town: 22.26 1st 2000 gal. + 5.80 per each additional 1000 gallons; Out of town: 30.79 1st 2000 gal. + 6.62 per each additional 1000 gallons. </td>
<td style="text-align:center;"> In-town: 10.21 1st 1500 gal. of water usage + 5.25 per each aditional 1000 gallons; Out of Town: 11.94 1st 1500 gal. of water + 6.00 per each additional 1000 gallons. </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Min. 19.50 </td>
<td style="text-align:center;"> 19.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> In-town: .35/100 gals.
Out-of-town: .45/100 gals.
15 minimum </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-town:
0-3000 gals.: 28.50
over 3000 gals: 7.00/1000 gals
Out-town:
0-3000 gals.: 42.75
over 3000 gals: 10.50/1000 gals </td>
<td style="text-align:center;"> In-town:
0-3000 gals.: 35.00
over 3000 gals: 11.00/1000 gals
Out-town:
0-3000 gals.: 52.50
over 3000 gals: 16.50/1000 gals </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 18.50--up to 1000 gals.
2.75--1001--10000 gals.
5.00--10001--20000 gals.
5.50--20001 and over </td>
<td style="text-align:center;"> 44.50 per month </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 1st. 1500 gals 10.75
1500 - 10000 gals: 3.50/1000 gals.
Over 10000 gals: 5.00/1000 gals. </td>
<td style="text-align:center;"> 120% of water amount </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> 15.60 plus 4.10/1000 gallons </td>
<td style="text-align:center;"> 18.79 plus 6.69/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 21.00 for 1st 3000 gal.
6.70/1000 gallons </td>
<td style="text-align:center;"> 33.00 for 1st 3000 gallons
11.00/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town Rates
9.92 first 3000 gallons
8.51 per thousand there after </td>
<td style="text-align:center;"> In-Town Rates
16.17 first 3000 gallons
13.91 per thousand there after </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 28.15 In Town for first 2000 gallons
30.25 Out of Town for first 2000 gallons
7.90 for each additional 1000 gallons </td>
<td style="text-align:center;"> Sewer rates are 28.68 for first 2000 gallons and 8.12 for each additional 1000 gallons. These fees are based on the water consumption and are for residential and commercial. We do not have out of town sewer. </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Water 31.50 (3000 gallons) .49/100 gallons </td>
<td style="text-align:center;"> Sewer 32.08 (3000 gallons) .13/100 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Res./Comm.:
In-town:
0-1000 gal.: 23.55
over 1000 gal.: 7.45/1000
Out-town:
0-1000 gal.: 37.52
over 1000 gal.: 11.18/1000 </td>
<td style="text-align:center;"> Res./Comm.:
In-town:
0-1000 gal.: 19.99
over 1000 gal.: 8.54/1000
Out-town:
0-1000 gal.: 22.76
over 1000 gal.: 8.54/1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 30.00 Residential
40.00 Small Business
70.00 Large Commercial Business. metered </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Bi-monthly:
In-Town 53.73 for 1st 6000 gals.
5.31 per 1000 gals. In excess
Out-of-Town 107.46 for 1st 6000 gals.
8.23 per 1000 gals. In excess </td>
<td style="text-align:center;"> Bi-monthly:
In-Town 34.09 for 1st 6000 gals.
3.65 per 1000 gals. In excess
Out-of-Town 68.17 for 1st 6000 gals.
7.30 per 1000 gals. in excess </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 0-2000: 20.63
Above 2000 gal.: 2.01 per 1000 gal. </td>
<td style="text-align:center;"> 0-2000 gallons: 47.53;
Above 2000 gal.: 3.75 per 1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> WATER IN TOWN: 4.75 PER 1000 GAL UP TO 8000 GAL
11.50 PER 1000 GAL ABOVE 8000 GAL
19.00 WATER SURCHARGE
WATER OUT OF TOWN:
6.50 PER 1000 GAL UP TO 8000 GAL
11.50 PER 1000 GAL ABOVE 8000 GAL
19.00 WATER SURCHARGE </td>
<td style="text-align:center;"> SEWER IN TOWN: 7.00 PER 1000 GAL UP TO 8000 GAL
17.50 PER 1000 GAL ABOVE 8000 GAL
13.00 WATER SURCHARGE
SEWER OUT OF TOWN:
9.00 PER 1000 GAL UP TO 8000 GAL
20.50 PER 1000 GAL ABOVE 8000 GAL
13.00 WATER SURCHARGE
46.00 FLAT RATE (IN TOWN)
13.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> (Billed Quarterly)
5/8" meter service fee= 8.84 until June 30 2019
Base water rate= 3.06 per 1000 gals until June 30 2019
Water peak rate = 5.23 per 1000 gals until June 30 2019 (first tier); 4.32 per 1000 gals (second tier) until June 30 2019. </td>
<td style="text-align:center;"> (Billed Quarterly)
Base sewer rate= 5.78 per 1000 gals until June 30 2019 </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> (Bimonthly rates:
In town: 1st 4000 gals: 40.74
then 3.62/1000 gallons
Out town: 1st 4000 gals: 46.86
then 7.01/1000 gallons </td>
<td style="text-align:center;"> Bimonthly rate:
In-town 1st 4000 gals: 37.53
then 5.61/1000 gallons
Out-town 1st 4000 gals: 59.56
then 7.12/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 25.69 </td>
<td style="text-align:center;"> 28.26 </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 24 service charge + 9.10 per 1000 gallons </td>
<td style="text-align:center;"> 80 + 5.50/K @ 85% of water usage </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 1st. 999 gals. 12.50
4.69/1000 gallons </td>
<td style="text-align:center;"> 1st. 999 gals. 20.25
5.94/1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 34.00/mo. Availiabilty Fee
5.00/mo. Meter Fee </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> up to 3000 gals. = 15.15 Over 3000 gals: 5.50/1000 gals. </td>
<td style="text-align:center;"> up to 2000 gals. = 44.19 2001 and above 8.09 per 1000 gallon </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 5.00 per 1000 gallons </td>
<td style="text-align:center;"> 4.00 per 1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Bi-monthly rates
Min. Fee (0-5000 gal) 27.50(res) 55.00(commercial)
Additional 1000gal 2.80(res) 5.60(commerical) </td>
<td style="text-align:center;"> Bi-monthly rates
Min. Fee (0-5000 gal) 47.50(res) 95.00(comm)
Additional 1000gal 6.25(res) 12.50(commercial) </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town: 27.52 1st. 3000 gals.
Out-of-Town: 49.50 1st. 3000 gals.
Then 4.10 per 1000 gal. </td>
<td style="text-align:center;"> In-Town: 23.48 1st. 3000 gals.
Out-of-Town: 31.50 1st. 3000 gals.
Then 5.40 per 1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town:
1st 2000 gals. 10.50
ea additional 1000 3.94
out-of-town
1st 2000 gals. 18.38
each additional 1000 6.88 </td>
<td style="text-align:center;"> In-Town:
1st 2000 gals. 10.50
ea additional 1000 3.94
Out-Of-Town:
1st 2000 gals. 18.38
ea additional 1000 6.88 </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 300 cf: Res./in-town: 14.80
Comm./in-town: 15.80
Res./Out-of-town: 22.80
Comm./Out-of-town: 27.80
Tier Rate 1 (addition to basic use) 2245–14960 3.90/748 gallons </td>
<td style="text-align:center;"> 300 cf: Res./in-town: 15.80
Comm./in-town: 16.80
Res./Out-of-town: 23.80
Comm./Out-of-town: 28.80
Tier Rate 1 2245–14960 3.90/748 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> Effective July 1 2016
In Town
0-6000 gallons = 4.37/1000
6001-15000 gal = 5.46/1000
15001-300000 gal = 6.55/1000
Greater than 300001 = 8.69/1000
Out of Town
0-6000 gallons = 6.16/1000
6001-15000 gal = 7.70/1000
15001-300000 gal = 9.24/1000
G </td>
<td style="text-align:center;"> Effective July 1 2016
In Town
5.84/1000
Greater than 36000 = 0.00
Out Of Town
0-36000 gal = 8.87/1000
Greater than 36000 = 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 37.32 base (4000 gallons)
6.66 for each additional 1000 gal. </td>
<td style="text-align:center;"> 34.34 base (4000 gallons)
7.19 for each additional 1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 8.96/1000 gals.
Up to 6000 gallons 139.14 flat fee quarterly for both water and sewer </td>
<td style="text-align:center;"> 14.23/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> up to 1000 gals 25.52
1001-10000 5.25 per 1000 10001-25000 5.35 per 1000
25001-50000 5.45 per 1000
50001-100000 5.56 per 1000
100001 an up 5.69 per 1000
outside - above rates + 50% </td>
<td style="text-align:center;"> up to 1000 gals 33.63
1001-10000 7.04 per 1000 10001-25000 7.18 per 1000
25001-50000 7.31 per 1000
50001-100000 7.45 per 1000
100001 an up 7.61 per 1000
outside - above rates + 50% </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> RSA </td>
<td style="text-align:center;"> RSA </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Inside:
0 - 2000 11.70 min.
Over 2000 7.42/1000 gals.
Outside:
0 - 2000 23.37 min.
Over 2000 14.81/1000 gals. </td>
<td style="text-align:center;"> Inside:
0 - 2000 11.70 min.
Over 2000 7.07/1000 gals.
Outside:
0 - 2000 23.37 min.
Over 2000 14.10/1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Minimum of 2000 gallons - 34.28
Over 2000 gallons - 17.14/1000 gallons </td>
<td style="text-align:center;"> Minimum of 2000 gallons - 35.30
Over 2000 gallons - 17.65/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In Town:
Base rate: 26.50/mo for 1st 3000 gal.
Over minimum: 8.00 per 1000 gal.
Outside Town:
Base rate: 30.00/mo for 1st 3000 gal.
Over minimum: 9.00 per 1000 gal. </td>
<td style="text-align:center;"> 35.40/mo for 1st 3000 gal.
Over minimum 8.85 per 1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 18.00 1st. 6000 gallons </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 23.30 for 1000 gallons (minimum bill)
0.71 per 100 gallons of water or part thereof used. </td>
<td style="text-align:center;"> 23.30 for 1000 gallons (minimum bill)
0.71 per 100 gallons of water or part thereof used. </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 7.10 per 1000 gal. </td>
<td style="text-align:center;"> 12.45 per 1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 17.65 </td>
<td style="text-align:center;"> 24.40 </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> First 1700 gal 17.50(min charge)
Over 1700 gal 7.20/1000 gal
Out-of-town
First 1700 gal 26.25(min charge)
Over 1700 gal 10.80/1000 gal </td>
<td style="text-align:center;"> First 1700 gal 32.90(min Charge)
Over 1700 gal 16.01/1000 gal
Out-of-town
First 1700 gal 57.58(min charge)
Over 1700 gal 28.02/1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Residential (in town)
Water 17.00 base charge
0.0045 every gallon over 1000 gallons </td>
<td style="text-align:center;"> Sewer 17.00 base charge
0.0050 every gallon over 2000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> FIRST 3000 GALLONS 28.23
NEXT 12000 GALLONS 9.13 PER 1000 GALLONS
OVER 15000 GALLONS 9.50 PER 1000 GALLONS </td>
<td style="text-align:center;"> 1st 3000 gallons: 62.60
5000–7000 gal.: 22.05/1000 gal.
7000–15000 gal.: 21.42/1000 gal.
15000–30000 gal.: 21.12/1000 gal.
30000–40000 gal.: 20.81/1000 gal.
40000–90000 gal.: 20.51/1000 gal.
90000–200000 gal.: 19.58/1000 gal.
200000–400000 gal.: 19 </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town:
6.60 base rate + 0.40/100 gals. of consumption
Out-Of-Town:
31.90 base rate + 0.66/100 gals. of consumption </td>
<td style="text-align:center;"> In-Town: 25.38 + 0.55/100 gals. of usage
Out-Of-Town: 59.22 + 0.81/100 of usage </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> INSIDE
0 TO 20000 3.31
20001 TO 680000 2.81
680000 + 2.10
OUTSIDE
0 TO 20000 5.79
20001 TO 680000 4.69
680000 + 4.18 </td>
<td style="text-align:center;"> INSIDE
1000 TO 680000 7.76
680000 + 7.43
OUTSIDE
0 + 14.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Sum of
0-5000 gallons: 6.66/1000 (min of 1000 gallons)
5001-10000 gal: 8.89/1000 gal
10001-15000 gal: 10.71/1000 gal
15001-20000 gal: 12.75/1000 gal
20001-50000 gal:
15.91/1000 gal
50001-100000 gal:
18.17/1000 gal
100001-150000 gal: 20.42/1000gal </td>
<td style="text-align:center;"> 15.95 per 1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In town:
0-4000gallons 28/mo
over 4000 gals: 3.50/1000 gals
Out of town:
0-4000gallons 43/mo
over 4000 gals: 3.75/1000 gal </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Min. 3000 gals.: In-Town 17.01
Out-Of-Town: 34.02
3001-10000 : In-Town 3.35/1000 gals
Out-Of-Town 6.70/1000 gals
10001-50000: In-Town 3.25/1000 gals
Out-Of-Town 6.50/1000 gals
50001and above:
In-Town 3.15/1000 gals
Out-Of-Town 6.30/1000 gals </td>
<td style="text-align:center;"> Min. 3000 gals.: In-Town 17.01
Out-Of-Town: 34.02
3001-10000 : In-Town 3.30/1000 gals
Out-Of-Town 6.60/1000 gals
10001-50000: In-Town 3.15/1000 gals
Out-Of-Town 6.30/1000 gals
50001 and above:
In-Town 3.05/1000 gals
Out-Of-Town 6.10/1000 gals </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Bi-monthly minimum fee:
In-Town 35.82 Out-of-Town 53.76
In-Town: 8.30/1000 gallons
Out-Of-Town: 12.45/1000 gallons </td>
<td style="text-align:center;"> In-Town: 9.61/1000 gallons
Out-Of-Town: 14.43/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 0-2000 gals. 18.30
Next 4000 5.30/1000 gal.
Next 4000 6.50/1000 gal.
All over 7.05/1000 gal. </td>
<td style="text-align:center;"> 0-2000 gals. 19.35
Next 2000 4.80/1000 gal.
Next 2000 4.95/1000 gal.
Next 4000 5.25/1000 gal.
All over 6.50/1000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town:
14.25/1st 1500 gal.
Then 6.65/1000 gal.
Out-Of-Town:
26.00/1st 1500 gal.
Then 10.45/1000 gal. </td>
<td style="text-align:center;"> In-Town:
110% of water
Out-Of-Town:
110% of water </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 23.20 for the first 3000 gallons. .0045 per gallon after that </td>
<td style="text-align:center;"> 23.20 for the first 3000 gallons. .00417 per gallon after that </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> Water sevice is provided by Albemarle County Service Authority. ACSA imposes and collects usage fees. </td>
<td style="text-align:center;"> Sewer sevice is provided by Albemarle County Service Authority. ACSA imposes and collects usage fees. </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 22.65 min. </td>
<td style="text-align:center;"> 22.65 min. </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 6.14/1000 gallons
11.47 dept service charge on each water service </td>
<td style="text-align:center;"> 3.50/1000 gallons
18.62 sewer compliance fee
on each sewer service </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Up to 3000 gal 5.55
Service Charge 2.50
3001 - 10000 gal 5.55
Service Charge 3.00
10001-50000 gal 5.20 Service Charge 7.00
50001-100000 gal 3.95
Service Charge 85.00
>100000 gal 3.80
Service Charge 110.00
Out of Town = 2x Water </td>
<td style="text-align:center;"> In Town 110% x water
Out of Town = 2x sewer </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 17.50 up to 1000 gallons </td>
<td style="text-align:center;"> 25.50 for 100 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> Other </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Residential:
25.57 min. per 2000 gal.
12.79 per 1000 over min.
Non Residential:
27.34 min. per 2000 gal.
18.06 per 1000 over min. </td>
<td style="text-align:center;"> Residential:
22.02 min. per 2000 gal.
13.15 per 1000 over min.
Non Residential:
26.08 min. per 2000 gal.
16.39 per 1000 over min. </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 1st 4000 gals 10.50
Over 4000 gals 2.70 per 1000 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Inside Town:
Administrative fee 10.97
3.18 per 1000 gals.
Out-of-town:
Administrative fee 16.42
4.77 per 1000 gals. </td>
<td style="text-align:center;"> In-Town:
Administrative fee 10.97
9.91 per 1000 galls.
Out-of-Town:
Administrative fee 16.42
14.87 per 1000 gals. </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 26.00 up to 2000 gallons of </td>
<td style="text-align:center;"> 28.50 up to 2000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 0-5000 gal-26.08
5001-15000 gal-3.29 per 1000
15001-25000 gal-3.62
25001-50000 gal-3.90
50001-100000 gal-4.23
Over-100000 gal-4.53 </td>
<td style="text-align:center;"> 0-5000 gal-36.10
5001-15000 gal-3.77per 1000
15001-25000 gal 4.09
25001-50000 gal4.41
50001-100000 gal 4.72
Over-100000 gal 5.06 </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> In-town: 1st 3000 gal.: 24
Over 3000 gal.: 2.60/1000
Out-of-town: 1st 3000 gal.: 27
Over 3000 gal.: 5.20/1000 </td>
<td style="text-align:center;"> done by Hampton Roads Sanitation District
10.39 per 1000 gallons (62.22 minimum) </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town:1st 3000 gal.:30.50
Over 3000 gal: 5.17/1000 </td>
<td style="text-align:center;"> In-Town:1st 3000 gal.: 18.50
Over 3000 gal: 6.54/1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> Quarterly </td>
<td style="text-align:center;"> 5.10/0-9000 gal
5.55/9001-18000 gsl
6.40/18001+ gal </td>
<td style="text-align:center;"> 6.65/0-9000 gal
7.20/9001-18000 gsl
8.35/18001+ gal </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> Every 2 months
First 3000 gal 20.53
Next 30000 (per 1000) 3.79
All over 33000 (per 1000)4.75 </td>
<td style="text-align:center;"> Every 2 months
First 3000 gal 30.14
All over 3000 (per 1000) 4.42
Unmetered Service 62.79 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Deposit: 23.75 </td>
<td style="text-align:center;"> Deposit: 33.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In town: 15.00 per 2000 gal (min); next 8000 gal (per 1000 gal) 2.00; over 10000 gal (per 1000 gal) 1.80. Out of town: 30.00 per 2000 gal (min); next 8000 gal (per 1000 gal) 4.00; over 10000 gal (per 1000 gal) 3.60. </td>
<td style="text-align:center;"> Done by Sussex Service Authority </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Intown:
0 - 2000 gal. 5.33
over per 1000 5.50
Out-of-Town:
0 - 2000 gal. 7.99
over per 1000 8.25 </td>
<td style="text-align:center;"> Intown:
0 - 2000 gal. 12.06
over per 1000 9.03
Out-of-Town:
0 - 2000 gal. 18.09
over per 1000 13.55 </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Inside Town:
Up to 4500 gals.: 11.00
Over 4500 gals.: 2.97/1000
Outside Town:
Up to 4500 gals. 12.10
Over 4500 gals.: 3.27/1000 </td>
<td style="text-align:center;"> Inside Town:
Up to 4500 gals.: 40.00
Over 4500 gals.: 12.00/1000
Outside Town:
Up to 4500 gals. 44.00
Over 4500 gals.: 13.20/1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> Not Applicable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> first 10000 30.00 minimum
10001 to 999999999 equals 4.80 per 1000 gallons </td>
<td style="text-align:center;"> HRSD </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> Every two months </td>
<td style="text-align:center;"> 7.50 per 1000 </td>
<td style="text-align:center;"> County owns </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> In-Town
16.29 / 1st 1000 gals.
6.52 / all over 1000 gals.
Out-Of-Town
23.69 / 1st. 1000 gals.
9.48 / all over 1000 gals. </td>
<td style="text-align:center;"> In-Town 125% of water charge
Out-of-Town 125% of water charge </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> 25.67 first 2500 gallons
8.56/1000 next 47500 gal
8.30/1000 next 50000 gal
7.91/1000 over 100000 gal </td>
<td style="text-align:center;"> 44.92 first 2500 gallons
12.03/1000 next 47500 gal
10.45/1000 next 50000 gal
9.82/1000 over 100000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> Monthly </td>
<td style="text-align:center;"> Fixed charge 17.00
0-3000 gal 2.37/1000 gal
next 7000 gal 8.35/1000 gal
next 15000 gal 6.61/1000 gal
next 75000 gal 4.75
/1000 gal
next 3400000 gal 3.85/1000 gal
next 6500000 gal 3.50/1000 gal
over 10000000 3.00/1000 gal </td>
<td style="text-align:center;"> Fixed charge 13.00
0-3000 gal 1.81/1000 gal
next 7000 gal 6.13/1000 gal
next 15000 gal 6.19/1000 gal
next 75000 gal 5.97/1000 gal
next 3400000 gal 6.50/1000 gal
next 6500000 gal 8.30/1000 gal
over 10000000 8.28/1000 gal </td>
</tr>
</tbody>
</table>
<file_sep>/_book/09-Tangible-Personal-Tax.md
# Tangible Personal Property Tax
The personal property tax is the second most important source of tax revenue for cities and counties, though it is not as important for towns. In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the personal property tax accounted for 10.7 percent of tax revenue for cities, 14.6 percent for counties, and 4.5 percent for large towns. These are averages; the relative importance of taxes in individual cities, counties, and towns may vary significantly. For information on individual localities, see Appendix C.
Cities, counties, and towns are permitted to tax the tangible personal property of businesses and individuals pursuant to the *Code of Virginia*, §§ 58.1-3500 through 58.1-3521. Included in this category are such items as motor vehicles, business furniture and fixtures, farming equipment, trailers, boats, recreational vehicles, and campers.
Localities may elect to prorate the taxes on motor vehicles, trailers, and boats which have acquired a situs within a locality after the tax day for the balance of the tax year. The proration must be on a monthly basis with a period of more than a half a month counted as a full month and a period of less than half a month not counted (§ 58.1-3516).
Under § 58.1-3504, localities may elect to exempt household goods and personal effects from taxation; these effects may now include personal electronic and communication devices such as cell phones, tablets, and personal home computers. Under § 58.1-3505, localities may also exempt certain farm animals, products, and machinery. In addition, according to § 58.1-3506, the following categories are segregated as separate classes of tangible personal property under the condition that the tax rate on these items may not exceed that levied on other classifications of tangible personal property: boats or watercraft weighing five tons or more; privately owned pleasure boats and watercraft used for recreational purposes only; certain aircraft; antique automobiles; certain heavy construction machinery; certain computer hardware; motor vehicles specially equipped to provide transportation for physically handicapped individuals; privately owned vans with a seating capacity for twelve or more used exclusively for a ride-sharing arrangement; motor vehicles owned by a nonprofit organization and used to deliver meals to homebound persons or to provide transportation for senior or handicapped citizens; privately owned camping trailers and motor homes, as defined in § 46.2-100, which are used for recreational purposes only; and motor vehicles owned by members or auxiliary members of a volunteer rescue squad or volunteer fire department. Section 58.1-3506 provides for the segregation of motor vehicles owned or leased by a motor carrier into a separate classification of personal property. In addition, vehicles that use clean special fuels as authorized by § 46.2-749.3, which include hydrogen, natural gas, and electricity, are also treated as a separate tangible personal property category. In 2014, a separate classification was added for new business property for businesses qualifying as new businesses under the local business incentive program.
The *Code of Virginia* provides that all vehicles without motor power that are used or designed to be used as mobile homes are segregated as separate classes of tangible personal property. This is conditional upon the assessment ratio and the tax being the same as those applicable to real property [§ 58.1-3506, Subsection A.8., and § 58.1-3506, Clause (iii), Subsection B].
In addition, tangible personal property used in research and development of businesses and certain energy conversion equipment used in manufacturing are segregated as separate classes of tangible personal property. This is conditional upon the assessment ratio and the tax not exceeding that applicable to machinery and tools [§ 58.1-3506 Clause (ii), Subsection B]. For more on the machinery and tools tax, see Section 10.
In addition to the property discussed in this section, the *Code* lists several special categories of property which are exempt from real *and* personal property taxes (see § 58.1- 3660 through § 58.1-3666). These categories are discussed in Section 6 under the heading, “Miscellaneous Property Exemptions,” and are listed in Table 6.2.
## INFORMATION ON PERSONAL PROPERTY TAX
**Table 9.1** provides information related to the personal property tax, including the number of personal property accounts within a locality, the personal property tax rate, whether localities have special levies, property tax due dates, effective dates of assessment, options for payment of the personal property tax, and categories of vehicles for which proration is offered. In the survey, one city (Chesapeake) and one county (Accomack) reported some kind of special district levy. Regarding collections, 23 cities, 64 counties, and 88 towns reported collecting the tax once a year, while 15 cities, 31 counties, and 11 towns reported collecting it at least semi-annually. The most common due dates for payment of the tax are June 5 and December 5. Also, localities predominantly indicated January 1 as the effective date of assessment. Of the localities that reported imposing a personal property tax, 18 cities, 57 counties, and 19 towns offered options for the payment of the tax. The most common payment alternative provided by local governments is the option for taxpayers to prepay their balance at any time during the calendar year before the due date. The due date terms apply to all types of vehicles for all but 10 localities that answered the question.
Finally, 24 cities, 37 counties and 16 towns reported offering proration of the personal property tax on specific or all categories of motor vehicles. Though the term “motor vehicle” applies to all automotive vehicles with rubber tires for use on roadways, many localities use different definitions. For more detailed definitions of the categories for which proration is offered, please use the telephone/email listings in Appendix B to contact individual localities.
**Table 9.2** contains information on personal property tax exemptions for the elderly and disabled. The survey indicated that 13 cities, 45 counties, and 4 towns permitted some sort of exemption for the elderly or the disabled constrained by specific income and net worth limits.
## MOTOR VEHICLE TAX
Historically, the most important tangible personal property category has been motor vehicles. This tax is often called the “car tax” even though it covers sport utility vehicles (SUVs), pickup and panel trucks, large trucks, minivans, and motorcycles as well. In the survey, localities were asked to provide the percentage of personal property taxes coming from motor vehicles in fiscal year 2019. The unweighted average percentages for cities, counties and towns were 68 percent, 66 percent, and 74 percent, respectively. It is possible that some localities misunderstood the question about this topic and incorrectly counted state Personal Property Tax Relief Act (PPTRA) reimbursements as part of a local tax instead of as non-categorical state aid.
The Personal Property Tax Relief Act of 1998 (§ 58.1-3524) established a system by which the state would reimburse localities for relief on the tangible personal property tax.[^09-1] Passenger cars, pickup or panel trucks, and motorcycles owned or leased by natural persons and used for non-business purposes were to have the tax eliminated on the first \$20,000 of value over a five year period. Twelve and one-half percent of the tax was to be eliminated in tax year 1998, 27.5 percent in tax year 1999, 47.5 percent in tax year 2000 and 70 percent in tax year 2001. One hundred percent was slated to be eliminated in tax year 2002 and thereafter, but this final step was not implemented due to Virginia’s budget crisis in that period. Instead, in 2002, the General Assembly froze the reimbursement rate at 70 percent. Then, a special session of the General Assembly determined that the state would freeze what it was giving to localities at \$950 million annually. Beginning tax year 2006, each locality’s percentage share from the state distribution is based upon its actual share of the state reimbursements from tax year 2005. Each locality receiving a state reimbursement must reduce its rate on the first $20,000 value so that the sum of local tax revenue and state reimbursement to the locality approximates what the locality would have received based on the local valuation method and the local tax rate before the car tax rebate became law.
Vehicle assessed values are based on published market guides. For valuation of automobiles, all localities use the National Automobile Dealers’ Association’s *Official Used Car Guide* (NADA) as their *primary* valuation guide for cars and sport utility vehicles. When a vehicle is not listed in the primary guide, the locality obtains values from some other source. All cities and counties in Virginia levy this tax on motor vehicles.
Any comparison of personal property tax rates across localities is misleading if differences in the source of assessment value are not considered. Thus, the effective tax rates must be standardized by the assessment valuation method employed by a locality. To do this, an adjusted effective tax rate was calculated for each locality based on the NADA retail value of a 2018 Toyota Camry LE four-door sedan with a four-cylinder engine. In recent years, the Camry has been the best selling car in the U.S. The base data, summarized in the text table below, were obtained from NADA’s *Official Used Car Guide*.
```r
# table name: NADA Value, 2018 Toyota Camry, January 2019
```
The adjusted effective tax rate is found by multiplying the statutory tax rate by the percent of retail value and the assessment ratio. For those localities using the retail value and assessing at 100 percent, the statutory and effective tax rates are the same. The text table below summarizes the dispersion of the effective tax rates among localities.
In regard to individual localities, the adjusted effective rate for cities ranged from \$1.76 (Galax) to \$4.64 (Alexandria, Falls Church). The adjusted effective rate for counties ranged from \$0.30 (Bath) to \$4.35 (Greensville) and, in towns, ranged from \$0.04 (Eastville) to \$3.53 (Chatham). The much lower town rates reflect their limited fiscal responsibilities as subordinate units of government within counties. The town tax is in addition to the county tax.
```r
# table name: Adjusted Effective Tax Rates Among Localities, 2019
```
Besides the adjusted effective tax rate, **Table 9.3** also provides data on the tax rate, assessment value concept, the percent of retail value, the assessment ratio, percentage of personal property tax receipts from automobiles and light trucks, and the number of automobiles and light trucks within a locality. Among the cities that answered the question, the number of vehicles ranged from 429,645 in Virginia Beach to 3,040 in Norton. Among counties, the number ranged from 994,469 in Fairfax to 3,050 in Highland.
The assessment value is important because it provides an estimate of the percent of retail value the locality will assign to the vehicle when determining the effective tax rate. The assessment value used varies among localities. Care must be taken when evaluating the data based on the three valuation methods listed because a valuation method may have subcategories. The latest NADA book, for instance, lists three categories for trade-in value based on condition: rough, average, and clean. Other valuation guides may use some variant of this breakdown for the retail and loan value categories. This year and in past years our example listed the percentages based on clean retail, clean loan value, and clean trade-in.
The following text table shows the frequency of each valuation method among localities. Since many towns use the same concept as their respective counties, a tally is not shown for them.
```r
# table name: Frequency of Valuation Methods, 2019
```
Localities incorporate an assessment ratio in the valuation process. Most cities and counties use a 100 percent ratio of whatever value concept they adopt. The following text table summarizes the dispersion of assessment ratios.
Information on tax rates of towns that did not respond to the survey can be found in the Virginia
```r
# table name: Dispersion of Assessment Ratios, 2019
```
Department of Taxation’s local tax rates survey for tax year 2018.[^09-2] The rates shown are the most recent information available for towns that did not respond to the Cooper Center survey.
**Table 9.4** continues with data related to the PPTRA for motor vehicles for tax years 2018 and 2019. The second column lists whether the locality offers exemptions for low-value automobiles and light trucks. Twenty-one cities, 49 counties and 25 towns reported offering an exemption of some sort to low-value vehicles. The third column refers to methods for applying PPTRA tax relief. A locality can use one of three methods: a reduced rate method (RR), a specific relief method that provides the same percentage of relief for all qualifying vehicles (SRSP), and a specific relief method that provides a declining percentage of relief as the vehicle’s value rises (SRDP). The text table below summarizes the choices by all cities, 93 counties and the 66 towns that answered the question.
```r
# table name: Frequency of PPTRA Methods of Relief, 2019
```
Localities overwhelmingly use the specific relief method that provides the same percentage of relief for all qualifying vehicles. We assume the reporting towns use the same method as is used by the counties in which they are located.
The final set of columns provides data on the taxpayer liability for a vehicle assessed at \$20,000. What constitutes a \$20,000 vehicle in one locality may not match what constitutes a \$20,000 vehicle in another locality because of the differing valuation methods and assessment ratios used by the localities. Tax year 2019 is featured in the text table. The columns in Table 9.4 provide the locality’s total car tax, the amount of the state credit, and the resulting taxpayer liability for 2018 and 2019. In some cases we were not given the tax on a vehicle, but were provided the percentage share covered by the tax, the credit, and the taxpayer liability. In such cases only the percentage is listed. The text table below summarizes the percentage of state aid reported by cities and counties.
```r
# table name: Dispersion of State-Aid Assessment Ratios, 2019
```
For the $20,000 vehicle example, a lower percentage implies a higher resulting taxpayer liability relative to the total tax levied by a locality. Most cities provided a state credit between 50 percent and 60 percent of their total tax levied. The median state credit among cities in 2019 was 51.0 percent of the total tax, while the first quartile was 46.8 percent and the third quartile was 53.9 percent. Among counties the largest group reported the credit as a percentage of the total tax as between 20 percent and 49.9 percent. The median percentage of the taxpayer credit was 39.2 percent, with the first and third quartiles being 34.6 percent and 50.0 percent, respectively.
While the state credit for many localities usually diminishes each year, it is possible to have a greater state credit percentage for a current survey than for a previous one. Because the state payout to each locality is fixed, and the number and value of vehicles normally rise, it is generally assumed that as time passes the funding will decrease for each automobile. That expectation, however, does not account for either a possible disinflationary trend in the automobile market during a recession or a possible fall in the number of motor vehicles in the locality. In either of these cases a locality may be able to increase its payout percentage for each automobile within the locality.
The next text table summarizes the range of actual taxes for cities and counties based on the information from 2019. It summarizes the total tax, state credit and resulting taxpayer liability for those localities that provided dollar amounts. The measures of central tendency (the median and quartiles) do not include localities that did not answer.
As shown in the text table, 29 cities reported levying a tax between \$501 and \$1,000 before the PPTRA credit was factored in, while 1 reported levying taxes of \$1,001 or more and 4 reported levying taxes of \$500 or less. The median tax levied for all cities was \$808. Most PPTRA credits, 22 of the 34 reported, were between \$251 and \$500. The median credit was \$389. Most of the resulting taxpayer liabilities in cities were also between \$251 and \$500, with the median at \$399.
Among counties, original tax liabilities ranged from \$251 to over \$1,000. The median of the tax was \$720. Most counties gave credits in the \$251 to \$500 range, though about one-third provided a credit in the \$0 to \$250 range. The median credit among counties was \$274. Thirty-nine counties collected between \$251 and \$500 after the PPTRA
```r
# table name: Total Tax, State Credit and Tax Liability for a $20,000 Vehicle in Cities and Counties, 2019
```
tax credit was figured in. For counties, the median taxpayer liability after allowing for the credit was \$437.
**Table 9.5** lists localities that report giving a reduction in the personal property tax for high-mileage vehicles. This is permitted by § 58.1-3503.3, which states that the commissioner of the revenue, using an automobile pricing guide, may “use all applicable adjustments in such guide to determine the value of each individual automobile.” Many guides allow for adjustments in value for high- or low-mileage vehicles. Thirty-four cities, 73 counties, and 23 towns reported reduced valuations for high-mileage vehicles. Certain localities that reported giving such reductions also told us they couldn’t really ascertain the number of beneficiaries or foregone revenue because the software they used to determine valuation didn’t break down adjustments for them. Therefore, for some localities, though they responded that they had the reduction, they could not provide information about beneficiaries or foregone revenue.
Based on localities that did respond for both questions on beneficiaries and foregone revenues, there were a total of 9,605 beneficiaries of the high-mileage adjustment in cities, with the amount of revenue foregone totaling \$563,465. Among localities that provided both number of beneficiaries and revenues foregone, this amounted to an average reduction per beneficiary of \$58.66. In counties, the number of beneficiaries of the adjustment reported was 30,341. The amount of foregone revenue reported was \$1,313,558. The average reduction per beneficiary for those reporting both figures was \$43.29.
**Table 9.6** compares the tax rates and assessment components of the car tax between 1997, the year before $^the PPTRA went into effect, and 2019. The table provides information on localities that have raised their personal property taxes on motor vehicles since the beginning of the PPTRA.
When the PPTRA became law, some saw it as the beginning of the end of the “car tax.” However, as reimbursements rose and the state’s fiscal condition worsened, the commonwealth decided to limit the rollback. As previously noted, now each locality is annually given a lump sum by the state that is applied to each resident’s total property tax. The state reimbursements are based on 1997 effective rates as provided by the PPTRA. Any increase in the effective rate consequent to the 1997 rate is not covered by the PPTRA reimbursement from the state.[^09-3]
Making certain assumptions about the assessment value concept (which will be discussed below), it appears that large majorities of cities and counties have increased their effective rates since 1997. Twenty-eight cities and 78 counties increased them. The assumption made here is that the value assessment concepts follow a clear path of valuation. In NADA’s *Official Used Car Guide*, for instance, the lowest valuation is applied to loan value, a higher valuation is applied to trade-in value, and the highest valuation is applied to retail value. This is the hierarchy one would expect to see when comparing average measures of loan, trade-in, and retail value, or clean measures of loan, trade-in, and retail value. A problem arises, however, with those valuations that maintain subcategories. NADA’s multiple trade-in values, based on condition of vehicles, as discussed earlier, have not been tracked as separate categories. Therefore, we can’t be sure whether certain localities have changed subcategories. Consequently, historical adjustments within this valuation cannot be determined from the table.
**Table 9.7** gives the pricing guide, the value used, the tax rate, and the depreciation schedule, if any, for large trucks, two tons and over. Answers were provided by all cities and counties and 75 of the responding towns.
## OTHER PERSONAL PROPERTY TAXES
As previously noted, tangible personal property taxes are not limited to motor vehicles. There are about 20 categories in addition to motor vehicles, ranging from farm equipment to recreational vehicles and mobile homes (the general categories can be found from § 58.1-3504 through § 58.1- 3506). Household goods are a legal category, but no locality reports taxing them.
Localities exhibit a wide variation in their choices of valuation methods, pricing guides, and depreciation methods. Consequently, great care must be exercised when comparing taxes in different jurisdictions. Unless otherwise stated, the valuation method for the depreciation schedules is original cost.
A further problem pertains to towns. Certain towns provided a tax rate without showing a basis or depreciation schedule. In a follow-up for a previous survey, we called several towns in an attempt to elicit more information. Generally, a town representative confirmed the rate existed, but told us the county determined the actual depreciation schedule. The county representative confirmed that the county determined the town’s depreciation schedule but added that if the county did not tax a particular item, there was no schedule. Therefore the town could not collect any taxes for that item.
**Table 9.8** displays tangible personal property taxes on heavy tools and machinery, computers, and generating equipment for business use for cities, counties and 48 reporting towns. The text table below summarizes how many localities report a tax rate for each category.
```r
# table name: Taxes on Heavy Tools and Machinery, Computer Hardware, and Generating Equipment, 2019
```
**Table 9.9** displays tax rates on research and development, business furniture and fixtures, and biotechnology equipment for cities, counties and 46 respondent towns. The text table below shows how many localities report a tax rate for each category.
```r
# table name: Taxes on Research and Development, Furniture and Fixtures, and Biotechnology, 2019
```
**Table 9.10** displays tax rates on computer hardware in data centers, farm equipment, and livestock for cities, counties and 17 respondent towns. The text table below shows how many localities report a tax rate for each category.
```r
# table name: Taxes on Computer Hardware in Data Centers, Livestock, and Farm Equipment, 2019
```
**Table 9.11** displays tax rates on boats and aircraft for cities, counties, and 53 respondent towns. The text table below shows how many localities report a tax rate for each category.
```r
# table name: Taxes on Boats Over Five Tons, Pleasure Boats, and Aircraft, 2019
```
**Table 9.12** displays tax rates on antique motor vehicles, recreational vehicles, and mobile homes for cities, counties, and 66 respondent towns. The text table below shows how many localities report a tax rate in each category.
```r
# table name: Taxes on Antique Motor Vehicles, Recreational Vehicles, and Mobile Homes, 2019
```
**Table 9.13** displays tax rates on horse trailers, motor vehicles powered solely by an electric motor, and special clean fuel vehicles (hydrogen, natural gas, electric) used for driving for cities, counties, and 29 respondent towns. The text table below shows how many localities reported a tax rate in each category.
```r
# table name: Taxes on Horse Trailers, Special Fuel Vehicles, and Electric Vehicles, 2019
```
<table>
<caption>(\#tab:table09-5)Localities That Report Having a Personal Property Tax Reduction for High Mileage Vehicles Table, 2018 and 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Year Reporting </th>
<th style="text-align:center;"> Number of Beneficiaries </th>
<th style="text-align:center;"> Foregone Revenue ($) </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 3 </td>
<td style="text-align:center;"> 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 2143 </td>
<td style="text-align:center;"> 24290.45 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 2016 </td>
<td style="text-align:center;"> 56843 </td>
<td style="text-align:center;"> 402716.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 2011 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 4670 </td>
<td style="text-align:center;"> 117493.00 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 66 </td>
<td style="text-align:center;"> 35820.90 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 800 </td>
<td style="text-align:center;"> 24820.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 18982 </td>
<td style="text-align:center;"> 766824.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 52 </td>
<td style="text-align:center;"> 690.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 358 </td>
<td style="text-align:center;"> 11904.00 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 2010 </td>
<td style="text-align:center;"> 2250 </td>
<td style="text-align:center;"> 66100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25 </td>
<td style="text-align:center;"> 625.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 2011 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 238 </td>
<td style="text-align:center;"> 5741.28 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> 2016 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> 167 </td>
<td style="text-align:center;"> 4735.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 3029 </td>
<td style="text-align:center;"> 325874.41 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 2013 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 1455 </td>
<td style="text-align:center;"> 210192.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 3 </td>
<td style="text-align:center;"> 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 2016 </td>
<td style="text-align:center;"> 44 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> 50 </td>
<td style="text-align:center;"> 3000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 2016 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 18 </td>
<td style="text-align:center;"> 768.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 752 </td>
<td style="text-align:center;"> 20908.33 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 2014 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 68 </td>
<td style="text-align:center;"> 3905.41 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> 443 </td>
<td style="text-align:center;"> 13837.92 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 2015 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 2013 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 2019 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 103 </td>
<td style="text-align:center;"> 3242.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 1526 </td>
<td style="text-align:center;"> 71169.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 2018 </td>
<td style="text-align:center;"> 5237 </td>
<td style="text-align:center;"> 239342.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> 2011 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 2016 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 2009 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 2017 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> 0000 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table09-8)Tangible Personal Property Taxes Related to Business Use for Heavy Tools and Machinery, Computer Hardware, and Generating Equipment Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Heaby Tools & Machinery*, Basis </th>
<th style="text-align:center;"> Heavy Tools & Machinery*, Rate/$100 </th>
<th style="text-align:center;"> Computer Hardware*, Basis </th>
<th style="text-align:center;"> Computer Hardware*, Rate/$100 </th>
<th style="text-align:center;"> Generating Equipment*, Basis </th>
<th style="text-align:center;"> Generating Equipment*, Rate/$100 </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 1 25.0%
2 20.0%
3 20.0%
4 15.0%
Decrease 1% yrly to 6% 0.0% </td>
<td style="text-align:center;"> 3.63 to 3.72 </td>
<td style="text-align:center;"> 1 75.0%
2 50.0%
3 25.0%
4 15.0%
5+ 5.0% </td>
<td style="text-align:center;"> 3.63 to 3.72 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.28 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 1 80.0%
2 80.0%
3 60.0%
4 40.0%
5 40.0%
6 40.0%
7 30.0%
8 30.0%
9 30.0%
10 30.0%
11 30.0%
12 20.0%
13 20.0%
14 20.0%
15 20.0%
16 20.0%
17 20.0%
18 20.0%
19 20.0%
20 20.0%
21+ 10.0% </td>
<td style="text-align:center;"> 5.95 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 2.98 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 2.98 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 33.0%
5 20.0%
6+ 80% of previous </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 33.0%
5 20.0%
6+ 80% of previous </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 30.0% of cost </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> 30.0% of cost </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> 17.3% of original cost
no other depreciation </td>
<td style="text-align:center;"> 3.35 </td>
<td style="text-align:center;"> Year 1 80%
Year 2 75%
Year 3 60%
Year 4 45%
Year 5 30%
Year 6 15%
Year 7 - 18 15%
Year 19 and back 10% </td>
<td style="text-align:center;"> 3.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> n/A </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 65.0%
2 45.0%
3 30.0%
4 10.0%
5 10.0%
6 10.0%
7+ 10.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 1 40.0%
2 30.0%
3+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5 20.0%
6 15.0%
7 10.0%
8+ (Min 50) 5.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5 20.0%
6 15.0%
7 10.0%
8+ (Min 50) 5.0% </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0%
9+ (min.1000) 10.0% </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0%
9+ (min.1000) 10.0% </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> 1 85.0%
2 80.0%
3 75.0%
4 70.0%
5 65.0%
6 60.0%
7 55.0%
8 45.0%
9 35.0%
10+ 25.0% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> 1 85.0%
2 75.0%
3 65.0%
4 55.0%
5 45.0%
6 35.0%
7+ 25.0% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> 1 100%
2 95%
3 90%
4 85%
5 80%
6 75%
7 70%
8 65%
9 60%
10 55%
11 50%
12 45%
13 40%
14 35%
15 30%
16+ 25% </td>
<td style="text-align:center;"> 1.70 </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> 50.0%
25.0% </td>
<td style="text-align:center;"> 0.89 </td>
<td style="text-align:center;"> As long as used (half cost) 50.0% </td>
<td style="text-align:center;"> 2.29 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 1 90.0%
2 70.0%
3 50.0%
4 30.0%
5+ 10.0% </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> 1 90.0%
2 70.0%
3 50.0%
4 30.0%
5+ 10.0% </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> 1 90.0%
2 70.0%
3 50.0%
4 30.0%
5+ 10.0% </td>
<td style="text-align:center;"> 2.71 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 3.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 1 80.0%
2 80.0%
3 80.0%
4 60.0%
5 60.0%
6 60.0%
7 40.0%
8 40.0%
9 40.0%
10+ (20% the min.) 20.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1 90.0%
2 75.0%
3 65.0%
4 40.0%
5 20.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1 80.0%
2 80.0%
3 80.0%
4 60.0%
5 60.0%
6 60.0%
7 40.0%
8 40.0%
9 40.0%
10+ 20.0% </td>
<td style="text-align:center;"> 1.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 1-9 YRS 15%
10-19 YRS 10%
20+ YRS 5% </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 1-9 YRS 15%
10-19 YRS 10%
20+ YRS 5% </td>
<td style="text-align:center;"> 4.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 1 25.0%
2 25.0%
3 25.0%
4 25.0%
5 25.0%
6 25.0%
7 25.0%
8 25.0%
9 25.0%
10 25.0%
11+ 15.0% </td>
<td style="text-align:center;"> 4.400 "nominal" </td>
<td style="text-align:center;"> 1 25.0%
2 25.0%
3 25.0%
4 25.0%
5 25.0%
6 25.0%
7 25.0%
8 25.0%
9 25.0%
10 25.0%
11+ 15.0% </td>
<td style="text-align:center;"> 4.40 "nominal" </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 3.25 "Nominal" </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 45%
2 45%
3 45%
4 45%
5 40%
6 35%
7 30%
8+ 25% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 1.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> Age 1 30.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> Age 1 45.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 20.0%
4 10.0%
5 5.0%
6+ 1.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 1 yr. 75%
2 yr. 60%
3 yr. 50%
4 yr. 40%
5 yr. 30%
6+ yr. 20%
then 75% of depreciated
amount for tax value </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> 1 yr. 75%
2 yr. 60%
3 yr. 50%
4 yr. 40%
5 yr. 30%
6+ yr. 20%
then 75% of depreciated
amount for tax value </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> none at present </td>
<td style="text-align:center;"> 4.496 </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 50.0%
2 30.0%
3 20.0%
4+ 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 65.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 20% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> 2017 80%
2016 70%
2015 60%
2014 50%
2013 40%
2012 30%
2011 & older 20% </td>
<td style="text-align:center;"> 1.85 </td>
<td style="text-align:center;"> Same Depreciation
Schedule ad Avove </td>
<td style="text-align:center;"> 1.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 3.30 </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> one time depreciation 50% </td>
<td style="text-align:center;"> 1.20 </td>
<td style="text-align:center;"> one time depreciation 50% </td>
<td style="text-align:center;"> 1.20 </td>
<td style="text-align:center;"> one time depreciation 50% </td>
<td style="text-align:center;"> 1.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> Until asset is disposed 0.0%
1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.57 </td>
<td style="text-align:center;"> Until asset is disposed 0.0%
1 50.0%
2 35.0%
3 20.0%
4 10.0%
5+ 2.0% </td>
<td style="text-align:center;"> 4.57 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.57 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 60.0%
2 40.0%
3 20.0%
4+ 10.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 2.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> remove </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 1 to 10 years 25.0% </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 1 to 10 years 25.0% </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 1 to 10 yrs 25.0% </td>
<td style="text-align:center;"> 2.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 1 75%
2 65%
3 55%
4 45% </td>
<td style="text-align:center;"> 1.89 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 35.0%
5 30.0%
6 25.0%
7 20.0% </td>
<td style="text-align:center;"> 2.46 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 35.0%
5 30.0%
6 25.0%
7 20.0% </td>
<td style="text-align:center;"> 2.46 </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 4.86 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 4.86 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 4.86 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> Any age 50% </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> Any age 50% </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> Any Age 50% </td>
<td style="text-align:center;"> 2.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> 98 + Newer 30.0%
97 + older 10.0% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> 98 + Newer 30.0%
97 + older 10.0% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> 98 + Newer 30.0%
97 + older 10.0% </td>
<td style="text-align:center;"> 2.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.95 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.95 </td>
<td style="text-align:center;"> 1 to 5 75.0%
6 to 10 56.0%
11+ 37.0% </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> 1 75.0%
2 70.0%
3 65.0%
4 60.0%
5 55.0%
6 50.0%
7 45.0%
8 40.0%
9 35.0%
10 30.0%
11 25.0%
12 20.0% </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> 1 75.0%
2 50.0%
3 30.0%
4+ 20.0% </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> 1 75.0%
2 70.0%
3 65.0%
4 60.0%
5 55.0%
6 50.0%
7 45.0%
8 40.0%
9 35.0%
10 30.0%
11 25.0%
12 20.0% </td>
<td style="text-align:center;"> 1.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 37.5%
5 35.0%
6 32.5%
7 30.0%
8 27.5%
9 25.0%
10 22.5%
11 20.0%
12 17.5%
13+ 15.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 3.85 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0%
6 5.0%
7+ 1.0% </td>
<td style="text-align:center;"> 3.85 </td>
<td style="text-align:center;"> 1991-2009 50.0%
1990 & prior 25.0%
Idled Unused 5.0% </td>
<td style="text-align:center;"> 1.26 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> 1 66.0%
2 55.0%
3 35.0%
4 24.0%
5 5.0%
6+ 1.0% </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.57 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 1 80.0%
2 73.0%
3 63.0%
4 54.0%
5 46.0%
6 39.0%
7 32.0%
8 26.0%
9 22.0%
10+ 12.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 72.0%
2 48.0%
3 30.0%
4 20.0%
5 12.0%
6+ 4.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 80.0%
2 73.0%
3 63.0%
4 54.0%
5 46.0%
6 39.0%
7 32.0%
8 26.0%
9 23.0%
10+ 12.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 1 97.0%
2 87.0%
3 77.0%
4 67.0%
5 57.0% </td>
<td style="text-align:center;"> 1.55 </td>
<td style="text-align:center;"> 1 71.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 1.55 </td>
<td style="text-align:center;"> 1 97.0% Can apply
2 87.0% for partial
3 77.0% exemption
4 67.0%
5 57.0% </td>
<td style="text-align:center;"> 1.55 </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> 40% first year with 5%
deprection </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> 40% first year with 5%
deprection </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> Any age 40% </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> Any age 40.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> 1 70.0%
less 10% each yr.
thereafter. </td>
<td style="text-align:center;"> 1.10 </td>
<td style="text-align:center;"> 1 25.0%
less 10% each yr.
thereafter. </td>
<td style="text-align:center;"> 3.94 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> Year Purchased Percent of Value
2018 30.0%
2017 25.0%
2016 20.0%
2015 15.0%
2014 and older 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Year Purchased Percent of Value
2018 30.0%
2017 25.0%
2016 20.0%
2015 15.0%
2014 and older 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Year Purchased Percent of Value
2018 30.0%
2017 25.0%
2016 20.0%
2015 15.0%
2014 and older 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1 80.0% of cost
2 60.0% of cost
3 40.0% of cost
4 20.0% of cost
5+ 10.0% of cost </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> 1 80.0% of cost
2 60.0% of cost
3 40.0% of cost
4 20.0% of cost
5+ 10.0% of cost </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> 1 80.0% of cost
2 60.0% of cost
3 40.0% of cost
4 20.0% of cost
5+ 10.0% of cost </td>
<td style="text-align:center;"> 3.65 per 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> Fair market value 100% 100.0% </td>
<td style="text-align:center;"> 1.52 </td>
<td style="text-align:center;"> FMV 100.0% </td>
<td style="text-align:center;"> 1.52 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 90.0%
2 70.0%
3 50.0%
4 30.0%
5 20.0%
6+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> 1 25.0%
2 30.0%
3 40.0%
4 50.0%
5 60.0%
6 70.0%
7 80.0%
8+ (not less than 10%) 90.0% </td>
<td style="text-align:center;"> 1.90 </td>
<td style="text-align:center;"> 1 25.0%
2 30.0%
3 40.0%
4 50.0%
5 60.0%
6 70.0%
7 80.0%
8+ (not less than 10%) 90.0% </td>
<td style="text-align:center;"> 1.90 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 50% less 10% every 5 years; 10% min </td>
<td style="text-align:center;"> 1.80 </td>
<td style="text-align:center;"> 1 32.5%
2 32.5%
3 32.5%
4 32.5%
5 32.5%
6 27.5%
7 27.5%
8 27.5%
9 27.5%
10 27.5%
11 25.5%
12 25.5%
13 25.5%
14 25.5%
15 25.5%
16 17.5%
17 17.5%
18 17.5%
19 17.5%
20 17.5%
21+ 12.5% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> n/a </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> 20% depr. from prior years assessment until minimum of 100 is reached 0.0% </td>
<td style="text-align:center;"> 3.10 </td>
<td style="text-align:center;"> 20% depr. from prior years assessment until minimum of 100 is reached </td>
<td style="text-align:center;"> 3.10 </td>
<td style="text-align:center;"> 10% depr. from prior year </td>
<td style="text-align:center;"> 3.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 30% of oc first 10 years
10% of oc thereafter </td>
<td style="text-align:center;"> 2.14 </td>
<td style="text-align:center;"> 30% of oc first 10 years
10% of oc thereafter </td>
<td style="text-align:center;"> 2.14 </td>
<td style="text-align:center;"> 30% of oc first 10 years
10% of oc thereafter </td>
<td style="text-align:center;"> 2.14 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 25.0%
8+ 15.0% </td>
<td style="text-align:center;"> 3.36 </td>
<td style="text-align:center;"> 1 80.0%
2 50.0%
3 40.0%
4 20.0%
5 10.0%
6+ 5.0% </td>
<td style="text-align:center;"> 3.36 </td>
<td style="text-align:center;"> Assessed by SCC 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> Any age 10.0% </td>
<td style="text-align:center;"> 3.50 @ 10% of purchase </td>
<td style="text-align:center;"> Any age 10.0% </td>
<td style="text-align:center;"> 3.50 @ 10% of purchase </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> 1 80.0%
2 60.0%
3 50.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 50.0%
4+ 10.0% </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 2.55 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 1 70.0%
Reduce 10% each yr. after 0.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> Any age 15.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> Any age 15.0% </td>
<td style="text-align:center;"> 3.45 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 1-3/ 20%
4-6/ 15%
7-10/ 10%
11&older/ 5%
Idle/ 0% </td>
<td style="text-align:center;"> .75 </td>
<td style="text-align:center;"> 1/ 60%
2/ 35%
3-4/ 10%
5&older/ 0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1-3/ 55%
4-6/ 30%
7&older/10% </td>
<td style="text-align:center;"> 3.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 25.0%
6+ (Min. 200) 10.0% </td>
<td style="text-align:center;"> 2.86 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> any age 25.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> any age 40.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> any age 25.0% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> 1 70.0%
2 70.0%
3 70.0%
4 60.0%
5 60.0%
6 60.0%
7 60.0%
8+ 30.0% </td>
<td style="text-align:center;"> 1.35 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 55.0%
4 40.0%
5 25.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> 1 65%
2 60%
3 55%
4 50%
5 45%
6 40%
7 37%
8 34%
9 31%
10 28%
11+ 25% </td>
<td style="text-align:center;"> 2.20 </td>
<td style="text-align:center;"> 1 65%
2 60%
3 55%
4 50%
5 45%
6 40%
7 37%
8 34%
9 31%
10 28%
11+ 25% </td>
<td style="text-align:center;"> 2.20 </td>
<td style="text-align:center;"> 1 65%
2 60%
3 55%
4 50%
5 45%
6 40%
7 37%
8 34%
9 31%
10 28%
11+ 25% </td>
<td style="text-align:center;"> 2.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 72% 1st yr. 10% less each year. </td>
<td style="text-align:center;"> 4.59 </td>
<td style="text-align:center;"> 72% 1st yr. 10% less each year. </td>
<td style="text-align:center;"> 4.59 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> 1 95.0%
2 85.5%
3 77.0%
4 69.3%
5 62.0%
6 56.0%
7 50.5%
8 45.4%
9 41.0%
10 36.8%
11 33.0%
12 29.8%
13 26.8%
14+ 25.0% </td>
<td style="text-align:center;"> 1.71 </td>
<td style="text-align:center;"> 1 95.0%
2 70.0%
3 50.0%
4 20.0%
5+ 10.0% </td>
<td style="text-align:center;"> 1.71 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> all years 10% </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> 1 30.0%
2 27.5%
3 25.0%
4 23.5%
5 20.0%
6 17.5%
7 15.0%
8 13.5%
9 10.0%
10 7.5%
11+ 5.0% </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .62 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince Edward County </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.25 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1 85.0%
2 75.0%
3 65.0%
4 55.0%
5 45.0%
6+ 10.0% - 35% </td>
<td style="text-align:center;"> 3.70 </td>
<td style="text-align:center;"> 1 50.0%
2 35.0%
3 20.0%
4 10.0%
5+ 5.0% </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> 1 85.0%
2 75.0%
3 65.0%
4 55.0%
5 45.0%
6 35.0%
7 25.0%
8 15.0%
9+ 10.0% </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> 1 60.0%
2 60.0%
3 60.0%
4 60.0%
5 60.0%
6 40.0%
7 40.0%
8 40.0%
9 40.0%
10 40.0%
11+ 20.0% </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> 1 60.0%
2 to 3 45.0%
4 to 5 30.0%
6 to 7 10.0%
8 02.0% </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> 1 to 5 years 60.0%
6 to 10 years 40.0%
10+ years 20.0% </td>
<td style="text-align:center;"> 2.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> 1 40.%
2previous year value reduced by 10%
3previous year value reduced by 10%
4previous year value reduced by 10%
5 Min. 100 </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1 40.0%
2previous year value reduced by 10%
3previous year value reduced by 10%
4previous year value reduced by 10%
5 Min. 100 0.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ (Min. 100) 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 20.0%
5+ (Min. 100) 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ (Min.100) 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5+ 10.0% </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0% </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 30.0%
4 20.0%
0.0%
0.0%
0.0%
0.0%
0.0% </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0% </td>
<td style="text-align:center;"> 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 0 90.0%
1 90.0%
2 80.0%
3 80.0%
4 70.0%
5 70.0%
6 60.0%
7 60.0%
8 50.0%
9 50.0%
10 50.0%
11 40.0%
12 40.0%
13 40.0%
14 40.0%
15+ 30.0% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 0 90.0%
1 90.0%
2 80.0%
3 80.0%
4 70.0%
5 70.0%
6 60.0%
7 60.0%
8 50.0%
9 50.0%
10 50.0%
11 40.0%
12 40.0%
13 40.0%
14 40.0%
15+ 30.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> current (new) 90.0%
1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> current (new) 70.0%
1 50.0%
2 35.0%
3 25.0%
4 15.0%
5 5.0% </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> current (new) 90.0%
1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 3.15 </td>
<td style="text-align:center;"> 1 55.0%
2 50.0%
3 45.0%
4 40.0%
5 25.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 80.0%
2 60.0%
3 40.0%
4+ 20.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 90%
2 80%
3 70%
4 60%
5 50%
6 40%
7 30%
8+ 20% </td>
<td style="text-align:center;"> 2.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 1 80.0%
2 70%
3 60%
4 50%
5 40%
6 30%
7 20%
8 10% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 30.0%
5 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 30.0%
5 20.0% </td>
<td style="text-align:center;"> 6.73 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 30.0%
5 20.0% </td>
<td style="text-align:center;"> 6.73 </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 1 35.0%
2 30.0%
3 25.0%
4 20.0%
5 15.0% </td>
<td style="text-align:center;"> 5.49 </td>
<td style="text-align:center;"> 1 35.0%
2 30.0%
3 25.0%
4 20.0%
5 15.0% </td>
<td style="text-align:center;"> 5.49 </td>
<td style="text-align:center;"> 1 35.0%
2 30.0%
3 25.0%
4 20.0%
5 15.0% </td>
<td style="text-align:center;"> 5.49 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -10% from prior year each year after </td>
<td style="text-align:center;"> 4.85 </td>
<td style="text-align:center;"> -10% from prior year each year after </td>
<td style="text-align:center;"> 4.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> 1 80.0%
2 40.0%
3+ 20.0% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> 10 years/ 10%
minimum 15% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 5 years/80%60%40%20%15%
15% minimum </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 10 years/ 10% minimum 15% </td>
<td style="text-align:center;"> 1.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 2.32 </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 2.32 </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 2.32 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> all 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> 1 65.0%
2 45.0%
3 30.0%
4 20.0%
5 5.0%
6 5.0%
7+ 5.0% </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> Any age 12.0% </td>
<td style="text-align:center;"> 7.00 </td>
<td style="text-align:center;"> Any age 12.0% </td>
<td style="text-align:center;"> 7.00 </td>
<td style="text-align:center;"> Any Age 12.0 </td>
<td style="text-align:center;"> 7.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 3.12 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> any age 20% % </td>
<td style="text-align:center;"> 3.08 </td>
<td style="text-align:center;"> any age 20% </td>
<td style="text-align:center;"> 3.08 </td>
<td style="text-align:center;"> Any age 20% </td>
<td style="text-align:center;"> 3.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.00 (3.5
effective 01/01.2018) </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 30.0%
4 20.0%
5+ 10.0% </td>
<td style="text-align:center;"> 3.00 (3.5
effective
01/01/2018) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 1 50.0% 6 25%
2 45.0% 7 20%
3 40.0%
4 35.0%
5 30.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 35.0%
5 30.0%
6 25.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 4.13 </td>
<td style="text-align:center;"> 1 65.0%
2 45.0%
3 30.0%
4 10.0%
5 2.0% </td>
<td style="text-align:center;"> 4.13 </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.84 </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 35.0%
4 10.0%
5 10.0%
6 5.0%
7+ 5.0% </td>
<td style="text-align:center;"> 4.84 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.84 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 45.0%
6 30.0%
7+ 20.0%
0.0% </td>
<td style="text-align:center;"> 3.40 </td>
<td style="text-align:center;"> 1 80.0%
2 60.0%
3 40.0%
4+ 20.0% </td>
<td style="text-align:center;"> 3.40 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 45.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.40 </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> any age 50.0% </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> any age 50.0% </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> Any age 35.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 35.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 35.0% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 2.12 </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 30.0%
4 15.0%
5 10.0%
6 5.0%
7 2.0% </td>
<td style="text-align:center;"> 2.12 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 2.12 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> New 60.0%
1 50.0%
2 40.0%
3 30.0%
4 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> New 60.0%
1 50.0%
2 40.0%
3 30.0%
4 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> State Corp Comm 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 25% of OC when item is not fully depreciated
10% of OC when item is fully depreciated </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 25% of OC when item is not fully depreciated
10% of OC when item is fully depreciated </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 25% of OC when item is not fully depreciated
10% of OC when item is fully depreciated </td>
<td style="text-align:center;"> 4.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 1 30.0%
2 30.0%
3 30.0%
4 30.0%
5 30.0%
6+ 25.35% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 1 30.0%
2 30.0%
3 30.0%
4 30.0%
5 30.0%
6+ 25.35% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 1 30.0%
2 30.0%
3 30.0%
4 30.0%
5 30.0%
6+ 25.35% </td>
<td style="text-align:center;"> 3.80 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 50.0%
2 35.0%
3 20.0%
4 10.0%
5+ 5.0% </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4+ 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 25.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 30.0%
4 15.0%
5 10.0%
6+ 5.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 25.0% </td>
<td style="text-align:center;"> 1.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> Any age 33.3% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 33.3% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 33.3% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> any age 40.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> any age 40.0% </td>
<td style="text-align:center;"> 4.33 </td>
<td style="text-align:center;"> any age 40.0% </td>
<td style="text-align:center;"> 4.33 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> any age 10.0%
Valued @ 10% of Cost </td>
<td style="text-align:center;"> 2.05 </td>
<td style="text-align:center;"> any age 10.0%
Valued @ 10% of Cost </td>
<td style="text-align:center;"> 2.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.90 </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.90 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 4.15 </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 4.15 </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 4.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 1985-current 50.0%
1984-older 25.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1985-current 50.0%
1984-older 25.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1985-current 50.0%
1984-older 25.0% </td>
<td style="text-align:center;"> 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.76 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.76 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.70 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 30.0%
4 15.0%
5 10.0%
6+ 5.0% </td>
<td style="text-align:center;"> 3.70 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.70 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.45 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 and older 25.0% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 and older 25.0% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 or older 25.0% </td>
<td style="text-align:center;"> 3.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 10 </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 3 </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> </td>
<td style="text-align:center;"> 2.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> Any age 15% OC </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> Any age 20% OC </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 1-5 yrs 20% OC
6 yrs & older 10% OC </td>
<td style="text-align:center;"> 3.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> all years 40.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> all years 40.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> all years 40.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 40% of given book value each year 0.0%
to min. 20% of the original cost of item 0.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 40% of given book value each year 0.0%
to min. 20% of the original cost of item 0.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 40% of given book value each year 0.0%
to min. 20% of the original cost of item 0.0% </td>
<td style="text-align:center;"> 5.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 1.09 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> 50.0% </td>
<td style="text-align:center;"> 0.76 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.76 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> Years 1 - 10 25%
Years 11 + 15% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> Years 1 - 10 25%
Years 11 + 15% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> 12.5% </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> 100.0% </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.77 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 55.0%
4 40.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .85 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> Figured by Rockingham Co. 0.0% </td>
<td style="text-align:center;"> .75 </td>
<td style="text-align:center;"> Figured by Rockingham Co. </td>
<td style="text-align:center;"> .75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.30 (5.00 minimum) </td>
<td style="text-align:center;"> 1 80.0%
2 60.0%
3 40.0%
4 20.0% </td>
<td style="text-align:center;"> 0.30(5.00 minimum) </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> yr1 80% yr2 60% yr3 50% yr 4 30% yr5 20% yr6+10% </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> yr1 80% yr 2 70% yr3 50%yrs 4+10% </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> yr1 80% yr2 60% yr3 50% yr 4 30% yr5 20% yr6+10% </td>
<td style="text-align:center;"> 0.45 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> County has this info </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 100.0% </td>
<td style="text-align:center;"> 1.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> Original cost with percentage reduction per age 0.0% </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> Original cost with percentage reduction per age 0.0% </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> Cost with reduced rate per age 0.0% </td>
<td style="text-align:center;"> 0.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 65.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5+ 30.0% </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> .37 </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> .37 </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> .37 </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 100.0% </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 100.0% </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 100.0% </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.08 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.08 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 0.64 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 0.64 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .24 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .24 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .24 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 1 80.0%
2 65.0%
3 50.0%
4 35.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5+ 10.0% </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> 1 85.0%
2 75.0%
3 65.0%
4 55.0%
5 45.0%
6 35.0%
7 25.0%
8 15.0%
9+ 10.0% </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> 0.40 </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Lan Co 0.16; North Co 0.40/100 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Lan Co 0.16; North Co 0.40/100 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Lan Co 0.16; North Co 0.40 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 20% per Year stopping at 50% </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> 20% per Year stopping at 50% </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> 20% per Year stopping at 50% </td>
<td style="text-align:center;"> 0.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 1 72.0%
10% each yr. thereafter 0.0%
(Page Co. info) </td>
<td style="text-align:center;"> 0.62 </td>
<td style="text-align:center;"> 1 72.0%
10% each yr thereafter 0.0%
(Page Co. Info) </td>
<td style="text-align:center;"> 0.62 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.066 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.83 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.066 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 1 60.0%
2 60.0%
3 60.0%
4 60.0%
5 60.0%
6 40.0%
7 40.0%
8 40.0%
9 40.0%
10 40.0%
11+ 20.0% </td>
<td style="text-align:center;"> 0.80 </td>
<td style="text-align:center;"> 1 60.0%
2 60.0%
3 60.0%
4 60.0%
5 60.0%
6 40.0%
7 40.0%
8 40.0%
9 40.0%
10 40.0%
11+ 20.0% </td>
<td style="text-align:center;"> 0.80 </td>
<td style="text-align:center;"> 1 60.0%
2 60.0%
3 60.0%
4 60.0%
5 60.0%
6 40.0%
7 40.0%
8 40.0%
9 40.0%
10 40.0%
11+ 20.0% </td>
<td style="text-align:center;"> 0.80 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .55 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .55 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> Same as Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Same as Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Same as Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.375 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> 10 10% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 10 10% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 10 10% </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> FMV 100.0% </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> FMV 100.0% </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 60%
2 50%
3 40%
4 20%
5+ 10% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 60.0%
2 40.0%
3 20.0%
4+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> King <NAME> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> King <NAME> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> King <NAME> </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .10 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0%
9+ 10.0% </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> 1 55.0%
2 50.0%
3 45.0%
4 40.0%
5 25.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 0.28 </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table09-9)Tangible Personal Property Taxes Related to Business Use for Research and Development, Furniture and Fixtures, and Biotechnology Equipment Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Research & Development*, Basis </th>
<th style="text-align:center;"> Research & Development*, Rate/$100 </th>
<th style="text-align:center;"> Business Furniture & Fixtures*, Basis </th>
<th style="text-align:center;"> Business Furniture & Fixtures*, Rate/$100 </th>
<th style="text-align:center;"> Biotechnology*, Basis </th>
<th style="text-align:center;"> Biotechnology*, Rate/$100 </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 43.0%
4 41.0%
5 39.0%
6 37.0%
7 35.0%
8 33.0%
9 31.0%
10 29.0%
11 27.0%
12 25.0%
13 23.0%
14+ 20.0% </td>
<td style="text-align:center;"> 3.63 to 3.72 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.28 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 2.98 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 2.98 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 2.98 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 60.0%
2 40.0%
3 37.0%
4 33.0%
5 20.0%
6+ 80% of previous </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 30.0% of cost </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> n/A </td>
<td style="text-align:center;"> Year 1 80%
Year 2 80%
Year 3 75%
Year 4 75%
Year 5 70%
Year 6 65%
Year 7 60%
Year 8 60%
Year 9 55%
Year 10 55%
Year 11 50%
Year 12 45%
Year 13 40%
Year 14 35%
Year 15 30%
Year 16 25%
Year 17 20%
Year 18 and back 15% </td>
<td style="text-align:center;"> 3.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> n/a </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5 20.0%
6 15.0%
7 10.0%
8+ (Min 50) 5.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5 20.0%
6 15.0%
7 10.0%
8+ (Min 50) 5.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5 20.0%
6 15.0%
7 10.0%
8+ (Min.50) 5.0% </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0%
9+ (min.1000) 10.0% </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> 1 100.0%
2 95.0%
3 90.0%
4 85.0%
5 80.0%
6 75.0%
7 70.0%
8 65.0%
9 60.0%
10 55.0%
11 50.0%
12 45.0%
13 40.0%
14 35.0%
15 30.0%
16+ 25% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> 1 100.0%
2 95.0%
3 90.0%
4 85.0%
5 80.0%
6 75.0%
7 70.0%
8 65.0%
9 60.0%
10 55.0%
11 50.0%
12 45.0%
13 40.0%
14 35.0%
15 30.0%
16+ 25% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> 1 100.0%
2 95.0%
3 90.0%
4 85.0%
5 80.0%
6 75.0%
7 70.0%
8 65.0%
9 60.0%
10 55.0%
11 50.0%
12 45.0%
13 40.0%
14 35.0%
15 30.0%
16 25.0% </td>
<td style="text-align:center;"> 1.70 </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> percentage of cost </td>
<td style="text-align:center;"> 2.29 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 1 90.0%
2 70.0%
3 50.0%
4 30.0%
5+ 10.0% </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> 1 90.0%
2 70.0%
3 50.0%
4 30.0%
5+ 10.0% </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> 1 90.0%
2 70.0%
3 50.0%
4 30.0%
5+ 10.0% </td>
<td style="text-align:center;"> 2.71 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 3.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 80.0%
2 80.0%
3 80.0%
4 60.0%
5 60.0%
6 60.0%
7 40.0%
8 40.0%
9 40.0%
10+ (no < 20%) 20.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1-9 YRS 15%
10-19 YRS 10%
20+ YRS 5% </td>
<td style="text-align:center;"> 4.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 1 25.0%
2 25.0%
3 25.0%
4 25.0%
5 25.0%
6 25.0%
7 25.0%
8 25.0%
9 25.0%
10 25.0%
11+ 15.0% </td>
<td style="text-align:center;"> 3.25 "Nominal" </td>
<td style="text-align:center;"> 1 25.0%
2 25.0%
3 25.0%
4 25.0%
5 25.0%
6 25.0%
7 25.0%
8 25.0%
9 25.0%
10 25.0%
11+ 15.0% </td>
<td style="text-align:center;"> 4.40 "nominal" </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 45%
2 45%
3 45%
4 45%
5 40%
6 35%
7 30%
8+ 25% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1. 90%
2. 85%
3. 80%
4. 70%
5. 60%
6. 50%
7. 40%
8. 35%
9. 30% </td>
<td style="text-align:center;"> 1.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Age 1 45.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 70.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> none at present </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> 1 yr. 75%
2 yr. 60%
3 yr. 50%
4 yr. 40%
5 yr. 30%
6+ yr. 20%
then 75% of depreciated
amount for tax value see above </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> 1 yr. 75%
2 yr. 60%
3 yr. 50%
4 yr. 40%
5 yr. 30%
6+ yr. 20%
then 75% of depreciated
amount for tax value </td>
<td style="text-align:center;"> 4.496 </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0%
0.0% </td>
<td style="text-align:center;"> 2.20 </td>
<td style="text-align:center;"> 1 50.0%
2 30.0%
3 20.0%
4+ 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Same Depreciation
Schedule as Above </td>
<td style="text-align:center;"> 1.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> one time depreciation 50% </td>
<td style="text-align:center;"> 1.20 </td>
<td style="text-align:center;"> one time depreciation 50% </td>
<td style="text-align:center;"> 1.20 </td>
<td style="text-align:center;"> one time depreciation 50% </td>
<td style="text-align:center;"> 1.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.57 </td>
<td style="text-align:center;"> Until asset is disposed 0.0%
1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.57 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.57 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> remove </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> remove </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 1 to 10 yrs 25.0% </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 1 to 10 yrs 25.0% </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 1 to 10 yrs 25.0% </td>
<td style="text-align:center;"> 2.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 35.0%
5 30.0%
6 25.0%
7 20.0% </td>
<td style="text-align:center;"> 2.46 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 35.0%
5 30.0%
6 25.0%
7 20.0% </td>
<td style="text-align:center;"> 2.46 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 35.0%
5 30.0%
6 25.0%
7 20.0% </td>
<td style="text-align:center;"> 2.46 </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> 60%
50%
40%
30% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 4.86 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 4.86 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> Any Age 50% </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> Any age 50% </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> Any Age 50% </td>
<td style="text-align:center;"> 2.02 </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> 98 + Newer 30.0%
97 + Older 0.0% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> 98 + Newer 30.0%
97 + older 10.0% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.95 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.95 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.95 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> 1 75.0%
2 70.0%
3 65.0%
4 60.0%
5 55.0%
6 50.0%
7 45.0%
8 40.0%
9 35.0%
10 30.0%
11 25.0%
12 20.0% </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> 1 75.0%
2 70.0%
3 65.0%
4 60.0%
5 55.0%
6 50.0%
7 45.0%
8 40.0%
9 35.0%
10 30.0%
11 25.0%
12 20.0% </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> 1 75.0%
2 70.0%
3 65.0%
4 60.0%
5 55.0%
6 50.0%
7 45.0%
8 40.0%
9 35.0%
10 30.0%
11 25.0%
12 20.0% </td>
<td style="text-align:center;"> 1.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 37.5%
5 35.0%
6 32.5%
7 30.0%
8 27.5%
9 25.0%
10 22.5%
11 20.0%
12 17.5%
13+ 15.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 3.85 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 3.85 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 3.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> 1 66.0%
2 55.0%
3 35.0%
4 24.0%
5 5.0%
6+ 1.0% </td>
<td style="text-align:center;"> 3.57 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> 1 80.0%
2 73.0%
3 63.0%
4 54.0%
5 46.0%
6 39.0%
7 32.0%
8 26.0%
9 22.0%
10+ 12.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 80.0%
2 73.0%
3 63.0%
4 54.0%
5 46.0%
6 39.0%
7 32.0%
8 26.0%
9 22.0%
10+ 12.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 80.0%
2 73.0%
3 63.0%
4 54.0%
5 46.0%
6 39.0%
7 33.0%
8 27.0%
9 23.0%
10+ 12.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 1 97.0%
2 87.0%
3 77.0%
4 67.0%
5 57.0% </td>
<td style="text-align:center;"> 1.55 </td>
<td style="text-align:center;"> 1 97.0%
2 87.0%
3 77.0%
4 67.0%
5 57.0% </td>
<td style="text-align:center;"> 1.55 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 40% first year with 5%
deprection </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Any age 40.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 25.0%
less 10% each yr.
thereafter. </td>
<td style="text-align:center;"> 3.94 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> Year Purchased Percent of Value
2018 30.0%
2017 25.0%
2016 20.0%
2015 15.0%
2014 and older 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Year Purchased Percent of Value
2018 30.0%
2017 25.0%
2016 20.0%
2015 15.0%
2014 and older 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Year Purchased Percent of Value
2018 30.0%
2017 25.0%
2016 20.0%
2015 15.0%
2014 and older 10.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 1 80.0% of cost
2 60.0% of cost
3 40.0% of cost
4 20.0% of cost
5+ 10.0% of cost </td>
<td style="text-align:center;"> 3.65 per 100 </td>
<td style="text-align:center;"> 1 80.0% of cost
2 60.0% of cost
3 40.0% of cost
4 20.0% of cost
5+ 10.0% of cost </td>
<td style="text-align:center;"> 3.65 per 100 </td>
<td style="text-align:center;"> 1 80.0% of cost
2 60.0% of cost
3 40.0% of cost
4 20.0% of cost
5+ 10.0% of cost </td>
<td style="text-align:center;"> 3.65 per 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Book Value 100.0% </td>
<td style="text-align:center;"> 1.52 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0%
8+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0% </td>
<td style="text-align:center;"> 2.75 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 25.0%
2 30.0%
3 40.0%
4 50.0%
5 60.0%
6 70.0%
7 80.0%
8+ (not less than 10%) 90.0% </td>
<td style="text-align:center;"> 1.90 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> n/a </td>
<td style="text-align:center;"> 1 32.5%
2 32.5%
3 32.5%
4 32.5%
5 32.5%
6 27.5%
7 27.5%
8 27.5%
9 27.5%
10 27.5%
11 22.5%
12 22.5%
13 22.5%
14 22.5%
15 22.5%
16 17.5%
17 17.5%
18 17.5%
19 17.5%
20 17.5%
21+ 12.5% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> n/a </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 10% depr. from prior years assessment until minimum of 100 is reached </td>
<td style="text-align:center;"> 3.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 30% of oc first 10 years
10% of oc thereafter </td>
<td style="text-align:center;"> 2.14 </td>
<td style="text-align:center;"> 30% of oc first 10 years
10% of oc thereafter </td>
<td style="text-align:center;"> 2.14 </td>
<td style="text-align:center;"> 30% of oc first 10 years
10% of oc thereafter </td>
<td style="text-align:center;"> 2.14 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 80.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 15.0% </td>
<td style="text-align:center;"> 3.36 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Any age 35.0% </td>
<td style="text-align:center;"> 3.50 @ 10% of purchase </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> Any age 15.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> Any age 15.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> Any age 15.0% </td>
<td style="text-align:center;"> 3.45 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 1-3/ 55%
4-6/ 30%
7&older/10% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1-3/ 55%
4-6/ 30%
7&older/10% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1-3/ 55%
4-6/ 30%
7&older/10% </td>
<td style="text-align:center;"> 3.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 25.0%
6+ (Min. 200) 10.0% </td>
<td style="text-align:center;"> 3.90 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 25.0%
6+ (Min 200) 10.0% </td>
<td style="text-align:center;"> 3.90 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> any age 40.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> Any age 40.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> any age 25% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> same as above </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> 1 65%
2 60%
3 55%
4 50%
5 45%
6 40%
7 37%
8 34%
9 31%
10 28%
11+ 25% </td>
<td style="text-align:center;"> 2.20 </td>
<td style="text-align:center;"> 1 65%
2 60%
3 55%
4 50%
5 45%
6 40%
7 37%
8 34%
9 31%
10 28%
11+ 25% </td>
<td style="text-align:center;"> 2.20 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 72% 1st yr. 10% less each year. </td>
<td style="text-align:center;"> 4.59 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 95.0%
2 85.5%
3 77.0%
4 69.3%
5 62.0%
6 56.0%
7 50.5%
8 45.4%
9 41.0%
10 36.8%
11 33.0%
12 29.8%
13 26.8%
14+ 25.0% </td>
<td style="text-align:center;"> 1.71 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 1 30.0%
2 27.5%
3 25.0%
4 23.5%
5 20.0%
6 17.5%
7 15.0%
8 13.5%
9 10.0%
10 7.5%
11+ 5.0% </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> 1 30.0%
2 27.5%
3 25.0%
4 23.5%
5 20.0%
6 17.5%
7 15.0%
8 13.5%
9 10.0%
10 7.5%
11+ 5.0% </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> 1 30.0%
2 27.5%
3 25.0%
4 23.5%
5 20.0%
6 17.5%
7 15.0%
8 13.5%
9 10.0%
10 7.5%
11+ 5.0% </td>
<td style="text-align:center;"> 9.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince Edward County </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> any age 20.0% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1 85.0%
2 75.0%
3 65.0%
4 55.0%
5 45.0%
6 35.0%
7 25.0%
8 15.0%
9+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 85.0%
2 75.0%
3 65.0%
4 55.0%
5 45.0%
6 35.0%
7 25.0%
8 15.0%
9+ 10.0% </td>
<td style="text-align:center;"> 3.7 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> New to 5 years 60.0%
6 to 10 years 40.0%
11+ years 20.0% </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> 1 to 5 60.0%
6 to 10 40.0%
11+ 20.0% </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> 1 to 5 years 60%
6 to 10 years 40%
11+ years 20% </td>
<td style="text-align:center;"> 2.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 40.
2previous year value reduced by 10%
3previous year value reduced by 10%
4previous year value reduced by 10%
5 Min. 100 0.0% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ (Min. 100) 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0% </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 20.0% </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 90.0%
1 90.0%
2 80.0%
3 80.0%
4 70.0%
5 70.0%
6 60.0%
7 60.0%
8 50.0%
9 50.0%
10 50.0%
11 40.0%
12 40.0%
13 40.0%
14 40.0%
15+ 30.0% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> current (new) 90.0%
1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> current (new) 90.0%
1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 3.15 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 3.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 1 90%
2 80%
3 70%
4 60%
5 50%
6 40%
7 30%
8+ 20% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 90%
2 80%
3 70%
4 60%
5 50%
6 40%
7 30%
8+ 20% </td>
<td style="text-align:center;"> 2.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 30.0%
5 20.0% </td>
<td style="text-align:center;"> 6.73 </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 30.0%
5 20.0% </td>
<td style="text-align:center;"> 5.95 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 1 35.0%
2 30.0%
3 25.0%
4 20.0%
5 15.0% </td>
<td style="text-align:center;"> 5.49 </td>
<td style="text-align:center;"> 1 35.0%
2 30.0%
3 25.0%
4 20.0%
5 15.0% </td>
<td style="text-align:center;"> 5.49 </td>
<td style="text-align:center;"> 1 35.0%
2 30.0%
3 25.0%
4 20.0%
5 15.0% </td>
<td style="text-align:center;"> 5.49 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.0 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0% </td>
<td style="text-align:center;"> 4.0 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -10% from prior year each year after </td>
<td style="text-align:center;"> 4.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 80.0% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> 10 years/ 10% minimum 15% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 10 years/ 10% minimum 15% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 10 years/ 10% minimum 15% </td>
<td style="text-align:center;"> 1.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 2.32 </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 2.32 </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 2.32 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> all 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> all 25.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> Any age 12.0% </td>
<td style="text-align:center;"> 7.00 </td>
<td style="text-align:center;"> Any age 12.0% </td>
<td style="text-align:center;"> 7.00 </td>
<td style="text-align:center;"> Any age 12.0% </td>
<td style="text-align:center;"> 7.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 25.0%
2 22.5%
3 20.0%
4 17.5%
5 15.0%
6 12.5%
7+ 10.0% </td>
<td style="text-align:center;"> 4.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Any age 20.0% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> Any age 20% </td>
<td style="text-align:center;"> 3.08 </td>
<td style="text-align:center;"> Any age 20% </td>
<td style="text-align:center;"> 3.08 </td>
<td style="text-align:center;"> Any age 20% </td>
<td style="text-align:center;"> 3.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.00 (3.5
effective
01/01/2018) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 50.0%
2 45.0%
3 40.0%
4 35.0%
5 30.0%
6 25.0%
7+ 20.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> 4.13 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 4.13 </td>
<td style="text-align:center;"> 1 80%
2 70%
3 60%
4 50%
5 40%
6 30%
7 20%
8 10% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.84 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.84 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 4.84 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Any age 25.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 45.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.40 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 45.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.40 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> any age 50.0% </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> Any age 35.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 35.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 35.0% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 2.12 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 2.12 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 2.12 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> New 60%
1 50%
2 40%
3 30%
4 20% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> New 60.0%
1 50.0%
2 40.0%
3 30.0%
4 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> New 60%
1 50%
2 40%
3 30%
4 20% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25% of OC when item is not fully depreciated
10% of OC when item is fully depreciated </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> 1 30.0%
2 30.0%
3 30.0%
4 30.0%
5 30.0%
6+ 25.35% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 1 30.0%
2 30.0%
3 30.0%
4 30.0%
5 30.0%
6+ 25.35% </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 1 30.0%
2 30.0%
3 30.0%
4 30.0%
5 30.0%
6+ 25.35% </td>
<td style="text-align:center;"> 3.80 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7+ 20.0% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 25.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 25.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 25.0% </td>
<td style="text-align:center;"> 2.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> Any age 33.3% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 33.3% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Any age 33.3% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> any age 40.0% </td>
<td style="text-align:center;"> 4.33 </td>
<td style="text-align:center;"> Any age 40.0% </td>
<td style="text-align:center;"> 4.33 </td>
<td style="text-align:center;"> any age 40.0% </td>
<td style="text-align:center;"> 4.33 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Any age
Value @ 10% of Cost </td>
<td style="text-align:center;"> 2.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5+ 20.0% </td>
<td style="text-align:center;"> 4.90 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 30.0% </td>
<td style="text-align:center;"> 4.15 </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 4.15 </td>
<td style="text-align:center;"> 30.0% </td>
<td style="text-align:center;"> 4.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 1985-current 50.0%
1984-older 25.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1985-current 50.0%
1984-older 25.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.76 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.76 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 20.0% </td>
<td style="text-align:center;"> 3.70 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 60.0%
50.0%
40.0%
30.0%
20.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> 60%
50%
40%
30%
20% </td>
<td style="text-align:center;"> 3.45 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 or older 25.0% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 and older 25.0% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6+ 25.0% </td>
<td style="text-align:center;"> 3.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 7 </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 1-5 yrs 20% OC
6 yrs & older 10% OC </td>
<td style="text-align:center;"> 3.15 </td>
<td style="text-align:center;"> Any age 20% OC </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> Any age 20% OC </td>
<td style="text-align:center;"> 4.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> all years 40.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> all years 40.0% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> all years 40% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 40% of given book value each year 0.0%
to min. 20% of the original cost of item 0.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 40% of given book value each year 0.0%
to min. 20% of the OC of item 0.0% </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 40% if given book value each year 0.0%
to min. 20% of the original cost of item 0.0% </td>
<td style="text-align:center;"> 5.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Any age 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> any age 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6+ 30.0% </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.76 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Years 1 - 10 25%
Years 11 + 15% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Figured by Rockingham Co. </td>
<td style="text-align:center;"> .75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.20 (5.00 minimum) </td>
<td style="text-align:center;"> Each year based 10.0%
on original cost 0.0% </td>
<td style="text-align:center;"> 0.30 (5.00 minimum) </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> yr1 80% yr2 60% yr3 50% yr 4 30% yr5 20% yr6+10% </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> yr1 80% yr2 60% yr3 50% yr 4 30% yr5 20% yr6+10% </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.45 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> Cost with reduced rate per age 0.0% </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Original cost with percentage 0.0%
reduction per age 0.0% </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5+ 30.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5+ 30.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> .37 </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> .37 </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> .37 </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 0.0% </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> Any age 100.0% </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.025 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.08 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.64 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .24 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .24 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .24 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 1 85.0%
2 75.0%
3 65.0%
4 55.0%
5 45.0%
6 35.0%
7 25.0%
8 15.0%
9+ 10.0% </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 10.0% </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> 0.40 </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> 1 90.0%
2 85.0%
3 80.0%
4 70.0%
5 60.0%
6 50.0%
7 40.0%
8 35.0%
9+ 30.0% </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Lan Co 0.16; North Co 0.40 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Lan Co 0.16; North Co 0.40/100 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Lan Co 0.16; Noth Co. .40/100 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 20% per Year stopping at 50% </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> 20% per Year stopping at 50% </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> 20% per Year stopping at 50% </td>
<td style="text-align:center;"> 0.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 72.0%
10% each year thereafter 0.0%
(Page Co. Info) </td>
<td style="text-align:center;"> 0.62 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.83 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .55 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> Same as Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Same as Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Same as Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 70% dep 10% each year to 20% min </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> 10 10% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 10 10.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 10 10% </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.05 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> N/A 0.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 60.0%
2 50.0%
3 40.0%
4 30.0%
5+ 20.0% </td>
<td style="text-align:center;"> 1.00/100.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 70.0%
2 60.0%
3 50.0%
4 40.0%
5 30.0%
6 20.0%
7+ 10.0% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> King William COR </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> King <NAME> </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> King <NAME> </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> shenandoah county does all assessment </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> 1 50.0%
2 50.0%
3 50.0%
4 50.0%
5 50.0%
6+ 20.0% </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table09-11)Tangible Personal Property Taxes for Boats and Aircraft Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Boats & Watercraft Over 5 Tons*, Basis </th>
<th style="text-align:center;"> Boats & Watercraft Over 5 Tons*, Rate/$100[^†] </th>
<th style="text-align:center;"> Private Pleasure Boats & Watercraft*, Basis </th>
<th style="text-align:center;"> Private Pleasure Boats & Watercraft*, Rate/$100[^†] </th>
<th style="text-align:center;"> Aircraft*, Basis </th>
<th style="text-align:center;"> Aircraft*, Rate/$100[^†] </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 1st:30282624222018161412108642 </td>
<td style="text-align:center;"> 3.63 to 3.72 </td>
<td style="text-align:center;"> ABOS </td>
<td style="text-align:center;"> 3.63 to 3.72 </td>
<td style="text-align:center;"> aircraft blue book price digest </td>
<td style="text-align:center;"> 3.63 to 3.72 </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 1st year-90% of cost 90% of
assessed value thereafter;
minimum 200 </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> 1st year-90% of cost 90% of
assessed value thereafter;
minimum 200 </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> 1st year-12.5% of cost 90% of
assessed value thereafter;
minimum 1000 </td>
<td style="text-align:center;"> 4.28 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1st year 40%
2nd year 40%
3rd year 36%
4th year 32%
5th year 28%
6th year 24%
7th year 20%
8th year 20%
9th year 20%
10th year 20%
11th year 20%
12th year 20%
13th year 20%
14th year 20%
15th year 20%
16th year 20%
17th year 20%
18th yea </td>
<td style="text-align:center;"> 2.98 </td>
<td style="text-align:center;"> 24% of Cost </td>
<td style="text-align:center;"> 2.98 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 33.0%
5 20.0%
6+ 80% of previous </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 33.0%
5 20.0%
6+ 80% of previous </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 33.0%
5 20.0%
6+ 80% of previous </td>
<td style="text-align:center;"> 4.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 80% of cost or deduct 10% of prior assessed value thereafter. </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> 80% of cost or deduct 10% of prior assessed value thereafter. </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> 100% trade in value </td>
<td style="text-align:center;"> 3.35 </td>
<td style="text-align:center;"> 100% trade in value </td>
<td style="text-align:center;"> 3.35 </td>
<td style="text-align:center;"> 100% trade in value </td>
<td style="text-align:center;"> 3.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> NADA - Low low or % of cost </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> NADA - low value or % of original cost </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Aircraft Bluebook Price Digest
We have no aircraft in Arlington Co. </td>
<td style="text-align:center;"> 5.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> 25% of Aircraft Blue Book Average Wholesale </td>
<td style="text-align:center;"> 2.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> 1yr:902:803:704:605:506:40 10%e/yr.min1000 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 1yr:902:803:704:605:506:40 10%e/yr.min1000 </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 1yr:90%2:fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b; 10% e/yr.(min1000) </td>
<td style="text-align:center;"> 0.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> 100% low ABOS value </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> 100% low ABOS value </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> Vessel Valuation Services
% of value </td>
<td style="text-align:center;"> 2.29 </td>
<td style="text-align:center;"> Vessel Valuation Services
% of Value </td>
<td style="text-align:center;"> 2.29 </td>
<td style="text-align:center;"> % of Cost </td>
<td style="text-align:center;"> 2.29 </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 1st.-90%;70%;50%;30%;10% </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> 1st.-90%;70%;50%;30%;10% </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> 1st.-90%;70%;50%;30%;10% </td>
<td style="text-align:center;"> 2.71 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> ABOS Guide </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> ABOS Guide "Low Value" </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> 25% of OC </td>
<td style="text-align:center;"> 3.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 1:85%2:703:604:505:406:357:258:159:10% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1:85%2:703:604:505:406:357:258:159:10% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> NADA
IF NOT AVAILABLE IN NADA
1st:80; 90% thereafter </td>
<td style="text-align:center;"> 4.05 </td>
<td style="text-align:center;"> NADA
IF NOT AVAILABLE IN NADA
1st:80; 90% thereafter </td>
<td style="text-align:center;"> 4.05 </td>
<td style="text-align:center;"> AIRCRAFT BLUEBOOK
IF NOT AVAILABLE IN BOOK
1st:80; 90% thereafter </td>
<td style="text-align:center;"> .55 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 1yr:80%
2:70%
3:60%
4:50%
5:40%
6:30%
7-20:20%
21+:10% </td>
<td style="text-align:center;"> 4.40 "Nominal" </td>
<td style="text-align:center;"> 1yr:80%
2:70%
3:60%
4:50%
5:40%
6:30%
7-20:20%
21+:10% </td>
<td style="text-align:center;"> 4.40 "Nominal" </td>
<td style="text-align:center;"> Gross WT <= 20000lbs:
1yr:13.91%
2:12.35%
3:10.82%
4:9.27%
5:7.73%
6:6.18% </td>
<td style="text-align:center;"> 4.40 "Nominal" </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% ABOS WHOLESALE HIGH </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 1 90%
2 80%
3 70%
4 60%
5 50%
6 40%
7 30%
8 20%
9+ 10% </td>
<td style="text-align:center;"> 3.80 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 85%
75%
65%
55%
45%
40%
35%
30% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 85%
75%
65%
55%
45%
40%
35% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 60%
55%
50% </td>
<td style="text-align:center;"> 1.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 100% ABOS Guide </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 100% ABOS Guide </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1:60504030206+yrs:10 </td>
<td style="text-align:center;"> 3.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 1yr -70% 2yr-50 3yr-40 4yr-30 5yr-20 6+yr-10 </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 1yr -70% 2yr-50 3yr-40 4yr-30 5yr-20 6+yr-10 </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> Aircraft Bluebook Digest; Wholesale value </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 1 yr. 75%
2 yr. 60%
3 yr. 50%
4 yr. 40%
5 yr. 30%
6+ yr. 20%
then 75% of depreciated
amount for tax value </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> 1 yr. 75%
2 yr. 60%
3 yr. 50%
4 yr. 40%
5 yr. 30%
6+ yr. 20%
then 75% of depreciated
amount for tax value </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> 100 % wholesale value from aircraft book
0r 20% OC </td>
<td style="text-align:center;"> 4.496 </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 80% 70 60 50 40 30 20 >20yrs (min 200) </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 80% 70 60 50 40 30 20 </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 100% Low Trade-in ABOS </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> 100% Low Trade-in ABOS </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> 100% AVG Whole Sale - Aircraft Blue Book </td>
<td style="text-align:center;"> 0.0001 </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> Vessel Valuation Services Inc. </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Vessel Valuation Services Inc. </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Aircraft Blue Book </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20% of OC </td>
<td style="text-align:center;"> 1.85 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> value by marine blue book </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> value by marine blue book </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> Aircraft Book 100% </td>
<td style="text-align:center;"> .50 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 50% FMV </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 50% FMV </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 50% FMV </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 0.01 </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 0.01 </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 0.01 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 1st:7060504030207+yrs:10 </td>
<td style="text-align:center;"> 4.65 </td>
<td style="text-align:center;"> 1st:7060504030207+yrs:10 </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Avg inventory value from aircraft blue bk </td>
<td style="text-align:center;"> 0.001 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 1st:70 less 10% prior assessed value thereafter not lower than 20%. </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> 1st:70 less 10% prior assessed value thereafter not lower than 20%. </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> 1st:70 less 10% prior assessed value thereafter not lower than 20%. </td>
<td style="text-align:center;"> 2.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 100% Avg. Trade-In Value </td>
<td style="text-align:center;"> 4.35 </td>
<td style="text-align:center;"> Mid high-low Blue Book </td>
<td style="text-align:center;"> 4.35 </td>
<td style="text-align:center;"> 1st. to 10 years 20 % of cost each year </td>
<td style="text-align:center;"> 4.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> 100% ABOS low book </td>
<td style="text-align:center;"> 2.46 </td>
<td style="text-align:center;"> 100% ABOS low book </td>
<td style="text-align:center;"> 2.46 </td>
<td style="text-align:center;"> 100% low book </td>
<td style="text-align:center;"> 2.46 </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> None in area </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA boat book </td>
<td style="text-align:center;"> 4.86 </td>
<td style="text-align:center;"> Blue Book </td>
<td style="text-align:center;"> 0.01 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> Zero effective rate </td>
<td style="text-align:center;"> 00.00001 </td>
<td style="text-align:center;"> Zero effective rate </td>
<td style="text-align:center;"> 0.00001 </td>
<td style="text-align:center;"> 30% of OC </td>
<td style="text-align:center;"> 2.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 1st yr : 60
2: 45
3: 37.5
4:30
5 & prior: 20% </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 1 50
2 45
3 40
4 37.5
5 35
6 32.5
7 30
8 27.5
9 25
10 22.5
11 20
12 17.5
13+yrs 15 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 50
2 45
3 40
4 37.5
5 35
6 32.5
7 30
8 27.5
9 25
10 22.5
11 20
12 17.5
13+yrs 15 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 80% cost less 10% each yr to 10% </td>
<td style="text-align:center;"> 3.85 </td>
<td style="text-align:center;"> 80% cost less 10% each yr to 10% </td>
<td style="text-align:center;"> 3.85 </td>
<td style="text-align:center;"> 80% cost less 10% each yr to 10% </td>
<td style="text-align:center;"> 3.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> ABOS MARINE BLUE BOOK </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> ABOS MARINE BLUE BOOK </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> Aircraft Blue Book/percentage of cost </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> 1st:75
2nd:60
3rd:50
4th:40
5th:30
6+yr:20 </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1st:75
2nd:60
3rd:50
4th:40
5th:30
6+yr:20 </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1st:75
2nd:60
3rd:50
4th:40
5th:30
6+yr:20 </td>
<td style="text-align:center;"> .50 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> NADA USED TRADE-IN VALUE </td>
<td style="text-align:center;"> 1.55 </td>
<td style="text-align:center;"> NADA USED TRADE-IN VALUE </td>
<td style="text-align:center;"> 1.55 </td>
<td style="text-align:center;"> AIRCRAFT BLUEBOOK
AVG WHOLESALE </td>
<td style="text-align:center;"> 1.55 </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 40% first year with 5%
deprection until minimum
value of 300 </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> ABOS first year then 10% depreciation each year after </td>
<td style="text-align:center;"> 0.32 </td>
<td style="text-align:center;"> ABOS first year then 10% depreciation each year after </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 75% sale price or insurance value
10% sliding scale following year </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> 50% cost </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 50% BV </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 25% BV </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> Trade-in Value </td>
<td style="text-align:center;"> 3.94 </td>
<td style="text-align:center;"> Trade-in value </td>
<td style="text-align:center;"> 3.94 </td>
<td style="text-align:center;"> 40% retail Value </td>
<td style="text-align:center;"> 3.94 </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> If not available in the
pricing guide start at
80% of OC and decrease
by 5% for each year. </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> If not available in the
pricing guide start at
80% of OC and decrease
by 5% for each year. </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> If not available in the
pricing guide start at
80% of OC and decrease
by 5% for each year. </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> Buck Boats and Vessel Valuation Service </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> Buck Boats and Vessel Valuation Service </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> Airpac Guide </td>
<td style="text-align:center;"> 1.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> If not in guide
20% of original cost </td>
<td style="text-align:center;"> .000000000000001 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> .000000000000001 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 1.52 </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 2.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 1yr:70%
2yr:60%
3yr:50%
4yr:40%
5yr:30%
6yr.20% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1yr:70%
2yr:60%
3yr:50%
4yr:40%
5yr:30%
6yr.20% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> Avg Wholesale Value
per Aircraft Bluebook </td>
<td style="text-align:center;"> 0.01 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% NADA-WS </td>
<td style="text-align:center;"> 2.43 </td>
<td style="text-align:center;"> 100% FMV Aircraft Blue Book </td>
<td style="text-align:center;"> 0.48 </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 100% trade-in </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 100% Trade In </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 100% Marketable </td>
<td style="text-align:center;"> 2.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> 100 </td>
<td style="text-align:center;"> 3.10 </td>
<td style="text-align:center;"> 100 </td>
<td style="text-align:center;"> 3.10 </td>
<td style="text-align:center;"> 100 </td>
<td style="text-align:center;"> 3.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 100% Low Trade-In ABOS </td>
<td style="text-align:center;"> 1.45 </td>
<td style="text-align:center;"> 100% Low Trade-In ABOS marine blue book </td>
<td style="text-align:center;"> 1.45 </td>
<td style="text-align:center;"> 100% BV </td>
<td style="text-align:center;"> 2.14 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> 1 80
2 70
3 60
4 50
5 40
6 30
7 25
8+ 15 </td>
<td style="text-align:center;"> 3.36 </td>
<td style="text-align:center;"> 1 80
2 70
3 60
4 50
5 40
6 30
7 25
8+ 15 </td>
<td style="text-align:center;"> 3.36 </td>
<td style="text-align:center;"> 1 80
2 70
3 60
4 50
5 40
6 30
7 25
8+ 15 </td>
<td style="text-align:center;"> 3.36 </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 35% of RV </td>
<td style="text-align:center;"> 0.62 </td>
<td style="text-align:center;"> 35% of RV </td>
<td style="text-align:center;"> 0.98 </td>
<td style="text-align:center;"> 35% of RV </td>
<td style="text-align:center;"> 2.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> ABOS MARINE BLUE BOOK </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> ABOS MARINE BLUE BOOK </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> AIRCRAFT BLUE BOOK </td>
<td style="text-align:center;"> 1.23 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 75% NADA Average Value
MARINE APPRAISAL GUIDE </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 75% NADA AVERAGE VALUE
MARINE APPRAISAL GUIDE </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 100% Retail/Market </td>
<td style="text-align:center;"> .75 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> ABOS </td>
<td style="text-align:center;"> 0.99 </td>
<td style="text-align:center;"> ABOS </td>
<td style="text-align:center;"> 0.99 </td>
<td style="text-align:center;"> 70% 1st year
-5% every year thereafter </td>
<td style="text-align:center;"> 3.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> 20% of Original Cost </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 40% avg. retail </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 40% </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> same as above </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> Values come from vessel valuation. If no value then we use the OC and depreciate by the 80 70 55 40 25 and 10% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 80% 70% 55% 40% 25% 10% min </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> ABOS Marine Blue Book </td>
<td style="text-align:center;"> 2.09 </td>
<td style="text-align:center;"> ABOS Marine Blue Book </td>
<td style="text-align:center;"> 2.09 </td>
<td style="text-align:center;"> Aircraft was given a zero rate in 2016 </td>
<td style="text-align:center;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> 1st:72 10% deduction of previous balance/year </td>
<td style="text-align:center;"> 4.59 </td>
<td style="text-align:center;"> 1st:72 10% deduction of previous balance/year </td>
<td style="text-align:center;"> 4.59 </td>
<td style="text-align:center;"> Aircraft Blue Book </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> 1st yr 95%
85.5
77
69.362
56.10
50.5
45.4
40.90
36.80
33.10
29.80
26.80
25 </td>
<td style="text-align:center;"> 1.71 </td>
<td style="text-align:center;"> same as boats over 5 tons </td>
<td style="text-align:center;"> 1.71 </td>
<td style="text-align:center;"> same depreciation as
boats </td>
<td style="text-align:center;"> 1.71 </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 30% used Wholesale </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> 30% Used Wholesale </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> Percentage of Cost
1 30.0%
2 27.5%
3 25.0%
4 23.5%
5 20.0%
6 17.5%
7 15.0%
8 13.5%
9 10.0%
10 7.5%
11+ 5.0% </td>
<td style="text-align:center;"> 9.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 3.60 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA/LV </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Based on Yr Model Condition </td>
<td style="text-align:center;"> 4.50 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 60% 1st year
50%
40%
30%
20% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 60% 1st year
50%
40%
30%
20% </td>
<td style="text-align:center;"> 4.25 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .00001 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .00001 </td>
<td style="text-align:center;"> Commuter </td>
<td style="text-align:center;"> .00001 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> ABOS Marine Blue Book </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> 60% OC 1-2;
55% OC 3-4;
50% OC 5-6;
45% OC 7-8;
40% OC 9-10;
35% OC 11-12;
30% OC 13 years and older </td>
<td style="text-align:center;"> 2.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> NADA Boat Book </td>
<td style="text-align:center;"> 4.25(+.20 fire tax) </td>
<td style="text-align:center;"> NADA Boat Book </td>
<td style="text-align:center;"> 4.25 (+.20 fire tax) </td>
<td style="text-align:center;"> None in County </td>
<td style="text-align:center;"> 4.25(+.20 fire tax) </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA Marine Appraisal Guide </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 1yr:40%
2previous year value reduced by 10%
3previous year value reduced by 10%
4previous year value reduced by 10%
5 Min. 100 </td>
<td style="text-align:center;"> 3.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> NADA
IF NOT IN NADA BOOK 90%
OF COST </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> N /A </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> Low book min 100 </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> Low book value to min. of 100 </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 8 yr. 10% straight line </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 8 yr. 10% straight line </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 8 yr. 10% straight line </td>
<td style="text-align:center;"> .44 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 1st2nd:80; 34:60; 56:50; 7-10:40; 11-14:30; 15+yr:20 </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1st2nd:80; 34:60; 56:50; 7-10:40; 11-14:30; 15+yr:20 </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1st2nd:80; 34:60; 56:50; 7-10:40; 11-14:30; 15+yr:20 </td>
<td style="text-align:center;"> 1.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 1st:90
2nd:80
3rd:70
4th:60
5th:50
6th:40
7th:30
8th:20
9+yr:10 </td>
<td style="text-align:center;"> 3.90 </td>
<td style="text-align:center;"> 1st:90
2nd:80
3rd:70
4th:60
5th:50
6th:40
7th:30
8th:20
9+yr:10 </td>
<td style="text-align:center;"> 3.90 </td>
<td style="text-align:center;"> 1st:90
2nd:80
3rd:70
4th:60
5th:50
6th:40
7th:30
8th:20
9+yr:10 </td>
<td style="text-align:center;"> 3.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8+ 20.0% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> 1 50.0%
2 40.0%
3 30.0%
4 20.0%
5 10.0% </td>
<td style="text-align:center;"> 1.40 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 1st:807060504030208+yr:10 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1st:807060504030208+yr:10 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 1yr:50%
2:45%
3:40%
4:30%
5:20% </td>
<td style="text-align:center;"> 6.73 </td>
<td style="text-align:center;"> 1yr:50%
2:45%
3:40%
4:30%
5:20% </td>
<td style="text-align:center;"> 6.73 </td>
<td style="text-align:center;"> 1yr:50%
2:45%
3:40%
4:30%
5:20% </td>
<td style="text-align:center;"> .000001 </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NOT TAXED </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NOT TAXED </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NOT TAXED </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> ABOS Marine Blue Book low value or %OC </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> ABOS Marine Blue Book low value </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Aircraft Bluebook </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -10% from prior year each year after </td>
<td style="text-align:center;"> 4.85 </td>
<td style="text-align:center;"> -10% from prior year each year after </td>
<td style="text-align:center;"> 4.85 </td>
<td style="text-align:center;"> -10% from prior year each year after </td>
<td style="text-align:center;"> 4.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 1 75.0%
2 65.0%
3 55.0%
4 45.0%
5 35.0%
6 25.0%
7+ 15.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 75.0%
2 65.0%
3 55.0%
4 45.0%
5 35.0%
6 25.0%
7+ 15.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 75.0%
2 65.0%
3 55.0%
4 45.0%
5 35.0%
6 25.0%
7+ 15.0% </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 100% w/motor of > 5hp </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 100% Aircraft Blue Book
wholesale amount
Gliders - 500 </td>
<td style="text-align:center;"> 0.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> NADA/ BV
Year:percent
1:90
2:80
3:70
4:60
5:50
6:40
7:30
6:20 </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> NADA/ BV
Year:percent
1:90
2:80
3:70
4:60
5:50
6:40
7:30
8:20 </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> Aircraft Book/ BV </td>
<td style="text-align:center;"> 1.70 </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> Retail Low - 50% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> Retail Low - 50% </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 3.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> ABOS-Low average Trade-In Value </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> Aircraft Book-LV & Low Wholesale </td>
<td style="text-align:center;"> 1.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 1=80%; 2=70%;3=60%;4=50%; 5=40%6=30% </td>
<td style="text-align:center;"> 2.32 </td>
<td style="text-align:center;"> 1=80%; 2=70%;3=60%;4=50%; 5= 40%6=30% </td>
<td style="text-align:center;"> 2.32 </td>
<td style="text-align:center;"> Depreciated cost </td>
<td style="text-align:center;"> 2.32 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 80% in yr acquired less
10% each yr thereafter </td>
<td style="text-align:center;"> .000000001 </td>
<td style="text-align:center;"> 60% of Low BV in ABOS
Book. Min varies
depending on length of
boat. </td>
<td style="text-align:center;"> .000000001 </td>
<td style="text-align:center;"> No aircraft at this time. </td>
<td style="text-align:center;"> none </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> Commercial Boats </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0001 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 12.0% </td>
<td style="text-align:center;"> 7.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> ABOS Guide </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> ABOS Guide </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> none in locality </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> Pricing Guide </td>
<td style="text-align:center;"> 0.01 </td>
<td style="text-align:center;"> Pricing Guide </td>
<td style="text-align:center;"> 0.01 </td>
<td style="text-align:center;"> 20% OC </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 1st:90% less 10% prior assessed value thereafer. </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1st:90% less 10% prior assessed value thereafter. Min. 30 </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% NADA MARINE APPRAISAL GUIDE </td>
<td style="text-align:center;"> 3.08 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.00 (3.5 effective 01/01/2018) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.00 (3.5
effective 01/01/2018) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 30% OC </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.13 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.13 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> ABOS Publication and Percent of Cost Paid </td>
<td style="text-align:center;"> 4.84 </td>
<td style="text-align:center;"> Percent of cost paid </td>
<td style="text-align:center;"> 4.84 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25% of OC </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 yr. 90% 2 / 80% 3/ 70% 4/ 60% 5/45 % 6 /30 7/20% </td>
<td style="text-align:center;"> 3.40 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 1st yr 80% then depreciate
by 10% to a min of 100 </td>
<td style="text-align:center;"> 1.00 business
pleasure
.000001/100 </td>
<td style="text-align:center;"> 1st yr 80% then depreciate
by 10% to a min of 100 </td>
<td style="text-align:center;"> 1.00 business
pleasure
.000001/100 </td>
<td style="text-align:center;"> 1st yr 80% then depreciate
by 10% to a min of 100 </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> current-1st:35%
2-7yr:30%
8-13yr:25%
14-22yr:15%
23+yr:10% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 65% of retail-ABOS </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> New 60%
1 50%
2 40%
3 30%
4 20% </td>
<td style="text-align:center;"> 3.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 85% of OC for each year owned </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 85% of OC for each year owned </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> 25% of OC when not fully depreciated
10% of OC when fully depreciated </td>
<td style="text-align:center;"> 4.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> ABOS Marine Blue Book </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> ABOS Marine Blue Book </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 1:902:703:604:505:406:307:208:109+:90% of prev. yr. </td>
<td style="text-align:center;"> 3.80 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> Sliding Scale by Age </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> NADA Marine Guide </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> Aircraft Blue Book (Avg Retail) </td>
<td style="text-align:center;"> 0.00001 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> NADA Marine Appraisal
Guide or % of OC </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> NADA Marine Appraisal
Guide or % OC </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> ABOS - Avg between listed high </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> NADA used trade in or % of OC Min 125 </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 85% of original cost of the purchase year and reduced by 90% of the previous year's assessment until the taxpayers liability begins. </td>
<td style="text-align:center;"> .90 </td>
<td style="text-align:center;"> 100% ABOS BV or % OC per
purchase year
* Min Value assessed is
200 boats 1 aft & under
or 500 boats 1 aft & over </td>
<td style="text-align:center;"> 1.00 OC or BV </td>
<td style="text-align:center;"> Aircraft Digest 100% BV
(Avg Inv) </td>
<td style="text-align:center;"> .50 effective
1/2016 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 60% of OC less 5% per year </td>
<td style="text-align:center;"> 1.50 (commercial) </td>
<td style="text-align:center;"> Retail range ABOS </td>
<td style="text-align:center;"> 0.50 (all sizes) </td>
<td style="text-align:center;"> 20% of avg wholesale from
Aircraft Blue Book </td>
<td style="text-align:center;"> 2.40 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 2.05 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 2.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 100% ABOS Book </td>
<td style="text-align:center;"> 4.90 </td>
<td style="text-align:center;"> 100% ABOS Book </td>
<td style="text-align:center;"> 4.90 </td>
<td style="text-align:center;"> n/a none in our locality </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 100% ABOS value </td>
<td style="text-align:center;"> .000001 </td>
<td style="text-align:center;"> 100% ABOS value </td>
<td style="text-align:center;"> .000001 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> Low Retail Abos </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> Low Retail Abos </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 50% of cost </td>
<td style="text-align:center;"> 5.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 2.44 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 2.44 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 3.70 </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 3.70 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> ABOS Book - Low Avg Trade In </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> ABOS Book - Low Avg Trade In </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> % of cost </td>
<td style="text-align:center;"> 1.06 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 25.0%
9+ Less 20% of last years assessment </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 25.0%
9+ Less 20% of last years assessment </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 25.0%
9+ Less 20% of last years assessment </td>
<td style="text-align:center;"> 3.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 7 yr to 15% of original acquisition </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 7 yr to 15% of original acquisition </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> 7 yr to 15% of original cost </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> ABOS </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> ABOS </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> 20% of OC </td>
<td style="text-align:center;"> 0.58 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> NADA Marine Guide ABOS Marine Guide </td>
<td style="text-align:center;"> 1.50 Commercial Use </td>
<td style="text-align:center;"> NADA Marine Guide ABOS Marine Guide </td>
<td style="text-align:center;"> .000001 </td>
<td style="text-align:center;"> ars of ownership 1.5%of original cost </td>
<td style="text-align:center;"> 4.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 1st:40303+yr:20 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1st:40303+yr:20 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> LV </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA Trade-In </td>
<td style="text-align:center;"> 4.80 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> </td>
<td style="text-align:center;"> NADA/ LV </td>
<td style="text-align:center;"> 0.76 </td>
<td style="text-align:center;"> NADA/ LV </td>
<td style="text-align:center;"> 0.76 </td>
<td style="text-align:center;"> Aircraft Book LV </td>
<td style="text-align:center;"> 0.76 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 1 Yr 80%
2 Yrs 70%
3 Yrs 60% </td>
<td style="text-align:center;"> 2.00 per 100 of assessed value </td>
<td style="text-align:center;"> 1 Year 80%
2 Yrs 70%
3 Yr 60%
4 yr 50%
5 Yr 25%
6 Yr 20% (floored) </td>
<td style="text-align:center;"> 2.00 per 100 of assessed value </td>
<td style="text-align:center;"> Based on gross wt. less than 20000 lbs
1 Yrs. 13.91%
2 Yrs 12.35%
3 Yr 10.82%
4 Yr 9.27%
5 Yr 7.73%
6 Yr 6.18% (Floor) </td>
<td style="text-align:center;"> 2.00 per 100 of assessed value </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> ABOS </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> ABOS </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> Aircraft Blue Book </td>
<td style="text-align:center;"> 0.77 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> 100% BV </td>
<td style="text-align:center;"> 1.06 </td>
<td style="text-align:center;"> 100% BV </td>
<td style="text-align:center;"> 1.06 </td>
<td style="text-align:center;"> 100% BV </td>
<td style="text-align:center;"> 1.06 </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 55.0%
4 40.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 55.0%
4 40.0%
5 20.0%
6+ 10.0% </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> Done by Nottoway County </td>
<td style="text-align:center;"> 0.85 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> Figured by Rockingham Co. </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> Figured by Rockingham Co. </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 56% used wholesale </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 56% used wholesale </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.20 (5.00 minimum) </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.20 (5.00 minimum) </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.20 (5.00 minimum) </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> abos marine blue book </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> abos marine blue book </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> aircraft bluebook </td>
<td style="text-align:center;"> 0.45 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 1.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> Annual dep. </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .01 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> per com. Of rev. southampton </td>
<td style="text-align:center;"> 1.14 if applicable </td>
<td style="text-align:center;"> per com. Of rev. southampton co. </td>
<td style="text-align:center;"> 1.14 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> N/A </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 100% low Trade-in
per ABOS; min 200 </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Shenandoah County </td>
<td style="text-align:center;"> 1.08 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .99 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .99 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .99 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> Done by Pittsylvania County </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> Done by Pittsylvania County </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> Loudoun County </td>
<td style="text-align:center;"> 1.10 </td>
<td style="text-align:center;"> Loudoun County </td>
<td style="text-align:center;"> 1.10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> same as prince william co. </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 100% Appraisal value </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 100% Appraisal value </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 100% Appraisal value </td>
<td style="text-align:center;"> 0.40 </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 85% 75 65 55 45 40 35 </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> 85% 75 65 55 45 40 35 </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> 60% 55% 50% min </td>
<td style="text-align:center;"> 0.72 </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> Done by counties </td>
<td style="text-align:center;"> 0.16; .40 </td>
<td style="text-align:center;"> 100% Lancaster Co; 40% Northumberland Co </td>
<td style="text-align:center;"> 0.16; .40 </td>
<td style="text-align:center;"> Done by counties </td>
<td style="text-align:center;"> 0.16; .40 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> Mecklenburg County </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> Mecklenburg County </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.001 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.71 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.71 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.71 </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> (Page Co. Assessments) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.83 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.83 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.83 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.80 </td>
<td style="text-align:center;"> NADA (watercraft guide) 100% </td>
<td style="text-align:center;"> 0.80 </td>
<td style="text-align:center;"> 60% of cost </td>
<td style="text-align:center;"> .80 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Only licensed motor vehicles </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> Done by Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Done by Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Done by Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> 70% dep 10% each year to 20% min </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> 70% dep 10% each year to 20% min </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> ABOS Guide 100% Low Book Value </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .31 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 0.00001 </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 0.00001 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> cost less 10% 1st yr down to 15% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 100% of value </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> 100% of value </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> 1.11 </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> 1.11 </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA Boat Guide- low value </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 1.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> See Roanoke county </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> see Roanoke County </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> see Roanoke County </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> 100% of assessed value </td>
<td style="text-align:center;"> 0.86 </td>
<td style="text-align:center;"> 100% of assessed value </td>
<td style="text-align:center;"> 0.86 </td>
<td style="text-align:center;"> 100% of assessed value </td>
<td style="text-align:center;"> 0.86 </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> Shenandoah Co. </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> Shhenandoah Co. </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> Shenandoah Co. </td>
<td style="text-align:center;"> 0.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> see Wythe county </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> see Wythe County </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> see Wythe County </td>
<td style="text-align:center;"> 0.28 </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table09-12)Tangible Personal Property Taxes for Antique Motor Vehicles, Recreational Vehicles, and Mobile Homes Table, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Antique Motor Vehicles*, Basis </th>
<th style="text-align:center;"> Antique Motor Vehicles*, Rate/$100[^†] </th>
<th style="text-align:center;"> Recreational Vehicles*, Basis </th>
<th style="text-align:center;"> Recreational Vehicles*, Rate/$100[^†] </th>
<th style="text-align:center;"> Mobile Homes*, Basis </th>
<th style="text-align:center;"> Mobile Homes*, Rate/$100[^†] </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 3.63 to 3.72 </td>
<td style="text-align:center;"> VIRGINIA MANUFACTURED HOUSING APPRAISAL GUIDE </td>
<td style="text-align:center;"> .048 to 0.61 </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 1st year-90% of cost 90% of
assessed value thereafter </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> 1st year-90% of cost 90% of
assessed value thereafter;
minimum 750 </td>
<td style="text-align:center;"> 4.28 </td>
<td style="text-align:center;"> Current year's Wingate Manufactured Home appraisal guide; minimum assessment for all years is 1500 </td>
<td style="text-align:center;"> 0.854 </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1st year 40%
2nd year 40%
3rd year 36%
4th year 32%
5th year 28%
6th year 24%
7th year 20%
8th year 20%
9th year 20%
10th year 20%
11th year 20%
12th year 20%
13th year 20%
14th year 20%
15th year 20%
16th year 20%
17th year 20%
18th yea </td>
<td style="text-align:center;"> 2.98 </td>
<td style="text-align:center;"> based on 2019 reassesment rates & condition </td>
<td style="text-align:center;"> 0.73 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 60.0%
2 45.0%
3 37.5%
4 33.0%
5 20.0%
6+ 80% of previous </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> Square footage Year BV </td>
<td style="text-align:center;"> 0.47 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 90% of cost or deduct 10% prior assessed value thereafter. </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> Assessment determined by size year and condition. </td>
<td style="text-align:center;"> 0.61 </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> if antique tags </td>
<td style="text-align:center;"> not taxed </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> n/a </td>
<td style="text-align:center;"> Mobile Home Guide </td>
<td style="text-align:center;"> .65 </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> assessed at 100.00 1995 & older </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> NADA-Used Trade-In value or % of OC </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> No residential mobile homes in Arlington Co. by Code. </td>
<td style="text-align:center;"> 5.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 40%
2 35%
3 30%
4 25%
5 20%
6 15%
7 10%
6 5% </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> 100% Avg Trade-In </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> 1yr:90%2:8fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b; 10% e/yr. </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> Commissioner picks up this assessment </td>
<td style="text-align:center;"> 0.48 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> If tagged with antique
tag. </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 100% trade </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> 100% Avg Market Value
Assessed during
reassessment every 4 years </td>
<td style="text-align:center;"> 0.50 (2019) </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> % of cost or size & year </td>
<td style="text-align:center;"> 2.29 </td>
<td style="text-align:center;"> Age and Square Feet - assessed in general reassessment </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> AV Loan </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> AV Loan </td>
<td style="text-align:center;"> 2.71 </td>
<td style="text-align:center;"> General reassessment </td>
<td style="text-align:center;"> 0.79 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> None </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> Used Wholesale </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.53 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1:85%2:703:604:505:406:357:258:159:10% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> Square Footage and year Model Yr </td>
<td style="text-align:center;"> 0.39 </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 1st:80; 90% thereafter </td>
<td style="text-align:center;"> 4.05 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 4.05 </td>
<td style="text-align:center;"> MANUF HSING GUIDE </td>
<td style="text-align:center;"> 0.55 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> Not taxable </td>
<td style="text-align:center;"> 1yr:29.25%
2yr:26.00%
3yr:22.75%
4yr:19.50%
5yr:16.25%
6yr:13.00% </td>
<td style="text-align:center;"> 3.85 "Nominal" </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.52 </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> Permanent plates not taxed </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% NADA Recreational
Vehicle Guide Wholesale
Trade In </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> Stonewall Technology
Go House Valuation
Program </td>
<td style="text-align:center;"> 0.83 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> 80%
70%
60%
50%
40%
30% </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 90%
(10% depreciation each year) </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.695 </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> NADA guide </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 100% Wingate Mobile Home Guide </td>
<td style="text-align:center;"> 0.72 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 80% </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> set by sq.ft. </td>
<td style="text-align:center;"> 0.53 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> Current (new) 90%
1 70%
2 60%
3 50%
4 40%
5 30%
6 20%
7+ 10%
Minimum assessment
Model Year 1997-& Newer = 200.00
Model Year 1996 and prior = 100.00 </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> New 90% 1yr. 70% 2yr. 50% 3yr. 40%; 4yr.30% 5yr. 20%; 6+ yr. 10%
Minimum assessment=100 </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> Wingate Guide
Assessments based on price per square foot as determined in the Wingate Mobile Home Appraisal Guide. </td>
<td style="text-align:center;"> 0.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> OldCarsPriceGuide max 5000 w/ street tags only. Antique plates not taxed </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 4.496 </td>
<td style="text-align:center;"> Wingate Mobile Home Guide </td>
<td style="text-align:center;"> 0.63 </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Wampler-Eanes </td>
<td style="text-align:center;"> 0.59 </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> 200 flat rate </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 100% of used wholesale from NADA </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> square footage x depreciation factor </td>
<td style="text-align:center;"> 0.62 </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> none </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> none </td>
<td style="text-align:center;"> VA Manufactured Housing Appraisal Guide
by Wingate Appraisal Service </td>
<td style="text-align:center;"> 0.78 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> vehicle over 15 Yrs assessed at 100 value </td>
<td style="text-align:center;"> 1.85 </td>
<td style="text-align:center;"> 20% Depreciation of
cost </td>
<td style="text-align:center;"> 1.85 </td>
<td style="text-align:center;"> Square Footage and Yearly Depreciation </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.75 </td>
<td style="text-align:center;"> Square Footage times Rate </td>
<td style="text-align:center;"> 0.79 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 50% FMV </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 0.88 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.01 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.57 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 225.00 minimum value </td>
<td style="text-align:center;"> 4.65 </td>
<td style="text-align:center;"> 1st:7060504030207+yrs:10 </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Assessed at each county gen'l reassessment </td>
<td style="text-align:center;"> 0.994 </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 1st:70 less 10% prior assessed value thereafter not lower than 20%. </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> Wingate Mobile Home Guide </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Blue book-avg. 100% </td>
<td style="text-align:center;"> 4.35 </td>
<td style="text-align:center;"> 100% Wingate M/H Book </td>
<td style="text-align:center;"> 0.925 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> EXEMPT BY CODE </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> ATV AND DIRT BIKES EXEMPTED BY LOCAL ORDINANCE </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Square Footage X rate per sq.ft. established by Virginia Manufactured Housing Appraisal Guide
in effect at the latest reassessment </td>
<td style="text-align:center;"> 0.61 </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> NADA/CPI if limited mileage tag -0- </td>
<td style="text-align:center;"> 4.86 </td>
<td style="text-align:center;"> NADA recreational Guide </td>
<td style="text-align:center;"> 4.86 </td>
<td style="text-align:center;"> /sq ft. during
Reassessment </td>
<td style="text-align:center;"> 0.585 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 400 Flat Value </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> 45% </td>
<td style="text-align:center;"> 2.02 </td>
<td style="text-align:center;"> Wingate Book </td>
<td style="text-align:center;"> 0.67 </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> 35% of OC </td>
<td style="text-align:center;"> 2.95 </td>
<td style="text-align:center;"> Square Foot Method </td>
<td style="text-align:center;"> 0.695 </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> exempt if antique plates </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> 1yr-60%
2-45%
3- 37.5%
4-30%
5+yr-20% </td>
<td style="text-align:center;"> 3.95 </td>
<td style="text-align:center;"> Flat Rate </td>
<td style="text-align:center;"> 0.53 </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> .49 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.775 </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 300 assessed value for trucks;
100 for antique cars </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 1 75
2 70
3 65
4 60
5 55
6 50
7 45
8 40
9 37.5
10 35
11 32.5
12 30
13 27.5
14 25
15 22.5
16 20
17 17.5
18+ 15 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Wingate Appraisal Guide
Min. is 5/sq. ft. on
mobile homes
1985 and older </td>
<td style="text-align:center;"> 0.67 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 80% cost less 10% each yr to 10% </td>
<td style="text-align:center;"> 3.85 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.48 </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> NADA Classic Car Guide/percentage of cost </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> NADA Recreational Guide 100% W/S/percentage of cost </td>
<td style="text-align:center;"> 3.57 </td>
<td style="text-align:center;"> 90% </td>
<td style="text-align:center;"> 0.81 </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Year 1:85
Year 2:75
Year 3:60
Year 4:50
Year 5:40
Year 6:30
Year 7+:20 </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Year 1:85
Year 2:75
Year 3:60
Year 4:50
Year 5:40
Year 6:30
Year 7+:20 </td>
<td style="text-align:center;"> 0.87 </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> Do not Tax </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA USED TRADE-IN VALUE </td>
<td style="text-align:center;"> 1.55 </td>
<td style="text-align:center;"> WINGATE APPRAISAL GUIDE </td>
<td style="text-align:center;"> 0.555 </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 40% first year with 5%
deprection until minimum
value of 400 </td>
<td style="text-align:center;"> 2.50 </td>
<td style="text-align:center;"> Mobile Home Guide & Depreciation </td>
<td style="text-align:center;"> .42 </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 25% LV/Book </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.85 </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 50% book value </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.84 </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 3.94 </td>
<td style="text-align:center;"> Used Wholesale </td>
<td style="text-align:center;"> 3.94 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.53 </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> Assessed at minimum value
of 200.00 </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> If value not available in
pricing guide:
Year Purchased Percent of Value
2017 50%
2016 45%
2015 40%
2014 35%
2013 30%
2012 25%
2011 20%
2010 15%
2009 and older 10% </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Blue Ridge Mass
Appraisal Co. LLC </td>
<td style="text-align:center;"> 00.70/per
100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> Do not tax </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> NADA Guide </td>
<td style="text-align:center;"> 3.65 </td>
<td style="text-align:center;"> 20-24 /sq ft -no longer pers. prop. </td>
<td style="text-align:center;"> .88 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 2.04 </td>
<td style="text-align:center;"> Square Footage and Year </td>
<td style="text-align:center;"> 0.63 </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 0.6187 </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> vehicles 25 years & older assessed at 100 </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1yr:70%
2yr:60%
3yr:50%
4yr:40%
5yr:30%
6yr.20% </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> Wingate Appraisal Book fair market square footage
2018 1.1085
2017 1.125
2016 1.145
2015 1.135 </td>
<td style="text-align:center;"> 1.085 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> 100% NADA - WS </td>
<td style="text-align:center;"> 2.43 </td>
<td style="text-align:center;"> FMV 100% </td>
<td style="text-align:center;"> 0.72 </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 100% clean trade-in </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 100% trade-in </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 0.38 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100 </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.68 </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 5.00 one time registration
fee for as long as vehicle
is vested in the applicant. </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% NADA </td>
<td style="text-align:center;"> 2.14 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 0.575 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> 1 80
2 70
3 60
4 50
5 40
6 30
7 25
8+ 15 </td>
<td style="text-align:center;"> 3.36 </td>
<td style="text-align:center;"> Square Foot Factor from Wingate Guide </td>
<td style="text-align:center;"> .42 </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> tax exempt if using antique tags </td>
<td style="text-align:center;"> tax exempt </td>
<td style="text-align:center;"> 35% of RV </td>
<td style="text-align:center;"> 1.75 </td>
<td style="text-align:center;"> 100% of RV </td>
<td style="text-align:center;"> .62 </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NA </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 2.55 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.89 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> BV </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> reassessment </td>
<td style="text-align:center;"> .72 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 50% Low Value NADA
Collector/Special Interest
Guide
Unless vehicle has antique plates </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> 75% NADA Recreational
Vehicle Guide </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> Approximately 100% - Based on Sq. Footage </td>
<td style="text-align:center;"> 0.82 </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 50% of cost shown in Vintage nada book
Vehicles with antique plates are tax exempt </td>
<td style="text-align:center;"> 3.90 </td>
<td style="text-align:center;"> NADA Recreational Guide </td>
<td style="text-align:center;"> 3.90 </td>
<td style="text-align:center;"> General reassessment guidelines </td>
<td style="text-align:center;"> .83 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> tax exempt </td>
<td style="text-align:center;"> 40% </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.56 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> no tax on antique vehicles </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 80% 70% 55% 40% 25% 10% min </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Virginia Manufactured Housing Appraisal Guide </td>
<td style="text-align:center;"> 0.48 </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> 0-exemption </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% RV </td>
<td style="text-align:center;"> 2.62 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.804 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1st:72 10% deduction of previous balance/year </td>
<td style="text-align:center;"> 4.59 </td>
<td style="text-align:center;"> CAMRA </td>
<td style="text-align:center;"> 0.73 </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> assessed value </td>
<td style="text-align:center;"> .545 </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> Flat Valued </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> Percentage of Cost
1 30.0%
2 27.5%
3 25.0%
4 23.5%
5 20.0%
6 17.5%
7 15.0%
8 13.5%
9 10.0%
10 7.5%
11+ 5.0% </td>
<td style="text-align:center;"> 9.00 </td>
<td style="text-align:center;"> General Reassessment based on year model condition and square feet </td>
<td style="text-align:center;"> .62 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> TAX EXEMPT </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> .88 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince Edward County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> NADA/LV </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> VA Mobile Home Appraisal Guide </td>
<td style="text-align:center;"> 0.51 </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 60% 1st yr
50%
40%
30%
20% </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.86 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> EXEMPT </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> .00001 </td>
<td style="text-align:center;"> Wingate Appraisal </td>
<td style="text-align:center;"> 1.1936 </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> Flat 350 if it
has regular tags. If it
has vintage tags we
exempt it. </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> NADA - avg. used </td>
<td style="text-align:center;"> 2.35 </td>
<td style="text-align:center;"> Appraised Value By reassessment </td>
<td style="text-align:center;"> 0.77 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> Not taxable </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA Book </td>
<td style="text-align:center;"> 4.25(+.20 fire tax) </td>
<td style="text-align:center;"> Appraisal Service --part of
general reassessment </td>
<td style="text-align:center;"> 0.67/.06 fire tax </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> NADA Recreation Vehicle Appraisal Guide </td>
<td style="text-align:center;"> 3.75 </td>
<td style="text-align:center;"> assessed at reassessment or new construction </td>
<td style="text-align:center;"> .70 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> ALL ASSESSED AT 100 VALUE </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 1.09 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Low Book Value </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> Recognized Pricing Guide - Various Value per Sq ft </td>
<td style="text-align:center;"> 0.73 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> 8 yr. 10% straight line </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 8 yr. 10% straight line </td>
<td style="text-align:center;"> .74 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 1st2nd:80; 34:60; 56:50; 7-10:40; 11-14:30; 15+yr:20 </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 1st2nd:80; 34:60; 56:50; 7-10:40; 11-14:30; 15+yr:20 </td>
<td style="text-align:center;"> 1.95 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.63 </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 1.40 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.80 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 1st:90
2nd:80
3rd:70
4th:60
5th:50
6th:40
7th:30
8th:20
9+yr:10 </td>
<td style="text-align:center;"> 3.90 </td>
<td style="text-align:center;"> Square Foot </td>
<td style="text-align:center;"> 0.64 </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> Age Percent Value
1 85%
2 75%
3 65%
4 55%
5 45%
6 35%
7 25%
8+ 15% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> Age Percent Value
1 85%
2 75%
3 65%
4 55%
5 45%
6 35%
7 25%
8+ 15% </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.74 </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> 130 per unit </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> First year is a certain percentage of cost then assessment reduced a certain percentage for each year after based on market </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Wingate Appraisal Guide or General Reassessment </td>
<td style="text-align:center;"> 0.895 </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 0.00 </td>
<td style="text-align:center;"> 1yr:50%
2:45%
3:40%
4:30%
5:20% </td>
<td style="text-align:center;"> 6.73 </td>
<td style="text-align:center;"> % of mobile home guide </td>
<td style="text-align:center;"> 0.86 </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NOT TAXED </td>
<td style="text-align:center;"> 1 40.0%
2 35.0%
3 30.0%
4 25.0%
5 20.0%
6 15.0% </td>
<td style="text-align:center;"> 5.49 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 0.99 </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> NADA Book. Not taxed if vehicle has antique tag </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> NADA Loan Value or % of cost </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Wingate Mobile Home Guide </td>
<td style="text-align:center;"> 0.71 </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> Collectible Car Book - 50% of OC </td>
<td style="text-align:center;"> 4.85 </td>
<td style="text-align:center;"> -10% from prior year each year after </td>
<td style="text-align:center;"> 4.85 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.58 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 500 VALUE </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 1 75.0%
2 65.0%
3 55.0%
4 45.0%
5 35.0%
6 25.0%
7+ 15.0% </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.58 </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> 100% NADA Wholesale </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> 100%
Reassessed every 4 yrs. </td>
<td style="text-align:center;"> 0.66 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> BV
Year:percent
1:90
2:80
3:70
4:60
5:50
6:40
7:30
6:20
7:10 </td>
<td style="text-align:center;"> 1.70 </td>
<td style="text-align:center;"> value changes every 4 years during real estate assessment cycle. </td>
<td style="text-align:center;"> 0.63 </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> .00 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> Reassessment values </td>
<td style="text-align:center;"> 0.65 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> NADA Classic Collectible & Special Interest </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> Values In House/Sq.Ft. </td>
<td style="text-align:center;"> .69 </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> No longer taxed </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.32 </td>
<td style="text-align:center;"> 2017 Reassessment-sales study </td>
<td style="text-align:center;"> .54 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> 50% of wholesale BV in
NADA Recreational Guide
Motor Homes: 500 min
value; Self Contained
Camping Trls: 300 min
value; Pop-Up Campers:
100 min value </td>
<td style="text-align:center;"> 4.00 </td>
<td style="text-align:center;"> Ratio by Square Ft
1000 Flat Value for 1995 & older MH with Width 10' or less
1500 Flat Value for 1995 & older MH with Width 11' to 12'
2000 Min Value for MH 13' or more </td>
<td style="text-align:center;"> 0.7950 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.00001 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 100.0% </td>
<td style="text-align:center;"> 2.60 </td>
<td style="text-align:center;"> 100.0% </td>
<td style="text-align:center;"> 2.60 </td>
<td style="text-align:center;"> Square Footage X Applicable Rate </td>
<td style="text-align:center;"> 1.17 </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 80.0%
2 70.0%
3 60.0%
4 50.0%
5 40.0%
6 30.0%
7 20.0%
8+ 10.0% </td>
<td style="text-align:center;"> 5.85 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 1.21 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> unless tax-exempt (meeting
criteria of usage)
min value = 600 if over 2 tons </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> 1st yr: 85% of cost less 10% in following years </td>
<td style="text-align:center;"> 4.20 </td>
<td style="text-align:center;"> Virginia Mobile Home Appraisal Guide </td>
<td style="text-align:center;"> 0.95 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 7/1/97 ordiance effective date </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> Pricing Guide </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Based on Model Yr and Square Footage taxed at real estate rate </td>
<td style="text-align:center;"> 1.04 </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 500 Flat Value </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> 1st:90% less 10% prior assessed value thereafter. </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.50/100 </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% RV NADA </td>
<td style="text-align:center;"> 3.08 </td>
<td style="text-align:center;"> Yr Model & Sq. Footage using Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.80 </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 95% of Purchase Price </td>
<td style="text-align:center;"> 3.00 (3.5 effective 01/01/2018) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 3.00 (3.5 effective 01/01/2018) </td>
<td style="text-align:center;"> same as real </td>
<td style="text-align:center;"> 0.73 (effective 01/01/2018 80 cents) </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> Minimum assessment </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> 30% OC </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Assessed as - personal property </td>
<td style="text-align:center;"> 0.87 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 4.13 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> Exempt Personal Property Tax w DMV antique plates; no charge for the decal </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> NADA or percent of cost paid </td>
<td style="text-align:center;"> 4.84 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 100 flat rate </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> Depreciated 10% each yr. 80% 1st yr. OC </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 yr.90%2 /80%3/70%4/60% 5/45 % 6/30% 7+/20% </td>
<td style="text-align:center;"> 3.40 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.77 </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1st: 90
2nd: 80
3rd: 70
4th: 60
5th: 50
6th: 40
7+yr:30 </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.57 </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Exempt </td>
<td style="text-align:center;"> NADA recreational appraisal
guide; motor homes min
value 1000 & trailers
minimum value 400 </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 1.24 </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> No Value </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> NADA RV Guide </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.86 </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> finance value Price Digest </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Square Footage
Wingate Appraisal Guide </td>
<td style="text-align:center;"> 1.11 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% NADA used trade-in value </td>
<td style="text-align:center;"> 4.25 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 1.035 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1:902:703:604:505:406:307:208:109+:90% of prev. yr. </td>
<td style="text-align:center;"> 3.80 </td>
<td style="text-align:center;"> Sq footage x factor from depr. Table </td>
<td style="text-align:center;"> 1.11 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 3.60 </td>
<td style="text-align:center;"> Virginia Mobile Home Appraising Guide </td>
<td style="text-align:center;"> 1.283 </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 200 flat fee </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> NADA recreational
vehicle guide or % of cost </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> NADA LV or %age of OC </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> NADA used trade-in </td>
<td style="text-align:center;"> 2.30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 200 minimum </td>
<td style="text-align:center;"> 4.50 </td>
<td style="text-align:center;"> 85% of original cost of the purchase year and reduced by 90% of the previous year's assessment until the taxpayers liability begins </td>
<td style="text-align:center;"> 1.00
Motor Homes </td>
<td style="text-align:center;"> Square Footage </td>
<td style="text-align:center;"> 1.22 </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> No fee if vehicle has
Antique tags. </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Low Range of Wingate
Mobile Home Guide </td>
<td style="text-align:center;"> 1.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 2.05 </td>
<td style="text-align:center;"> 85% 1st yr
10% each yr thereafter
until 30% of value is reached </td>
<td style="text-align:center;"> 2.05 </td>
<td style="text-align:center;"> Square Footage based on
Year of Mobile Homes </td>
<td style="text-align:center;"> 0.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> Tax Exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% NADA Recreation
Vehicle Appraisal Guide </td>
<td style="text-align:center;"> 4.90 </td>
<td style="text-align:center;"> 100% Wingate Appraisal Guide </td>
<td style="text-align:center;"> 1.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 250.00 minimum value </td>
<td style="text-align:center;"> 4.15 </td>
<td style="text-align:center;"> 100% BV effective 1/1/96 </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> 100% Assessed Value </td>
<td style="text-align:center;"> 1.14 </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> Low Avg. Loan Value </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Avg Cash Value Blue Book </td>
<td style="text-align:center;"> 1.30 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 2.44 </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.76 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 3.70 </td>
<td style="text-align:center;"> Real estate tax rate </td>
<td style="text-align:center;"> 1.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> none </td>
<td style="text-align:center;"> none </td>
<td style="text-align:center;"> Intertec-low trade in </td>
<td style="text-align:center;"> 3.45 </td>
<td style="text-align:center;"> Wingate Appr.Bk sq ft factor </td>
<td style="text-align:center;"> 1.22 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1 90.0%
2 80.0%
3 70.0%
4 60.0%
5 50.0%
6 40.0%
7 30.0%
8 25.0%
9+ Less 20% of last years assessment </td>
<td style="text-align:center;"> 3.25 </td>
<td style="text-align:center;"> Wingate Appraisal Book </td>
<td style="text-align:center;"> 1.18 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> Not taxed (exempt Household) </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> N.A.D.A. or 7 year stright line w/10% of cost min </td>
<td style="text-align:center;"> 2.90 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> .90 </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> exempt </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 1.07 </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> NA </td>
<td style="text-align:center;"> NADA Rec. Veh. Guide </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> Square footage </td>
<td style="text-align:center;"> 1.0025 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> now tax exempt per state code </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1st:40303+yr:20 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> Sq. Footage x per sq.ft. per Wingate M.H. Guide </td>
<td style="text-align:center;"> 0.90 </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> No cost if vehicle has
antique plates. </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> LV </td>
<td style="text-align:center;"> 3.50 </td>
<td style="text-align:center;"> Taxed as Real Estate.
No Mobile Homes in City. </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 4.80 </td>
<td style="text-align:center;"> NADA Trade In </td>
<td style="text-align:center;"> 4.80 </td>
<td style="text-align:center;"> 100% assessed valuation </td>
<td style="text-align:center;"> .93 </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> BV </td>
<td style="text-align:center;"> 0.76 </td>
<td style="text-align:center;"> 100% OC; depreciates 10% per yr </td>
<td style="text-align:center;"> 0.28 </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Not Taxed </td>
<td style="text-align:center;"> See Campbell County </td>
<td style="text-align:center;"> 2.00 per 100 of assessed value </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.08 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.036 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.35 </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> 700/ vehicle </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> 100 FMV </td>
<td style="text-align:center;"> 0.55 </td>
<td style="text-align:center;"> Factured depreciation annually 100% FMV </td>
<td style="text-align:center;"> 0.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> NADA Antique Car Guide </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.77 </td>
<td style="text-align:center;"> Mobile Home Blue Book </td>
<td style="text-align:center;"> 0.07 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> NADA Guide </td>
<td style="text-align:center;"> 1.06 </td>
<td style="text-align:center;"> 100% BV </td>
<td style="text-align:center;"> 1.06 </td>
<td style="text-align:center;"> 100% Book </td>
<td style="text-align:center;"> 0.32 </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.44 </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> Done by Nottoway County </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> Done by Nottoway County </td>
<td style="text-align:center;"> 0.85 </td>
<td style="text-align:center;"> OC </td>
<td style="text-align:center;"> 0.22 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.1875 </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> Figured by Rockingham Co. </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> Figured by Rockingham Co. </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> Figured by Rockingham Co. </td>
<td style="text-align:center;"> 0.75 </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.17 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.32 </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .09 </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 15% </td>
<td style="text-align:center;"> 0.34 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Pitts. Co. Commissioner of Revenue </td>
<td style="text-align:center;"> .22 </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.20 (5.00 minimum) </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.20 (5.00 minimum) </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 0.30 (5.00 minimum) </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> na </td>
<td style="text-align:center;"> NADA </td>
<td style="text-align:center;"> 0.45 </td>
<td style="text-align:center;"> fmv </td>
<td style="text-align:center;"> 0.16 </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 1.65 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> .28 </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> >15 yrs. Assessed @ 100 value </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> 100.00 of assessed value </td>
<td style="text-align:center;"> 0.11 </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> per com. Of rev. </td>
<td style="text-align:center;"> 1.14 </td>
<td style="text-align:center;"> per com. Of rev. </td>
<td style="text-align:center;"> 1.14 </td>
<td style="text-align:center;"> if permanent foundation </td>
<td style="text-align:center;"> 0.19 </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 200 flat rate </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 100% used wholesale
per NADA- minimum 200 </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> cost with depreciation
factor </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.0465 </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> Ask County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Done by Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Done by Charlotte County </td>
<td style="text-align:center;"> 0.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Length & width & year x rate per ft. </td>
<td style="text-align:center;"> 0.19 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> $0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.08 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.08 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.19 </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.11 </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .99 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .99 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .095 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> Done by Pittsylvania County </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> Done by Pittsylvania County </td>
<td style="text-align:center;"> 2.25 </td>
<td style="text-align:center;"> Done by Pittsylvania County </td>
<td style="text-align:center;"> 0.21 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> County of Loudoun </td>
<td style="text-align:center;"> 0.25 </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> same as prince william co. </td>
<td style="text-align:center;"> 0.60 </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 100% Appraisal value </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 100% Appraisal value </td>
<td style="text-align:center;"> 0.40 </td>
<td style="text-align:center;"> 100% Appraisal value by size & year </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 80
70
60
50
40
30 </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> 90% 10% per year Deprec. Thereafter </td>
<td style="text-align:center;"> 0.72 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.22 </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.148 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Current value </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> 100% of current assessment </td>
<td style="text-align:center;"> 0.16 </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> Done by counties </td>
<td style="text-align:center;"> 0.16; .40 </td>
<td style="text-align:center;"> Done by Counties </td>
<td style="text-align:center;"> Lan Co 0.16; North Co 0.40 </td>
<td style="text-align:center;"> Done by the counties </td>
<td style="text-align:center;"> Lan Co 0.10; North Co 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> Done by Mecklenburg County </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> Done by Mecklenburg County </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> Done by Mecklenburg County </td>
<td style="text-align:center;"> 0.31 </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.80 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.20 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.195 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Done by Louisa County </td>
<td style="text-align:center;"> 0.21 </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> (Page Co. Assessments) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.29 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.83 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Same as Real Estate </td>
<td style="text-align:center;"> 0.175 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> 0.32 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.05 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> Done by Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Done by Franklin County </td>
<td style="text-align:center;"> 0.51 </td>
<td style="text-align:center;"> Done by Franklin County </td>
<td style="text-align:center;"> 0.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> FMV </td>
<td style="text-align:center;"> 1.15 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.20/100 </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> NADA 100% Low Book Value </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> NADA 100% Low Book Value </td>
<td style="text-align:center;"> .31 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> FLAT FEE 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> AV </td>
<td style="text-align:center;"> 0.16 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.21 </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 1.50 </td>
<td style="text-align:center;"> done by county </td>
<td style="text-align:center;"> 0.34 </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.75 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.11 </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> we get assessment values from the county </td>
<td style="text-align:center;"> .6 </td>
<td style="text-align:center;"> From Sussex County </td>
<td style="text-align:center;"> 0.06 </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> All assessing is done by
Shenandoah County </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 1.25 </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> LV </td>
<td style="text-align:center;"> 0.30 </td>
<td style="text-align:center;"> assessed value </td>
<td style="text-align:center;"> .30 </td>
<td style="text-align:center;"> Real Estate </td>
<td style="text-align:center;"> 0.115 </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.65 </td>
<td style="text-align:center;"> Assessed Value </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> square foot </td>
<td style="text-align:center;"> 0.14 </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> See Roanoke county </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> See Roanoke County </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> See Roanoke County </td>
<td style="text-align:center;"> 0.03 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> 100% FMV </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> comes from Halifax Co. </td>
<td style="text-align:center;"> .10 </td>
<td style="text-align:center;"> comes from Halifax Co. </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% of assessed value </td>
<td style="text-align:center;"> 0.093 </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 1 70%
2 60%
3 50%
4 40%
5 30%
6 20% </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> 0.60 </td>
<td style="text-align:center;"> 100% </td>
<td style="text-align:center;"> .13 </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.10 </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .63 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> Wingate Appraisal Guide </td>
<td style="text-align:center;"> .2988 </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> Shenandoah Co. </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> Shenandoah Co. </td>
<td style="text-align:center;"> 0.90 </td>
<td style="text-align:center;"> Shenandoah Co. </td>
<td style="text-align:center;"> 0.15 </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> see Wythe County </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> see Wythe County </td>
<td style="text-align:center;"> 0.28 </td>
<td style="text-align:center;"> see Wythe County </td>
<td style="text-align:center;"> 0.16 </td>
</tr>
</tbody>
</table>
```r
# Table 9.2 Tangible Personal Property Tax Relief for Elderly and Disabled, 2019
# Table 9.3 Tangible Personal Property Tax for Automobiles and Trucks of Less than Two Tons, 2019
# Table 9.4 Personal Property Tax Relief Act for Motor Vehicles State Credit for $20,000 Vehicle, 2018 and 2019
# Table 9.5 Localities That Report Having a Personal Property Tax Reduction for High Mileage Vehicles, 2018 or 2019
# Table 9.6 Assessment Component Changes in Cities and Counties from 1997, When PPTRA Went into Effect, to 2019
# Table 9.7 Tangible Personal Property Tax Rates for Large Trucks Two Tons and Over, 2019
# Table 9.8 Tangible Personal Property Taxes Related to Business Use for Heavy Tools and Machinery, Computer Hardware, and Generating Equipment, 2019
# Table 9.9 Tangible Personal Property Taxes Related to Business Use for Research and Development, Furniture and Fixtures, and Biotechnology Equipment, 2019
# Table 9.10 Tangible Personal Property Taxes for Computer Hardware in Data Centers, Livestock, and Farm Equipment, 2019
# Table 9.11 Tangible Personal Property Taxes for Boats and Aircraft, 2019
# Table 9.12 Tangible Personal Property Taxes for Antique Motor Vehicles, Recreational Vehicles, and Mobile Homes, 2019
# Table 9.13 Tangible Personal Property Taxes Related to Horse Trailers, Special Fuel Vehicles, and Electric Vehicles, 2019
```
[^09-1]: This history of the PPTRA and the subsequent discussion of its impact on the state since it was instituted is based on “What Will Become of the Car Tax?” by <NAME> in *Virginia Issues and Answers*. (Winter 2006), Vol. 13, No. 1, pp. 27-31. http://www.via.vt.edu/winter06/index.html
[^09-2]: http://www.tax.virginia.gov/content/local-tax-rates
[^09-3]: See “What Will Become of the Car Tax?” by <NAME> in *Virginia Issues and Answers*. (Winter 2006), Vol. 13, No. 1, pp. 27-31.
http://www.via.vt.edu/winter06/index.html
<file_sep>/_book/11-Utility-License-Tax.md
# Utility License Tax {#sec:utility-license-tax}
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the utility license tax accounted for 0.1 percent of the total tax revenue for cities, 0.1 percent for counties, and 0.6 percent for large towns. These percentages are based on the franchise license tax reported in [Appendix C](#secAppendixC). The franchise license tax includes not only the license fees of electric and water utilities, which are discussed in this section, but also cable television utilities, discussed in Section \@ref(sec:cable-tv). These are averages; the relative importance of this tax in individual cities, counties, and towns varies significantly. For information on individual localities, see [Appendix C](#secAppendixC).
Localities in Virginia may impose a local license tax on certain types of public service corporations. As authorized by § 58.1-3731 of the *Code*, localities may levy a license tax on telephone and water companies not to exceed one-half of 1 percent of the gross receipts of such company accruing from sales to the ultimate consumer in the locality. For telephone companies, long-distance calls are not taxable under this provision. County utility license taxes do not apply within the limits of an incorporated town if the town also imposes the tax.
Prior to 2006, any locality that had in effect before January 1, 1972 a tax rate exceeding the statutory ceiling could continue to tax at the previous level but could not raise the rate (see *Virginia, Acts of Assembly, 1972*, c. 858). This provision changed in 2006 under the Virginia Communication Sales and Use Tax when the General Assembly eliminated the business license tax in excess of 0.5 percent.
```r
#In the latest survey `r utility_license_summary_tbl$Total[1]` localities responded that they had a utility license tax on telephone service and `r utility_license_summary_tbl$Total[2]` had a tax on water service. The table below summarizes the numbers of positive respondents by type of service and locality.
```
Nearly all localities reported charging the maximum 0.5 percent (1/2 of 1 percent) permitted by the law. None reported charging a greater amount. A few localities reported charging less for the telephone utility tax, including the counties of Fairfax (0.24 percent), New Kent (0.42 percent) and <NAME> (0.29 percent), and the towns of Haymarket (0.1 percent), Pembroke (0.3 percent), and Urbanna (0.23 percent).
<file_sep>/_main.Rmd
---
title: "Virginia Local Tax Rates, 2019"
subtitle: "38th Annual Edition: Information for All Cities and Counties and Selected Incorporated Towns"
author: "<NAME>, Weldon Cooper Center for Public Service, University of Virginia"
date: "2021"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
description: "Information for All Cities and Counties and Selected Incorporated Towns"
---
# Overview
## Credits
These course materials were generated using the **bookdown** package [@R-bookdown], which was built on top of R Markdown and **knitr** [@xie2015].
<!--chapter:end:index.Rmd-->
# Introduction
Placeholder
## Foreward
## Organization of the Book
## About the Survey
## Some Components of Local Taxes
## Partnership with LexisNexis
## Study Personnel
## Final Comments
<!--chapter:end:va-local-tax-rates-introduction.Rmd-->
# Section 1
Placeholder
## Summary of Legislative Changes in Local Taxation, 2019 $^1$
### General Provisions
#### Local License Tax on Mobile Food Units
#### Local Gas Road Improvement Tax; Extension of Sunset Provision
#### Private Collectors Authorized for Use by Localities to Collect Delinquent Debts
### Real Property Tax
#### Real Property Tax Exemptions for Elderly and Disabled: Computation of Income Limitation
#### Real Property Tax Exemption for Elderly and Disabled: Improvements to a Dwelling
#### Real Property Tax: Partial Exemption from Real Property Taxes for Flood Mitigation Efforts
#### Real Property Tax: Exemption for Certain Surviving Spouses
#### Land Preservation; Special Assessment, Optional Limit on Annual Increase in Assessed Value
#### Virginia Regional Industrial Act: Revenue Sharing; Composite Index
#### Real Estate with Delinquent Taxes or Liens: Appointment of Special Commissioner; Increase Required Value
#### Real Estate with Delinquent Taxes or Liens; Appointment of Special Commissioner in the City of Martinsville
### Personal Property Tax
#### Constitutional Amendment: Personal Property Tax Exemption for Motor Vehicle of a Disabled Veteran
#### Personal Property Tax Exemption for Agricultural Vehicles
#### Intangible Personal Property Tax: Classifi cation of Certain Business Property
<!--chapter:end:va-local-tax-rates-Section-1.Rmd-->
# Section 15
Placeholder
## Motor Vehicle Local License Tax, 2019
<!--chapter:end:va-local-tax-rates-Section-15.Rmd-->
# Section 16
Placeholder
## Meals, Transient Occupancy, Cigarettes, Tobacco, and Admissions Excise Taxes, 2019
### MEALS TAX
### TRANSIENT OCCUPANCY TAX
### CIGARETTE AND TOBACCO TAXES
### ADMISSIONS TAX
<!--chapter:end:va-local-tax-rates-Section-16.Rmd-->
# Section 17
Placeholder
## Taxes on Natural Resources, 2019
### TAXATION OF MINERAL LANDS
### SEVERANCE TAX
### COAL AND GAS ROAD IMPROVEMENT TAX
<!--chapter:end:va-local-tax-rates-Section-17.Rmd-->
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Section 18
## Legal Document Taxes, 2019
| In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, taxes on legal documents accounted for 0.5 percent of total tax revenue for cities and 0.8 percent for counties. Towns do not have this tax. These are averages; the relative importance of taxes in individual localities may vary significantly. For information on individual localities, see Appendix C.
|
| Section 58.1-3800 of the Code of Virginia authorizes the governing body of any city or county to impose a recordation tax in an amount equal to one-third of the state recordation tax. The recordation tax generally applies to real and personal property in connection with deeds of trust, mortgages, and leases, and to contracts involving the sale of rolling stock or equipment (§§ 58.1-807 and 58.1-808).
|
| Local governments are not permitted to impose a levy when the state recordation tax imposed is 50 cents or more (§ 58.1-3800). Consequently, local governments cannot levy a tax on such documents as certain corporate charter amendments (§ 58.1-801), deeds of release (§ 58.1-805), or deeds of partition (§ 58.1-806) as the state tax imposed is already 50 cents per $100.
|
| Sections 58.1-809 and 58.1-810 also specifically exempt certain types of deed modifications from being taxed. Deeds of confirmation or correction, deeds to which the only parties are husband and wife, and modifications or supplements to the original deeds are not taxed. Finally, § 58.1-811 lists a number of exemptions to the recordation tax.
|
| Currently, the state recordation tax on the first \$10 million of value is 25 cents per \$100, so cities and counties can impose a maximum tax of 8.3 cents per \$100 on the first \$10 million, one-third of the 25 cent state rate. Above $10 million there is a declining scale of charges applicable (§ 58.1-3803).
|
| In addition to a tax on real and personal property, §§ 58.1-3805 and 58.1-1718 authorize cities and counties to impose a tax on the probate of every will or grant of administration equal to one-third of the state tax on such probate or grant of administration. Currently, the state tax on wills and grants of administration is 10 cents per \$100 or a fraction of \$100 for estates valued at greater than $15,000 (§ 58.1-1712). Therefore, the maximum local rate is 3.3 cents.
|
| A related *state* tax is levied in localities associated with the Northern Virginia Transportation Authority. The tax is a grantor’s fee of \$0.15 per $100 on the value of real property property sold. This was created as part of the 2013 transportation bill.
|
| **Table 18.1** provides information on the recordation tax and the wills and administration tax for the 35 cities and 89 counties that report imposing one or both of them. The following text table shows range of recordation taxes and taxes on wills and administration imposed by localities.
```{r}
#Text table "Recordation Tax and Tax on Wills and Administration, 2019" goes here
#Table 18.1 "Legal Document Taxes, 2019" goes here
```
<!--chapter:end:va-local-tax-rates-Section-18.Rmd-->
# Section 19
Placeholder
## Miscellaneous Taxes, 2018
### LOCAL OPTION AND STATE SALES AND USE TAXES
### STATE MOTOR FUELS TAX ON DISTRIBUTORS
### BANK FRANCHISE TAX
### COMMUNICATIONS SALES AND USE TAX
### SHORT-TERM DAILY RENTAL TAX
<!--chapter:end:va-local-tax-rates-Section-19.Rmd-->
<!--chapter:end:va-local-tax-rates-Section-2.Rmd-->
# Section 20
Placeholder
## Refuse and Recycling Collection Fees, 2019
### REFUSE COLLECTION
### RECYCLING PROGRAMS
<!--chapter:end:va-local-tax-rates-Section-20.Rmd-->
# Section 21
Placeholder
## Residential Water and Sewer Connection and Usage Fees, 2019
### CONNECTION FEES
### USAGE FEES
<!--chapter:end:va-local-tax-rates-Section-21.Rmd-->
# Section 22
Placeholder
## Impact Fees for Roads, 2019
<!--chapter:end:va-local-tax-rates-Section-22.Rmd-->
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(knitr)
```
# Section 23
## Public Rights-of-Way Use Fees, 2019
The Code of Virginia § 56-468.1 authorizes certain localities to charge rights-of-way use fees for the use of publicly owned roads and property by certified telecommunication firms. Cities and towns whose public streets are not maintained by the Virginia Department of Transportation (VDOT), as well as any county that has chosen to withdraw from the secondary system of state highways (currently only Arlington and Henrico counties), may impose a public rights-of-way use fee by local ordinance. This fee is in exchange for the use of the locality’s lands for electric poles or electric conduits by certified providers of telecommunications services.
The provider collects the use fee on a per access line basis by adding the fee to each end-user’s monthly bill for local exchange telephone service (§ 56-468-1.G). The fee must be stated separately on the phone bill.
The fee is calculated each year by VDOT based on information about the number of access lines and footage of new installation that have occurred in the reporting localities. Based on this information, VDOT uses a formula to calculate the monthly fee per access line for participating localities. Starting July 1, 2019, the fee was $1.20 per access line. Information about the rights-of-way use fee can be obtained from VDOT at: http://www.virginiadot.org/business/row-usefee.asp. The Code(§ 56-468.1.I) also permits any locality which had a franchise agreement or ordinance prior to July 1, 1998 to “grandfather” in the prior agreement provided that the county, city, or town does not discriminate among telecommunications providers and does not adopt any additional rights-of-way practices that do not comply with current laws.
***Table 23.1*** lists the localities that report having a rights-of-way agreement or a prior agreement that has been grand-fathered. The information is based on the Cooper Center’s 2019 survey. The text table below summarizes the results:
```{r}
#Text table "Public Rights-of-Way Use Fees, 2019" goes here
#Table 23.1 "Localities Imposing Public Rights-of-Way Use Fees, 2019*" goes here
```
-----------------------------------------------------------------------------------------------------------
* In years prior to 2009 this table was based on information provided by the Virginia Department of Transportation. The current table uses data based on responses to the Cooper Center’s survey. To compare survey responses with VDOT information, refer to http://virginiadot.org/business/row-usefee.asp
<!--chapter:end:va-local-tax-rates-Section-23.Rmd-->
# Section 24
Placeholder
## Cash Proffers, FY 2018
<!--chapter:end:va-local-tax-rates-Section-24.Rmd-->
# Section 25
Placeholder
## Virginia Enterprise Zone Program, 2018*
### INTRODUCTION
### PURPOSE FOR THE PROGRAM
### PROGRAM GRANTS
### LOCAL INCENTIVES
##### Source: Virginia Department of Housing and Community Development, Grant Year 2018 Annual Report: Virginia Enterprise Zone Program. Provided by the DHCD to the author.
<!--chapter:end:va-local-tax-rates-Section-25.Rmd-->
# Section 26
Placeholder
## Fiscal Content Information on Local Web Sites, 2019
<!--chapter:end:va-local-tax-rates-Section-26.Rmd-->
## Real Property Tax Relief Plans and Housing Grants for the Elderly and Disabled, 2019
<!--chapter:end:va-local-tax-rates-Section-3.Rmd-->
<file_sep>/14-Business-Professional-Occupational.Rmd
# Business, Professional, and Occupational License Tax
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, business license taxes, of which the business, professional, and occupational license tax (commonly referred to as the BPOL tax) makes up the largest part, accounted for 6.0 percent of tax revenue for cities, 3.4 percent for counties, and 11.9 percent for large towns. These are averages; the relative importance of the tax varies for individual cities, counties and towns. In fact, only slightly over half of the counties employ the tax. Others use the merchants’ capital tax instead. Four counties (Amherst, Hanover, Louisa, and Southampton) reported using both taxes, maintaining the merchants’ capital tax for retailers and the BPOL tax for other types of businesses. For information on individual localities, see Appendix C.
Localities are authorized to impose a local license tax on businesses, professions, and occupations operating within their jurisdictions unless they already levy a tax on merchants’ capital.The BPOL tax is sanctioned by §§ 58.1-3700 through 58.1-3735 of the *Code of Virginia*. The *Code* establishes the dates between March 1 and May 1 as the time by which businesses must apply for a license. County BPOL taxes do not apply within the limits of an incorporated town unless the town grants the county authority to do so (§ 58.1-3711). Localities may charge a fee to each business for the issuance of a license. Each business classification such as retail or contracting, has a specific tax rate which cannot exceed maximums set by the state guidelines. Businesses pay the tax rate for the amount of gross receipts within each classification.
Although revised guidelines in January 1997 made administration of the BPOL tax more uniform in terms of due dates, penalties, interest, appeals, and definitions of situs, localities retained some flexibility. In 2000, the 1997 guidelines were updated. They are viewable on the internet site, http://townhall.virginia.gov/L/GetFile.cfm?File=C:\TownHall\docroot\GuidanceDocs\161\GDoc_TAX_2537_v1.pdf.
In 2011 the General Assembly passed a law allowing localities the option of imposing the tax on either gross receipts or the Virginia taxable income of the business. This option did not apply to certain public service corporations required to pay the 1/2 of 1 percent utility tax, which is considered a form of BPOL (see Section 11). The legislature also permitted relief from the BPOL tax, allowing localities to exempt new business from the tax for up to two years and second. allowing localities to exempt unprofitable businesses from the tax.
Localities may still determine how many separate licenses they issue to a business and whether to charge a fee for each business location or only one fee for a business with multiple locations. Some localities charge no fee or charge different fees depending on a firm’s gross receipts. Some localities charge a minimum tax instead of a fee. For example, if a locality had a minimum license tax of \$30 then businesses with gross receipts below the threshold would pay $30 instead of a smaller amount based on gross receipts. In addition, there are some localities that impose *both* a license fee and a tax rate on businesses with gross receipts above the threshold.
The BPOL tax is collected by all cities and 51 of the 95 counties. The tax is also widely used by incorporated towns; 105 towns reported using the BPOL tax. The specific localities that impose the tax are listed in **Table 14.1** along with information regarding due dates, license fees, and thresholds.
For most localities, the filing and payment dates are March 1st, though there is quite a bit of variance from that date. Of the cities, 18 reported requiring a license fee, either by business or by location. Twenty-eight counties and 57 towns also reported requiring license fees of some sort. Finally, 20 cities, 33 counties, and 17 towns reported having a tax threshold requirement based on gross receipts.
**Table 14.2** lists the fees, minimum tax, and an explanation of the fee structures provided by the localities in the survey. Thirty-two cities reported having either a fee or a minimum tax, as did 41 counties and 98 towns.
**Table 14.3** shows specific tax rates by business classification for each locality. All 38 cities, 45 counties, and 98 towns reported having a tax on at least one business classification. An overview of the general practices of Virginia localities is shown in the text table below. Combining data from tables 14.2 and 14.3, it lists the median license fee and median gross receipts tax rate for cities, counties, and towns. If a locality reported different fees due to differences in total gross receipts, the median figures were calculated using the highest fee amount given because that provides an estimate of the greatest impact on the payer.
Only the localities that reported a fee or a tax rate in a particular category were included in the calculation of the medians in the following text table.
```{r}
# table name: BPOL License Fee and Tax Rate Per $100 in 2019
```
The median tax rates for the cities matched the maximum rates permitted by the state—\$0.16 per \$100 of gross receipts for contracting; \$0.20 for retail; \$0.36 for repair, personal, and business services; and \$0.58 for financial, real estate, and professional services. The median figures for counties and towns were less than those of the cities, indicating that counties and towns did not generally apply the maximum rates permitted by Virginia law.
The median rate of \$0.11 on wholesalers for cities was well above the state maximum of \$0.05 per \$100 of purchases. Cities are presumed to operate under grandfather clauses that allow them to impose higher rates. The median rate on wholesalers for counties and towns was \$0.05 per \$100.
The median license fee, which is generally imposed only upon businesses below the gross receipts tax threshold, was \$50 for the cities, \$40 for counties, and \$30 for towns.
One business classification not presented in Table 14.3 is that of rental property due to the small number of localities reporting it. Localities are permitted to charge a license fee, or levy a BPOL tax, on businesses renting real property. In 2019, only 24 localities reported taxing such businesses. They were the cities of Alexandria, Bristol, Fairfax, Falls Church, Fredericksburg, and Portsmouth; the counties of Albemarle, Arlington, Augusta, Fairfax, King George, Loudoun, Nelson, Pulaski, and Wythe; and the towns of Bridgewater, Chatham, Goshen, Haymarket, Narrows, Purcellville, Round Hill, Saint Paul, and Vienna.
**Table 14.4** lists taxes and fees on peddlers and itinerant merchants. All of the cities, 50 counties, and 93 towns reported some form of tax on peddlers. Annual fees charged by cities for retail peddling ranged anywhere from \$30 to \$500. Taxes on retail itinerant merchants and wholesale peddlers also ranged from \$30 to \$500, with some cities charging according to gross receipts and other cities according to gross purchases. Annual charges by counties ranged from a \$1 minimum fee to \$500, while towns charged anywhere from \$10 to \$500 per year.
```{r}
# Table 14.1 BPOL Due Dates and Other Provisions, 2019
# Table 14.2 Specific BPOL Fees and Minimum Taxes, 2019
# Table 14.3 Specific BPOL Tax Rates per $100 by Business Category, 2019
# Table 14.4 Taxes and Fees on Peddlers and Itinerant Merchants, 2019
```
```{r load code to make tables 20, message=FALSE, echo=FALSE}
source("make_table.R")
```
```{r table14-1, echo=FALSE}
#table_14_1_vars <- c("ExternalDataReference", "BPOL_date", "BPOL_payment_date", "", "BPOL_tax_threshold", "BPOL_tax_threshold_amt", "")
#table_14_1_labels <- c("Locality","Due Dates, Filing", "Due Dates, Payments", "License Fee Applied", "Gross Receipts Tax Threshold", "Threshold Amount", "Separate Gross Receipts Tax Threshold for Each License")
#table_14_1 <- make_table(table_14_1_vars)
#knitr::kable(table_14_1,
#caption = "BPOL Due Dates and Other Provisions Table, 2019",
#col.names = table_14_1_labels,
#align = "lcccccc",
#format = "html")
```
```{r table14-2, echo=FALSE}
table_14_2_vars <- c("ExternalDataReference", "BPOL_contr_fee", "BPOL_contr_min_tax", "BPOL_contr_cmt")
table_14_2_labels <- c("Locality","Fee", "Minimum Tax", "Description of Tax and Fee Classifications")
table_14_2 <- make_table(table_14_2_vars)
knitr::kable(table_14_2,
caption = "Specific BPOL Fees and Minimum Taxes Table, 2019",
col.names = table_14_2_labels,
align = "lccc",
format = "html")
```
```{r table14-3, echo=FALSE}
table_14_3_vars <- c("ExternalDataReference", "BPOL_contr_tax", "BPOL_retail_tax", "BPOL_repair_tax", "BPOL_pers_tax", "BPOL_busS_tax", "BPOL_fin_tax", "BPOL_estate_tax", "BPOL_prof_tax", "BPOL_whole_tax")
table_14_3_labels <- c("Locality","Contracting", "Retail", "Repair, Personal, & Business Svcs.[^†]", "Repair, Personal, & Business Svcs.[^†]", "Repair, Personal, & Business Svcs.[^†]", "Financial, Real Estate & Prof. Svcs.[^†]", "Financial, Real Estate & Prof. Svcs.[^†]", "Financial, Real Estate & Prof. Svcs.[^†]", "Wholesale Gross Receipts or Gross Purchases")
table_14_3 <- make_table(table_14_3_vars)
knitr::kable(table_14_3,
caption = "Specific BPOL Tax Rates per $100 by Business Category Table, 2019",
col.names = table_14_3_labels,
align = "lccccc",
format = "html")
```
```{r table14-4, echo=FALSE}
table_14_4_vars <- c("ExternalDataReference", "BPOL_peddlers", "BPOL_itinerants", "BPOL_whole_pedItin")
table_14_4_labels <- c("Locality","Annual Amount (Unless Otherwise Stated), Retail Peddlers", "Annual Amount (Unless Otherwise Stated), Retail Itinerant Merchants", "Annual Amount (Unless Otherwise Stated), Wholesale Peddlers & Itinerant Merchants")
table_14_4 <- make_table(table_14_4_vars)
knitr::kable(table_14_4,
caption = "Taxes and Fees on Peddlers and Itinerant Merchants Table, 2019",
col.names = table_14_4_labels,
align = "lccc",
format = "html")
```
```{r}
# excel column, comments for table 14.1 : BPOL_fee_cmt
```<file_sep>/_book/Appendix-B.md
# List of Respondents and Non-Respondents
```r
# List of Respondents and Non-Respondents to 2019 Tax Rates Questionnaire$^a$
```
<file_sep>/_book/13-Consumers-Utility-Tax.md
# Consumers' Utility Tax
In fiscal year 2018, the most recent year available from the Auditor of Public Accounts, the consumers’ utility tax accounted for 2.9 percent of the tax revenue collected by cities, 1.3 percent by counties and 3.6 percent by large towns. These are averages; the relative importance of the tax in individual cities, counties, and towns varies significantly. For information on individual localities, see Appendix C.
The *Code of Virginia*, § 58.1-3814, authorizes localities to impose a tax on the consumers of public utilities. (This tax should not be confused with the utility license tax, a tax levied on utility providers, which is discussed in Section 11.) Residential customers of gas, water, and electric services are not to be taxed at a rate higher than 20 percent of the first \$15 of the monthly bill. Any locality that had in effect before July 1, 1972, a tax rate exceeding the current statutory ceiling may continue to tax at the previous level. There is no statutory ceiling on the tax on commercial or industrial consumers, and localities generally levy higher rates on those entities.
Counties are restricted in their authority to levy a consumers’ utility tax within the limits of an incorporated town if the town itself also levies such a tax, provided the town maintains certain services. If localities wish to change rates for local consumer utility taxes, they must give 120 days notice to providers for such a rate change.
In 2001, the General Assembly repealed the utility license tax on providers of gas (any type used in residences, but not if sold in portable containers) and electric power and rearranged the rate structure of the consumers’ utility tax for electricity and natural gas consumption (see § 58.1-3814). The taxes are now per kilowatt hour (kwh) of electricity used by consumers and per hundred cubic feet (ccf) of gas delivered monthly to consumers. The tax schedules and services of the provider are explained in § 58.1-2901 for electricity and § 58.1-2905 for natural gas. The maximum amount of tax that can be imposed on residential consumers as a result of either conversion is limited to \$3.00 per month, except where a higher limit already existed. According to § 58.1-3816.2 churches and religious bodies may be exempted from any or all the consumer utility taxes at the discretion of the locality.
In January 2007 the Virginia communications sales and use tax was implemented and several local taxes were eliminated, including the cable television system franchise tax, the local E-911 fees on land line phone service, the business license taxes in excess of 0.5 percent gross revenues collected by several localities, the local consumer utility taxes on land line and wireless phones, and the local consumer utility tax on cable television service except where it was “grandfathered” in a few localities. These local taxes were replaced by a new *state* tax of 5 percent of the bill for the service, which is collected by the Virginia Department of Taxation and remitted to localities as non-categorical aid based on a percentage developed by the Auditor of Public Accounts from its report, *Report of State and Local Communication Service Taxes and Fees: Report on Audit for the Year Ended June 30, 2006*, and available on the web at http://www.apa.virginia.gov/APA_Reports/Reports.aspx. Refer to Section 19, “Miscellaneous Taxes,” for more on the communications sales and use tax.
**Table 13.1** shows the monthly tax on electricity for residential, commercial, and industrial users. Thirty-six cities, 86 counties, and 85 towns reported having a tax on electricity in 2019. The format of charges in terms of kilowatt hours reflects the changes made in the 2001 law though some localities still use the older tax terminology. Consequently, a locality’s rate might be described in terms of dollars per kilowatt hour (e.g., \$0.005/kwh) plus some minimum price or it might be described in the older manner (e.g., 10 percent on the first \$30 of the tax bill).
The consumers’ tax on gas is listed in **Table 13.2**. As with the tax on electricity, the tax on gas has been changed to reflect the elimination of the utility license tax on gas companies and the subsequent incorporation of that tax into the consumers’ utility tax. The usual format for the tax is now a given minimum, with a given tax per additional ccf (hundred cubic feet) of gas used by the consumer, up to a certain maximum amount charged. In 2019, 32 cities, 51 counties, and 44 towns reported imposing the tax on residential, commercial and industrial users.
Finally, **Table 13.3** lists localities with a monthly tax on water. Sixteen cities, 2 counties, and 3 towns reported having the tax. The water tax imposes a certain percentage tax on the first given dollar amount of usage, such as 10 percent on the first \$15 of usage.
The following text table summarizes the number of localities reporting these taxes.
```r
# table name: Consumers' Utility Tax in Localities, 2019
```
```r
# Table 13.1 Utility Consumers' Monthly Tax on Electricity, 2019
# Table 13.2 Utility Consumers' Monthly Tax on Gas, 2019
# Table 13.3 Utility Consumers' Monthly Tax on Water, 2019
```
<table>
<caption>(\#tab:table13-1)Utility Consumers' Monthly Tax on Electricity, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Residential </th>
<th style="text-align:center;"> Commercial </th>
<th style="text-align:center;"> Industrial </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 0.00321/kwh/month </td>
<td style="text-align:center;"> 0.00132/kwh/month </td>
<td style="text-align:center;"> 0.00342/kwh/month </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 0.0312831/kwh 1st 128 kwh not to exceed 4.00/month </td>
<td style="text-align:center;"> 0.005265 per kWh for first 56980 kWh & 0.000934 per kWh exceeding 56980 kWh </td>
<td style="text-align:center;"> 0.006161 per kWh for first 48693 kWh & 0.001636 per kWh exceeding 48693 kWh </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 15% 1st 15.00 </td>
<td style="text-align:center;"> 10% 1st 500.00 </td>
<td style="text-align:center;"> 10% 1st 500.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> 20% 1st 12.50 </td>
<td style="text-align:center;"> 20% 1st 25.00 </td>
<td style="text-align:center;"> 20% 1st 25.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 20% * minimum provider charge + .015508/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 20% * minimum provider charge + .014214/kwh; 20.00 max/month </td>
<td style="text-align:center;"> 20% * minimum provider charge + .014214/kwh; 20.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .014768/kwh; 3.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .015279/kwh; 20 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .015279/kwh; 20 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.15 + .004989/kwh </td>
<td style="text-align:center;"> 1.15 + .008022/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> .015094/kwh + 1.40/month; 3.00 max </td>
<td style="text-align:center;"> .014169/kwh + 2.29/month; 30.00 max </td>
<td style="text-align:center;"> .014169/kwh + 2.29/month; 30.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> .00038 </td>
<td style="text-align:center;"> .00024 </td>
<td style="text-align:center;"> .00018 </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> .0075/kwh; 1.50 max </td>
<td style="text-align:center;"> .00605/kwh; 25.00 max </td>
<td style="text-align:center;"> .00735/kwh; 25.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> 1.50/mo plus 0.01515 per kwh not to exceed 3.00 </td>
<td style="text-align:center;"> 1.50/mo plus 0.00945 per kwh not to exceed 30.00 </td>
<td style="text-align:center;"> 1.50/mo plus 0.00945 per kwh for first 3175 kwh delivered and 0.00012 per kwh for next 66667 kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> 1.50 + .01515/kwh; 3.00 max </td>
<td style="text-align:center;"> .75 + .01125/kwh; 3.00 max </td>
<td style="text-align:center;"> .75 + .0109/kwh; 3.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> 10% 1st 15.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> greater of .01505/kwh/mo or min tax of 1.50/mo 3.00 max </td>
<td style="text-align:center;"> greater of .03500/kwh/mo or min tax of 2.29/mo 3.00 max </td>
<td style="text-align:center;"> greater of .03000/kwh/mo or 2.29 min/mo 3.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 20% of min monthly charge + 0.01672/kwh with max tax of 3.00 </td>
<td style="text-align:center;"> 20% of min monthly charge + 0.01865/kwh with max tax of 10.00 </td>
<td style="text-align:center;"> 20% of min monthly charge + 0.01865/kwh with max tax of 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> .01140 per kwh 3.00 max./mo </td>
<td style="text-align:center;"> 0.0290 per kwh 20.00 max./month </td>
<td style="text-align:center;"> 0.01155 per kwh 50.00 max./month </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 2.50 max </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> 1.40 + .014432/kwh; 2.50 max </td>
<td style="text-align:center;"> 1st 176 kwh @ .015398 then .001326 </td>
<td style="text-align:center;"> 1st 412 kwh @ .006583 then .001568 </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 1.40 + .015062/kwh; 2.00 max </td>
<td style="text-align:center;"> 1.15 + .007023 on 1st 2684 kwh; + .000508 on 2685-195597; + .000367 on the remaining balance delivered monthly. </td>
<td style="text-align:center;"> 1.15 + .010995 on 1st 1714 kwh + .000758 on 1715-131002 kwh + .000167 on the remaining balance delivered monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 1.40 + .015/kwh; 3.00 max </td>
<td style="text-align:center;"> 2.29/month + .0140167/kwh for 1st 5300 kwh; + .00283/kwh in excess of 5300 kwh </td>
<td style="text-align:center;"> 2.29/month + .0140167/kwh for 1st 5300 kwh; + .00283/kwh in excess of 5300 kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> .01515/kwh; max 3.00/month; min. 1.50/mo. </td>
<td style="text-align:center;"> .01700/kwh; max 9.00/month; min. 1.50/mo. </td>
<td style="text-align:center;"> .01525/kwh; max 9.00/month; min. 1.50/mo. </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> .14953/kwh; 3.00 max 1.40 min. </td>
<td style="text-align:center;"> .14658/kwh; 10.00 max 2.29 min. </td>
<td style="text-align:center;"> .14658/kwh; 10.00 max 2.29 min. </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> 20% up to 3.00 </td>
<td style="text-align:center;"> 20% of charge by seller up to 37.50 </td>
<td style="text-align:center;"> 20% of charge by seller up to 75.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 20% nte 3.00 </td>
<td style="text-align:center;"> 20% nte 30.00 </td>
<td style="text-align:center;"> 20% nte 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> 1.40 + .015094/kwh; not to exceed 3.00 </td>
<td style="text-align:center;"> 1.15 + .007261/kwh; not to exceed 10.00 </td>
<td style="text-align:center;"> 1.15 + .007261/kwh; not to exceed 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 0.00605/kwh + 0.56/bill;
4.00 max/bill. </td>
<td style="text-align:center;"> 0.00707/kwh + 1.15/bill;
1000 max/bill </td>
<td style="text-align:center;"> 0.00594/kwh + 1.15/bill;
1000 max/bill. </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 20% of minimum monthly charge + .016070/kwh; 3.00 max </td>
<td style="text-align:center;"> 10% of minimum monthly charge + .007887/kwh up to 1500 kwh; + .007184 > 1500 kwh; 100 max </td>
<td style="text-align:center;"> 10% of minimum monthly charge + .007887/kwh up to 1500 kwh; + .007184 > 1500 kwh; 100 max </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 1.40 + .017138; max 3.00 </td>
<td style="text-align:center;"> 2.00 + .018088; max 3.00 </td>
<td style="text-align:center;"> 2.00 + .018088; max 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> .01525/kwh; 1.50 minimum/month; 3.00 max/month </td>
<td style="text-align:center;"> .0400/kwh; Minimum 1.50/month; Max 3.00/month </td>
<td style="text-align:center;"> .01600/kwh; minimum 1.50/month; Max 40.00/month </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> .22 + .003/kwh; max 3.00 </td>
<td style="text-align:center;"> .30 + .0024/kwh or 1st 700 kwh + .0015928 </td>
<td style="text-align:center;"> .30 + .0024/kwh or 1st 700 kwh + .0015928 </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> 1/2 of 1% of gross receipts </td>
<td style="text-align:center;"> 1/2 of 1% of gross receipts </td>
<td style="text-align:center;"> 1/2 of 1% of gross receipts </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 20% * minimum charge monthly + .015164/kwh </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .014866/kwh; 6.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .014866/kwh; 6.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> 0.0155 /kWh
min. 1.50
max. 3.00 </td>
<td style="text-align:center;"> 0.0155 /kWh
min. 1.50
max. 20.00 </td>
<td style="text-align:center;"> 0.0155 /kWh
min. 1.50
max.40.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 42.50 </td>
<td style="text-align:center;"> 20% 1st 42.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 150.00 </td>
<td style="text-align:center;"> 20% 1st 150.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 20% minimum monthly charge + .014973/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .016375/kwh up to 1082 kwh + .001070/kwh > 1082 kwh </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .016375/kwh up to 1082 kwh + .001070/kwh > 1082 kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 3.00 a month maximum </td>
<td style="text-align:center;"> 3.00 a month maximum </td>
<td style="text-align:center;"> 3.00 a month maximum </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> .70 + .007537 per kwh; 1.00 max </td>
<td style="text-align:center;"> 1.15 + .007130/kwh; 10 max </td>
<td style="text-align:center;"> 1.15 + .007603/kwh; 10 max </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 20% of minimum. Mo. charge + 0.010374 on each KWH delivered not to exceed 3.00 mo. </td>
<td style="text-align:center;"> 20% of min. mo. charge + 0.009794/KWH until tax reaches 3.00 0.003183 on each addtl KWH delivered. </td>
<td style="text-align:center;"> 20% of min. mo. Charge + 0.009794/KWH until tax 3.00 0.003183 on each addtl KWH delivered. No max. </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> 0.015/kWh. Min. of 1.00/month max. of 3.00/month </td>
<td style="text-align:center;"> 0.015/kWh. Min. of 1.00/month max. of 3.00/month </td>
<td style="text-align:center;"> 0.015/kWh. Min. of 1.00/month max. of 3.00/month </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 0.015626/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 0.014766/kwh; 200.00 max/month </td>
<td style="text-align:center;"> 0.014766/kwh; 200.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> .000380/kwh 0-2500kwh; .000240 2501-50000kwh </td>
<td style="text-align:center;"> .000380/kwh 0-2500 kwh; .000240 2501-50000 kwh; .000180/kwh for > 50000 kwh </td>
<td style="text-align:center;"> .000380/kwh 0-2500 kwh; .000240 2501-50000 kwh; .000180/kwh for > 50000 kwh </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> Min. tax 1.05
Max. tax 1.50 </td>
<td style="text-align:center;"> Min. tax 1.15
Max. tax 10.00 </td>
<td style="text-align:center;"> Min. tax 1.15
Max. tax 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> Residential customers: 0.015238 per kilowatt hour (kwh) plus a minimum tax of 1.40 per month with a maximum tax of 3.00 per month. </td>
<td style="text-align:center;"> Industrial customers: 0.007218 per kilowatt hour (kwh) plus a minimum tax of 1.15 per month with a maximum tax of 10.00 per month </td>
<td style="text-align:center;"> Commercial customers: 0.007218 per kilowatt hour (kwh) plus a minimum tax of 1.15 per month with a maximum tax of 10.00 per month </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 15% of first 15 </td>
<td style="text-align:center;"> 15% of first 15 </td>
<td style="text-align:center;"> 15% 1st 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 0.63/month + 0.006804/kwh
Max- 2.70 </td>
<td style="text-align:center;"> 0.92/month + 0.005393/kwh
Max- 72.00 </td>
<td style="text-align:center;"> 0.92/month + 0.005393/kwh
Max- 72.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> 15% of first 100 </td>
<td style="text-align:center;"> 15% of first 100 </td>
<td style="text-align:center;"> 5% of first 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 30.00 </td>
<td style="text-align:center;"> 20% 1st 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> minimum monthly + .014473/kwh; 3.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .013966/kwh; 20.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .013966/kwh; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> 3.00/month </td>
<td style="text-align:center;"> 3.00/month </td>
<td style="text-align:center;"> 3.00/month </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 5% 1st 50.00 </td>
<td style="text-align:center;"> 5% 1st 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 0.70 per month plus 0.07436/kwh not to exceed 1.50/mo. </td>
<td style="text-align:center;"> 1.15 per month plus 0.00704/kwh not to exceed 10.00/mo. </td>
<td style="text-align:center;"> 1.15 per month plus 0.00704/kwh not to exceed 10.00/mo. </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> max 3.00 </td>
<td style="text-align:center;"> max 3.00 </td>
<td style="text-align:center;"> max 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 75.00 </td>
<td style="text-align:center;"> 20% 1st 75.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> 20% on first 15 </td>
<td style="text-align:center;"> 20% on first 15 </td>
<td style="text-align:center;"> 20% on first 15 </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 20% * min monthly charge + .016231/kwh/month; 3.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .015071/kwh/month; 20 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .015071/kwh/month; 20 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 2.50 max </td>
<td style="text-align:center;"> 40.00 max </td>
<td style="text-align:center;"> 40.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1.40 minimum charge + .01509/kwh; max 3.00 </td>
<td style="text-align:center;"> 2.29 minimum charge + .013487/kwh; 100 max </td>
<td style="text-align:center;"> 2.29 minimum charge + .013487/kwh; 100 max </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> .01525 </td>
<td style="text-align:center;"> .01415 </td>
<td style="text-align:center;"> .01515 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> .015/kwh not to exceed 3.00/month per service. </td>
<td style="text-align:center;"> .015/kwh not to exceed 3.00/month per service. </td>
<td style="text-align:center;"> .015/kwh not to exceed 3.00/month per service. </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> .009 kwh
min 0.90
max 1.80 </td>
<td style="text-align:center;"> .00610 kwh
min 0.90
max 600 </td>
<td style="text-align:center;"> .00640 kwh
min 0.90
max 600 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 50.00 </td>
<td style="text-align:center;"> 20% 1st 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 10% 1st 200.00 </td>
<td style="text-align:center;"> 20% 1st 1000.00; 2% excess of 1000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 37.50 </td>
<td style="text-align:center;"> 20% 1st 75.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> 20% 1st 5.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .01525/kwh; 3.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .01460/kwh; 20.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .01260/kwh; 200 max </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> .014543/kwh + min tax of 1.40/mon; max 3.00 </td>
<td style="text-align:center;"> .015199/kwh 1st 3219 kwh; .000365 >;+ min tax 2.29;1500 max </td>
<td style="text-align:center;"> .015199/kwh 1st 3219 kwh; .000365 >;+ min tax 2.29;1500 max </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 10% of 1st. 300.00 1% thereafter </td>
<td style="text-align:center;"> 10% of 1st. 300.00 1% thereafter </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> 3.00 max; .014955/kwh </td>
<td style="text-align:center;"> 200 max; .006434/kwh </td>
<td style="text-align:center;"> 200 max; .006434/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> 10% 1st 15.00 </td>
<td style="text-align:center;"> 10% 1st 150.00 </td>
<td style="text-align:center;"> 10% 1st 150.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 0.01525 per kwh w/a minimum of 1.50 per month and a maximum of 3.00 per month </td>
<td style="text-align:center;"> 0.01500 on 1st 667 kwh & 0.00105 over 667 kwh with a minimum of 1.50 & a maximum of 90.00 per month </td>
<td style="text-align:center;"> 0.01500 on 1st 667 kwh & 0.00105 over 667 kwh with a minimum of 1.50 & a maximum of 90.00 per month </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> Minimum amount 1.40 per month plus 0.015 per KWH with max of 3.00 per month delivered monthly </td>
<td style="text-align:center;"> Minimum amount of 2.29 per month plus .0047223 per KWH on first 5300 KWH delivered then .0009433 on balance </td>
<td style="text-align:center;"> Minimum amount of 2.29 per month plus .0047223 per KWH on first 5300 KWH delivered then .0009433 on balance </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 1.50/month + .01520/kwh; min 1.50/month; max 3.00/month </td>
<td style="text-align:center;"> 1.50/month + .01500 1st 667 kwh; + .00105/kwh > 667 kwh; 1.50 min/month; 100 max/month </td>
<td style="text-align:center;"> 1.50/month + .01500 1st 667 kwh; + .00105/kwh > 667 kwh; 1.50 min/month; 100 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> 0.015625 per kwh
Min. 1.50 per month
Max. 3.00 per month </td>
<td style="text-align:center;"> .01800 per kwh
Min. 1.50 per month
Max. 15.00 per month </td>
<td style="text-align:center;"> .01900 per kwh
Min. 1.50 per month
Max. 7.50 per month </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
<td style="text-align:center;"> 20% 1st 1000.00 1% over 1000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> 0-2500 KWH
2501 - 50000
50001 - + </td>
<td style="text-align:center;"> .000380
.000240
.000180 </td>
<td style="text-align:center;"> .000380
.000240
.000180 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 1.12 + 0.012075/kwh Group meter can't exceed 3.00 times #units </td>
<td style="text-align:center;"> 1.07 plus 0.005071kwh </td>
<td style="text-align:center;"> 1.07 plus 0.004131/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 20% 1st 15 </td>
<td style="text-align:center;"> 20% 1st 150 </td>
<td style="text-align:center;"> 20% 1st 150 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 0.70 + .007349 1st 40726 kwh and .002940 > 40726 kwh </td>
<td style="text-align:center;"> 1.15 + .009580 1st 36570 kwh and .001755 > 36570 kwh </td>
<td style="text-align:center;"> 1.15 + .007115 1st 49242 kwh and .002868 > 49242 kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 1.75/dwelling unit + .0185/kwh not to exceed 3.75/month </td>
<td style="text-align:center;"> 2.87/meter + .0251/kwh not to exceed 112.50/month </td>
<td style="text-align:center;"> 2.87/meter + .0171/kwh not to exceed 112.50/month </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 1.40 + .015094/kwh; max 3 </td>
<td style="text-align:center;"> 2.29 + .013669/kwh; max 60 </td>
<td style="text-align:center;"> 2.29 + .013669/kwh; max 60 </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 6% min. monthly charge plus rate of 0.004743/kWh max. 6/month </td>
<td style="text-align:center;"> 10% min. monthly charge plus rate of 0.006602/kWh max. of 8000/yr </td>
<td style="text-align:center;"> 10% min. monthly charge plus rate of 0.006602/kWh max. of 8000/yr </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> .027 + 0.0035/ cap 0.90 </td>
<td style="text-align:center;"> 0.49 + 0.0037 on 1st 1500 </td>
<td style="text-align:center;"> 39.00 + .0019; not to exceed 60.00/month </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 1.40 plus rate of 0.15086 kwh not to exceed 3.00 per mo. </td>
<td style="text-align:center;"> 2.29 plus rate of 0.014085 kwh not to exceed 36.00 per mo. </td>
<td style="text-align:center;"> 2.29 plus rate of 0.014085 kwh not to exceed 36.00 per mo. </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 1.05 + .01136/kwh not to exceed 2.25 </td>
<td style="text-align:center;"> 1.72 + rate of .010112/kwh not to exceed 75.00 </td>
<td style="text-align:center;"> 1.72 + rate of .010112/kwh not to exceed 75.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> .70 + .007535/kwh; 5.00 max </td>
<td style="text-align:center;"> .092 + .004807/kwh </td>
<td style="text-align:center;"> .092 + .004807/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 1.15 + .015/kWh; 3.00 max/month </td>
<td style="text-align:center;"> 2.00 + .015 < 3700 kWh; + 0.0055 > 3700kWh; 165.00 max </td>
<td style="text-align:center;"> 2.00 + .015 < 3700 kWh; + 0.0055 > 3700kWh; 165.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 1.40 + .015080/kwh
Apt or multifamily
=3.00/unit
Max 3.00 </td>
<td style="text-align:center;"> 2.15 + .005194 on 1st 30630 kwh and .001494 on cons >30360 kwh
Max 20% consumer chg/month </td>
<td style="text-align:center;"> Same as commercial </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> 20% 1st $10.00 </td>
<td style="text-align:center;"> 20% 1st $100.00 </td>
<td style="text-align:center;"> 20% 1st $150.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 1.40 + .014953/kwh; 3.00 max </td>
<td style="text-align:center;"> 2.29 + .013953 1st 2703 kwh;+ .003321 thereafter; 80 max </td>
<td style="text-align:center;"> 2.29 + 0.013953 1st 2703 kwh delivered;+ 0.003321 on each kwh thereafter; 80 max per month </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 1.00/month + .0024/kwh 2.00 max </td>
<td style="text-align:center;"> 1.00/month + .0166/kwh
20.00 max tax </td>
<td style="text-align:center;"> 1.00/month + .0166/kwh
20.00 max tax </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 25.00 </td>
<td style="text-align:center;"> 20% 1st 2500.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 100.00 </td>
<td style="text-align:center;"> 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> .00460 1st 1000; .00260 > 1000 There is no minimum or maximum </td>
<td style="text-align:center;"> .00480 1st 1000; .00292 > 1000 Tere is no minimum or maximum. </td>
<td style="text-align:center;"> .00375 1st 1000 kwh; .00260 > 1000 There is no minimum or maximum. </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 20% * minimum provider charge + .01641/kwh; 3 max </td>
<td style="text-align:center;"> 20% * min provider charge + .021683/kwh; > 1500 kwh + .0174 </td>
<td style="text-align:center;"> 20% * min provider charge + .021683/kwh; > 1500 kwh + .0174 </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 2.00 + .00328/kwh; 3.00 max </td>
<td style="text-align:center;"> .00528/kwh; 400 max LGS
.00626/kwh;400 max MGS
.00949/kwh; 400 max SGS </td>
<td style="text-align:center;"> .00528/kwh; 400 max </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 1.54 + 0.016398/kWh not to exceed 3.08/month </td>
<td style="text-align:center;"> 2.29 plus the rate of 0.015455 per kWh on the first two thousand four hundred forty (2440) kWhs plus the rate of 0.003482 per kWh on all remaining kWhs delivered monthly to industrial consumers however the total tax shall not exceed one thousand five hund </td>
<td style="text-align:center;"> 2.29 plus the rate of 0.013859 per kWh on the first two thousand seven hundred twenty-one (2721) kWhs plus the rate of 0.003265 per kWh on all remaining kWhs delivered monthly to commercial consumers however the total tax shall not exceed eighty dollars ( </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 1.75 + 0.016891/kwh not to exceed 3.75/month </td>
<td style="text-align:center;"> non-mfg 2.87 + .017933/kwh for 1st 537 kwhs; .006330/kwh on rest:
Manufacturing: 1.38+.004965/kwh
0-3625100kwhs +.004014/kwh on balance not to exceed 53000 per month </td>
<td style="text-align:center;"> same as Industrial </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 37.50 </td>
<td style="text-align:center;"> 20% 1st 37.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 1.40 + .015063/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 1.72 + .010533/kwh; 75.00 max/month </td>
<td style="text-align:center;"> 1.72 + .010533/kwh/month; 75.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 1.40 + .014716/kwh not to exceed 3.00 monthly </td>
<td style="text-align:center;"> 1.15 + .007286/kwh not to exceed 10.00 monthly </td>
<td style="text-align:center;"> 1.15 + .007286/kwh not to exceed 10.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 1.40 + .015038/kwh/month; 3.40 max/month </td>
<td style="text-align:center;"> 2.29 + .015915/kwh/month; 400.00 max/month </td>
<td style="text-align:center;"> 2.29 + .013143/kwh/month; 400.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 0.01505/kwh; 3.00 max </td>
<td style="text-align:center;"> 0.017050/kwh; 40.00 max </td>
<td style="text-align:center;"> 0.03000/kwh; 40.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 1.40 + 0.015116/kwh; 4 max./mo. </td>
<td style="text-align:center;"> 2.75 + 0.016462/kwh on first 8945kwh; 0.002160 thereafter </td>
<td style="text-align:center;"> 2.75 + 0.11952/kwh on first 1232kwh; 0.001837 thereafter </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> .00780 for 1st 1000 kwh & .00450 1000kwh; or 12% of min mo </td>
<td style="text-align:center;"> .00800 1st 1000kwh & .00540 kwh > 1000; or 12% min mon chg </td>
<td style="text-align:center;"> .00680 1st 1000kwh & .00395 kwh>1000; or 12% min mon chg </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> A minimum charge of .40 per customer plus .003 per KWh with the amount of tax not to exceed .90 maximum </td>
<td style="text-align:center;"> A minimum charge of
1.00 plus .003 per
KWh with the amount
not to exceed 300.00 </td>
<td style="text-align:center;"> A minimum charge of
1.00 plus .003 per
KWh with the amount
not to exceed 300.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 1.40 + .015/kwh; max 2.00 per month </td>
<td style="text-align:center;"> 2.29 + .014489/kwh; max 20 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 1.40 + .014679/kwh
3.00 max/mo. </td>
<td style="text-align:center;"> 1.49 + .008283/kwh
1300.00 max/mo. </td>
<td style="text-align:center;"> 1.49 + .007722/kwh
1300 max/mo. </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 1.40+.014771 per kwh up to 3.00 </td>
<td style="text-align:center;"> 1.72+.009253 on first 9946; then .001190 up to 162.50 </td>
<td style="text-align:center;"> 1.72+.010057 up to 1st 9151 kwh then .002831 up to 162.5 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> .70 + .007589/kwh; 5.00 max </td>
<td style="text-align:center;"> 1.15 + .007144/kwh; 15.00 max </td>
<td style="text-align:center;"> 1.15 + .007409/kwh; 15.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> .70/month + .007468/kwh; 1.00 max </td>
<td style="text-align:center;"> 1.15/month + .006947/kwh; 20 max </td>
<td style="text-align:center;"> 1.15/month + .006947/kwh; 20 max </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> Max. 3.00/mo .012/kwh </td>
<td style="text-align:center;"> Max 10700 kwh/mo .011/kwh </td>
<td style="text-align:center;"> Max 10700 kwh/mo .011/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> .00750/KWH; 1.00 max </td>
<td style="text-align:center;"> .00550/kwh; 10.00 max </td>
<td style="text-align:center;"> .00750/kwh; 2.50 max </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 3.00 max/month on each meter </td>
<td style="text-align:center;"> 3.00 max/month on each meter </td>
<td style="text-align:center;"> 3.00 max/month on each meter </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> 8% * minimum monthly charge + .00650/kwh; 1.20 max/month </td>
<td style="text-align:center;"> 8% * minimum monthly charge + .00500/kwh </td>
<td style="text-align:center;"> 8% * minimum monthly charge + .00500/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> .70 + .007523/kwh/month; 1.00 max </td>
<td style="text-align:center;"> 1.15 + .007342/kwh/month; 10.00 max </td>
<td style="text-align:center;"> 1.15 + .007342/kwh/month; 10.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> 0.00038 on kWh </td>
<td style="text-align:center;"> 0.00038 on kWh </td>
<td style="text-align:center;"> 0.00038 on kWh </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> 20% on 1st 15 </td>
<td style="text-align:center;"> 20% on 1st 50 </td>
<td style="text-align:center;"> 20% on 1st 50 </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> .01135/kwh; max 3.00 </td>
<td style="text-align:center;"> .01115/kwh; max 10.00 </td>
<td style="text-align:center;"> .012000/kwh; max 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> 8.29 per month
first 800 .10044
801-2500 .11149
2501-50000 .11224
OVER 50001 .11258 </td>
<td style="text-align:center;"> Basic charge 15.98 per month
first 20 kw free
all over 20 kw 9.21
first 2500 kwh
.10555
2501-3000 kwh .10629
3000-50000 kwh
.07745
all over 50001 kwh .07778 </td>
<td style="text-align:center;"> Basic charge 15.44 per month
first 20 kw free
all over 20 kw 8.9
first 2500 kwh
.09712
2501-3000 kwh .09781
3000-50000 kwh
.07127
all over 50001 kwh .07157 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> .75% </td>
<td style="text-align:center;"> .75% </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 0.05% </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> 15% 1st 10.00 </td>
<td style="text-align:center;"> 15% 1st 50.00 </td>
<td style="text-align:center;"> 15% 1st 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> .0284/kwh; 3.00 max/month </td>
<td style="text-align:center;"> .0250/kwh 1st 6300 kwh; .0082/kwh > 6300 kwh </td>
<td style="text-align:center;"> .0250/kwh 1st 6300 kwh; .0082/kwh > 6300 kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 15% of 1st 10.00 </td>
<td style="text-align:center;"> 15% of 1st 100.00 </td>
<td style="text-align:center;"> 15% of 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> 1.40 + .014815/kwh/month; 3.00 max/month </td>
<td style="text-align:center;"> 2.29 + .029583/kwh/month; 3.00 max/month </td>
<td style="text-align:center;"> 2.29 + .029583/kwh/month; 3.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> 20% 1st 15 </td>
<td style="text-align:center;"> 20% 1st 15 </td>
<td style="text-align:center;"> 20% 1st 15 </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> Not to exceed 3.00 monthly. Shall be 1.45 for 0 to 5 kWh plus the rate of 0.0015 on each kWh thereafter delivered monthly to residential consumers by a service provider. </td>
<td style="text-align:center;"> Not to exceed 20.00 monthly. Shall be 3.50 for 0 to 5 kWh plus the rate of 0.0015 on each kWh thereafter delivered monthly to industrial consumers by a service provider. </td>
<td style="text-align:center;"> Not to exceed 20.00 monthly. Shall be 3.50 for 0 to 5 kWh plus the rate of 0.0015 on each kWh thereafter delivered monthly to commercial consumers by a service provider. </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 7% 1st 100.00 </td>
<td style="text-align:center;"> 7% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> .04500/kwh or 20% * minimum monthly charge; 3.00 max </td>
<td style="text-align:center;"> .01456/kwh or 20% * minimum monthly charge: 50.00 max/month </td>
<td style="text-align:center;"> .0158125/kwh or 20% * minimum monthly charge; 250 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> .0149/kwh; 2.50 max </td>
<td style="text-align:center;"> .0125/kwh; 20.00 max </td>
<td style="text-align:center;"> .0125/kwh; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> 1.40 + .014839; 3.00 max </td>
<td style="text-align:center;"> 2.29 + .014191; 20.00 max </td>
<td style="text-align:center;"> 2.29 + .014191; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 1.40 + 0.015094 on each kwh not to exceed 3.00 monthly. </td>
<td style="text-align:center;"> 2.29 + 0.014401 on each kwh not to exceed 25.00 monthly. </td>
<td style="text-align:center;"> 2.29 + 0.014401 on each kwh not to exceed 25.00 monthly. </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> 0.01510/kwh/month; 3.00 max/month </td>
<td style="text-align:center;"> 0.01500/kwh; 10.00 max/month </td>
<td style="text-align:center;"> 0.03200/kwh; 10.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> 0-2500 = 0.00038
2501-50000 = 0.00024
50001-over = 0.00018 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> 0.01515/kwh </td>
<td style="text-align:center;"> 0.015/kwh for 1st 667kwh; 0.001 for each of next 240000 kwh </td>
<td style="text-align:center;"> 0.0135/kwh for 1st 740 kwh; 0.00095 for each of next 252632 kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> .0373/kwh/month; 1.50 max/month;
no min. </td>
<td style="text-align:center;"> 0.0251/kwh for 1st 625 kwh/month & .0027/kwh in excess of 625 kwh/month;no min. </td>
<td style="text-align:center;"> 0.0251/kwh for 1st 625 kwh/month & .0027/kwh in excess of 625 kwh/month;no min. </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> 0-2500 kwhr: .00038/kwhr </td>
<td style="text-align:center;"> 0-2500 kwhr: .00038/kwhr 2501-50000 kwhr: .00024/kwhr </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> 1.40 plus 0.014418/kWh per month not to exceed 2.50/month </td>
<td style="text-align:center;"> 2.29 plus 0.015319/kWh up to 177 kWh plus 0.000723/kWh over 177kWh per month </td>
<td style="text-align:center;"> 2.29 plus 0.015319/kWh up to 177 kWh plus 0.000723/kWh over 177kWh per month </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 10% 1st 13.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> not to exceed 3.00 monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> not to exceed 9.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> 1.00 </td>
<td style="text-align:center;"> 5.00 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> 0.011354 per kilowatt hour (kWh) with a minimum tax of 1.05 per month and a maximum tax of 1.50 per month. </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> 20% of 1st 15.00 </td>
<td style="text-align:center;"> 20% of 1st 300.00 </td>
<td style="text-align:center;"> 20% 1st 300.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> .09850/kwh; 3.00 max </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 20% 1st 6.25 </td>
<td style="text-align:center;"> 15% 1st 83.33 </td>
<td style="text-align:center;"> 15% 1st 83.33 </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> 1.40 + 0.015094/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 2.29 + 0.014524/kwh; 10.00 max/month </td>
<td style="text-align:center;"> 2.29 + 0.014524/kwh; 10.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 20 </td>
<td style="text-align:center;"> 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> 10% 1st $15.00 </td>
<td style="text-align:center;"> 10% 1st $15 .00 </td>
<td style="text-align:center;"> 10% 1st $15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> $0.006804/kwh, not to exceed $2.70/month </td>
<td style="text-align:center;"> $0.00005393/kwh, not to exceed $72/month </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 20% of the monthly charge with a 3.00
maximum charge </td>
<td style="text-align:center;"> 20% of the monthly cha
rge with a 100.00
maximum charge </td>
<td style="text-align:center;"> 20% of the monthly cha
rge with a 100.00
maximum charge </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> 20% of 1st 15 </td>
<td style="text-align:center;"> 20% of 1st 50 </td>
<td style="text-align:center;"> 20% of first 50 </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> 1.40 + .015082/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 2.29 + .014536/kwh; 30.00 max/month </td>
<td style="text-align:center;"> 2.29 + .014536/kwh; 30.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> .0151/kwh; not to exceed 3.00 monthly </td>
<td style="text-align:center;"> .0125/kwh; not to exceed 20.00 monthly </td>
<td style="text-align:center;"> .0185/kwh not to exceed 40.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> .01525/kwh; 3.00 max </td>
<td style="text-align:center;"> .00580/kwh; 20.00 max </td>
<td style="text-align:center;"> .01300/kwh; 40.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> 1.40 + 0.015094/kWh. Max. of 3.00/month. </td>
<td style="text-align:center;"> 2.29 + 0.014394/kWh. Max. 15.00/month. </td>
<td style="text-align:center;"> 2.29 + 0.013969/kWh. Max. 15.00/month. </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> Standard .014474 </td>
<td style="text-align:center;"> Standard (1) 0.026876 (2) 0.001121 </td>
<td style="text-align:center;"> Standard (1) 0.014245 (2) 0.001289 </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> 1.40 + .014932/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 2.29 + .015588/kwh; 6.00 max/month </td>
<td style="text-align:center;"> 2.29 + .015588/kwh; 6.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> 15% 1st 15.00 </td>
<td style="text-align:center;"> 15% 1st 100.00 </td>
<td style="text-align:center;"> 15% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> .015132/kwh; 3.00 max/month </td>
<td style="text-align:center;"> .010628/kwh; 30 max/month </td>
<td style="text-align:center;"> .010628/kwh; 30 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 20% of first 15.00
Maximum 3.00 </td>
<td style="text-align:center;"> 20% of first 15.00
Maximum 3.00 </td>
<td style="text-align:center;"> 20% of first 15.00
Maximum 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 1.12 + .012047/kwh; 2.40 max/month </td>
<td style="text-align:center;"> 1.84 + .010707/kwh; 48 max/month </td>
<td style="text-align:center;"> 1.84 + .010707/kwh; 48 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> .49 + .0052 per kWh. Not to exceed 1.05 per meter monthly. </td>
<td style="text-align:center;"> .80 + .0049 on each kWh. Not to exceed 7.00 per meter monthly </td>
<td style="text-align:center;"> .80 + .0049 on each kWh. Not to exceed 7.00 per meter monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> .0007095/kwh/month; minimum tax 1.50/month; max 3.00 </td>
<td style="text-align:center;"> .0008462/kwh/month; minimum tax 1.50/month; max 3.00 </td>
<td style="text-align:center;"> .00005309/kwh/month; miminum tax 1.50/month; max 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> 20% 1st 5; max.1.00/mo. </td>
<td style="text-align:center;"> 20% 1st 50 </td>
<td style="text-align:center;"> 20% 1st 250.00 </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> 1.26 plus 0.013424 per kWh. Max 2.70 </td>
<td style="text-align:center;"> 1.26 plus 0.007421 per kWh Not to exceed 33.00 </td>
<td style="text-align:center;"> 1.26 plus 0.007421 per kWh Not to exceed 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> 0.031283 per KWH not to exceed 3.00 mo. </td>
<td style="text-align:center;"> 0.006161 1st. 48693KWH; 0.001636 exceed 4868KWH; not to exceed 10.00 mo. </td>
<td style="text-align:center;"> same as commercial </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> .007498 per kWh not to exceed 3.00 monthly </td>
<td style="text-align:center;"> .007298 per kWh not to exceed 5.00 monthly </td>
<td style="text-align:center;"> .007298 per kWh not to exceed 5.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> 18% 1st 15.00 </td>
<td style="text-align:center;"> 18% 1st 15.00 </td>
<td style="text-align:center;"> 18% 1st 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> Tax shall be ten percent times the minimum monthly charge (exclusive of any federal tax) imposed upon the consumer plus the rate of 0.007582 on each small kWh delivered monthly to residential consumers by the service provider not to exceed 1.50 monthly. </td>
<td style="text-align:center;"> Such tax shall be ten percent times the minimum monthly charge (exclusive of any federal tax) imposed upon the consumer plus the rate of 0.007115 on each kilowatt hour delivered monthly not to exceed 10.00 per month. </td>
<td style="text-align:center;"> Such tax shall be ten percent times the minimum monthly charge (exclusive of any federal tax) imposed upon the consumer plus the rate of 0.007115 on each kilowatt hour delivered monthly not to exceed 10.00 per month. </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> $1.05 minimum charge + $.011881/kwh; $2.25 max/month </td>
<td style="text-align:center;"> $1.72 minimum + $.010517/kwh/month;$9.00 max/month </td>
<td style="text-align:center;"> $1.72 minimum + $.010517/kwh/month;$9.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> 1.40 plus 0.015101/kWh max 3.00 </td>
<td style="text-align:center;"> 2.29 plus 0.014300/kWh max 30.00 </td>
<td style="text-align:center;"> 2.29 plus 0.014300/kWh max 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 15% 1st 15.00 </td>
<td style="text-align:center;"> 15% 1st 250 .00 </td>
<td style="text-align:center;"> 15% 1st 250.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 1.05 + .011363/kwh; 2.25 max/month </td>
<td style="text-align:center;"> 1.72 + .010204/kwh; 45.00 max/month </td>
<td style="text-align:center;"> 1.72 + .010204/kwh; 45.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> .70 + .007458/kwh; 1.50 max/month </td>
<td style="text-align:center;"> 1.15 + .00702/kwh; 15.00 max/month </td>
<td style="text-align:center;"> 1.15 + .00702/kwh; 15.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> 1.50-3.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 1.50-90.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> 10% 1st 20.00 </td>
<td style="text-align:center;"> 10% 1st 50.00 </td>
<td style="text-align:center;"> 10% 1st 150.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 1.26 + 0.013424/kwh; 2.70/mo. max. </td>
<td style="text-align:center;"> 1.26 + 0.007421/kwh; 33/mo. max. </td>
<td style="text-align:center;"> 1.26 + 0.007421/kwh; 33/mo. max. </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> .0151/kwh; 3.00 max/month </td>
<td style="text-align:center;"> .0150/kwh; 15.00 max/month </td>
<td style="text-align:center;"> .0150/kwh; 15.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> .015/kwh up to 200 kwh per month; not to exceed 3.00/month </td>
<td style="text-align:center;"> .015/kwh up to 500 kwh per month; not to exceed 7.50/month </td>
<td style="text-align:center;"> .015/kwh up to 1000 kwh per month; not to exceed 15.00/month </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> 1.00/month </td>
<td style="text-align:center;"> 1.00/month </td>
<td style="text-align:center;"> 1.00/month </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> Electrical Services - Residential. On purchasers of electric service for residential purposes the tax shall be in the amount of 0.0300 per kWh for the first 100 kWh and 0.000000 per kWh exceeding 100 kWh delivered monthly by a seller not to exceed three </td>
<td style="text-align:center;"> Electrical Services - Industrial. On purchasers of electric service for industrial purposes the tax shall be in the amount of 0.005265 per kWh for the first 56980 kWh and 0.000934 per kW exceeding 56980 kWh delivered monthly by a seller. </td>
<td style="text-align:center;"> Electrical Services - Commercial. On purchasers of electric service for commercial purposes the tax shall be in the amount of 0.006161 per kWh for the first 48693 kWh and 0.001636 per kWh exceeding 48693 kWh delivered monthly by a seller. </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> min .70
max 10% 1st 10.00 </td>
<td style="text-align:center;"> min 1.15
max 10% 1st 700.00 </td>
<td style="text-align:center;"> min 1.15
max 10% 1st 700.00 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> 0.70 plus 0.007157/kwh 3 max/month </td>
<td style="text-align:center;"> 1.15 plus 0.006469/kwh 300 max/month </td>
<td style="text-align:center;"> 1.15 plus 0.008963/kwh 300 max/mo </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 1.05 + .011429/kwh; 2.25 max/month </td>
<td style="text-align:center;"> 1.72 + .010708/kwh; 15.00 max/month </td>
<td style="text-align:center;"> 1.72 + .010708/kwh; 15.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> .0025/kwh/month; .75 max/month </td>
<td style="text-align:center;"> .0025/kwh/month; .75 max/month </td>
<td style="text-align:center;"> .0025/kwh/month; .75 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 1.00 + .007585/kwh/month;
2.00 max </td>
<td style="text-align:center;"> 10.00 + .007520/kwh/month;
20.00 max </td>
<td style="text-align:center;"> 10.00 + .007520/kwh/month;
20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 10% 1st 10 </td>
<td style="text-align:center;"> 10% 1st 100 </td>
<td style="text-align:center;"> 10% 1st 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 1.40+ .015097/kwh; 2.00 max/month </td>
<td style="text-align:center;"> 2.29+0.016504/kwh; 5.00 max/month </td>
<td style="text-align:center;"> 2.29+0.016504/kwh; 5.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> 1/2 of 1% of town gross sales </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> Max 2.00 per month </td>
<td style="text-align:center;"> Max 20.00 per month </td>
<td style="text-align:center;"> Max 20.00 per month </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> 15% 1st 15.00 No charge over 15.00 </td>
<td style="text-align:center;"> 15% 1st 200.00 </td>
<td style="text-align:center;"> 15% 1st 200.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> 1.40 + .015111/kwh; 3.00 max/month </td>
<td style="text-align:center;"> 1.72 + .010200/kwh; 45.00 max/month </td>
<td style="text-align:center;"> 1.72 + .010200/kwh; 45.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 0.00900/kwh </td>
<td style="text-align:center;"> 0.00610/kwh </td>
<td style="text-align:center;"> 0.00640/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .5 of %1 </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> 0-2500= .00038/kwh; 2501-50K=.00024; >50K=.00018/kwh </td>
<td style="text-align:center;"> 0-2500= .00038/kwh; 2501-50K= .00024;
>50K= .00018/kwh </td>
<td style="text-align:center;"> 0-2500= .00038/kwh; 2501-50K= .00024;
>50K= .00018/kwh </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> .0158865/kwh; 3.00 max/month </td>
<td style="text-align:center;"> .015009/kwh; 20.00 max/month </td>
<td style="text-align:center;"> .015009/kwh; 20.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> .015/kwh; 1.00 max/month </td>
<td style="text-align:center;"> .015/kwh; 1.00 max/month </td>
<td style="text-align:center;"> .015/kwh; 1.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> 1.40 +
.015094 each
KWH 3.00 </td>
<td style="text-align:center;"> 1.15 +
.007319 each
Max 10.00 </td>
<td style="text-align:center;"> 1.15+
.007319 each
max 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> 20% times min. monthly charge + rate of .015626/kwh/mo not to exceed 3.00 </td>
<td style="text-align:center;"> 20% times min. monthly charge + .014766/kwh/mo not to exceed 200 month </td>
<td style="text-align:center;"> same as commercial </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> .80 + .009644/kwh; 3.00 max </td>
<td style="text-align:center;"> 1.50 + .0123367/kwh; 10.00 max/month </td>
<td style="text-align:center;"> 7.50 + .0047528/kwh; 10.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 1.00 + .007585/kwh/month; 1.25 max/month </td>
<td style="text-align:center;"> 1.25 + .007520/kwh/month; 5.00 max/month </td>
<td style="text-align:center;"> 1.25 + .007520/kwh/month; 10.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> .01135/kwh; 2.25 max </td>
<td style="text-align:center;"> .01/kwh; 11.25 max </td>
<td style="text-align:center;"> .0112/kwh; 11.25 max </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table13-2)Utility Consumers' Monthly Tax on Gas, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Residential </th>
<th style="text-align:center;"> Commercial </th>
<th style="text-align:center;"> Industrial </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> 10% 1st 15.00; 2% thereafter </td>
<td style="text-align:center;"> 10% 1st 100.00; 2% thereafter </td>
<td style="text-align:center;"> 10% 1st 100.00; 2% thereafter </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> 1.25/CCF 1st 1.6 CCF </td>
<td style="text-align:center;"> 0.0638/CCF 1st 4500 CCF; 0.0110/CCF exceeding 4500 for non-interruptible svc; 0.0588/CCF 1st 4770 CCF interruptible; 0.0110 per CCF exceeding 47700 CCF interruptible </td>
<td style="text-align:center;"> 0.0638/CCF 1st 4500 CCF; 0.0110/CCF exceeding 4500 for non-interruptible svc; 0.0588/CCF 1st 4770 CCF interruptible; 0.0110 per CCF exceeding 47700 CCF interruptible </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> 15% 1st 15.00 </td>
<td style="text-align:center;"> 10% 1st 500.00 </td>
<td style="text-align:center;"> 10% 1st 500.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> 20% * minimum provider charge + .01867/CCF/month; 3.00 max </td>
<td style="text-align:center;"> 20% * minimum provider charge + .15566/CCF/month; 20.00 max </td>
<td style="text-align:center;"> 20% * minimum provider charge + .15566/CCF/month; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> .845 + .05017/CCF interruptible non-res= 4.50 + .00913/C </td>
<td style="text-align:center;"> .845 + .05017/CCF interruptible non-res= 4.50 + .00913/C </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> 1.25 + .04/CCF; 1.50 max </td>
<td style="text-align:center;"> 2.35 +.04/CCF; 25 max </td>
<td style="text-align:center;"> 2.35 + .04/CCF; 25.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> .069/CCF; 3.00 max </td>
<td style="text-align:center;"> .048/CCF; 3.00 max </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> 2.45/mo + .05/CCF/mo 3.00 max </td>
<td style="text-align:center;"> 2.45/mo + .05/CCF/mo 3.00 max </td>
<td style="text-align:center;"> 2.45/mo + .05/CCF/mo 3.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> 20% of min. monthly bill + 0.18670/ccf with Max Tax of 3.00 </td>
<td style="text-align:center;"> 20% of min. monthly bill + 0.15566/ccf with Max Tax of 10.00 </td>
<td style="text-align:center;"> 20% of min. monthly bill + 0.15566/ccf with Max Tax of 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> 2.50 max </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> 2.00/month </td>
<td style="text-align:center;"> 2.00 + .010010 on 1st 50000 CCF and .00005 on the remaining balance delivered monthly </td>
<td style="text-align:center;"> 2.00 + .010010 on 1st 50000 CCF and .00005 on the remaining balance delivered monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 75.00; 4% of >75.00 </td>
<td style="text-align:center;"> 20% 1st 75.00; 4% of> 75.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 20% nte 3.00 </td>
<td style="text-align:center;"> 20% nte 30.00 </td>
<td style="text-align:center;"> 20% nte 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> 0.05259/CCF + 0.56/bill;
4.00 max/bill </td>
<td style="text-align:center;"> 0.04794/CCF + 0.845/bill;
300 max/bill </td>
<td style="text-align:center;"> 0.04794/CCF + 0.845/bill;
300 max/bill </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> 20% of minimum monthly charge + .1867/CCF; 3.00 max </td>
<td style="text-align:center;"> 10% of miinimum monthly charge + .07783/CCF; 100 max </td>
<td style="text-align:center;"> 10% of minimum monthly charge + .07783/CCF; 100.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> 2.45 + 0.18670; max 3.00 </td>
<td style="text-align:center;"> 3.00 + 0.15566 </td>
<td style="text-align:center;"> 3.00 + 0.15566 </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> .12183/CCF; Minimum 1.50/month; Max 3.00/month </td>
<td style="text-align:center;"> .12183/CCF; Minimum 1.50/month; Max 3.00/month </td>
<td style="text-align:center;"> .12183/CCF; Minimum 1.50/month; Max 40.00/month </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> .04 * non-metered + .055/CCF; 3.00 max </td>
<td style="text-align:center;"> .04 * non- metered + .04 on 1st 6K CCF+.033 next 24K + .025 > 3000 CCF </td>
<td style="text-align:center;"> .04 * non- metered + .04 on 1st 6K CCF+.033 next 24K + .025 > 3000 CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .1867/CCF; 3.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .015566/CCF; 6.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .015566/CCF; 6.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> 15.00 /month exclusive of fed. and state tax </td>
<td style="text-align:center;"> 20% /month max 1000 exclusive of fed. and state tax </td>
<td style="text-align:center;"> 20% /month max 200 exclusice of fed. And state tax </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20% 1st 150.00 </td>
<td style="text-align:center;"> 20% 1st 150.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .1867/CCF; 3.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .15566/CCF/month up to 100 CCF; + .015566 > 100 CCF </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .15566/CCF/month up to 100 CCF; + .015566 > 100 CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> 3.00 a month maximum </td>
<td style="text-align:center;"> 3.00 a month maximum </td>
<td style="text-align:center;"> 3.00 a month maximum </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 20% min. mo. Charge + 0.015192/CCF delivered not to exceed 3.00 mo </td>
<td style="text-align:center;"> 20% of min. mo. Charge + 0.14521 on each CCF until tax 3.00 + .04719 on each CCF thereafter. No max </td>
<td style="text-align:center;"> 20% of min. mo. Charge + 0.14974 on each CCF until tax 3.00 + .04867 on each CCF thereafter. No max </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 0.1867/CCF; 3.00 max/month </td>
<td style="text-align:center;"> 0.15716/CCF/month; 200.00 max/month </td>
<td style="text-align:center;"> 0.15716/CCF/month; 100.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> Max. tax: 3.00 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> 20% 1st max 15.00 </td>
<td style="text-align:center;"> 10% 1st max 100.00 </td>
<td style="text-align:center;"> 10% 1st max 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> 15% of first 15.00 </td>
<td style="text-align:center;"> 15% of first 15.00 </td>
<td style="text-align:center;"> 15% of first 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> 0.63/month + 0.06485/CCF
Max- 2.70 </td>
<td style="text-align:center;"> 0.676/month + 0.03034/CCF
Max- 72.00 </td>
<td style="text-align:center;"> 0.676/month + 0.03034/CCF
Max- 72.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .1867/CCF; 3.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly + .15566/CCF; 20.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly + .15566/CCF; 20.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> 10% of consumer plan plus 0.08273 per CCF not to exceed 1.50/mo. </td>
<td style="text-align:center;"> 10% of consumer plan plus 0.05945 per CCF not to exceed 10.00/mo. </td>
<td style="text-align:center;"> 10% of consumer plan plus 0.05945 per CCF not to exceed 10.00/mo. </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> Such tax on residential consumers of natural gas shall be 20%
times the minimum monthly charge imposed upon the consumer plus the rate of
0.120913 per cu ft delivered monthly to residential consumers not to exceed three
dollars (3.00) per month </td>
<td style="text-align:center;"> Commercial/Industrial consumers- such tax shall be 20% times the minimum monthly charge imposed upon the consumer plus the rate of 0.112805 on each cu ft delivered monthly to commercial
industrial consumers not to exceed twenty dollars (20.00) per month. </td>
<td style="text-align:center;"> Commercial/Industrial consumers- such tax shall be 20% times the
minimum monthly charge imposed upon the consumer plus the rate of
0.112805 on each cu ft delivered monthly to commercial/industrial
consumers not to exceed twenty dollars (20.00) per mont </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .18670/CCF/month; 3.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .15566/CCF/month; 20 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .15566/CCF/month; 20 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Prince George County </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 30.00 </td>
<td style="text-align:center;"> 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> 1.60 minimum charge + .06/CCF; max 3.00 </td>
<td style="text-align:center;"> 3.35 minimum charge + .085/CCF; 100 max </td>
<td style="text-align:center;"> 3.35 minimum charge + .085/CCF; 100 max </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> .15492 </td>
<td style="text-align:center;"> .14618 </td>
<td style="text-align:center;"> .14618 </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> .12183 CCF
min 0.90
max 1.80 </td>
<td style="text-align:center;"> .12183 CCF
min 0.90
max 600 </td>
<td style="text-align:center;"> .12183 CCF
min 0.90
max 600 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 50.00 </td>
<td style="text-align:center;"> 20% 1st 50.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% on monthly amount not to exceed 7.50 </td>
<td style="text-align:center;"> 20% on monthly amount not to exceed 7.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 37.50 </td>
<td style="text-align:center;"> 20% 1st 75.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .015492/CCF; 3.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .014618/CCF; 20.00 max </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .13842/CCF; 200 max </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> 2.00 </td>
<td style="text-align:center;"> 10% of 1st. 300.00 1% thereafter </td>
<td style="text-align:center;"> 10% of 1st. 300.00 1% thereafter </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> .06/CCF; 3.00 max </td>
<td style="text-align:center;"> .085/CCF; 100 max </td>
<td style="text-align:center;"> .085/CCF; 100 max </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> 10% 1st 15.00 </td>
<td style="text-align:center;"> 2.00 + .186/CCF; max 15.00 </td>
<td style="text-align:center;"> 4.00 + .115/CCF; max 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> .22 per CCF not to exceed 3.00 per month </td>
<td style="text-align:center;"> 0.16 on each CCF not to exceed a max of 800 CCF </td>
<td style="text-align:center;"> 0.16 on each CCF not to exceed a max of 800 CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> 1.20/month + .135/CCF/month; 1.20 minimum; 3.00 max/month </td>
<td style="text-align:center;"> 2.50 (small C/I) 12.30 (large C/I) + .10/CCF 1st 100 CCF; .075/CCF > 100 CCF; 100 max/month </td>
<td style="text-align:center;"> 2.50 (small C/I) 12.30 (large C/I) + .10/CCF 1st 100 CCF; .075/CCF > 100 CCF; 100 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 200.00 </td>
<td style="text-align:center;"> 20% 1st 1000.00 1% over 1000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> .004000 </td>
<td style="text-align:center;"> .004000 </td>
<td style="text-align:center;"> .004000 </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> Group meter 1.28 plus 0.050909/CCF. Not to exceed 3.00 monthly </td>
<td style="text-align:center;"> 1.42 + 0.050213/CCF Interruptible; 4.50 +0.003670/CCF </td>
<td style="text-align:center;"> 1.42 plus 0.050213/CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 20% 1st 15 </td>
<td style="text-align:center;"> 20% 1st 150 </td>
<td style="text-align:center;"> 20% 1st 150 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 0.80 + 0.0638 1st 4500 CCF and 0.0214 > 4500 CCF </td>
<td style="text-align:center;"> Firm:
0.80 + 0.0919 1st 4500 CCF and 0.0308 > 4500 CCF
Interruptible:
5.00 + 0.0798 1st 4770 CCF and 0.0308 > 4770 CCF </td>
<td style="text-align:center;"> Firm:
0.80 + 0.0919 1st 4500 CCF and 0.0308 > 4500 CCF
Interruptible:
5.00 + 0.0798 1st 4770 CCF and 0.0308 > 4770 CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> 1.88/month/meter </td>
<td style="text-align:center;"> 4.00/meter + .155/CCF not to exceed 112.50/month </td>
<td style="text-align:center;"> 4.00/meter + .155/CCF not to exceed 112.50/month </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> 2.45 + .0920/ccf; max 3 </td>
<td style="text-align:center;"> 4.00 + .0840/ccf; max 60 </td>
<td style="text-align:center;"> 4.00 + .0840/ccf; max 60 </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> 6% min monthly charge plus rate of 0.05601 ccf max. 6/month </td>
<td style="text-align:center;"> 10% mon monthly charge plus rate of 0.07783 ccf in excess of 64 ccf not to exceed 8000/yr </td>
<td style="text-align:center;"> 10% mon monthly charge plus rate of 0.07783 ccf in excess of 64 ccf not to exceed 8000/yr </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> 20% of customer ccf chg plus 0.120913/cap3.00 </td>
<td style="text-align:center;"> 20% of customer chg plus 0.112805 ccf/cap 20 </td>
<td style="text-align:center;"> 20% of customer chg plus 0.112805 ccf/cap 20 </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> 1.05 + .05709/CCF not to exceed 2.25 </td>
<td style="text-align:center;"> 1.27 + .05295/CCF not to exceed 75.00 </td>
<td style="text-align:center;"> 1.27 + .05295/CCF not to exceed 75.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> .70 + .0039/CCF; 5.00 max </td>
<td style="text-align:center;"> .676 + 0.04098/CCF </td>
<td style="text-align:center;"> .676 + 0.098/CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> 2.00/month
Apt or multifamily max = 3.00/unit </td>
<td style="text-align:center;"> 5.65 + .091390 per CCF on 1st 835 CCF's and .00843 per CCF on cons >835 CCF's </td>
<td style="text-align:center;"> Same as commercial </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> 1.98 + .191 CCF; 2.40 max per mo </td>
<td style="text-align:center;"> 2.78 + .135199 1st 130 CCF;+ .032578 thereafter; 65 max </td>
<td style="text-align:center;"> 2.78 + 0.135199/CCF on 1st 130;+ 0.032578/CCF thereafter; 65 max per month </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 2.00 /month </td>
<td style="text-align:center;"> 4.65/month +.155/100 cu. ft. 20.00 max </td>
<td style="text-align:center;"> 4.65/month +.155/100 cu. ft. 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 20% 1st 7.00 </td>
<td style="text-align:center;"> 20% 1st 25.00 </td>
<td style="text-align:center;"> 20% 1st 2500.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 100.00 </td>
<td style="text-align:center;"> 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> .86 + .05088 per CCF There is no minimum or maximum. </td>
<td style="text-align:center;"> 1.63 + .02689 per CCF There is no minimum or maximum. </td>
<td style="text-align:center;"> 1.63 + .00256 per CCF There is no minimum or maximum. </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> 20% * min provider charge + .193/CCF/month; 3 max/month </td>
<td style="text-align:center;"> 20% * min provider chg + .1557/CCF;>200CCF + .1530;150 max </td>
<td style="text-align:center;"> 20% * min provider chg + .1557/CCF;>200CCF + .1530;150 max </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> 1.51/month </td>
<td style="text-align:center;"> 1.29 + 0.067602/ccf on first 128.91 ccfs + 0.032576/ccf on all remaining ccfs not to exceed 55/month </td>
<td style="text-align:center;"> 1.29 + 0.067602/ccf on first 128.91 ccfs + 0.032576/ccf on all remaining ccfs not to exceed 55/month </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 1.50/month </td>
<td style="text-align:center;"> 3.225 + 0.167821 for 1st 70 ccf: over 70 ccf to 430CCF=.161552;.15363 >430 - max 500/mo </td>
<td style="text-align:center;"> same as Industrial </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 37.50 </td>
<td style="text-align:center;"> 20% 1st 37.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 2.45 + .0920/CCF/month; 3.00 max/month </td>
<td style="text-align:center;"> 3.49 + .063/CCF; 7.50 max/month </td>
<td style="text-align:center;"> 3.49 + .063/CCF; 7.50 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> 1.98 + .0188374/CCF not to exceed 3.00 monthly </td>
<td style="text-align:center;"> 1.29 + .068855/CCF not to exceed 10.00 monthly </td>
<td style="text-align:center;"> 1.29 + .068855/CCF not to exceed 10.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 2.45 + .18/CCF/month; 3.00 max/month </td>
<td style="text-align:center;"> 4.65 + .10/CCF/month; 400.00 max/month </td>
<td style="text-align:center;"> 4.65 + .10/CCF/month; 400.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> 0.025/CCF; 3.00 max </td>
<td style="text-align:center;"> 0.25/CCF; 40.00 max </td>
<td style="text-align:center;"> 0.25/CCF; 40.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> 1.78 + 0.10091/ccf; 4 max./mo. </td>
<td style="text-align:center;"> Small Volume: 2.88 + 0.1739027/ccf. Large Volume: 24 + 0.07163081/ccf </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> > of .13/CCF or 12% of the minimum monthly charge </td>
<td style="text-align:center;"> > of .08/CCF or 12% of the minimum monthly charge </td>
<td style="text-align:center;"> > of .008/CCF or 12% of the minimum monthly charge </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> A minimum charge of .53 per customer plus .011 per 100 CCF with the amount of the tax not to exceed .90 maximum
GS-1 A minimum charge of .84 per customer plus
.011 per 100 CCF with the amount of the tax not to exceed 300.00
maximum
GS-2 A minimum </td>
<td style="text-align:center;"> A minimum charge of
19.50 per customer
plus .011 per 100 CCF with the amount of the tax not to exceed 300.00 maximum </td>
<td style="text-align:center;"> A minimum charge of
24.00 per customer
plus .011 per 100 CCF with the amount of the tax not to exceed 300.00 maximum </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 2/mo </td>
<td style="text-align:center;"> 4.65 + .1832269 PCCF; 20 max </td>
<td style="text-align:center;"> 4.65 + .1832269 per CCF; 20 max </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> 1.98 + .166183/ccf
3.00 max/mo. </td>
<td style="text-align:center;"> 1.67 + .08904/ccf
1300.00 max/mo. </td>
<td style="text-align:center;"> 1.67 + .08904/ccf
1300.00 max/mo. </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 1.98 + .162451 on each CCF up to 3.00 </td>
<td style="text-align:center;"> 1.94 + .097668 per CCF on the first 961 CCFs and .031362 up to 162.50 </td>
<td style="text-align:center;"> 1.94 + .097668 per CCF on the first 961 CCFs and .031362 up to 162.50 </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> 1.23 + .07145/CCF; 5.00 max </td>
<td style="text-align:center;"> 2.33 + .07384/CCF; 15.00 max </td>
<td style="text-align:center;"> 2.33 + .07384/CCF; 15.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> .70/month + .014/CCF; 1.00 max </td>
<td style="text-align:center;"> 1.15/month + .0243/CCF; 20.00 max </td>
<td style="text-align:center;"> 1.15/month + .0243/CCF; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> Max 3.00/mo .22/CCF </td>
<td style="text-align:center;"> Max 800 CCF/mo .15/CCF </td>
<td style="text-align:center;"> Max 800 CCF/mo .15/CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> .0212/CCF; .70 max </td>
<td style="text-align:center;"> .0104/CCF; 10.00 max </td>
<td style="text-align:center;"> .0104/CCF; 2.50 max </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 3.00 max/month </td>
<td style="text-align:center;"> 3.00 max/month </td>
<td style="text-align:center;"> 3.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .1867/ccf; 3.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .15566/ccf; 20.00 max/month </td>
<td style="text-align:center;"> 20% * minimum monthly charge + .15566/ccf; 20.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> .10 + .10/CCF/month; 3.00/month max </td>
<td style="text-align:center;"> 1.00 + .10/CCF/month: 10.00 max/month </td>
<td style="text-align:center;"> 1.00 + .10/CCF/month; 10.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> .1891/CCF; max 3.00 </td>
<td style="text-align:center;"> .07955/CCF; max 10.00 </td>
<td style="text-align:center;"> .07955/CCF; max 10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> .0502/CCF; 3.00 max/month </td>
<td style="text-align:center;"> .0248/CCF 1st 1225 CCF; .0114/CCF > 1225 CCF </td>
<td style="text-align:center;"> .0248/CCF 1st 1225 CCF; .0114/CCF > 1225 CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> 15% of 1st 10.00 </td>
<td style="text-align:center;"> 15% of 1st 100.00 </td>
<td style="text-align:center;"> 15% of 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> 20% of 1st 15 </td>
<td style="text-align:center;"> 20% of 1st 15 </td>
<td style="text-align:center;"> 20% of 1st 15 </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
<td style="text-align:center;"> 20% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 7% 1st 100.00 </td>
<td style="text-align:center;"> 7% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> .05520/CCF; 3.00 max/month </td>
<td style="text-align:center;"> .08350/CCF; 50.00 max/month </td>
<td style="text-align:center;"> .0065/CCF; 250.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> .0946/CCF; 2.50 max </td>
<td style="text-align:center;"> .0766/CCF; 20.00 max </td>
<td style="text-align:center;"> .0225/CCF; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 2.45 + 0.15566 on each CCF not to exceed 3.00 monthly </td>
<td style="text-align:center;"> 4.65 + 0.15566 on each CCF not to exceed 25.00 monthly </td>
<td style="text-align:center;"> 4.65 + 0.15566 on each CCF not to exceed 25.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> .0240/CCF/month; 1.50 max/month;
no min. </td>
<td style="text-align:center;"> .0170/CCF/month; 15.00 max/month;
no min. </td>
<td style="text-align:center;"> .0170/CCF/month; 15.00 max/month;
no min. </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> 10% 1st 13.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
<td style="text-align:center;"> 10% 1st 100.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> not to exceed 3.00 monthly </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> not to exceed 9.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> 20% 1st 6.25 </td>
<td style="text-align:center;"> 15% 1st 83.33 </td>
<td style="text-align:center;"> 15% 1st 83.33 </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
<td style="text-align:center;"> 20% 1st 15.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> $0.064852/ccf, not to exceed $2.70/month </td>
<td style="text-align:center;"> $0.030340/ccf, not to exceed $72/month </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> 1.50 minimum charge + .75/CCF not to exceed
3.00/month </td>
<td style="text-align:center;"> 3.00 minimum charge + .675/CCF not to
exceed 100/month </td>
<td style="text-align:center;"> 3.00 minimum charge + .675/CCF not to
exceed 100/month </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> 2.45 + .183/CCF; 3.00 max/month </td>
<td style="text-align:center;"> 4.65 + .086/CCF; 30.00 max/month </td>
<td style="text-align:center;"> 4.65 + .086/CCF; 30.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> 1.00 + .133/CCF; not to exceed 2.50 monthly </td>
<td style="text-align:center;"> 2.00 + .126/CCF; not to exceed 20.00 monthly </td>
<td style="text-align:center;"> 2.00 + .126/CCF; not to exceed 50.00 monthly </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> N/A` </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> .18670/CCF; 3.00 max/month </td>
<td style="text-align:center;"> .15566/CCF; 30 max/month </td>
<td style="text-align:center;"> .15566/CCF; 30 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> 20% of first 15.00
Maximum 3.00 </td>
<td style="text-align:center;"> 20% of first 15.00
Maximum 3.00 </td>
<td style="text-align:center;"> 20% of first 15.00
Maximum 3.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> 1.12 + .07172/CCF; 2.40 max/month </td>
<td style="text-align:center;"> 1.35 + .05352/CCF; 48 max/month </td>
<td style="text-align:center;"> 1.35 + .05352/CCF; 48 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> No tax </td>
<td style="text-align:center;"> No tax </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> 2.00/month </td>
<td style="text-align:center;"> .08274/CCF/month; minimum tax 4.65/month; max 20.00/month </td>
<td style="text-align:center;"> .08274/CCF/month; minimum tax 4.65/month; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> 20% 1st 5 </td>
<td style="text-align:center;"> 20% 1st 50 bill </td>
<td style="text-align:center;"> 20% 1st 250.00 </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> 0.0288 on CCF not to
exceed 3.00 </td>
<td style="text-align:center;"> 0.0790 on each CCF not to exceed 33.00 </td>
<td style="text-align:center;"> 0.0790 on each CCF not to exceed 33.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> Tax shall be ten percent times the monthly minimum charge (exclusive of any federal tax) imposed upon the consumer plus the rate of 0.11426 per CCF delivered monthly to residential consumers not to exceed 1.50 per month. </td>
<td style="text-align:center;"> The tax shall be ten percent times the minimum monthly charge (exclusive of any federal tax) imposed upon the consumer plus the rate of 0.10555 on each CCF delivered monthly to commercial/industrial consumers not to exceed 10.00 per month. </td>
<td style="text-align:center;"> The tax shall be ten percent times the minimum monthly charge (exclusive of any federal tax) imposed upon the consumer plus the rate of 0.10555 on each CCF delivered monthly to commercial/industrial consumers not to exceed 10.00 per month. </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> $1.35 minimum charge + $.0141600/CCF, $2.25 max/month </td>
<td style="text-align:center;"> $2.51 min charge + $.0627327/CCF; $9.00 max month </td>
<td style="text-align:center;"> $2.51 min charge + $.0627327/CCF; $9.00 max month </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> 15% 1st 15.00 </td>
<td style="text-align:center;"> 15% 1st 250.00 </td>
<td style="text-align:center;"> 15% 1st 250 .00 monthly bill </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> 15% 1st 15.00; 2.25 max/month </td>
<td style="text-align:center;"> 15% 1st 300; 45.00 max/month </td>
<td style="text-align:center;"> 15% 1st 300; 45.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> 0.0288/ccf; 3/mo. max. </td>
<td style="text-align:center;"> 0.0790/ccf; 33/mo. max. </td>
<td style="text-align:center;"> 0.0790/ccf; 33/mo. max. </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> .166/CCF; 3.00 max/month </td>
<td style="text-align:center;"> 2.344 + .158/CCF; 15.00 max/month </td>
<td style="text-align:center;"> 2.344 + .158/CCF; 15.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> N/A </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> Gas Service - Residential. On purchasers of natural gas service for residential purposes the tax shall be 1.25 per CCF for the first 1.6 CCF and 0.00 per CCF exceeding 1.6 CCF delivered monthly by a seller. </td>
<td style="text-align:center;"> Gas Service - Commercial or Industrial. On purchasers of natural gas service for commercial or industrial purposes the tax shall be 0.0638 per CCF for the first 4500 CCF and 0.0110 per CCF exceeding 4500 CCF for non-interruptible service and 0.0588 per C </td>
<td style="text-align:center;"> Gas Service - Commercial or Industrial. On purchasers of natural gas service for commercial or industrial purposes the tax shall be 0.0638 per CCF for the first 4500 CCF and 0.0110 per CCF exceeding 4500 CCF for non-interruptible service and 0.0588 per C </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> fixed 1.00 </td>
<td style="text-align:center;"> min 2.33
max 10% 1st 700.00 </td>
<td style="text-align:center;"> min 2.33
max 10% 1st 700.00 </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> 1.50/month </td>
<td style="text-align:center;"> 3.49 + .065/CCF; 15.00 max/month </td>
<td style="text-align:center;"> 3.49 + .065/CCF; 15.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> 1.00 + .10¢/per CCF; 2.00 max </td>
<td style="text-align:center;"> 10.00 + .10¢/per CCF; 20.00 max </td>
<td style="text-align:center;"> 10.00 + .10¢/per CCF; 20.00 max </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> 10% 1st 10 </td>
<td style="text-align:center;"> 10% 1st 100 </td>
<td style="text-align:center;"> 10% 1st 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> 2.00 per month </td>
<td style="text-align:center;"> Max 20.00 per month </td>
<td style="text-align:center;"> Max 20.00 per month </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> 1.40 + .18356/CCF; 3.00 max/month </td>
<td style="text-align:center;"> 1.27 + .10760/CCF; 45.00 max/month </td>
<td style="text-align:center;"> 1.27 + .10760/CCF; 45.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 0.12183/CCF </td>
<td style="text-align:center;"> 0.12183/CCF </td>
<td style="text-align:center;"> 0.12183/CCF </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> .0186/CCF; 3.00 max/month </td>
<td style="text-align:center;"> .015566/CCF; 20.00 max/month </td>
<td style="text-align:center;"> .015566/CCF; 20.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> Natural Gas
3.oo per month </td>
<td style="text-align:center;"> Natural Gas
3.00 Minimum
+ tax rate of .004 per CCF with Maximum of 3500.00 </td>
<td style="text-align:center;"> Natural Gas
3.00 Minimum
+ tax rate of .004 per CCF with Maximum of 3500.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> 20% of first 15 or 3 </td>
<td style="text-align:center;"> 20% of first 50 or 10 </td>
<td style="text-align:center;"> 20% of first 500 or 100 </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> 1.00 + .10/CCF/month; 1.25 max/month </td>
<td style="text-align:center;"> 1.25 + .10/CCF/month; 5.00 max/month </td>
<td style="text-align:center;"> 1.25 + .10/CCF/month; 10.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> .90 + .1333/CCF; 2.25 max </td>
<td style="text-align:center;"> 1.875 + .126/CCF; 11.25 max </td>
<td style="text-align:center;"> 1.875 + .126/CCF; 11.25 max </td>
</tr>
</tbody>
</table>
<table>
<caption>(\#tab:table13-3)Utility Consumers' Monthly Tax on Water, 2019</caption>
<thead>
<tr>
<th style="text-align:left;"> Locality </th>
<th style="text-align:center;"> Residential </th>
<th style="text-align:center;"> Commercial </th>
<th style="text-align:center;"> Industrial </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Accomack County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Albemarle County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alleghany County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amelia County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Arlington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Augusta County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bath County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Botetourt County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brunswick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buckingham County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Campbell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Caroline County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Carroll County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charles City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chesterfield County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarke County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craig County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dickenson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dinwiddie County </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Essex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fauquier County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fluvanna County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Frederick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Giles County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gloucester County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goochland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grayson County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greene County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Greensville County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 20% 1st 150.00 </td>
<td style="text-align:center;"> 20% 1st 150.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hanover County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henrico County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Henry County </td>
<td style="text-align:center;"> 30.00 1st 4000 gal
4.70 for each additional 1000 gal </td>
<td style="text-align:center;"> 45.00 1st 4000 gal
7.00 for each additional 1000 gal </td>
<td style="text-align:center;"> 45.00 1st 4000 gal
7.00 for each additional 1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Highland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Isle of Wight County </td>
<td style="text-align:center;"> 10.67/1000 gal. under 50000 gal. usage
9.45/1000 gal. over 50000 gal usage </td>
<td style="text-align:center;"> 10.67/1000 gal. under 50000 gal. usage
9.45/1000 gal. over 50000 gal usage </td>
<td style="text-align:center;"> 10.67/1000 gal. under 50000 gal. usage
9.45/1000 gal. over 50000 gal usage </td>
</tr>
<tr>
<td style="text-align:left;"> James City County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King & Queen County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King George County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> King William County </td>
<td style="text-align:center;"> SERVICE RATE SCHEDULE - WATER SYSTEM*
Minimum Monthly Charge: 30.00 for 0 to 3000 Gallons
Over 3000 Gallons: 6.00 per 1000 Gallons
Number of Billings per Year: 6
Number of Gallons for Minimum Monthly Charge: 0 to 3000 </td>
<td style="text-align:center;"> SERVICE RATE SCHEDULE - WATER SYSTEM*
Minimum Monthly Charge: 30.00 for 0 to 3000 Gallons
Over 3000 Gallons: 6.00 per 1000 Gallons
Number of Billings per Year: 6
Number of Gallons for Minimum Monthly Charge: 0 to 3000 </td>
<td style="text-align:center;"> SERVICE RATE SCHEDULE - WATER SYSTEM*
Minimum Monthly Charge: 30.00 for 0 to 3000 Gallons
Over 3000 Gallons: 6.00 per 1000 Gallons
Number of Billings per Year: 6
Number of Gallons for Minimum Monthly Charge: 0 to 3000 </td>
</tr>
<tr>
<td style="text-align:left;"> Lancaster County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lee County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Loudoun County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lunenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mathews County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mecklenburg County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middlesex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montgomery County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nelson County </td>
<td style="text-align:center;"> 38.20 1st 4000 gal. 10.50 per 1000 gal over 1st 4000 </td>
<td style="text-align:center;"> 38.20 1st 4000 gal. 10.50 per 1000 gal over 1st 4000 </td>
<td style="text-align:center;"> 38.50 1st 4000 gal. 10.50per 1000 gal over 1st 4000 </td>
</tr>
<tr>
<td style="text-align:left;"> New Kent County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Northumberland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nottoway County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Page County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Patrick County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pittsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Powhatan County </td>
<td style="text-align:center;"> 6.73 per one thousand gallons </td>
<td style="text-align:center;"> 6.73 per one thousand gallons </td>
<td style="text-align:center;"> 6.73 per one thousand gallons </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> <NAME> County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rappahannock County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke County </td>
<td style="text-align:center;"> 12% 1st 15.00 </td>
<td style="text-align:center;"> 12% 1st 5000.00 </td>
<td style="text-align:center;"> 12% 1ST 5000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Rockbridge County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rockingham County </td>
<td style="text-align:center;"> 3500 gal 12.50 </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Russell County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scott County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smyth County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Southampton County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Spotsylvania County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stafford County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Sussex County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell County </td>
<td style="text-align:center;"> 0-1000 gal 24.23
Over 1000 gal is
8.45/1000 gal </td>
<td style="text-align:center;"> 0-1000 gal 33.25
1001-30000 gal 12.40/1000 gal 30001-120000 gal 11.27/1000 gal Over 120000 gal 7.61/1000 gal </td>
<td style="text-align:center;"> 0-1000 gal 33.25 1001-30000 gal 12.40/1000 gal 30001-120000 gal 11.27/1000 gal Over 120000 gal 7.61/1000 gal </td>
</tr>
<tr>
<td style="text-align:left;"> Warren County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Westmoreland County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wythe County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> York County </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alexandria City </td>
<td style="text-align:center;"> 15% of monthly bill </td>
<td style="text-align:center;"> 15% not to exceed 150.00 of monthly bill </td>
<td style="text-align:center;"> 15% not to exceed 150.00 of monthly bill </td>
</tr>
<tr>
<td style="text-align:left;"> Bristol City </td>
<td style="text-align:center;"> 5% </td>
<td style="text-align:center;"> 5% </td>
<td style="text-align:center;"> 5% </td>
</tr>
<tr>
<td style="text-align:left;"> Buena Vista City </td>
<td style="text-align:center;"> 20% 1st 15 </td>
<td style="text-align:center;"> 20% 1st 150 </td>
<td style="text-align:center;"> 20% 1st 150 </td>
</tr>
<tr>
<td style="text-align:left;"> Charlottesville City </td>
<td style="text-align:center;"> 10% on 1st 3000 of bill and 4% on excess </td>
<td style="text-align:center;"> 10% on 1st 3000 of bill and 4% on excess </td>
<td style="text-align:center;"> 10% on 1st 3000 of bill and 4% on excess </td>
</tr>
<tr>
<td style="text-align:left;"> Chesapeake City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Heights City </td>
<td style="text-align:center;"> none </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Covington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Danville City </td>
<td style="text-align:center;"> depending on line size (same for all customer classes) </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Emporia City </td>
<td style="text-align:center;"> 20% of monthly charge exclusive of federal tax not
to exceed 15.00 </td>
<td style="text-align:center;"> 20% of monthly charge exclusive of federal tax not to exceed 180.00 </td>
<td style="text-align:center;"> same as industrial </td>
</tr>
<tr>
<td style="text-align:left;"> Fairfax City </td>
<td style="text-align:center;"> Wastewater-Only
47.30 first 5000 gallons or less- 9.04/thousand over </td>
<td style="text-align:center;"> Wastewater-Only
55.65 first 5000 gallons or less - 9.04/thousand over </td>
<td style="text-align:center;"> Wastewater- Only
55.65 first 5000 gallons or less - 9.04/thousand over </td>
</tr>
<tr>
<td style="text-align:left;"> Falls Church City </td>
<td style="text-align:center;"> 10% of 1st 50 of bill </td>
<td style="text-align:center;"> 8% monthly bill </td>
<td style="text-align:center;"> 8% monthly bill </td>
</tr>
<tr>
<td style="text-align:left;"> Franklin City </td>
<td style="text-align:center;"> 20% 1st 15.00
3.00 max/month </td>
<td style="text-align:center;"> 16.5% 1st 1000.00
165.00 max/month </td>
<td style="text-align:center;"> 16.5% 1st 1000.00
165.00 max/month </td>
</tr>
<tr>
<td style="text-align:left;"> Fredericksburg City </td>
<td style="text-align:center;"> water = 0.208/100gal
sewer = 0.423/100gal </td>
<td style="text-align:center;"> water = 0.208/100gal
sewer = 0.423/100gal </td>
<td style="text-align:center;"> water = 0.208/100gal
sewer = 0.423/100gal </td>
</tr>
<tr>
<td style="text-align:left;"> Galax City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hampton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Harrisonburg City </td>
<td style="text-align:center;"> 2.00/month </td>
<td style="text-align:center;"> 20% 20.00 Max </td>
<td style="text-align:center;"> 20% 20.00 Max </td>
</tr>
<tr>
<td style="text-align:left;"> Hopewell City </td>
<td style="text-align:center;"> 20% 1st 10.00 </td>
<td style="text-align:center;"> 20% 1st 25.00 </td>
<td style="text-align:center;"> 20% 1st 2500.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Lexington City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lynchburg City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Manassas Park City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Martinsville City </td>
<td style="text-align:center;"> 1.00 (if not an electrict customer) </td>
<td style="text-align:center;"> 1.00 (if not an electric customer) </td>
<td style="text-align:center;"> 1.00 (if not an electric customer) </td>
</tr>
<tr>
<td style="text-align:left;"> Newport News City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Norfolk City </td>
<td style="text-align:center;"> 25% 1st 22.50 </td>
<td style="text-align:center;"> 25% 1st 75; 15% over 75 </td>
<td style="text-align:center;"> same as Industrial </td>
</tr>
<tr>
<td style="text-align:left;"> Norton City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Petersburg City </td>
<td style="text-align:center;"> 20% 1st 30000 cu. ft. </td>
<td style="text-align:center;"> 15% 1st 30000 cu. ft. </td>
<td style="text-align:center;"> 15% 1st 30000 cu. ft. </td>
</tr>
<tr>
<td style="text-align:left;"> Poquoson City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Portsmouth City </td>
<td style="text-align:center;"> 20% 1st 2000.00 </td>
<td style="text-align:center;"> 20% 1st 2000.00 </td>
<td style="text-align:center;"> 20% 1st 2000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Radford City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richmond City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Roanoke City </td>
<td style="text-align:center;"> 12% NC </td>
<td style="text-align:center;"> 12% first 20000 </td>
<td style="text-align:center;"> 12% first 20000 </td>
</tr>
<tr>
<td style="text-align:left;"> Salem City </td>
<td style="text-align:center;"> 6% of the first 15.00 of revenue not to exceed
0.90 per service </td>
<td style="text-align:center;"> 6% of the first 5000.00 of revenue not to exceed 300.00 per
service </td>
<td style="text-align:center;"> 6% of the first 5000.00 of revenue not to exceed 300.00 per
service </td>
</tr>
<tr>
<td style="text-align:left;"> Staunton City </td>
<td style="text-align:center;"> 20% 1st 10.00 maximum 2/mo </td>
<td style="text-align:center;"> 20% 1st 100.00 maximum 20/mo </td>
<td style="text-align:center;"> 20% 1st 100.00 maximum 20/mo </td>
</tr>
<tr>
<td style="text-align:left;"> Suffolk City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Virginia Beach City </td>
<td style="text-align:center;"> 20% up to a ceiling charge of 15.00 per month </td>
<td style="text-align:center;"> 15% 1st 625.00 and 5% of 625.00 and 2000.00 of the monthly chrge for any single water utility service </td>
<td style="text-align:center;"> 15% 1st 625.00 and 5% of 625.00 and 2000.00 of the monthly chrge for any single water utility service </td>
</tr>
<tr>
<td style="text-align:left;"> Waynesboro City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Williamsburg City </td>
<td style="text-align:center;"> 5.30/1000 gals
29.70/quarter </td>
<td style="text-align:center;"> 5.30/1000 gals
29.70/month </td>
<td style="text-align:center;"> 5.30/1000 gals
29.70/month </td>
</tr>
<tr>
<td style="text-align:left;"> Winchester City </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Abingdon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Accomac Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Alberta Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Altavista Town </td>
<td style="text-align:center;"> 2.54/1000 gallons </td>
<td style="text-align:center;"> 2.54/1000 gallons </td>
<td style="text-align:center;"> 2.49/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Amherst Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appalachia Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Appomattox Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ashland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bedford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Belle Haven Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Berryville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Big Stone Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blacksburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Blackstone Town </td>
<td style="text-align:center;"> first 3000 24.17
next 40000 8.06/1000
next 87000 7.91/1000
all over 130000 7.80/1000 </td>
<td style="text-align:center;"> first 3000 24.17
next 40000 8.06/1000
next 87000 7.91/1000
all over 130000 7.80/1000 </td>
<td style="text-align:center;"> first 3000 24.17
next 40000 8.06/1000
next 87000 7.91/1000
all over 130000 7.80/1000 </td>
</tr>
<tr>
<td style="text-align:left;"> Bloxom Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bluefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boones Mill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bowling Green Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boyce Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Boydton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Branchville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Bridgewater Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Broadway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brodnax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Brookneal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Buchanan Town </td>
<td style="text-align:center;"> 48.25 /4000 </td>
<td style="text-align:center;"> 50.25 /4000 </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Burkeville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cape Charles Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Capron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Charlotte Court House Town </td>
<td style="text-align:center;"> 25+/month </td>
<td style="text-align:center;"> 25+/month </td>
<td style="text-align:center;"> 25+/month </td>
</tr>
<tr>
<td style="text-align:left;"> Chase City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chatham Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Cheriton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chilhowie Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Chincoteague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Christiansburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Claremont Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clarksville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clifton Forge Town </td>
<td style="text-align:center;"> 24.50 for up to 5000 gal for standard connection </td>
<td style="text-align:center;"> 24.50 for up to 5000 gal for standard connection </td>
<td style="text-align:center;"> 24.50 for up to 5000 gal for standard connection </td>
</tr>
<tr>
<td style="text-align:left;"> Clinchco Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Clintwood Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Coeburn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Colonial Beach Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Courtland Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Craigsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Culpeper Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Damascus Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dayton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dendron Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dillwyn Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Drakes Branch Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dublin Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dumfries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Dungannon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Eastville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Edinburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Elkton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Exmore Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Farmville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fincastle Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Floyd Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Fries Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Front Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gate City Town </td>
<td style="text-align:center;"> 28.15 per 2000 gallons in town with 7.90 per 1000 above the 2000 gal
36.25 per 2000 out of town with 7.90 per 1000 above the 2000 gallons </td>
<td style="text-align:center;"> Same as commercial </td>
<td style="text-align:center;"> 30.25 per 2000 gallons in town with 7.90 per 1000 above the 2000 gal
30.25 per 2000 out of town with 7.90 per 1000 above the 2000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Glade Spring Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Glasgow Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Gordonsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Goshen Town </td>
<td style="text-align:center;"> 35.00 per month for first 5000 gallons of water residential
40.00 per month for first 5000 gallons of water for small business and 70.00 per month for first 5000 gallons for large business </td>
<td style="text-align:center;"> 45.00 (small business) </td>
<td style="text-align:center;"> 75.00 (large business) </td>
</tr>
<tr>
<td style="text-align:left;"> Gretna Town </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 0 </td>
</tr>
<tr>
<td style="text-align:left;"> Grottoes Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Grundy Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Halifax Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hamilton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haymarket Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Haysi Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Herndon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsboro Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hillsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Honaker Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Hurt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Independence Town </td>
<td style="text-align:center;"> 0-999 gallons 10
1000-1999 13.75
2000-2999 17.50
3000-3999 21.25
4000-4999 25.00
5000-5999 28.75 </td>
<td style="text-align:center;"> 0-999 gallons 15
1000-1999 17.19
2000-2999 21.88
3000-3999 26.56
4000-4999 31.25
5000-5999 35.94 </td>
<td style="text-align:center;"> 0-999 gallons 15
1000-1999 20.63
2000-2999 26.25
3000-3999 31.88
4000-4999 37.50
5000-5999 43.13 </td>
</tr>
<tr>
<td style="text-align:left;"> Iron Gate Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Irvington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Ivor Town </td>
<td style="text-align:center;"> 34.00 per month </td>
<td style="text-align:center;"> 34.00 per month </td>
<td style="text-align:center;"> 34.00 per month </td>
</tr>
<tr>
<td style="text-align:left;"> Jarratt Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keller Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kenbridge Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Keysville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Kilmarnock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> La Crosse Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lawrenceville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Lebanon Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Leesburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Louisa Town </td>
<td style="text-align:center;"> 37.32 for 4000 gal. min. 6.66 per 1000 gal. over 4k </td>
<td style="text-align:center;"> same </td>
<td style="text-align:center;"> same </td>
</tr>
<tr>
<td style="text-align:left;"> Lovettsville Town </td>
<td style="text-align:center;"> no tax </td>
<td style="text-align:center;"> no tax </td>
<td style="text-align:center;"> no tax </td>
</tr>
<tr>
<td style="text-align:left;"> Luray Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Madison Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Marion Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> McKenney Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middleburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Middletown Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mineral Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Montross Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Crawford Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Mount Jackson Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Narrows Town </td>
<td style="text-align:center;"> 17.65 for 2000 gal.
8.87 each additional
1000 gal. </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> 17.65 for 2000 gals.
4.82 for each additional 10000 gal. </td>
</tr>
<tr>
<td style="text-align:left;"> New Market Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Newsoms Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Nickelsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Occoquan Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onancock Town </td>
<td style="text-align:center;"> Water
Min 3000 = 28.23
3001-15000 = 9.13 per 1000
Over 15000 gallons 9.50 per 1000
Sewer
Min 3000 = 62.60
3001-7000 = 22.05
7001-15000 = 21.42
15001-30000 = 21.12
30001-40000 = 20.81
40001-90000 = 19.58
90001-200000 = 19.28
200001-400000 = 18. </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Onley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Orange Town </td>
<td style="text-align:center;"> 20% not to exceed 3.00 </td>
<td style="text-align:center;"> 20% not to exceed 30.00 </td>
<td style="text-align:center;"> 20% not to exceed 30.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Pennington Gap Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Phenix Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pocahontas Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Port Royal Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pound Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Pulaski Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Purcellville Town </td>
<td style="text-align:center;"> Sum of
0-5000 gallons: 6.66/1000 (min of 1000 gallons)
5001-10000 gal: 8.89/1000 gal
10001-15000 gal: 10.71/1000 gal
15001-20000 gal: 12.75/1000 gal
20001-50000 gal:
15.91/1000 gal
50001-100000 gal:
18.17/1000 gal
100001-150000 gal: 20.42/1000gal
150001-2 </td>
<td style="text-align:center;"> Sum of
0-5000 gallons: 6.66/1000 (min of 1000 gallons)
5001-10000 gal: 8.89/1000 gal
10001-15000 gal: 10.71/1000 gal
15001-20000 gal: 12.75/1000 gal
20001-50000 gal:
15.91/1000 gal
50001-100000 gal:
18.17/1000 gal
100001-150000 gal: 20.42/1000gal
150001-2 </td>
<td style="text-align:center;"> Sum of
0-5000 gallons: 6.66/1000 (min of 1000 gallons)
5001-10000 gal: 8.89/1000 gal
10001-15000 gal: 10.71/1000 gal
15001-20000 gal: 12.75/1000 gal
20001-50000 gal:
15.91/1000 gal
50001-100000 gal:
18.17/1000 gal
100001-150000 gal: 20.42/1000gal
150001-2 </td>
</tr>
<tr>
<td style="text-align:left;"> Remington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rich Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Richlands Town </td>
<td style="text-align:center;"> 3.00 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:center;"> 3.00-10.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Ridgeway Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rocky Mount Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Round Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Rural Retreat Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Saint Paul Town </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> N/A </td>
<td style="text-align:center;"> N/A </td>
</tr>
<tr>
<td style="text-align:left;"> Saltville Town </td>
<td style="text-align:center;"> 23.20 per 3000 gallons </td>
<td style="text-align:center;"> 190.01 per 12000 gallons </td>
<td style="text-align:center;"> 38.00 per 3000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> Saxis Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Scottsville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Shenandoah Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Smithfield Town </td>
<td style="text-align:center;"> 6.14/1000 gallons </td>
<td style="text-align:center;"> 6.14/1000 gallons </td>
<td style="text-align:center;"> 6.14/1000 gallons </td>
</tr>
<tr>
<td style="text-align:left;"> South Boston Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> South Hill Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stanley Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Stony Creek Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Strasburg Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Surry Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tappahannock Town </td>
<td style="text-align:center;"> 3.18 per K </td>
<td style="text-align:center;"> 3.18 per K </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Tazewell Town </td>
<td style="text-align:center;"> 26.00 minimum </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Timberville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Toms Brook Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Troutville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Urbanna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Victoria Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vienna Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Vinton Town </td>
<td style="text-align:center;"> 12% 1st 15.00 </td>
<td style="text-align:center;"> 12% 1st 5000.00 </td>
<td style="text-align:center;"> 12% 1st 5000.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Virgilina Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wachapreague Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wakefield Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warrenton Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Warsaw Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Washington Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Waverly Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Weber City Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> West Point Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Windsor Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wise Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Woodstock Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
<tr>
<td style="text-align:left;"> Wytheville Town </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
<td style="text-align:center;"> -- </td>
</tr>
</tbody>
</table>
<file_sep>/_book/24-Cash-Proffers.md
# Cash Proffers FY 2018
In Virginia proffers are permitted for conditional zoning, “whereby a zoning reclassification may be allowed subject to certain conditions proffered by the zoning applicant for the protection of the community that are not generally applicable to land similarly zoned.” (Code of Virginia, §§ 15.2-2296 through 15.2-2302). The Code § 15.2-2297 authorizes zoning ordinances to include voluntary proffers “in writing, by the owner, of reasonable conditions, prior to a public hearing before the governing body, in addition to the regulations provided for the zoning district or zone by the ordinance, as a part of a rezoning or amendment to a zoning map” provided that the rezoning itself gives rise to the needed conditions.
Eligibility requirements are listed in § 15.2-2298 and § 15.2-2303. Section 15.2-2298 gives localities the authority to accept proffers if: (1) the locality’s growth rate met or exceeded 10 percent in the last decennial census (2010); (2) the locality is a city which adjoins another city or county that had a growth rate that met or exceeded 10 percent in the last decennial census; (3) any towns located within counties that had a growth rate that met or exceeded 10 percent in the last decennial census; and (4) any county contiguous with at least three counties that had a growth rate that met or exceeded 10 percent in the last decennial census.
Further eligibility requirements listed in § 15.2-2303 permit proffers for (1) any county with an urban county executive form of government; (2) any city next to or surrounded by a county with an urban county executive form of government; (3) any county next to a county with an urban county executive form of government; (4) any city next to or surrounded by a county contiguous to a county with an urban county executive form of government; (5) any town within a county contiguous to a county with an urban county executive form of government; and (6) any county east of the Chesapeake Bay (i.e., Accomack and Northampton counties). Finally, § 15.2-2303.1 permits proffers for any county with a 1990 census population between 10,300 and 11,000 through which an interstate highway passes. This section was meant to include New Kent County.
Proffers may entail the giving of property, property improvements, or cash. Proffers of cash payments are required to be disclosed to the Commission on Local Government in accordance with § 15.2-2303.2.There is no requirement for reporting non-cash proffers, a category that may be significant. Cash proffers are reported in an annual commission publication[^24-1]. The study presented here covers fiscal year 2018. In that period, the commission shows a total of 298 localities eligible to receive cash proffers (36 cities, 89 counties, and 177 towns). Of those, 36 reported cash proffer activity.
The following text table shows the total cash proffer revenue expended annually from 2011 through 2018.
```r
#Text table "Total Cash Proffer Revenue Expended, Fiscal Years 2010 to 2017" goes here.
```
The following text table shows the relative importance of the various types of cash proffer revenue expended in fiscal year 2018. Road improvements accounted for the most important use (38.1 percent). Other important uses schools (30.0), and fire and rescue/public safety (14.4). ***Table 24.1*** lists fiscal year 2018 cash proffer revenue collected and expended by locality and purpose.
```r
#Text table "Relative Importance of Various Types of Cash Proffers Expended in FY 2018"
#Pull the relevant data here
#Will probably need to calculate the percent of total for the type of proffer here
#Turn it into a table here
```
```r
#Recreation of "Table 24.1 Total Cash Proffer Revenue Collected and Expended by Purpose, by Locality, FY 2018" goes here
```
[^24-1]: Commission on Local Government, Report on Proffered Cash Payments and Expenditures by Virginia’s Counties, Cities and Towns, 2017-2018. https://www.dhcd.virginia.gov/cash-proffers.
| 3d298bc9896eda12d27c35bf25e0cd0b50c13b69 | [
"Markdown",
"R",
"RMarkdown"
] | 51 | RMarkdown | coopercenter/va-local-tax-rates | 7907a51314ef5f95b21e16f0785709201f037269 | c2e08709bb9c7b8bed4f89a573fe5ca5d3af5c9f |
refs/heads/master | <file_sep><?php
require_once('model/user.php');
function history()
{
$user = new stdClass();
$user->id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : false;
$supp_id = isset($_GET['supp']) ? $_GET['supp'] : null;
if ($supp_id !== null) {
var_dump(User::deleteMediaFromHistory($supp_id));
}
$history = User::getHistory($user->id);
require('view/historyView.php');
}
<file_sep><?php
require_once('model/user.php');
function profile()
{
$mail = isset($_POST['mail']) ? $_POST['mail'] : null;
$password = isset($_POST['password']) ? $_POST['password'] : null;
$old_password = isset($_POST['old_password']) ? $_POST['old_password'] : null;
$old_password = crypt($old_password, '<PASSWORD>');
$message = null;
// ACCOUNT DELETED
if (isset($_POST['del'])) {
$message = User::deleteUser($password, $old_password);
if ($message == 'OK') {
?>
<script type="text/javascript">
window.location = "index.php?action=login"
</script>
<?php
}
// MODIFY USER ACCOUNT BY USER
} else {
if (isset($mail) || isset($password)) {
$message = User::UpdateAcountInfo($mail, $password, $old_password);
}
}
$user = new stdClass();
$user->id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : false;
$profileData = User::getUserById($user->id);
require('view/profileView.php');
}
<file_sep>-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Jun 25, 2020 at 06:42 PM
-- Server version: 5.7.23
-- PHP Version: 7.2.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `Codflix`
--
-- --------------------------------------------------------
--
-- Table structure for table `episode`
--
CREATE TABLE `episode` (
`id` int(11) NOT NULL,
`genre_id` int(11) NOT NULL,
`media_id` int(11) NOT NULL,
`season` int(11) NOT NULL,
`episode` int(11) NOT NULL,
`title` varchar(100) NOT NULL,
`status` varchar(20) NOT NULL,
`duration` int(11) NOT NULL,
`release_date` date NOT NULL,
`summary` longtext NOT NULL,
`media_url` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `episode`
--
INSERT INTO `episode` (`id`, `genre_id`, `media_id`, `season`, `episode`, `title`, `status`, `duration`, `release_date`, `summary`, `media_url`) VALUES
(1, 4, 2, 1, 1, '<NAME>', 'sortie', 1420, '1989-12-17', 'Après avoir assisté au spectacle de Noël de Bart et Lisa à l\'école élémentaire de Springfield, Marge leur demande ce qu\'ils désirent recevoir comme cadeaux pour Noël : Bart demande un tatouage et Lisa demande un poney, mais Marge refuse de leur offrir ces cadeaux', 'https://www.youtube.com/embed/302zdsKnYQc%27'),
(2, 4, 2, 1, 2, '<NAME>', 'sortie', 1335, '1990-01-14', 'En jouant au Scrabble avec sa famille pour se préparer au test de QI qu\'il devra effectuer le lendemain, Bart, qui ne prend pas le jeu au sérieux, place toutes ses lettres au hasard, ce qui forme un mot inexistant causant la rage d\'Homer qui le poursuit dans la maison.', 'https://www.youtube.com/embed/WtC2e5qlIF4%27'),
(3, 4, 2, 2, 1, 'Aide-toi, le ciel t\'aidera', 'sortie', 1307, '1990-10-11', 'Une fois que Martin a fini son exposé, <NAME> demande à Bart de présenter le sien sur le livre L\'Île au trésor qu\'il est censé avoir lu. Bien évidemment, Bart ne l\'a jamais ouvert et tente d\'en faire une explication sans convaincre personne.', 'https://www.youtube.com/embed/mQbshj7ls5o%27'),
(4, 4, 2, 2, 2, '<NAME>', 'sortie', 1272, '1990-10-18', 'Pendant un programme télévisé, Homer voit une publicité qui vante les mérites de Dimoxinil, un produit miracle qui permet de faire pousser les cheveux. Il court voir un médecin afin qu\'il lui prescrive le traitement mais ce dernier coûte 1 000 $. En discutant avec Lenny et Carl, il apprend que son traitement peut être pris en charge par son assurance maladie. Il s\'empresse donc de retourner voir le médecin à la clinique du cheveu pour obtenir le produit miracle.', 'https://www.youtube.com/embed/LV-CzpastW0%27');
-- --------------------------------------------------------
--
-- Table structure for table `genre`
--
CREATE TABLE `genre` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `genre`
--
INSERT INTO `genre` (`id`, `name`) VALUES
(1, 'Action'),
(2, 'Horreur'),
(3, 'Science-Fiction');
-- --------------------------------------------------------
--
-- Table structure for table `history`
--
CREATE TABLE `history` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`media_id` int(11) NOT NULL,
`start_date` datetime NOT NULL,
`finish_date` datetime DEFAULT NULL,
`watch_duration` int(11) NOT NULL DEFAULT '0' COMMENT 'in seconds'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `history`
--
INSERT INTO `history` (`id`, `user_id`, `media_id`, `start_date`, `finish_date`, `watch_duration`) VALUES
(3, 1, 2, '2020-06-25 00:00:00', NULL, 0),
(4, 1, 3, '2020-06-25 00:00:00', NULL, 0);
-- --------------------------------------------------------
--
-- Table structure for table `media`
--
CREATE TABLE `media` (
`id` int(11) NOT NULL,
`genre_id` int(11) NOT NULL,
`title` varchar(100) NOT NULL,
`type` varchar(20) NOT NULL,
`status` varchar(20) NOT NULL,
`release_date` date NOT NULL,
`summary` longtext NOT NULL,
`trailer_url` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `media`
--
INSERT INTO `media` (`id`, `genre_id`, `title`, `type`, `status`, `release_date`, `summary`, `trailer_url`) VALUES
(1, 3, 'Les indestructibles', 'movie', 'released', '1977-10-12', '<NAME> était jadis l\'un des plus grands super-héros de la planète. Tout le monde connaissait Mr. Indestructible, le héros qui, chaque jour, sauvait des centaines de vies et combattait le mal. Aujourd\'\'hui, Mr. Indestructible est un petit expert en assurances qui n\'\'affronte plus que l\'\'ennui et un tour de taille en constante augmentation.', 'https://www.youtube.com/embed/wZ8l1AavXWM'),
(2, 3, '<NAME>', 'série', 'released', '1989-12-17', 'Lorsqu\'Homer pollue gravement le lac de Springfield, une agence de protection de l\'environnement décide de mettre la ville en quarantaine en l\'isolant sous un énorme dôme. Les Springfieldiens, fous de rage, sont bien décidés à lyncher le coupable. Devant cette vague d\'animosité, les Simpson n\'ont d\'autre choix que de fuir et de s\'exiler en Alaska.', 'https://www.youtube.com/embed/SR8WWFzrZAg'),
(3, 1, 'Terminator', 'movie', 'released', '1984-04-13', 'Un Terminator, robot d\'aspect humain, est envoyé d\'un futur où sa race livre aux hommes une guerre sans merci. Sa mission est de trouver et d\'éliminer <NAME> avant qu\'elle ne donne naissance à John, appelé à devenir le chef de la résistance. Cette dernière envoie un de ses membres, Reese, aux trousses du cyborg.', 'https://www.youtube.com/embed/EpdAcA6ziiA');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`email` varchar(254) NOT NULL,
`password` varchar(80) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `email`, `password`) VALUES
(1, '<EMAIL>', '<PASSWORD>');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `episode`
--
ALTER TABLE `episode`
ADD PRIMARY KEY (`id`),
ADD KEY `genre_id` (`genre_id`),
ADD KEY `media_id` (`media_id`);
--
-- Indexes for table `genre`
--
ALTER TABLE `genre`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `history`
--
ALTER TABLE `history`
ADD PRIMARY KEY (`id`),
ADD KEY `history_user_id_fk_media_id` (`user_id`),
ADD KEY `history_media_id_fk_media_id` (`media_id`);
--
-- Indexes for table `media`
--
ALTER TABLE `media`
ADD PRIMARY KEY (`id`),
ADD KEY `media_genre_id_fk_genre_id` (`genre_id`) USING BTREE;
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `episode`
--
ALTER TABLE `episode`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `genre`
--
ALTER TABLE `genre`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `history`
--
ALTER TABLE `history`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `media`
--
ALTER TABLE `media`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `history`
--
ALTER TABLE `history`
ADD CONSTRAINT `history_media_id_fk_media_id` FOREIGN KEY (`media_id`) REFERENCES `media` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `history_user_id_fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `media`
--
ALTER TABLE `media`
ADD CONSTRAINT `media_genre_id_b1257088_fk_genre_id` FOREIGN KEY (`genre_id`) REFERENCES `genre` (`id`);
<file_sep><?php
function contact() {
require('view/contactView.php');
}<file_sep><?php ob_start(); ?>
<div class="media-list">
<?php foreach ($history as $media) : ?>
<a class="item" href="index.php?media=<?= $media['media_id'] ?>">
<div class="video">
<div>
<iframe allowfullscreen="" frameborder="0" src="<?= $media['trailer_url']; ?>">
</iframe>
</div>
</div>
<div class="title"><?= $media['title']; ?></div>
<a href="index.php?action=history&supp=<?= $media[0]; ?>">Supprimer</a>
</a> <?php endforeach; ?>
</div>
<a href="index.php?action=history&supp=0">Supprimer mon historique</a>
<?php
$content = ob_get_clean();
require('dashboard.php');
?><file_sep><?php ob_start(); ?>
<h1>Mon profil</h1>
<h1 style='text-align : center'>Mail : <?php echo ($profilData['email']);; ?></h1>
<form id="mail" method="post" action="index.php?action=profile">
<p><label for="email">Mail : </label><input type="text" id="mail" name="mail" /></p>
<div><input type="submit" name="envoi" value="Changer de mail" /></div>
</form><br><br>
<form id="password" method="post" action="index.php?action=profile">
<p><label for="password">Mot de passe :</label><input type="text" id="password" name="password" /></p>
<p><label for="old_password">Ancien mot de passe :</label><input type="text" id="old_password" name="old_password" /></p>
<div><input type="submit" name="envoi" value="Changer de mot de passe" /></div>
</form><br><br>
<form id="delete" method="post" action="index.php?action=profile">
<p><label for="old_password">Ancien mot de passe :</label><input type="text" id="old_password" name="old_password" /></p>
<input type="hidden" id="supp" name="supp" value="<?php echo ($profileData['id']); ?>">
<div><input type="submit" name="envoi" value="Supprimer le compte utilisateur" /></div>
</form>
<?php
if ($message !== null) {
echo ("<p>$message</p>");
}
$content = ob_get_clean();
require('dashboard.php');
?><file_sep><?php
require_once( 'model/user.php' );
/****************************
* ----- LOAD SIGNUP PAGE -----
****************************/
function signupPage() {
$user = new stdClass();
$user->id = isset( $_SESSION['user_id'] ) ? $_SESSION['user_id'] : false;
if( !$user->id ):
require('view/auth/signupView.php');
else:
require('view/homeView.php');
endif;
}
/***************************
* ----- SIGNUP FUNCTION -----
***************************/
function IsSignupFormOk( $post ) {
$formData = new stdClass();
$formData->email = $post['email'];
$formData->password = $post['<PASSWORD>'];
$formData->password_confirm = $post['<PASSWORD>_confirm'];
$user = new User( $formData );
$userformData = $user-> createUser();
}<file_sep><?php
require_once('database.php');
class User
{
protected $id;
protected $email;
protected $password;
public function __construct($user = null)
{
if ($user != null) :
$this->setId(isset($user->id) ? $user->id : null);
$this->setEmail($user->email);
$this->setPassword($user->password, isset($user->password_confirm) ? $user->password_confirm : false);
endif;
}
/***************************
* -------- SETTERS ---------
***************************/
public function setId($id)
{
$this->id = $id;
}
public function setEmail($email)
{
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) :
throw new Exception('Email incorrect');
endif;
$this->email = $email;
}
public function setPassword($password, $password_confirm = false)
{
if ($password_confirm && $password != $password_confirm) :
throw new Exception('Vos mots de passes sont différents');
endif;
$this->password = $password;
}
/***************************
* -------- GETTERS ---------
***************************/
public function getId()
{
return $this->id;
}
public function getEmail()
{
return $this->email;
}
public function getPassword()
{
return $this->password;
}
/**********************************
* -------- CREATE NEW USER --------
**********************************/
public function createUser()
{
// db link open
$db = init_db();
// Check if email already exist
$req = $db->prepare("SELECT * FROM user WHERE email = ?");
$req->execute(array($this->getEmail()));
if ($req->rowCount() > 0) throw new Exception("Email ou mot de passe incorrect");
// Insert new user
$req->closeCursor();
$req = $db->prepare("INSERT INTO user ( email, password ) VALUES ( :email, :password )");
$req->execute(array(
'email' => $this->getEmail(),
'password' => $this->getPassword()
));
// db link closed
$db = null;
}
/**************************************
* -------- GET USER DATA BY ID --------
***************************************/
public static function getUserById($id)
{
$db = init_db();
$req = $db->prepare("SELECT * FROM user WHERE id = ?");
$req->execute(array($id));
$db = null;
return $req->fetch();
}
/***************************************
* ------- GET USER DATA BY EMAIL -------
****************************************/
public function getUserByEmail()
{
$db = init_db();
$req = $db->prepare("SELECT * FROM user WHERE email = ?");
$req->execute(array($this->getEmail()));
$db = null;
return $req->fetch();
}
/******************************
* ------- DELETE USER -------
******************************/
public static function deleteUser($password, $old_password)
{
$user = new stdClass();
$user->id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : false;
$db = init_db();
$req = $db->prepare("SELECT password FROM user WHERE id = $user->id");
$req->execute();
$current_password = $req->fetch();
if ($old_password == $current_password[0]) {
$req = $db->prepare("DELETE FROM user WHERE id = $user->id ");
$req->execute();
$req = $db->prepare("DELETE FROM history WHERE user_id = $user->id ");
$req->execute();
$reponse = 'OK';
session_destroy();
} else {
$reponse = 'Ancien mot de passe incorrect';
}
$db = null;
return $reponse;
}
/*********************************
* ------- GET USER HISTORY -------
*********************************/
public static function getHistory($user_id)
{
$db = init_db();
$req = $db->prepare("SELECT * FROM `history`, `media` WHERE history.media_id = media.id AND user_id = " . $user_id);
$req->execute(array('%' . $user_id . '%'));
$db = null;
return $req->fetchAll();
}
/*******************************
* ------- UPDATE HISTORY -------
********************************/
public static function updateHistory($id, $user_id)
{
$db = init_db();
$req = $db->prepare("SELECT * FROM history WHERE media_id = " . $id . " AND user_id = " . $user_id);
$req->execute();
if ($req->fetchAll() == null) { // New media in history
$req = $db->prepare("INSERT INTO `history`(`user_id`, `media_id`, `start_date`) VALUES (" . $user_id . "," . $id . ",'" . date('Y-m-d') . "')");
$req->execute();
} else { // Media already in history
$req = $db->prepare("UPDATE `history` SET `start_date`= " . date('Y-m-d') . " WHERE `id` = " . $id . " AND `user_id` = " . $user_id);
$req->execute();
}
$db = null;
return $req->fetchAll();
}
/***************************************
* ------- DELETE ONE FROM HISTORY -----
**************************************/
public static function deleteMediaFromHistory($history)
{
$user = new stdClass();
$user->id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : false;
$db = init_db();
if ($history == 0) {
$req = $db->prepare("DELETE FROM `history` WHERE user_id = " . $user->id);
$req->execute(array('%' . $history . '%'));
} else {
$req = $db->prepare("DELETE FROM `history` WHERE id = " . $history);
$req->execute(array('%' . $history . '%'));
}
$db = null;
return $req->fetchAll();
}
/***********************************
* ------- UPDATE ACCOUNT INFO -----
***********************************/
public static function UpdateAcountInfo($mail, $password, $old_password)
{
$user = new stdClass();
$user->id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : false;
$db = init_db();
$req = $db->prepare("SELECT password FROM user WHERE id = $user->id");
$req->execute();
$current_password = $req->fetch();
if ($mail !== null) {
$req = $db->prepare("UPDATE user SET email = '$mail' WHERE id = $user->id ");
$req->execute();
$reponse = 'Mail modifié';
}
if ($password !== null) {
if ($old_password == $current_password[0]) {
$reponse = 'Nouveau mot de passe modifié avec succès';
$cryptedPassword = crypt($password, 'SHA-256');
$req = $db->prepare("UPDATE user SET password = '$<PASSWORD>' WHERE id = $user->id");
$req->execute();
} else {
$reponse = 'Ancien mot de passe incorrect';
}
}
$db = null;
return $reponse;
}
}
<file_sep><?php
require_once('model/media.php');
require_once('model/user.php');
function detail()
{
$id = isset($_GET['media']) ? $_GET['media'] : null;
$season_id = isset($_GET['season']) ? $_GET['season'] : null;
$episode_id = isset($_GET['episode']) ? $_GET['episode'] : null;
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : false;
$detail = Media::detailMedias($id);
// UPDATE HISTORY
User::updateHistory($id, $user_id);
// EPISODE SELECTED
if ($episode_id !== null) {
$detailEpisode = Media::detailEpisode($episode_id);
}
// SERIE SELECTED
if ($detail[0]['type'] == 'série') {
$episodes = Media::getEpisodes($id, $season_id);
$tabSeason = Media::getNbSeason($id);
$nbSeason = $tabSeason[0][0];
}
require('view/detailView.php');
}
<file_sep><?php
require_once('database.php');
class Media
{
protected $id;
protected $genre_id;
protected $title;
protected $type;
protected $status;
protected $release_date;
protected $summary;
protected $trailer_url;
public function __construct($media)
{
$this->setId(isset($media->id) ? $media->id : null);
$this->setGenreId($media->genre_id);
$this->setTitle($media->title);
}
/***************************
* -------- SETTERS ---------
***************************/
public function setId($id)
{
$this->id = $id;
}
public function setGenreId($genre_id)
{
$this->genre_id = $genre_id;
}
public function setTitle($title)
{
$this->title = $title;
}
public function setType($type)
{
$this->type = $type;
}
public function setStatus($status)
{
$this->status = $status;
}
public function setReleaseDate($release_date)
{
$this->release_date = $release_date;
}
/***************************
* -------- GETTERS ---------
***************************/
public function getId()
{
return $this->id;
}
public function getGenreId()
{
return $this->genre_id;
}
public function getTitle()
{
return $this->title;
}
public function getType()
{
return $this->type;
}
public function getStatus()
{
return $this->status;
}
public function getReleaseDate()
{
return $this->release_date;
}
public function getSummary()
{
return $this->summary;
}
public function getTrailerUrl()
{
return $this->trailer_url;
}
/***************************
* -------- GET LIST --------
***************************/
// Get filtered media
public static function filterMedias($title)
{
// Open database connection
$db = init_db();
if (isset($_GET['title'])) {
$req = $db->prepare("SELECT * FROM media WHERE title LIKE '%{$title}%' ");
$req->execute(array('%' . $title . '%'));
} else {
$req = $db->prepare("SELECT * FROM media ORDER BY release_date DESC");
$req->execute(array('%' . $title . '%'));
}
// Close databse connection
$db = null;
return $req->fetchAll();
}
/********************************
* ------- GET MEDIA DETAIL -----
********************************/
public static function detailMedias($id)
{
$db = init_db();
$req = $db->prepare("SELECT * FROM media WHERE id = \" " . $id . " \" ");
$req->execute(array('%' . $id . '%'));
$db = null;
return $req->fetchAll();
}
/**********************************
* ------- GET EPISODE DETAIL -----
**********************************/
public static function detailEpisode($id)
{
$db = init_db();
$req = $db->prepare("SELECT * FROM episode WHERE id = \" " . $id . " \" ");
$req->execute(array('%' . $id . '%'));
$db = null;
return $req->fetchAll();
}
/**************************
* ------- GET EPISODES ---
**************************/
public static function getEpisodes($id, $season_id)
{
$db = init_db();
if ($season_id !== null) { // If user selected a season
$req = $db->prepare("SELECT * FROM episode WHERE media_id = " . $id . " AND season = " . $season_id);
$req->execute(array('%' . $id . '%'));
} else { // If not
$req = $db->prepare("SELECT * FROM episode WHERE media_id = " . $id);
$req->execute(array('%' . $id . '%'));
}
$db = null;
return $req->fetchAll();
}
/************************************
* ------- GET SERIE NB SEASONS -----
************************************/
public static function getNbSeason($id)
{
$db = init_db();
$req = $db->prepare("SELECT COUNT(DISTINCT season) FROM episode WHERE media_id = " . $id);
$req->execute(array('%' . $id . '%'));
$db = null;
return $req->fetchAll();
}
}
<file_sep><?php ob_start(); ?>
<div>
<h2> Contactez - nous</h2>
<a href='mailto:<EMAIL>'>
<P>Envoyer un mail</P>
</a>
</div>
<?php
$content = ob_get_clean();
require('dashboard.php');
?><file_sep><?php ob_start(); ?>
<!-- EPISODES INFO -->
<?php if (isset($detailEpisode)) { ?>
<div>
<p><?php echo ($detailEpisode[0]['title']) ?></p>
<p><?php echo ("Saison : " . $detailEpisode[0]['season']) ?></p>
<p><?php echo ("Episode : " . $detailEpisode[0]['episode']) ?></p>
<p><?php echo ($detailEpisode[0]['release_date']) ?></p>
<p><?php echo ($detailEpisode[0]['summary']) ?></p>
</div>
<?php } else { ?>
<!-- MEDIA INFO -->
<div>
<h3><?php echo ($detail[0]['title']) ?></h3>
<p> - <?php echo ($detail[0]['type']) ?></p>
<p> - <?php echo ($detail[0]['status']) ?></p>
<p> - <?php echo ($detail[0]['release_date']) ?></p>
<p> " <?php echo ($detail[0]['summary']) ?> "</p>
<div class="video">
<iframe allowfullscreen="" frameborder="0" src="<?= $detail[0]['trailer_url']; ?>"></iframe>
</div>
</div>
<!-- SEASON -->
<?php }
if ($detail[0]['type'] == 'série' && !isset($detailEpisode)) { ?>
<!-- SELECT SEASON -->
<select name="season" onchange="location = this.value;">
<?php
$i = 1;
// BEFORE SEASON SELECTED
if ($season_id == null) {
echo ('<option selected value="index.php?media=' . $detail[0]["id"] . '">Tout</option>');
while ($i <= $nbSeason) {
echo ('<option value="index.php?media=' . $detail[0]["id"] . '&season=' . $i . '">Saison ' . $i . '</option>');
$i++;
}
// AFTER SEASON SELECTED
} else {
echo ('<option value="index.php?media=' . $detail[0]["id"] . '">Tout</option>');
while ($i <= $nbSeason) {
if ($season_id == $i) {
echo ('<option selected value="index.php?media=' . $detail[0]["id"] . '&season=' . $i . '">Saison ' . $i . '</option>');
} else {
echo ('<option value="index.php?media=' . $detail[0]["id"] . '&season=' . $i . '">Saison ' . $i . '</option>');
}
$i++;
}
}
?>
</select>
<!-- EPISODES LIST -->
<div class="media-list">
<?php foreach ($episodes as $episode) : ?>
<a class="item" href="index.php?media=<?= $detail[0]['id']; ?>&episode=<?= $episode['id']; ?>">
<div class="video">
<div>
<iframe allowfullscreen="" frameborder="0" src="<?= $episode['media_url']; ?>"></iframe>
</div>
</div>
<div class="title"><?= $episode['title']; ?></div>
</a>
<?php endforeach; ?>
</div>
<?php
}
$content = ob_get_clean();
require('dashboard.php');
?> | ecda73c39b823a422ff95ba5709a157f43bc86e6 | [
"SQL",
"PHP"
] | 12 | PHP | Reverse-moT/CodFlix | 019e975b0feb20f40e2f3c585acbe31b3207c5a8 | fc0ac5b49aeb57791ca10a1a243d957880625c34 |
refs/heads/master | <repo_name>kvasnytsyaira/GL_Hibernate_hw1<file_sep>/src/main/java/DAO/DepartmentDAOImpl.java
package DAO;
import model.Department;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import java.util.List;
public class DepartmentDAOImpl implements DAO<Department, Integer> {
private final SessionFactory sessionFactory;
public DepartmentDAOImpl(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public void create(Department department) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
session.saveOrUpdate(department);
//
session.getTransaction().commit();
}
@Override
public Department read(Integer integer) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Department department = session.get(Department.class, integer);
//
session.getTransaction().commit();
return department;
}
@Override
public List readAll() {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Query readAllDepartments = session.createQuery("from Department");
java.util.List listDepartments = readAllDepartments.list();
//
session.getTransaction().commit();
return listDepartments;
}
@Override
public void updateById(Department department) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
session.saveOrUpdate(department);
//
session.getTransaction().commit();
}
@Override
public void delete(Integer integer) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Department department = session.get(Department.class, integer);
Query findWorkersToDelete = session.createQuery("from Worker where departmentId= " + integer);
java.util.List workersToDelete = findWorkersToDelete.list();
for (Object o : workersToDelete) {
session.delete(o);
}
session.delete(department);
//
session.getTransaction().commit();
}
@Override
public void deleteAll() {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Query findWorkersToDelete = session.createQuery("from Worker");
java.util.List workersToDelete = findWorkersToDelete.list();
for (Object o : workersToDelete) {
session.delete(o);
}
Query deleteDepartments = session.createQuery("from Department ");
List departmentsToDelete = deleteDepartments.list();
for (Object o : departmentsToDelete) {
session.delete(o);
}
//
session.getTransaction().commit();
}
}
<file_sep>/src/main/java/DAO/WorkerDAOImpl.java
package DAO;
import model.Worker;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import java.util.List;
public class WorkerDAOImpl implements DAO<Worker, Integer> {
private final SessionFactory sessionFactory;
public WorkerDAOImpl(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public void create(Worker worker) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
session.saveOrUpdate(worker);
//
session.getTransaction().commit();
}
@Override
public Worker read(Integer integer) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Worker worker = session.get(Worker.class, integer);
//
session.getTransaction().commit();
return worker;
}
@Override
public List readAll() {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Query readAll = session.createQuery("from Worker");
java.util.List listWorkers = readAll.list();
//
session.getTransaction().commit();
return listWorkers;
}
@Override
public void updateById(Worker worker) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
session.saveOrUpdate(worker);
//
session.getTransaction().commit();
}
@Override
public void delete(Integer integer) {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Worker worker = session.get(Worker.class, integer);
session.delete(worker);
//
session.getTransaction().commit();
}
@Override
public void deleteAll() {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
//
Query deleteWorkers = session.createQuery("FROM Worker");
List workersToDelete = deleteWorkers.list();
for (Object o : workersToDelete) {
session.delete(o);
}
//
session.getTransaction().commit();
}
}
| 1dcde2684d4cef19e6c26b0d1a0bd0d0ce76660f | [
"Java"
] | 2 | Java | kvasnytsyaira/GL_Hibernate_hw1 | b0130a037d7c1f043dbb56112d009426cebb421e | 736daadc4ad90551449181a3bc49157cc4c07cd2 |
refs/heads/master | <file_sep>package com.hackthenorth.android.model;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.*;
public class Update extends Model implements Comparable<Update> {
private static final String TAG = "Update";
// Fields
public String description;
public String name;
public String time;
public String avatar;
public static Update fromBundle(Bundle bundle) {
Update update = new Update();
update.name = bundle.getString("name", null);
update.description = bundle.getString("description", null);
update.time = bundle.getString("time", null);
update.avatar = bundle.getString("avatar", null);
return update;
}
@Override
public String toString() {
Gson gson = new Gson();
return gson.toJson(this);
}
@Override
public int compareTo(@NonNull Update another) {
return another.id.compareTo(id);
}
}
<file_sep>package com.hackthenorth.android.model;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
public class Prize extends Model implements Comparable<Prize> {
private static final String TAG = "Prize";
public String company;
public String contact;
public String description;
public String name;
// A list of prizes, i.e. [$10k, a chromebook, free tour of the Facebook SF office]
public ArrayList<String> prize;
@Override
public int compareTo(Prize another) {
// Put things without a name at the end of the list.
if (name == null) {
return another.name == null ? 0 : 1;
}
return name.compareTo(another.name);
}
}
<file_sep>package com.hackthenorth.android.ui;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.devspark.robototextview.util.RobotoTypefaceManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.hackthenorth.android.R;
import com.hackthenorth.android.base.BaseActivity;
import com.hackthenorth.android.framework.GCMRegistrationManager;
import com.hackthenorth.android.ui.component.ExplodingImageView;
import com.hackthenorth.android.ui.component.PagerTitleStrip;
import com.hackthenorth.android.ui.component.TextView;
import com.hackthenorth.android.ui.settings.SettingsActivity;
import com.readystatesoftware.systembartint.SystemBarTintManager;
public class MainActivity extends BaseActivity implements View.OnTouchListener {
private static final String TAG = "MainActivity";
private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
private ViewPagerAdapter mViewPagerAdapter;
private PagerTitleStrip mViewPagerTabs;
private ViewPager mViewPager;
// ActionBar menu items
private MenuItem mSettingsMenuItem;
// Action bar state
private static final int ACTION_BAR_STATE_NORMAL = 0;
private static final int ACTION_BAR_STATE_SEARCH = 1;
private int actionBarState;
// Search animation state
private static final int ACTION_NONE = 0;
private static final int ACTION_APPEAR = 1;
private static final int ACTION_DISAPPEAR = 2;
private int currentAction = ACTION_NONE;
private int nextAction = ACTION_NONE;
private static final int DURATION = 200;
private ExplodingImageView mSearchButton;
private ExplodingImageView mCancelButton;
private TextView mTitle;
private EditText mSearchBox;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Resources resources = getResources();
LayoutInflater inflater = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.titleview, null);
mTitle = (TextView) view.findViewById(R.id.title);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/bebas_neue.ttf");
mTitle.setTypeface(tf);
mTitle.setText(resources.getString(R.string.app_name).toUpperCase());
mSearchBox = (EditText)view.findViewById(R.id.searchBox);
// This action is run when the user clicks the "search" button on the keyboard.
mSearchBox.setOnEditorActionListener(new android.widget.TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(android.widget.TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
if (mViewPagerAdapter != null) {
Fragment f = mViewPagerAdapter.getItem(mViewPager.getCurrentItem());
if (f instanceof MentorsFragment) {
// MentorsFragment has two adapters: a regular adapter, and an adapter
// for the search items list. We get the search adapter, and make the
// query on that adapter.
MentorsFragment mentorsFragment = (MentorsFragment)f;
MentorListAdapter adapter = mentorsFragment.getSearchAdapter();
if (adapter != null) {
adapter.query(mSearchBox.getText().toString());
}
// dismiss the keyboard
InputMethodManager imm = (InputMethodManager)
getSystemService(Service.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearchBox.getWindowToken(), 0);
return true;
}
}
}
return false;
}
});
// Send the queries as the user is typing
mSearchBox.addTextChangedListener(new TextWatcher() {
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override public void afterTextChanged(Editable s) { }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (mViewPagerAdapter != null) {
Fragment f = mViewPagerAdapter.getItem(mViewPager.getCurrentItem());
if (f instanceof MentorsFragment) {
MentorsFragment mentorsFragment = (MentorsFragment)f;
MentorListAdapter adapter = mentorsFragment.getSearchAdapter();
if (adapter != null) {
adapter.query(mSearchBox.getText().toString());
}
}
}
}
});
mSearchButton = (ExplodingImageView)view.findViewById(R.id.searchButton);
mCancelButton = (ExplodingImageView)view.findViewById(R.id.cancelButton);
mSearchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startSearchBarAction(ACTION_APPEAR);
}
});
mCancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startSearchBarAction(ACTION_DISAPPEAR);
}
});
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setCustomView(view);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(resources.getColor(R.color.blue));
tintManager.setNavigationBarTintEnabled(true);
tintManager.setNavigationBarTintColor(resources.getColor(R.color.blue));
mViewPagerAdapter = new ViewPagerAdapter(this, getFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mViewPagerAdapter);
mViewPagerTabs = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
mViewPagerTabs.setTypeface(RobotoTypefaceManager.obtainTypeface(
this, RobotoTypefaceManager.Typeface.ROBOTO_REGULAR), 0);
mViewPagerTabs.setViewPager(mViewPager);
mViewPagerTabs.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override public void onPageScrolled(int i, float v, int i2) { }
@Override public void onPageScrollStateChanged(int i) {
}
@Override
public void onPageSelected(int i) {
// When the fragment page changes, reload the options menu.
updateOptionsMenu();
}
});
if (checkPlayServices()) {
if (GCMRegistrationManager.getRegistrationId(this) == null) {
// Register with GCM
GCMRegistrationManager.registerInBackground(this);
}
}
}
@Override
public void onResume() {
super.onResume();
checkPlayServices();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
// Save menu items
mSettingsMenuItem = menu.findItem(R.id.action_settings);
if (mViewPager == null || !searchable(mViewPager.getCurrentItem())) {
mSearchButton.setVisibility(View.GONE);
}
// Mmmmmm boilerplate
mSettingsMenuItem.getActionView().setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) { onOptionsItemSelected(mSettingsMenuItem); }
});
return super.onCreateOptionsMenu(menu);
}
private void updateOptionsMenu() {
// Show / hide the search button
switch (mViewPager.getCurrentItem()) {
case ViewPagerAdapter.UPDATES_POSITION:
case ViewPagerAdapter.SCHEDULE_POSITION:
case ViewPagerAdapter.PRIZES_POSITION:
case ViewPagerAdapter.TEAM_POSITION:
if (actionBarState == ACTION_BAR_STATE_NORMAL) {
mSearchButton.setExplodingVisibility(View.GONE);
} else {
startSearchBarAction(ACTION_DISAPPEAR);
}
break;
case ViewPagerAdapter.MENTORS_POSITION:
if (actionBarState == ACTION_BAR_STATE_NORMAL) {
mSearchButton.setExplodingVisibility(View.VISIBLE);
}
break;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch (id) {
case R.id.action_settings:
startActivity(new Intent(this, SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
// Copied from the GCM Client tutorial [1].
// [1]: https://developer.android.com/google/gcm/client.html
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Toast.makeText(this, "You must have Play Services to use this app.",
Toast.LENGTH_SHORT).show();
finish();
}
return false;
}
return true;
}
@Override
public void onBackPressed() {
// If we are in a searching state, go back to the normal state.
// Otherwise just close the activity as usual.
if (actionBarState == ACTION_BAR_STATE_SEARCH) {
startSearchBarAction(ACTION_DISAPPEAR);
} else {
super.onBackPressed();
}
}
/**
* Returns true iff the position corresponds to a fragment that is searchable.
*/
private boolean searchable(int position) {
return position == ViewPagerAdapter.MENTORS_POSITION;
}
private void startSearchBarAction(int action) {
if (action == ACTION_APPEAR && actionBarState == ACTION_BAR_STATE_NORMAL) {
if (currentAction == ACTION_NONE) {
// Start the search bar animation!
currentAction = ACTION_APPEAR;
searchBarAppear();
} else if (currentAction == ACTION_APPEAR && nextAction == ACTION_DISAPPEAR) {
// Cancel the pending disappear action
nextAction = ACTION_NONE;
} else if (currentAction == ACTION_DISAPPEAR) {
// Oh, rats! We have an appear action but we already started disappearing.
// Queue up the appear action.
nextAction = ACTION_APPEAR;
}
} else if (action == ACTION_DISAPPEAR && actionBarState == ACTION_BAR_STATE_SEARCH) {
if (currentAction == ACTION_NONE) {
// Disappear!
currentAction = ACTION_DISAPPEAR;
searchBarDisappear();
} else if (currentAction == ACTION_DISAPPEAR && nextAction == ACTION_DISAPPEAR) {
// Cancel the pending appear action
nextAction = ACTION_NONE;
} else if (currentAction == ACTION_APPEAR) {
// We're currently appearing, so we have to disappear when we finish.
nextAction = ACTION_DISAPPEAR;
}
}
}
private void searchBarAppear() {
Fragment f = mViewPagerAdapter.getItem(mViewPager.getCurrentItem());
if (f instanceof MentorsFragment) {
MentorsFragment mentorsFragment = (MentorsFragment)f;
mentorsFragment.startSearch();
}
//
// Icon / Title / Settings button disappear animation
//
actionBarState = ACTION_BAR_STATE_SEARCH;
AlphaAnimation alpha = new AlphaAnimation(1f, 0f);
alpha.setInterpolator(new DecelerateInterpolator());
alpha.setDuration(DURATION);
alpha.setFillAfter(true);
TranslateAnimation translate = new TranslateAnimation(
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.RELATIVE_TO_SELF, -0.5f);
translate.setInterpolator(new DecelerateInterpolator());
translate.setDuration(DURATION);
AnimationSet set = new AnimationSet(false);
set.addAnimation(translate);
set.addAnimation(alpha);
set.setAnimationListener(new Animation.AnimationListener() {
@Override public void onAnimationStart(Animation animation) {}
@Override public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
// Don't ever have the title be *gone*, because then we get issues with
// the custom view clipping child bounds (it's the parent of the custom
// view that does it, so we can't really fix it nicely).
mTitle.setVisibility(View.INVISIBLE);
mSettingsMenuItem.getActionView().setVisibility(View.GONE);
}
});
mSettingsMenuItem.getActionView().startAnimation(set);
mTitle.startAnimation(set);
//
// Search icon animation
// Big comment because this is a lot of code
//
int[] xy = new int[2];
mSearchButton.getLocationOnScreen(xy);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)
mSearchButton.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 1);
mSearchButton.setLayoutParams(params);
translate = new TranslateAnimation(
Animation.ABSOLUTE, xy[0],
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f);
translate.setInterpolator(new AccelerateDecelerateInterpolator());
translate.setDuration(3 * DURATION / 2);
translate.setAnimationListener(new Animation.AnimationListener() {
@Override public void onAnimationStart(Animation animation) { }
@Override public void onAnimationRepeat(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation) {
// This is a little more subtle than other parts of this code. If the next
// action is DISAPPEAR, we don't want to show the cancel button at all.
// However, we also have to check the state again, or else we can get into
// a bad state if the user cancels after the cancel button starts animating.
if (nextAction == ACTION_DISAPPEAR) {
currentAction = nextAction;
nextAction = ACTION_NONE;
searchBarDisappear();
} else {
// Show the cancel button, then do all the state stuff and show the
// keyboard. We do it this way because we get animation jank if we
// show the keyboard at the same time as our animations.
mCancelButton.setExplodingVisibility(View.VISIBLE, new AnimationListener() {
@Override public void onAnimationStart(Animation animation) { }
@Override public void onAnimationRepeat(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation) {
currentAction = ACTION_NONE;
if (nextAction == ACTION_DISAPPEAR) {
currentAction = nextAction;
nextAction = ACTION_NONE;
searchBarDisappear();
} else {
mSearchBox.setVisibility(View.VISIBLE);
if (mSearchBox.requestFocus()) {
InputMethodManager imm = (InputMethodManager)
getSystemService(Service.INPUT_METHOD_SERVICE);
imm.showSoftInput(mSearchBox, 0);
}
}
}
});
}
}
});
mSearchButton.startAnimation(translate);
}
private void searchBarDisappear() {
Fragment f = mViewPagerAdapter.getItem(ViewPagerAdapter.MENTORS_POSITION);
if (f instanceof MentorsFragment) {
MentorsFragment mentorsFragment = (MentorsFragment)f;
mentorsFragment.endSearch();
}
mCancelButton.setVisibility(View.GONE);
// The user may have switched to a non-searchable fragment, in which case we
// shouldn't show the search menu item.
boolean showSearchButton = searchable(mViewPager.getCurrentItem());
mTitle.setVisibility(View.VISIBLE);
mSearchButton.setVisibility(View.VISIBLE);
mSettingsMenuItem.getActionView().setVisibility(View.VISIBLE);
mSearchBox.setVisibility(View.GONE);
actionBarState = ACTION_BAR_STATE_NORMAL;
// Set up animations for the title and the settings button to disappear
AlphaAnimation alpha = new AlphaAnimation(0f, 1f);
alpha.setInterpolator(new AccelerateInterpolator());
alpha.setDuration(DURATION);
alpha.setFillAfter(true);
TranslateAnimation translate = new TranslateAnimation(
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.RELATIVE_TO_SELF, -1f,
Animation.ABSOLUTE, 0f);
translate.setInterpolator(new AccelerateInterpolator());
AnimationSet set = new AnimationSet(false);
if (showSearchButton) {
translate.setDuration(DURATION / 2);
set.setStartOffset(DURATION);
} else {
translate.setDuration(3 * DURATION / 2);
alpha.setDuration(3 * DURATION / 2);
// Otherwise, we should handle all the state changes in the listener here.
set.setAnimationListener(new Animation.AnimationListener() {
@Override public void onAnimationStart(Animation animation) { }
@Override public void onAnimationRepeat(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation) {
currentAction = ACTION_NONE;
if (nextAction == ACTION_APPEAR) {
currentAction = nextAction;
nextAction = ACTION_NONE;
searchBarAppear();
} else {
// Hide the keyboard
InputMethodManager imm = (InputMethodManager)
getSystemService(Service.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearchBox.getWindowToken(), 0);
}
}
});
}
set.addAnimation(translate);
set.addAnimation(alpha);
mSettingsMenuItem.getActionView().startAnimation(set);
mTitle.startAnimation(set);
//
// Search icon animation
// Big comment because this is a lot of code
//
// If we're going to show the search button...
if (showSearchButton) {
// First, let's change the relative layout things back.
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)
mSearchButton.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1);
mSearchButton.setLayoutParams(params);
mSearchButton.setPadding(
mSearchButton.getPaddingLeft(),
mSearchButton.getPaddingTop(),
mSearchButton.getPaddingRight(),
mSearchButton.getPaddingBottom());
// We use a predraw listener here because we need to measure where the icon
// *would* be if it were aligned to the right side of the parent before we can
// animate it to that position.
mSearchButton.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
int[] xy = new int[2];
mSearchButton.getLocationOnScreen(xy);
TranslateAnimation translate = new TranslateAnimation(
Animation.ABSOLUTE, -xy[0],
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f);
translate.setInterpolator(new AccelerateDecelerateInterpolator());
translate.setDuration(3 * DURATION / 2);
mSearchButton.startAnimation(translate);
translate.setAnimationListener(new Animation.AnimationListener() {
@Override public void onAnimationStart(Animation animation) { }
@Override public void onAnimationRepeat(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation) {
currentAction = ACTION_NONE;
if (nextAction == ACTION_APPEAR) {
currentAction = nextAction;
nextAction = ACTION_NONE;
searchBarAppear();
} else {
// Hide the keyboard
InputMethodManager imm = (InputMethodManager)
getSystemService(Service.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearchBox.getWindowToken(), 0);
}
}
});
// Remove the pre draw listener---we only want this to happen once.
mSearchButton.getViewTreeObserver().removeOnPreDrawListener(this);
return false;
}
});
} else {
// This is the case where we don't want to show the search button when the
// animation is over. We'll just fade it out to the bottom, in a similar way
// that the title etc. are fading in from the top.
alpha = new AlphaAnimation(1f, 0f);
alpha.setInterpolator(new AccelerateInterpolator());
alpha.setDuration(3 * DURATION / 2);
alpha.setFillAfter(true);
translate = new TranslateAnimation(
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.ABSOLUTE, 0f,
Animation.RELATIVE_TO_SELF, 1f);
translate.setInterpolator(new AccelerateInterpolator());
translate.setDuration(3 * DURATION / 2);
set = new AnimationSet(false);
set.addAnimation(translate);
set.addAnimation(alpha);
final Activity activity = this;
set.setAnimationListener(new Animation.AnimationListener() {
@Override public void onAnimationStart(Animation animation) { }
@Override public void onAnimationRepeat(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation) {
mSearchButton.setVisibility(View.GONE);
// Change the relative layout things back.
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)
mSearchButton.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1);
mSearchButton.setLayoutParams(params);
}
});
mSearchButton.startAnimation(set);
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
// dismiss the keyboard
InputMethodManager imm = (InputMethodManager)
getSystemService(Service.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mSearchBox.getWindowToken(), 0);
}
return false;
}
}
<file_sep>package com.hackthenorth.android.ui.component;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Region;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import com.hackthenorth.android.R;
import com.hackthenorth.android.util.Units;
import java.util.ArrayList;
import java.util.WeakHashMap;
public class HexagonRippleView extends RippleView {
private static final String TAG = "HexagonRippleView";
ArrayList<RegularHexagon> mHexagons = new ArrayList<RegularHexagon>();
public HexagonRippleView(Context context) {
this(context, null, 0);
}
public HexagonRippleView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public HexagonRippleView(Context context, AttributeSet attrs, int idk) {
super(context, attrs, idk);
}
@Override
public void onSizeChanged(int w, int h, int oldWidth, int oldHeight) {
initializeHexagons(w, h, oldWidth, oldHeight);
}
private void initializeHexagons(int w, int h, int ow, int oh) {
// Set the ripple radius and duration
if (w != ow || h != oh) {
// Clear the hexagons
mHexagons.clear();
// The radius of the bounding circle of the hexagon
double radius = Units.dpToPx(getContext(), 50);
// The length of the shortest line segment where one endpoint is the center
// and the other resides on the boundary of the hexagon
double smallRadius = Math.sqrt(radius * radius * 3.0d / 4.0d);
boolean stagger = false;
double vadjust = Units.dpToPx(getContext(), 0.0d);
double hadjust = (radius * radius) / (250.0d * 250.0d);
for (double i = 0; i < h + radius; i += smallRadius + vadjust) {
double j = 0.0d;
if (stagger) {
j = (int) (2 * smallRadius * Math.cos(11 * Math.PI / 6));
}
for (; j < w + radius; j += 3 * radius) {
if (stagger) {
j += hadjust;
}
mHexagons.add(new RegularHexagon(j, i, radius));
}
stagger = !stagger;
}
}
}
protected void drawRipple(@NonNull final Canvas canvas) {
Paint red = new Paint();
red.setColor(android.graphics.Color.RED);
red.setStyle(Paint.Style.FILL_AND_STROKE);
canvas.clipRect(getPaddingLeft(), getPaddingTop(),
getWidth() - getPaddingRight(),
getHeight() - getPaddingBottom(),
Region.Op.REPLACE);
// Calculate the new color
int color = Color.argb(0, 0, 0, 0);
for (Animator animator : animatorSet) {
color = composeColors(color, animator.paint.getColor());
}
// Draw once using that new color.
for (Animator animator : animatorSet) {
Paint paint = new Paint(animator.paint);
paint.setColor(color);
canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
break;
}
for (RegularHexagon hexagon : mHexagons) {
// Repeat the process here for each hexagon
color = Color.argb(0, 0, 0, 0);
for (Animator animator : animatorSet) {
double d = dist(animator.x, animator.y, hexagon.x, hexagon.y);
if (d - 100 < animator.radius) {
int hexRGB = hexagon.getColor(getContext(), animator);
int hexColor = Color.argb(animator.paint.getAlpha(),
Color.red(hexRGB), Color.green(hexRGB), Color.blue(hexRGB));
color = composeColors(color, hexColor);
}
}
// Build the paint and draw once.
for (Animator animator : animatorSet) {
Paint paint = new Paint(animator.paint);
paint.setColor(color);
hexagon.draw(canvas, paint);
break;
}
}
}
public static String hex(int n) {
// call toUpperCase() if that's required
return String.format("0x%8s", Integer.toHexString(n)).replace(' ', '0');
}
private int composeColors(int col1, int col2) {
// reference: http://en.wikipedia.org/wiki/Alpha_compositing
float a_1 = (float)Color.alpha(col1) / 255f;
float a_2 = (float)Color.alpha(col2) / 255f;
// calculate the alpha of the composed color
float alpha = a_1 + a_2 * (1 - a_1);
// calculate the RGB values
float red = (1f / alpha) * ((Color.red(col1) * a_1) + (Color.red(col2) * a_2 * (1f - a_1)));
float green = (1f / alpha) * ((Color.green(col1) * a_1) + (Color.green(col2) * a_2 * (1f - a_1)));
float blue = (1f / alpha) * ((Color.blue(col1) * a_1) + (Color.blue(col2) * a_2 * (1f - a_1)));
red = Float.isNaN(red) ? 0 : red;
green = Float.isNaN(green) ? 0 : green;
blue = Float.isNaN(blue) ? 0 : blue;
int result = Color.argb((int) (255 * alpha), (int) red, (int) green, (int) blue);
return result;
}
private double dist(double x1, double y1, double x2, double y2) {
double dx = x1 - x2;
double dy = y1 - y2;
return Math.sqrt(dx*dx+dy*dy);
}
private static class Point {
public double x;
public double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
}
// __
// / \
// \__/
//
private static class RegularHexagon {
// Center and radius of bounding circle
public double x;
public double y;
public double radius;
public WeakHashMap<Animator, Integer> colors = new WeakHashMap<Animator, Integer>();
public RegularHexagon(double x, double y, double radius) {
this.x = x;
this.y = y;
this.radius = radius;
}
public String toString() {
return String.format("(%f,%f):%f", x, y, radius);
}
public ArrayList<Point> getPoints() {
ArrayList<Point> results = new ArrayList<Point>(6);
for (int i = 0; i < 6; i++) {
double px = x + Math.cos(i * Math.PI / 3) * radius;
double py = y + Math.sin(i * Math.PI / 3) * radius;
results.add(new Point(px, py));
}
return results;
}
public int getColor(Context context, Animator animator) {
Integer color = colors.get(animator);
if (color == null) {
color = Math.round(4 * Math.random()) % 4 == 0 ?
context.getResources().getColor(R.color.blue) :
context.getResources().getColor(R.color.background_gray);
colors.put(animator, color);
}
return color;
}
public void draw(Canvas canvas, Paint paint) {
paint.setStrokeWidth(1);
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(false);
Path path = new Path();
path.setFillType(Path.FillType.EVEN_ODD);
ArrayList<Point> points = getPoints();
Point start = points.get(0);
path.moveTo((float)start.x, (float)start.y);
for (int i = 1; i < points.size(); i++) {
Point point = points.get(i);
path.lineTo((float)point.x, (float)point.y);
}
path.lineTo((float)start.x, (float)start.y);
path.close();
canvas.drawPath(path, paint);
}
}
}
<file_sep>package com.hackthenorth.android.ui;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.provider.CalendarContract.Events;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gson.reflect.TypeToken;
import com.hackthenorth.android.HackTheNorthApplication;
import com.hackthenorth.android.R;
import com.hackthenorth.android.base.BaseListFragment;
import com.hackthenorth.android.framework.HTTPFirebase;
import com.hackthenorth.android.model.Instruction;
import com.hackthenorth.android.model.Model;
import com.hackthenorth.android.model.ScheduleItem;
import com.hackthenorth.android.ui.dialog.ConfirmDialogFragment;
import com.hackthenorth.android.util.DateFormatter;
import com.hackthenorth.android.ui.dialog.ConfirmDialogFragment.ConfirmDialogFragmentListener;
import com.nhaarman.listviewanimations.appearance.simple.AlphaInAnimationAdapter;
/**
* A fragment for displaying lists of Update.
*/
public class ScheduleFragment extends BaseListFragment
implements ConfirmDialogFragmentListener {
public static final String TAG = "ScheduleFragment";
public static final String CONFIRM_DIALOG_TAG = "ConfirmDialog";
public static final String CONFIRM_DIALOG_POSITION_KEY = "position";
private ListView mListView;
private ScheduleFragmentAdapter mAdapter;
private ArrayList<Model> mData = new ArrayList<Model>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Keep a static cache of the arraylist, because decoding from JSON every time is
// a waste.
String key = ViewPagerAdapter.SCHEDULE_TAG;
Object thing = getCachedObject(key);
if (thing != null) {
mData = (ArrayList<Model>)thing;
} else {
setCachedObject(key, mData);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// Register for updates
registerForSync(activity, HackTheNorthApplication.Actions.SYNC_SCHEDULE);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the view and return it
View view = inflater.inflate(R.layout.list_fragment_cards, container, false);
// Set up adapter
mAdapter = new ScheduleFragmentAdapter(inflater.getContext(), R.layout.schedule_list_item,
mData);
mAdapter.setFragment(this);
// Save a reference to the list view
mListView = (ListView) view.findViewById(android.R.id.list);
// Animation adapter
AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(mAdapter);
animationAdapter.setAbsListView(mListView);
mListView.setAdapter(animationAdapter);
return view;
}
@Override
public void onResume() {
super.onResume();
// Re-GET data from Firebase here
if (getActivity() != null) {
HTTPFirebase.GET("/schedule", getActivity(),
HackTheNorthApplication.Actions.SYNC_SCHEDULE);
}
}
@Override
public void onPositiveClick(ConfirmDialogFragment fragment) {
// Get the email intent from the ScheduleFragmentAdapter and start it.
int position = fragment.getArguments().getInt(CONFIRM_DIALOG_POSITION_KEY);
startActivity(mAdapter.getIntent(position));
}
@Override
public void onNegativeClick(ConfirmDialogFragment fragment) {
// Do nothing
}
@Override
protected void handleJSONUpdateInBackground(final String json, String actio) {
final Activity activity = getActivity();
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... nothing) {
// Decode JSON
final ArrayList<ScheduleItem> newData = new ArrayList<ScheduleItem>();
ScheduleItem.loadArrayListFromJSON(newData, new TypeToken<HashMap<String, ScheduleItem>>(){},
json);
if (activity != null && mAdapter != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
// Copy the data into the ListView on the main thread and
// refresh.
mData.clear();
mData.addAll(newData);
mAdapter.notifyDataSetChanged();
}
});
}
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public static class ScheduleFragmentAdapter extends ArrayAdapter<Model> {
private int mResource;
private ArrayList<Model> mData;
private Fragment mFragment;
public ScheduleFragmentAdapter(Context context, int resource,
ArrayList<Model> objects) {
super(context, resource, objects);
mResource = resource;
mData = objects;
}
public void setFragment(Fragment fragment) {
mFragment = fragment;
}
public View getView(final int position, View convertView, ViewGroup parent) {
// Get the data for this position
Model model = mData.get(position);
if (model instanceof ScheduleItem) {
final ScheduleItem scheduleItem = (ScheduleItem) model;
if (convertView == null ||
convertView.getId() != R.id.schedule_list_item) {
// If we don't have a view to reuse, inflate a new one.
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(mResource, parent, false);
}
// Set up the click event
final Intent intent = getIntent(position);
final Context context = convertView.getContext();
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Resources res = context.getResources();
String title = res.getString(R.string.calendar_dialog_title);
String message = String.format(res.getString(R.string.calendar_dialog_message),
scheduleItem.name);
String yes = res.getString(R.string.dialog_button_yes);
String cancel = res.getString(R.string.dialog_button_cancel);
ConfirmDialogFragment dialog = ConfirmDialogFragment.getInstance(
title, message, yes, cancel);
// Set the target fragment for the callback
dialog.setTargetFragment(mFragment, 0);
// Keep track of the position here so the fragment knows which
// intent to send off.
Bundle args = dialog.getArguments();
args.putInt(CONFIRM_DIALOG_POSITION_KEY, position);
dialog.setArguments(args);
// Add the dialog to the fragment.
dialog.show(mFragment.getFragmentManager(), CONFIRM_DIALOG_TAG);
}
});
convertView.findViewById(R.id.schedule_item_type)
.setBackgroundDrawable(getIndicator(scheduleItem.type));
((TextView) convertView.findViewById(R.id.schedule_item_name))
.setText(scheduleItem.name);
((TextView) convertView.findViewById(R.id.schedule_item_speaker))
.setText(scheduleItem.speaker);
// Make the description disappear if there is no text
TextView locationText = (TextView)convertView.findViewById(R.id.schedule_item_location);
if (TextUtils.isEmpty(scheduleItem.location)) {
locationText.setVisibility(View.GONE);
} else {
locationText.setVisibility(View.VISIBLE);
locationText.setText(scheduleItem.location);
}
ArrayList<String> times = new ArrayList<String>();
times.add(scheduleItem.start_time);
times.add(scheduleItem.end_time);
((TextView) convertView.findViewById(R.id.schedule_item_time))
.setText(DateFormatter.getTimespanString(times));
// Make the description disappear if there is no text
TextView descriptionText = (TextView)convertView.findViewById(R.id.schedule_item_description);
if (TextUtils.isEmpty(scheduleItem.description)) {
descriptionText.setVisibility(View.GONE);
} else {
descriptionText.setVisibility(View.VISIBLE);
descriptionText.setText(scheduleItem.description);
}
// Make the speaker disappear if there is no text
Resources res = context.getResources();
TextView speakerText = (TextView)convertView.findViewById(R.id.schedule_item_speaker);
if (TextUtils.isEmpty(scheduleItem.speaker)) {
speakerText.setVisibility(View.GONE);
} else {
speakerText.setVisibility(View.VISIBLE);
speakerText.setText(scheduleItem.speaker);
}
if (speakerText.getVisibility() != View.VISIBLE &&
descriptionText.getVisibility() != View.VISIBLE) {
// Hide the holder if both things are invisible, so that we don't see the extra
// margin
convertView.findViewById(R.id.schedule_item_description_holder)
.setVisibility(View.GONE);
} else {
convertView.findViewById(R.id.schedule_item_description_holder)
.setVisibility(View.VISIBLE);
}
} else if (model instanceof Instruction) {
final Instruction instruction = (Instruction) model;
if (convertView == null ||
convertView.getId() != R.id.instruction_list_item) {
// If we don't have a view to reuse, inflate a new one.
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.instruction_list_item, parent, false);
}
}
return convertView;
}
public Intent getIntent(int position) {
Model model = mData.get(position);
if (!(model instanceof ScheduleItem)) {
return null;
}
ScheduleItem item = (ScheduleItem) model;
SimpleDateFormat format = DateFormatter.getISO8601SimpleDateFormat();
Date start = null, end = null;
try {
start = format.parse(item.start_time);
end = format.parse(item.end_time);
} catch (ParseException e) {
e.printStackTrace();
}
Intent result = null;
if (start != null && end != null) {
result = new Intent(Intent.ACTION_INSERT)
.setType("vnd.android.cursor.item/event")
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, start.getTime())
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end.getTime())
.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, false)
.putExtra(Events.TITLE, item.name)
.putExtra(Events.DESCRIPTION, item.description)
.putExtra(Events.EVENT_LOCATION, item.location)
.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY)
.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE);
}
return result;
}
public Drawable getIndicator(String type) {
Resources res = getContext().getResources();
Drawable indicator = res.getDrawable(R.drawable.schedule_item_type);
if (type.equals(ScheduleItem.TYPE_EVENT)) {
indicator.setColorFilter(res.getColor(R.color.blue_dark), PorterDuff.Mode.MULTIPLY);
} else if (type.equals(ScheduleItem.TYPE_WORKSHOP)) {
indicator.setColorFilter(res.getColor(R.color.workshop), PorterDuff.Mode.MULTIPLY);
} else if (type.equals(ScheduleItem.TYPE_TALK)) {
indicator.setColorFilter(res.getColor(R.color.talk), PorterDuff.Mode.MULTIPLY);
} else if (type.equals(ScheduleItem.TYPE_SPEAKER)) {
indicator.setColorFilter(res.getColor(R.color.speaker), PorterDuff.Mode.MULTIPLY);
} else if (type.equals(ScheduleItem.TYPE_UPDATE)) {
indicator.setColorFilter(res.getColor(R.color.update), PorterDuff.Mode.MULTIPLY);
} else if (type.equals(ScheduleItem.TYPE_FOOD)) {
indicator.setColorFilter(res.getColor(R.color.food), PorterDuff.Mode.MULTIPLY);
}
return indicator;
}
public int getCount() {
return mData.size();
}
}
}
<file_sep>package com.hackthenorth.android.ui.settings;
import android.app.ActionBar;
import android.app.Fragment;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import com.hackthenorth.android.R;
import com.hackthenorth.android.ui.component.TextView;
import com.readystatesoftware.systembartint.SystemBarTintManager;
public class SettingsActivity extends PreferenceActivity {
private static final String SETTINGS_FRAGMENT_TAG = "settingsFragment";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Resources resources = getResources();
LayoutInflater inflater = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.titleview, null);
TextView title = (TextView)view.findViewById(R.id.title);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/bebas_neue.ttf");
title.setTypeface(tf);
title.setText(resources.getString(R.string.settings_activity).toUpperCase());
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setCustomView(view);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(resources.getColor(R.color.blue));
tintManager.setNavigationBarTintEnabled(true);
tintManager.setNavigationBarTintColor(resources.getColor(R.color.blue));
Fragment settingsFragment = new SettingsFragment();
getFragmentManager().beginTransaction()
.add(android.R.id.content, settingsFragment, SETTINGS_FRAGMENT_TAG)
.commit();
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int id = menuItem.getItemId();
switch (id) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(menuItem);
}
}
<file_sep>package com.hackthenorth.android.ui;
import android.app.Activity;
import android.app.Fragment;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.volley.toolbox.NetworkImageView;
import com.hackthenorth.android.HackTheNorthApplication;
import com.hackthenorth.android.R;
import com.hackthenorth.android.framework.HTTPFirebase;
import com.hackthenorth.android.framework.NetworkManager;
public class SponsorsFragment extends Fragment {
private static final String TAG = "SponsorsFragment";
private BroadcastReceiver mReceiver;
private NetworkImageView mImage;
private String mUrl;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (mReceiver == null) {
mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String response = intent.getStringExtra(
HackTheNorthApplication.Actions.SYNC_SPONSORS);
// strip the quotes from the response (it's a JSON string)
mUrl = response.substring(1, response.length()-1);
setImageUrlWhenReady();
}
};
// Register our broadcast receiver.
IntentFilter filter = new IntentFilter();
filter.addAction(HackTheNorthApplication.Actions.SYNC_SPONSORS);
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(activity);
manager.registerReceiver(mReceiver, filter);
}
HTTPFirebase.GET("/sponsors", activity, HackTheNorthApplication.Actions.SYNC_SPONSORS);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the view and return it
View view = inflater.inflate(R.layout.sponsors_fragment, container, false);
mImage = (NetworkImageView)view.findViewById(R.id.image);
setImageUrlWhenReady();
return view;
}
private void setImageUrlWhenReady() {
if (mUrl != null && mImage != null) {
mImage.setImageUrl(mUrl, NetworkManager.getImageLoader());
}
}
}
<file_sep>package com.hackthenorth.android.ui;
import android.app.Activity;
import android.app.DialogFragment;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.google.gson.reflect.TypeToken;
import com.hackthenorth.android.HackTheNorthApplication;
import com.hackthenorth.android.R;
import com.hackthenorth.android.base.BaseListFragment;
import com.hackthenorth.android.framework.HTTPFirebase;
import com.hackthenorth.android.model.Model;
import com.hackthenorth.android.model.Prize;
import com.hackthenorth.android.ui.component.TextView;
import com.hackthenorth.android.ui.dialog.ConfirmDialogFragment;
import com.hackthenorth.android.ui.dialog.ConfirmDialogFragment.ConfirmDialogFragmentListener;
import com.hackthenorth.android.ui.dialog.IntentChooserDialogFragment;
import com.nhaarman.listviewanimations.appearance.simple.AlphaInAnimationAdapter;
import java.util.ArrayList;
import java.util.HashMap;
public class PrizesFragment extends BaseListFragment implements
ConfirmDialogFragmentListener {
public static final String TAG = "PrizesFragment";
public static final String CONFIRM_DIALOG_TAG = "ConfirmDialog";
public static final String CONFIRM_DIALOG_POSITION_KEY = "position";
private static final String INTENT_CHOOSER_DIALOG_FRAGMENT = "intentChooserDialogFragment";
private ListView mListView;
private ArrayList<Prize> mData = new ArrayList<Prize>();
private PrizesFragmentAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Keep a static cache of the arraylist, because decoding from JSON every time is
// a waste.
String key = ViewPagerAdapter.PRIZES_TAG;
Object thing = getCachedObject(key);
if (thing != null) {
mData = (ArrayList<Prize>)thing;
} else {
setCachedObject(key, mData);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
registerForSync(activity, HackTheNorthApplication.Actions.SYNC_PRIZES);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the view and return it
View view = inflater.inflate(R.layout.list_fragment_cards, container, false);
mAdapter = new PrizesFragmentAdapter(inflater.getContext(), R.layout.prizes_list_item,
mData);
mAdapter.setFragment(this);
// Set up list
mListView = (ListView) view.findViewById(android.R.id.list);
// Animation adapter
AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(mAdapter);
animationAdapter.setAbsListView(mListView);
mListView.setAdapter(animationAdapter);
return view;
}
@Override
public void onResume() {
super.onResume();
// Re-GET data from Firebase here
if (getActivity() != null) {
HTTPFirebase.GET("/prizes", getActivity(),
HackTheNorthApplication.Actions.SYNC_PRIZES);
}
}
@Override
protected void handleJSONUpdateInBackground(final String json, String action) {
final Activity activity = getActivity();
new AsyncTask<Void, Void, Void>(){
@Override
protected Void doInBackground(Void... nothing) {
final ArrayList<Prize> newData = new ArrayList<Prize>();
Prize.loadArrayListFromJSON(newData, new TypeToken<HashMap<String, Prize>>(){},
json);
if (activity != null && mAdapter != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
// Copy the data into the ListView on the main thread and
// refresh.
mData.clear();
mData.addAll(newData);
mAdapter.notifyDataSetChanged();
}
});
}
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
public void onPositiveClick(ConfirmDialogFragment fragment) {
// Start the intent chooser for this prize.
int position = fragment.getArguments().getInt(CONFIRM_DIALOG_POSITION_KEY);
Prize prize = mData.get(position);
Intent intent = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("mailto", prize.contact, null));
String subject = String.format("Regarding the Hack The North prize"
+ " \"%s\"", prize.name);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
String title = getActivity().getString(R.string.send_email);
DialogFragment dialog = IntentChooserDialogFragment.getInstance(intent,
getActivity(), title);
dialog.show(getFragmentManager(), INTENT_CHOOSER_DIALOG_FRAGMENT);
}
@Override
public void onNegativeClick(ConfirmDialogFragment fragment) {
// Do nothing
}
public static class PrizesFragmentAdapter extends ArrayAdapter<Prize> {
private int mResource;
private ArrayList<Prize> mData;
private PrizesFragment mFragment;
public PrizesFragmentAdapter(Context context, int resource,
ArrayList<Prize> objects) {
super(context, resource, objects);
mResource = resource;
mData = objects;
}
public void setFragment(PrizesFragment f) {
mFragment = f;
}
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
// If we don't have a view to reuse, inflate a new one.
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(mResource, parent, false);
}
// Get the data for this position
final Prize prize = mData.get(position);
// Compose email on tap if we have a contact email address
if (prize.contact == null) {
convertView.setOnClickListener(null);
} else {
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Resources res = view.getContext().getResources();
String title = res.getString(R.string.prize_dialog_title);
String message = String.format(res.getString(R.string.prize_dialog_message),
prize.name);
String yes = res.getString(R.string.prize_dialog_confirm);
String cancel = res.getString(R.string.dialog_button_cancel);
ConfirmDialogFragment dialog = ConfirmDialogFragment.getInstance(
title, message, yes, cancel);
// Set the target fragment for the callback
dialog.setTargetFragment(mFragment, 0);
// Keep track of the position here so the fragment knows which
// intent to send off.
Bundle args = dialog.getArguments();
args.putInt(CONFIRM_DIALOG_POSITION_KEY, position);
dialog.setArguments(args);
// Add the dialog to the fragment.
dialog.show(mFragment.getFragmentManager(), CONFIRM_DIALOG_TAG);
}
});
}
((TextView)convertView.findViewById(R.id.prize_name))
.setText(prize.name);
((TextView)convertView.findViewById(R.id.prize_description))
.setText(prize.description);
((TextView)convertView.findViewById(R.id.prize_company))
.setText(prize.company);
((TextView)convertView.findViewById(R.id.prize_prizes))
.setText(getPrizesString(prize.prize));
return convertView;
}
public int getCount() {
return mData.size();
}
private String getPrizesString(ArrayList<String> prizesList) {
if (prizesList == null || prizesList.size() == 0) {
return null;
}
String prizes = " • " + prizesList.get(0);
for (int i = 1; i < prizesList.size(); i++) {
prizes += "\n • " + prizesList.get(i);
}
return prizes;
}
}
}
<file_sep>package com.hackthenorth.android.ui.component;
import android.content.Context;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
public class CircleFadeNetworkImageView extends NetworkImageView {
private final String TAG = "CircleFadeNetworkImageView";
public CircleFadeNetworkImageView(Context context) {
this(context, null);
}
public CircleFadeNetworkImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CircleFadeNetworkImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void setImageBitmap(Bitmap bitmap) {
// TODO: animation here as well.
if (bitmap == null) {
super.setImageBitmap(bitmap);
return;
}
Bitmap sbmp;
int radius = getWidth();
if (bitmap.getWidth() != radius || bitmap.getHeight() != radius) {
float smallest = Math.min(bitmap.getWidth(), bitmap.getHeight());
float factor = smallest / radius;
sbmp = Bitmap.createScaledBitmap(bitmap, (int) (bitmap.getWidth() / factor), (int) (bitmap.getHeight() / factor), false);
} else {
sbmp = bitmap;
}
Bitmap output = Bitmap.createBitmap(radius, radius, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xffa19774;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, radius, radius);
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
paint.setDither(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(Color.parseColor("#BAB399"));
canvas.drawCircle(radius / 2, radius / 2, radius / 2, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(sbmp, rect, rect, paint);
super.setImageBitmap(output);
}
}
<file_sep>package com.hackthenorth.android.util;
import android.util.Log;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class DateFormatter {
private static final String TAG = "DateTileUtil";
public static SimpleDateFormat getISO8601SimpleDateFormat() {
return new SimpleDateFormat("yyyy-MM-d'T'HH:mm:ssZZZZZ");
}
public static String getTimespanString(ArrayList<String> timeslotTimes) {
// Make sure there is and only is a start time and an end time for each timeslot array
if (timeslotTimes.size() != 2) {
Log.e(TAG, "Invalid availability");
return null;
}
String timespan = "";
Timeslot start = buildTimeslot(timeslotTimes.get(0));
Timeslot end = buildTimeslot(timeslotTimes.get(1));
if (start.day.equals(end.day)) {
// If both times are on the same day, don't write the day twice
timespan += start.day + " ";
if (start.period.equals(end.period)) {
if (start.minute.equals(end.minute) && start.minute.equals(end.minute)) {
// If they're the same time, only show the single time!
timespan += start.hour + ":" + start.minute + start.period;
} else {
// If both times are in the same period, only write the period at the end
timespan += start.hour + ":" + start.minute +
"\u2013" + end.hour + ":" + end.minute + end.period;
}
} else {
// Both times have different periods, write each one
timespan += start.hour + ":" + start.minute + start.period +
"\u2013" + end.hour + ":" + end.minute + end.period;
}
} else {
// Both times are on different days, write each one
timespan += start.day + " " + start.hour + ":" + start.minute + start.period +
"\u2013" + end.day + " " + end.hour + ":" + end.minute + end.period;
}
return timespan;
}
private static Timeslot buildTimeslot(String s) {
Date date = new Date();
try {
date = getISO8601SimpleDateFormat().parse(s);
} catch (ParseException e) {
e.printStackTrace();
}
Timeslot timeslot = new Timeslot();
timeslot.day = new SimpleDateFormat("EEEE").format(date);
timeslot.hour = new SimpleDateFormat("h").format(date);
timeslot.minute = new SimpleDateFormat("mm").format(date);
timeslot.period = new SimpleDateFormat("a").format(date);
return timeslot;
}
/**
* Small data class to hold the parts of the timestamp for easy comparisons
*/
private static class Timeslot {
String day;
String hour;
String minute;
String period;
}
}
<file_sep>package com.hackthenorth.android.ui;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.content.res.Resources;
import android.support.v13.app.FragmentStatePagerAdapter;
import com.hackthenorth.android.R;
public class ViewPagerAdapter extends FragmentStatePagerAdapter {
private final String TAG = "FragmentStatePagerAdapter";
public static final int UPDATES_POSITION = 0;
public static final int SPONSORS_POSITION = 1;
public static final int SCHEDULE_POSITION = 2;
public static final int PRIZES_POSITION = 3;
public static final int MENTORS_POSITION = 4;
public static final int TEAM_POSITION = 5;
public static final int NUM_FRAGMENTS = 6;
public static final String UPDATES_TAG = "Updates";
public static final String SPONSORS_TAG = "Sponsors";
public static final String SCHEDULE_TAG = "Schedule";
public static final String PRIZES_TAG = "Prizes";
public static final String MENTORS_TAG = "Mentors";
public static final String TEAM_TAG = "Team";
private Fragment[] mFragments = new Fragment[NUM_FRAGMENTS];
private String[] mFragmentTitles;
public ViewPagerAdapter(Context context, FragmentManager fm) {
super(fm);
Resources resources = context.getResources();
mFragmentTitles = resources.getStringArray(R.array.fragment_titles);
}
@Override
public Fragment getItem(int i) {
if (mFragments[i] == null) {
switch (i) {
case UPDATES_POSITION:
mFragments[i] = new UpdatesFragment();
break;
case SPONSORS_POSITION:
mFragments[i] = new SponsorsFragment();
break;
case SCHEDULE_POSITION:
mFragments[i] = new ScheduleFragment();
break;
case PRIZES_POSITION:
mFragments[i] = new PrizesFragment();
break;
case MENTORS_POSITION:
mFragments[i] = new MentorsFragment();
break;
case TEAM_POSITION:
mFragments[i] = new TeamFragment();
break;
}
}
return mFragments[i];
}
@Override
public int getCount() {
return NUM_FRAGMENTS;
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitles[position];
}
}
<file_sep>package com.hackthenorth.android.ui;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.google.gson.reflect.TypeToken;
import com.hackthenorth.android.HackTheNorthApplication;
import com.hackthenorth.android.R;
import com.hackthenorth.android.base.BaseListFragment;
import com.hackthenorth.android.framework.HTTPFirebase;
import com.hackthenorth.android.framework.NetworkManager;
import com.hackthenorth.android.model.Mentor;
import com.hackthenorth.android.model.TeamMember;
import com.hackthenorth.android.ui.dialog.ContactOptionsDialogFragment;
import com.hackthenorth.android.ui.dialog.IntentChooserDialogFragment;
import com.nhaarman.listviewanimations.appearance.simple.AlphaInAnimationAdapter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
public class TeamFragment extends BaseListFragment implements ContactOptionsDialogFragment.ListDialogFragmentListener {
public static final String TAG = "TeamFragment";
// Info for the fragment
public static final String TEAMMEMBER_POSITION = "mentorPosition";
// Contact types
public static final int EMAIL_CONTACT_TYPE = 0;
public static final int PHONE_CONTACT_TYPE = 1;
public static final int GITHUB_CONTACT_TYPE = 2;
public static final int TWITTER_CONTACT_TYPE = 3;
private ListView mListView;
private ArrayList<TeamMember> mData = new ArrayList<TeamMember>();
private TeamFragmentAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addHardcodedTeamData(mData);
// Keep a static cache of the arraylist, because decoding from JSON every time is
// a waste.
String key = ViewPagerAdapter.TEAM_TAG;
Object thing = getCachedObject(key);
if (thing != null) {
mData = (ArrayList<TeamMember>) thing;
} else {
setCachedObject(key, mData);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// Register for updates
registerForSync(activity, HackTheNorthApplication.Actions.SYNC_TEAM);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the view and return it
View view = inflater.inflate(R.layout.team_fragment, container, false);
// Save a reference to the list view
mListView = (ListView) view.findViewById(android.R.id.list);
mListView.setFastScrollEnabled(true);
// Create adapter
mAdapter = new TeamFragmentAdapter(inflater.getContext(), this, R.layout.team_list_item, mData);
// Wrap the adapter in AlphaInAnimatorAdapter for prettiness
AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(mAdapter);
animationAdapter.setAbsListView(mListView);
// Hook it up to the ListView
mListView.setAdapter(animationAdapter);
return view;
}
@Override
public void onResume() {
super.onResume();
// Re-GET data from Firebase here
if (getActivity() != null) {
HTTPFirebase.GET("/team", getActivity(),
HackTheNorthApplication.Actions.SYNC_TEAM);
}
}
@Override
protected void handleJSONUpdateInBackground(final String json, String action) {
final Activity activity = getActivity();
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... nothing) {
// Decode JSON
final ArrayList<TeamMember> newData = new ArrayList<TeamMember>();
TeamMember.loadArrayListFromJSON(newData, new TypeToken<HashMap<String, TeamMember>>() {
},
json);
if (activity != null && mAdapter != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
mData.clear();
// Add Kartik and Kevin's data hardcoded here
addHardcodedTeamData(mData);
mData.addAll(newData);
mAdapter.notifyDataSetChanged();
}
});
}
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
public void onItemClick(ContactOptionsDialogFragment fragment, int position) {
// Get the position of the mentor in the list.
int mentorPosition = fragment.getArguments().getInt(MentorListAdapter.MENTOR_POSITION);
TeamMember mentor = mAdapter.getItem(mentorPosition);
List<Integer> canonicalContactTypesList = getCanonicalContactTypesList(mentor);
openContactAction(canonicalContactTypesList.get(position), mentor);
fragment.dismiss();
}
@Override
public void onCancelButtonClick(ContactOptionsDialogFragment fragment) {
fragment.dismiss();
}
/**
* @param mentor The mentor we wish to contact.
* @return A list of the ways that a mentor can be contacted in a canonical order.
*/
public List<Integer> getCanonicalContactTypesList(TeamMember mentor) {
List<Integer> list = new ArrayList<Integer>();
if (mentor.email != null) list.add(EMAIL_CONTACT_TYPE);
if (mentor.twitter != null) list.add(TWITTER_CONTACT_TYPE);
if (mentor.phone != null) list.add(PHONE_CONTACT_TYPE);
return list;
}
public void openContactAction(int contactType, TeamMember teamMember) {
if (getActivity() == null) return;
Intent intent = null;
String title = null;
Resources res = getActivity().getResources();
switch (contactType) {
case TeamFragmentAdapter.TWITTER_CONTACT_TYPE:
String twitter = teamMember.twitter;
twitter = twitter.charAt(0) == '@' ? twitter.substring(1, twitter.length()) : twitter;
intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(String.format("http://twitter.com/%s", twitter)));
title = res.getString(R.string.open_twitter_profile);
break;
case TeamFragmentAdapter.EMAIL_CONTACT_TYPE:
String email = teamMember.email;
intent = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("mailto", email, null));
title = res.getString(R.string.send_email);
break;
case TeamFragmentAdapter.PHONE_CONTACT_TYPE:
String phone = teamMember.phone;
intent = new Intent(Intent.ACTION_DIAL,
Uri.fromParts("tel", phone, null));
title = res.getString(R.string.dial_phone);
break;
}
IntentChooserDialogFragment dialog = IntentChooserDialogFragment.getInstance(intent,
getActivity(), title);
dialog.show(getFragmentManager(), "another hmmmm?");
}
private void addHardcodedTeamData(ArrayList<TeamMember> mData) {
TeamMember kartik = new TeamMember();
kartik.name = "<NAME>";
kartik.phone = "+16472254089";
kartik.email = "<EMAIL>";
kartik.role = new ArrayList<String>(Arrays.asList("organizer"));
TeamMember kevin = new TeamMember();
kevin.name = "<NAME>";
kevin.phone = "+16476278630";
kevin.email = "<EMAIL>";
kevin.role = new ArrayList<String>(Arrays.asList("organizer"));
mData.add(kartik);
mData.add(kevin);
}
public static class TeamFragmentAdapter extends ArrayAdapter<TeamMember> {
// Contact types
public static final int EMAIL_CONTACT_TYPE = 0;
public static final int PHONE_CONTACT_TYPE = 1;
public static final int GITHUB_CONTACT_TYPE = 2;
public static final int TWITTER_CONTACT_TYPE = 3;
private Context mContext;
private TeamFragment mFragment;
private int mResource;
private ArrayList<TeamMember> mData;
public TeamFragmentAdapter(Context context, TeamFragment fragment, int resource, ArrayList<TeamMember> objects) {
super(context, resource, objects);
mContext = context;
mFragment = fragment;
mResource = resource;
mData = objects;
}
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
// If we don't have a view to reuse, inflate a new one.
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(mResource, parent, false);
}
// Get the data for this position
final TeamMember teamMember = mData.get(position);
/* DISABLED AVATARS
// Set up the image view with the avatar URLs
NetworkImageView networkImageView = (NetworkImageView) convertView.findViewById(R.id.team_member_avatar);
networkImageView.setDefaultImageResId(R.drawable.ic_launcher);
// If we have an avatar URL, load it here.
ImageLoader loader = NetworkManager.getImageLoader();
if (!"" .equals(teamMember.avatar)) {
networkImageView.setImageUrl(teamMember.avatar, loader);
} else {
networkImageView.setImageUrl(null, loader);
}
*/
Drawable contact = getContext().getResources().getDrawable(R.drawable.ic_contact);
contact.setColorFilter(getContext().getResources().getColor(R.color.blue_dark), PorterDuff.Mode.MULTIPLY);
contact.setAlpha(contactable(teamMember) ? 222 : 143);
// Set the data in the TextViews
((TextView) convertView.findViewById(R.id.team_member_name)).setText(teamMember.name);
((TextView) convertView.findViewById(R.id.team_member_role)).setText(getRolesString(teamMember.role));
((ImageView) convertView.findViewById(R.id.team_member_contact)).setImageDrawable(contact);
if (contactable(teamMember)) {
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Show a list dialog fragment for contacting the teamMembers.
ArrayList<String> titles = new ArrayList<String>();
ArrayList<String> items = new ArrayList<String>();
if (!TextUtils.isEmpty(teamMember.email)) {
titles.add(mContext.getString(R.string.email_mentor));
items.add(teamMember.email);
}
if (!TextUtils.isEmpty(teamMember.twitter)) {
titles.add(mContext.getString(R.string.twitter_mentor));
items.add(teamMember.twitter);
}
if (!TextUtils.isEmpty(teamMember.phone)) {
titles.add(mContext.getString(R.string.phone_mentor));
items.add(teamMember.phone);
}
Resources res = mContext.getResources();
ContactOptionsDialogFragment dialog = ContactOptionsDialogFragment.getInstance(mFragment,
res.getString(R.string.contact_mentor),
null, titles, items,
res.getString(R.string.dialog_button_cancel));
Bundle args = dialog.getArguments();
args.putInt(TEAMMEMBER_POSITION, position);
dialog.setArguments(args);
dialog.show(mFragment.getFragmentManager(), "heythere");
}
});
}
return convertView;
}
public int getCount() {
return mData.size();
}
private String getRolesString(ArrayList<String> rolesList) {
if (rolesList == null || rolesList.size() == 0) {
return null;
}
String roles = rolesList.get(0);
for (int i = 1; i < rolesList.size(); i++) {
roles += " • " + rolesList.get(i);
}
return roles;
}
public boolean contactable(TeamMember team) {
return team.twitter != null ||
team.phone != null ||
team.email != null;
}
}
}
<file_sep>hackthenorth-android
====================
Hack the North Android App
| 10b1833fa0f31af25ac003f323ff129abaa65f6d | [
"Markdown",
"Java"
] | 13 | Java | hackthenorth/hackthenorth-android | 18fb2826861b415df5367ec5551029a869aeab7a | 197f3ff79e9458e393258876315b6191a2ee85e8 |
refs/heads/master | <file_sep>package com.comers.annotation.mode;
public class Mode {
public static final int MAIN = 1;
public static final int BACKGROUND = 2;
public static final int NEW_THREAD = 3;
public static final int POST_THREAD = 4;
}
<file_sep>implementation-class=com.comers.plugin.OkBusPlugin
<file_sep>apply plugin: 'groovy'
apply plugin: 'java'
//apply plugin: 'com.github.dcendents.android-maven'
//group 'com.comers.okbus.plugin'
//version = '0.1.3'
dependencies {
//gradle sdk
implementation gradleApi()
//groovy sdk
implementation localGroovy()
implementation 'org.javassist:javassist:3.20.0-GA'
implementation 'com.android.tools.build:gradle:3.5.0'
implementation 'com.squareup:javapoet:1.11.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
repositories {
mavenCentral()
google()
jcenter()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/'}
mavenLocal()
maven { url "https://jitpack.io" }
}
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
pom.groupId = 'com.comers.okbus' //groupId
pom.artifactId = 'plugin' //artifactId
pom.version = '1.0.0' //版本号
//提交到远程服务器:
// repository(url: "http://www.xxx.com/repos") {
// authentication(userName: "admin", password: "<PASSWORD>")
// }
//本地的Maven地址设置为
repository(url: uri("../repo"))
}
}
}
/*
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task classesJar(type: Jar) {
from "$buildDir/intermediates/classes/release"
}
artifacts {
archives classesJar
archives javadocJar
archives sourcesJar
}*/
<file_sep>package com.comers.bus;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import com.comers.annotation.annotation.EventReceiver;
import com.comers.annotation.mode.Mode;
import com.comers.okbus.ClassTypeHelper;
import com.comers.okbus.OkBus;
import com.comers.okbus.PostData;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class OkBusActivity extends AppCompatActivity {
private TextView txShowText;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txShowText = findViewById(R.id.txShowText);
OkBus.getDefault().register(this);
findViewById(R.id.txShowText).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
OkBus.getDefault().post("我是来自 OKBusActivity 的数据");
//发送带tag 的数据,进行过滤,不区分页面,只要方法的tag一样则进行调用,当然我们会进行参数类型的校验
// OkBus.getDefault().post(11, "MainActivity");
//发送给多个页面的。前提是对应的页面能支持这个类型的参数
// OkBus.getDefault().post("我是一个多个页面的发送", MainActivity.class);
OkData<Success> data = new OkData<>();
data.data = new Success("我的数据来自泛型");
//发送泛型数据相对复杂一些,需要把数据存出来我实现写好的类里面,并且注意后面的{},有点类似于Gson 的TypeToken获取数据的泛型
OkBus.getDefault().post(new PostData<OkData<Success>>(data) {
});
}
});
}
@EventReceiver(threadMode = Mode.POST_THREAD, tag = "OkActivity_changed")
public void changed(OkData<Success> hahha) {
txShowText.setText(hahha.data.show);
}
@EventReceiver(threadMode = Mode.BACKGROUND)
public Success change(String hahha) {
return null;
}
@Override
protected void onDestroy() {
super.onDestroy();
OkBus.getDefault().unregister(this);
}
}
<file_sep>package com.comers.bus;
public class Success {
public String show;
public Success(String show) {
this.show = show;
}
}
<file_sep>package com.comers.okbus;
import java.lang.reflect.Type;
interface PostCard<T> {
default public Type getType() {//获取需要解析的泛型T类型
return new ParameterizedTypeImpl(PostData.class, new Type[]{ClassTypeHelper.findNeedClass(getClass())});
}
}
<file_sep>package com.comers.okbus;
public class PostData<T> implements PostCard<T> {
public T data;
public PostData(T data) {
this.data = data;
}
public PostData() {
}
public Class getDataClass() {
if (data == null) {
return Object.class;
}
return data.getClass();
}
}
<file_sep>package com.comers.bus;
import android.app.Activity;
import com.comers.okbus.AbstractHelper;
import com.comers.okbus.OkBus;
import com.comers.okbus.PostData;
import java.lang.ref.WeakReference;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
public class MainActivity_Helpers extends AbstractHelper {
WeakReference target;
private LinkedHashMap<Class, ? extends AbstractHelper> objDeque = new LinkedHashMap();
public MainActivity_Helpers(Object obj) {
super(obj);
}
public void postchanged(String text) {
MainActivity to = (MainActivity) target.get();
if (to instanceof Activity && to.isFinishing()) {
return;
}
if (target.get() != null) {
to.changed(text);
}
Runnable runnable=new Runnable() {
@Override
public void run() {
}
};
}
public void post(java.lang.Object obj) {
final OkBusActivity to = (com.comers.bus.OkBusActivity) target.get();
if (to == null || to instanceof android.app.Activity && ((android.app.Activity) to).isFinishing()) {
return;
}
if(obj instanceof PostData){
}
if (obj.getClass().getName().equals("java.lang.String")) {
final java.lang.Object param = obj;
}
}
}
<file_sep>package com.comers.plugin;
import java.util.ArrayList;
public class ProcessorHelper {
public ArrayList getInfo() {
ArrayList list = new ArrayList();
list.add("com.comers.bus.OkBusActivity");
list.add("com.comers.bus.MainActivity");
return list;
}
}
<file_sep>include ':app', ':processor', ':plugin', ':okbus', ":annotation"
rootProject.name='OkBus'
<file_sep>package com.comers.bus;
public class OkData<T> {
public String text;
public T data;
}
<file_sep>apply plugin: 'java-library'
apply plugin: 'com.github.dcendents.android-maven'
group 'com.comers.okbus.processor'
version = '0.1.3'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//自动生成注册文件,否则需要自己创建resources/META_INF/services
//javax.annotation.processing.Processor 内容是注解器的相对路径
compileOnly 'com.google.auto.service:auto-service:1.0-rc4'
//java文件生成工具
implementation 'com.squareup:javapoet:1.11.1'
implementation 'de.greenrobot:java-common:2.3.1'
api project(path: ':annotation')
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task classesJar(type: Jar) {
from "$buildDir/intermediates/classes/release"
}
artifacts {
archives classesJar
archives javadocJar
archives sourcesJar
}
repositories {
mavenCentral()
google()
jcenter()
maven { url "https://jitpack.io" }
}<file_sep>package com.comers.okbus;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
public class AbstractHelper {
public WeakReference target;
//存储每个类里面所有的
public ArrayList tags = new ArrayList();
//存储每个类对应的参数类型
public List<Class> paramList = new ArrayList<>();
public AbstractHelper(Object obj){
target=new WeakReference(obj);
}
public <T> void post(T obj) {
post(obj, null);
}
public <T> void post(T text, String tag) {
}
public <T> T post(T tClass, Object text) {
return null;
}
public boolean checkNull(WeakReference reference) {
if (reference == null || reference.get() == null) {
return true;
}
final Object to = reference.get();
if (to == null || to instanceof android.app.Activity && ((android.app.Activity) to).isFinishing()) {
return true;
}
return false;
}
public boolean checkTag(String tag, String tag1) {
if (tag == null || tag.isEmpty() || !tag1.isEmpty() && TextUtils.equals(tag, tag1)) {
return true;
}
return false;
}
}
<file_sep>package com.comers.bus;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.comers.annotation.annotation.EventReceiver;
import com.comers.annotation.mode.Mode;
import com.comers.okbus.AbstractHelper;
import com.comers.okbus.OkBus;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
public class MainActivity extends AppCompatActivity {
private TextView txShowText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
OkBus.getDefault().register(this);
txShowText = findViewById(R.id.txShowText);
txShowText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, OkBusActivity.class);
startActivity(intent);
}
});
}
@EventReceiver(tag = "MainActivity", threadMode = Mode.MAIN)
public void dataChanged(Integer hahha) {
txShowText.setText(hahha + "---->00000");
}
@EventReceiver(threadMode = Mode.MAIN)
public void changed(String hahha) {
txShowText.setText(hahha + "---->00000");
}
@Override
protected void onDestroy() {
super.onDestroy();
OkBus.getDefault().unregister(this);
}
}
<file_sep>package com.comers.okbus;
import android.drm.DrmStore;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class OkBus {
private static OkBus INSTANCE;
//存储每个类对应的辅助类
ConcurrentHashMap<Class, AbstractHelper> objDeque = new ConcurrentHashMap<>();
//参数 对应辅助类
ConcurrentHashMap<Class, List<AbstractHelper>> paramDeque = new ConcurrentHashMap<>();
private OkBus() {
}
public static OkBus getDefault() {
if (INSTANCE == null) {
synchronized (OkBus.class) {
if (INSTANCE == null) {
INSTANCE = new OkBus();
}
}
}
return INSTANCE;
}
public <T> void post(T obj) {
if (obj == null) {
return;
}
List<AbstractHelper> helperList = null;
if (obj instanceof PostData) {
helperList = paramDeque.get(((PostData) obj).getDataClass());
} else {
helperList = paramDeque.get(obj.getClass());
}
if (helperList == null) {
return;
}
Iterator it = helperList.iterator();
while (it.hasNext()) {
AbstractHelper helper = (AbstractHelper) it.next();
if (checkHelper(helper)) {
helper.post(obj);
} else {
removeHelper(helper);
}
}
}
//发送给一组
public <T> void post(T event, Class... to) {
for (Class cla : to) {
if (objDeque.containsKey(to)) {
AbstractHelper helper = objDeque.get(cla);
if (checkHelper(helper)) {
helper.post(event);
} else {
objDeque.remove(cla);
}
}
}
}
//发送给一组 tag
public <T> void post(T event, String... tag) {
if (event == null) {
return;
}
List<AbstractHelper> helperList ;
if (event instanceof PostData) {
helperList = paramDeque.get(((PostData) event).getDataClass());
} else {
helperList = paramDeque.get(event.getClass());
}
if (helperList == null) {
return;
}
Iterator it = helperList.iterator();
while (it.hasNext()) {
Class cl = (Class) it.next();
AbstractHelper helper = (AbstractHelper) objDeque.get(cl);
if (checkHelper(helper)) {
for (String ta : tag) {
if (helper.tags.contains(ta)) {
helper.post(event, ta);
}
}
} else {
objDeque.remove(cl);
}
}
}
public <T> T post(T tClass, Object text, Class to) {
AbstractHelper helper = objDeque.get(to);
if (checkHelper(helper)) {
return helper.post(tClass, text);
} else {
objDeque.remove(to);
}
return null;
}
public void register(Object target) {
}
public void unregister(Object obj) {
if (obj != null && objDeque.containsKey(obj.getClass())) {
AbstractHelper helper = objDeque.get(obj.getClass());
if (helper != null) {
for (Class cls : helper.paramList) {
paramDeque.get(cls).remove(helper);
}
}
objDeque.remove(obj.getClass());
}
}
ExecutorService executors = Executors.newCachedThreadPool();
Handler handler = new Handler(Looper.getMainLooper());
public Handler getHandler() {
return handler;
}
public ExecutorService getExecutors() {
return executors;
}
void registerParam(AbstractHelper helper) {
if (helper != null) {
for (Class cls : helper.paramList) {
List<AbstractHelper> helperList = paramDeque.get(cls);
if (helperList == null) {
helperList = new ArrayList<>();
}
helperList.add(helper);
paramDeque.put(cls, helperList);
System.out.println("--->" + cls.getCanonicalName() + "---");
}
}
}
boolean checkHelper(AbstractHelper helper) {
if (helper != null && helper.target != null && helper.target.get() != null) {
return true;
}
return false;
}
private void removeHelper(AbstractHelper helper) {
if (helper != null) {
}
}
}
<file_sep># OkBus
-------
**github 地址** [项目地址](https://github.com/comerss/OkBus.git)
**特点 :**
1. 支持 线程切换
2. 支持 为方法打标签 根据标签发送数据
3. 支持 泛型参数以及发送泛型数据
4. 不使用反射调方法
5. 支持 发送给指定页面 或者 tag
6. 将要支持 带返回值的调用
-------

-------
## Eventbus
android里面我们都知道EventBus事件总线 来处理我们的事件分发,确实从一定程度上解决了android的一些通信问题,但是其自身的弊端也不容忽视,在我看来主要是两点
1.EventBus 大量使用后造成混乱,你根本不知道你这个事件会从哪里调用,无法根据自己打的标记进行调用,比如给某个方法打个标记方便识别以及调用。也就是说我们要清晰发给谁 以及方法本身能接受谁
2.EventBus本身使用的是反射的技术,耗时平均大于100ms。虽然对于很多架构而言反射是利器,但是性能的损耗也不可姑息,能否不用反射?
处于对以上问题的思考,我尝试着用市面上已有的技术打造一款解决EventBus问题的事件总线框架。其目的是能够更清晰的使用,不造成使用后的混乱,另一方面想达到直接调用方法的效果而不是反射调用。以下我将使用**APT 、动态生成代码 以及动态修改字节码** 技术来尝试解决这个问题
## 上路吧OkBus
问题既然清楚了,那我们就逐一解决。
一 . 首先不必要考虑新的架构,而是如何在EventBus本身上解决第一个问题,最初的想法是,在注解里增加fromType控制谁能调用,在post方法是增加toType解决到底发给谁还是给一组谁,post也可以增加一个tag根据tag来区分到底发给谁,前提是注解里添加tag。其实这样的思路完全是可以更好的优化EventBus的,能更清晰的看到,大致如下
```
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.METHOD)
public @interface Subscriber {
int threadMode() default Mode.POST_THREAD;
//接受谁 从某种程度来说就是确定关系,我只接受某些类的事件,但是需要提前在我这里声明某个不予响应
Class[] from() default {};
//发给谁 我们也可以根据tag分组,比如refresh,这样post 的时候带上这个tag,所有的相同tag的都能收到事件 可以说是分组功能,他决定了 发给谁
String tag() default "";
}
//发给谁
EventBus.getDefault().post("我来自伽马星球",HomeActivity.class);
```
从上面简短的代码中基本可以看到我的思路了,也就是解决 谁可以调 以及调用谁的问题。
二. 以上思想可以从EventBus本身解决,然而如果想不用反射 EventBus就歇菜了,他无法做到这点。从目前的技术来看,可能解决的技术就是 _动态生成代码 以及动态修改 字节码技术_
**思路决定出路**
1. 我们要实现类似于代码直接调用的方式前提是拿到对象,也就是注册的时候我们需要引用到对应的对像,以便于后期调用目标方法
2. 通过register这一步我们是可以拿到对象,但是如何存储以及如何在事件分发的时候 有了对象如何辨别该调用哪个方法?
3. 显然2中调用哪个方法是完全不知道的,我们不能直接写在框架列吧,那如何搞?答案是动态生成。
4. ButterKnife是否还记得,它是如何通过注解来实现调用点击事件监听的?
5. 对于OkBus本身,他就是写死的,比如注册我们只存一个对象是不够的的,那能不能像ButterKnife那样动态生成辅助类?可以是可以但你Okbus本身这个类写死的如何改? 动态字节码修改罗
有了以上问题的思考,我们逐一解决对应的问题即可。当然对于我而言上面的东西只不过是事后总结的,事先根本一脸懵逼,无数次脑海里假想和实践才能得出来的。
## 代码实践
### OkBus 类
```
public class OkBus {
private volatile static OkBus INSTANCE;
//存储每个类对应的辅助类
private LinkedHashMap<Class, ? extends AbstractHelper> objDeque = new LinkedHashMap<>();
private OkBus() {
}
public static OkBus getDefault() {
if (INSTANCE == null) {
synchronized (OkBus.class) {
if (INSTANCE == null) {
INSTANCE = new OkBus();
}
}
}
return INSTANCE;
}
public <T> void post(T obj) {
Iterator it = this.objDeque.values().iterator();
while (it.hasNext()) {
AbstractHelper helper = (AbstractHelper) it.next();
helper.post(obj);
}
}
//发送给一组
public <T> void post(T event, Class... to) {
for (Class cla : to) {
AbstractHelper helper = objDeque.get(cla);
if (helper != null) {
helper.post(event);
}
}
}
//发送给一组 tag
public <T> void post(T event, String... tag) {
Iterator it = this.objDeque.values().iterator();
while (it.hasNext()) {
AbstractHelper helper = (AbstractHelper) it.next();
for (String ta : tag) {
if (helper.tags.contains(ta)) {
helper.post(event, ta);
}
}
}
}
public <T> T post(T tClass, Object text, Class to) {
AbstractHelper helper = objDeque.get(to);
if (helper != null) {
return helper.post(tClass, text);
}
return null;
}
public void register(Object target) {
if (objDeque.containsKey(target.getClass())) {
return;
}
}
public void unregister(Object target) {
if (objDeque.containsKey(target.getClass())) {
objDeque.remove(target.getClass());
}
}
ExecutorService executors = Executors.newFixedThreadPool(5);
Handler handler = new Handler(Looper.getMainLooper());
public Handler getHandler() {
return handler;
}
public ExecutorService getExecutors() {
return executors;
}
}
```
### APT 以及动态生成代码
我们在这里要实现的是,通过动态生成代码生成辅助类,为了方便调用,我们定义一个抽象类,因为每个类对应的方法不同。
注解定义
```
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.METHOD)
public @interface EventReceiver {
//线程
int threadMode() default Mode.POST_THREAD;
// Class[] from() default {};
//方法分组名 或者称之为方法标记
String tag() default "";
}
```
第二阶段最主要的就是辅助类的生成(用空间换时间 不反射得多文件),具体的思考细节就不多说了,通过注解我们需要生成每个类对应的辅助文件。(事实上 在实际项目中我们用的最多的是页面级的数据传递,或者调用,所以我认为不会特别多,你不可能每个页面都需要和其他页面通信,所以生成的文件也是有限的,不会大规模)
这里主要做了三件事
1.收集所有使用okbus的类,并生成文件保存留给后面做字节码修改使用
2.辅助类要生成两种方法,第一个是对原有方法的包装 也就是对注解的处理比如线程以及调用
3.我们调用的前提是需要匹配 post 的所带的条件 以及方法本身注解所带有的条件是否吻合,决定是否调用,条件包括fromType tag方法参数类型 的条件校验
```
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
if (set.size() > 0) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "要开始注解结识了啊");
//收集所有的注解的信息以及所在类的信息
collectSubscribers(set, roundEnvironment, processingEnv.getMessager());
//1. 需要生成一个保存所有需要修改类的文件,留给javassit 好知道需要修改哪些类
createFile();
//2. 创建对应的Helper类,本来是javassit创建方便些,但是由于javassit不能处理handler 无法解决只能前移到这里
createHelper();
}
return false;
}
int count = 0;
private void createHelper() {
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "--------" + count);
for (TypeElement element : methodsByClass.keySet()) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "我是一个" + element.getSimpleName() + "_Helper" + count++);
//构造函数
TypeSpec.Builder helper = TypeSpec.classBuilder(element.getSimpleName() + "_Helper");
helper.addModifiers(Modifier.PUBLIC);
helper.superclass(ClassName.get("com.comers.okbus", "AbstractHelper"));
helper.addField(ClassName.get("java.lang.ref", "WeakReference"), "target", Modifier.PRIVATE);
helper.addMethod(MethodSpec.constructorBuilder()
.addParameter(ClassName.get(getPackage(element.getQualifiedName().toString()), element.getSimpleName().toString()), "target")
.addStatement("this.target=new $T(target)", ClassName.get("java.lang.ref", "WeakReference"))
.addStatement("initTag()")
.addModifiers(Modifier.PUBLIC)
.build());
//post 事件分发函数
MethodSpec.Builder post = MethodSpec.methodBuilder("post")
.addModifiers(Modifier.PUBLIC)
.addParameter(ClassName.OBJECT, "obj")
.addParameter(String.class,"tag")
;
post.addStatement("if (checkNull(target)) {return;}");
//tag初始化
MethodSpec.Builder initTag = MethodSpec.methodBuilder("initTag");
List<ExecutableElement> methods = methodsByClass.get(element);
StringBuffer body = new StringBuffer();
StringBuffer buffer = new StringBuffer();
boolean containsFans = false;
boolean containsNormal = false;
buffer.append("if(obj instanceof com.comers.okbus.PostData){\n");
for (int i = 0; i < methods.size(); i++) {
ExecutableElement method = methods.get(i);
String prefix = "";
if (i != 0) {
prefix = "else ";
}
EventReceiver receiver = method.getAnnotation(EventReceiver.class);
if((receiver.threadMode()== Mode.BACKGROUND||receiver.threadMode()==Mode.NEW_THREAD)&&method.getReturnType()== TypeName.VOID){
}
TypeName typeName = ClassName.get(method.getParameters().get(0).asType());
String name = typeName.toString();
//先对每个方法生成对应的调用方法
MethodSpec.Builder mBuild = MethodSpec.methodBuilder(method.getSimpleName().toString())
.addParameter(ClassName.get(method.getParameters().get(0).asType()), "obj")
;
StringBuffer mBody = new StringBuffer();
mBody.append(" if(checkNull(target)){return;}\n");
mBody.append("final " + element.getQualifiedName().toString() + " to=(" + element.getSimpleName().toString() + ")target.get();\n");
if (name.contains("<") && name.contains(">")) {
if (receiver != null) {
if (receiver.threadMode() == 1) {
mBody.append("com.comers.okbus.OkBus.getDefault().getHandler().post(new Runnable() {\n" +
" @Override\n" +
" public void run() {\n" +
" to." + method.getSimpleName() + "(obj);\n" +
" }\n" +
" });");
} else if (receiver.threadMode() == 2 || receiver.threadMode() == 3) {
mBody.append("com.comers.okbus.OkBus.getDefault().getExecutors().submit(new Runnable() {\n" +
" @Override\n" +
" public void run() {\n" +
" to." + method.getSimpleName() + "(obj);\n" +
" }\n" +
"});");
} else {
mBody.append("to." + method.getSimpleName() + "(obj);\n");
}
}
} else {
if (receiver != null) {
if (receiver.threadMode() == 1) {
mBody.append("com.comers.okbus.OkBus.getDefault().getHandler().post(new Runnable() {\n" +
" @Override\n" +
" public void run() {\n" +
" to." + method.getSimpleName() + "(obj);\n" +
" }\n" +
"});");
} else if (receiver.threadMode() == 2 || receiver.threadMode() == 3) {
mBody.append("com.comers.okbus.OkBus.getDefault().getExecutors().submit(new Runnable() {\n" +
" @Override\n" +
" public void run() {\n" +
" to." + method.getSimpleName() + "(obj);\n" +
" }\n" +
"});");
} else {
mBody.append("to." + method.getSimpleName() + "(obj);\n");
}
}
}
mBuild.addStatement(mBody.toString());
helper.addMethod(mBuild.build());
//事件分发 以及条件校验
if (name.contains("<") && name.contains(">")) {
String posName = "pos" + i;
buffer.append(" com.comers.okbus.PostData<" + name + "> " + posName + "=new com.comers.okbus.PostData<" + name + ">(){};\n");
buffer.append(containsFans ? "else" : "" + " if (com.comers.okbus.ClassTypeHelper.equals(((com.comers.okbus.PostData) obj).getType(), " + posName + ".getType())&&checkTag(tag,\""+receiver.tag()+"\")) {\n");
containsFans = true;
buffer.append(" " + method.getSimpleName() + "((" + method.getParameters().get(0).asType().toString() + ")((com.comers.okbus.PostData) obj).data);");
buffer.append("}\n");
} else {
containsNormal = true;
body.append(prefix + " if(obj.getClass().equals(" + method.getParameters().get(0).asType().toString() + ".class)&&checkTag(tag,\""+receiver.tag()+"\")){\n");
body.append(" " + method.getSimpleName() + "((" + method.getParameters().get(0).asType().toString() + ")obj);");
body.append("}\n");
}
if (receiver.tag() != null && !receiver.tag().isEmpty()) {
initTag.addStatement("tags.add(\"" + receiver.tag() + "\")");
}
}
buffer.append("}");
if (containsNormal) {
if(!body.toString().startsWith("else")){
buffer.append("else ");
}
buffer.append(body.toString());
}
post.addStatement(buffer.toString());
helper.addMethod(post.build());
helper.addMethod(initTag.build());
// helper.addMethod(postReturn.build());
JavaFile javaFile = JavaFile.builder(getPackage(element.getQualifiedName().toString()), helper.build()).build();
try {
javaFile.writeTo(filer);
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void collectSubscribers(Set<? extends TypeElement> annotations, RoundEnvironment env, Messager messager) {
for (TypeElement annotation : annotations) {
Set<? extends Element> elements = env.getElementsAnnotatedWith(annotation);
for (Element element : elements) {
//判断类型是方法的类型
if (element instanceof ExecutableElement) {
ExecutableElement method = (ExecutableElement) element;
//检测方法是否符合标准
if (checkHasNoErrors(method, messager)) {
TypeElement classElement = (TypeElement) method.getEnclosingElement();
methodsByClass.putElement(classElement, method);
}
} else {
messager.printMessage(Diagnostic.Kind.ERROR, "@EventReceiver is only valid for methods", element);
}
}
}
}
private void createFile() {
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "创建一个文件---->ProcessorHelper");
TypeSpec.Builder classBuilder = TypeSpec.classBuilder("ProcessorHelper")
.addModifiers(Modifier.PUBLIC);
ClassName list = ClassName.get("java.util", "ArrayList");
MethodSpec constructer = MethodSpec.methodBuilder("ProcessorHelper")
.addModifiers(Modifier.PUBLIC)
.build();
MethodSpec.Builder getInfo = MethodSpec.methodBuilder("getInfo")
.returns(ArrayList.class)
.addModifiers(Modifier.PUBLIC);
CodeBlock.Builder getInfoBlock = CodeBlock.builder()
.add("$T list = new $T();\n", list, list);
Set<TypeElement> clazzs = methodsByClass.keySet();
for (TypeElement element : clazzs) {
getInfoBlock.add("list.$N(" + "\"" + element.getQualifiedName() + "\"" + ");\n", "add");
}
getInfoBlock.add("return list");
getInfo.addStatement(getInfoBlock.build());
classBuilder.addMethod(getInfo.build());
// classBuilder.addMethod(constructer);
JavaFile javaFile = JavaFile.builder("com.comers.plugin", classBuilder.build()).build();
try {
javaFile.writeTo(new File("/Volumes/Work/works/OkBus/plugin/src/main/groovy/"));
} catch (Exception e) {
e.printStackTrace();
}
}
```
生成的文件如下
用来存储哪些类用了okbus
```
public class ProcessorHelper {
public ArrayList getInfo() {
ArrayList list = new ArrayList();
list.add("com.comers.bus.MainActivity");
list.add("com.comers.bus.OkBusActivity");
return list;
}
}
```
辅助类如下
```
public class OkBusActivity_Helper extends AbstractHelper {
private WeakReference target;
public OkBusActivity_Helper(OkBusActivity target) {
this.target=new WeakReference(target);
initTag();
}
原有方法的包装以及调用
void changed(OkData<Success> obj) {
if(checkNull(target)){return;}
final com.comers.bus.OkBusActivity to=(OkBusActivity)target.get();to.changed(obj);
;
}
void change(String obj) {
if(checkNull(target)){return;}
final com.comers.bus.OkBusActivity to=(OkBusActivity)target.get();com.comers.okbus.OkBus.getDefault().getExecutors().submit(new Runnable() {
@Override
public void run() {
to.change(obj);
}
});;
}
//事件分发 以及条件校验 决定调用哪个方法
public void post(Object obj, String tag) {
if (checkNull(target)) {return;};
if(obj instanceof com.comers.okbus.PostData){
com.comers.okbus.PostData<com.comers.bus.OkData<com.comers.bus.Success>> pos0=new com.comers.okbus.PostData<com.comers.bus.OkData<com.comers.bus.Success>>(){};
if (com.comers.okbus.ClassTypeHelper.equals(((com.comers.okbus.PostData) obj).getType(), pos0.getType())&&checkTag(tag,"OkActivity")) {
changed((com.comers.bus.OkData<com.comers.bus.Success>)((com.comers.okbus.PostData) obj).data);}
}else if(obj.getClass().equals(java.lang.String.class)&&checkTag(tag,"")){
change((java.lang.String)obj);}
;
}
//tag收集 会在初始化类的时候初始化到集合里面
void initTag() {
tags.add("OkActivity");
}
}
```
### 动态修改字节码
看上面的代码,我们不难发现OkBus 的注册方法咩有具体的实现,因为注册的时候辅助类还没有,没法注册到objDeque。这个就需要我们动态的去修改了 也就是根据之前我们生成的ProcessorHelper 存储的需要修改的类来进行注册就行了
不知道如何自定义插件的需要问娘哦。
```
class OkBusTransform extends Transform {
def pool = ClassPool.default
def project
def helper = new ProcessorHelper()
String destDir
OkBusTransform(Project project) {
this.project = project
}
@Override
String getName() {
return "OkBusTransform"
}
@Override
Set<QualifiedContent.ContentType> getInputTypes() {
return TransformManager.CONTENT_CLASS
}
@Override
Set<? super QualifiedContent.Scope> getScopes() {
return TransformManager.SCOPE_FULL_PROJECT
}
@Override
boolean isIncremental() {
return false
}
@Override
void transform(TransformInvocation transformInvocation) throws TransformException, InterruptedException, IOException {
super.transform(transformInvocation)
pool.clearImportedPackages()
project.android.bootClasspath.each {
pool.appendClassPath(it.absolutePath)
}
transformInvocation.inputs.each {
//这里是三方的jar包以及 我们的moudle打成的jar包 ,比如我们的okbus 打成的jar包
it.jarInputs.each {
pool.insertClassPath(it.file.absolutePath)
// 重命名输出文件(同目录copyFile会冲突)
def jarName = it.name
def md5Name = DigestUtils.md5Hex(it.file.getAbsolutePath())
if (jarName.endsWith(".jar")) {
jarName = jarName.substring(0, jarName.length() - 4)
}
def dest = transformInvocation.outputProvider.getContentLocation(
jarName + md5Name, it.contentTypes, it.scopes, Format.JAR)
//不能copy okbus 的jar包 因为后面修改的时候没法覆盖jar包里面的Okbus造成 有两个okbus 造成冲突
//TODO 如果打成jar包的话怎么让他不copy 现在还在项目中能这么搞,以后打成jar 这里需要修改
if (!it.file.absolutePath.contains("okbus/build/intermediates/")) {
FileUtils.copyFile(it.file, dest)
} else {
}
}
it.directoryInputs.each {
def preFileName = it.file.absolutePath
pool.insertClassPath(preFileName)
// // 获取output目录
destDir = preFileName
//查询需要修稿的文件
// findTarget(it.file, preFileName)
//修改 OkBus
// editOkBus()
//先清除已经生成的文件 以免造成文件内容重复
File file = new File(destDir + "/com/comers/okbus")
println(file.absolutePath + "------>" + file.exists())
if (file.exists()) {
FileUtils.deleteDirectory(file)
}
//将okbus 目录下的类不会被写到目标目录所以需要手动写到目录
CtClass absHelper = pool.get("com.comers.okbus.AbstractHelper")
absHelper.defrost()
absHelper.writeFile(destDir)
CtClass ClassTypeHelper = pool.get("com.comers.okbus.ClassTypeHelper")
ClassTypeHelper.defrost()
ClassTypeHelper.writeFile(destDir)
CtClass postCard = pool.get("com.comers.okbus.PostCard")
postCard.defrost()
postCard.writeFile(destDir)
CtClass ParameterizedTypeImpl = pool.get("com.comers.okbus.ParameterizedTypeImpl")
ParameterizedTypeImpl.defrost()
ParameterizedTypeImpl.writeFile(destDir)
CtClass PostData = pool.get("com.comers.okbus.PostData")
PostData.defrost()
PostData.writeFile(destDir)
Loader cl = new Loader(pool)
if (EventReceiver == null) {
EventReceiver = cl.loadClass("com.comers.annotation.annotation.EventReceiver")
}
//需要修改的文件的集合
def list = helper.getInfo()
for (String str : list) {
createNewFile(str)
}
def dest = transformInvocation.outputProvider.getContentLocation(
it.name,
it.contentTypes,
it.scopes, Format.DIRECTORY)
println "copy directory: " + it.file.absolutePath
println "dest directory: " + dest.absolutePath
// 将input的目录复制到output指定目录
FileUtils.copyDirectory(it.file, dest)
}
}
pool.clearImportedPackages()
}
private void createNewFile(String name) {
CtClass ctClass = pool.get(name)
if (ctClass.isFrozen()) {
ctClass.defrost()
}
def methods = ctClass.getDeclaredMethods()
//需要处理的方法
List<CtMethod> methodList = new ArrayList<>()
//TODO 需要处理注解的时候把要处理的方法名字带过来,否则这里遍历很耗时间
for (CtMethod method : methods) {
def ano = method.getAnnotation(EventReceiver)
if (ano != null) {
def annotation = ano.getAt("h").getAt("annotation")
LinkedHashMap members = annotation.getAt("members")
IntegerMemberValue integerMemberValue = members.get("threadMode").getAt("value")
int mode = integerMemberValue.value
if (mode < 1 || mode > 4) {
throw new IllegalArgumentException(ctClass.name + " EventReceiver threadMode must be one of Mode, or between 1 and 4 ")
}
methodList.add(method)
}
}
if (methodList.size() == 0) {
//如果不需要修改就释放文件
ctClass.detach()
return
}
// 修改OkBus 来处理对应的能能够调用的方法
//等遍历完所有的文件之后 我们需要修改 oKbus 来完成事件的真正分发 与 调用
CtClass okbus = pool.get("com.comers.okbus.OkBus")
if (okbus.isFrozen()) {
okbus.defrost()
}
//修改注册方法
CtMethod register = okbus.getDeclaredMethod("register")
StringBuffer buffer = new StringBuffer()
buffer.append("if(android.text.TextUtils.equals(target.getClass().getName().toString(),\"" + ctClass.getName() + "\")&&!objDeque.containsKey(target.getClass())){")
buffer.append("objDeque.put(target.getClass(),")
buffer.append("new " + ctClass.getName() + "_Helper" + "((" + ctClass.getName() + ")target)")
buffer.append(");")
buffer.append("}")
register.insertAfter(buffer.toString())
okbus.writeFile(destDir)
}
}
```
<file_sep>apply plugin: 'java-library'
//apply plugin: 'com.github.dcendents.android-maven'
//group 'com.comers.okbus.annotation'
//version '0.1.3'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
/*
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task classesJar(type: Jar) {
from "$buildDir/intermediates/classes/release"
}
artifacts {
archives classesJar
archives javadocJar
archives sourcesJar
}
repositories {
mavenCentral()
google()
jcenter()
maven { url "https://jitpack.io" }
}
*/
| ca3c94190be0d4204f0e81ac9b0cd61e3cbae94c | [
"Markdown",
"Java",
"INI",
"Gradle"
] | 17 | Java | comerss/OkBus | c5dd0ba77f661f3db7af3b68fd3d2c242cc4e041 | a948c49be9e41307079abfd9b4d19cdba58f58bf |
refs/heads/master | <repo_name>staimphin/wp_pdf_manager<file_sep>/index.php
<?php
/*
Plugin Name: PDF upload manger
Plugin URI:
Description:PDF management for Wordpress
Version: 0.3
Author: <NAME>
Author email: <EMAIL>
Author URI:
License: GPLv2
*/
/* Copyright 2015 <NAME> (email : <EMAIL>)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require "class/class_filesManager.php";
add_action( 'admin_menu', 'GS_PDF_admin_menu' );
add_action( 'admin_head', 'pdf_buttons' );
//call the value maker JS
add_action('admin_head', 'pdf_js_data');
add_action( 'wp_ajax_pdf_insert_dialog', 'pdf_insert_dialog' );
$meta_box = array(
'id' => 'PDF manager',
'title' => 'PDF ManagementSystem',
'page' => 'page',
'context' => 'advanced',
'priority' => 'high',
);
global $gs_file_upload; // base directory for PDF
global $option; // base directory for theme
$option=getCurrentThemePath();
// base url / theme
//move into class!
// check if folder exist
if(file_exists($option."/PDF")){
$gs_file_upload="PDF/";
} else if (file_exists($option."/pdf")){
$gs_file_upload="pdf/";
} else {
//create folder
//echo "** make dir :$option/PDF ";
if(mkdir($option."/PDF")){
$gs_file_upload="PDF/";
} else {
echo "ERROR!";
}
}
/**
* plugin specific
*
*/
/* function: directory path */
function getBaseFolder($path)
{
$tmp =explode('/',$path);
$dirNum = count($tmp)-1;
return $tmp[$dirNum];
}
function cleanString($string, $type='')
{
return $string;
}
function getCurrentThemePath()
{
$path_parts = pathinfo(__FILE__);
$thisDir = getBaseFolder($path_parts['dirname']);
$themeDir=get_template();
//replace the folder
$path_parts['dirname']=str_replace('plugins/'.$thisDir,'themes/'. $themeDir, $path_parts['dirname']);
return $path_parts['dirname'];
}
/**
*
* PDF: POST EDITOR OPTIONS
*
*
*/
/*==== plugins edition options ======*/
function pdf_insert_dialog()
{
global $gs_file_upload;
global $option;
global $post;
$path=$gs_file_upload.'/'.$post->post_name;
$PDF= new FFM($path,'PDF', $option);
$selection= $PDF->getSelectList('',1);
$tree= $PDF-> getTree();
$max= count($tree);
echo $selection;
die(include dirname(__FILE__).'/template/uploadForm.php');
}
// add PDF convertion
add_shortcode('pdf_url', 'pdf2link');/* dont work*/
function pdf_buttons()
{
add_filter( "mce_external_plugins", "pdf_add_buttons" );
add_filter( 'mce_buttons', 'pdf_register_buttons' );
}
function pdf_add_buttons( $plugin_array )
{
$thisDir = getBaseFolder(__DIR__);
$plugin_array['pdflink'] = plugins_url().'/'.$thisDir.'/js/pdf.js' ;
return $plugin_array;
}
function pdf_register_buttons( $buttons )
{
array_push( $buttons, 'pdflink' );
return $buttons;
}
// insert value to head
/* To move out
* used in wp post editor
*/
function pdf_js_data()
{
global $post;
$pdfData= pdfFormLite(1);
$list= $pdfData['PDF'];
$urls= $pdfData['URL'];
?>
<script type="text/javascript">
var pdfFolder= '<?= urldecode($post->post_name);?>';
var foundPDF = [<?= $list;?>];
var foundUrlPDF = [<?= $urls;?>];
</script>
<?php
// pdfFormLite();
}
/*replace the tag by URL
* pdf base should be variable
* pdf path?
* used in ??
*/
function pdf2link($atts)
{
$slug=urldecode( get_post_field('post_name',get_the_iD(),'raw'));
//$pType=get_post_type();
//$PDF_path=($pType=='page' || $pType=='post')?$slug:$pType.'/'.$slug;
//$URL= get_bloginfo('template_url')."/PDF/$PDF_path/" ;
$URL= get_bloginfo('template_url')."/$gs_file_upload" ;//gs_file_upload=> pdf/ OR PDF/
//check where is the file:
//if(file_exists())
print_r($atts);
return $URL;
}
/**
*
* PDF UPLOAD AND MANAGEMENT
*
*/
/*======= plugins functions ==============*/
function GS_PDF_admin_menu()
{
global $meta_box;
add_meta_box( 'pdfLink', 'PDF選択','pdfFormLite','page');
add_menu_page('PDF管理', 'PDF一覧', 'manage_options', 'pdf-management.php', 'gs_pdf_page' , plugin_dir_url( __FILE__ ) . '','13.14');
}
function pdfFormLite($return=0){
global $gs_file_upload;
global $option;
global $post;
$pType=$post->post_type;
$pName=$post->post_name;
$PDF_path= $gs_file_upload.$pType.'/';
//echo "*INDEX*--Post TYPE=-$pType--PDF PATH-$PDF_path--|| UPLOAD path:$gs_file_upload---\r\n<br>";
/* retrieve files infos from root and folder*/
$PDF_ROOT= new FFM($gs_file_upload,'PDF', $option);
$ROOT_LIST= $PDF_ROOT->getSelectList('',$return);
//echo "*INDEX* root list: <br >\r\n";
//print_r($ROOT_LIST);
/*
$PDF= new FFM($PDF_path,'PDF', $option);
$selection= $PDF->getSelectList('',$return,1);
*/
//echo "*INDEX* post type list:$pType <br >\r\n";
$postNameList= $PDF_ROOT->getSelectList($pType,$return);
// print_r($postNameList);
//echo "*INDEX* TYPE/name :$pType.'/'.$pName <br >\r\n";
$selection= $PDF_ROOT->getSelectList($pType.'/'.$pName,$return);
//print_r($selection);
$urls="'test'";
if($return==1) return array(
'PDF'=>$selection['PDF'].$postNameList['PDF'].$ROOT_LIST['PDF'],
'URL'=>$selection['PATH'].$selection['FOLDER'].$postNameList['PATH'].$postNameList['FOLDER'].$ROOT_LIST['PATH'].$ROOT_LIST['FOLDER']);
}
function gs_pdf_page()
{
global $gs_file_upload;
global $option;
$PDF= new FFM($gs_file_upload,'PDF', $option);
//show
// $PDF->css();
$PDF->uploadForm();
//Show the list in edit mode
$PDF-> manageFiles();
}<file_sep>/template/uploadForm.php
<?php
/**
* File type: template
* file name: uploadForm.php
*
*
*/
//<input type="submit" name="addFolder">
//カテゴリー ==>PDFのサブフォルダー
echo $path;
?>
<form method="post" action="#" enctype="multipart/form-data">
<ul>
<li>アップロードフォルダー<select name="destination">
<?php
for($i=0; $i < $max; $i++){
?>
<option value="<?= $tree[$i];?>"><?= $tree[$i];?></option>
<?php
}
?>
</select></li>
<li>フォルダー追加<input type="text" name="newFolder"></li>
<li><input type="file" name="fileupload"></li>
<li><button type="submit" name="upload">アップロード</button></li>
</form><file_sep>/template/files_list.php
<?php
/**
* File type: template
* file name: files_list.php
*
*
*/
$title= ($FOLDER!='')? '<h3>'.$FOLDER.'</h3>':'' ;
echo $title;
// print_r($this->_folders);
//print_r($_SERVER);
?>
<ul class="PDFList">
<?php
for($j=0; $j < $sub; $j++){
if( isset($this->_files[$currentFolderLevel][$j] ) ){
//$link= get_bloginfo('template_url').'/'.$this->_folders[$i]['PATH'].$this->_folders[$i]['FOLDER'].'/'.$this->_files[$currentFolderLevel][$j][strtoupper($this->_ext)];
$link= get_bloginfo('template_url').'/'.$PATH.$FOLDER.$this->_files[$currentFolderLevel][$j][strtoupper($this->_ext)];
$tmp= $this->_files[$currentFolderLevel][$j]['PDF'];//siwtched for PDF: strtoupper($this->_ext)
$filename = explode('.',$tmp);
$thumbnail=(file_exists( $destination.'tmb_'.$filename[0].".jpg") )? '<img src="'. $destination.'tmb_'.$filename[0].'.jpg" alt="'.$filename[0] .'">' :'';
echo "****". $destination.'tmb_'.$filename[0].".jpg".'<img src="'. $destination.'tmb_'.$filename[0].'.jpg" alt="'.$filename[0] .'">'; //dirname();
// exec('gs -dSAFER -dBATCH -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r300 -sOutputFile=whatever.jpg input.pdf');
$DOWNLOAD=($downloadoption==1)? ' download="'.$filename[0] .'"':'';
if($tmp!=''){
?>
<li><a href="<?= $link;?>" class="ico_<?= $filename[1];?>" target="blank"<?= $DOWNLOAD?;>><?= $thumbnail. $filename[0];?></a></li>
<?php }
}
}
?>
</ul><file_sep>/class/class_filesManager.php
<?php //class pdf
/**
* FileManager: V1.1
* Upload and manage PDF
*
*
*/
class FFM{
private $_ext;
private $_root;
private $_basepath;
private $_base;
private $_path;
private $_folderNames= array();
private $_folders;
private $_files;
private $_autorised= array(
'PDF'=> 1,'TXT'=>1,
);
public function __construct($path,$ext='',$fullPath='')
{
$this->_ext= strtolower($ext);
if($fullPath==''){
$fullPath= dirname(__FILE__);
}
$this->_path=$fullPath."/".$path;//current path
$this->_basepath=$fullPath."/";//current path
$this->_root=explode('/',$path);//root folder
$this->_base=$path;
$this->_folders=$this->listFolder();
$max= count($this->_folders);
for($i=0; $i < $max; $i++){
if(isset($this->_folders[$i]['FOLDER'])){
$this->_folderNames[$this->_folders[$i]['FOLDER']]=1;
}
}
$this->upload();
}
public function listFolder($PATH='')
{
return $this->listFiles($PATH,$output=1);
}
public function getBaseFolder($path)
{
$tmp =explode('/',$path);
$step=(is_file($path))?2:1;
$dirNum = count($tmp)-$step;
return $tmp[$dirNum];
}
/* useless?*/
public function getFilePathPDF($path)
{
if(is_file($path)){
$path= dirname($path).'/';
}
$start= mb_strpos($path, $this->_base)+ mb_strlen($this->_base)-1;
$foundPath= preg_replace('#^/#','',mb_substr($path, $start) );
return $foundPath;
}
public function listFiles ($PATH='',$output=0)
{
$result= array();//define root
$folderList=array();
$PATH=($PATH=='')?$this->_path: $this->_basepath.$PATH;
if(file_exists($PATH)){
if ($handle = opendir($PATH) ) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".."){
/* READING FOLDER*/
/*adding trailling slah if requiered*/
$path_length= mb_strlen($PATH);
$lastChar= mb_substr($PATH, $path_lenght-1);
$PATH .=($lastChar !='/')?'/':'';
$currentFile =$PATH.$entry;
$currentFolder= $this->getFilePathPDF($currentFile);
$folderList[]= $currentFolder;
$ext_length= strlen($this->_ext);
if($ext_length>= 2){
//compare the ext in lower case
if ( strtolower(substr($entry, -$ext_length) )== $this->_ext){
switch($output){
case 0:
if( !is_file($currentFile)){//shouldn't be the case
//echo "----NOt A FILE--- $output **";
} else {
$result[]= array('PDF' =>$entry, 'PATH'=>$this->_base, 'FOLDER'=>$currentFolder);// return the result as a list [EXT][ FLE NAME]
}
break;
case 1:
if( !is_file($currentFile)){
$result[]= array ('PATH'=>$this->_base, 'FOLDER'=>$currentFolder);
}else {
/* necesseary for listing on the root? */
$result[]= array('PDF' =>$entry, 'PATH'=>$this->_base, 'FOLDER'=>$currentFolder);
}// break;
break;
case 2:
if( is_file($currentFile)){
$result[]= array('PDF' =>$entry, 'PATH'=>$this->_base, 'FOLDER'=>$currentFolder);
}// break;
default: break;
}
}else{// default list everything
// in this case there's a file with an other extension
$tmp= explode('.',$entry);
$fileExt=strtoupper($tmp[1]);
switch($output){
case 0:
if(is_file($currentFile)){
if($this->_autorised[$fileExt]){
$result[]= array(strtoupper($fileExt) =>$entry, 'PATH'=>$this->_base, 'FOLDER'=>$currentFolder);
}
} else {
//we found a folder. assuming a sub folder
$result[]= array('PATH'=>$this->_base,'FOLDER'=>$currentFolder.'/','L221'=>0);// 'FOLDER'=>$currentFolder 'PDF' =>'',
}
break;
case 1: // LOOKING FOR FOLDER LIST
if( !is_file($currentFile)){
$result[]= array('PATH'=>$this->_base, 'FOLDER'=>$currentFolder,'L227'=>0);
}
break;
case 2: // file only
if( is_file($currentFile)){
$result[]= array(strtoupper($fileExt)=> $entry,'PATH'=> $currentFolder, 'L232'=>0);
};
break;
case 99: //No filter
if(is_file($currentFile)){
$result[]= array(strtoupper($fileExt) =>$entry,'PATH'=>$this->_base, 'FOLDER'=>$currentFolder);
} else {
$result[]= array('PDF' =>'', 'PATH'=>$currentFolder.$entry, 'FOLDER'=>$entry);
}
break;
}
//$folderList[]=$currentFolder.$entry;
}
} else {
//echo "other case";
//$result[]= $entry;
}
}
}//end while
closedir($handle);
} else {
//echo "---Can open Files!";
}
} else {
//echo "---no files exists!";//happends when listing the pdf for wp composer
}
$this->_folderNames= array_unique($folderList);
return (count($result)>0)?$result: array ('PATH'=>$this->_base, 'FOLDER'=>'');//define root;
}
/* intend to be display
SHOULD BE--OK 2015-12-01 */
public function displayFilesList($folder='',$downloadoption=0)
{
if($folder!=''){
$this->_path= $this->_path.$folder."/";
$this->_base= $this->_base.$folder."/";
$this->_folders=$this->listFolder();
}
$this->parseFolder();
$projectName=strtolower(get_current_theme() );// $SASS_BASE."project/
$base= dirname(__FILE__);
$keyword="plugins";
$base= substr($base,0 , strpos($base,$keyword));
$destination= str_replace('/var/www/html/','', $base)."themes/$projectName/".$this->_path;
$max=(isset($this->_folders[0]))? count($this->_folders):1;
for($i=0; $i < $max; $i++){
$currentFolderLevel= $this->_folders[$i]['PATH'].$this->_folders[$i]['FOLDER'];
$PATH=(isset($this->_folders[$i]['PATH']))? $this->_folders[$i]['PATH']: $this->_folders['PATH'];
$FOLDER= (isset($this->_folders[$i]['FOLDER']))? $this->_folders[$i]['FOLDER']: $this->_folders['FOLDER'];
$sub= count($this->_files[ $currentFolderLevel] );
if($sub>0){
include(dirname(__FILE__). "/../template/files_list.php"); //to put inside a template
}
}
}
/* ===== admin screen ============*/
public function newDir($name)
{
$newfolder= $this->_path.$name;
if(file_exists($newfolder)){
//echo "Folder exist (".$newfolder.")<br>";
}else{
//echo "Project (".$newfolder."): DOESN'T EXIST. CREATING.";
mkdir($newfolder,0777);
}
}
public function delFile($name, $path='')
{
$path=($path=='')?$this->_path: $path;
$todel=$this->_basepath. $path.$name;
if(file_exists($todel)){
if(unlink($todel)){
echo "$name を削除しました!";
} else {
echo "Error!";
}
}else{
echo "Project (".$todel."): DOESN'T EXIST.";
}
}
public function upload($UPLOAD_NAME='fileupload')
{
if(isset($_FILES[$UPLOAD_NAME])){
$FILE=$_FILES[$UPLOAD_NAME];
if ($FILE["error"] > 0) {
echo "Error #" . $FILE["error"] . "<br>";
}else{
// check if its an autorised files
$tmp= explode('.',$FILE['name']);
$uploadedExt=strtoupper($tmp[1]);
if (isset($this->_autorised[$uploadedExt])){
//moves teh file to the requiered folder
$folder=cleanString($_POST['destination'],'txt');
if($_POST['newFolder']!=''){
$folder .= '/'. cleanString($_POST['newFolder'],'txt');
if(!isset($this->_folderNames[$folder])){
$this->newDir($folder);
}
}
$destFolder=$this->_basepath.$folder;
//echo "will upload to :$destFolder || tmp name =".$FILE['tmp_name'];
$filename = $FILE['name'];
if(is_uploaded_file($FILE['tmp_name'])){
if (move_uploaded_file($FILE['tmp_name'],$destFolder.'/'.$filename) == TRUE){
$this->_folders=$this->listFolder();//update files list
}else{
echo "ERROR UPLOADING ".$filename."!";
}
}else {
echo "File not uploaded?";
}
} else {
echo "Non authorised file! Upload aborted.!";
}
}
}
}
public function uploadForm()
{
$tree= $this-> getTree();
$max= count($tree);
include(dirname(__FILE__). "/../template/uploadForm.php");
}
/* TO CHECK */
public function getTree()
{
$max= count($this->_folders);
//print_r($this->_folders);
$tree=array();
$tree[]= '';
for($i=0; $i < $max; $i++){
$baseFolder= (isset($this->_folders[$i]['PATH']))?$this->_folders[$i]['PATH']:$this->_folders[$i];
$current=$this->listFolder( $baseFolder);
$tree[]= $baseFolder;
$maxSub= count($current);
for($j=0; $j < $maxSub; $j++){
$tree[]= $baseFolder.$current[$j]['FOLDER'];;
}
}
return array_unique($tree);
}
/* IN PROGRESS*/
public function manageFiles()
{
$this->deleteMng();
$this->parseFolder();
$this->_folders[]= array ('PATH'=>$this->_base, 'FOLDER'=>'', 'ROOT'=>1);// add root
$max= count($this->_folders);
//echo "----------------------------------------------------DEBUG ADMIN=============================<br>\r\n";
// print_r($this->_folders);// FOLDER LIST
for($i=0; $i < $max; $i++){
$ENTRY=$this->_folders[$i];
if(is_array($ENTRY)){
$PATH= (isset($ENTRY['PATH']))?$ENTRY['PATH']:$ENTRY;
$FOLDER=(isset($ENTRY['FOLDER']))?$ENTRY['FOLDER']:'';
$baseFolder= $PATH.$FOLDER;//list of directory dedicated to PDF
echo "<h2>親フォルダー:$baseFolder</h2>";
$currentFolder='';// reset?
$current=$this->listFolder( $baseFolder);
$maxSub= count($current);
$currentPDFList= $this->listFiles( $FOLDER) ;
$sub= count($currentPDFList);
//check list the file
$LIST ='';
if($maxSub>0){
for($j=0; $j < $maxSub; $j++){
$PDF=(isset($current[$j]['PDF']))?$current[$j]['PDF']:'';
if($PDF!=''){//Files
$pdfPath= $current[$j]['PATH'].$current[$j]['FOLDER'];
$currentFolder=$current[$j]['FOLDER'];
$isFolder=0;
$EXT_KEY= explode('.',$PDF);
// print_r($EXT_KEY);
$extPos=count($EXT_KEY)-1;
$filename= $EXT_KEY[0];
if( $EXT_KEY[$extPos]== strtoupper($this->_ext)){
$link= get_bloginfo('template_url').'/'. $pdfPath.'/'.$filename.'.'.strtoupper($this->_ext);
// $filename= $EXT_KEY[0];
} else {
$link= get_bloginfo('template_url').'/'. $pdfPath.'/'.$filename.'.'.$EXT_KEY[$extPos];
}
if($isFolder==0){
$LIST .=' <li>'.$filename.'<button type="submit" name="delete" value="'. base64_encode ( $pdfPath ).'_'. base64_encode ( $filename ).'">ファイル削除</button></li>';
}
}
}
include(dirname(__FILE__). "/../template/files_mng.php");
}
}
}
}
private function deleteMng()
{
if(isset($_POST['delete'])){
$data= explode('_',$_POST['delete']);
$folder=base64_decode ( $data[0]);
$file=base64_decode ( $data[1]);
//confirmation screen
if(isset($_POST['deleteOK'])){
//echo " $file を削除します";
$this->delFile($file, $folder.'/');
} else {
include(dirname(__FILE__). "/../template/files_delete_chk.php");
}
}
}
private function parseFolder($option=0)
{
$max= count($this->_folders);
for($i=0; $i < $max; $i++){
$PATH= (isset($this->_folders[$i]['PATH']))?$this->_folders[$i]['PATH']:$this->_folders[$i];
$FOLDER=(isset($this->_folders[$i]['PATH']))?$this->_folders[$i]['FOLDER']:'';
$FILES_LIST[$PATH.$FOLDER]= $this->listFiles($PATH.$FOLDER,$option);//.$this->_folders[$i]['PDF']
}
$this->_files=$FILES_LIST;
}
/* doesnt return a folder?*/
public function getSelectList($folder='',$return=1,$debug=0)
{
if($folder!=''){
$this->_path= $this->_path.urldecode($folder)."/";
$this->_folders=$this->listFolder();
}
$list=$this->listFiles();
if($debug==1){
echo "DBG: folder: $folder-|| Path=".$this->_path;
$TMP=array('PDF'=>'','PATH'=>'',);
echo "---gets elected:-";
print_r($list);
echo "---fodlers listd:-";
print_r($this->_folders);
}
$max = count( $list);
for($i=0; $i < $max; $i++){
if(isset($list[$i]['PDF'])){
if($list[$i]['PDF']!=''){
if($return==1){
$TMP['PDF'].= "'".$list[$i]['PDF']."',";
$TMP['PATH'].= "'".$list[$i]['PATH'].$list[$i]['FOLDER']."',";
} else {
$TMP['PDF'].= '<option value="'.$this->_path.$list[$i]['PATH'].$this->_path.$list[$i]['PDF'].'">'.$list[$i]['PDF'].'</option>';
}
}
}
}
return $TMP;
}
}<file_sep>/README.md
#============================
#
# wp_pdf_manager
#
#============================
# plugin for wordpress.
#============================
# This plugin Allows to manage PDF files from administration Panel
# OR FTP software
#
#i
# Currents features are:
# - Automatic PDF listing ),
# - Link editing (shortcode).
#
#------------------------------------------------------------------
# VERSION HISTORY :
#------------------------------------------------------------------
#
# 2016-02-10: v0.35):
# added option: download file
# Improved Compatibility
#
# 2015-12-01 (v0.3)
# 2015- 11-10 (v0.2):Few changes for a more them independant use.
# Improved compatibility with wp_tiny_MCE
# Code Rewritting:
# Allow to select files from the PDF root, then POST TYPE, then Post Name
#
#
#------------------------------------------------------------------
# TO DO:
#------------------------------------------------------------------
# Remove comments
# rewrite some function in a more DRY way.
<file_sep>/template/files_delete_chk.php
<?php
/**
* File type: template
* file name: files_delete_chk.php
*
*
*/
?>
<div class="popup">
<div>
<h2 class="alert">ご注意ください:<br><?= $folder;?>/<?= $file;?>を消します。</h2>
<p><?= $folder;?>/<?= $file;?>を本当に削除してもよろしいでしょうか?</p>
<form method="post" action="#" enctype="multipart/form-data">
<button type="submit" name="deleteOK" value="cancel" class="green">戻る</button>
</form>
<form method="post" action="#" enctype="multipart/form-data">
<button type="submit" name="deleteOK" value="ok" class="red"><?= $file;?>を削除する</button>
<input type="hidden" name="delete" value="<?= $_POST['delete'];?>">
</form>
</div>
</div>
<file_sep>/pdf_dial.php
<?php
global $gs_file_upload;
global $option;
global $post;
$PDF= new FFM($gs_file_upload,'PDF', $option);
echo '<style>
#pdfLink{display:none;}
.popup {width:400px;display:block;position:absolute; top:300px; margin:0 auto;}
</style>';
//show
$selection= $PDF->getSelectList($post->post_name);
//$PDF->uploadForm();
//echo "***=====CUSTOM=========---";
echo '<div class="popup">************pdf_dial.php';
echo '<select id="pdfSelector">'.$selection.'</select>';
echo '</div>';<file_sep>/template/files_mng.php
<?php
/**
* File type: template
* file name: files_mng.php
*
*
*/
/*<button type="submit" name="delete" value="<?= $i;?>">全部削除</button>*///was button on the h3 title
?>
<form method="post" action="#" enctype="multipart/form-data">
<h3><?=$currentFolder;?></h3>
<ul>
<?= $LIST;?>
</ul>
</form><file_sep>/js/pdf-updated.js
( function() {
// Register plugin
tinymce.create( 'tinymce.plugins.pdflink', {
init: function( editor, url ) {
// Add the Insert Gistpen button
editor.addButton( 'pdflink', {
//text: 'Insert Shortcode',
title : 'PDFリンクを入れる',
image : url+'/pdficon_small.png',
icon: 'icons dashicons-icon',
tooltip: 'Insert PDF',
cmd: 'pdf_dial'
});
editor.addCommand( 'pdf_dial', function() {
editor.windowManager.open({
title: 'PDF選択',
width : 420 + parseInt(editor.getLang('button.delta_width', 0)), // size of our window
height : 35 + parseInt(editor.getLang('button.delta_height', 0)), // size of our window
inline: 1,
id: 'pdf-insert-dialog',
buttons: [{
text: 'Insert',
id: 'pdf-button-insert',
class: 'insert',
onclick: function( e ) {
//insertShortcode();
var linkText= editor.selection.getContent();
var fileName= jQuery( '#uploaded_PDF'). find(":selected").text();;
editor.selection.setContent("\r\n"+'<a href="[pdf_url]' +fileName + '" class="ico_pdf" target="blank">' + linkText + '</a>');
editor.windowManager.close();
}
},
{
text: 'Cancel',
id: 'pdf-button-cancel',
onclick: 'close'
}],
});
// external function
appendInsertDialog();
});
}
});
tinymce.PluginManager.add( 'pdflink', tinymce.plugins.pdflink );
function appendInsertDialog () {
var foundPDFCount= foundPDF.length;
var menuTxt='';
if(foundPDFCount>0){
menuTxt='<span id="textPdfLink">ファイル名</span>:<select id="uploaded_PDF">';
var select= '';
for(var i in foundPDF) { //var is generated and inserted to page from the WP plugin PDFplugin function
select= select+'<option value="'+foundUrlPDF[i]+'">'+foundUrlPDF[i]+foundPDF[i]+'</option>';
}
menuTxt= menuTxt+select+'</select>';
}
else{
menuTxt='<a href="?page=pdf-management.php" style="text-decoration:underline;color:#00a0d2;">管理画面から</a><br>「'+pdfFolder+'」にPDFをアップロードしてください';
}
jQuery( '#pdf-insert-dialog-body' ).css( 'text-align', 'center' );
jQuery( '#pdf-insert-dialog-body' ).css( 'padding', '10px' );
jQuery( '#pdf-insert-dialog-body' ).append( menuTxt );
}
})();
| d50156de74e0c97bbcae70846f80e11528a5708b | [
"Markdown",
"JavaScript",
"PHP"
] | 9 | PHP | staimphin/wp_pdf_manager | 79228bab63631c51da88ca9f7f140a9c1d143fdb | 318aee826624aa76537782f35138cc5e9710c741 |
refs/heads/master | <file_sep># Flashcard-Generator Command Line App
## Flashcard Generator application is a backend that essentially constitutes an API that allows users to create two types of flashcards:
1. Basic flashcards, which have a front ("Who was the first president of the United States?"), and a back ("<NAME>").
2. Cloze-Deleted flashcards, which present partial text ("... was the first president of the United States."), and the full text when the user requests it ("<NAME> was the first president of the United States.")
## The flash card has three parts:
1. The full text. This is the entire sentence users need to remember: "<NAME> was the first president of the United States."
2. The cloze deletion. This is the text we've chosen to remove: "<NAME>".
3. The partial text. This is what we get if we remove the cloze deletion from the full text: "... was the first president of the United States.
<img src="https://github.com/acbrent25/Flashcard-Generator/blob/master/flashcard%20generator.gif?raw=true" alt="Command Line Flashcard Generator">
<file_sep>var inquirer = require('inquirer');
var fs = require("fs");
var BasicCard = require("./BasicCard.js");
var ClozeCard = require("./ClozeCard.js");
var basicCardArr = [];
var basicCardFront;
var basicCardBack;
var basicCard;
var partial;
/************************
CHOOSE CARD TYPE
*************************/
inquirer.prompt([
{
type: "list",
name: "chooseCardType",
message: "What Kind of Flashcard Do You Want to Make?",
choices: ["Basic", "Cloze"]
}
]).then(function(card) {
if (card.chooseCardType === "Basic") {
console.log("==============================================");
console.log("Basic Card");
console.log("==============================================");
createBasicCard();
}
else {
console.log("==============================================");
console.log("Cloze Card");
console.log("==============================================");
createClozeCard();
}
});
/************************
CREATE BASIC CARD
************************/
function createBasicCard(){
inquirer.prompt([
{
type: "input",
name: "cardFront",
message: "Please enter the Flashcard front text"
},
{
type: "input",
name: "cardBack",
message: "Please enter the Flashcard back text"
},
]).then(function(basicText) {
var newBasicCard = new BasicCard (basicText.cardFront, basicText.cardBack)
fs.appendFile("basiccard.txt", "Flashcard front: " + basicText.cardFront + ", " + " Flashcard Back: " + basicText.cardBack + "\r\n", function(err) {
if (err) {
return console.log(err);
}
})
// Print out current card
console.log("==============================================");
console.log("Current Card");
console.log("------------");
console.log("Flashcard front: " + basicText.cardFront + ", " + " Flashcard Back: " + basicText.cardBack);
console.log("\n\r");
console.log("==============================================");
readCards();
}
)
};
/************************
CREATE BASIC CARD
************************/
function createClozeCard(){
inquirer.prompt([
{
type: "input",
name: "text",
message: "Please enter the full text"
},
{
type: "input",
name: "cloze",
message: "Please enter the cloze"
},
]).then(function(clozeText) {
console.log(clozeText.text)
var newClozeCard = new ClozeCard (clozeText.text, clozeText.cloze)
partial = clozeText.text.replace(clozeText.cloze, "_____________");
fs.appendFile("basiccard.txt", "Full Text: " + clozeText.text + ", " + " Cloze: " + clozeText.cloze + "\r\n", function(err) {
if (err) {
return console.log(err);
}
})
// Print out current card
console.log("==============================================");
console.log("Current Card");
console.log("------------");
console.log("Flashcard front: " + partial + ", " + "\n\r" + " Flashcard Back: " + clozeText.text);
console.log("\n\r");
console.log("==============================================");
readCards();
}
)
};
function readCards() {
// Read the existing bank file
fs.readFile("basiccard.txt", "utf8", function(err, cardData) {
if (err) {
return console.log(err);
}
// Print out all cards
console.log("==============================================");
console.log("All Cards");
console.log("----------");
console.log(cardData);
console.log("==============================================");
});
}
| 871da996c532264338d55aa0e7daa9e6dfcdb9ad | [
"Markdown",
"JavaScript"
] | 2 | Markdown | acbrent25/Flashcard-Generator | 6d3954bbe445fd0e146c18c3ef425bdf50122e32 | 4d430bb99c5ab6d94c241de32e7aa1f7b349c4c4 |
refs/heads/main | <file_sep># CodeAcademy-Full-Stack-Engineering<file_sep>let story = 'Last weekend, I took literally the most beautiful bike ride of my life. The route is called "The 9W to Nyack" and it actually stretches all the way from Riverside Park in Manhattan to South Nyack, New Jersey. It\'s really an adventure from beginning to end! It is a 48 mile loop and it basically took me an entire day. I stopped at Riverbank State Park to take some extremely artsy photos. It was a short stop, though, because I had a really long way left to go. After a quick photo op at the very popular Little Red Lighthouse, I began my trek across the George Washington Bridge into New Jersey. The GW is actually very long - 4,760 feet! I was already very tired by the time I got to the other side. An hour later, I reached Greenbrook Nature Sanctuary, an extremely beautiful park along the coast of the Hudson. Something that was very surprising to me was that near the end of the route you actually cross back into New York! At this point, you are very close to the end.';
let overusedWords = ['really', 'very', 'basically'];
let unnecessaryWords = ['extremely', 'literally', 'actually' ];
//Split all the words and save them into a new array
const storyWords = story.split(' ');
//Prints the amount of words stored in the array
console.log(`Words in story: ${storyWords.length}`);
const betterWords = storyWords.filter(word => !unnecessaryWords.includes(word))
//Count the amount of each overused word and print to console
overusedReally = 0;
overusedVery = 0;
overusedActually = 0;
for (word of storyWords) {
if (word === overusedWords[0]){
overusedReally += 1
}
else if (word == overusedWords[1]){
overusedVery += 1
}
else if (word == overusedWords[2]){
overusedActually += 1
}}
console.log(`'Really' count: ${overusedReally}`)
console.log(`'Very' count: ${overusedVery}`)
console.log(`'Actually' count: ${overusedActually}`)
let sentences = 0;
storyWords.forEach(word => {
if(word[word.length-1] === '.' || word[word.length-1] === '!') {
sentences += 1
}
})
console.log(`Sentences count: ${sentences}`)
console.log(betterWords.join(' ')); | dcb5b27ea251276e42b75619decd5504a6ff29f3 | [
"Markdown",
"JavaScript"
] | 2 | Markdown | bradbieselin/CodeAcademy-Full-Stack-Engineering | 9767dfdbb437f09bff1ae116933159361fcd27c6 | 4a798393b3e84dc77f5a7161acd7fd8da3b1ea69 |
refs/heads/master | <repo_name>omar-enrique/Data-Structures<file_sep>/C++Based/CPP_LinkedList/CppLinkedList/Queue.h
#pragma once
#include "List.h"
template <class T>
class Queue : private List<T>
{
public:
Queue();
~Queue();
bool enqueue(T &data);
bool dequeue(T &data);
};
template <class T>
Queue<T>::Queue() : List<T>()
{
}
template <class T>
Queue<T>::~Queue()
{
}
template <class T>
bool Queue<T>::enqueue(T &data)
{
return this->insertAtEnd(data);
}
template <class T>
bool Queue<T>::dequeue(T &data)
{
if (this->isEmpty())
return false;
else
{
data = this->deleteAtFront();
return true;
}
}<file_sep>/Java-Based/SingleLinkedList/SingleLinkedList.java
/**
* SingleLinkedList represents a LinearNode-based implementation of both an unordered and indexed list.
*
* @author Java Foundations,
* @version 4.0
*/
public class SingleLinkedList<T> extends AbstractLinkedList<T> implements UnorderedListADT<T>, IndexedListADT<T>
{
/**
* Adds the specified element to the front of this list.
*
* @param element the element to be added to the list
*/
public void addToFront(T element)
{
LinearNode<T> newNode = new LinearNode<T>(element);
newNode.setNext(head);
head = newNode;
if(tail == null)
tail = newNode;
count++;
modCount++;
}
/**
* Adds the specified element to the rear of this list.
*
* @param element the element to be added to the list
*/
public void addToRear(T element)
{
LinearNode<T> newNode = new LinearNode<T>(element);
if(tail == null)
{
head = tail = newNode;
}
else
{
tail.setNext(newNode);
tail = newNode;
}
count++;
modCount++;
}
/**
* Adds the specified element to this list after the given target.
*
* @param element the element to be added to this list
* @param target the target element to be added after
* @throws ElementNotFoundException if the target is not found
*/
public void addAfter(T element, T target)
{
LinearNode<T> newNode = new LinearNode<T>();
newNode.setElement(element);
LinearNode<T> targetElement = head;
boolean found = false;
while (targetElement != null && !found)
if (target.equals(targetElement.getElement()))
found = true;
else
{
targetElement = targetElement.getNext();
}
if(found == false )
throw new ElementNotFoundException("SLL");
newNode.setNext(targetElement.getNext());
targetElement.setNext(newNode);
if(newNode.getNext() == null)
tail = newNode;
count++;
modCount++;
}
/**
* Inserts the specified element at the specified index.
*
* @param index the index into the array to which the element is to be
* inserted.
* @param element the element to be inserted into the array
* @throws IndexOutOfBoundsException for invalid index
*/
public void add(int index, T element)
{
if(index<0 || index>size())
throw new IndexOutOfBoundsException();
if(index == 0)
{
addToFront(element);
}
else if(index == size())
addToRear(element);
else{
LinearNode<T> prev = head;
for(int i = 0; i < index-1; i++)
prev = prev.getNext();
LinearNode<T> newNode = new LinearNode<T>(element);
prev.setNext(newNode);
modCount++;
count++;
}
}
/**
* Adds the specified element to the rear of this list.
*
* @param element the element to be added to the rear of the list
*/
public void add(T element) {
addToRear(element);
}
/**
* Sets the element at the specified index.
*
* @param index the index into the array to which the element is to be set
* @param element the element to be set into the list
* @throws IndexOutOfBoundsException for invalid index
*/
public void set(int index, T element) {
if(index<0 || index>=size() || isEmpty())
throw new IndexOutOfBoundsException();
LinearNode<T> node = new LinearNode<T>(element);
if(index == 0)
{
node.setNext(head);
}
else if(index == size())
{
node.setNext(tail);
}
else
{
LinearNode<T> current = head;
for(int i = 0; i < index-1; i++)
current = current.getNext();
node.setNext(current);
remove(current.getElement());
}
modCount++;
}
/**
* Returns a reference to the element at the specified index.
*
* @param index the index to which the reference is to be retrieved from
* @return the element at the specified index
* @throws IndexOutOfBoundsException for invalid index
*/
public T get(int index) {
if(index<0 || index>=size() || isEmpty())
throw new IndexOutOfBoundsException();
if(index == 0)
{
return head.getElement();
}
else if(index == size())
{
return tail.getElement();
}
else{
LinearNode<T> prev = head;
for(int i = 0; i < index-1; i++)
prev = prev.getNext();
return prev.getElement();
}
}
/**
* Returns the index of the specified element.
*
* @param element the element for the index is to be retrieved
* @return the integer index for this element or -1 if element is not in the list
*/
public int indexOf(T element) {
LinearNode<T> prev = head;
for(int i = 0; i < size(); i++)
{
if(element.equals(prev.getElement()))
return i;
prev = prev.getNext();
}
return -1;
}
/**
* Returns the element at the specified element.
*
* @param index the index of the element to be retrieved
* @return the element at the given index
* @throws IndexOutOfBoundsException for invalid index
*/
public T remove(int index) {
if(index<0 || index>=size() || isEmpty())
throw new IndexOutOfBoundsException();
LinearNode<T> current = head;
LinearNode<T> previous = null;
for(int i = 0; i<index;i++)
{
previous = current;
current = current.getNext();
}
if(size() == 1)
{
head = tail = null;
}
else if(current.equals(head))
head = current.getNext();
else if(current.equals(tail))
{
tail = previous;
tail.setNext(null);
}
else
previous.setNext(current.getNext());
modCount++;
count--;
return current.getElement();
}
}
<file_sep>/C++Based/Binary_Search_Tree/122_PA6/BST.cpp
#include "BST.h"
BST::BST()
{
mpRoot = nullptr;
}
BST::BST(const BST &rhs)
{
this->mpRoot = rhs.mpRoot;
}
BST::~BST()
{
deleteTree(); // Frees the memory allocated for every node in the tree
}
Node * BST::getRoot() const
{
return mpRoot;
}
// read the parameter type from right-to-left;
// newRoot is a constant pointer to a Node. This means
// the contents of newRoot can't be modified, but
// the Node can be modified!
void BST::setRoot(Node * const newRoot)
{
mpRoot = newRoot;
}
// public
void BST::insert(char letter, string code)
{
bool done;
// call private insert ()
done = insertInOrder(this->mpRoot, letter, code, 0);
}
// private
bool BST::insertInOrder(Node *& pTree, char letter, string code, int height)
{
/* Code below inserts the nodes in a way that the whole tree will be balanced out perfectly, with the same amount of nodes
on one side as on another side of the tree */
bool inserted = false;
if (pTree == nullptr) // base case - we found spot in tree to insert
{
pTree = new Node(letter, code);
return true;
}
//The algorithm h >= log2(n+1)-1 >= log2(n) has been used to balance Binary Search Trees, with
// h being the vertical maximum height of a balanced Binary Tree and n being the number of nodes this tree will have.
// So, since log2(39+1)-1 approximates to 4.32... its ceiling is 5, which is h.
// I use this algorithm for balancing out my binary tree in the following if statement
else if ((height + 1) <= (int) (log2(39+1))) //n is 39 because there will always be 39 morse character translations in "MorseTable.txt"
{
if(inserted == false)
inserted = insertInOrder(pTree->getLeft(), letter, code, height + 1);
if (inserted == false)
inserted = insertInOrder(pTree->getRight(), letter, code, height + 1);
}
else
{
//cout << "duplicate" << endl;
}
/* Code below inserts the nodes in order, whereas code above does a balanced tree */
//if (pTree == nullptr) // base case - we found spot in tree to insert
//{
// pTree = new Node(letter, code);
// return true;
//}
//else if (letter < pTree->getLetter())
//{
// inserted = insertInOrder(pTree->getLeft(), letter, code, 0);
//}
//else if (letter > pTree->getLetter())
//{
// inserted = insertInOrder(pTree->getRight(), letter, code, 0);
//}
//else
//{
// cout << "duplicate" << endl;
//}
return inserted;
}
void BST::preOrderTraversal()
{
preOrderTraversal(this->mpRoot);
}
void BST::preOrderTraversal(Node *&pTree)
{
if (pTree != nullptr)
{
cout << pTree->getLetter() << " " << pTree->getCode() << endl;
preOrderTraversal(pTree->getLeft());
preOrderTraversal(pTree->getRight());
}
}
void BST::print()
{
print(this->mpRoot);
}
void BST::print(Node *&pTree)
{
if (pTree != nullptr)
{
cout << pTree->getLetter() << " " << pTree->getCode() << endl;
print(pTree->getLeft());
print(pTree->getRight());
}
}
string BST::search(char letter)
{
string code;
bool found;
found = search(this->mpRoot, letter, code);
return code;
}
bool BST::search(Node *&pTree, char letter, string &code)
{
bool found = false;
if (pTree != nullptr)
{
if ((int)letter < 97) // If the character is not a lowercase character
{
if (letter == pTree->getLetter()) // If matching character to current letter we are searching has been found
{
code = pTree->getCode(); // Get code of matching character
found = true;
}
}
else // If the character is a lower case character
{
if (((int)letter - 32) == (int)pTree->getLetter()) // Reduce ascii value of lower case character to its upper case value
{
code = pTree->getCode(); // Then get the matching code of the character
found = true;
}
}
}
if (pTree != nullptr && found == false) // If the matching character was not found in this node, keep searching
{
found = search(pTree->getLeft(), letter, code);
}
if (pTree != nullptr && found == false) // If the matching character was not found in this node, keep searching
{
found = search(pTree->getRight(), letter, code);
}
return found;
}
void BST::deleteTree()
{
deleteTree(this->mpRoot);
}
void BST::deleteTree(Node *&pTree)
{
Node *pNextLeft, *pNextRight;
if (pTree != nullptr)
{
pNextLeft = pTree->getLeft();
pNextRight = pTree->getRight();
delete pTree;
//Deletes every node in the tree, splitting off to the left and right of the current node
deleteTree(pNextLeft);
deleteTree(pNextRight);
}
}<file_sep>/C++Based/Binary_Search_Tree/122_PA6/BST.h
#pragma once
#include <iostream>
#include <string>
#include "BSTNode.h"
using std::cin;
using std::cout;
using std::endl;
using std::string;
class BST
{
public:
BST();
BST(const BST &rhs);
~BST();
Node *getRoot() const;
void setRoot(Node * const newRoot);
// will call on private insert (), pass through the data
void insert(char letter, string code);
void print();
void preOrderTraversal();
string search(char letter);
void deleteTree();
private:
Node *mpRoot;
void print(Node *&pTree);
void preOrderTraversal(Node *&pTree);
// hides pointer information for recursive calls
bool insertInOrder(Node *& pTree, char letter, string code, int height);
bool BST::search(Node *&pTree, char letter, string &code);
void deleteTree(Node *&pTree);
// hides pointer information for recursive calls
};<file_sep>/C++Based/Binary_Search_Tree/122_PA6/BSTNode.cpp
#include "BSTNode.h"
Node::Node(char newLetter, string newCode)
{
mLetter = newLetter;
mCode = newCode; // will be on heap
mpLeft = nullptr;
mpRight = nullptr;
}
Node::~Node()
{
/*cout << "Inside Node's destructor!" << endl;
cout << "Deleting node with data: " << mLetter << mCode << endl;*/
}
char Node::getLetter() const // can't call non const functions
{
return mLetter;
}
string Node::getCode() const // can't call non const functions
{
return mCode;
}
Node *& Node::getLeft()
{
return mpLeft;
}
Node *& Node::getRight()
{
return mpRight;
}
void Node::setLetter(const char newData) // setData (string newData);
{
mLetter = newData;
}
// setData ("literal string");
void Node::setCode(const string newData) // setData (string newData);
{
mCode = newData;
}
void Node::setLeft(Node * const newLeft)
{
mpLeft = newLeft;
}
void Node::setRight(Node * const newRight)
{
mpRight = newRight;
}<file_sep>/C++Based/Binary_Search_Tree/122_PA6/BSTNode.h
#pragma once
#include <iostream>
#include <string>
#include <cmath>
using std::cin;
using std::cout;
using std::endl;
using std::string;
class Node
{
public:
Node(char newLetter, string newCode);
~Node();
// we will implement a copy constructor and destructor later...
char getLetter() const;
string getCode() const; // can't call non const functions
Node *& getLeft();
Node *& getRight();
void setLetter(const char newData);
void setCode(const string newData);
void setLeft(Node * const newLeft);
void setRight(Node * const newRight);
private:
// mLetter is the english character, number, or punctuation associated with the morse code
char mLetter;
// mCode is the morse code associated with the character
string mCode;
Node *mpLeft; // Left Node
Node *mpRight; // Right Node
};<file_sep>/Java-Based/ListTesting/ListTester.java
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* A unit test class for lists that implement both UnorderedListADT and
* IndexedListADT. This is a set of black box tests that should work for any
* implementation of these interfaces.
*
* NOTE: One example test is given for each interface method using a new list to
* get you started.
*
* @author mvail, mhthomas, Omar
*/
public class ListTester {
//possible lists that could be tested
private enum ListToUse {
goodList, badList, arrayList, singleLinkedList, doubleLinkedList
};
// TODO: THIS IS WHERE YOU CHOOSE WHICH LIST TO TEST
private final ListToUse LIST_TO_USE = ListToUse.doubleLinkedList;
// possible results expected in tests
private enum Result {
EmptyCollection, ElementNotFound, IndexOutOfBounds, IllegalState, ConcurrentModification, NoSuchElement,
NoException, UnexpectedException,
True, False, Pass, Fail,
MatchingValue,
ValidString
};
// named elements for use in tests
private static final Integer ELEMENT_A = new Integer(1);
private static final Integer ELEMENT_B = new Integer(2);
private static final Integer ELEMENT_C = new Integer(3);
private static final Integer ELEMENT_D = new Integer(4);
// instance variables for tracking test results
private int passes = 0;
private int failures = 0;
private int total = 0;
/**
* @param args not used
*/
public static void main(String[] args) {
// to avoid every method being static
ListTester tester = new ListTester();
tester.runTests();
}
/**
* Print test results in a consistent format
*
* @param testDesc description of the test
* @param result indicates if the test passed or failed
*/
private void printTest(String testDesc, boolean result) {
total++;
if (result) { passes++; }
else { failures++; }
System.out.printf("%-46s\t%s\n", testDesc, (result ? " PASS" : "***FAIL***"));
}
/** Print a final summary */
private void printFinalSummary() {
System.out.printf("\nTotal Tests: %d, Passed: %d, Failed: %d\n",
total, passes, failures);
}
/** XXX <- see the blue box on the right of the scroll bar? this tag aids in navigating long files
* Run tests to confirm required functionality from list constructors and methods */
private void runTests() {
//recommended scenario naming: start_change_result
test_newList(); //aka noList_constructor_emptyList
test_emptyList_addToFrontA_A();
test_emptyList_addToRearA_A();
test_emptyList_addA_A();
test_emptyList_addA0_A();
test_A_removeFirst_emptyList();
test_A_removeLast_emptyList();
test_A_addToFrontB_BA();
test_A_addToRearB_AB();
test_A_addAfterAB_AB();
test_A_remove0_empty();
test_A_removeA_emptyList();
test_AB_addC_ABC();
// test_A_removeLast_emptyList();
// test_A_removeA_emptyList();
//and so on
// report final verdict
printFinalSummary();
}
//////////////////////////////////////
// SCENARIO: NEW EMPTY LIST
// XXX Scenario 1
//////////////////////////////////////
/**
* Returns a ListADT for the "new empty list" scenario.
* Scenario: no list -> constructor -> [ ]
*
* NOTE: the return type is a basic ListADT reference, so each test method
* will need to cast the reference to the specific interface (Indexed or
* UnorderedListADT) containing the method being tested.
*
* @return a new, empty ListADT
*/
private ListADT<Integer> newList() {
ListADT<Integer> listToUse;
switch (LIST_TO_USE) {
// case goodList:
// listToUse = new GoodList<Integer>();
// break;
// case badList:
// listToUse = new BadList<Integer>();
// break;
// case arrayList:
// listToUse = new ArrayList<Integer>();
// break;
// case singleLinkedList:
// listToUse = new SingleLinkedList<Integer>();
// break;
case doubleLinkedList:
listToUse = new DoubleLinkedList<Integer>();
break;
default:
listToUse = null;
}
return listToUse;
}
/** Run all tests on scenario: no list -> constructor -> [ ] */
private void test_newList() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("no list -> constructor -> [ ]");
printTest("newList_testRemoveFirst", testRemoveFirst(newList(), null, Result.EmptyCollection));
printTest("newList_testRemoveLast", testRemoveLast(newList(), null, Result.EmptyCollection));
printTest("newList_testRemoveA", testRemoveElement(newList(), null, Result.ElementNotFound));
printTest("newList_testFirst", testFirst(newList(), null, Result.EmptyCollection));
printTest("newList_testLast", testLast(newList(), null, Result.EmptyCollection));
printTest("newList_testContainsA", testContains(newList(), ELEMENT_A, Result.False));
printTest("newList_testIsEmpty", testIsEmpty(newList(), Result.True));
printTest("newList_testSize", testSize(newList(), 0));
printTest("newList_testToString", testToString(newList(), Result.ValidString));
// UnorderedListADT
printTest("newList_testAddToFrontA", testAddToFront(newList(), ELEMENT_A, Result.NoException));
printTest("newList_testAddToRearA", testAddToRear(newList(), ELEMENT_A, Result.NoException));
printTest( "newList_testAddAfterBA", testAddAfter(newList(), ELEMENT_B, ELEMENT_A, Result.ElementNotFound));
// IndexedListADT
printTest("newList_testAddAtIndexNeg1", testAddAtIndex(newList(), -1, ELEMENT_A, Result.IndexOutOfBounds));
printTest("newList_testAddAtIndex0", testAddAtIndex(newList(), 0, ELEMENT_A, Result.NoException));
printTest("newList_testAddAtIndex1", testAddAtIndex(newList(), 1, ELEMENT_A, Result.IndexOutOfBounds));
printTest("newList_testSetNeg1A", testSet(newList(), -1, ELEMENT_A, Result.IndexOutOfBounds));
printTest("newList_testSet0A", testSet(newList(), 0, ELEMENT_A, Result.IndexOutOfBounds));
printTest("newList_testAddA", testAdd(newList(), ELEMENT_A, Result.NoException));
printTest("newList_testGetNeg1", testGet(newList(), -1, null, Result.IndexOutOfBounds));
printTest("newList_testGet0", testGet(newList(), 0, null, Result.IndexOutOfBounds));
printTest("newList_testIndexOfA", testIndexOf(newList(), ELEMENT_A, -1));
printTest("newList_testRemoveNeg1", testRemoveIndex(newList(), -1, null, Result.IndexOutOfBounds));
printTest("newList_testRemove0", testRemoveIndex(newList(), 0, null, Result.IndexOutOfBounds));
// Iterator
printTest("newList_testIterator", testIterator(newList(), Result.NoException));
printTest("newList_testIteratorHasNext", testIteratorHasNext(newList().iterator(), Result.False));
printTest("newList_testIteratorNext", testIteratorNext(newList().iterator(), null, Result.NoSuchElement));
printTest("newList_testIteratorRemove", testIteratorRemove(newList().iterator(), Result.IllegalState));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_newList");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [ ] -> addToFront(A) -> [A]
// XXX Scenario 2
////////////////////////////////////////////////
/** Scenario: empty list -> addToFront(A) -> [A]
* @return [A] after addToFront(A)
*/
private ListADT<Integer> emptyList_addToFrontA_A() {
// cast to UnorderedListADT to make addToFront() available
UnorderedListADT<Integer> list = (UnorderedListADT<Integer>) newList();
list.addToFront(ELEMENT_A);
return list;
}
/** Run all tests on scenario: empty list -> addToFront(A) -> [A] */
private void test_emptyList_addToFrontA_A() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("empty list -> addToFront(A) -> [A]");
printTest("emptyList_addToFrontA_A_testRemoveFirst", testRemoveFirst(emptyList_addToFrontA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testRemoveLast", testRemoveLast(emptyList_addToFrontA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testRemoveA", testRemoveElement(emptyList_addToFrontA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testRemoveB", testRemoveElement(emptyList_addToFrontA_A(), ELEMENT_B, Result.ElementNotFound));
printTest("emptyList_addToFrontA_A_testFirst", testFirst(emptyList_addToFrontA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testLast", testLast(emptyList_addToFrontA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testContainsA", testContains(emptyList_addToFrontA_A(), ELEMENT_A, Result.True));
printTest("emptyList_addToFrontA_A_testContainsB", testContains(emptyList_addToFrontA_A(), ELEMENT_B, Result.False));
printTest("emptyList_addToFrontA_A_testIsEmpty", testIsEmpty(emptyList_addToFrontA_A(), Result.False));
printTest("emptyList_addToFrontA_A_testSize", testSize(emptyList_addToFrontA_A(), 1));
printTest("emptyList_addToFrontA_A_testToString", testToString(emptyList_addToFrontA_A(), Result.ValidString));
// UnorderedListADT
printTest("emptyList_addToFrontA_A_testAddToFrontB", testAddToFront(emptyList_addToFrontA_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addToFrontA_A_testAddToRearB", testAddToRear(emptyList_addToFrontA_A(), ELEMENT_A, Result.NoException));
printTest( "emptyList_addToFrontA_A_testAddAfterCB", testAddAfter(emptyList_addToFrontA_A(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest( "emptyList_addToFrontA_A_testAddAfterAB", testAddAfter(emptyList_addToFrontA_A(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("emptyList_addToFrontA_A_testAddAtIndexNeg1B", testAddAtIndex(emptyList_addToFrontA_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addToFrontA_A_testAddAtIndex0B", testAddAtIndex(emptyList_addToFrontA_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addToFrontA_A_testAddAtIndex1B", testAddAtIndex(emptyList_addToFrontA_A(), 1, ELEMENT_B, Result.NoException));
printTest("emptyList_addToFrontA_A_testSetNeg1B", testSet(emptyList_addToFrontA_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addToFrontA_A_testSet0B", testSet(emptyList_addToFrontA_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addToFrontA_A_testAddB", testAdd(emptyList_addToFrontA_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addToFrontA_A_testGetNeg1", testGet(emptyList_addToFrontA_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addToFrontA_A_testGet0", testGet(emptyList_addToFrontA_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testIndexOfA", testIndexOf(emptyList_addToFrontA_A(), ELEMENT_A, 0));
printTest("emptyList_addToFrontA_A_testIndexOfB", testIndexOf(emptyList_addToFrontA_A(), ELEMENT_B, -1));
printTest("emptyList_addToFrontA_A_testRemoveNeg1", testRemoveIndex(emptyList_addToFrontA_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addToFrontA_A_testRemove0", testRemoveIndex(emptyList_addToFrontA_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testRemove1", testRemoveIndex(emptyList_addToFrontA_A(), 1, null, Result.IndexOutOfBounds));
// Iterator
printTest("emptyList_addToFrontA_A_testIterator", testIterator(emptyList_addToFrontA_A(), Result.NoException));
printTest("emptyList_addToFrontA_A_testIteratorHasNext", testIteratorHasNext(emptyList_addToFrontA_A().iterator(), Result.True));
printTest("emptyList_addToFrontA_A_testIteratorNext", testIteratorNext(emptyList_addToFrontA_A().iterator(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToFrontA_A_testIteratorRemove", testIteratorRemove(emptyList_addToFrontA_A().iterator(), Result.IllegalState));
printTest("emptyList_addToFrontA_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(emptyList_addToFrontA_A(), 1), Result.False));
printTest("emptyList_addToFrontA_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(emptyList_addToFrontA_A(), 1), null, Result.NoSuchElement));
printTest("emptyList_addToFrontA_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(emptyList_addToFrontA_A(), 1), Result.NoException));
printTest("emptyList_addToFrontA_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addToFrontA_A(), 1)), Result.False));
printTest("emptyList_addToFrontA_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addToFrontA_A(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addToFrontA_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(emptyList_addToFrontA_A(), 1)), Result.IllegalState));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [ ] -> addToRear(A) -> [A]
// XXX Scenario 3
////////////////////////////////////////////////
/** Scenario: empty list -> addToRear(A) -> [A]
* @return [A] after addToRear(A)
*/
private ListADT<Integer> emptyList_addToRearA_A() {
// cast to UnorderedListADT to make addToFront() available
UnorderedListADT<Integer> list = (UnorderedListADT<Integer>) newList();
list.addToRear(ELEMENT_A);
return list;
}
/** Run all tests on scenario: empty list -> addToRear(A) -> [A] */
private void test_emptyList_addToRearA_A() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("empty list -> addToRear(A) -> [A]");
printTest("emptyList_addToRearA_A_testRemoveFirst", testRemoveFirst(emptyList_addToRearA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testRemoveLast", testRemoveLast(emptyList_addToRearA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testRemoveA", testRemoveElement(emptyList_addToRearA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testRemoveB", testRemoveElement(emptyList_addToRearA_A(), ELEMENT_B, Result.ElementNotFound));
printTest("emptyList_addToRearA_A_testFirst", testFirst(emptyList_addToRearA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testLast", testLast(emptyList_addToRearA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testContainsA", testContains(emptyList_addToRearA_A(), ELEMENT_A, Result.True));
printTest("emptyList_addToRearA_A_testContainsB", testContains(emptyList_addToRearA_A(), ELEMENT_B, Result.False));
printTest("emptyList_addToRearA_A_testIsEmpty", testIsEmpty(emptyList_addToRearA_A(), Result.False));
printTest("emptyList_addToRearA_A_testSize", testSize(emptyList_addToRearA_A(), 1));
printTest("emptyList_addToRearA_A_testToString", testToString(emptyList_addToRearA_A(), Result.ValidString));
// UnorderedListADT
printTest("emptyList_addToRearA_A_testAddToFrontB", testAddToFront(emptyList_addToRearA_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addToRearA_A_testAddToRearB", testAddToRear(emptyList_addToRearA_A(), ELEMENT_A, Result.NoException));
printTest( "emptyList_addToRearA_A_testAddAfterCB", testAddAfter(emptyList_addToRearA_A(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest( "emptyList_addToRearA_A_testAddAfterAB", testAddAfter(emptyList_addToRearA_A(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("emptyList_addToRearA_A_testAddAtIndexNeg1B", testAddAtIndex(emptyList_addToRearA_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addToRearA_A_testAddAtIndex0B", testAddAtIndex(emptyList_addToRearA_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addToRearA_A_testAddAtIndex1B", testAddAtIndex(emptyList_addToRearA_A(), 1, ELEMENT_B, Result.NoException));
printTest("emptyList_addToRearA_A_testSetNeg1B", testSet(emptyList_addToRearA_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addToRearA_A_testSet0B", testSet(emptyList_addToRearA_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addToRearA_A_testAddB", testAdd(emptyList_addToRearA_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addToRearA_A_testGetNeg1", testGet(emptyList_addToRearA_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addToRearA_A_testGet0", testGet(emptyList_addToRearA_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testIndexOfA", testIndexOf(emptyList_addToRearA_A(), ELEMENT_A, 0));
printTest("emptyList_addToRearA_A_testIndexOfB", testIndexOf(emptyList_addToRearA_A(), ELEMENT_B, -1));
printTest("emptyList_addToRearA_A_testRemoveNeg1", testRemoveIndex(emptyList_addToRearA_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addToRearA_A_testRemove0", testRemoveIndex(emptyList_addToRearA_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testRemove1", testRemoveIndex(emptyList_addToRearA_A(), 1, null, Result.IndexOutOfBounds));
// Iterator
printTest("emptyList_addToRearA_A_testIterator", testIterator(emptyList_addToRearA_A(), Result.NoException));
printTest("emptyList_addToRearA_A_testIteratorHasNext", testIteratorHasNext(emptyList_addToRearA_A().iterator(), Result.True));
printTest("emptyList_addToRearA_A_testIteratorNext", testIteratorNext(emptyList_addToFrontA_A().iterator(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addToRearA_A_testIteratorRemove", testIteratorRemove(emptyList_addToFrontA_A().iterator(), Result.IllegalState));
printTest("emptyList_addToRearA_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(emptyList_addToRearA_A(), 1), Result.False));
printTest("emptyList_addToRearA_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(emptyList_addToRearA_A(), 1), null, Result.NoSuchElement));
printTest("emptyList_addToRearA_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(emptyList_addToRearA_A(), 1), Result.NoException));
printTest("emptyList_addToRearA_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addToRearA_A(), 1)), Result.False));
printTest("emptyList_addToRearA_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addToRearA_A(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addToRearA_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(emptyList_addToRearA_A(), 1)), Result.IllegalState));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [ ] -> add(A) -> [A]
// XXX Scenario 4
////////////////////////////////////////////////
/** Scenario: empty list -> add(A) -> [A]
* @return [A] after add(A)
*/
private ListADT<Integer> emptyList_addA_A() {
// cast to UnorderedListADT to make addToFront() available
IndexedListADT<Integer> list = (IndexedListADT<Integer>) newList();
list.add(ELEMENT_A);
return list;
}
/** Run all tests on scenario: empty list -> add(A) -> [A] */
private void test_emptyList_addA_A() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("empty list -> add(A) -> [A]");
printTest("emptyList_addA_A_testRemoveFirst", testRemoveFirst(emptyList_addA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testRemoveLast", testRemoveLast(emptyList_addA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testRemoveA", testRemoveElement(emptyList_addA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testRemoveB", testRemoveElement(emptyList_addA_A(), ELEMENT_B, Result.ElementNotFound));
printTest("emptyList_addA_A_testFirst", testFirst(emptyList_addA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testLast", testLast(emptyList_addA_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testContainsA", testContains(emptyList_addA_A(), ELEMENT_A, Result.True));
printTest("emptyList_addA_A_testContainsB", testContains(emptyList_addA_A(), ELEMENT_B, Result.False));
printTest("emptyList_addA_A_testIsEmpty", testIsEmpty(emptyList_addA_A(), Result.False));
printTest("emptyList_addA_A_testSize", testSize(emptyList_addA_A(), 1));
printTest("emptyList_addA_A_testToString", testToString(emptyList_addA_A(), Result.ValidString));
// UnorderedListADT
printTest("emptyList_addA_A_testAddToFrontB", testAddToFront(emptyList_addA_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addA_A_testAddToRearB", testAddToRear(emptyList_addA_A(), ELEMENT_A, Result.NoException));
printTest("emptyList_addA_A_testAddAfterCB", testAddAfter(emptyList_addA_A(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("emptyList_addA_A_testAddAfterAB", testAddAfter(emptyList_addA_A(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("emptyList_addA_A_testAddAtIndexNeg1B", testAddAtIndex(emptyList_addA_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addA_A_testAddAtIndex0B", testAddAtIndex(emptyList_addA_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addA_A_testAddAtIndex1B", testAddAtIndex(emptyList_addA_A(), 1, ELEMENT_B, Result.NoException));
printTest("emptyList_addA_A_testSetNeg1B", testSet(emptyList_addA_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addA_A_testSet0B", testSet(emptyList_addA_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addA_A_testAddB", testAdd(emptyList_addA_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addA_A_testGetNeg1", testGet(emptyList_addA_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addA_A_testGet0", testGet(emptyList_addA_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testIndexOfA", testIndexOf(emptyList_addA_A(), ELEMENT_A, 0));
printTest("emptyList_addA_A_testIndexOfB", testIndexOf(emptyList_addA_A(), ELEMENT_B, -1));
printTest("emptyList_addA_A_testRemoveNeg1", testRemoveIndex(emptyList_addA_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addA_A_testRemove0", testRemoveIndex(emptyList_addA_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testRemove1", testRemoveIndex(emptyList_addA_A(), 1, null, Result.IndexOutOfBounds));
// Iterator
printTest("emptyList_addA_A_testIterator", testIterator(emptyList_addA_A(), Result.NoException));
printTest("emptyList_addA_A_testIteratorHasNext", testIteratorHasNext(emptyList_addA_A().iterator(), Result.True));
printTest("emptyList_addA_A_testIteratorNext", testIteratorNext(emptyList_addA_A().iterator(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA_A_testIteratorRemove", testIteratorRemove(emptyList_addA_A().iterator(), Result.IllegalState));
printTest("emptyList_addA_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(emptyList_addA_A(), 1), Result.False));
printTest("emptyList_addA_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(emptyList_addA_A(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(emptyList_addA_A(), 1), Result.NoException));
printTest("emptyList_addA_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addA_A(), 1)), Result.False));
printTest("emptyList_addA_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addA_A(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(emptyList_addA_A(), 1)), Result.IllegalState));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [ ] -> add(A) -> [A]
// XXX Scenario 5
////////////////////////////////////////////////
/** Scenario: empty list -> add(0,A) -> [A]
* @return [A] after add(0,A)
*/
private ListADT<Integer> emptyList_addA0_A() {
// cast to UnorderedListADT to make addToFront() available
IndexedListADT<Integer> list = (IndexedListADT<Integer>) newList();
list.add(0, ELEMENT_A);
return list;
}
/** Run all tests on scenario: empty list -> add(0,A) -> [A] */
private void test_emptyList_addA0_A() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("empty list -> add(0,A) -> [A]");
printTest("emptyList_addA0_A_testRemoveFirst", testRemoveFirst(emptyList_addA0_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testRemoveLast", testRemoveLast(emptyList_addA0_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testRemoveA", testRemoveElement(emptyList_addA0_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testRemoveB", testRemoveElement(emptyList_addA0_A(), ELEMENT_B, Result.ElementNotFound));
printTest("emptyList_addA0_A_testFirst", testFirst(emptyList_addA0_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testLast", testLast(emptyList_addA0_A(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testContainsA", testContains(emptyList_addA0_A(), ELEMENT_A, Result.True));
printTest("emptyList_addA0_A_testContainsB", testContains(emptyList_addA0_A(), ELEMENT_B, Result.False));
printTest("emptyList_addA0_A_testIsEmpty", testIsEmpty(emptyList_addA0_A(), Result.False));
printTest("emptyList_addA0_A_testSize", testSize(emptyList_addA0_A(), 1));
printTest("emptyList_addA0_A_testToString", testToString(emptyList_addA0_A(), Result.ValidString));
// UnorderedListADT
printTest("emptyList_addA0_A_testAddToFrontB", testAddToFront(emptyList_addA0_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addA0_A_testAddToRearB", testAddToRear(emptyList_addA0_A(), ELEMENT_A, Result.NoException));
printTest("emptyList_addA0_A_testAddAfterCB", testAddAfter(emptyList_addA0_A(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("emptyList_addA0_A_testAddAfterAB", testAddAfter(emptyList_addA0_A(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("emptyList_addA0_A_testAddAtIndexNeg1B", testAddAtIndex(emptyList_addA0_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addA0_A_testAddAtIndex0B", testAddAtIndex(emptyList_addA0_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addA0_A_testAddAtIndex1B", testAddAtIndex(emptyList_addA0_A(), 1, ELEMENT_B, Result.NoException));
printTest("emptyList_addA0_A_testSetNeg1B", testSet(emptyList_addA0_A(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("emptyList_addA0_A_testSet0B", testSet(emptyList_addA0_A(), 0, ELEMENT_B, Result.NoException));
printTest("emptyList_addA0_A_testAddB", testAdd(emptyList_addA0_A(), ELEMENT_B, Result.NoException));
printTest("emptyList_addA0_A_testGetNeg1", testGet(emptyList_addA0_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addA0_A_testGet0", testGet(emptyList_addA0_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testIndexOfA", testIndexOf(emptyList_addA0_A(), ELEMENT_A, 0));
printTest("emptyList_addA0_A_testIndexOfB", testIndexOf(emptyList_addA0_A(), ELEMENT_B, -1));
printTest("emptyList_addA0_A_testRemoveNeg1", testRemoveIndex(emptyList_addA0_A(), -1, null, Result.IndexOutOfBounds));
printTest("emptyList_addA0_A_testRemove0", testRemoveIndex(emptyList_addA0_A(), 0, ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testRemove1", testRemoveIndex(emptyList_addA0_A(), 1, null, Result.IndexOutOfBounds));
// Iterator
printTest("emptyList_addA0_A_testIterator", testIterator(emptyList_addA0_A(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(emptyList_addA0_A().iterator(), Result.True));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(emptyList_addA0_A().iterator(), ELEMENT_A, Result.MatchingValue));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(emptyList_addA0_A().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(emptyList_addA0_A(), 1), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(emptyList_addA0_A(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(emptyList_addA0_A(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addA0_A(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(emptyList_addA0_A(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(emptyList_addA0_A(), 1)), Result.IllegalState));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A] -> removeFirst() -> [ ]
// XXX Scenario 6
////////////////////////////////////////////////
/** Scenario: [A] -> removeFirst() -> empty list
* @return [ ] after removeFirst()
*/
private ListADT<Integer> A_removeFirst_emptyList() {
// cast to UnorderedListADT to make addToFront() available
IndexedListADT<Integer> list = (IndexedListADT<Integer>) newList();
list.add(ELEMENT_A);
list.removeFirst();
return list;
}
/** Run all tests on scenario: [A] -> removeFirst() -> empty list */
private void test_A_removeFirst_emptyList() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("[A] -> removeFirst() -> empty list");
printTest("A_removeFirst_emptyList_testRemoveFirst", testRemoveFirst(A_removeFirst_emptyList(), null, Result.EmptyCollection));
printTest("A_removeFirst_emptyList_testRemoveLast", testRemoveLast(A_removeFirst_emptyList(), null, Result.EmptyCollection));
printTest("A_removeFirst_emptyList_testRemoveA", testRemoveElement(A_removeFirst_emptyList(), ELEMENT_A, Result.ElementNotFound));
printTest("A_removeFirst_emptyList_testRemoveB", testRemoveElement(A_removeFirst_emptyList(), ELEMENT_B, Result.ElementNotFound));
printTest("A_removeFirst_emptyList_testFirst", testFirst(A_removeFirst_emptyList(), null, Result.EmptyCollection));
printTest("A_removeFirst_emptyList_testLast", testLast(A_removeFirst_emptyList(), null, Result.EmptyCollection));
printTest("A_removeFirst_emptyList_testContainsA", testContains(A_removeFirst_emptyList(), ELEMENT_A, Result.False));
printTest("A_removeFirst_emptyList_testContainsB", testContains(A_removeFirst_emptyList(), ELEMENT_B, Result.False));
printTest("A_removeFirst_emptyList_testIsEmpty", testIsEmpty(A_removeFirst_emptyList(), Result.True));
printTest("A_removeFirst_emptyList_testSize", testSize(A_removeFirst_emptyList(), 0));
printTest("A_removeFirst_emptyList_testToString", testToString(A_removeFirst_emptyList(), Result.ValidString));
// UnorderedListADT
printTest("A_removeFirst_emptyList_testAddToFrontB", testAddToFront(A_removeFirst_emptyList(), ELEMENT_B, Result.NoException));
printTest("A_removeFirst_emptyList_testAddToRearB", testAddToRear(A_removeFirst_emptyList(), ELEMENT_A, Result.NoException));
printTest("A_removeFirst_emptyList_testAddAfterCB", testAddAfter(A_removeFirst_emptyList(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("A_removeFirst_emptyList_testAddAfterAB", testAddAfter(A_removeFirst_emptyList(), ELEMENT_A, ELEMENT_B, Result.ElementNotFound));
// IndexedListADT
printTest("A_removeFirst_emptyList_testAddAtIndexNeg1B", testAddAtIndex(A_removeFirst_emptyList(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testAddAtIndex0B", testAddAtIndex(A_removeFirst_emptyList(), 0, ELEMENT_B, Result.NoException));
printTest("A_removeFirst_emptyList_testAddAtIndex1B", testAddAtIndex(A_removeFirst_emptyList(), 1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testSetNeg1B", testSet(A_removeFirst_emptyList(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testSet0B", testSet(A_removeFirst_emptyList(), 0, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testAddB", testAdd(A_removeFirst_emptyList(), ELEMENT_B, Result.NoException));
printTest("A_removeFirst_emptyList_testGetNeg1", testGet(A_removeFirst_emptyList(), -1, null, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testGet0", testGet(A_removeFirst_emptyList(), 0, null, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testIndexOfA", testIndexOf(A_removeFirst_emptyList(), ELEMENT_A, -1));
printTest("A_removeFirst_emptyList_testIndexOfB", testIndexOf(A_removeFirst_emptyList(), ELEMENT_B, -1));
printTest("A_removeFirst_emptyList_testRemoveNeg1", testRemoveIndex(A_removeFirst_emptyList(), -1, null, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testRemove0", testRemoveIndex(A_removeFirst_emptyList(), 0, null, Result.IndexOutOfBounds));
printTest("A_removeFirst_emptyList_testRemove1", testRemoveIndex(A_removeFirst_emptyList(), 1, null, Result.IndexOutOfBounds));
//Iterators
printTest("A_removeFirst_emptyList_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("A_removeFirst_emptyList_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("A_removeFirst_emptyList_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.NoSuchElement));
printTest("A_removeFirst_emptyList_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("A_removeFirst_emptyList_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
// printTest("A_removeFirst_emptyList_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
// printTest("A_removeFirst_emptyList_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
// printTest("A_removeFirst_emptyList_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
// printTest("A_removeFirst_emptyList_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
// printTest("A_removeFirst_emptyList_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A] -> removeLast() -> [ ]
// XXX Scenario 7
////////////////////////////////////////////////
/** Scenario: [A] -> removeLast() -> empty list
* @return [ ] after removeLast()
*/
private ListADT<Integer> A_removeLast_emptyList() {
// cast to UnorderedListADT to make addToFront() available
IndexedListADT<Integer> list = (IndexedListADT<Integer>) newList();
list.add(ELEMENT_A);
list.removeLast();
return list;
}
/** Run all tests on scenario: [A] -> removeLast() -> empty list */
private void test_A_removeLast_emptyList() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("[A] -> removeLast() -> empty list");
printTest("A_removeLast_emptyList_testRemoveFirst", testRemoveFirst(A_removeLast_emptyList(), null, Result.EmptyCollection));
printTest("A_removeLast_emptyList_testRemoveLast", testRemoveLast(A_removeLast_emptyList(), null, Result.EmptyCollection));
printTest("A_removeLast_emptyList_testRemoveA", testRemoveElement(A_removeLast_emptyList(), ELEMENT_A, Result.ElementNotFound));
printTest("A_removeLast_emptyList_testRemoveB", testRemoveElement(A_removeLast_emptyList(), ELEMENT_B, Result.ElementNotFound));
printTest("A_removeLast_emptyList_testFirst", testFirst(A_removeLast_emptyList(), null, Result.EmptyCollection));
printTest("A_removeLast_emptyList_testLast", testLast(A_removeLast_emptyList(), null, Result.EmptyCollection));
printTest("A_removeLast_emptyList_testContainsA", testContains(A_removeLast_emptyList(), ELEMENT_A, Result.False));
printTest("A_removeLast_emptyList_testContainsB", testContains(A_removeLast_emptyList(), ELEMENT_B, Result.False));
printTest("A_removeLast_emptyList_testIsEmpty", testIsEmpty(A_removeLast_emptyList(), Result.True));
printTest("A_removeLast_emptyList_testSize", testSize(A_removeLast_emptyList(), 0));
printTest("A_removeLast_emptyList_testToString", testToString(A_removeLast_emptyList(), Result.ValidString));
// UnorderedListADT
printTest("A_removeLast_emptyList_testAddToFrontB", testAddToFront(A_removeLast_emptyList(), ELEMENT_B, Result.NoException));
printTest("A_removeLast_emptyList_testAddToRearB", testAddToRear(A_removeLast_emptyList(), ELEMENT_A, Result.NoException));
printTest("A_removeLast_emptyList_testAddAfterCB", testAddAfter(A_removeLast_emptyList(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("A_removeLast_emptyList_testAddAfterAB", testAddAfter(A_removeLast_emptyList(), ELEMENT_A, ELEMENT_B, Result.ElementNotFound));
// IndexedListADT
printTest("A_removeLast_emptyList_testAddAtIndexNeg1B", testAddAtIndex(A_removeLast_emptyList(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeLast_emptyList_testAddAtIndex0B", testAddAtIndex(A_removeLast_emptyList(), 0, ELEMENT_B, Result.NoException));
printTest("A_removeLast_emptyList_testAddAtIndex1B", testAddAtIndex(A_removeLast_emptyList(), 1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeLast_emptyList_testSetNeg1B", testSet(A_removeLast_emptyList(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeLast_emptyList_testSet0B", testSet(A_removeLast_emptyList(), 0, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeLast_emptyList_testAddB", testAdd(A_removeLast_emptyList(), ELEMENT_B, Result.NoException));
printTest("A_removeLast_emptyList_testGetNeg1", testGet(A_removeLast_emptyList(), -1, null, Result.IndexOutOfBounds));
printTest("A_removeLast_emptyList_testGet0", testGet(A_removeLast_emptyList(), 0, null, Result.IndexOutOfBounds));
printTest("test_A_removeLast_emptyList_testIndexOfA", testIndexOf(A_removeLast_emptyList(), ELEMENT_A, -1));
printTest("test_A_removeLast_emptyList_testIndexOfB", testIndexOf(A_removeLast_emptyList(), ELEMENT_B, -1));
printTest("test_A_removeLast_emptyList_testRemoveNeg1", testRemoveIndex(A_removeLast_emptyList(), -1, null, Result.IndexOutOfBounds));
printTest("test_A_removeLast_emptyList_testRemove0", testRemoveIndex(A_removeLast_emptyList(), 0, null, Result.IndexOutOfBounds));
printTest("test_A_removeLast_emptyList_testRemove1", testRemoveIndex(A_removeLast_emptyList(), 1, null, Result.IndexOutOfBounds));
//Iterators
/* printTest("emptyList_addA0_A_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.EmptyCollection));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
*/
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A] -> remove(A) -> [ ]
// XXX Scenario 8
////////////////////////////////////////////////
/** Scenario: [A] -> remove(A) -> empty list
* @return [ ] after remove(A)
*/
private ListADT<Integer> A_removeA_emptyList() {
// cast to UnorderedListADT to make addToFront() available
IndexedListADT<Integer> list = (IndexedListADT<Integer>) newList();
list.add(ELEMENT_A);
list.remove(ELEMENT_A);
return list;
}
/** Run all tests on scenario: [A] -> remove(A) -> empty list */
private void test_A_removeA_emptyList() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("[A] -> remove(A) -> empty list");
printTest("A_removeA_emptyList_testRemoveFirst", testRemoveFirst(A_removeA_emptyList(), null, Result.EmptyCollection));
printTest("A_removeA_emptyList_testRemoveLast", testRemoveLast(A_removeA_emptyList(), null, Result.EmptyCollection));
printTest("A_removeA_emptyList_testRemoveA", testRemoveElement(A_removeA_emptyList(), ELEMENT_A, Result.ElementNotFound));
printTest("A_removeA_emptyList_testRemoveB", testRemoveElement(A_removeA_emptyList(), ELEMENT_B, Result.ElementNotFound));
printTest("A_removeA_emptyList_testFirst", testFirst(A_removeA_emptyList(), null, Result.EmptyCollection));
printTest("A_removeA_emptyList_testLast", testLast(A_removeA_emptyList(), null, Result.EmptyCollection));
printTest("A_removeA_emptyList_testContainsA", testContains(A_removeA_emptyList(), ELEMENT_A, Result.False));
printTest("A_removeA_emptyList_testContainsB", testContains(A_removeA_emptyList(), ELEMENT_B, Result.False));
printTest("A_removeA_emptyList_testIsEmpty", testIsEmpty(A_removeA_emptyList(), Result.True));
printTest("A_removeA_emptyList_testSize", testSize(A_removeA_emptyList(), 0));
printTest("A_removeA_emptyList_testToString", testToString(A_removeA_emptyList(), Result.ValidString));
// UnorderedListADT
printTest("A_removeA_emptyList_testAddToFrontB", testAddToFront(A_removeA_emptyList(), ELEMENT_B, Result.NoException));
printTest("A_removeA_emptyList_testAddToRearB", testAddToRear(A_removeA_emptyList(), ELEMENT_A, Result.NoException));
printTest("A_removeA_emptyList_testAddAfterCB", testAddAfter(A_removeA_emptyList(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("A_removeA_emptyList_testAddAfterAB", testAddAfter(A_removeA_emptyList(), ELEMENT_A, ELEMENT_B, Result.ElementNotFound));
// IndexedListADT
printTest("A_removeA_emptyList_testAddAtIndexNeg1B", testAddAtIndex(A_removeA_emptyList(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testAddAtIndex0B", testAddAtIndex(A_removeA_emptyList(), 0, ELEMENT_B, Result.NoException));
printTest("A_removeA_emptyList_testAddAtIndex1B", testAddAtIndex(A_removeA_emptyList(), 1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testSetNeg1B", testSet(A_removeA_emptyList(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testSet0B", testSet(A_removeA_emptyList(), 0, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testAddB", testAdd(A_removeA_emptyList(), ELEMENT_B, Result.NoException));
printTest("A_removeA_emptyList_testGetNeg1", testGet(A_removeA_emptyList(), -1, null, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testGet0", testGet(A_removeA_emptyList(), 0, null, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testIndexOfA", testIndexOf(A_removeA_emptyList(), ELEMENT_A, -1));
printTest("A_removeA_emptyList_testIndexOfB", testIndexOf(A_removeA_emptyList(), ELEMENT_B, -1));
printTest("A_removeA_emptyList_testRemoveNeg1", testRemoveIndex(A_removeA_emptyList(), -1, null, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testRemove0", testRemoveIndex(A_removeA_emptyList(), 0, null, Result.IndexOutOfBounds));
printTest("A_removeA_emptyList_testRemove1", testRemoveIndex(A_removeA_emptyList(), 1, null, Result.IndexOutOfBounds));
//Iterators
/* printTest("emptyList_addA0_A_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.EmptyCollection));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
*/
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A] -> addToFront(B) -> [B,A]
// XXX Scenario 9
////////////////////////////////////////////////
/** Scenario: [A] -> addToFront(B) -> [B,A]
* @return [B,A] after addToFront(B)
*/
private ListADT<Integer> A_addToFrontB_BA() {
// cast to UnorderedListADT to make addToFront() available
UnorderedListADT<Integer> list = (UnorderedListADT<Integer>) newList();
list.addToRear(ELEMENT_A);
list.addToFront(ELEMENT_B);
return list;
}
/** Run all tests on scenario: [A] -> addToFront(B) -> [B,A] */
private void test_A_addToFrontB_BA() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("[A] -> addToFront(B) -> [B,A]");
printTest("A_addToFrontB_BA_testRemoveFirst", testRemoveFirst(A_addToFrontB_BA(), ELEMENT_B, Result.MatchingValue));
printTest("A_addToFrontB_BA_testRemoveLast", testRemoveLast(A_addToFrontB_BA(), ELEMENT_A, Result.MatchingValue));
printTest("A_addToFrontB_BA_testRemoveA", testRemoveElement(A_addToFrontB_BA(), ELEMENT_A, Result.MatchingValue));
printTest("A_addToFrontB_BA_testRemoveB", testRemoveElement(A_addToFrontB_BA(), ELEMENT_B, Result.MatchingValue));
printTest("A_addToFrontB_BA_testFirst", testFirst(A_addToFrontB_BA(), ELEMENT_B, Result.MatchingValue));
printTest("A_addToFrontB_BA_testLast", testLast(A_addToFrontB_BA(), ELEMENT_A, Result.MatchingValue));
printTest("A_addToFrontB_BA_testContainsA", testContains(A_addToFrontB_BA(), ELEMENT_A, Result.True));
printTest("A_addToFrontB_BA_testContainsB", testContains(A_addToFrontB_BA(), ELEMENT_B, Result.True));
printTest("A_addToFrontB_BA_testIsEmpty", testIsEmpty(A_addToFrontB_BA(), Result.False));
printTest("A_addToFrontB_BA_testSize", testSize(A_addToFrontB_BA(), 2));
printTest("A_addToFrontB_BA_testToString", testToString(A_addToFrontB_BA(), Result.ValidString));
// UnorderedListADT
printTest("A_addToFrontB_BA_testAddToFrontB", testAddToFront(A_addToFrontB_BA(), ELEMENT_B, Result.NoException));
printTest("A_addToFrontB_BA_testAddToRearB", testAddToRear(A_addToFrontB_BA(), ELEMENT_A, Result.NoException));
printTest("A_addToFrontB_BA_testAddAfterCB", testAddAfter(A_addToFrontB_BA(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("A_addToFrontB_BA_testAddAfterAB", testAddAfter(A_addToFrontB_BA(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("A_addToFrontB_BA_testAddAtIndexNeg1B", testAddAtIndex(A_addToFrontB_BA(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addToFrontB_BA_testAddAtIndex0B", testAddAtIndex(A_addToFrontB_BA(), 0, ELEMENT_B, Result.NoException));
printTest("A_addToFrontB_BA_testAddAtIndex1B", testAddAtIndex(A_addToFrontB_BA(), 1, ELEMENT_B, Result.NoException));
printTest("A_addToFrontB_BA_testSetNeg1B", testSet(A_addToFrontB_BA(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addToFrontB_BA_testSet0B", testSet(A_addToFrontB_BA(), 0, ELEMENT_B, Result.NoException));
printTest("A_addToFrontB_BA_testAddB", testAdd(A_addToFrontB_BA(), ELEMENT_B, Result.NoException));
printTest("A_addToFrontB_BA_testGetNeg1", testGet(A_addToFrontB_BA(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addToFrontB_BA_testGet0", testGet(A_addToFrontB_BA(), 0, ELEMENT_B, Result.MatchingValue));
printTest("A_addToFrontB_BA_testIndexOfA", testIndexOf(A_addToFrontB_BA(), ELEMENT_A, 1));
printTest("A_addToFrontB_BA_testIndexOfB", testIndexOf(A_addToFrontB_BA(), ELEMENT_B, 0));
printTest("A_addToFrontB_BA_testRemoveNeg1", testRemoveIndex(A_addToFrontB_BA(), -1, null, Result.IndexOutOfBounds));
printTest("A_addToFrontB_BA_testRemove0", testRemoveIndex(A_addToFrontB_BA(), 0, ELEMENT_B, Result.MatchingValue));
printTest("A_addToFrontB_BA_testRemove1", testRemoveIndex(A_addToFrontB_BA(), 1, ELEMENT_A, Result.MatchingValue));
//Iterators
/* printTest("emptyList_addA0_A_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.EmptyCollection));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
*/
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A] -> addToRear(B) -> [A,B]
// XXX Scenario 10
////////////////////////////////////////////////
/** Scenario: [A] -> addToRear(B) -> [A,B]
* @return [A,B] after addToRear(B)
*/
private ListADT<Integer> A_addToRearB_AB() {
// cast to UnorderedListADT to make addToFront() available
UnorderedListADT<Integer> list = (UnorderedListADT<Integer>) newList();
list.addToFront(ELEMENT_A);
list.addToRear(ELEMENT_B);
return list;
}
/** Run all tests on scenario: [A] -> addToRear(B) -> [A,B] */
private void test_A_addToRearB_AB() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("[A] -> addToRear(B) -> [A,B]");
printTest("A_addToRearB_AB_testRemoveFirst", testRemoveFirst(A_addToRearB_AB(), ELEMENT_A, Result.MatchingValue));
printTest("A_addToRearB_AB_testRemoveLast", testRemoveLast(A_addToRearB_AB(), ELEMENT_B, Result.MatchingValue));
printTest("A_addToRearB_AB_testRemoveA", testRemoveElement(A_addToRearB_AB(), ELEMENT_A, Result.MatchingValue));
printTest("A_addToRearB_AB_testRemoveB", testRemoveElement(A_addToRearB_AB(), ELEMENT_B, Result.MatchingValue));
printTest("A_addToRearB_AB_testFirst", testFirst(A_addToRearB_AB(), ELEMENT_A, Result.MatchingValue));
printTest("A_addToRearB_AB_testLast", testLast(A_addToRearB_AB(), ELEMENT_B, Result.MatchingValue));
printTest("A_addToRearB_AB_testContainsA", testContains(A_addToRearB_AB(), ELEMENT_A, Result.True));
printTest("A_addToRearB_AB_testContainsB", testContains(A_addToRearB_AB(), ELEMENT_B, Result.True));
printTest("A_addToRearB_AB_testIsEmpty", testIsEmpty(A_addToRearB_AB(), Result.False));
printTest("A_addToRearB_AB_testSize", testSize(A_addToRearB_AB(), 2));
printTest("A_addToRearB_AB_testToString", testToString(A_addToRearB_AB(), Result.ValidString));
// UnorderedListADT
printTest("A_addToRearB_AB_testAddToFrontB", testAddToFront(A_addToRearB_AB(), ELEMENT_B, Result.NoException));
printTest("A_addToRearB_AB_testAddToRearB", testAddToRear(A_addToRearB_AB(), ELEMENT_A, Result.NoException));
printTest("A_addToRearB_AB_testAddAfterCB", testAddAfter(A_addToRearB_AB(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("A_addToRearB_AB_testAddAfterAB", testAddAfter(A_addToRearB_AB(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("A_addToRearB_AB_testAddAtIndexNeg1B", testAddAtIndex(A_addToRearB_AB(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addToRearB_AB_testAddAtIndex0B", testAddAtIndex(A_addToRearB_AB(), 0, ELEMENT_B, Result.NoException));
printTest("A_addToRearB_AB_testAddAtIndex1B", testAddAtIndex(A_addToRearB_AB(), 1, ELEMENT_B, Result.NoException));
printTest("A_addToRearB_AB_testSetNeg1B", testSet(A_addToRearB_AB(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addToRearB_AB_testSet0B", testSet(A_addToRearB_AB(), 0, ELEMENT_B, Result.NoException));
printTest("A_addToRearB_AB_testAddB", testAdd(A_addToRearB_AB(), ELEMENT_B, Result.NoException));
printTest("A_addToRearB_AB_testGetNeg1", testGet(A_addToRearB_AB(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addToRearB_AB_testGet0", testGet(A_addToRearB_AB(), 0, ELEMENT_A, Result.MatchingValue));
printTest("A_addToRearB_AB_testIndexOfA", testIndexOf(A_addToRearB_AB(), ELEMENT_B, 1));
printTest("A_addToRearB_AB_testIndexOfB", testIndexOf(A_addToRearB_AB(), ELEMENT_A, 0));
printTest("A_addToRearB_AB_testRemoveNeg1", testRemoveIndex(A_addToRearB_AB(), -1, null, Result.IndexOutOfBounds));
printTest("A_addToRearB_AB_testRemove0", testRemoveIndex(A_addToRearB_AB(), 0, ELEMENT_A, Result.MatchingValue));
printTest("A_addToRearB_AB_testRemove1", testRemoveIndex(A_addToRearB_AB(), 1, ELEMENT_B, Result.MatchingValue));
//Iterators
/* printTest("emptyList_addA0_A_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.EmptyCollection));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
*/
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A] -> addAfter(A,B) -> [A,B]
// XXX Scenario 11
////////////////////////////////////////////////
/** Scenario: [A] -> addAfter(A,B) -> [A,B]
* @return [A,B] after addAfter(A,B)
*/
private ListADT<Integer> A_addAfterAB_AB() {
// cast to UnorderedListADT to make addToFront() available
UnorderedListADT<Integer> list = (UnorderedListADT<Integer>) newList();
list.addToFront(ELEMENT_A);
list.addAfter(ELEMENT_B, ELEMENT_A);
return list;
}
/** Run all tests on scenario: [A] -> addAfter(A,B) -> [A,B] */
private void test_A_addAfterAB_AB() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("[A] -> addToRear(B) -> [A,B]");
printTest("A_addAfterAB_AB_testRemoveFirst", testRemoveFirst(A_addAfterAB_AB(), ELEMENT_A, Result.MatchingValue));
printTest("A_addAfterAB_AB_testRemoveLast", testRemoveLast(A_addAfterAB_AB(), ELEMENT_B, Result.MatchingValue));
printTest("A_addAfterAB_AB_testRemoveA", testRemoveElement(A_addAfterAB_AB(), ELEMENT_A, Result.MatchingValue));
printTest("A_addAfterAB_AB_testRemoveB", testRemoveElement(A_addAfterAB_AB(), ELEMENT_B, Result.MatchingValue));
printTest("A_addAfterAB_AB_testFirst", testFirst(A_addAfterAB_AB(), ELEMENT_A, Result.MatchingValue));
printTest("A_addAfterAB_AB_testLast", testLast(A_addAfterAB_AB(), ELEMENT_B, Result.MatchingValue));
printTest("A_addAfterAB_AB_testContainsA", testContains(A_addAfterAB_AB(), ELEMENT_A, Result.True));
printTest("A_addAfterAB_AB_testContainsB", testContains(A_addAfterAB_AB(), ELEMENT_B, Result.True));
printTest("A_addAfterAB_AB_testIsEmpty", testIsEmpty(A_addAfterAB_AB(), Result.False));
printTest("A_addAfterAB_AB_testSize", testSize(A_addAfterAB_AB(), 2));
printTest("A_addAfterAB_AB_testToString", testToString(A_addAfterAB_AB(), Result.ValidString));
// UnorderedListADT
printTest("A_addAfterAB_AB_testAddToFrontB", testAddToFront(A_addAfterAB_AB(), ELEMENT_B, Result.NoException));
printTest("A_addAfterAB_AB_testAddToRearB", testAddToRear(A_addAfterAB_AB(), ELEMENT_A, Result.NoException));
printTest("A_addAfterAB_AB_testAddAfterCB", testAddAfter(A_addAfterAB_AB(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("A_addAfterAB_AB_testAddAfterAB", testAddAfter(A_addAfterAB_AB(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("A_addAfterAB_AB_testAddAtIndexNeg1B", testAddAtIndex(A_addAfterAB_AB(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addAfterAB_AB_testAddAtIndex0B", testAddAtIndex(A_addAfterAB_AB(), 0, ELEMENT_B, Result.NoException));
printTest("A_addAfterAB_AB_testAddAtIndex1B", testAddAtIndex(A_addAfterAB_AB(), 1, ELEMENT_B, Result.NoException));
printTest("A_addAfterAB_AB_testSetNeg1B", testSet(A_addAfterAB_AB(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addAfterAB_AB_testSet0B", testSet(A_addAfterAB_AB(), 0, ELEMENT_B, Result.NoException));
printTest("A_addAfterAB_AB_testAddB", testAdd(A_addAfterAB_AB(), ELEMENT_B, Result.NoException));
printTest("A_addAfterAB_AB_testGetNeg1", testGet(A_addAfterAB_AB(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_addAfterAB_AB_testGet0", testGet(A_addAfterAB_AB(), 0, ELEMENT_A, Result.MatchingValue));
printTest("A_addAfterAB_AB_testIndexOfA", testIndexOf(A_addAfterAB_AB(), ELEMENT_B, 1));
printTest("A_addAfterAB_AB_testIndexOfB", testIndexOf(A_addAfterAB_AB(), ELEMENT_A, 0));
printTest("A_addAfterAB_AB_testRemoveNeg1", testRemoveIndex(A_addAfterAB_AB(), -1, null, Result.IndexOutOfBounds));
printTest("A_addAfterAB_AB_testRemove0", testRemoveIndex(A_addAfterAB_AB(), 0, ELEMENT_A, Result.MatchingValue));
printTest("A_addAfterAB_AB_testRemove1", testRemoveIndex(A_addAfterAB_AB(), 1, ELEMENT_B, Result.MatchingValue));
//Iterators
/* printTest("emptyList_addA0_A_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.EmptyCollection));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
*/
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A] -> remove(0) -> []
// XXX Scenario 12
////////////////////////////////////////////////
/** Scenario: [A] -> remove(0) -> []
* @return [] after remove(0)
*/
private ListADT<Integer> A_remove0_empty() {
// cast to UnorderedListADT to make addToFront() available
IndexedListADT<Integer> list = (IndexedListADT<Integer>) newList();
list.add(ELEMENT_A);
list.remove(0);
return list;
}
/** Run all tests on scenario: [A] -> remove(0) -> [] */
private void test_A_remove0_empty() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("A] -> remove(0) -> []");
printTest("A_remove0_empty_testRemoveFirst", testRemoveFirst(A_remove0_empty(), null, Result.EmptyCollection));
printTest("A_remove0_empty_testRemoveLast", testRemoveLast(A_remove0_empty(), null, Result.EmptyCollection));
printTest("A_remove0_empty_testRemoveA", testRemoveElement(A_remove0_empty(), ELEMENT_A, Result.ElementNotFound));
printTest("A_remove0_empty_testRemoveB", testRemoveElement(A_remove0_empty(), ELEMENT_B, Result.ElementNotFound));
printTest("A_remove0_empty_testFirst", testFirst(A_remove0_empty(), null, Result.EmptyCollection));
printTest("A_remove0_empty_testLast", testLast(A_remove0_empty(), null, Result.EmptyCollection));
printTest("A_remove0_empty_testContainsA", testContains(A_remove0_empty(), ELEMENT_A, Result.False));
printTest("A_remove0_empty_testContainsB", testContains(A_remove0_empty(), ELEMENT_B, Result.False));
printTest("A_remove0_empty_testIsEmpty", testIsEmpty(A_remove0_empty(), Result.True));
printTest("A_remove0_empty_testSize", testSize(A_remove0_empty(), 0));
printTest("A_remove0_empty_testToString", testToString(A_remove0_empty(), Result.ValidString));
// UnorderedListADT
printTest("A_remove0_empty_testAddToFrontB", testAddToFront(A_remove0_empty(), ELEMENT_B, Result.NoException));
printTest("A_remove0_empty_testAddToRearB", testAddToRear(A_remove0_empty(), ELEMENT_A, Result.NoException));
printTest("A_remove0_empty_testAddAfterCB", testAddAfter(A_remove0_empty(), ELEMENT_C, ELEMENT_B, Result.ElementNotFound));
printTest("A_remove0_empty_testAddAfterAB", testAddAfter(A_remove0_empty(), ELEMENT_A, ELEMENT_B, Result.ElementNotFound));
// IndexedListADT
printTest("A_remove0_empty_testAddAtIndexNeg1B", testAddAtIndex(A_remove0_empty(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testAddAtIndex0B", testAddAtIndex(A_remove0_empty(), 0, ELEMENT_B, Result.NoException));
printTest("A_remove0_empty_testAddAtIndex1B", testAddAtIndex(A_remove0_empty(), 1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testSetNeg1B", testSet(A_remove0_empty(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testSet0B", testSet(A_remove0_empty(), 0, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testAddB", testAdd(A_remove0_empty(), ELEMENT_B, Result.NoException));
printTest("A_remove0_empty_testGetNeg1", testGet(A_remove0_empty(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testGet0", testGet(A_remove0_empty(), 0, null, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testIndexOfA", testIndexOf(A_remove0_empty(), ELEMENT_A, -1));
printTest("A_remove0_empty_testIndexOfB", testIndexOf(A_remove0_empty(), ELEMENT_B,-1));
printTest("A_remove0_empty_testRemoveNeg1", testRemoveIndex(A_remove0_empty(), -1, null, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testRemove0", testRemoveIndex(A_remove0_empty(), 0, ELEMENT_A, Result.IndexOutOfBounds));
printTest("A_remove0_empty_testRemove1", testRemoveIndex(A_remove0_empty(), 1, ELEMENT_B, Result.IndexOutOfBounds));
//Iterators
/* printTest("emptyList_addA0_A_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.EmptyCollection));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
*/
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
////////////////////////////////////////////////
// SCENARIO: [A,B] -> add(C) -> [A,B,C]
// XXX Scenario 28
////////////////////////////////////////////////
/** Scenario: [A,B] -> add(C) -> [A,B,C]
* @return [A,B,C] after add(A,B,C)
*/
private ListADT<Integer> AB_addC_ABC() {
// cast to UnorderedListADT to make addToFront() available
IndexedListADT<Integer> list = (IndexedListADT<Integer>) newList();
list.add(ELEMENT_A);
list.add(ELEMENT_B);
list.add(ELEMENT_C);
return list;
}
/** Run all tests on scenario: [A,B] -> add(C) -> [A,B,C] */
private void test_AB_addC_ABC() {
// recommended test naming: start_change_result_testName
// e.g. A_addToFront_BA_testSize
// AB_addC1_ACB_testFirst
// A_remove0_empty_testLast
//try-catch is necessary to prevent an Exception from the scenario builder method from bringing
//down the whole test suite
try {
// ListADT
System.out.println("[A,B] -> add(C) -> [A,B,C]");
printTest("AB_addC_ABC_testRemoveFirst", testRemoveFirst(AB_addC_ABC(), ELEMENT_A, Result.MatchingValue));
printTest("AB_addC_ABC_testRemoveLast", testRemoveLast(AB_addC_ABC(), ELEMENT_C, Result.MatchingValue));
printTest("AB_addC_ABC_testRemoveA", testRemoveElement(AB_addC_ABC(), ELEMENT_A, Result.MatchingValue));
printTest("AB_addC_ABC_testRemoveB", testRemoveElement(AB_addC_ABC(), ELEMENT_B, Result.MatchingValue));
printTest("AB_addC_ABC_testFirst", testFirst(AB_addC_ABC(), ELEMENT_A, Result.MatchingValue));
printTest("AB_addC_ABC_testLast", testLast(AB_addC_ABC(), ELEMENT_C, Result.MatchingValue));
printTest("AB_addC_ABC_testContainsA", testContains(AB_addC_ABC(), ELEMENT_A, Result.True));
printTest("AB_addC_ABC_testContainsB", testContains(AB_addC_ABC(), ELEMENT_B, Result.True));
printTest("AB_addC_ABC_testIsEmpty", testIsEmpty(AB_addC_ABC(), Result.False));
printTest("AB_addC_ABC_testSize", testSize(AB_addC_ABC(), 3));
printTest("AB_addC_ABC_testToString", testToString(AB_addC_ABC(), Result.ValidString));
// UnorderedListADT
printTest("AB_addC_ABC_testAddToFrontB", testAddToFront(AB_addC_ABC(), ELEMENT_B, Result.NoException));
printTest("AB_addC_ABC_testAddToRearB", testAddToRear(AB_addC_ABC(), ELEMENT_A, Result.NoException));
printTest("AB_addC_ABC_testAddAfterCB", testAddAfter(AB_addC_ABC(), ELEMENT_C, ELEMENT_B, Result.NoException));
printTest("AB_addC_ABC_testAddAfterAB", testAddAfter(AB_addC_ABC(), ELEMENT_A, ELEMENT_B, Result.NoException));
// IndexedListADT
printTest("AB_addC_ABC_testAddAtIndexNeg1B", testAddAtIndex(AB_addC_ABC(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("AB_addC_ABC_testAddAtIndex0B", testAddAtIndex(AB_addC_ABC(), 0, ELEMENT_B, Result.NoException));
printTest("AB_addC_ABC_testAddAtIndex1B", testAddAtIndex(AB_addC_ABC(), 1, ELEMENT_B, Result.NoException));
printTest("AB_addC_ABC_testSetNeg1B", testSet(AB_addC_ABC(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("AB_addC_ABC_testSet0B", testSet(AB_addC_ABC(), 0, ELEMENT_B, Result.NoException));
printTest("AB_addC_ABC_testAddB", testAdd(AB_addC_ABC(), ELEMENT_B, Result.NoException));
printTest("AB_addC_ABC_testGetNeg1", testGet(AB_addC_ABC(), -1, ELEMENT_B, Result.IndexOutOfBounds));
printTest("AB_addC_ABC_testGet0", testGet(AB_addC_ABC(), 0, ELEMENT_A, Result.MatchingValue));
printTest("AB_addC_ABC_testIndexOfA", testIndexOf(AB_addC_ABC(), ELEMENT_A, 0));
printTest("AB_addC_ABC_testIndexOfB", testIndexOf(AB_addC_ABC(), ELEMENT_B, 1));
printTest("AB_addC_ABC_testRemoveNeg1", testRemoveIndex(AB_addC_ABC(), -1, null, Result.IndexOutOfBounds));
printTest("AB_addC_ABC_testRemove0", testRemoveIndex(AB_addC_ABC(), 0, ELEMENT_A, Result.MatchingValue));
printTest("AB_addC_ABC_testRemove1", testRemoveIndex(AB_addC_ABC(), 1, ELEMENT_B, Result.MatchingValue));
//Iterators
/* printTest("emptyList_addA0_A_testIterator", testIterator(A_removeFirst_emptyList(), Result.NoException));
printTest("emptyList_addA0_A_testIteratorHasNext", testIteratorHasNext(A_removeFirst_emptyList().iterator(), Result.False));
printTest("emptyList_addA0_A_testIteratorNext", testIteratorNext(A_removeFirst_emptyList().iterator(), null, Result.EmptyCollection));
printTest("emptyList_addA0_A_testIteratorRemove", testIteratorRemove(A_removeFirst_emptyList().iterator(), Result.IllegalState));
printTest("emptyList_addA0_A_iteratorNext_testIteratorHasNext", testIteratorHasNext(iteratorAfterNext(A_removeFirst_emptyList(), 0), Result.False));
printTest("emptyList_addA0_A_iteratorNext_testIteratorNext", testIteratorNext(iteratorAfterNext(A_removeFirst_emptyList(), 1), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNext_testIteratorRemove", testIteratorRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1), Result.NoException));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorHasNext", testIteratorHasNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.False));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorNext", testIteratorNext(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), null, Result.NoSuchElement));
printTest("emptyList_addA0_A_iteratorNextRemove_testIteratorRemove", testIteratorRemove(iteratorAfterRemove(iteratorAfterNext(A_removeFirst_emptyList(), 1)), Result.IllegalState));
*/
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_emptyList_addToFrontA_A");
e.printStackTrace();
}
}
// //////////////////////////
// LIST_ADT TESTS XXX
// //////////////////////////
/**
* Runs removeFirst() method on given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param expectedElement element or null if expectedResult is an Exception
* @param expectedResult
* @return test success
*/
private boolean testRemoveFirst(ListADT<Integer> list, Integer expectedElement, Result expectedResult) {
Result result;
try {
Integer retVal = list.removeFirst();
if (retVal.equals(expectedElement)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (EmptyCollectionException e) {
result = Result.EmptyCollection;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testRemoveFirst", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs removeLast() method on given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param expectedElement element or null if expectedResult is an Exception
* @param expectedResult
* @return test success
*/
private boolean testRemoveLast(ListADT<Integer> list, Integer expectedElement, Result expectedResult) {
Result result;
try {
Integer retVal = list.removeLast();
if (retVal.equals(expectedElement)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (EmptyCollectionException e) {
result = Result.EmptyCollection;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testRemoveLast", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs removeLast() method on given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param element element to remove
* @param expectedResult
* @return test success
*/
private boolean testRemoveElement(ListADT<Integer> list, Integer element, Result expectedResult) {
Result result;
try {
Integer retVal = list.remove(element);
if (retVal.equals(element)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (ElementNotFoundException e) {
result = Result.ElementNotFound;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testRemoveElement", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs first() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param expectedElement element or null if expectedResult is an Exception
* @param expectedResult
* @return test success
*/
private boolean testFirst(ListADT<Integer> list, Integer expectedElement, Result expectedResult) {
Result result;
try {
Integer retVal = list.first();
if (retVal.equals(expectedElement)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (EmptyCollectionException e) {
result = Result.EmptyCollection;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testFirst", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs last() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param expectedElement element or null if expectedResult is an Exception
* @param expectedResult
* @return test success
*/
private boolean testLast(ListADT<Integer> list, Integer expectedElement, Result expectedResult) {
Result result;
try {
Integer retVal = list.last();
if (retVal.equals(expectedElement)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (EmptyCollectionException e) {
result = Result.EmptyCollection;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testLast", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs contains() method on a given list and element and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param element
* @param expectedResult
* @return test success
*/
private boolean testContains(ListADT<Integer> list, Integer element, Result expectedResult) {
Result result;
try {
if (list.contains(element)) {
result = Result.True;
} else {
result = Result.False;
}
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testContains", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs isEmpty() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param expectedResult
* @return test success
*/
private boolean testIsEmpty(ListADT<Integer> list, Result expectedResult) {
Result result;
try {
if (list.isEmpty()) {
result = Result.True;
} else {
result = Result.False;
}
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testIsEmpty", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs size() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param expectedSize
* @return test success
*/
private boolean testSize(ListADT<Integer> list, int expectedSize) {
try {
return (list.size() == expectedSize);
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testSize", e.toString());
e.printStackTrace();
return false;
}
}
/**
* Runs toString() method on given list and attempts to confirm non-default or empty String
* difficult to test - just confirm that default address output has been overridden
* @param list a list already prepared for a given change scenario
* @param expectedResult
* @return test success
*/
private boolean testToString(ListADT<Integer> list, Result expectedResult) {
Result result;
try {
String str = list.toString();
System.out.println("toString() output: " + str);
if (str.length() == 0) {
result = Result.Fail;
}
char lastChar = str.charAt(str.length() - 1);
if (str.contains("@")
&& !str.contains(" ")
&& Character.isLetter(str.charAt(0))
&& (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) {
result = Result.Fail; // looks like default toString()
} else {
result = Result.ValidString;
}
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testToString", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
// /////////////////////////////////////////
// UNORDERED_LIST_ADT TESTS XXX
// /////////////////////////////////////////
/**
* Runs addToFront() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param element
* @param expectedResult
* @return test success
*/
private boolean testAddToFront(ListADT<Integer> list, Integer element, Result expectedResult) {
Result result;
try {
((UnorderedListADT<Integer>) list).addToFront(element);
result = Result.NoException;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testAddToFront", e.toString());
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs addToRear() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param element
* @param expectedResult
* @return test success
*/
private boolean testAddToRear(ListADT<Integer> list, Integer element, Result expectedResult) {
Result result;
try {
((UnorderedListADT<Integer>) list).addToRear(element);
result = Result.NoException;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testAddToRear", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs addAfter() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param target
* @param element
* @param expectedResult
* @return test success
*/
private boolean testAddAfter(ListADT<Integer> list, Integer target, Integer element, Result expectedResult) {
Result result;
try {
((UnorderedListADT<Integer>) list).addAfter(element, target);
result = Result.NoException;
} catch (ElementNotFoundException e) {
result = Result.ElementNotFound;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testAddAfter", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
// /////////////////////////////////////
// INDEXED_LIST_ADT TESTS XXX
// /////////////////////////////////////
/**
* Runs add(int, T) method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param index
* @param element
* @param expectedResult
* @return test success
*/
private boolean testAddAtIndex(ListADT<Integer> list, int index, Integer element, Result expectedResult) {
Result result;
try {
((IndexedListADT<Integer>)list).add(index, element);
result = Result.NoException;
} catch (IndexOutOfBoundsException e) {
result = Result.IndexOutOfBounds;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testAddAtIndex", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs add(T) method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param element
* @param expectedResult
* @return test success
*/
private boolean testAdd(ListADT<Integer> list, Integer element, Result expectedResult) {
Result result;
try {
((IndexedListADT<Integer>)list).add(element);
result = Result.NoException;
} catch (IndexOutOfBoundsException e) {
result = Result.IndexOutOfBounds;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testAddAtIndex", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs set(int, T) method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param index
* @param element
* @param expectedResult
* @return test success
*/
private boolean testSet(ListADT<Integer> list, int index, Integer element, Result expectedResult) {
Result result;
try {
((IndexedListADT<Integer>)list).set(index, element);
result = Result.NoException;
} catch (IndexOutOfBoundsException e) {
result = Result.IndexOutOfBounds;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testSet", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs get() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param index
* @param expectedElement
* @param expectedResult
* @return test success
*/
private boolean testGet(ListADT<Integer> list, int index, Integer expectedElement, Result expectedResult) {
Result result;
try {
Integer retVal = ((IndexedListADT<Integer>)list).get(index);
if (retVal.equals(expectedElement)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (IndexOutOfBoundsException e) {
result = Result.IndexOutOfBounds;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testGet", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs remove(index) method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param index
* @param expectedElement
* @param expectedResult
* @return test success
*/
private boolean testRemoveIndex(ListADT<Integer> list, int index, Integer expectedElement, Result expectedResult) {
Result result;
try {
Integer retVal = ((IndexedListADT<Integer>)list).remove(index);
if (retVal.equals(expectedElement)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (IndexOutOfBoundsException e) {
result = Result.IndexOutOfBounds;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testRemoveIndex", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs indexOf() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param element
* @param expectedIndex
* @return test success
*/
private boolean testIndexOf(ListADT<Integer> list, Integer element, int expectedIndex) {
Result result;
try {
return ((IndexedListADT<Integer>)list).indexOf(element) == expectedIndex;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testIndexOf", e.toString());
e.printStackTrace();
return false;
}
}
////////////////////////////
// ITERATOR TESTS XXX
////////////////////////////
/**
* Runs iterator() method on a given list and checks result against expectedResult
* @param list a list already prepared for a given change scenario
* @param expectedResult
* @return test success
*/
private boolean testIterator(ListADT<Integer> list, Result expectedResult) {
Result result;
try {
Iterator<Integer> it = list.iterator();
result = Result.NoException;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testIterator", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs list's iterator hasNext() method on a given list and checks result against expectedResult
* @param iterator an iterator already positioned for the call to hasNext()
* @param expectedResult
* @return test success
*/
private boolean testIteratorHasNext(Iterator<Integer> iterator, Result expectedResult) {
Result result;
try {
if (iterator.hasNext()) {
result = Result.True;
} else {
result = Result.False;
}
} catch (ConcurrentModificationException e) {
result = Result.ConcurrentModification;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testIteratorHasNext", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs list's iterator next() method on a given list and checks result against expectedResult
* @param iterator an iterator already positioned for the call to hasNext()
* @param expectedValue the Integer expected from next() or null if an exception is expected
* @param expectedResult MatchingValue or expected exception
* @return test success
*/
private boolean testIteratorNext(Iterator<Integer> iterator, Integer expectedValue, Result expectedResult) {
Result result;
try {
Integer retVal = iterator.next();
if (retVal.equals(expectedValue)) {
result = Result.MatchingValue;
} else {
result = Result.Fail;
}
} catch (NoSuchElementException e) {
result = Result.NoSuchElement;
} catch (ConcurrentModificationException e) {
result = Result.ConcurrentModification;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testIteratorNext", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
/**
* Runs list's iterator remove() method on a given list and checks result against expectedResult
* @param iterator an iterator already positioned for the call to remove()
* @param expectedResult
* @return test success
*/
private boolean testIteratorRemove(Iterator<Integer> iterator, Result expectedResult) {
Result result;
try {
iterator.remove();
result = Result.NoException;
} catch (IllegalStateException e) {
result = Result.IllegalState;
} catch (ConcurrentModificationException e) {
result = Result.ConcurrentModification;
} catch (Exception e) {
System.out.printf("%s caught unexpected %s\n", "testIteratorRemove", e.toString());
e.printStackTrace();
result = Result.UnexpectedException;
}
return result == expectedResult;
}
//////////////////////////////////////////////////////////
//HELPER METHODS FOR TESTING ITERATORS XXX
//////////////////////////////////////////////////////////
/**
* Helper for testing iterators. Return an Iterator that has been advanced numCallsToNext times.
* @param list
* @param numCallsToNext
* @return Iterator for given list, after numCallsToNext
*/
private Iterator<Integer> iteratorAfterNext(ListADT<Integer> list, int numCallsToNext) {
Iterator it = list.iterator();
for (int i = 0; i < numCallsToNext; i++) {
it.next();
}
return it;
}
/**
* Helper for testing iterators. Return an Iterator that has had remove() called once.
* @param iterator
* @return same Iterator following a call to remove()
*/
private Iterator<Integer> iteratorAfterRemove(Iterator<Integer> iterator) {
iterator.remove();
return iterator;
}
}// end class UnorderedListTester
<file_sep>/C++Based/Binary_Search_Tree/122_PA6/main.cpp
/****************************************************************************************
* Name: <NAME> *
* Class: CptS 122, Spring 2017 *
* Programming Assignment: Project Assignment #6, Lab Section #5 *
* Date Due: 3/22/2017 *
* Description: This program uses a Binary search tree to convert strings given from a *
* text file to morse code. *
* *
*****************************************************************************************/
#include "BST.h"
#include <vector>
#include <fstream>
using std::fstream;
int main(void)
{
BST tree;
char char_holder;
string holder;
string conversion;
string code;
int i = 0;
fstream file("MorseTable.txt"); // Open first file for reading
while (!file.eof())
{
file >> char_holder >> holder;
tree.insert(char_holder, holder); // Create BST containing 39 characters from "MorseTable.txt" and their associated morse code values
}
file.close();
tree.print();
cout << endl;
system("pause");
system("cls");
file.open("Convert.txt"); // Open new file for reading
while (!file.eof())
{
getline(file, holder);
cout << holder << endl; // Holder holds the string of the current line being processed from Convert.txt
for (int i = 0; i < holder.length(); i++)
{
code = tree.search(holder[i]);
conversion = conversion + code + " "; // Conversion holds the string of the morse code for the string being processed
}
conversion = conversion + "\n";
}
cout << endl;
cout << conversion << endl;
file.close();
return 0;
}<file_sep>/README.md
# Data-Structures
My data structure projects from early CS classes.
<file_sep>/C++Based/Stack/StackTemplateLab/Stack.h
// This file contains a stack class template. The underlying data structure for the
// stack is an array allocated from the heap.
#pragma once
#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
template <class T>
class Stack
{
public:
Stack(int newSize = 0);
~Stack();
bool push(T &newItem);
bool pop(T &poppedItem);
bool peek(T &item);
bool isEmpty();
bool infixToPost(string &line);
string postfixToIn(string &line);
private:
int mSize; // represents the current number of items in the stack
int mMaxSize; // must not exceed the max size of our allocated array
T *mTop; // will point to contigous memory on the heap (an array)
};
template <class T>
Stack<T>::Stack(int newSize)
{
mSize = newSize; // this can also be used as the index to the top of the stack
mMaxSize = 100;
mTop = new T[100]; // allocating an array of 100 items of type T on the heap
}
template <class T>
Stack<T>::~Stack()
{
delete[] mTop; // this is how we free up an array on the heap in C++
}
// Places the newItem at the top of the stack
template <class T>
bool Stack<T>::push(T &newItem)
{
if (mSize < mMaxSize)
{
mTop[mSize] = newItem;
mSize++;
return true;
}
return false;
}
// In this implementation you will apply defensive design. You must check to
// see if the stack is empty or not before you pop. Places the popped item in
// the parameter referred to as "poppedItem". Returns true if the item was popped; false
// otherwise.
template <class T>
bool Stack<T>::pop(T &poppedItem)
{
if (this->isEmpty() == false)
{
poppedItem = mTop[mSize - 1];
mSize--;
return true;
}
return false;
}
// In this implementation you will apply defensive design. You must check to
// see if the stack is empty or not before you peek. Places the item at the top of the
// stack in the parameter referred to as "item". Returns true if there
// is an item at the top; false otherwise.
template <class T>
bool Stack<T>::peek(T &item)
{
if (isEmpty() == false)
{
item = mTop[mSize - 1];
return true;
}
return false;
}
// Returns true if the stack is empty; false otherwise
template <class T>
bool Stack<T>::isEmpty()
{
if (mSize == 0)
return true;
return false;
}
template <class T>
bool Stack<T>::infixToPost(string &line)
{
int length = line.length();
char temp;
int current;
int add1 = 0, add2 = 0, end = 0;
bool check1, check2;
for (int i = 0; i < length; i++)
{
temp = line[i];
if ((int)temp > 47 && (int)temp < 58)
{
current = (int)temp - 48;
push(current);
}
else
{
check1 = pop(add1);
check2 = pop(add2);
if (check1 && check2)
{
if (temp == '+')
{
end = add2 + add1;
}
else if (temp == '-')
end = add2 - add1;
else if (temp == '/')
end = add2 / add1;
else if (temp == '*')
end = add2 * add1;
}
push(end);
}
}
return true;
}
template <class T>
string Stack<T>::postfixToIn(string &line)
{
int length = line.length();
string str = "";
char temp = '\0';
char current;
bool check1, check2;
for (int i = 0; i < length; i++)
{
if (line[i] == '(')
{
i++;
temp = line[i];
while (temp != ')')
{
temp = line[i];
if ((int)temp <= 47 || (int)temp >= 58)
{
current = temp;
push(current);
}
else
{
str += temp;
}
if (temp == '*' || temp == '/')
{
i += 1;
str += line[i];
while (isEmpty() == false)
{
pop(current);
str += current;
}
}
i++;
temp = line[i];
}
while (isEmpty() == false)
{
pop(current);
str += current;
}
}
else
{
temp = line[i];
if ((int)temp <= 47 || (int)temp >= 58)
{
current = temp;
push(current);
}
else
{
str += temp;
}
if (temp == '*' || temp == '/')
{
i += 1;
str += line[i];
while (isEmpty() == false)
{
pop(current);
str += current;
}
}
}
}
while (isEmpty() == false)
{
pop(current);
str += current;
}
return str;
}<file_sep>/Java-Based/SearchingAndSorting/SearchAndSort.java
import java.util.*;
/**
* Class for searching and sorting DoubleLinkedLists
* using either natural order or a Comparator.
*
* @author spanter, mvail, <NAME>
*/
public class SearchAndSort
{
private static int count = 0;
/**
* Sorts a list that implements the DoubleLinkedListADT using the
* natural ordering of list elements.
* DO NOT MODIFY THIS METHOD SIGNATURE
*
* @param <T>
* The data type in the list must extend Comparable
* @param list
* The list that will be sorted
* @see DoubleLinkedListADT
*/
public static <T extends Comparable<T>> void sort(DoubleLinkedListADT<T> list)
{
if(list.size()>=2)
{
WrappedDLL<T> firstHalf = new WrappedDLL<T>();
WrappedDLL<T> secondHalf = new WrappedDLL<T>();
for(int index = 0; index < list.size()/2; index++)
{
firstHalf.add(list.first());
list.removeFirst();
}
for(int index = 0; index < list.size(); index++)
{
secondHalf.add(list.first());
list.removeFirst();
}
sort(firstHalf);
sort(secondHalf);
merge(list, firstHalf, secondHalf);
}
}
/**
* Sorts a DoubleLinkedListADT with the provided Comparator.
* DO NOT MODIFY THIS METHOD SIGNATURE
*
* @param <T>
* The type of list to sort
* @param list
* The list to sort
* @param c
* The Comparator to use
* @see DoubleLinkedListADT
*/
public static <T> void sort(DoubleLinkedListADT<T> list, Comparator<T> c) {
if(list.size()>=2)
{
WrappedDLL<T> firstHalf = new WrappedDLL<T>();
WrappedDLL<T> secondHalf = new WrappedDLL<T>();
for(int index = 0; index < list.size()/2; index++)
{
firstHalf.add(list.first());
list.removeFirst();
}
for(int index = 0; index < list.size(); index++)
{
secondHalf.add(list.first());
list.removeFirst();
}
sort(firstHalf, c);
sort(secondHalf, c);
merge(list, firstHalf, secondHalf, c);
}
}
public static <T extends Comparable<T>> void merge(DoubleLinkedListADT<T> list, DoubleLinkedListADT<T> firstHalf, DoubleLinkedListADT<T> secondHalf)
{
for(int index = 0; index <= (firstHalf.size() + secondHalf.size()); index++)
{
if(!firstHalf.isEmpty() && !secondHalf.isEmpty())
{
if(firstHalf.first().compareTo(secondHalf.first()) < 0)
{
list.addToRear(firstHalf.first());
firstHalf.removeFirst();
}
else if(firstHalf.first().compareTo(secondHalf.first()) == 0)
{
list.addToRear(firstHalf.first());
list.addToRear(secondHalf.first());
firstHalf.removeFirst();
secondHalf.removeFirst();
}
else
{
list.addToRear(secondHalf.first());
secondHalf.removeFirst();
}
}
else if(!firstHalf.isEmpty() && secondHalf.isEmpty())
{
list.addToRear(firstHalf.first());
firstHalf.removeFirst();
}
else if(firstHalf.isEmpty() && !secondHalf.isEmpty())
{
secondHalf.addToRear(secondHalf.first());
secondHalf.removeFirst();
}
}
}
public static <T> void merge(DoubleLinkedListADT<T> list, DoubleLinkedListADT<T> firstHalf, DoubleLinkedListADT<T> secondHalf, Comparator<T> c)
{
for(int index = 0; index <= (firstHalf.size() + secondHalf.size()); index++)
{
if(!firstHalf.isEmpty() && !secondHalf.isEmpty())
{
if(c.compare(firstHalf.first(), secondHalf.first()) < 0)
{
list.addToRear(firstHalf.first());
firstHalf.removeFirst();
}
else if(c.compare(firstHalf.first(), secondHalf.first()) == 0)
{
list.addToRear(firstHalf.first());
list.addToRear(secondHalf.first());
firstHalf.removeFirst();
secondHalf.removeFirst();
}
else
{
list.addToRear(secondHalf.first());
secondHalf.removeFirst();
}
}
else if(!firstHalf.isEmpty() && secondHalf.isEmpty())
{
list.addToRear(firstHalf.first());
firstHalf.removeFirst();
}
else if(firstHalf.isEmpty() && !secondHalf.isEmpty())
{
secondHalf.addToRear(secondHalf.first());
secondHalf.removeFirst();
}
}
}
/**
* Finds the smallest element in a list according to the natural ordering of
* list elements. Does not alter the order of list elements.
* DO NOT MODIFY THIS METHOD SIGNATURE
*
* @param <T>
* The type of object we are comparing
* @param list
* The list we are passed
* @return The smallest element or null if list is empty
* @see DoubleLinkedListADT
*/
public static <T extends Comparable<T>> T findSmallest(DoubleLinkedListADT<T> list) {
if(list.isEmpty())
return null;
T retVal = list.first();
T test;
if(list.size() == 1)
return retVal;
else{
retVal = list.first();
list.removeFirst();
test = findSmallest(list);
list.addToFront(retVal);
}
if(retVal.compareTo(test) <= 0)
return retVal;
else
return test;
}
/**
* Finds the smallest element in a list with a Custom comparator. Does not
* alter the order of list elements.
* DO NOT MODIFY THIS METHOD SIGNATURE
*
* @param <T>
* The type of object we are comparing
* @param list
* The list we are passed
* @param c
* The comparator to use
* @return The smallest element or null if list is empty
* @see DoubleLinkedListADT
*/
public static <T> T findSmallest(DoubleLinkedListADT<T> list, Comparator<T> c)
{
if(list.isEmpty())
return null;
T retVal = list.first();
T test;
if(list.size() == 1)
return retVal;
else{
retVal = list.first();
list.removeFirst();
test = findSmallest(list, c);
list.addToFront(retVal);
}
if(c.compare(retVal, test) <= 0)
return retVal;
else
return test;
}
/**
* Finds the largest element in a list according to the natural ordering of
* list elements. Does not alter the order of list elements.
* DO NOT MODIFY THIS METHOD SIGNATURE
*
* @param <T>
* The type of object we are comparing
* @param list
* The list we are passed
* @return The largest element or null if list is empty
* @see DoubleLinkedListADT
*/
public static <T extends Comparable<T>> T findLargest(DoubleLinkedListADT<T> list) {
if(list.isEmpty())
return null;
T retVal = list.first();
T test;
if(list.size() == 1)
return retVal;
else{
retVal = list.first();
list.removeFirst();
test = findLargest(list);
list.addToFront(retVal);
}
if(retVal.compareTo(test) >= 0)
return retVal;
else
return test;
}
/**
* Finds the largest element in a list with a Custom comparator. Does not
* alter the order of list elements.
* DO NOT MODIFY THIS METHOD SIGNATURE
*
* @param <T>
* The type of object we are comparing
* @param list
* The list we are passed
* @param c
* The comparator to use
* @return The largest element or null if list is empty
* @see DoubleLinkedListADT
*/
public static <T> T findLargest(DoubleLinkedListADT<T> list, Comparator<T> c) {
if(list.isEmpty())
return null;
T retVal = list.first();
T test;
if(list.size() == 1)
return retVal;
else{
retVal = list.first();
list.removeFirst();
test = findLargest(list, c);
list.addToFront(retVal);
}
if(c.compare(retVal, test)>= 0)
return retVal;
else
return test;
}
}<file_sep>/Java-Based/SearchingAndSorting/SearchAndSortTester.java
import java.util.*;
/**
* Class for testing the SearchAndSort class
* @author Omar
*
*/
public class SearchAndSortTester {
private enum ListToUse {
mergeSort
};
// TODO: THIS IS WHERE YOU CHOOSE WHICH LIST TO TEST
private final ListToUse LIST_TO_USE = ListToUse.mergeSort;
// possible results expected in tests
private enum Result {
EmptyCollection, ElementNotFound, IndexOutOfBounds, IllegalState, ConcurrentModification, NoSuchElement,
NoException, UnexpectedException,
True, False, Pass, Fail,
MatchingValue,
ValidString
};
// named elements for use in tests
private static final Integer ELEMENT_A = new Integer(1);
private static final Integer ELEMENT_B = new Integer(2);
private static final Integer ELEMENT_C = new Integer(3);
private static final Integer ELEMENT_D = new Integer(4);
// instance variables for tracking test results
private int passes = 0;
private int failures = 0;
private int total = 0;
/**
* @param args not used
*/
public static void main(String[] args) {
// to avoid every method being static
SearchAndSortTester tester = new SearchAndSortTester();
tester.runTests();
}
/**
* Print test results in a consistent format
*
* @param testDesc description of the test
* @param result indicates if the test passed or failed
*/
private void printTest(String testDesc, boolean result) {
total++;
if (result) { passes++; }
else { failures++; }
System.out.printf("%-46s\t%s\n", testDesc, (result ? " PASS" : "***FAIL***"));
}
/** Print a final summary */
private void printFinalSummary() {
System.out.printf("\nTotal Tests: %d, Passed: %d, Failed: %d\n",
total, passes, failures);
}
/** XXX <- see the blue box on the right of the scroll bar? this tag aids in navigating long files
* Run tests to confirm required functionality from list constructors and methods */
private void runTests() {
//recommended scenario naming: start_change_result
test_newList(); //aka noList_constructor_emptyList
test_sort21_12();
test_sort10_01();
test_sort321_123();
// report final verdict
printFinalSummary();
}
//////////////////////////////////////
// SCENARIO: NEW EMPTY LIST
// XXX Scenario 1
//////////////////////////////////////
/**
* Returns a ListADT for the "new empty list" scenario.
* Scenario: no list -> constructor -> [ ]
*
* NOTE: the return type is a basic ListADT reference, so each test method
* will need to cast the reference to the specific interface (Indexed or
* UnorderedListADT) containing the method being tested.
*
* @return a new, empty ListADT
*/
/** Run all tests on scenario: no list -> constructor -> [ ] */
private void test_newList() {
try {
// ListADT
System.out.println("no list -> constructor -> [ ]");
printTest("newList_sort", testSort("", ""));
printTest("newList_sortComparator", testSortComparator("", ""));
printTest("newList_findSmallest", testFindSmallest("1", 1));
printTest("newList_findSmallestComparator", testFindSmallestComparator("1", 1));
printTest("newList_findLargest", testFindLargest("1", 1));
printTest("newList_findLargestComparator", testFindLargestComparator("1", 1));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_newList");
e.printStackTrace();
}
}
private void test_sort21_12() {
try {
// ListADT
System.out.println("no list -> constructor -> [ ]");
printTest("newList_sort", testSort("21", "12"));
printTest("newList_sortComparator", testSortComparator("21", "12"));
printTest("newList_findSmallest", testFindSmallest("12", 1));
printTest("newList_findSmallestComparator", testFindSmallestComparator("12", 1));
printTest("newList_findLargest", testFindLargest("12", 2));
printTest("newList_findLargestComparator", testFindLargestComparator("12", 2));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_newList");
e.printStackTrace();
}
}
private void test_sort10_01() {
try {
// ListADT
System.out.println("no list -> constructor -> [ ]");
printTest("newList_sort", testSort("10", "01"));
printTest("newList_sortComparator", testSortComparator("10", "01"));
printTest("newList_findSmallest", testFindSmallest("01", 0));
printTest("newList_findSmallestComparator", testFindSmallestComparator("01", 0));
printTest("newList_findLargest", testFindLargest("01", 1));
printTest("newList_findLargestComparator", testFindLargestComparator("01", 1));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_newList");
e.printStackTrace();
}
}
private void test_sort321_123() {
try {
// ListADT
System.out.println("no list -> constructor -> [ ]");
printTest("newList_sort", testSort("321", "123"));
printTest("newList_sortComparator", testSortComparator("321", "123"));
printTest("newList_findSmallest", testFindSmallest("123", 1));
printTest("newList_findSmallestComparator", testFindSmallestComparator("123", 1));
printTest("newList_findLargest", testFindLargest("123", 3));
printTest("newList_findLargestComparator", testFindLargestComparator("123", 3));
System.out.println();
} catch (Exception e) {
System.out.printf("***UNABLE TO RUN/COMPLETE %s***\n", "test_newList");
e.printStackTrace();
}
}
private boolean testSort(String elements, String result)
{
try
{
int index = 0;
WrappedDLL<Integer> list = new WrappedDLL<Integer>();
for(int i = 0; i<elements.length(); i++)
{
String name = elements.charAt(i) + "";
list.addToRear(Integer.parseInt(name));
}
SearchAndSort.sort(list);
for(int i = 0; i<result.length(); i++)
{
String name = result.charAt(i) + "";
if (list.get(i) != Integer.parseInt(name))
return false;
}
}
catch(Exception e)
{
e.printStackTrace();
return false;
}
return true;
}
private boolean testSortComparator(String elements, String result)
{
try
{
int index = 0;
WrappedDLL<Integer> list = new WrappedDLL<Integer>();
for(int i = 0; i<elements.length(); i++)
{
String name = elements.charAt(i) + "";
list.addToRear(Integer.parseInt(name));
}
SearchAndSort.sort(list, new ComparableComparator<Integer>());
for(int i = 0; i<result.length(); i++)
{
String name = result.charAt(i) + "";
if (list.get(i) != Integer.parseInt(name))
return false;
}
}
catch(Exception e)
{
e.printStackTrace();
return false;
}
return true;
}
private boolean testFindSmallest(String elements, int result)
{
try
{
int index = 0;
WrappedDLL<Integer> list = new WrappedDLL<Integer>();
for(int i = 0; i<elements.length(); i++)
{
String name = elements.charAt(i) + "";
list.addToRear(Integer.parseInt(name));
}
int smallest = SearchAndSort.findSmallest(list);
if(smallest != result)
return false;
}
catch(Exception e)
{
e.printStackTrace();
return false;
}
return true;
}
private boolean testFindSmallestComparator(String elements, int result)
{
try
{
int index = 0;
WrappedDLL<Integer> list = new WrappedDLL<Integer>();
for(int i = 0; i<elements.length(); i++)
{
String name = elements.charAt(i) + "";
list.addToRear(Integer.parseInt(name));
}
int smallest = SearchAndSort.findSmallest(list, new ComparableComparator<Integer>());
if(smallest != result)
return false;
}
catch(Exception e)
{
e.printStackTrace();
return false;
}
return true;
}
private boolean testFindLargest(String elements, int result)
{
try
{
int index = 0;
WrappedDLL<Integer> list = new WrappedDLL<Integer>();
for(int i = 0; i<elements.length(); i++)
{
String name = elements.charAt(i) + "";
list.addToRear(Integer.parseInt(name));
}
int largest = SearchAndSort.findLargest(list);
if(largest != result)
return false;
}
catch(Exception e)
{
e.printStackTrace();
return false;
}
return true;
}
private boolean testFindLargestComparator(String elements, int result)
{
try
{
int index = 0;
WrappedDLL<Integer> list = new WrappedDLL<Integer>();
System.out.println(elements);
for(int i = 0; i<elements.length(); i++)
{
String name = elements.charAt(i) + "";
list.addToRear(Integer.parseInt(name));
}
int largest = SearchAndSort.findLargest(list, new ComparableComparator<Integer>());
System.out.println(list.toString());
if(largest != result)
return false;
}
catch(Exception e)
{
e.printStackTrace();
return false;
}
return true;
}
}
<file_sep>/Java-Based/ListTesting/ArrayQueue.java
import java.util.Arrays;
public class ArrayQueue<T> implements QueueADT<T> {
private T[] theQueue;
private int size;
private int first;
private int rear;
public ArrayQueue(){
theQueue = (T[])new Object[10];
size = 0;
first = 0;
rear = 0;
}
private void expandCapacity()
{
T[] bigOne = (T[]) new Object[theQueue.length*2];
for(int index = 0; index < size(); index++)
{
bigOne[index] = theQueue[first];
first = (first + 1) % theQueue.length;
}
first = 0;
rear = size();
theQueue = bigOne;
}
@Override
public void enqueue(T element) {
if(size() == theQueue.length)
expandCapacity();
theQueue[rear] = element;
size++;
rear = (rear+1)%theQueue.length;
}
@Override
public T dequeue() {
if(isEmpty())
throw new EmptyCollectionException("Queue");
T retVal = theQueue[first];
theQueue[first] = null;
first = (first + 1) % theQueue.length;
size--;
return retVal;
}
@Override
public T first() {
if(isEmpty())
throw new EmptyCollectionException("Queue");
return theQueue[first];
}
@Override
public boolean isEmpty() {
return (first == rear);
}
@Override
public int size() {
return size;
}
}
<file_sep>/C++Based/CPP_LinkedList/CppLinkedList/main.cpp
#include "ListApp.h"
int main(void)
{
Queue<int> q;
int num = 21;
bool success;
success = q.enqueue(num);
num = 1;
success = q.dequeue(num);
cout << num << endl;
return 0;
}<file_sep>/C++Based/CPP_LinkedList/CppLinkedList/ListNode.h
#pragma once
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
template <class T> class ListNode
{
public:
ListNode();
ListNode(T newData); // constructor - "constructs" a ListNode; initializes the object
ListNode(const ListNode<T> ©); // copy constructor - implicitly invoked copying a ListNode object during construction of
// another ListNode object, or when a ListNode object is passed-by-value;
// the compiler generated one would be ok here as well! shallow copy performed!
~ListNode(); // destructor - implicitly invoked when a ListNode object leaves scope;
// the compiler generated one would be ok here as well!
// we will not define an explicit overloaded assignment operator (=). We will
// rely on the memberwise assignment generated by the compiler.
// getters
T getData() const; // used to retrieve a copy of the data in the node
ListNode<T> * getNextPtr() const; // used to retrieve a copy of the node's next pointer
// setters
void setData(const T &newData); // used to modify the data in the node
void setNextPtr(ListNode<T> * const pNewNext); // used to modify the node's next pointer
private:
T mData; // represents a score
ListNode<T> *mpNext; // should be set to NULL in the constructor
};
template <class T>
ListNode<T>::ListNode()
{
mpNext = nullptr;
}
template <class T>
ListNode<T>::ListNode(T newData)
{
mData = newData;
mpNext = nullptr;
}
template <class T>
// copy constructor - implicitly invoked copying a ListNode object during construction of
// another ListNode object, or when a ListNode object is passed-by-value
ListNode<T>::ListNode(const ListNode<T> ©)
{
// shallow copy performed!
mData = copy.mData;
mpNext = copy.mpNext;
}
template <class T>
// destructor - implicitly invoked when a ListNode object leaves scope
ListNode<T>::~ListNode()
{
// Yes, these nodes are dynamically allocated, but delete will be invoked invoked by functions in List.
// Hence, don't need to deallocate the heap memory inside of this destructor!
cout << "Inside ListNode's destructor!" << endl;
}
template <class T>
T ListNode<T>::getData() const // the const indicates "constant" function; can't modify the object's data members with this function
{
return mData;
}
template <class T>
ListNode<T> * ListNode<T>::getNextPtr() const // the const indicates "constant" function; can't modify the object's data members with this function
{
return mpNext;
}
template <class T>
void ListNode<T>::setData(const T &newData) // the const in this context ensures newData can't be modified
{
mData = newData;
}
template <class T>
// the const in this context ensures pNewNext can't be modified;
// remember read as pNewNext is a constant pointer to a ListNode - the ListNode object is not const though!
void ListNode<T>::setNextPtr(ListNode<T> * const pNewNext)
{
mpNext = pNewNext;
}<file_sep>/C++Based/CPP_LinkedList/CppLinkedList/List.h
#pragma once
#include <iostream>
#include "ListNode.h"
using std::cin;
using std::cout;
using std::endl;
// This class defines a container for a list; it's a singly linked list
template <class T> class List
{
public:
List(); // default constructor; will always set mpHead to NULL
List(const List<T> ©List); // copy constructor - implicitly invoked copying a List object during construction of
// another List object, or when a List object is passed-by-value - must perform a deep copy,
// which means create new memory for each node copied!
~List(); // destructor - implicitly invoked when a List object leaves scope
List<T> & operator= (const List<T> &rhs); // overloaded assignment operator - must perform a deep copy, which means
// create new memory (from the heap) for each node copied!
// getter
ListNode<T> * getHeadPtr() const; // returns a copy of the address stored in mpHead
// setter
void setHeadPtr(ListNode<T> * const pNewHead); // modifies mpHead
bool insertAtFront(const T newData); // inserts newData at the beginning or front of the list
bool insertInOrder(const T newData); // inserts newData in ascending (smallest to largest) order
bool insertAtEnd(const T newData); // inserts newData at the end of the list
bool isEmpty(); // determines if the list is empty
T deleteAtFront(); // deletes the node at the front of the list
bool deleteNode(T &searchValue); // deletes the node with data == searchValue
T deleteAtEnd(); // deletes the node at the end of the list
void printList(); // visits each node, print the node's data - we could also overload the stream insertion << operator to print the list
private:
ListNode<T> *firstNode; // pointer to the start or head of the singly linked list
ListNode<T> *lastNode;
// yes, we can make member functions private as well
ListNode<T> * makeNode(const T newData); // will only call within insert functions
void destroyList(); // deletes each node to free memory; will call in the destructor
void destroyListHelper(ListNode<T> * const pMem); // we will use recursion to solve this problem!
};
// default constructor; will always set mpHead to NULL or nullptr
template <class T>
List<T>::List()
{
firstNode = nullptr;
lastNode = nullptr;
}
// copy constructor - implicitly invoked copying a List object during construction of
// another List object, or when a List object is passed-by-value - must perform a deep copy,
// which means create new memory for each node copied!
template <class T>
List<T>::List(const List ©List)
{
ListNode<T> *pCopy = copyList.firstNode;
//this->mpHead
if (copyList.firstNode != nullptr)
{
ListNode<T> *nNode = new ListNode<T>(pCopy->getData());
firstNode = nNode;
ListNode<T> *pWalk = firstNode;
pCopy = pCopy->getNextPtr();
while (pCopy->getNextPtr() != nullptr)
{
nNode = new ListNode<T>(pCopy->getData());
pWalk->setNextPtr(nNode);
pWalk = pWalk->getNextPtr();
pCopy = pCopy->getNextPtr();
}
if (pCopy->getNextPtr() == nullptr)
lastNode = pCopy;
}
else
firstNode = lastNode = nullptr;
}
template <class T>
List<T>::~List() // destructor - implicitly invoked when a List object leaves scope
{
cout << "Inside List's destructor! Freeing each ListNode in the List!" << endl;
destroyList();
}
// this function must allocate new memory for each of the nodes in rhs to construct "this" object
template <class T>
List<T> & List<T>::operator= (const List<T> &rhs) // overloaded assignment operator - must perform a deep copy
{
if (firstNode != nullptr)
{
while (_size > 0)
{
removeElementAt(0);
}
}
ListNode<T> *pCopy = rhs.firstNode;
if (rhs.firstNode != nullptr)
{
while (pCopy != nullptr)
{
addElement(pCopy->getData());
pCopy = pCopy->getNextPtr();
}
}
else
firstNode = nullptr;
return (*this);
}
// getter
template <class T>
ListNode<T> * List<T>::getHeadPtr() const // returns a copy of the address stored in mpHead
{
return firstNode;
}
template <class T>
// setter
void List<T>::setHeadPtr(ListNode<T> * const pNewHead) // modifies mpHead
{
firstNode = pNewHead;
}
template <class T>
// This function creates a new ListNode on the heap, and uses the ListNode constructor to initialize the node!
bool List<T>::insertAtFront(const T newData) // inserts newData at the beginning or front of the list
{
//ListNode<T> *pMem = makeNode(newData);
//bool success = false; // C++ has built in bool types - false, true
//if (pMem != nullptr)
//{
// success = true; // allocated memory successfully
// // pMem is pointing to a ListNode object, but a List object does not have direct access to it; must use a setter!
// pMem->setNextPtr(mpHead);
// mpHead = pMem;
//}
//return success;
}
template <class T>
// inserts newData at the end of the list
bool List<T>::insertAtEnd(const T newData)
{
ListNode<T> *pMem = makeNode(newData);
ListNode<T> *pCur = firstNode;
bool success = false;
if (pMem != nullptr)
{
if (this->isEmpty())
firstNode = lastNode = pMem;
else
{
lastNode->setNextPtr(pMem);
lastNode = pMem;
}
success = true;
}
return success;
}
template <class T>
// determines if the list is empty;
// returns true if the list is empty; false otherwise
bool List<T>::isEmpty()
{
return (firstNode == nullptr);
}
template <class T>
// deletes the node at the front of the list and returns a copy of the data
// precondition: list must not be empty
T List<T>::deleteAtFront()
{
T data;
ListNode<T> *pTemp;
pTemp = firstNode;
if (firstNode != nullptr)
{
firstNode = firstNode->getNextPtr();
data = pTemp->getData();
delete pTemp;
}
return data;
}
template <class T>
// deletes the node at the end of the list and returns a copy of the data
// precondition: list must not be empty
T List<T>::deleteAtEnd()
{
//T data;
//ListNode<T> *pPrev;
//ListNode<T> *pCur = mpHead;
//while (pCur->getNextPtr() != nullptr)
//{
// pPrev = pCur;
// pCur = pCur->getNextPtr();
//}
//data = pCur->getData();
//pPrev->setNextPtr(nullptr);
//delete pCur;
//return data;
}
template <class T>
// visits each node, print the node's data
void List<T>::printList()
{
ListNode<T> *pCur = firstNode;
while (pCur != nullptr)
{
cout << pCur->getData() << endl;
pCur = pCur->getNextPtr();
}
}
//////////// private member functions! //////////////
template <class T>
// allocates memory for a Listnode; initializes the memory with newData
ListNode<T> * List<T>::makeNode(const T newData) // will only call within insert functions
{
ListNode<T> *pMem = new ListNode<T>(newData); // ListNode constructor is invoked!
return pMem;
}
template <class T>
// we created this function so that we could use recursion to delete the nodes!
void List<T>::destroyListHelper(ListNode<T> * const pMem)
{
if (pMem != nullptr)
{
destroyListHelper(pMem->getNextPtr());
delete pMem; // delete from the back of list to the front!
}
}
template <class T>
// deletes each node to free memory; will call in the destructor
void List<T>::destroyList()
{
destroyListHelper(firstNode);
}<file_sep>/C++Based/Stack/StackTemplateLab/main.cpp
// This example illustrates how to define a Stack class template.
#include "TestStack.h"
//#include <vector>
int main(void)
{
int item1 = -89, item2 = 104;
char item = '\0';
string end;
bool take;
Stack<int> toPost(0);
Stack<char> toIn(0);
string str = "123*+4-";
take = toPost.infixToPost(str);
take = toPost.peek(item1);
cout << item1 << endl;
system("pause");
system("cls");
str = "(6+2)*5-8/4";
end = toIn.postfixToIn(str);
cout << "Postfix: "<< str << " Infix: " << end << endl;
system("pause");
str = "(1+2)*3-4";
end = toIn.postfixToIn(str);
cout << "\nPostfix: " << str << " Infix: " << end << endl;
system("pause");
// vector<int> my_vector; // vector<> is from the Standard Template Library (STL)
TestStack<int> tester;
tester.Test(item1, item2);
return 0;
} | 27ed4f47c155e6bfc6542611e70c1e1ca79c0138 | [
"Markdown",
"Java",
"C++"
] | 17 | C++ | omar-enrique/Data-Structures | 07361c9fed396e41960efd1787a564444a146447 | 8db39c4e33c1d6c9d80feac9e909633c24455f51 |
refs/heads/main | <repo_name>HerbLuo/zz-trans<file_sep>/database/ddl.sql
/* 版本 */
CREATE TABLE version (
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
uid bigint unsigned NULL COMMENT '当数据私有时可选',
business varchar(32) NOT NULL COMMENT '业务',
type varchar(5) NOT NULL COMMENT 'oss,local',
version int unsigned NOT NULL COMMENT '版本',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
KEY with_type_with_uid_business (`type`, `uid`, `business`) /*注意这里为了更好的使用索引,搜索全局业务时,加上uid is null更好*/
) COLLATE = utf8mb4_unicode_ci COMMENT '版本信息';
CREATE TABLE version_command (
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
uid bigint unsigned NULL COMMENT '当数据私有时可选',
business varchar(32) NOT NULL COMMENT '业务',
version int unsigned NOT NULL COMMENT '版本',
command varchar(255) NOT NULL COMMENT '同步用的指令',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
KEY with_type_with_uid_business (`business`, `uid`, `version`)
) COLLATE = utf8mb4_unicode_ci COMMENT '版本同步指令';
/* 公共数据 */
CREATE TABLE simple_word ( /*Redis: Set<word>, FrontEnd: Array<word>*/
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
word varchar(100) NOT NULL COMMENT '简单词',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '简单词汇';
CREATE TABLE word ( /*Redis: ZSet<first word, word, score>, FrontEnd: Record<word, score>*/
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
word varchar(100) NOT NULL COMMENT '单词',
score double NOT NULL COMMENT '词频',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '词汇';
CREATE TABLE professional_word (/*Redis: Hash<category, word, score>, FrontEnd: Record<category, Record<word, score>>*/
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
category_id bigint unsigned NOT NULL COMMENT '专业分类',
word varchar(100) NOT NULL COMMENT '单词',
score double NOT NULL COMMENT '词频',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '专业词汇';
CREATE TABLE exchanges (/*Redis: Hash<first word, word, origin>, FrontEnd: Record<word, score>*/
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
word varchar(100) NOT NULL COMMENT '单词',
origin varchar(64) NOT NULL COMMENT '原型',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '词形';
CREATE TABLE category (/*JsonTree*/
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
name varchar(64) NOT NULL COMMENT '专业类别',
par_id varchar(64) NOT NULL COMMENT '父级',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '专业类别';
/* 审核表 */
CREATE TABLE verify (
id bigint unsigned NOT NULL COMMENT 'uid' primary key,
business varchar(64) NOT NULL COMMENT '业务',
action varchar(32) NOT NULL COMMENT '操作add,delete',
value varchar(64) NOT NULL COMMENT '值',
status tinyint default 0 NOT NULL COMMENT '审批状态, 0初始,1通过,-1拒绝',
checked_by varchar(50) NULL COMMENT '审批人',
checked_time datetime NULL COMMENT '审批人',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '审批表';
/* 用户登陆信息 */
CREATE TABLE auth_pwd (
uid bigint unsigned NOT NULL PRIMARY KEY,
username varchar(50) NOT NULL COMMENT '登录用的用户名',
password char(64) NOT NULL COMMENT '密码',
disabled tinyint(1) NOT NULL COMMENT '是否冻结',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
UNIQUE KEY username (`username`)
) COLLATE = utf8mb4_unicode_ci COMMENT '用户名密码信息';
CREATE TABLE auth_tmp_token (
uid bigint unsigned NOT NULL PRIMARY KEY,
tmp_token char(36) NOT NULL COMMENT '临时账号可以使用临时token登录',
disabled tinyint(1) NOT NULL COMMENT '是否冻结',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
UNIQUE KEY tmp_token (`tmp_token`)
) COLLATE = utf8mb4_unicode_ci COMMENT '临时账号信息';
/* 用户私有信息 */
CREATE TABLE user_pri_word ( /*FrontEnd: Record<word, familiar>*/
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
uid bigint NOT NULL COMMENT '用户ID',
word varchar(100) NOT NULL COMMENT '单词',
familiar tinyint(1) NOT NULL COMMENT '是否熟悉',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
UNIQUE KEY uid_word (`uid`,`word`)
) COLLATE = utf8mb4_unicode_ci COMMENT '用户私有的词汇';
CREATE TABLE user_category_score ( /*FrontEnd: Record<category, score>*/
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
uid bigint NOT NULL COMMENT '用户ID',
category_id bigint NOT NULL COMMENT '专业ID',
score double NOT NULL COMMENT '分数',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '用户词汇分数';
CREATE TABLE user_pri_setting (
id bigint unsigned AUTO_INCREMENT PRIMARY KEY,
uid bigint unsigned NOT NULL COMMENT '用户ID',
kee varchar(20) NOT NULL COMMENT '设置的键',
val varchar(50) NULL COMMENT '设置的值,如果为null表从全局设置继承',
site varchar(100) default 'global' NOT NULL COMMENT '生效的站点',
`order` double default 0 NULL COMMENT '生效顺序',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
constraint uid_kee unique (uid, site, kee)
) COLLATE = utf8mb4_unicode_ci COMMENT '用户私有设置';
CREATE TABLE user_pri (
uid bigint NOT NULL PRIMARY KEY,
role tinyint unsigned NOT NULL COMMENT '用户角色',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '用户私有数据';
CREATE TABLE user_pub (
uid bigint NOT NULL PRIMARY KEY,
nickname varchar(50) NULL COMMENT '昵称',
deleted tinyint(1) default 0 NOT NULL COMMENT '是否删除',
create_by varchar(55) NOT NULL COMMENT '创建人',
create_time datetime default current_timestamp NOT NULL COMMENT '创建日期',
update_by varchar(55) NULL COMMENT '更新人',
update_time datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) COLLATE = utf8mb4_unicode_ci COMMENT '用户公有数据';
<file_sep>/doc/开发-后端.md
### 一:分析
#### 1. 有以下几块数据:
|name |OSS|REDIS|MYSQL|VER_CTRL_WITH_CMD|VER_CTRL|
|---|---|---|---|---|---|
|简单词 |✅| |✅|✅| |
|单词与词频 |✅|✅|✅|✅| |
|专业词汇与词频 |✅|✅|✅|✅| |
|词形 |✅| |✅|✅| |
|专业信息 |✅| |✅| | |
|审核表 | | |✅| | |
|用户私有词汇 | | |✅| |✅|
|用户通用词汇分数 | | |✅| |✅|
|用户专业词汇分数 | | |✅| |✅|
|用户全局设置 | | |✅| |✅|
|用户某网站下的设置| | |✅| |✅|
|用户账号信息 | | |✅| | |
* 需要OSS的场景为:只要数据变更不频繁,都可接入OSS以节省业务服务器带宽。
另外,额外考虑数据的通用程度,过于私有的数据不接入,以节省OSS存储空间。
* 需要接入REDIS的场景为:高频写入 或 高频读取但不方便接入OSS
* 所有类型的数据都保存一版MYSQL
* 对于所有可同步的数据,都加入版本信息以及版本数据
* 另外,如果一块数据的结构可以明确定义为Hash, Set, ZSet等,
就不需要专门为该数据编写接口了
#### 2. 需要提供以下接口
```
Mind:
客户端读取
-> 初始化获取数据
-> 传入版本信息尝试更新数据
此时,服务端会有两种表现:
1. 数据存在版本信息, 返回版本信息
2. 数据不存在版本信息, 返回最新的完整数据
客户端写入
并非所有数据客户端都可以直接写入
可在登陆后根据uid直接写入的数据有:除特殊说明意外的所有用户私有数据
例如简单词, 用户在申请了添加简单词之后,需要审核,此时数据仅存放在审核表中
新单词与词频,词形,专业词汇与词频同上
版本
发生版本变化的原因存在两个,
1:加入新数据或删除新数据。无论是加入新数据还是删除新数据,都需要审批
审批过后,更新版本信息并更新OSS数据。
2:原有数据发生更新。
原有数据发生更新当数据发生一定变化,并达到一定阈值后,更新版本信息并更新OSS数据
```
### 二:任务及进度
|mark|desc|
|---|---|
|🏃|进行中|
|✅|基本完成|
|🎉|已完成|
|✋|已停止|
* 🏃 数据库设计(Mysql以及其对应的主REDIS结构)
* 数据库设计(Redis)
* 从REDIS获取数据的接口(初始化阶段)
* 从MYSQL获取数据的接口(初始化阶段)
* 使用客户端版本信息获取数据的接口(后续同步阶段)
* 从MYSQL同步至到OSS的任务¹
*
1. 同步至OSS的方案:
维护一个额外的本地数据版本的(MYSQL)表与OSS数据版本的(MYSQL)表,
数据版本更新后,将数据同步至OSS,并生成版本更新指令。
2.
<file_sep>/doc/设计.md
`POPUP`设置界面
`WELCOME`欢迎及引导界面
`BACKGROUND`后台服务
`CONTENT`注入到用户访问的各界面中
### 常规流程
---
#### 一. 欢迎与引导模块
---
##### 1.注册及登陆
###### 界面
```
┌─────────────────┐
username │ │
└─────────────────┘
┌─────────────────┐
password │ │
└─────────────────┘ skip
sign in | sign up
github | google | wechat
```
###### 流程
```
1 注册及登陆
-> 1.1 用户名与密码
-> 登陆
-> 注册
-> 1.2 第三方授权
-> 1.3 跳过(临时账号)
-> 1.4 直接关闭(此时,用户只能在Popup界面注册才能使用)
```
---
##### 2.其它信息录入
###### 界面
```
step1: professional & professional words
☑ cs
☑ common ⦿ normal ◯ hai_ke_yi ◯ professional
☐ java ⦿ normal ◯ hai_ke_yi ◯ professional
☐ javascript ⦿ normal ◯ hai_ke_yi professional
☐ typescript ⦿ normal ◯ hai_ke_yi ◯ professional
☐ rust ⦿ normal ◯ hai_ke_yi ◯ professional
...
step2: generally words
1. firstly, choose a score that roughly represents your english level
◯300 ◯ 350 ⦿ 400(≈CET4) ◯ 500 ◯ 600(≈CET6) ◯ 800
2. and then, there are three sets of words to fine-tune your english level
group 1/3
aboard barn carve dock injection mayor paste quote radius vertical ↺
* * * * * * * * * * ☑ show translate
words i know / all words
◯30% ⦿60% ◯70% ◯90%
( next group )
your final score: 400
```
###### 流程
```
2 其它信息录入
-> 2.1 专业及专业词汇
选择几个专业类别以及对专业词汇的熟悉程度,我们将在翻译结果中优先剔除这些专业词汇。
-> 2.2 通用词汇(未选专业词汇时,这里不能展开)
-> 2.2.1 选择一个能大致代表你的英语水平的分数
-> 2.2.1.1 然后,这里有三组词汇可以大致微调你的分数(20%低一级词汇, 50%当前级别词汇, 30%下一级词汇,另外过滤调所有简单和一般的专业词汇)
以400分为例:在350,360分段取一个词汇,370,380..430分段各取一个词汇,450到550取三个
-> 如果选的是50%及以下
-> 下一组直接展示翻译信息(因为语境中的单词更好理解)
-> 否则
-> 默认隐藏翻译
-> 2.2.2 你的最终分数
目的:1. 选60%时维持当前组的分数 2. 选90%时使用下一组的分数
400-(60%-x)*(400-350)/(60%-30%), 400+(x-60%)*(500-400)/(90%-60%)
70%->433
3 完毕后,执行初始化操作
```
---
#### 二. 数据以及接口模块(BACKGROUND)
##### 1. 初始化
```
初始化接收如下参数
是否执行同步 默认是
1 没有登陆信息
新版设计中不存在自动注册的操作,所以如果没有登陆,取消初始化
2 已有登陆信息
-> 登陆
-> 成功
-> 2.1 初始化公共信息(简单词,词频,词形,专业词汇)
-> 2.1.1 获取oss中的数据, 并将其存储为:WithVersionData
-> 2.2 初始化私有数据(用户全局设置,用户私有词汇,用户通用词汇分数,用户专业词汇分数,用户设置的专业)
-> 使用Api接口获取私有数据,并将其存储为:WithVersionData
-> 2.3 获取公共信息版本数据,触发一次所有公共数据的同步操作(Api接口获取的私有数据必然是最新的, 所以无需同步)
-> 2.4 使用某函数初始化用户的各网站下的设置信息
-> 失败 新版设计中不存在自动注册的操作,所以如果没有登陆,取消初始化
假设这里登陆失败是网络原因引起的,在用户触发?操作后,会重新执行登陆
触发翻译的时候?
点击设置界面的时候?
针对没有初始化的问题不大,因为调用大多数api接口前都会有一个同步操作,同步操作中检测到如果没有初始化,会执行重新登陆且初始化的操作
```
```
同步用户各网站下的设置信息
-> 智能获取用户的所有配置信息(后续服务器可在用户网站配置数量大于100时,仅返回KEY信息)
```
##### 2. 同步操作
同步操作只能由其它代码手动触发,它们可以是 初始化模块,触发翻译时等
调用同步操作需要使用await等待其返回
如果本地数据版本过旧(针对各种类型的数据,过旧时间可能不相同)或不存在,需要等待同步完成后,返回
否则,允许先使用本地数据,直接返回
__todo 获取服务器版本和获取数据可以放到同一接口中
```
1 简单词同步(参数有:数据在服务器上的版本, 可选参数:有新数据的回调)
-> 获取本地数据的版本信息
-> 没有获取到(可能是各种原因导致的初始化失败),执行不会自动同步的初始化操作并等待其完成
-> 成功 <--|
-> 失败
-> 同步失败
-> 版本过旧
-> <-|
-> 版本尚可接受
-> async <-| return
-> 从服务器或参数中获取云端版本信息
-> 对比
-> 存在新版本
-> 使用同步指令同步 可在失败后重试一次
2 词频,词形的同步同简单词汇
3 用户全局设置,用户私有词汇,用户通用词汇分数,用户专业词汇分数的同步同简单词
4 专业词汇的同步(参数有:专业ID,数据在服务器上的版本)
-> 获取本地数据的版本信息
-> 没有获取到,直接初始化该类别的专业词汇
-> 获取到了
-> 版本过旧
-> <-|
-> 版本尚可接受
-> async <-| return
-> 从服务器或参数中获取云端版本信息
-> 对比
-> 存在新版本 使用同步指令同步 可在失败后重试一次
4 用户某网站下设置的同步(参数有:匹配规则字符串,匹配规则字符串:'reg '开头的代表url正则匹配;否则,host匹配)
所有网站的配置,共享一个版本信息,叫做:针对网站设置的版本
-> 获取本地数据的版本信息
-> 没有获取到(可能是各种原因导致的初始化失败),执行不会自动同步的初始化操作并等待其完成
-> 获取到了
-> 版本过旧
-> <-|
-> 版本尚可接受
-> 先查找本地host匹配的数据,再查找本地'reg '匹配的数据
-> 找到且本地存储的数据为Symbol("no sync")标记
-> 使用同步指令*同步(传参为[reg]+host)
-> 否则
-> async <----| return
-> 从服务器或参数中获取云端版本信息
-> 对比
-> 存在新版本
-> 先查找本地host匹配的数据,再查找本地'reg '匹配的数据
-> 如果找到,使用同步指令*同步(传参为[reg]+host)
-> 没有找到,调用某函数同步所有的各网站下的设置信息
```
---
#### 三. 设置界面
##### 1. 设置界面初始化流程
```
存在用户的登陆信息
-> 尝试登陆或已登陆
-> 无法登陆,重试一次后仍然无法登陆
嵌入注册与登陆引导界面
-> 已登陆
-> 获取全局设置
-> 显示界面
没有找到用户的登陆信息
-> 嵌入注册与登陆引导界面
```
##### 2. 修改某个设置
目前存在如下几种设置
* 启用 默认是 可选否
* 发送私有数据 默认是 可选否
* server 切换Server之后允许重新载入插件后生效(该配置在生产环境中隐藏)
* 翻译服务器 默认百度 可选谷歌
* 译文位置 默认 右边 可选 右上方 仅悬浮
* 何时触发更多操作 默认 鼠标悬浮 可选 鼠标点击
* 翻译纯大写字母 默认否 可选 是
`应该可以将所有配置转换成get形式供content调用`
##### 3. 切换配置目标
```
-> 由此网站切换到全局设置
-> 获取全局配置
-> 显示界面
-> 由全局切换到此网站
-> 获取网站下配置
-> 调用同步接口(这样就可以保证本地有数据了)
-> 这里获取到的数据除了基本的选项外,还有另外一种null(为null时,代表跟随全局配置)
-> 从本地数据匹配出最合适的配置
-> 找到
-> 使用获取到的配置
-> 未找到
-> 使用全局中的配置
-> 显示界面
```
#### 四. Content
Content部分80%已开发过,暂不整理
```
全部 节点
↓ 过滤器组()
目标 节点
↓ 提取文字
全部 文字
↓ 过滤器组([去简,去重])
目标 文字
```
当DOM改变时,使用MutationObserver检测变化
之后提取文本,提取单词,生成单词生词标记,翻译,写入DOM
当DOM改变,使用MutationObserver检测变化
```
基本事件
载入完毕
滚动 → 翻译
DOM改变
```
```
详细设计
载入完毕 → 注册 Observer → 第一次准备翻译 (第一次准备翻译的时间,遵循以下公式)
↑ i i / (a - b × t) > 1
a = 500 |. i 界面信息量(即非简单单词数)
| . t 时间,单位 s
| . a 默认为500,可理解为0秒时,如果界面单词大于500,立即翻译
|——————————————.———————→ t b 默认200,可理解为3.3秒后,无论是否有信息,都进行翻译
t = 3.3
↑ i . → 等待空闲 等待空闲的时间,遵循以下公式
| . (a + t ^ 4) > 1000
| . i 当前Dom的有效变化量(大于100的变化量总和,单位单词长度)
| . t 时间,单位 ms
a = 1000 |. a 默认 1000
|————————————————————→ t b 默认 ,可理解为 500ms后,
WordsCache 未知词Api
第一次滚动一整页以上 → 提取全部单词 → → | 未知单词 → . → WordsCache
滚动 + debounce → 显示区域 → } WordsCache { 生词 → → 翻译
} → 提取单词 → → { ↑ 生词
DOM改变 → 所有区域 | 显示区域 → } { 未知单词 - 未知词Api → . → WordsCache
↓
↓ WordsCache 未知词Api
↓ → → | 未知单词 → . → WordsCache
注:未知词Api可能调用频繁(DOM频繁更新),所以需以特殊方式节流,以保证 A: 不频繁请求 B: 不重复请求
```
当前任务,增加一个对TranslateService.translate Text节点的缓存,缓存大小上限为 40960
暂不支持iframe
另外,针对纯重复字母单词,不再翻译
<file_sep>/database/db-to.deno.ts
import { Client, ClientConfig } from "https://deno.land/x/mysql/mod.ts";
const syncConfig: SyncConfig = {
from: { // 可配置为链接,也可配置为文件夹路径(从配置的路径中读取所有sql文件,然后在目标数据库执行)
hostname: "127.0.0.1",
username: "root",
db: "words",
password: "<PASSWORD>",
},
to: "sql", // 可配置为链接,也可配置为文件夹路径(会将生成的sql文件保存至目标文件夹)
tables: "*", // 可以为*或数组
mode: "drop-create", // 目前仅支持该模式
};
interface SyncConfig {
mode: "drop-create";
from: string | ClientConfig;
to: string | ClientConfig;
tables: "*" | string[];
}
type CouldExcute = Pick<Client, "execute">;
type Schema = string;
type RowSql = string;
type SqlGroup = Record<Schema, RowSql[]>;
async function dbToSql(
client: CouldExcute,
pipConfig?: {
bufferSize?: number;
cb: (sql: SqlGroup) => void | Promise<void>;
},
): Promise<SqlGroup> {
const shouldSyncTables = syncConfig.tables === "*"
? await client.execute(
"SELECT TABLE_NAME FROM information_schema.TABLES WHERE table_type = 'BASE TABLE' AND table_schema = DATABASE()"
).then(r => r.rows?.map(r => r["TABLE_NAME"] as string) || [])
: syncConfig.tables;
const bufferSize = pipConfig?.bufferSize || 1000;
const pipCb = pipConfig?.cb;
let rowSize = 0;
let bufferedSqlGroup: SqlGroup = {};
const executes: Array<Promise<void> | void> = [];
for (const table of shouldSyncTables) {
let i = 0;
while(true) {
const res = await client.execute(`SELECT * FROM ${table} LIMIT ${i*1000}, 1000`);
const rows = res.rows || [];
console.log(res.fields);
bufferedSqlGroup[table] = rows.map(row => {
const keys = Object.keys(row);
const values = Object.values(row);
return `INSERT INTO ${table} (${keys.join(",")}) VALUES (${values.map(v => {
if (typeof v === "number") {
return v;
}
if (typeof v === "string") {
return `'${v}'`;
}
console.log(v)
return v;
}).join(",")})`;
});
rowSize = rowSize + rows.length;
if (pipCb && rowSize > bufferSize) {
executes.push(pipCb(bufferedSqlGroup));
bufferedSqlGroup = {};
}
if (rows.length < 1000) {
break;
}
i++;
}
}
if (pipCb) {
await Promise.all(executes);
await pipCb(bufferedSqlGroup);
return {};
} else {
return bufferedSqlGroup;
}
}
async function sqlToDb(sql: SqlGroup, target: CouldExcute) {
}
const spearator = Deno.build.os === "windows" ? "\\" : "/";
const filenameNoExt = (path: string) => {
const name = path.split(spearator).pop()!;
const lastIndexOfDot = name.lastIndexOf(".");
return lastIndexOfDot > 0 ? name.substring(0, lastIndexOfDot) : name;
}
const join = (dir: string, file: string) => dir.endsWith(spearator)
? dir + file
: dir + spearator + file;
async function readSqlFiles(path: string): Promise<SqlGroup> {
const stat = await Deno.stat(path);
const readFile = async (filepath: string): Promise<[Schema, RowSql[]]> => {
const sqlFilenameNoExt = filenameNoExt(filepath);
const sqls = await Deno.readTextFile(filepath);
return [sqlFilenameNoExt, sqls.split("\n")];
}
if (stat.isFile) {
const pair = await readFile(path);
return {
[pair[0]]: pair[1],
};
}
if (stat.isDirectory) {
const result: SqlGroup = {};
for await (const dirEntry of Deno.readDir(path)) {
if (dirEntry.isFile) {
const pair = await readFile(join(path, dirEntry.name));
result[pair[0]] = pair[1];
}
}
return result;
}
throw new Error("unsupport path: " + path);
}
async function saveSqlToDir(sqlGroup: SqlGroup, to: string) {
for (const [filename, sqls] of Object.entries(sqlGroup)) {
const filepath = join(to, filename + ".sql");
await Deno.writeTextFile(filepath, sqls.join("\n"));
}
}
// main
const { from, to } = syncConfig;
if (typeof from === "string") {
if (typeof to === "string") {
throw new Error("不支持sql to sql模式");
}
const sourceSqls = await readSqlFiles(from);
const client = await new Client().connect(to);
await client.transaction(async conn => {
await sqlToDb(sourceSqls, conn);
});
await client.close();
} else {
const sourceClient = await new Client().connect(from);
if (typeof to === "string") {
const sqlGroup = await dbToSql(sourceClient);
await saveSqlToDir(sqlGroup, to);
} else {
const targetClient = await new Client().connect(to);
await targetClient.transaction(async conn => {
await dbToSql(sourceClient, {
cb: async (sql) => {
await sqlToDb(sql, conn);
},
});
});
await targetClient.close();
}
await sourceClient.close();
}
| 7d5840495ef562e2be9fbfc804b16812506e4283 | [
"Markdown",
"SQL",
"TypeScript"
] | 4 | SQL | HerbLuo/zz-trans | affc30f0a769c1d7d7abb9784cf0c79c45ecdded | 26009d877585c96d5498581411a2d5b858001d8c |
refs/heads/master | <repo_name>cherepnalkovski/kafka-time-window<file_sep>/src/main/java/org/arkcase/akrcasetimewindowing/service/TransactionTimestampExtractor.java
package org.arkcase.akrcasetimewindowing.service;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.streams.processor.TimestampExtractor;
/**
* Created by <NAME> <<EMAIL>> on Apr, 2020
*/
public class TransactionTimestampExtractor implements TimestampExtractor
{
@Override
public long extract(ConsumerRecord<Object, Object> record, long partitionTime)
{
if (record.value() instanceof GenericRecord)
{
GenericRecord value = (GenericRecord) record.value();
Schema.Field field = value.getSchema().getField("eventDate");
if (field != null && field.schema().getType().equals(Schema.Type.STRING))
{
// Get the timestamp from the record value
return Long.valueOf(value.get(field.pos()).toString());
}
}
return record.timestamp();
}
}
<file_sep>/src/main/java/org/arkcase/akrcasetimewindowing/configuration/KTableConfiguration.java
package org.arkcase.akrcasetimewindowing.configuration;
import io.confluent.kafka.serializers.AbstractKafkaAvroSerDeConfig;
import io.confluent.kafka.streams.serdes.avro.GenericAvroSerde;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericRecord;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.Serde;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsBuilder;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.Topology;
import org.apache.kafka.streams.kstream.Consumed;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.KTable;
import org.apache.kafka.streams.kstream.Produced;
import org.arkcase.akrcasetimewindowing.service.TransactionTimestampExtractor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import java.util.Map;
import java.util.Properties;
import static java.util.Collections.singletonMap;
/**
* Created by <NAME> <<EMAIL>> on Mar, 2020
*/
//@Configuration
public class KTableConfiguration
{
@Value(value = "${spring.kafka.bootstrapAddress}")
private String bootstrapAddress;
@Value(value = "${spring.kafka.schemaRegistryAddress}")
private String schemaRegistryAddress;
@Value(value = "${spring.kafka.streams.host}")
private String host;
@Value(value = "${spring.kafka.streams.state-dir}")
private String stateDir;
@Value(value = "${server.port}")
private Integer serverPort;
public static final String oneDayStore = "one-minute-new-windowed-store-1";
public static final String sevenDaysStore = "seven-minutes-new-windowed-store-1";
public static final String thirtyDaysStore = "thirty-minutes-new-windowed-store-1";
private static final String ldapUsers = "ldap_users_topic";
private static final Schema resultSchema = new Schema.Parser().parse("some schema definition");
static Topology buildTopology(final Map<String, String> serdeConfig)
{
final GenericAvroSerde valueSerde = new GenericAvroSerde();
valueSerde.configure(serdeConfig, false);
final Serde<String> stringSerde = Serdes.String();
final Serde<Long> longSerde = Serdes.Long();
final StreamsBuilder builder = new StreamsBuilder();
KStream<String, GenericRecord> ldapAuth = builder.stream("windowing-by-day-01", Consumed.with(stringSerde, valueSerde)
.withOffsetResetPolicy(Topology.AutoOffsetReset.EARLIEST)
.withTimestampExtractor(new TransactionTimestampExtractor()));
KTable<String, GenericRecord> userTable = builder.table("user-topic", Consumed.with(stringSerde, valueSerde)
.withOffsetResetPolicy(Topology.AutoOffsetReset.EARLIEST)
.withTimestampExtractor(new TransactionTimestampExtractor()));
// Only if there is ldap user with user id in user table, record will be produced.
KStream<String, GenericRecord> result = ldapAuth.join(userTable, new GenericRedordsJoiner());
result
.to(ldapUsers, Produced.with(stringSerde, valueSerde));
return builder.build();
}
static Properties streamsConfig(final String bootstrapServers,
final int applicationServerPort,
final String stateDir,
final String host)
{
final Properties streamsConfiguration = new Properties();
// The name must be unique in the Kafka cluster against which the application is run.
streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, "windowing-by-days-01-new-topic-example");
// Where to find Kafka broker(s).
streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
streamsConfiguration.put(StreamsConfig.APPLICATION_SERVER_CONFIG, host + ":" + applicationServerPort);
streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, stateDir);
streamsConfiguration.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
streamsConfiguration.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 100);
streamsConfiguration.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 0);
streamsConfiguration.put(StreamsConfig.DEFAULT_TIMESTAMP_EXTRACTOR_CLASS_CONFIG, TransactionTimestampExtractor.class);
streamsConfiguration.put(StreamsConfig.METRICS_RECORDING_LEVEL_CONFIG, "DEBUG");
return streamsConfiguration;
}
@Bean
public KafkaStreams kafkaStreams()
{
KafkaStreams streams = new KafkaStreams(
buildTopology(singletonMap(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, schemaRegistryAddress)),
streamsConfig(bootstrapAddress, serverPort, stateDir, host)
);
streams.start();
return streams;
}
}
<file_sep>/README.md
# kafka-time-window
Create kafka time windowing example
<file_sep>/src/main/java/org/arkcase/akrcasetimewindowing/configuration/GenericRedordsJoiner.java
package org.arkcase.akrcasetimewindowing.configuration;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
import org.apache.kafka.streams.kstream.ValueJoiner;
/**
* Created by <NAME> <<EMAIL>> on Apr, 2020
*/
public class GenericRedordsJoiner implements ValueJoiner<GenericRecord, GenericRecord, GenericRecord>
{
private static final Schema resultSchema = new Schema.Parser().parse("some schema definition");
@Override
public GenericRecord apply(GenericRecord left, GenericRecord right) {
GenericRecord projectionRecord = new GenericData.Record(resultSchema);
projectionRecord.put("id", left.get("id"));
projectionRecord.put("userId", left.get("userId"));
projectionRecord.put("name", right.get("name"));
projectionRecord.put("lastName", right.get("lastName"));
return projectionRecord;
}
}
| 19d42877d486e296f080d4876f143ccb826c1425 | [
"Markdown",
"Java"
] | 4 | Java | cherepnalkovski/kafka-time-window | 53c6c9f65518efe5511b6e407c6358315db69111 | 85de099cc355b5923d01a85d914cb4b428dc5914 |
refs/heads/master | <repo_name>Kah919/school-domain-dumbo-web-121018<file_sep>/lib/school.rb
# code here!
require 'pry'
class School
def initialize(name)
@name = name
@roster = {}
end
def roster
@roster
end
def add_student(name, grade)
if @roster.keys.include?(grade)
@roster[grade] << name
else
@roster[grade] = [name]
end
end
def grade(grade)
@roster[grade]
end
def sort # looks messy
organized = {}
Hash[@roster.sort].each do |name|
organized[name[0]] = name[1].sort
end
return organized
end
end
# flatiron = School.new("Flatiron")
# flatiron.add_student("Kah", 1)
# flatiron.add_student("Kyle", 2)
# flatiron.add_student("Ludy", 1)
# puts flatiron.roster.keys
| c7bab0880b6e07f080746186ab5383868c5d0a43 | [
"Ruby"
] | 1 | Ruby | Kah919/school-domain-dumbo-web-121018 | ba5ac8dc0feacab0e67222853d6e56b9905dff2a | 521d8da6638d23babff25276be0a4efb8e6bbfc4 |
refs/heads/master | <file_sep>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package banco;
import bdd.Conexion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
/**
*
* @author r_blu
*/
public class EstadoDeCuenta {
/**
* @return the tipo
*/
public String getTipo() {
return tipo;
}
/**
* @param tipo the tipo to set
*/
public void setTipo(String tipo) {
this.tipo = tipo;
}
private float Hmonto;
private int noTransferencia;
private int HcuentaD;
private int HcuentaO;
private int carnet;
private String tipo;
public EstadoDeCuenta(int T, float mo, int ctaD, int ctaO,String ctipo) {
noTransferencia = T;
Hmonto = mo;
HcuentaD = ctaD;
HcuentaO = ctaO;
tipo = ctipo;
}
public EstadoDeCuenta(){
}
/**
* @return the Hmonto
*/
public float getHmonto() {
return Hmonto;
}
/**
* @param Hmonto the Hmonto to set
*/
public void setHmonto(float Hmonto) {
this.Hmonto = Hmonto;
}
/**
* @return the noTransferencia
*/
public int getNoTransferencia() {
return noTransferencia;
}
/**
* @param noTransferencia the noTransferencia to set
*/
public void setNoTransferencia(int noTransferencia) {
this.noTransferencia = noTransferencia;
}
/**
* @return the HcuentaD
*/
public int getHcuentaD() {
return HcuentaD;
}
/**
* @param HcuentaD the HcuentaD to set
*/
public void setHcuentaD(int HcuentaD) {
this.HcuentaD = HcuentaD;
}
/**
* @return the HcuentaO
*/
public int getHcuentaO() {
return HcuentaO;
}
/**
* @param HcuentaO the HcuentaO to set
*/
public void setHcuentaO(int HcuentaO) {
this.HcuentaO = HcuentaO;
}
public EstadoDeCuenta[] getEstadoCuenta(int cuenta) {
Connection dbConnection = null;
PreparedStatement preparedStatement = null;
Vector a = new Vector<>();
String selectSQL = "select * from transaccion where ctaDestino = ? OR ctaOrigen= ? order by idtransaccion DESC";
try {
dbConnection = new Conexion().getDBConnection();
preparedStatement = dbConnection.prepareStatement(selectSQL);
preparedStatement.setInt(1, cuenta);
preparedStatement.setInt(2, cuenta);
ResultSet rs;
rs = preparedStatement.executeQuery();
int no_trans, ctaO, ctaD;
float monto;
String cTipo="";
while (rs.next()) {
no_trans = rs.getInt("idtransaccion");
monto = rs.getFloat("monto");
ctaO = rs.getInt("ctaOrigen");
ctaD = rs.getInt("ctaDestino");
if(ctaO==cuenta){
cTipo = "Retiro";
}
if(ctaD==cuenta){
cTipo = "Deposito";
}
a.add(new EstadoDeCuenta(no_trans, monto, ctaO, ctaD,cTipo));
System.out.println("#TRANSF No.: " + no_trans + " monto: " + monto + " ctaOrigen: " + ctaO + " ctaDest: " + ctaD+" Tipo: "+cTipo);
}
rs.close();
EstadoDeCuenta[] vHistorial = new EstadoDeCuenta[a.size()];
a.copyInto(vHistorial);
return vHistorial;
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (preparedStatement != null) {
dbConnection.close();
}
} catch (SQLException se) {
}// do nothing
try {
if (dbConnection != null) {
dbConnection.close();
}
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
return null;
}
}
<file_sep>package ipc2.gt.usac.org.appejemplo;
import org.junit.Test;
import ipc2.gt.usac.org.appejemplo.ws.WebServiceClient;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
@Test
public void consumirWebService() throws Exception {
String respuesta = WebServiceClient.AbrirCuentaMonetaria(2000,"REIMER","CHAMALE",2020d);
assertEquals("true",respuesta);
}
}<file_sep>package ipc2.gt.usac.org.appejemplo.ws;
import android.os.AsyncTask;
import android.util.Log;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.MarshalDate;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.ObjectInput;
import java.util.ArrayList;
import java.util.Vector;
import ipc2.gt.usac.org.appejemplo.ws.utils.EstadoDeCuenta;
//KSOAP2
public class WebServiceClient {
//Namespace of the Webservice - can be found in WSDL
private static String NAMESPACE = "http://ws/";
//DIRECCION DE SU WEB SERVICE
/*Tienen que usar una direccion IP, porque si ponen localhost o 127.0.0.1 se esta refiriendo a
* su dispositivo como localhost, y ahí no hay ningun servicio publicado.
* De preferencia si hacen una red hotspot con su Android y su computadora.
* */
private static String URL = "http://192.168.0.4:8080/bancoIPC2/API?wsdl";
//ESTO LO ENCUENTRAN EN EL WSDL
private static String SOAP_ACTION = "http://ws/";
//---------------------------
//METODO PARA ABRIR CUENTA---
//---------------------------
public static String AbrirCuentaMonetaria(Integer carnet, String nombre, String apellido, Double monto) {
String resTxt = null;
String nombreMetodoWS = "AbrirCuentaMonetaria";
// SE CREA UNA SOLICITUD, A LA CUAL SE LE ASIGNARÁ LOS PARAMETROS.
// SE ENVIA EL METODO.
SoapObject request = new SoapObject(NAMESPACE, nombreMetodoWS);
// PARAMETROS
//FORMA (1) DE ENVIAR PARAMETROS
//ENVIAR CARNET
PropertyInfo piCarnet = new PropertyInfo();
piCarnet.setName("carnet");
piCarnet.setValue(carnet);
piCarnet.setType(Integer.class);
request.addProperty(piCarnet); //SE AGREGA PARAMETRO A LA SOLICITUD
// request.addProperty("carnet",carnet);
//ENVIAR CARNET
PropertyInfo piNombre = new PropertyInfo();
piNombre.setName("nombre");
piNombre.setValue(nombre);
piNombre.setType(String.class);
request.addProperty(piNombre); //SE AGREGA PARAMETRO A LA SOLICITUD
// request.addProperty("nombre",nombre);
//ENVIAR CARNET
PropertyInfo piApellido = new PropertyInfo();
piApellido.setName("apellido");
piApellido.setValue(apellido);
piApellido.setType(String.class);
request.addProperty(piApellido); //SE AGREGA PARAMETRO A LA SOLICITUD
// request.addProperty("apellido",apellido);
//ENVIAR CARNET
PropertyInfo piMonto = new PropertyInfo();
piMonto.setName("montoinicial");
piMonto.setValue(monto);
piMonto.setType(Double.class);
request.addProperty(piMonto); //SE AGREGA PARAMETRO A LA SOLICITUD
// request.addProperty("montoinicial",monto);
// SE CREA EL ENVELOPE, POR MEDIO DE ESTE OBJETO
//SE ENVIA LA SOLICITUD (request) CON TODOS LOS PARAMETROS
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
//PARA DOT NET
// envelope.dotNet = true;
envelope.setOutputSoapObject(request);
//CUANDO TENEMOS UN VALOR DE TIPO DOUBLE SE UTILIZA ESTE OBJETO
//Y SE AÑADE AL OBJETO A ENVELOPE.
MarshalDouble md = new MarshalDouble();
md.register(envelope);
// CREAR una llamada HTTP a su Web Service.
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
// Se invoca el servicio.
androidHttpTransport.call("\"" + SOAP_ACTION + nombreMetodoWS + "\"", envelope);
// SE OBTIENE EL RESULTADO. SI SON VALORES PRIMITIVOS (String, int, float)
// SE USA SOAP PRIMITIVE, SI NO, SE USA SOAPOBJECT.
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
// SE ENVIA EL VALOR DE LA RESPUESTA
resTxt = response.toString();
} catch (Exception e) {
e.printStackTrace();
resTxt = "Error occured: " + e.getMessage();
}
return resTxt;
}
//METODO PARA LLAMAR EL ESTADO DE CUENTA (LISTA DE OBJETOS)
public static ArrayList<EstadoDeCuenta> ObtenerEstadoCuenta(Integer cuenta) {
ArrayList<EstadoDeCuenta> resEstadoCuenta = new ArrayList<EstadoDeCuenta>();
EstadoDeCuenta edcuenta;
String webMethName = "todoEstadoDeCuenta";
// SE CREA UNA SOLICITUD, A LA CUAL SE LE ASIGNARÁ LOS PARAMETROS.
// SE ENVIA EL METODO.
SoapObject request = new SoapObject(NAMESPACE, webMethName);
// PARAMETROS
//FORMA (2) DE ENVIAR PARAMETROS. MAS SENCILLO.
request.addProperty("cuenta", cuenta);
// SE CREA EL ENVELOPE, POR MEDIO DE ESTE OBJETO
//SE ENVIA LA SOLICITUD (request) CON TODOS LOS PARAMETROS
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
//PARA DOT NET
//envelope.dotNet = true;
// SE ALMACENA LA SOLICITUD EN UN ENVELOPE.
envelope.setOutputSoapObject(request);
// CREAR una llamada HTTP a su Web Service.
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
// SE INVOCA EL SERVICIO
envelope.addMapping(NAMESPACE, "EstadoDeCuenta", EstadoDeCuenta.class);
androidHttpTransport.call(SOAP_ACTION, envelope);
//SE DEFINE UN OBJETO TIPO VECTOR DE SOAPOBJECT
//UN SOAPOBJECT RECONOCE CUALQUIER OBJETO QUE SE RECIBA.
Vector<SoapObject> result = (Vector<SoapObject>) envelope.getResponse();
//LAS PROPIEDADES DEL OBJETO QUE NECESITAMOS TRAER
int cuentaD;
int cuentaO;
float hmonto;
int notrans;
String tipo;
//ALMACENAR LOS OBJETOS EN UN ARRAY
for (int i = 0; i < result.size(); i++) {
SoapObject so = result.get(i);
//el getProperty, el nombre del valor tiene que ser EXACTAMENTE igual que lo que retorna
//el servicio.
cuentaD = Integer.parseInt(so.getProperty("hcuentaD").toString());
cuentaO = Integer.parseInt(so.getProperty("hcuentaO").toString());
hmonto = Float.parseFloat(so.getProperty("hmonto").toString());
notrans = Integer.parseInt(so.getProperty("noTransferencia").toString());
tipo = so.getProperty("tipo").toString();
edcuenta = new EstadoDeCuenta(cuentaD, cuentaO, hmonto, notrans, tipo);
resEstadoCuenta.add(edcuenta);
//---------------------------------------------------------------------
}
} catch (Exception e) {
e.printStackTrace();
}
return resEstadoCuenta;
}
}<file_sep>package ipc2.gt.usac.org.appejemplo.ws.utils;
/**
* Created by r_blu on 29/12/2016.
*/
public class EstadoDeCuenta {
//ESTA CLASE SI ES NECESARIA CREARLA NOSOTROS MISMOS CON SUS SETTERS Y GETTERS
private float Hmonto;
private int noTransferencia;
private int HcuentaD;
private int HcuentaO;
private int carnet;
private String tipo;
public EstadoDeCuenta(int cuentaD,int cuentaO,float hmonto, int notrans, String t){
HcuentaD = cuentaD;
HcuentaO = cuentaO;
Hmonto = hmonto;
noTransferencia = notrans;
tipo = t;
}
public float getHmonto() {
return Hmonto;
}
public void setHmonto(float hmonto) {
Hmonto = hmonto;
}
public int getNoTransferencia() {
return noTransferencia;
}
public void setNoTransferencia(int noTransferencia) {
this.noTransferencia = noTransferencia;
}
public int getHcuentaD() {
return HcuentaD;
}
public void setHcuentaD(int hcuentaD) {
HcuentaD = hcuentaD;
}
public int getHcuentaO() {
return HcuentaO;
}
public void setHcuentaO(int hcuentaO) {
HcuentaO = hcuentaO;
}
public int getCarnet() {
return carnet;
}
public void setCarnet(int carnet) {
this.carnet = carnet;
}
public String getTipo() {
return tipo;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
}
<file_sep>package ipc2.gt.usac.org.appejemplo;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import ipc2.gt.usac.org.appejemplo.ws.WebServiceClient;
public class principal extends AppCompatActivity {
Button btn;
Button btnEstadoCta;
EditText editCarnet;
EditText editNombre;
EditText editApellido;
EditText editMonto;
TextView txtResult;
//--
Integer ca;
String no, ap;
Double mo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_principal);
//Se manda a llamar la instancia despues de creado.
btn = (Button) findViewById(R.id.button);
btnEstadoCta = (Button) findViewById(R.id.btnEstadoCta);
editCarnet = (EditText) findViewById(R.id.editCarnet);
editNombre = (EditText) findViewById(R.id.editNombre);
editApellido = (EditText) findViewById(R.id.editApellido);
editMonto = (EditText) findViewById(R.id.editMonto);
txtResult = (TextView) findViewById(R.id.lblResultado);
//LISTENER DEL BOTON.
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//---
//--- Obtener los valors de los campos.
ca = Integer.parseInt(editCarnet.getText().toString());
no = editNombre.getText().toString();
ap = editApellido.getText().toString();
mo = Double.parseDouble(editMonto.getText().toString());
/*Se crea una tarea asíncrona, para evitar tener errores con la aplicación android
* al momento de mandar a llamar el web service y no se quede esperando una respuesta,
* y se trabe.
* */
/* AsyncTask<PARAMETROS, Void, RESPUESTA>*/
new AsyncTask<String, Void, Object>() {
/*Esto se ejecuta DESPUES de realizar la tarea asincrona.
*
* ----*/
protected void onPostExecute(Object result) {
super.onPostExecute(result);
if(result=="true") {
txtResult.setText("Cuenta creada exitosamente");
}else{
txtResult.setText("Ocurrió un error");
}
}
/*Tareas que se harán de fondo.
* */
@Override
protected Object doInBackground(String... params) {
String res;
res = WebServiceClient.AbrirCuentaMonetaria(ca, no, ap, mo);
return res;
}
}.execute();
}
});
//LISTENER PARA CAMBIAR DE PANTALLA.
btnEstadoCta.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//ENVIO DE PARAMETROS ENTRE PANTALLAS
Intent i = new Intent(getApplicationContext(), EstadoCuenta.class);
i.putExtra("parametro", "PRUEBA");
i.putExtra("abc", 12345);
startActivity(i); //SE LLAMA A LA OTRA PANTALLA.
}
});
}
}
| 89f1587af1f7f90c085d01f228ff4da1e9bd8db4 | [
"Java"
] | 5 | Java | reimerghost/EjemplosIPC2 | 06f9918d0b12202e30f3cba86fb1cae4f6cd19f5 | bc78f8fc351e8b4b5bd030161a868c02720cb171 |
refs/heads/master | <file_sep>using COMMON.Entidades;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace COMMON.Interfaces
{
public interface IUsuariosManager : IGenericManager<Usuario>
{
Usuario Login(string usuario, string pass);
Usuario CrearCuenta(string usuario, string pass);
}
}
<file_sep>using COMMON.Interfaces;
using COMMON.Entidades;
using DAL;
using BIZ;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AppMiescuela.Vistas
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ViewCompaniero : ContentPage
{
ICompanieroManager manager;
public ViewCompaniero (Companiero companiero, bool nuevo)
{
InitializeComponent ();
manager = new CompanieroManager(new GenericRepository<Companiero>());
Contenedor.BindingContext = companiero;
btnGuardar.Clicked += (sender, e) => {
Companiero resultado;
if (nuevo)
{
resultado = manager.Agregar(Contenedor.BindingContext as Companiero);
}
else
{
resultado = manager.Modificar(Contenedor.BindingContext as Companiero);
}
if (resultado != null)
{
DisplayAlert("Mi Escuela", "Compañero Guardado", "Ok");
Navigation.PopAsync();
}
else
{
DisplayAlert("Mi Escuela", "Error al guardar :'( ...", "Ok");
}
};
btnEliminar.Clicked += (sender, e) =>
{
if (manager.Eliminar(companiero.Id))
{
DisplayAlert("Mi Escuela", "Compañero eliminado", "Ok");
Navigation.PopAsync();
}
else
{
DisplayAlert("Mi Escuela", "Error al eliminar", "ok");
}
};
}
}
}<file_sep>using COMMON.Entidades;
using COMMON.Interfaces;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BIZ
{
public class UsuarioManager : IUsuariosManager
{
IRepository<Usuario> repository;
public UsuarioManager(IRepository<Usuario> repo)
{
repository = repo;
}
public List<Usuario> ListarElementos { get => repository.Read; set { } }
public Usuario Agregar(Usuario entidad)
{
return repository.Create(entidad);
}
public Usuario CrearCuenta(string usuario, string pass)
{
//lambda
if (repository.Read.Count(e => e.Nombre == usuario) == 0)
{
return repository.Create(new Usuario()
{
Nombre = usuario,
Password = <PASSWORD>
});
}
else
{
return null;
}
}
public bool Eliminar(ObjectId id)
{
return repository.Delete(id);
}
public Usuario Login(string usuario, string pass)
{
return repository.Read.Where(e => e.Nombre == usuario && e.Password == <PASSWORD>).SingleOrDefault();
}
public Usuario Modificar(Usuario entidad)
{
return repository.Update(entidad);
}
public Usuario ObtenerElementoPorId(ObjectId id)
{
return repository.SearchById(id);
}
}
}
<file_sep>using COMMON.Entidades;
using COMMON.Interfaces;
using BIZ;
using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AppMiescuela.Vistas
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ViewTarea : ContentPage
{
private bool nuevo;
Tarea tarea;
ITareaManager tareaManager;
public ViewTarea(Tarea tarea, bool nuevo)
{
this.nuevo = nuevo;
this.tarea = tarea;
InitializeComponent ();
tareaManager = new TareaManager(new GenericRepository<Tarea>());
contenedor.BindingContext = tarea;
btnGuardar.Clicked += (sender, e) =>
{
Tarea resultado;
if (nuevo)
{
resultado = tareaManager.Agregar(contenedor.BindingContext as Tarea);
}
else
{
resultado = tareaManager.Modificar(contenedor.BindingContext as Tarea);
}
if (resultado != null)
{
DisplayAlert("Mi Escuela", "Tarea Guardado", "Ok");
Navigation.PopAsync();
}
else
{
DisplayAlert("Mi Escuela", "Error al guardar :'( ...", "Ok");
}
};
btnEliminar.Clicked += (sender, e) =>
{
if (!nuevo)
{
if (tareaManager.Eliminar(tarea.Id))
{
DisplayAlert("Mi Escuela", "Tarea Eliminada Correctamente", "OK");
Navigation.PopAsync();
}
else
{
DisplayAlert("Mi Escuela", "No se pudo eliminar la Tarea", "OK");
}
}
};
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace COMMON.Entidades
{
public class Usuario:BaseDTO
{
public string Nombre { get; set; }
public string Password { get; set; }
}
}
<file_sep>using COMMON.Entidades;
using COMMON.Interfaces;
using DAL;
using BIZ;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AppMiescuela.Vistas
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ViewEscuela : ContentPage
{
Usuario usuario;
public ViewEscuela (Usuario usuario)
{
InitializeComponent ();
this.usuario = usuario;
btnAgregarMateria.Clicked += BtnAgregarMateria_Clicked;
btnAgregarCompaniero.Clicked += (sender, e) =>
{
Navigation.PushAsync(new ViewCompaniero(new Companiero()
{
IdUsuario = usuario.Id
}, true));
};
lstCompanieros.ItemTapped += (sender, e) =>
{
if (lstCompanieros.SelectedItem != null)
{
Navigation.PushAsync(new ViewCompaniero(lstCompanieros.SelectedItem as Companiero, false));
}
};
lstMaterias.ItemTapped += (sender, e) =>
{
if (lstMaterias.SelectedItem != null)
{
Navigation.PushAsync(new ViewMateria(lstMaterias.SelectedItem as Materia, false));
}
};
}
protected override void OnAppearing()
{
base.OnAppearing();
ICompanieroManager manager = new CompanieroManager(new GenericRepository<Companiero>());
lstCompanieros.ItemsSource = manager.CompanierosDeUsuario(usuario.Id);
IMateriaManager materiaManager = new MateriasManager(new GenericRepository<Materia>());
lstMaterias.ItemsSource = materiaManager.BuscarMateriasDeUsuario(usuario.Id);
}
private void BtnAgregarMateria_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new ViewMateria(new Materia()
{
IdUsuario = usuario.Id
}, true));
}
}
}<file_sep>using COMMON.Entidades;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace COMMON.Interfaces
{
public interface IRepository<T> where T : BaseDTO
{
T Create(T entidad);
List<T> Read { get; }
T Update(T entidad);
bool Delete(ObjectId id);
T SearchById(ObjectId id);
}
}
<file_sep>using COMMON.Entidades;
using COMMON.Interfaces;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BIZ
{
public class MateriasManager : IMateriaManager
{
IRepository<Materia> repository;
public MateriasManager(IRepository<Materia> repo)
{
repository = repo;
}
public List<Materia> ListarElementos { get => repository.Read; set { } }
public Materia Agregar(Materia entidad)
{
return repository.Create(entidad);
}
public List<Materia> BuscarMateriasDeUsuario(ObjectId idUsuario)
{
return repository.Read.Where(e => e.IdUsuario == idUsuario).ToList();
}
public bool Eliminar(ObjectId id)
{
return repository.Delete(id);
}
public Materia Modificar(Materia entidad)
{
return repository.Update(entidad);
}
public Materia ObtenerElementoPorId(ObjectId id)
{
return repository.SearchById(id);
}
}
}
<file_sep>using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace COMMON.Entidades
{
public abstract class BaseDTO
{
public ObjectId Id { get; set; }
public DateTime FechaHora { get; set; }
}
}
<file_sep>using COMMON.Entidades;
using COMMON.Interfaces;
using BIZ;
using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AppMiescuela.Vistas
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ViewMateria : ContentPage
{
private bool nuevo;
Materia materia;
IMateriaManager materiaManager;
ITareaManager tareaManager;
public ViewMateria (Materia materia, bool nuevo)
{
InitializeComponent ();
this.nuevo = nuevo;
this.materia = materia;
materiaManager = new MateriasManager(new GenericRepository<Materia>());
tareaManager = new TareaManager(new GenericRepository<Tarea>());
contenedor.BindingContext = materia;
this.Appearing += ViewMateria_Appearing;
btnGuardar.Clicked += (sender, e) =>
{
Materia resultado;
if (nuevo)
{
resultado = materiaManager.Agregar(contenedor.BindingContext as Materia);
}
else
{
resultado = materiaManager.Modificar(contenedor.BindingContext as Materia);
}
if (resultado != null)
{
DisplayAlert("Mi Escuela", "Materia Guardado", "Ok");
Navigation.PopAsync();
}
else
{
DisplayAlert("Mi Escuela", "Error al guardar :'( ...", "Ok");
}
};
btnEliminar.Clicked += (sender, e) =>
{
if (!nuevo)
{
if (materiaManager.Eliminar(materia.Id))
{
DisplayAlert("Mi Escuela", "Materia Eliminada Correctamente", "OK");
Navigation.PopAsync();
}
else
{
DisplayAlert("Mi Escuela", "No se pudo eliminar la materia", "OK");
}
}
};
btnAgregarTarea.Clicked += (sender, e) =>
{
Navigation.PushAsync(new ViewTarea(new Tarea()
{
IdMateria = materia.Id
}, true));
};
lstTareas.ItemTapped += (sender, e) =>
{
if (lstTareas.SelectedItem != null)
{
Navigation.PushAsync(new ViewTarea(lstTareas.SelectedItem as Tarea, false));
}
};
}
//protected override void OnAppearing()
//{
// base.OnAppearing();
// IMateriaManager materiaManager = new MateriasManager(new GenericRepository<Materia>());
// lstTareas.ItemsSource = materiaManager.BuscarMateriasDeUsuario(materia.Id);
//}
public void ViewMateria_Appearing(object sender, EventArgs e)
{
lstTareas.ItemsSource = null;
lstTareas.ItemsSource = tareaManager.BuscarTareasDeMateria(materia.Id);
}
}
}<file_sep>using COMMON.Entidades;
using COMMON.Interfaces;
using DAL;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BIZ
{
public class CompanieroManager : ICompanieroManager
{
private GenericRepository<Companiero> genericRepository;
public CompanieroManager(GenericRepository<Companiero> genericRepository)
{
this.genericRepository = genericRepository;
}
//--------------------------------------------------------------------------------------------------------
public List<Companiero> ListarElementos { get => genericRepository.Read; set { } }
public Companiero Agregar(Companiero entidad)
{
return genericRepository.Create(entidad);
}
public List<Companiero> CompanierosDeUsuario(ObjectId idUsuario)
{
return genericRepository.Read.Where(p => p.IdUsuario == idUsuario).ToList();
}
public bool Eliminar(ObjectId id)
{
return genericRepository.Delete(id);
}
public Companiero Modificar(Companiero entidad)
{
return genericRepository.Update(entidad);
}
public Companiero ObtenerElementoPorId(ObjectId id)
{
return genericRepository.SearchById(id);
}
}
}
<file_sep>using DAL;
using AppMiescuela.Vistas;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using COMMON.Interfaces;
using COMMON.Entidades;
using BIZ;
namespace AppMiescuela
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
IUsuariosManager manager = new UsuarioManager(new GenericRepository<Usuario>());
btnIniciarSesion.Clicked += (sender, e) =>
{
Usuario usuario = manager.Login(txbUsuario.Text, pswClave.Text);
if (usuario != null)
{
Navigation.PushAsync(new ViewEscuela(usuario));
}
else
{
DisplayAlert("Mi Escuela", "Usuario o contraseña incorrecta", "Ok");
}
};
btnCrearCuenta.Clicked += (sender, e) =>
{
Usuario usuario = manager.CrearCuenta(txbUsuario.Text, pswClave.Text);
if (usuario != null)
{
DisplayAlert("Mi Escuela", "Cuenta creada correctamente, ya puede iniciar sesión...", "Ok");
Navigation.PushAsync(new Vistas.ViewEscuela(usuario));
}
else
{
DisplayAlert("Mi Escuela", "Error al crear la cuenta, intente mas tarde", "Ok");
}
};
}
}
}
<file_sep>using COMMON.Entidades;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace COMMON.Interfaces
{
public interface ICompanieroManager : IGenericManager<Companiero>
{
List<Companiero> CompanierosDeUsuario(ObjectId idUsuario);
}
}
<file_sep>using COMMON.Entidades;
using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace COMMON.Interfaces
{
public interface ITareaManager : IGenericManager<Tarea>
{
List<Tarea> BuscarTareasDeMateria(ObjectId idMateria);
}
}
<file_sep>using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace COMMON.Entidades
{
public class Tarea : BaseDTO
{
//TODO: Cadena de conexión: mongodb://<dbuser>:<dbpassword>@ds<EMAIL>.mlab.com:61678/profecarlosmiescuela
public string Titulo { get; set; }
public DateTime FechaEntrega { get; set; }
public bool Entregada { get; set; }
public string Descripcion { get; set; }
public ObjectId IdMateria { get; set; }
public override string ToString()
{
return Titulo +", "+Descripcion+ ": " + FechaEntrega;
}
}
}
| b1a9db718ad2617b0c48b3172fff6783241af783 | [
"C#"
] | 15 | C# | gusLopezC/Xamarin_AppMiescuela | b9fe655010a484e395e89c7ab870ecbb3a4cf34c | 5c7fa13ec196c2ba3c7d9051158b13548a3ab067 |
refs/heads/master | <file_sep>tranID=tran_log_id
tranType=description
startDate=start_tran_date
startTime=start_tran_time
endDate=end_tran_date
endTime=end_tran_time
employee=employee_id
controlNum=control_number
lineNum=line_number
whID=wh_id
fromLoc=location_id
toLoc=location_id_2
palletID=hu_id
itemNo=regexp_extract(item_number,'(\\d+)',0)
lotNo=lot_number
qty=tran_qty
netWeight=cast(weight as float)
grossWeight=NULL
customer=strright(item_number,4)<file_sep>impala-shell -q "Insert into table transactionlog_impala_test2
select
tran_log_id as tranID,
description as tranType,
start_tran_date as startDate,
start_tran_time as startTime,
end_tran_date as endDate,
end_tran_time as endTime,
employee_id as employee,
control_number as controlNum,
line_number as lineNum,
wh_id as whID,
location_id as fromLoc,
location_id_2 as toLoc,
hu_id as palletID,
regexp_extract(item_number,'(\\d+)',0) as itemNo,
lot_number as lotNo,
tran_qty as qty,
cast(weight as float) as netWeight,
NULL as grossWeight,
strright(item_number,4) as customer from highjump_t_tran_log"
| f44536f6320be66e22a52c97278b651ccff55f57 | [
"Shell",
"INI"
] | 2 | INI | epermana/hj_tranlog | 64f46645fba9f5d4a9cc3f35c9b1d04d97345dff | 7ae9e8b8a19caabdb086a2bb2a0585768e3ad231 |
refs/heads/master | <file_sep>#coding=utf-8
# 本题为考试单行多行输入输出规范示例,无需提交,不计分。
import sys
for i in range(t):
fi<file_sep>a = 24
for ia in range(3, a + 1): # range包括前者不包括后者
for b in range(1, ia):
for c in range(b, ia):
for d in range(c, ia):
if ia * ia * ia == b * b * b + c * c * c + d * d * d:
print(ia, b, c, d) | 4aa64ab1fb77dec07f854660fed46febc573f9e3 | [
"Python"
] | 2 | Python | ZhuoGuihuang/Leetcode | b900cdde99ae7a61e75d865f63acb3576011c47f | 209bee1ba2aabe5e26a5fbf14b289aba0d5e53b2 |
refs/heads/master | <repo_name>Gafchik/MY_OLX<file_sep>/MY_OLX/Controllers/HomeController.cs
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using MY_OLX.Models;
using System.Web;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace MY_OLX.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IWebHostEnvironment _appEnvironment;
private IndexModel indexModel;
public HomeController(ILogger<HomeController> logger, IWebHostEnvironment appEnvironment)
{
indexModel = new IndexModel();
_logger = logger;
_appEnvironment = appEnvironment;
}
public IActionResult Index() => View(indexModel);
public IActionResult NewProduct() => View();
public IActionResult Del(int id)
{
//находим нашу картинку на сервере
string path = ProductRep.GetProducts().Find(i => i.id == id).img;
string fullPath = _appEnvironment.WebRootPath + path.Trim('~');
if (!System.IO.File.Exists(fullPath))
{
Debug.WriteLine("not fond");
return Redirect("/Home/Index");
}
// удаляем картинку
try { System.IO.File.Delete(fullPath); }
catch (Exception e)
{
Debug.WriteLine(e.Message);
return Redirect("/Home/Index");
}
// удаляем продукт
ProductRep.Delete(id);
//обновляем модель индекса с продуктами
indexModel.UpdateProducts();
// возвращаемся на главную
return Redirect("/Home/Index");
}
#region edit product
public IActionResult EditView(int id)=> View(indexModel.products.Find(i => i.id == id));
public IActionResult EditProduct(Product product)
{
//валидация измененного товара
if (CheckProduct(product))
ProductRep.UpdateProducts(product);// обновление товара
//обновляем модель индекса с продуктами
indexModel.UpdateProducts();
return Redirect("/Home/Index");
}
#endregion
#region add product
public async Task<IActionResult> Add(Product product, IFormFile uploadedFile)
{
if (uploadedFile == null)
return Redirect("/Home/NewProduct");
if( !IsImg(uploadedFile.FileName))
return Redirect("/Home/NewProduct");
if (!CheckProduct(product))
return Redirect("/Home/NewProduct");
#region file
// путь к папке Image
string path = "/Image/" + uploadedFile.FileName;
// сохраняем файл в папку Files в каталоге wwwroot
using (var fileStream = new FileStream(_appEnvironment.WebRootPath + path, FileMode.Create))
await uploadedFile.CopyToAsync(fileStream);
// ~ нам говорит о том что мы попадаем в папку wwwroot
product.img = "~" + path;
#endregion
// добавляем продукт
ProductRep.AddProducts(product);
//обновляем модель индекса с продуктами
indexModel.UpdateProducts();
// возвращаемся на главную
return Redirect("/Home/NewProduct");
}
private bool CheckProduct(Product product)
{
bool rez = false;
if (product.model != null && product.model != string.Empty)
if (product.product != null && product.product != string.Empty)
if (product.salesman != null && product.salesman != string.Empty)
if (product.category != null && product.category != string.Empty)
if (product.description != null && product.description != string.Empty)
if (product.price != null)
rez = true;
return rez;
}
private bool IsImg(string path)
{
bool rez;
if (path.EndsWith(".png") || path.EndsWith(".jpg") || path.EndsWith(".JPG") || path.EndsWith(".PNG"))
rez = true;
else
rez = false;
return rez;
}
#endregion
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
<file_sep>/MY_OLX/Models/IndexModel.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MY_OLX.Models
{
public class IndexModel
{
public List<Product> products;
public List<FileModel> files;
public IndexModel()
{
products = ProductRep.GetProducts();
files = new List<FileModel>();
}
public void UpdateProducts()=> products = ProductRep.GetProducts();
}
}
| 7d6c5652edc098256f60ec6a333b583853666c6c | [
"C#"
] | 2 | C# | Gafchik/MY_OLX | b2c03f4e7efcf43c4ff5508446477a22f9c046d1 | a7c5e313e433272d02d14c4e32888d7f2cecf682 |
refs/heads/master | <repo_name>tongjinle/MineBang<file_sep>/src/config.ts
class Config {
static size: number = 64;
static width: number = 10;
static height: number = 8;
static mapHeight:number = 512;
static ratio: number = .2;
static longTouchInterval = 600;
}<file_sep>/src/logic/boomBox.ts
/**
* BoomBox
*/
class BoomBox extends Box {
private _isBoom : boolean;
public get isBoom() : boolean {
return this._isBoom;
}
public set isBoom(v : boolean) {
this._isBoom = v;
if(this._isBoom){
Game.getIns().fire('boomBox.boom',this);
}
}
constructor(x:number,y:number) {
super(x,y,BoxType.boom);
}
}<file_sep>/src/logic/boxType.ts
enum BoxType{
num,
boom
}<file_sep>/src/logic/game.ts
/**
* Game
*/
class Game extends egret.EventDispatcher{
static _game:Game;
boxMap:BoxMap;
constructor() {
super();
}
static getIns(){
Game._game = Game._game || new Game();
return Game._game;
}
on(eventName:string,fn:Function,self:any){
this.addEventListener(eventName,fn,self);
}
off(eventName:string,fn:Function,self:any){
this.removeEventListener(eventName,fn,self);
}
fire(eventName:string,data:any){
this.dispatchEvent(new egret.Event(eventName, false, false, data));
}
//
startGame(){
this.boxMap = new BoxMap(Config.width,Config.height,Config.ratio);
this.boxMap.firstTip();
}
bind(){
Game.getIns().on('game.pass',()=>{
(RES.getRes('win_mp3') as egret.Sound).play(0,1);
Game.getIns().fire('game.over',null);
},this);
}
}<file_sep>/src/sprite/boxSp.ts
/**
* BoxSp
*/
class BoxSp extends egret.Sprite {
bitMap: egret.Bitmap;
constructor(public box: Box) {
super();
this.x = this.box.x * Config.size;
this.y = this.box.y * Config.size;
let bitMap: egret.Bitmap = this.bitMap = new egret.Bitmap(this.getTexture(this.box));
this.addChild(bitMap);
}
private getTexture(box: Box): egret.Texture {
let texture: egret.Texture;
let resName: string;
if (this.box.isWarn) {
resName = 'flag_png';
if (this.box.isWarnWrong) {
resName = 'fail_png';
}
} else if (this.box.type == BoxType.num) {
let numBox: NumBox = this.box as NumBox;
if (numBox.isClean) {
resName = numBox.num + '_png';
} else {
resName = 'none_png';
}
} else if (this.box.type == BoxType.boom) {
let boomBox: BoomBox = this.box as BoomBox;
if (boomBox.isBoom) {
resName = 'bomb_png';
} else {
resName = 'none_png';
}
}
return RES.getRes(resName);
}
refreshTexture(): void {
this.bitMap.texture = this.getTexture(this.box);
}
}<file_sep>/src/sprite/hubSp.ts
/**
* HubSp
*/
class HubSp extends egret.Sprite {
boxCountStr:egret.TextField;
statusStr:egret.TextField;
totalCount:number;
private _cleanCount : number;
public get cleanCount() : number {
return this._cleanCount;
}
public set cleanCount(v : number) {
this._cleanCount = v;
this.boxCountStr.text = `${this._cleanCount}-${this.totalCount}`;
}
private _status : string;
public get status() : string {
return this._status;
}
public set status(v : string) {
this._status = v;
this.statusStr.text = `${this._status}`;
this.statusStr.textColor = {
'playing':0x00ff00,
'fail':0x222222,
'win':0xff0000
}[this._status];
}
constructor() {
super();
this.boxCountStr = new egret.TextField();
this.statusStr = new egret.TextField();
this.boxCountStr.x = 50;
this.boxCountStr.y = 100;
this.addChild(this.boxCountStr);
this.statusStr.x = 640 - 150;
this.statusStr.y = 100;
this.status = 'playing';
this.addChild(this.statusStr);
this.bind()
}
bind(){
Game.getIns().on('boomBox.boom',()=>{
this.status = 'fail';
},this);
Game.getIns().on('game.pass',()=>{
this.status = 'win';
},this);
Game.getIns().on('render.numBox.refreshCleanCount',(e)=>{
this.cleanCount = e.data as number;
},this)
}
}<file_sep>/src/logic/box.ts
/**
* Box
*/
abstract class Box {
constructor(public x: number, public y: number, public type: BoxType, public isWarn = false, public isWarnWrong = false) {
this.touchDict = {};
this.touchDict[BoxType.num] = (box) => {
var numBox: NumBox = box as NumBox;
if (!numBox.isClean) {
numBox.isClean = true;
// 扩散
Game.getIns().fire('numBox.expand', numBox);
} else {
Game.getIns().fire('numBox.batch', numBox);
}
};
this.touchDict[BoxType.boom] = (box) => {
var boomBox: BoomBox = box as BoomBox;
if (!boomBox.isBoom) {
boomBox.isBoom = true;
Game.getIns().fire('boomBox.boom', boomBox);
}
};
}
private touchDict: { [boxType: number]: (box: Box) => void };
touch() {
this.touchDict[this.type](this);
Game.getIns().fire('box.touch', { box: this });
}
warn() {
this.isWarn = !this.isWarn;
Game.getIns().fire('box.warn', this);
}
}<file_sep>/src/logic/boxMap.ts
/**
* Map
*/
class BoxMap {
boxList: Box[][];
constructor(public width: number, public height: number, public ratio: number = .2) {
this.boxList = [];
this.seedBoom();
this.mark();
this.bind();
}
boomCount:number;
cleanCount:number = 0 ;
private seedBoom() {
var count = this.boomCount = Math.floor(this.width * this.height * this.ratio);
var dict = {};
while (count--) {
var flag = true;
while (flag) {
var x = Math.floor(Math.random() * this.width);
var y = Math.floor(Math.random() * this.height);
if (dict[`${x}-${y}`] === undefined) {
dict[`${x}-${y}`] = { x: x, y: y };
flag = false;
}
}
}
for (let i = 0; i < this.height; i++) {
let arr = [];
arr.length = this.width;
this.boxList.push(arr);
}
for (let i in dict) {
var posi = dict[i];
this.boxList[posi.y][posi.x] = new BoomBox(posi.x, posi.y);
}
}
private mark() {
var markOne = (boxList: Box[][], x, y) => {
if (this.boxList[y][x]) {
return;
}
var arr = [
{ x: x - 1, y: y - 1 },
{ x: x, y: y - 1 },
{ x: x + 1, y: y - 1 },
{ x: x - 1, y: y },
{ x: x, y: y },
{ x: x + 1, y: y },
{ x: x - 1, y: y + 1 },
{ x: x, y: y + 1 },
{ x: x + 1, y: y + 1 }
];
let count: number = 0;
for (let posi of arr) {
if (posi.x >= 0 && posi.x < this.width && posi.y >= 0 && posi.y < this.height) {
let box: Box = boxList[posi.y][posi.x];
if (box && box.type == BoxType.boom) {
count++;
}
}
}
let box = this.boxList[y][x] = new NumBox(x, y);
box.num = count;
};
for (let y = 0; y < this.height; y++) {
for (let x = 0; x < this.width; x++) {
markOne(this.boxList, x, y);
}
}
}
private _check;
private check() {
let _check = this._check = _.debounce(()=>{
for(let y=0;y<this.height;y++){
for(let x=0;x<this.width;x++){
let box = this.boxList[y][x];
if(box.type==BoxType.num && !(box as NumBox).isClean){
return;
}
}
}
Game.getIns().fire('game.pass',null);
},100);
_check();
}
firstTip() {
for (let y = 0; y < this.height; y++) {
for (let x = 0; x < this.width; x++) {
let box = this.boxList[y][x];
if (box.type == BoxType.num) {
let numBox = box as NumBox;
if (numBox.num == 0) {
numBox.touch();
return;
}
}
}
}
}
getNear(x:number,y:number,type:string):Box[]{
let boxList : Box[]=[];
let arr:{x:number,y:number}[];
if(type == 'circle'){
arr = [
{ x: x - 1, y: y - 1 },
{ x: x, y: y - 1 },
{ x: x + 1, y: y - 1 },
{ x: x - 1, y: y },
{ x: x, y: y },
{ x: x + 1, y: y },
{ x: x - 1, y: y + 1 },
{ x: x, y: y + 1 },
{ x: x + 1, y: y + 1 }
];
}else if(type == 'line'){
arr = [
{ x: x, y: y - 1 },
{ x: x, y: y + 1 },
{ x: x - 1, y: y },
{ x: x + 1, y: y }
];
}
arr.forEach(posi=>{
if (posi.x >= 0 && posi.x < this.width && posi.y >= 0 && posi.y < this.height) {
boxList.push(this.boxList[posi.y][posi.x]);
}
});
return boxList;
}
private onBoxTouch(e) {
var data = e.data;
console.log(data);
}
private onNumBoxClean(e) {
// var boxSp:BoxSp = this.box
console.log('numBox.clean');
let numBox: NumBox = e.data as NumBox;
Game.getIns().fire('render.numBox.clean', numBox);
this.cleanCount ++;
Game.getIns().fire('render.numBox.refreshCleanCount', this.cleanCount);
this.check();
}
private onNumBoxExpand(e) {
let numBox: NumBox = e.data as NumBox;
let near = this.getNear(numBox.x, numBox.y, 'line');
near.forEach((box) => {
if (box.type == BoxType.num) {
let nearBox: NumBox = box as NumBox;
if (!nearBox.isClean && (numBox.num == 0 || nearBox.num == 0)) {
box.touch();
}
}
});
}
private onNumBoxBatch(e) {
let numBox = e.data as NumBox;
let near = this.getNear(numBox.x,numBox.y,'circle');
let count: number = 0;
let rightCount:number = 0;
let wrongBoxList:Box[] = [];
let unWarnBoxList:Box[]=[];
near.forEach((box)=>{
if(box.isWarn){
count++;
if(box.type == BoxType.boom){
rightCount++;
}else{
wrongBoxList.push(box);
}
}else if(box.type == BoxType.boom){
unWarnBoxList.push(box);
}
});
if(numBox.num == count){
if(count == rightCount){
near.forEach((box)=>{
if(box && box.type == BoxType.num && !box.isWarn && !(box as NumBox).isClean){
box.touch();
}
});
}else{
wrongBoxList.forEach((box) => { box.isWarnWrong = true; });
Game.getIns().fire('render.box.warn.wrong',wrongBoxList);
Game.getIns().fire('boomBox.boom',unWarnBoxList[0]);
// Game.getIns().fire('game.over',null);
}
}
}
private onBoomBoxBoom(e){
let boomBox = e.data as BoomBox;
Game.getIns().fire('render.boomBox.boom',boomBox);
Game.getIns().fire('game.over',null);
}
private onBoxWarn(e){
let box = e.data as Box;
Game.getIns().fire('render.box.warn',box);
}
private bind() {
Game.getIns().on('box.touch', this.onBoxTouch, this);
Game.getIns().on('numBox.clean', this.onNumBoxClean, this);
Game.getIns().on('numBox.expand', this.onNumBoxExpand, this);
Game.getIns().on('numBox.batch', this.onNumBoxBatch, this);
Game.getIns().on('boomBox.boom',this.onBoomBoxBoom,this);
Game.getIns().on('box.warn',this.onBoxWarn,this);
}
private unbind() {
Game.getIns().off('box.touch', this.onBoxTouch, this);
}
}<file_sep>/src/logic/numBox.ts
/**
* NumBox
*/
class NumBox extends Box {
num:number = 0;
private _isClean : boolean;
public get isClean() : boolean {
return this._isClean;
}
public set isClean(v : boolean) {
this._isClean = v;
if(this._isClean){
Game.getIns().fire('numBox.clean',this);
}
}
constructor(x:number,y:number) {
super(x,y,BoxType.num);
}
}<file_sep>/src/sprite/boxMapSp.ts
/**
* MapSp ex
*/
class BoxMapSp extends egret.Sprite {
boxSpList: BoxSp[][];
constructor(public boxMap: BoxMap) {
super();
this.initBg();
let boxList = this.boxMap.boxList;
let boxSpList = this.boxSpList = [];
boxSpList.length = this.boxMap.height;
for (let y = 0; y < this.boxMap.height; y++) {
boxSpList[y] = [];
for (let x = 0; x < this.boxMap.width; x++) {
let box: Box = boxList[y][x];
let boxSp: BoxSp = new BoxSp(box);
boxSpList[y][x] = boxSp;
this.addChild(boxSp);
}
}
this.width = Config.width;
this.height = Config.mapHeight;
this.bind();
}
private touchBegin: { x: number, y: number, timeStamp: number };
private touchEnd: { x: number, y: number, timeStamp: number };
private longTouchInterval: number = Config.longTouchInterval;
private timeHandle;
private onTouch = (e: egret.TouchEvent) => {
console.log(e.type);
let x: number = Math.floor(e.stageX / Config.size);
let y: number = Math.floor(e.stageY / Config.size);
console.log(x, y);
let check = (begin: { x: number, y: number, timeStamp: number }, end: { x: number, y: number, timeStamp: number }): void => {
if (begin && end && begin.x == end.x && begin.y == end.y) {
let box: Box = this.boxMap.boxList[end.y][end.x];
if (end.timeStamp - begin.timeStamp < this.longTouchInterval) {
console.log('touch box');
box.touch();
} else {
console.log('warn box');
box.warn();
}
}
// 销毁
this.touchBegin = this.touchEnd = null;
};
if (x >= 0 && x < this.boxMap.width && y >= 0 && y < this.boxMap.height) {
if (e.type == egret.TouchEvent.TOUCH_BEGIN) {
this.touchBegin = { x, y, timeStamp: new Date().getTime() };
this.timeHandle = setTimeout(() => {
this.touchEnd = this.touchEnd || { x: this.touchBegin.x, y: this.touchBegin.y, timeStamp: Infinity };
check(this.touchBegin, this.touchEnd);
}, this.longTouchInterval);
} else if (e.type == egret.TouchEvent.TOUCH_END) {
this.touchEnd = { x, y, timeStamp: new Date().getTime() };
check(this.touchBegin, this.touchEnd);
clearTimeout(this.timeHandle);
} else if (e.type == egret.TouchEvent.TOUCH_MOVE) {
console.log('touch move');
this.touchEnd = { x, y, timeStamp: new Date().getTime() };
}
// this.boxMap.boxList[y][x].touch();
}
};
initBg() {
let bg: egret.Bitmap = new egret.Bitmap(RES.getRes('bg_jpg'));
// bg.width = Config.width;
// bg.height = Config.height;
this.addChild(bg);
}
private onNumBoxClean(e) {
console.log('render.numBox.clean');
let numBox: NumBox = e.data as NumBox;
this.boxSpList[numBox.y][numBox.x].refreshTexture();
}
private onBoomBoxBoom(e) {
console.log('render.boomBox.boom');
let boomBox: BoomBox = e.data as BoomBox;
this.boxSpList[boomBox.y][boomBox.x].refreshTexture();
(RES.getRes('crash2_mp3') as egret.Sound).play(0, 1);
}
private onBoxWarn(e) {
let box: Box = e.data as Box;
this.boxSpList[box.y][box.x].refreshTexture();
}
private onBoxWarnWrong(e){
let wrongBoxList = e.data as Box[];
wrongBoxList.forEach((box)=>{
this.boxSpList[box.y][box.x].refreshTexture();
});
}
bind() {
Game.getIns().on('render.numBox.clean', this.onNumBoxClean, this);
Game.getIns().on('render.boomBox.boom', this.onBoomBoxBoom, this);
Game.getIns().on('render.box.warn', this.onBoxWarn, this);
Game.getIns().on('render.box.warn.wrong',this.onBoxWarnWrong,this);
this.touchEnabled = true;
this.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
this.addEventListener(egret.TouchEvent.TOUCH_END, this.onTouch, this);
this.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.onTouch,this);
Game.getIns().on('game.over', () => {
this.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onTouch, this);
}, this);
}
unbind() {
}
} | 2ec6942305142b1cd6c97a0de618084986de3f2f | [
"TypeScript"
] | 10 | TypeScript | tongjinle/MineBang | f82bb4541c8a2360b4c711c23fc67d0aff84b9b8 | 508f1c4b7a0fa06474e02879f3fb103388551d94 |
refs/heads/master | <repo_name>opendashboard/opendashboard<file_sep>/src/index.js
import express from 'express';
import http from 'http';
import socketio from 'socket.io';
// Create an express instance
const app = express();
// Fire up the express server
const server = http.createServer(app).listen(3000, () => {
console.log('Server is listening on port %s', 3000);
});
// Initialize the socket.io
const socket = socketio.listen(server);
// @TODO: Load controllers..
app.get('/', (req, res) => {
res.end('testing');
});
| 29dedf627c739797a62a8c780f62863a468061ae | [
"JavaScript"
] | 1 | JavaScript | opendashboard/opendashboard | d4f50a92a375b7a1e8555e88d7e759da32816a38 | 4c3711c02d44550be9f62b65ce013f6214ad37b5 |
refs/heads/master | <repo_name>magdkudama/loqate-api<file_sep>/README.md
LOQATE PHP CLIENT
=================
Loqate PHP client. Simply using the API endpoint I need for now.
```php
<?php
use MagdKudama\Loqate\Client;
include_once __DIR__ . '/vendor/autoload.php';
$client = new Client('my-api-key');
$client->bankAccount()->validate('sort-code', 'account-number');
```
Enjoy!
<file_sep>/src/Client.php
<?php
namespace MagdKudama\Loqate;
use MagdKudama\Loqate\Api\BankAccountApi;
class Client
{
private $bankAccountApi;
public function __construct(string $apiKey)
{
$this->bankAccountApi = new BankAccountApi($apiKey);
}
public function bankAccount(): BankAccountApi
{
return $this->bankAccountApi;
}
}
<file_sep>/src/Api/BaseApiClient.php
<?php
namespace MagdKudama\Loqate\Api;
abstract class BaseApiClient
{
protected $apiKey;
public function __construct(string $apiKey)
{
$this->apiKey = $apiKey;
}
private function checkResponse($response, $handle)
{
if ($response === false || curl_errno($handle) !== 0) {
throw new ClientException('Invalid response from API');
}
$info = curl_getinfo($handle);
if ($info['http_code'] > 300) {
throw new ClientException('Invalid response. Code is: '.$info['http_code']);
}
}
/**
* @param string $uri
* @return array
* @throws ClientException
*/
protected function executeGet(string $uri)
{
$handle = curl_init();
curl_setopt($handle, CURLOPT_HTTPHEADER, ['Content-type: application/json']);
curl_setopt($handle, CURLOPT_URL, 'https://api.addressy.com/' . $uri);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$curlResponse = curl_exec($handle);
$this->checkResponse($curlResponse, $handle);
curl_close($handle);
$response = json_decode($curlResponse, true);
if (!is_array($response)){
throw new ClientException('Unable to decode value');
}
return $response;
}
}
<file_sep>/src/Api/ClientException.php
<?php
namespace MagdKudama\Loqate\Api;
use Exception;
class ClientException extends Exception
{
}
<file_sep>/src/Api/Model/BankAccountValidationResult.php
<?php
namespace MagdKudama\Loqate\Api\Model;
class BankAccountValidationResult
{
private $ok;
public function __construct(bool $ok)
{
$this->ok = $ok;
}
public function isOk(): bool
{
return $this->ok;
}
}
<file_sep>/src/Api/BankAccountApi.php
<?php
namespace MagdKudama\Loqate\Api;
use MagdKudama\Loqate\Api\Model\BankAccountValidationResult;
class BankAccountApi extends BaseApiClient
{
public function validate(string $sortCode, string $accountNumber): BankAccountValidationResult
{
$qs = [
'Key' => $this->apiKey,
'AccountNumber' => $accountNumber,
'SortCode' => $sortCode,
];
$response = $this->executeGet('BankAccountValidation/Interactive/Validate/v2/json3.ws?' . http_build_query($qs));
if (!isset($response['Items']) || !is_array($response['Items']) || count($response['Items']) !== 1) {
throw new ClientException('Invalid response from API');
}
$data = $response['Items'][0];
if (isset($data['Error'])) {
throw new ClientException('Response error: ' . $data['Cause']);
}
return new BankAccountValidationResult($data['IsCorrect']);
}
}
| f79f8e59f03a96f2c109b063e3f9893c5f8050f5 | [
"Markdown",
"PHP"
] | 6 | Markdown | magdkudama/loqate-api | 8832010694f4b0f341eb07556ca8605eb783dee8 | 78fc5139723d932b56a317a429ef785e1e80025e |
refs/heads/master | <file_sep>package com.luisgarcia.controllers;
import com.luisgarcia.models.Player;
public class PlayerController {
private Player player;
}
<file_sep>package com.luisgarcia;
import com.luisgarcia.models.Board;
import com.luisgarcia.models.Boat;
import com.luisgarcia.models.Player;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// Scanner scanner = new Scanner(System.in);
// int board_size = scanner.nextInt();
// Testing
Player playerOne = new Player("<NAME>", new Board(new Boat[10]));
Boat[] playerOneBoats = playerOne.getBoard().getBoats();
playerOneBoats[0] = new Boat(1, 3, 5, 3 );
System.out.println(playerOne.getBoard().checkPosition(new Boat(6, 3, 6, 3)));
playerOne.getBoard().checkAvailable(new Boat(6, 3, 6, 3));
}
}
<file_sep>package com.luisgarcia.enumerations;
public enum BoatType {
POINT,
VERTICAL,
HORIZONTAL
}
<file_sep>package com.luisgarcia.models;
import com.luisgarcia.enumerations.BoatType;
public class Boat {
private int startRow;
private int startColumn;
private int endRow;
private int endColumn;
public Boat(int startRow, int startColumn, int endRow, int endColumn) {
this.startRow = startRow;
this.startColumn = startColumn;
this.endRow = endRow;
this.endColumn = endColumn;
}
public int getStartRow() {
return startRow;
}
public void setStartRow(int startRow) {
this.startRow = startRow;
}
public int getStartColumn() {
return startColumn;
}
public void setStartColumn(int startColumn) {
this.startColumn = startColumn;
}
public int getEndRow() {
return endRow;
}
public void setEndRow(int endRow) {
this.endRow = endRow;
}
public int getEndColumn() {
return endColumn;
}
public void setEndColumn(int endColumn) {
this.endColumn = endColumn;
}
public int getBoatLength() {
BoatType boatType = this.getBoatType();
if (boatType == BoatType.POINT) {
return 1;
} else if (boatType == BoatType.HORIZONTAL) {
return (endColumn - startColumn) + 1;
} else {
return (endRow - startRow) + 1;
}
}
public BoatType getBoatType() {
if (startRow == endRow && startColumn == endColumn) {
return BoatType.POINT;
} else if (startColumn == endColumn) {
return BoatType.VERTICAL;
} else {
return BoatType.HORIZONTAL;
}
}
} | 44f4cde3e68bf665e9fe6242fec284eca9b6eadc | [
"Java"
] | 4 | Java | TheLemmon/Battleship | 9ecb342c5ea97a795129bbc3278a156854c62319 | 25e23b25174956c034cde0694d783ccaa56e9110 |
refs/heads/master | <repo_name>GiovanaMayer/project<file_sep>/project-master/rest_blog/api/post/read.php
<?php
// if(!isset($_SERVER['PHP_AUTH_USER'])){
// header('WWW-Authenitcate: Basic realm="Página Restrita"');
// header('HTTP/1.0 401 Unauthorized');
// echo json_encode(["mensagem" => "Autenticação necessária"
// ]);
// exit;
// }elseif (!($_SERVER['PHP_AUTH_USER'] == 'admin'
// && $_SERVER['PHP_AUTH_PW'] == 'admin')){
// header('HTTP/1.0 401 Unauthorized');
// echo json_encode(["mensagem" => "Usuário Inválido"]);
// }else{
header('Acess-Control-Allow-Origin: *');
header('Content-Type: application/json');
require_once '../../config/Conexao.php';
require_once '../../models/Post.php';
$db = new Conexao();
$con = $db->getConexao();
$post = new Post($con);
//1 - nao foi enviado um id, mostra todos os posts - read()
//2 - foi enviado um id de post, mostra os dados daquele post - read(id)
//3 - foi enviado um id de categoria, mostra os posts da categoria - readByCat(idcat)
$resultado = $post->read();
$qtde_posts = sizeof($resultado);
if($qtde_posts>0){
// $arr_posts = array();
// $arr_posts['data'] = array();
echo json_encode($resultado);
}else{
echo json_encode(array('mensagem' => 'nenhum post encontrado'));
}
// }<file_sep>/project-master/rest_blog/api/categoria/read.php
<?php
// if(!isset($_SERVER['PHP_AUTH_USER'])){
// header('WWW-Authenitcate: Basic realm="Página Restrita"');
// header('HTTP/1.0 401 Unauthorized');
// echo json_encode(["mensagem" => "Autenticação necessária"
// ]);
// exit;
// }elseif (!($_SERVER['PHP_AUTH_USER'] == 'admin'
// && $_SERVER['PHP_AUTH_PW'] == 'admin')){
// header('HTTP/1.0 401 Unauthorized');
// echo json_encode(["mensagem" => "Usuário Inválido"]);
// }else{
header('Acess-Control-Allow-Origin: *');
header('Content-Type: application/json');
require_once '../../config/Conexao.php';
require_once '../../models/Categoria.php';
$db = new Conexao();
$con = $db->getConexao();
$categoria = new Categoria($con);
//VERIFICAR SE FOI ENVIADO UM id VIA GET
//SE NAO TEM ID, CHAMA read()
if(isset($_GET['id'])){
$resultado = $categoria->read($_GET['id']);
}else{
$resultado = $categoria->read();
}
//SE TEM ID, CHAMA read(id)
$qtde_cats = sizeof($resultado);
if($qtde_cats>0){
// $arr_categorias = array();
// $arr_categorias['data'] = array();
echo json_encode($resultado);
}else{
echo json_encode(array('mensagem' => 'nenhuma categoria encontrada'));
}
// }
<file_sep>/rest_blog/bd/scriptBD.sql
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 15-Ago-2018 às 04:52
-- Versão do servidor: 10.1.34-MariaDB
-- PHP Version: 7.2.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `meu_blog`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `categoria`
--
CREATE TABLE `categoria` (
`id` int(11) NOT NULL,
`nome` varchar(50) NOT NULL,
`descricao` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estrutura da tabela `post`
--
CREATE TABLE `post` (
`id` int(11) NOT NULL,
`titulo` varchar(200) NOT NULL,
`texto` varchar(30) NOT NULL,
`id_categoria` int(11) NOT NULL,
`autor` varchar(30) NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categoria`
--
ALTER TABLE `categoria`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `post`
--
ALTER TABLE `post`
ADD PRIMARY KEY (`id`),
ADD KEY `ind_categoria` (`id_categoria`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categoria`
--
ALTER TABLE `categoria`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `post`
--
ALTER TABLE `post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `post`
--
ALTER TABLE `post`
ADD CONSTRAINT `fk_categoria` FOREIGN KEY (`id_categoria`) REFERENCES `categoria` (`id`);
COMMIT;
INSERT INTO categoria (nome,descricao) VALUES
('Games','Noticias'),
('Esportes','Tudo sobre futebol e outros esportes'),
('Entretenimento','Noticias sobre o mundo do cinema'),
('Drogas','Bora f1');
INSERT INTO post (titulo,texto,id_categoria,autor) VALUES
('Post1','Vamo jogar um lolzin',1,'Jorge'),
('Post2','Futebol e top',2,'Eu'),
('Post3','Esquadrao suicida e ruim',3,'Eu 2018'),
('Post4','KJKJKJKJ GRAZADO',4,'Didi');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | acb371442d0c399ba122a5558f36f5bfb82145f6 | [
"SQL",
"PHP"
] | 3 | PHP | GiovanaMayer/project | fee29311870b667a3d58692cbfc4b230758cb1a6 | 36b63d455dd3b23955eba525c406dab5b12c192e |
refs/heads/master | <repo_name>atuljain1383/HOSTAPI<file_sep>/models/student.js
import mongoose from 'mongoose';
import Program from '../models/program.js';
import AbacusSheet from '../models/AbacusSheet.js';
const studentSchema = new mongoose.Schema({
Name: {
type:String,
required:true,
minlength:1,
maxlength:50
},
Age: {
type:Number
},
Address: {
type:String,
maxlength:500
},
Phone: {
type:Number,
minlength:10,
maxlength:12
},
CreatedOn: {
type:Date,
required:true,
default:Date.now
},
UpdatedOn: {
type:Date,
required:true,
default:Date.now
},
ProgramsRegisterd:{type:[mongoose.model("Program").schema]},
Sheets:[
{
type: mongoose.Schema.Types.ObjectId,
ref: 'AbacusSheet'
}
]
})
const Student = new mongoose.model("Student", studentSchema, "Student");
export default Student;
<file_sep>/routes/login.js
import express from 'express';
import jwt from "jsonwebtoken";
import cookieParser from "cookie-parser";
import dotnev from "dotenv";
import Student from '../models/student.js';
import dbcon from "../db/conn.js";
const router = express.Router();
dotnev.config();
router.post("/", async(req, res)=> {
try {
const {loginid, password } = req.body;
if (!loginid || !password){
res.status(400).json({error:"Blank Credentials passed"});
}
const student = await Student.findOne({'Name': loginid}).populate("Sheets");
if (student)
{
const token = await jwt.sign({'_id': student._id},process.env.SECRET_KEY);
res.cookie("jwthostapitoken",token);
res.status(200).send(`Valid Login${req.cookies.jwthostapitoken}`);
}
else{
res.status(400).json({error:"Invalid Credentials"});
}
} catch (error) {
console.log(error);
res.status(400).send("jwt must be provided....");
}
});
export default router;<file_sep>/routes/program.js
import express from 'express';
import Program from '../models/program.js';
import dbcon from "../db/conn.js";
const router = express.Router();
router.get("/", async(req, res)=> {
try{
const programs = await Program.find();
res.send(programs);
}
catch{e}{
res.send(e);
}
});
router.get("/:name", async(req, res)=> {
try{
const name = req.params.name.toLowerCase();
const query = { 'Name': new RegExp(`^${name}$`, 'i') };
const programs = await Program.findOne(query);
res.send(programs);
}
catch{e}{
res.send(e);
}
});
router.post("/", (req, res)=> {
const program = new Program(req.body);
});
export default router;<file_sep>/Dockerfile
FROM node:latest
WORKDIR /usr/src/app
COPY package.json ./
RUN npm install
COPY . .
EXPOSE 9000
CMD ["npm", "start"]
<file_sep>/Middleware/Auth.js
import jwt from "jsonwebtoken";
import Student from "../models/student.js";
import cookieParser from "cookie-parser";
import dotnev from "dotenv";
const auth = async (req, res, next)=>{
const token = req.cookies.jwthostapitoken;
try {
const verifyUser = await jwt.verify(token, process.env.SECRET_KEY);
const studentsDatavalid = await Student.findOne({_id:verifyUser._id});
if (studentsDatavalid)
{
res.status(200).send('Valid User');
}
else{
res.status(400).send('InValid User');
}
next();
} catch (error) {
res.status(400).send(`Token invalid${token}`);
}
}
export default auth; | 4a4e65cece4ccf30599cc72e46bd476d323a29ec | [
"JavaScript",
"Dockerfile"
] | 5 | JavaScript | atuljain1383/HOSTAPI | 5e36aace95f244eb75e13cb47a6cdd57c6465f50 | 53523e97b36d9616eca05018a10ae1d95bc1f462 |
refs/heads/master | <repo_name>chintan94/dl-hw<file_sep>/hw1/assignment1/ecbm4040/features/pca.py
import time
import numpy as np
def pca_naive(X, K):
"""
PCA -- naive version
Inputs:
- X: (float) A numpy array of shape (N, D) where N is the number of samples,
D is the number of features
- K: (int) indicates the number of features you are going to keep after
dimensionality reduction
Returns a tuple of:
- P: (float) A numpy array of shape (K, D), representing the top K
principal components
- T: (float) A numpy vector of length K, showing the score of each
component vector
"""
X = (X - X.mean()) / X.std()
X = np.matrix(X)
cov = (X.T * X) / X.shape[0]
U, S, V = np.linalg.svd(cov)
U_reduced = U[:,:K]
T=S/S.sum()
P=U_reduced.T
return (P, T)
<file_sep>/hw0/assignment0/README.md
# This is for starters
After you open the .zip file, you should be able to see Assignment0.ipynb and /pics folder, these are two we will be using for Assignment 0.
1. To open .ipynb files locally, you have to open jupyter notebook in your virtual environment:
~~~python
source activate dlenv # for mac/linux users
activate dlenv # for windows users
jupyter notebook
~~~
You can check Step 5 in Local Setup on E4040 website, too.
2. To open .ipynb files on GCP, you have to first upload the file to your instance:
~~~
gcloud compute scp [LOCAL_FILE_PATH] ecbm4040@yourinstance-name:~/
~~~
Unzip the file, you may need to install packages first:
~~~python
sudo apt-get install zip
unzip [YOUR_FILE_NAME]
~~~
Then the following is just like what you do locally.<file_sep>/hw1/assignment1/ecbm4040/classifiers/softmax.py
import numpy as np
from random import shuffle
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: a numpy array of shape (D, C) containing weights.
- X: a numpy array of shape (N, D) containing a minibatch of data.
- y: a numpy array of shape (N,) containing training labels; y[i] = c means
that X[i] has label c, where 0 <= c < C.
- reg: (float) regularization strength
Returns a tuple of:
- loss: (float) the mean value of loss functions over N examples in minibatch.
- gradient: gradient wst W, an array of same shape as W
"""
# Initialize the loss and gradient to zero.
loss = 0.0
dW = np.zeros_like(W)
num_dims = W.shape[0]
num_classes = W.shape[1]
num_train = X.shape[0]
loss = 0.0
for i in range(num_train):
scores = X[i].dot(W)
scores_exp = np.exp(scores)
scores = scores_exp/np.sum(scores_exp)
correct_class_score = scores[y[i]]
for d in range(num_dims):
for k in range(num_classes):
if k == y[i]:
dW[d, k] += X.T[d, i] * (scores[k] - 1)
else:
dW[d, k] += X.T[d, i] * scores[k]
loss += -np.log(correct_class_score)
loss /= num_train
loss += 0.5 * reg * np.sum(W ** 2)
dW /= num_train
dW += reg * W
return loss, dW
def softmax_loss_vectorized(W, X, y, reg):
"""
Softmax loss function, vectorized version.
Inputs and outputs are the same as softmax_loss_naive.
"""
# Initialize the loss and gradient to zero.
loss = 0.0
dW = np.zeros_like(W)
num_dims = W.shape[0]
num_classes = W.shape[1]
num_train = X.shape[0]
scores = np.dot(X,W)
scores_exp = np.exp(scores)
score_sum = np.sum(scores_exp,axis=1)
score_sum = (np.ones(scores.shape).T*score_sum).T
scores = scores_exp/score_sum
correct_score = scores[range(num_train),y]
correct_score = np.log(correct_score)
loss = np.sum(-correct_score)
loss /= num_train
loss += 0.5 * reg * np.sum(W**2)
dscores = scores
dscores[range(num_train), y] -= 1
dW = np.dot(X.T, dscores)
dW /= num_train
dW += reg * W
#############################################################################
# END OF YOUR CODE #
#############################################################################
return loss, dW
<file_sep>/hw3/assignment3/ecbm4040/xor/rnn.py
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import variable_scope as vs
from tensorflow.python.util import nest
from tensorflow.contrib.rnn import RNNCell
_BIAS_VARIABLE_NAME = "bias"
_WEIGHTS_VARIABLE_NAME = "kernel"
class MyGRUCell(RNNCell):
"""
Your own basic GRUCell implementation that is compatible with TensorFlow. To solve the compatibility issue, this
class inherits TensorFlow RNNCell class.
For reference, you can look at the TensorFlow GRUCell source code. If you're using Anaconda, it's located at
anaconda_install_path/envs/your_virtual_environment_name/site-packages/tensorflow/python/ops/rnn_cell_impl.py
So this is basically rewriting the TensorFlow GRUCell, but with your own language.
"""
def __init__(self, num_units, activation=None):
"""
Initialize a class instance.
In this function, you need to do the following:
1. Store the input parameters and calculate other ones that you think necessary.
2. Initialize some trainable variables which will be used during the calculation.
:param num_units: The number of units in the GRU cell.
:param activation: The activation used in the inner states. By default we use tanh.
There are biases used in other gates, but since TensorFlow doesn't have them, we don't implement them either.
"""
super(MyGRUCell, self).__init__(_reuse = True)
#############################################
# TODO: YOUR CODE HERE #
self._num_units = num_units
self._activation = activation or math_ops.tanh
self._kernel_initializer = None
self._bias_initializer = None
self._gate_linear = None
self._candidate_linear = None
#############################################
# The following 2 properties are required when defining a TensorFlow RNNCell.
@property
def state_size(self):
"""
Overrides parent class method. Returns the state size of of the cell.
state size = num_units + output_size
:return: An integer.
"""
#############################################
# TODO: YOUR CODE HERE #
return self._num_units
#############################################
@property
def output_size(self):
"""
Overrides parent class method. Returns the output size of the cell.
:return: An integer.
"""
#############################################
# TODO: YOUR CODE HERE #
return self._num_units
#############################################
def call(self, inputs, state):
"""
Run one time step of the cell. That is, given the current inputs and the state from the last time step,
calculate the current state and cell output.
You will notice that TensorFlow GRUCell has a lot of other features. But we will not try them. Focus on the
very basic GRU functionality.
Hint 1: If you try to figure out the tensor shapes, use print(a.get_shape()) to see the shape.
Hint 2: In GRU there exist both matrix multiplication and element-wise multiplication. Try not to mix them.
:param inputs: The input at the current time step. The last dimension of it should be 1.
:param state: The state value of the cell from the last time step. The state size can be found from function
state_size(self).
:return: A tuple containing (new_state, new_state). For details check TensorFlow GRUCell class.
"""
#############################################
# TODO: YOUR CODE HERE #
bias_ones = init_ops.constant_initializer(1.0, dtype=inputs.dtype)
if self._gate_linear is None:
bias_ones = self._bias_initializer
if self._bias_initializer is None:
bias_ones = init_ops.constant_initializer(1.0, dtype=inputs.dtype)
with vs.variable_scope("gates"): # Reset gate and update gate.
self._gate_linear = _Linear(
[inputs, state],
2 * self._num_units,
True,
bias_initializer=bias_ones,
kernel_initializer=self._kernel_initializer)
value = math_ops.sigmoid(self._gate_linear([inputs, state]))
r, u = array_ops.split(value=value, num_or_size_splits=2, axis=1)
r_state = r * state
if self._candidate_linear is None:
with vs.variable_scope("candidate"):
self._candidate_linear = _Linear(
[inputs, r_state],
self._num_units,
True,
bias_initializer=self._bias_initializer,
kernel_initializer=self._kernel_initializer)
c = self._activation(self._candidate_linear([inputs, r_state]))
new_h = u * state + (1 - u) * c
return new_h, new_h
#############################################
#I have used this class from the rnn_impl by tensorflow
class _Linear(object):
"""Linear map: sum_i(args[i] * W[i]), where W[i] is a variable.
Args:
args: a 2D Tensor or a list of 2D, batch x n, Tensors.
output_size: int, second dimension of weight variable.
dtype: data type for variables.
build_bias: boolean, whether to build a bias variable.
bias_initializer: starting value to initialize the bias
(default is all zeros).
kernel_initializer: starting value to initialize the weight.
Raises:
ValueError: if inputs_shape is wrong.
"""
def __init__(self,
args,
output_size,
build_bias,
bias_initializer=None,
kernel_initializer=None):
self._build_bias = build_bias
if args is None or (nest.is_sequence(args) and not args):
raise ValueError("`args` must be specified")
if not nest.is_sequence(args):
args = [args]
self._is_sequence = False
else:
self._is_sequence = True
# Calculate the total size of arguments on dimension 1.
total_arg_size = 0
shapes = [a.get_shape() for a in args]
for shape in shapes:
if shape.ndims != 2:
raise ValueError("linear is expecting 2D arguments: %s" % shapes)
if shape[1].value is None:
raise ValueError("linear expects shape[1] to be provided for shape %s, "
"but saw %s" % (shape, shape[1]))
else:
total_arg_size += shape[1].value
dtype = [a.dtype for a in args][0]
scope = vs.get_variable_scope()
with vs.variable_scope(scope,reuse=tf.AUTO_REUSE) as outer_scope:
self._weights = vs.get_variable(
_WEIGHTS_VARIABLE_NAME, [total_arg_size, output_size],
dtype=dtype,
initializer=kernel_initializer)
if build_bias:
with vs.variable_scope(outer_scope) as inner_scope:
inner_scope.set_partitioner(None)
if bias_initializer is None:
bias_initializer = init_ops.constant_initializer(0.0, dtype=dtype)
self._biases = vs.get_variable(
_BIAS_VARIABLE_NAME, [output_size],
dtype=dtype,
initializer=bias_initializer)
def __call__(self, args):
if not self._is_sequence:
args = [args]
if len(args) == 1:
res = math_ops.matmul(args[0], self._weights)
else:
res = math_ops.matmul(array_ops.concat(args, 1), self._weights)
if self._build_bias:
res = nn_ops.bias_add(res, self._biases)
return res<file_sep>/ana/stm.py
import gensim
from gensim import corpora,models
from gensim.models import LdaModel
from gensim.test.utils import datapath
from gensim.parsing.preprocessing import remove_stopwords,strip_punctuation, strip_numeric,strip_short, stem_text
import pandas as pd
import unidecode
import csv
import datetime as dt
from gensim.models import ldaseqmodel
import pyLDAvis
import pyLDAvis.gensim # don't skip this
import matplotlib.pyplot as plt
def preprocess(doc):
return strip_short(remove_stopwords(strip_numeric(strip_punctuation(doc.lower()))),3).split()
def lda_modeling_df(df):
corpus, dictionary = prep_corpus(df)
lda_model = LdaModel(corpus=corpus, # This code runs your lda
id2word=dictionary,
random_state=100,
num_topics=15,
passes=5,
chunksize=10000,
alpha='asymmetric',
decay=0.5,
offset=64,
eta=None,
eval_every=0,
iterations=100,
gamma_threshold=0.001,
per_word_topics=True)
return lda_model, corpus, dictionary
def prep_corpus(df):
tags = [tag for tag in df["review_body"]]
corpus = [preprocess(tag) for tag in tags]
dictionary = corpora.Dictionary(corpus)
corpus = [dictionary.doc2bow(preprocess(tag)) for tag in tags]
dictionary.filter_extremes(no_below=10, no_above=0.8)
corpus = [dictionary.doc2bow(preprocess(tag)) for tag in tags]
return corpus, dictionary
def print_lda_models(lda_model, dictionary):
for i in range(15):
words = lda_model.get_topic_terms(i, topn=10)
print("Topic : " + str(i))
for i in words:
print("Word: " + str(dictionary[i[0]]) + "\t\t Weight: " + str(i[1]))
print("\n")
filename = "amazon_reviews_us_Beauty_v1_00.tsv"
url = 'https://s3.amazonaws.com/amazon-reviews-pds/tsv/amazon_reviews_us_Beauty_v1_00.tsv.gz'
a = []
with open(filename) as tsvfile:
reader = csv.reader(tsvfile, delimiter='\t' )
for row in reader:
a.append(row)
break
fdf = pd.read_csv(filename, delimiter='\t', names=a[0], skiprows=[0])
mask = fdf.isnull().sum(axis=1) != 7
fdf = fdf[mask]
fdf["review_date"] = pd.to_datetime(fdf['review_date'],format = "%Y-%m-%d",errors='coerce')
fdf.dropna(inplace=True)
fdf["year"] = fdf["review_date"].map(lambda x: x.year)
year_count = fdf.groupby('year')['review_id'].nunique()
years = list(year_count.keys())
years.remove(2000)
df_list = []
thresh = 10000
for year in years:
temp_df = fdf[fdf["year"] == year]
if (year_count[year] > thresh):
temp_df = temp_df.sample(thresh)
df_list.append(temp_df)
concat_dfs = []
for i in range(5):
concat_dfs.append(pd.concat(df_list[3 * i: 3 * i + 3]))
time_slice = [len(i) for i in df_list]
lda_model, corpus, dictionary = lda_modeling_df(concat_dfs[0])
print("Partition 1")
print("Dictionary length : " + str(len(dictionary)))
print('Perplexity: ', lda_model.log_perplexity(corpus))
print_lda_models(lda_model, dictionary)
vis = pyLDAvis.gensim.prepare(lda_model, corpus, dictionary)
temp_file = datapath("lda_model1")
lda_model.save(temp_file)
#pyLDAvis.display(vis)
pyLDAvis.save_html(vis, 'lda1.html')
lda_model2, corpus2, dictionary2 = lda_modeling_df(concat_dfs[1])
print("Partition 2")
print("Dictionary length : " + str(len(dictionary2)))
print('Perplexity: ', lda_model2.log_perplexity(corpus))
print_lda_models(lda_model2, dictionary2)
vis2 = pyLDAvis.gensim.prepare(lda_model2, corpus2, dictionary2)
temp_file = datapath("lda_model2")
lda_model2.save(temp_file)
#pyLDAvis.display(vis2)
pyLDAvis.save_html(vis2, 'lda2.html')
lda_model3, corpus3, dictionary3 = lda_modeling_df(concat_dfs[2])
print("Partition 3")
print("Dictionary length : " + str(len(dictionary3)))
print('Perplexity: ', lda_model3.log_perplexity(corpus))
print_lda_models(lda_model3, dictionary3)
vis3 = pyLDAvis.gensim.prepare(lda_model3, corpus3, dictionary3)
temp_file = datapath("lda_model3")
lda_model3.save(temp_file)
#pyLDAvis.display(vis3)
pyLDAvis.save_html(vis3, 'lda3.html')
lda_model4, corpus4, dictionary4 = lda_modeling_df(concat_dfs[3])
print("Partition 4")
print("Dictionary length : " + str(len(dictionary4)))
print('Perplexity: ', lda_model4.log_perplexity(corpus))
print_lda_models(lda_model4, dictionary4)
lda_model4.log_perplexity(corpus4)
vis4 = pyLDAvis.gensim.prepare(lda_model4, corpus4, dictionary4)
temp_file = datapath("lda_model4")
lda_model4.save(temp_file)
#pyLDAvis.display(vis4)
pyLDAvis.save_html(vis4, 'lda4.html')
lda_model5, corpus5, dictionary5 = lda_modeling_df(concat_dfs[4])
print("Partition 5")
print("Dictionary length : " + str(len(dictionary5)))
print('Perplexity: ', lda_model5.log_perplexity(corpus))
print_lda_models(lda_model5, dictionary5)
lda_model5.log_perplexity(corpus5)
vis5 = pyLDAvis.gensim.prepare(lda_model5, corpus5, dictionary5)
temp_file = datapath("lda_model5")
lda_model5.save(temp_file)
#pyLDAvis.display(vis5)
pyLDAvis.save_html(vis5, 'lda5.html')
flda_model, fcorpus, fdictionary = lda_modeling_df(pd.concat(concat_dfs))
print("Complete Partition")
print("Dictionary length : " + str(len(fdictionary)))
print('Perplexity: ', flda_model.log_perplexity(corpus))
print_lda_models(flda_model, fdictionary)
flda_model.log_perplexity(fcorpus)
fvis = pyLDAvis.gensim.prepare(flda_model, fcorpus, fdictionary)
temp_file = datapath("flda_model")
flda_model.save(temp_file)
#pyLDAvis.display(fvis)
pyLDAvis.save_html(fvis, 'flda.html')
| a3abfa455fffa889765d3ad14d557efa3f76f6e1 | [
"Markdown",
"Python"
] | 5 | Python | chintan94/dl-hw | 0f9a5af95a49628e791cd58066c98bdc87601d5d | 76548d5f217ff9604fb0d221092fe47931462b91 |
refs/heads/master | <file_sep>import {builder, metaCache, traverseMeta} from "../simplicity.js";
const renderedItems = new WeakMap();
export function lifeCycle(element = document.body) {
console.time("lifeCycle")
for (const meta of metaCache) {
if (meta[0].element.isConnected) {
traverseMeta(meta, (leaf) => {
for (const property of Object.keys(leaf)) {
switch (property) {
case "if" : {
let state = leaf.if();
let elementChild = leaf.template.content.firstElementChild;
if (state) {
if (elementChild) {
leaf.template.insertAdjacentElement("afterend", elementChild);
}
} else {
if (!elementChild) {
leaf.template.content.appendChild(leaf.element);
}
}
}
break;
case "style" : {
for (const style of Object.keys(leaf.style)) {
let currentStyle = leaf.style[style];
if (currentStyle instanceof Function) {
leaf.element.style[style] = currentStyle();
}
}
}
break;
case "value" : {
if (leaf.element.type === "radio") {
let valueElement = leaf.value;
let value = valueElement.input();
leaf.element.value = leaf.element.use
if (value === leaf.element.value) {
leaf.element.checked = true;
}
} else {
if (leaf.element.type === "checkbox") {
let valueElement = leaf.value;
let checked = valueElement.input();
leaf.element.checked = checked;
} else {
let valueElement = leaf.value;
if (valueElement.input instanceof Function) {
let value = valueElement.input();
leaf.element.value = value;
} else {
leaf.element.value = valueElement;
}
}
}
}
break;
case "text" : {
if (leaf.text instanceof Function) {
leaf.element.textContent = leaf.text();
}
} break;
case "src" : {
if (leaf.src instanceof Function) {
leaf.element.src = leaf.src();
}
} break;
case "href" : {
if (leaf.href instanceof Function) {
leaf.element.href = leaf.href();
}
} break;
case "innerHTML" : {
let element = leaf[property];
if (element instanceof Function) {
leaf.element[property] = element();
} else {
leaf.element[property] = element;
}
} break
case "disabled" : {
leaf.element.disabled = leaf[property]();
} break;
case "update" : {
let update = leaf.update;
update(leaf.element);
}
break;
default : {
if (leaf.items && leaf.item) {
let items = leaf.items();
let newVar = renderedItems.get(leaf.parent.leaf.element);
if (newVar !== items) {
for (const child of Array.from(leaf.parent.leaf.element.children)) {
child.remove();
}
items.forEach((item, index, array) => {
let tree = leaf.item(item, index, array);
builder(leaf.parent.leaf.element, tree);
})
renderedItems.set(leaf.parent.leaf.element, items);
}
}
if (leaf[property].input) {
leaf.element[property] = leaf[property].input();
}
}
}
}
})
}
}
console.timeEnd("lifeCycle")
}<file_sep>import {builder, customComponents} from "../../simplicity.js";
import DomInputFile from "../../directives/dom-input[file].js";
class MatImageUpload extends HTMLElement {
initialize(that) {
let isInitialized = false;
let value = {
data : ""
};
let defaultValue;
that.addEventListener("change", () => {
if (! isInitialized) {
defaultValue = JSON.stringify(value);
isInitialized = true;
}
})
return class {
get value() {
return value;
}
set value(v) {
value = v;
that.dispatchEvent(new Event("change"));
}
get valid() {
return true;
}
get pristine() {
return defaultValue === JSON.stringify(value);
}
get dirty() {
return ! that.pristine;
}
render() {
that.style.display = "block";
that.style.minWidth = "inherit";
that.style.minHeight = "inherit"
that.style.maxWidth = "inherit";
that.style.maxHeight = "inherit"
builder(that, {
element : "div",
style : {
minWidth : "inherit",
minHeight : "inherit",
maxWidth : "inherit",
maxHeight : "inherit"
},
children : [
{
element : "img",
style : {
border : "1px solid var(--main-normal-color)",
minWidth : "inherit",
minHeight : "inherit",
maxWidth : "inherit",
maxHeight : "inherit"
},
src() {
return value.data
}
},
{
element : DomInputFile,
style : {
display : "none"
},
onLoadend(event) {
value = event.detail.load;
that.dispatchEvent(new Event("change"));
that.dispatchEvent(new CustomEvent("load", {detail : event.detail}));
}
},{
element : "button",
type : "button",
text : "Upload",
className : "button",
style : {
display: "block"
},
onClick() {
let input = that.querySelector("input[type=file]");
input.click();
}
}
]
})
if (that.name) {
let form = that.queryUpwards("form");
if (form) {
form.appendInput(that);
}
}
}
}
}
}
export default customComponents.define("mat-image-upload", MatImageUpload)<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatModal extends HTMLElement {
initialize(that) {
let content;
return class {
get content() {
return content;
}
set content(value) {
content = value;
}
extension() {
return {
content : "element"
}
}
render() {
builder(that, {
element : "div",
style : {
top : "0",
left : "0",
position : "absolute",
display : "flex",
width : "100%",
height : "100vh",
alignItems : "center",
justifyContent : "center",
backgroundColor : "rgba(1, 1, 1, 0.5)"
},
initialize(element) {
element.appendChild(content);
}
})
}
}
}
}
export default customComponents.define("mat-modal", MatModal)<file_sep>import {builder, customComponents} from "../../simplicity.js";
import EditorToolbar from "./mat-editor/editor-toolbar.js";
import EditorContextmenuDialog from "./mat-editor/dialog/editor-contextmenu-dialog.js";
class MatEditor extends HTMLElement {
initialize(that) {
let value = "";
let imageDialog;
let linkDialog;
return class {
get value() {
return value;
}
set value(v) {
value = v;
}
get imageDialog() {
return imageDialog;
}
set imageDialog(value) {
imageDialog = value;
}
get linkDialog() {
return linkDialog;
}
set linkDialog(value) {
linkDialog = value;
}
render() {
that.style.display = "block"
builder(that, [
{
element: EditorToolbar,
editor: {
input() {
return that;
}
}
}, {
element: "div",
style : {
outline: "0 solid transparent",
height : "calc(100% - 70px)",
border : "var(--main-normal-color) solid 1px",
margin : "2px"
},
attributes : {
contentEditable : "true"
},
initialize(element) {
element.innerHTML = value;
},
onContextmenu(event) {
if (! event.ctrlKey) {
let dialog = new EditorContextmenuDialog();
let content = that.querySelector("div[contenteditable=true]");
let path = Array.from(event.path);
let indexOf = path.indexOf(content);
path = path.slice(0, indexOf)
dialog.path = path
document.body.appendChild(dialog);
event.preventDefault();
}
}
}
])
let content = that.querySelector("div[contenteditable=true]");
let observer = new MutationObserver(() => {
value = content.innerHTML;
that.dispatchEvent(new Event("change"));
})
observer.observe(content, {subtree : true, childList : true, characterData : true, attributes : true})
}
}
}
}
export default customComponents.define("mat-editor", MatEditor)<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatSpinner extends HTMLElement {
initialize(that) {
return class {
render() {
builder(that, {
element: "svg",
attributes: {
"width": "65px",
"height": "65px",
"viewBox": "0 0 66 66",
"class" : "spinner"
},
children: [
{
element: "circle",
attributes: {
"fill": "none",
"stroke-width": "6",
"stroke-linecap": "round",
"cx": "33",
"cy": "33",
"r": "30",
"class" : "path"
}
}
]
})
}
}
}
}
export default customComponents.define("mat-spinner", MatSpinner)<file_sep>import {get} from "../services/router.js"
import {customComponents} from "../simplicity.js";
import {lifeCycle} from "../processors/lifecycle-processor.js";
class DomRouter extends HTMLElement {
initialize(that) {
let cache = new Map();
window.addEventListener("hashchange", () => {
that.onWindowHashchange();
})
return class {
onWindowHashchange() {
console.time("load")
let hash = window.location.hash;
let hashes = hash.split("?");
let path = hashes[0].substring(1);
let result = {};
if (hashes[1]) {
let rawQueryParams = hashes[1].split("&");
for (const rawQueryParam of rawQueryParams) {
let queryParamRegex = /(\w+)=([\w\d\-/]*)/g;
let queryParameterRegexResult = queryParamRegex.exec(rawQueryParam);
result[queryParameterRegexResult[1]] = queryParameterRegexResult[2]
}
}
let newPath = "../../.." + path + ".js";
import(newPath)
.then((module) => {
let view, guard;
if (cache.has(window.location.hash)) {
view = cache.get(window.location.hash);
} else {
view = new module.default();
view.queryParams = result;
cache.set(window.location.hash, view);
}
guard = get(view.localName);
if (guard) {
view.queryParams = result;
let target = guard(view);
let guardResult = Reflect.ownKeys(target);
let promises = [];
for (const property of guardResult) {
let guardResultElement = target[property];
promises.push(guardResultElement);
}
Promise.all(promises)
.then((results) => {
guardResult.forEach((property, index) => {
view[property] = results[index];
});
let firstElementChild = this.firstElementChild;
if (firstElementChild) {
firstElementChild.remove();
}
this.appendChild(view);
console.timeEnd("load")
})
} else {
let firstElementChild = this.firstElementChild;
if (firstElementChild) {
firstElementChild.remove();
}
this.appendChild(view);
console.timeEnd("load")
}
})
}
render() {
that.onWindowHashchange();
}
}
}
}
export default customComponents.define("dom-router", DomRouter);<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatDrawer extends HTMLElement {
initialize(that) {
let open = true;
let content = [];
return class {
get open() {
return open;
}
set open(value) {
open = value;
}
get content() {
return content;
}
set content(value) {
content = value;
}
extension() {
return {
open : "boolean",
content : "array"
}
}
render() {
builder(that, {
element : "div",
style : {
padding : "1px",
display() {
return open ? "block" : "none"
},
top : "0",
backgroundColor : "var(--main-normal-color)",
borderRight : "1px var(--main-normal-color) solid",
width : "300px",
zIndex : "2"
},
initialize(element) {
for (const contentElement of content) {
element.appendChild(contentElement);
}
}
})
}
}
}
}
export default customComponents.define("mat-drawer", MatDrawer)<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatTab extends HTMLElement {
initialize(that) {
let content;
let selected = false;
return class {
get content() {
return content;
}
set content(value) {
content = value;
}
get selected() {
return selected;
}
set selected(value) {
selected = value;
}
render() {
builder(that, {
element : "div",
style : {
height : "24px",
width : "100px",
textAlign : "center",
borderBottom() {
if (selected) {
return "1px solid var(--main-selected-color)"
} else {
return "1px solid var(--main-grey-color)"
}
}
},
initialize(element) {
element.appendChild(content);
}
})
}
}
}
}
export default customComponents.define("mat-tab", MatTab);<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatTabs extends HTMLElement {
initialize(that) {
let contents = [];
function deSelectAll() {
for (const content of contents) {
content.selected = false;
}
}
return class {
get contents() {
return contents;
}
set contents(value) {
contents = value;
}
render() {
builder(that, {
element : "div",
style : {
display : "flex"
},
children : [
{
element : "div",
style : {
display : "flex"
},
initialize(element) {
for (const content of contents) {
element.appendChild(content);
content.addEventListener("click", () => {
deSelectAll();
content.selected = true;
let indexOf = contents.indexOf(content);
that.dispatchEvent(new CustomEvent("page", {detail : {page : indexOf}}))
})
}
contents[0].selected = true;
}
}, {
element: "div",
style: {
flex : "1",
borderBottom: "1px solid var(--main-grey-color)"
}
}
]
})
}
}
}
}
export default customComponents.define("mat-tabs", MatTabs);<file_sep>import {register} from "./services/router.js"
import {lifeCycle} from "./processors/lifecycle-processor.js";
Node.prototype.queryUpwards = function (query) {
if (this.localName && this.localName === query) {
return this;
} else {
if (this.parentElement === null) {
return null;
}
return this.parentElement.queryUpwards(query);
}
}
const blackList = ["mousemove", "mouseover"]
EventTarget.prototype.addEventListener = (function (_super) {
return function (name, callback) {
_super.apply(this, [name, (event) => {
callback(event)
if (blackList.indexOf(name) === -1) {
lifeCycle();
}
}])
}
})(EventTarget.prototype.addEventListener);
Node.prototype.appendChild = (function (_super) {
return function (child) {
_super.apply(this, [child])
if (child.isConnected) {
lifeCycle();
}
}
})(Node.prototype.appendChild);
HTMLElement.prototype.insertAdjacentElement = (function (_super) {
return function (position, element) {
_super.apply(this, [position, element]);
if (element.isConnected) {
lifeCycle();
}
}
})(HTMLElement.prototype.insertAdjacentElement);
HTMLElement.prototype.insertBefore = (function (_super) {
return function (newChild, refChild) {
_super.apply(this, [newChild, refChild])
if (newChild.isConnected) {
lifeCycle();
}
}
})(HTMLElement.prototype.insertBefore);
export function traverseMeta(tree, callback) {
function internal(tree, callback) {
callback(tree);
for (const property of Object.keys(tree)) {
let treeElement = tree[property];
if (treeElement.items && treeElement.item) {
treeElement.parent = {
leaf : tree,
property : property
}
internal(treeElement, callback);
}
if (treeElement instanceof Array) {
for (const child of treeElement) {
if (child.element) {
child.parent = {
leaf : tree,
property : property
}
internal(child, callback);
}
}
}
if (treeElement.element) {
treeElement.parent = {
leaf : tree,
property : property
}
internal(treeElement, callback);
}
}
}
internal(tree, callback);
}
const htmlTags = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "blockquote",
"body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details",
"dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4",
"h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link",
"main", "map", "mark", "menu", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param",
"picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source",
"span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time",
"title", "tr", "track", "u", "ul", "var", "video", "wbr"];
export const metaCache = new Set;
export function builder(scope, tree) {
if (!(tree instanceof Array)) {
tree = [tree];
}
metaCache.add(tree);
let container = document.createDocumentFragment();
for (const treeElement of tree) {
traverseMeta(treeElement, (leaf) => {
if (leaf.parent) {
leaf.parent.leaf.invalid = leaf.parent.leaf.invalid || [];
leaf.parent.leaf.invalid.push(leaf.parent.property);
}
})
}
for (const treeElement of tree) {
traverseMeta(treeElement, (leaf) => {
for (const property of Object.keys(leaf)) {
switch (property) {
case "element" : {
let element = leaf.element;
if (element instanceof Function) {
leaf.element = new element();
} else {
if (htmlTags.indexOf(leaf.element) === -1) {
leaf.element = document.createElementNS("http://www.w3.org/2000/svg", element);
} else {
leaf.element = document.createElement(element);
}
}
if (leaf.parent) {
if (leaf.parent.property === "children") {
leaf.parent.leaf.element.appendChild(leaf.element);
} else {
let parentLeaf = leaf.parent.leaf.element[leaf.parent.property];
if (parentLeaf instanceof Array) {
parentLeaf.push(leaf.element);
} else {
leaf.parent.leaf.element[leaf.parent.property] = leaf.element;
}
}
}
container.appendChild(treeElement.element);
}
break;
case "if" : {
let templateElement = document.createElement("template");
leaf.element.insertAdjacentElement("beforebegin", templateElement)
templateElement.content.appendChild(leaf.element);
leaf.template = templateElement;
}
break;
case "value" : {
if (leaf.element.type === "checkbox") {
let valueElement = leaf.value;
let checked = valueElement.input();
leaf.element.checked = checked;
} else {
let valueElement = leaf.value;
if (valueElement.input instanceof Function) {
let value = valueElement.input();
leaf.element.value = value;
} else {
leaf.element.value = valueElement;
}
}
if (leaf.element.type === "checkbox") {
let valueElement = leaf[property];
let handler = () => {
valueElement.output(leaf.element.checked);
}
leaf.element.addEventListener("click", handler)
} else {
let valueElement = leaf[property];
let handler = () => {
valueElement.output(leaf.element.value);
}
leaf.element.addEventListener("change", handler)
leaf.element.addEventListener("keyup", handler)
}
}
break;
case "update" : {
leaf[property](leaf.element);
}
break;
case "initialize" : {
leaf[property](leaf.element);
}
break;
case "text" : {
if (leaf.text instanceof Function) {
leaf.element.textContent = leaf.text();
} else {
leaf.element.textContent = leaf.text;
}
}
break;
case "style" : {
for (const style of Object.keys(leaf.style)) {
let currentStyle = leaf.style[style];
if (currentStyle instanceof Function) {
leaf.element.style[style] = currentStyle();
} else {
leaf.element.style[style] = currentStyle;
}
}
}
break;
case "attributes" : {
let leafElement = leaf[property];
for (const name of Object.keys(leafElement)) {
leaf.element.setAttribute(name, leafElement[name])
}
}
break;
default : {
if (leaf.invalid && leaf.invalid.indexOf(property) > -1) {
// No Op
} else {
if (property.startsWith("on")) {
let eventName = property.substring(2).toLowerCase();
let leafElement = leaf[property];
leaf.element.addEventListener(eventName, (event) => {
leafElement(event);
});
} else {
if (leaf.element) {
if (leaf[property].direct) {
leaf.element[property] = leaf[property].direct;
} else {
if (leaf[property] instanceof Function) {
leaf.element[property] = leaf[property]();
} else {
leaf.element[property] = leaf[property];
}
}
if (leaf[property].input) {
leaf.element[property] = leaf[property].input();
}
}
}
}
}
}
}
})
}
scope.appendChild(container);
}
function componentHelper(clazz) {
return eval(`(function (clazz) {
return class ${clazz.constructor.name}Helper extends clazz {
#isRendered = false;
constructor() {
super();
let Model = this.initialize(this);
if (Model) {
let model = new Model();
let descriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf(model));
Object.defineProperties(this, descriptors);
}
}
connectedCallback() {
if (this.render && !this.#isRendered) {
this.render();
this.#isRendered = true;
}
}
}
})(clazz)`);
}
export const customComponents = new class CustomComponents {
define(name, clazz, options) {
const Component = componentHelper(clazz);
customElements.define(name, Component, options);
return Component;
}
}
export const customViews = new class CustomViews {
define(configure) {
let View = componentHelper(configure.class);
if (configure.guard) {
register(configure.name, configure.guard)
}
customElements.define(configure.name, View)
return View
}
}<file_sep>import {builder, customComponents} from "../../../../simplicity.js";
import EditorTextDialog from "../dialog/editor-text-dialog.js";
import EditorTableDialog from "../dialog/editor-table-dialog.js";
import EditorTableElement from "../components/editor-table.js";
class ToolbarInserts extends HTMLElement {
initialize(that) {
let editor;
return class {
get editor() {
return editor;
}
set editor(value) {
editor = value;
}
render() {
builder(that, [
{
element: "div",
style: {
display: "flex"
},
children: [
{
element: "button",
type: "button",
className: "iconBig",
title: "Link",
text: "insert_link",
onClick() {
let dialog = editor.linkDialog();
document.body.appendChild(dialog);
let selection = document.getSelection();
let rangeAt = selection.getRangeAt(0);
dialog.callback = function (value) {
document.getSelection().removeAllRanges();
document.getSelection().addRange(rangeAt);
let link = dialog.page.links.find((link) => link.rel === "read");
document.execCommand("createLink", false, `#/anjunar/pages/page?id=${value.id}&link=${link.url}`);
}
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "unLink",
text: "link_off",
onClick() {
document.execCommand("unlink")
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "Image",
text: "image",
onClick() {
let dialog = editor.imageDialog();
document.body.appendChild(dialog);
let selection = document.getSelection();
let rangeAt = selection.getRangeAt(0);
dialog.callback = function (value) {
document.getSelection().removeAllRanges();
document.getSelection().addRange(rangeAt);
document.execCommand("insertImage", false, value);
}
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "Insert Hr",
text: "code",
onClick() {
document.execCommand("insertHorizontalRule")
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "Insert Text",
text: "short_text",
onClick() {
let dialog = new EditorTextDialog();
document.body.appendChild(dialog);
let selection = document.getSelection();
let rangeAt = selection.getRangeAt(0);
dialog.callback = function (value) {
document.getSelection().removeAllRanges();
document.getSelection().addRange(rangeAt);
document.execCommand("insertText", false, value);
dialog.close();
}
}
}
]
},
{
element: "div",
style: {
display: "flex"
},
children: [
{
element: "button",
type: "button",
className: "iconBig",
title: "Table",
text: "table_view",
onClick() {
let dialog = new EditorTableDialog();
document.body.appendChild(dialog);
let selection = document.getSelection();
let rangeAt = selection.getRangeAt(0);
dialog.callback = function (columnsSize) {
document.getSelection().removeAllRanges();
document.getSelection().addRange(rangeAt);
let table = new EditorTableElement();
let row = document.createElement("tr");
table.appendChild(row)
for (let i = 0; i <= columnsSize; i++) {
let td = document.createElement("td");
row.appendChild(td);
}
document.execCommand("insertHTML", false, table.outerHTML)
}
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "Insert ordered List",
text: "format_list_numbered",
onClick() {
document.execCommand("insertOrderedList")
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "Insert Unordered List",
text: "format_list_bulleted",
onClick() {
document.execCommand("insertUnorderedList")
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "Div FlexBox",
text: "table_chart",
onClick() {
let html = `<div is="editor-flexbox" style="display: flex">
<div style="flex: 1">Insert here...</div>
</div>`;
document.execCommand("insertHTML", false, html)
}
},
{
element: "button",
type: "button",
className: "iconBig",
title: "Paragraph",
text: "notes",
onClick() {
document.execCommand("insertParagraph")
}
}
]
}
])
}
}
}
}
export default customComponents.define("toolbar-inserts", ToolbarInserts)
<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatMenuItem extends HTMLElement {
initialize(that) {
let content;
return class {
get content() {
return content;
}
set content(value) {
content = value;
}
render() {
builder(that, {
element : "div",
style : {
padding : "5px"
},
initialize(element) {
element.appendChild(content);
}
})
}
}
}
}
export default customComponents.define("mat-menu-item", MatMenuItem)<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatProgress extends HTMLElement {
initialize(that) {
return class {
render() {
that.style.display = "block"
builder(that, {
element : "div",
className : "progress",
children : [
{
element : "div",
className : "indeterminate"
}
]
})
}
}
}
}
export default customComponents.define("mat-progress", MatProgress)<file_sep>import {builder, customComponents} from "../../library/simplicity/simplicity.js";
class Example extends HTMLElement {
initialize(that) {
let meta;
let items;
return class {
get meta() {
return meta;
}
set meta(value) {
meta = value;
}
get items() {
return items;
}
set items(value) {
items = value;
}
render() {
builder(that, {
element : "div",
children : {
items() {
return items;
},
item(item) {
return {
element : "div",
children : [
{
element : "span",
initialize(element) {
let contentElement = meta.content[0];
let m = contentElement.element(item)
builder(element, m);
}
},
{
element : "span",
initialize(element) {
let contentElement = meta.content[1];
let m = contentElement.element(item)
builder(element, m);
}
},
{
element : "span",
initialize(element) {
let contentElement = meta.content[2];
let m = contentElement.element(item)
builder(element, m);
}
},
{
element : "span",
initialize(element) {
let contentElement = meta.content[3];
let m = contentElement.element(item)
builder(element, m);
}
}
]
}
}
}
})
}
}
}
}
export default customComponents.define("documentation-common-example", Example)<file_sep>import {builder, customComponents} from "../../../library/simplicity/simplicity.js";
import MatDialog from "../../../library/simplicity/components/modal/mat-dialog.js";
import MatGrid from "../../../library/simplicity/components/table/mat-grid.js";
class EditorImageDialog extends HTMLElement {
initialize(that) {
let callback;
let value;
let items = (query, callback) => {
callback(
[
{
name: 1,
url: "images/a5WZLLq_700bwp.webp"
},
{
name: 2,
url: "images/a7W7Z4m_700bwp.webp"
},
{
name: 3,
url: "images/a9nPQDj_700bwp.webp"
},
{
name: 4,
url: "images/aBme7LD_460swp.webp"
}]
, 4)
}
return class {
get callback() {
return callback;
}
set callback(value) {
callback = value;
}
get items() {
return items;
}
set items(value) {
items = value
}
render() {
builder(that, {
element: MatDialog,
header: "Table Setup",
content: {
element: "div",
children: [
{
element: MatGrid,
items: {
direct: items
},
meta: {
item: {
element(item) {
return {
element: "img",
src: item.url,
style: {
height: "200px"
},
onClick() {
callback(item.url);
}
}
}
}
}
}
]
},
footer: {
element: "button",
type: "button",
text: "Ok",
onClick() {
callback(value);
}
}
})
}
}
}
}
export default customComponents.define("editor-image-dialog", EditorImageDialog)<file_sep>import {builder, customComponents} from "../../../library/simplicity/simplicity.js";
import MatDialog from "../../../library/simplicity/components/modal/mat-dialog.js";
import DomInput from "../../../library/simplicity/directives/dom-input.js";
class EditorLinkDialog extends HTMLElement {
initialize(that) {
let table;
let callback;
let value = ""
return class {
get table() {
return table;
}
set table(value) {
table = value;
}
get callback() {
return callback;
}
set callback(value) {
callback = value;
}
get value() {
return value;
}
set value(v) {
value = v
}
render() {
builder(that, {
element : MatDialog,
header : "Table Setup",
content : {
element : "div",
children : [
{
element : DomInput,
type : "text",
value : {
input() {
return value;
},
output(v) {
value = v;
}
}
}
]
},
footer : {
element: "button",
type : "button",
text : "Ok",
onClick() {
callback(value);
}
}
})
}
}
}
}
export default customComponents.define("editor-link-dialog", EditorLinkDialog)<file_sep>import {customComponents} from "../simplicity.js";
class DomA extends HTMLAnchorElement {
initialize(that) {
let hateoas;
let action;
that.addEventListener("click", () => {
document.dispatchEvent(new CustomEvent("page", {detail : {hateoas : hateoas, action : action}}));
})
return class {
get hateoas() {
return hateoas;
}
set hateoas(value) {
hateoas = value;
}
get action() {
return action;
}
set action(value) {
action = value;
}
static extension() {
return {
hateoas: "object",
action: "string"
}
}
}
}
}
export default customComponents.define("dom-a", DomA, {extends : "a"})<file_sep>import {customComponents} from "../simplicity.js";
class DomLi extends HTMLElement {
initialize(that) {
let open = false;
that.addEventListener("click", () => {
open = ! open;
let el = that.querySelector("ul")
if (el) {
if (open) {
el.style.display = "block";
} else {
el.style.display = "none";
}
}
})
return class {
get open() {
return open;
}
set open(value) {
open = value;
}
render() {
let el = that.querySelector("ul");
if (el) {
el.style.display = "none";
}
}
}
}
}
export default customComponents.define("dom-li", DomLi)<file_sep>import {customComponents, loader} from "../library/simplicity2020/simplicity.js"
const validator = loader("./errors/404.html");
const {html, css} = validator([]);
export const name = "errors-404";
export default customComponents.define(name, class Error404 extends HTMLElement {}, {html: html, css: css});
<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatDrawerContainer extends HTMLElement {
initialize(that) {
let drawer;
let content;
that.style.width = "100%"
return class {
get drawer() {
return drawer;
}
set drawer(value) {
drawer = value;
}
get content() {
return content;
}
set content(value) {
content = value;
}
render() {
builder(that, {
element : "div",
style : {
display : "flex"
},
initialize(element) {
element.appendChild(drawer);
element.appendChild(content);
}
})
}
}
}
}
export default customComponents.define("mat-drawer-container", MatDrawerContainer)<file_sep>import {parse, multipartToJSON} from "./multipart.js"
import {lifeCycle} from "../processors/lifecycle-processor.js";
const exceptionHandlers = [];
export function registerExceptionHandler(value) {
exceptionHandlers.push(value);
}
export const htmlClient = new class HTMLClient {
action(method, url, options) {
let request = new XMLHttpRequest;
let parser = new DOMParser();
request.open(method, url);
request.setRequestHeader("content-type", "html/text");
let executor = (resolve, reject) => {
request.addEventListener("loadend", (event) => {
let status = event.target.status;
if (status >= 200 && status < 300) {
let response = event.target.responseText;
resolve(parser.parseFromString(response, "text/html"))
window.setTimeout(() => {
lifeCycle();
}, 10)
} else {
reject(event.target);
window.setTimeout(() => {
lifeCycle();
}, 10)
for (const exceptionHandler of exceptionHandlers) {
exceptionHandler(event.target);
}
}
});
};
let promise = new Promise(executor);
if (options instanceof FormData) {
request.addEventListener("progress", (event) => {
console.log(event)
})
request.send(options);
} else {
if (options && options.body) {
request.send(JSON.stringify(options.body));
} else {
request.send();
}
}
return promise;
}
get(url, options) {
return this.action("GET", url, options)
}
put(url, options) {
return this.action("PUT", url, options)
}
delete(url, options) {
return this.action("DELETE", url, options)
}
post(url, options) {
return this.action("POST", url, options)
}
options(url, options) {
return this.action("OPTIONS", url, options)
}
}
export const jsonClient = new class JSONClient {
action(method, url, options) {
let request = new XMLHttpRequest;
request.open(method, url);
request.setRequestHeader("content-type", "application/json");
let executor = (resolve, reject) => {
request.addEventListener("loadend", (event) => {
let status = event.target.status;
if (status >= 200 && status < 300) {
if (event.target.responseText.length > 0) {
let response = JSON.parse(event.target.responseText);
resolve(response)
window.setTimeout(() => {
lifeCycle();
}, 10)
} else {
resolve("")
window.setTimeout(() => {
lifeCycle();
}, 10)
}
} else {
reject(event.target);
window.setTimeout(() => {
lifeCycle();
}, 10)
for (const exceptionHandler of exceptionHandlers) {
exceptionHandler(event.target);
}
}
});
};
let promise = new Promise(executor);
if (options && options.body) {
request.send(JSON.stringify(options.body));
} else {
request.send();
}
return promise;
}
get(url, options) {
return this.action("GET", url, options)
}
put(url, options) {
return this.action("PUT", url, options)
}
delete(url, options) {
return this.action("DELETE", url, options)
}
post(url, options) {
return this.action("POST", url, options)
}
options(url, options) {
return this.action("OPTIONS", url, options)
}
}
export const formClient = new class JSONClient {
action(method, url, options) {
let request = new XMLHttpRequest;
request.open(method, url);
let executor = (resolve, reject) => {
request.addEventListener("loadend", (event) => {
let status = event.target.status;
if (status >= 200 && status < 300) {
if (event.target.responseText.length > 0) {
let response = multipartToJSON(parse(event.target.responseText));
resolve(response)
window.setTimeout(() => {
lifeCycle();
}, 10)
} else {
resolve("")
window.setTimeout(() => {
lifeCycle();
}, 10)
}
} else {
reject(event.target);
window.setTimeout(() => {
lifeCycle();
}, 10)
for (const exceptionHandler of exceptionHandlers) {
exceptionHandler(event.target);
}
}
});
};
let promise = new Promise(executor);
if (options) {
request.send(options);
} else {
request.send();
}
return promise;
}
get(url, options) {
return this.action("GET", url, options)
}
put(url, options) {
return this.action("PUT", url, options)
}
delete(url, options) {
return this.action("DELETE", url, options)
}
post(url, options) {
return this.action("POST", url, options)
}
options(url, options) {
return this.action("OPTIONS", url, options)
}
}
<file_sep>import {builder, customComponents} from "../../simplicity.js";
import DomInput from "../../directives/dom-input.js";
class MatRating extends HTMLElement {
initialize(that) {
let name;
that.addEventListener("click", () => {
let inputs = Array.from(that.querySelectorAll("input"));
let checked;
for(let input of inputs) {
if (input.checked) {
checked = input;
}
}
for(let i = 0; i < inputs.length; i++) {
if (i < inputs.indexOf(checked)) {
inputs[i].classList.add("selected");
} else {
inputs[i].classList.remove("selected");
}
}
})
return class {
get name() {
return name;
}
set name(value) {
name = value
}
render() {
builder(that, {
element : "div",
style : {
display : "flex"
},
children : [
{
element : DomInput,
type : "radio",
name : name,
value : "1"
},
{
element : DomInput,
type : "radio",
name : name,
value : "2"
},
{
element : DomInput,
type : "radio",
name : name,
value : "3"
},
{
element : DomInput,
type : "radio",
name : name,
value : "4"
},
{
element : DomInput,
type : "radio",
name : name,
value : "5"
}
]
})
}
}
}
}
export default customComponents.define("mat-rating", MatRating)
<file_sep>import {builder, customComponents} from "../../../../simplicity.js";
import MatDialog from "../../../modal/mat-dialog.js";
import DomInput from "../../../../directives/dom-input.js";
import MatInputContainer from "../../containers/mat-input-container.js";
class EditorTableDialog extends HTMLElement {
initialize(that) {
let value;
let callback;
return class {
get callback() {
return callback;
}
set callback(value) {
callback = value;
}
render() {
builder(that, {
element : MatDialog,
header : "Table Setup",
content : {
element : "div",
style : {
display : "flex"
},
children : [
{
element: MatInputContainer,
placeholder : "Columns",
content : {
element : DomInput,
type : "number",
value : {
input() {
return value;
},
output(v) {
value = v;
}
}
}
}
]
},
footer : {
element: "button",
type : "button",
text : "Ok",
onClick() {
callback(value);
}
}
})
}
}
}
}
export default customComponents.define("editor-table-dialog", EditorTableDialog)<file_sep>import {builder, customComponents} from "../../../simplicity.js";
class MatCheckboxContainer extends HTMLElement {
initialize(that) {
let content;
let placeholder;
return class {
get content() {
return content
}
set content(value) {
content = value;
}
get placeholder() {
return placeholder;
}
set placeholder(value) {
placeholder = value;
}
render() {
builder(that, {
element : "div",
style : {
display : "flex"
},
children : [
{
element : "div",
initialize(element) {
element.appendChild(content);
}
},
{
element: "div",
style : {
lineHeight : "18px"
},
text() {
return placeholder;
}
}
]
})
}
}
}
}
export default customComponents.define("mat-checkbox-container", MatCheckboxContainer);<file_sep>import {customComponents} from "../simplicity.js";
class DomInput extends HTMLInputElement {
initialize(that) {
let isInitialized;
let defaultValue;
let errors = [];
let form;
let use;
let validation = {};
let validators = [
{
empty(element) {
if (validation.notEmpty) {
return String(element.value).length > 0;
}
return true;
}
}
];
let formatter = (value) => {
return value;
};
return class {
isInput() {
return true;
}
get errors() {
return errors;
}
set errors(value) {
errors = value;
}
get isInitialized() {
return isInitialized;
}
set isInitialized(value) {
isInitialized = value;
}
get defaultValue() {
return defaultValue;
}
set defaultValue(value) {
defaultValue = value;
}
get form() {
return form;
}
set form(value) {
form = value;
}
get use() {
return use;
}
set use(value) {
use = value;
}
get validation() {
return validation;
}
set validation(value) {
validation = value;
}
reset() {
this.value = defaultValue;
this.dispatchEvent(new Event("change"));
}
get dirty() {
return !this.pristine;
}
get pristine() {
return defaultValue === this.value;
}
get valid() {
return errors.length === 0;
}
get validators() {
return validators;
}
get formatter() {
return formatter;
}
set formatter(value) {
formatter = value;
}
render() {
let handler = (event) => {
if (!isInitialized) {
defaultValue = that.value;
isInitialized = true;
}
for (const validator of validators) {
let name = Object.keys(validator)[0];
let result = validator[name](that);
let indexOf = errors.indexOf(name);
if (result) {
if (indexOf > -1) {
errors.splice(indexOf, 1);
}
} else {
if (indexOf === -1) {
errors.push(name)
}
}
}
event.stopPropagation();
return false;
}
that.addEventListener("focus", handler);
that.addEventListener("blur", handler);
that.addEventListener("keyup", handler);
that.addEventListener("change", handler);
if (that.name) {
let form = that.queryUpwards("form");
if (form) {
form.appendInput(that);
}
}
}
}
}
}
export default customComponents.define("dom-input", DomInput, {extends : "input"})<file_sep>import {builder, customComponents} from "../../simplicity.js";
class MatMenu extends HTMLElement {
initialize(that) {
let open = false;
let content;
let subMenu = [];
return class {
get content() {
return content;
}
set content(value) {
content = value;
}
get subMenu() {
return subMenu;
}
set subMenu(value) {
subMenu = value;
}
render() {
builder(that, {
element: "div",
style : {
position: "relative"
},
onMouseenter() {
open = true;
},
onMouseleave() {
open = false;
},
children: [
{
element: "div",
className: "item",
style: {
padding: "5px"
},
initialize(element) {
element.appendChild(content);
}
},
{
element: "div",
style: {
position: "absolute",
width: "100%",
top: "36px",
left: "0",
backgroundColor: "var(--main-normal-color)"
},
if() {
return open
},
initialize(element) {
for (const sub of subMenu) {
element.appendChild(sub);
}
}
}
]
})
}
}
}
}
export default customComponents.define("mat-menu", MatMenu)<file_sep>import {customComponents} from "../../../../simplicity";
export const name = "editor-flexbox";
class EditorDivFlexElement extends HTMLDivElement {
connectedCallback() {
let element = this;
document.addEventListener("keydown", (event) => {
let selection = document.getSelection();
let rangeAt = selection.getRangeAt(0);
let endOffset = rangeAt.endOffset;
let endContainer = rangeAt.endContainer;
let divs = element.querySelectorAll("div");
let parentElement = endContainer.parentElement;
if (parentElement && parentElement.parentElement === element) {
if (divs.item(divs.length - 1).isEqualNode(parentElement)) {
let length = endContainer.textContent.length;
if (length === endOffset) {
if (event.code === "Enter") {
event.preventDefault();
let newColumn = document.createElement("div");
newColumn.style.flex = "1"
element.appendChild(newColumn);
return false;
}
if (event.code === "ArrowRight") {
let newChild = document.createElement("div");
newChild.className = "root"
element.insertAdjacentElement("afterend", newChild)
}
}
}
}
});
}
}
export default customComponents.define(name, EditorDivFlexElement, {extends: "div"})
<file_sep>import {builder, customViews} from "../../library/simplicity/simplicity.js";
class Example extends HTMLElement {
initialize(that) {
return class {
render() {
builder(that, {
element : "div",
text : "It work's"
})
}
}
}
}
customViews.define({
name : "documentation-navigation-example",
class : Example
}) | d516159db896ebc1ab0d0611a79512c3f6238f21 | [
"JavaScript"
] | 28 | JavaScript | HerbrichCorporation/simplicity | ef8a413f674c27e80d227e9c91f6fec10ea16c20 | 80ddbe22f74a4f953e5f171089ed7a44b5fa222a |
refs/heads/master | <repo_name>Lepstr/PyBit<file_sep>/README.md
# PyBit
bit manipulation library
<file_sep>/bit.py
from sys import stderr
BYTES_TYPE_I64: int = 64 / 8
BYTES_TYPE_I32: int = 32 / 8
BYTES_TYPE_I16: int = 16 / 8
BYTES_TYPE_I8: int = 8 / 8
class BitfieldType:
pass
def _get_type_by_bits(bits: int) -> int:
if int(bits) is int((BYTES_TYPE_I64 * 8)):
return BYTES_TYPE_I64
if int(bits) is int((BYTES_TYPE_I32 * 8)):
return BYTES_TYPE_I32
if int(bits) is int((BYTES_TYPE_I16 * 8)):
return BYTES_TYPE_I16
if int(bits) is int((BYTES_TYPE_I8 * 8)):
return BYTES_TYPE_I8
return BYTES_TYPE_I8
def _get_type_by_num(num: int) -> int:
bit_type = BYTES_TYPE_I8
if num < -128 or num > 128:
bit_type = BYTES_TYPE_I16
if num < -32768 or num > 32767:
bit_type = BYTES_TYPE_I32
if num < -2147483648 or num > 2147483647:
bit_type = BYTES_TYPE_I64
return bit_type
def _get_unpack_mask_by_type(bit_type: int) -> int:
mask: int = 0xFF000000000000
if int(bit_type) is int(BYTES_TYPE_I64):
return (mask ^ mask) | 0xFFFFFFFFFFFFFFFF
if int(bit_type) is int(BYTES_TYPE_I32):
return (mask ^ mask) | 0xFFFFFFFF00000000
if int(bit_type) is int(BYTES_TYPE_I16):
return (mask ^ mask) | 0xFFFF000000000000
if int(bit_type) is int(BYTES_TYPE_I8):
return (mask ^ mask) | 0xFF00000000000000
return mask
def field(num: int) -> BitfieldType:
pass
def set(num: int, index: int, state: bool) -> int:
bit_type: int = _get_type_by_num(num)
if index > (bit_type * 8):
stderr.write('[PyBit]: Failed to set bit \'' + str(index) + '\' of \'' + str(num) + '\' '
'(insufficient number of bits for specified index)\n')
return -1
if index <= 0:
stderr.write('[PyBit]: Failed to set bit \'' + str(index) + '\' of \'' + str(num) + '\' '
'(bit indices start at 1)\n')
return -1
bit_mask: int = 0b00000001 << (index - 1)
if state:
return num | bit_mask
else:
return num ^ bit_mask
def get(num: int, index: int) -> bool:
bit_type: int = _get_type_by_num(num)
if index > (bit_type * 8) or index <= 0:
stderr.write('[PyBit]: Failed to get bit \'' + str(index) + '\' of \'' + str(num) + '\' '
'(insufficient number of bits for specified index)\n')
bit_mask: int = 0b00000001 << (index - 1)
return (num & bit_mask) > 0
def cut(num: int, frm: int, to: int) -> int:
bit_type: int = _get_type_by_num(num)
if (frm > (bit_type * 8) or to > (bit_type * 8)) or frm >= to:
stderr.write('[PyBit]: Failed to cut bit area from \'' + str(num) + '\''
' (\'from\' and/or \'to\' exceed the number of available bits)\n')
return -1
if frm <= 0 or to <= 0:
stderr.write('[PyBit]: Failed to cut bit area from \'' + str(num) + '\' (bit indices start at 1)\n')
return -1
bit_mask: int = 0b000000001
for n in range(to):
bit_mask = bit_mask | (0b000000001 << n)
return num & bit_mask
def pack(nums: list) -> int:
packed: int = 0x0000000000000000
shift: int = (BYTES_TYPE_I64 * 8)
num_bits: int = 0x00
for num in nums:
if not isinstance(num, int):
stderr.write('[PyBit]: Failed to pack \'' + str(nums) + '\' '
'(one of the supplied values is not an integer)\n')
return -1
bit_type: int = _get_type_by_num(num)
num_bits = num_bits + (bit_type * 8)
if num_bits > (BYTES_TYPE_I64 * 8):
stderr.write('[PyBit]: Failed to pack \'' + str(nums) + '\' '
'(the sum of all bits within the given list is greater than 64)\n')
return -1
shift = shift - (bit_type * 8)
packed = packed | (num << int(shift))
return packed
def unpack(num: int, bit_format: list = []) -> list:
if bit_format is None:
bit_format = [8, 8, 8, 8, 8, 8, 8, 8]
result = []
shift: int = (BYTES_TYPE_I64 * 8)
num_bits: int = 0x00
for n in bit_format:
if not isinstance(n, int):
stderr.write('[PyBit]: Failed to unpack \'' + str(num) + '\' '
'(one of the supplied values is not an integer)\n')
return []
num_bits = num_bits + n
if num_bits > (BYTES_TYPE_I64 * 8):
stderr.write('[PyBit]: Failed to unpack \'' + str(num) + '\' '
'(the sum of all bits within the given list is greater than 64)\n')
return []
mask: int = _get_unpack_mask_by_type(_get_type_by_bits(n)) >> int(((BYTES_TYPE_I64 * 8) - shift))
shift = shift - n
result = result + [((num & mask) >> int(shift))]
return result
def stringify(num: int) -> str:
bit_type: int = _get_type_by_num(num)
bits: int = int(bit_type * 8)
builder: str = ""
for n in range(bits):
if (n % 8) == 0:
builder = builder + " "
bit_mask: int = 0b00000001 << n
if (num & bit_mask) > 0:
builder = builder + "1"
else:
builder = builder + "0"
return builder[::-1]
| 38eb2319892b55bd387b1fc119d918e04974c0a7 | [
"Markdown",
"Python"
] | 2 | Markdown | Lepstr/PyBit | 925d74cca34e598d9b9d37249c2a519df572987f | 5cdec8419e4531699681c4527346f56f8147d424 |
refs/heads/master | <file_sep>const items = document.querySelectorAll(".list-group-item[data-toggle='collapse'");
function cambiarFondo(e){
setTimeout(() => {
if ($(this).attr('aria-expanded') === "false") {
$(this).removeClass('list-group-item-active');
} else {
$(this).addClass('list-group-item-active');
}
},100);
}
items.forEach(item => item.addEventListener('click', cambiarFondo));<file_sep># EduCapital
Sitio Web de EduCapital
Desarrollado por HAND Creative Design
Santa Fé, México
2017
<3
<file_sep><?php
if(isset($_POST['inputEmail']) &&
isset($_POST['inputName']) &&
isset($_POST['inputPhone']) &&
isset($_POST['inputMensaje']) &&
){
$to = "<EMAIL>"; // email de EduCapital
$from = $_POST['inputEmail']; // el email de quién envía el formulario
$nombre = $_POST['inputName'];
$email = $_POST['inputEmail'];
$phone = $_POST['inputPhone'];
$msg = $_POST['inputMensaje'];
$subject = "Formulario Contacto EduCapital";
$message = $nombre . " escribió:" . "\n\n" . $msg . "\n\n" . "Email: " . $email . "\nTeléfono: " . $phone . "\n\n" ;
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
// You can also use header('Location: thank_you.php'); to redirect to another page.
header('Location: http://educapital.com.mx/index.html');
}
?> | 2279a650d28a29cb0c113bf9116ace8b4020041c | [
"JavaScript",
"PHP",
"Markdown"
] | 3 | JavaScript | handcd/EduCapital | efbc012d25ab0c7e9112e01a1a6c23bef7f9630d | 895d1561f22b343470254bbb69b15234e40f748e |
refs/heads/master | <repo_name>Mavitis/RoomInspector<file_sep>/src/root/Preprocessing/open_close_usage.py
import sys
import numpy as np
import scipy as sc
import matcompat
import scipy.ndimage
import matplotlib.pyplot as plt
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def open_close_usage(fr, camType, method):
np.disp('open_close_usage ...')
# Local Variables: map, fr, camType, use, method, width, usage, height, frame, se
# Function calls: disp, strel, imopen, open_close_usage, find, imclose, zeros, reshape, strcmp
#% frame = open_close_usage(fr, camType, method)
frame = fr
usage = fr.usage
width = camType.width
height = camType.height
#print type(width), type(height)
map1 = np.zeros((1, width * height))
#print usage, len(usage), usage, len(map1[0])
#np.savetxt('usage', usage)
map1=map1[0]
map1[usage]=1
#print len(map1)
#dla porownania estetycznego .conj().T
map1 = np.reshape(map1, (height, width))
#plt.imshow(map1)
#plt.show()
#print 'map1', map1, len(map1)
#map1 = np.reshape(map1, (width, height))
#print 'map1', map1, len(map1)
se = np.ones((3,3))
#%se = strel('disk', 1);
if method == 'open-close' :
map1 = scipy.ndimage.morphology.binary_opening(scipy.ndimage.morphology.binary_closing(map1, structure=se), structure=se)
elif method == 'open':
map1 = scipy.ndimage.binary_opening(map1, structure=se)
elif method == 'close-open':
map1 = scipy.ndimage.morphology.binary_closing(scipy.ndimage.morphology.binary_opening(map1, structure=se), structure=se)
elif method == 'close':
map1 = scipy.ndimage.binary_closing(map1, structure=se)
else:
np.disp('Error: Unknown morphological method!')
#print 'map1', map1, len(map1)
#np.savetxt('map1', map1)
map1=map1*1
#print 'map1', map1, len(map1)
map1 = np.reshape(map1, (1,(width*height)))
use = np.nonzero((map1 == 1))
frame.usage = use[1]
#np.savetxt('frame.usage_openclose.txt', frame.usage, delimiter='\n', newline='\n')
#print 'frame.usage', frame.usage, len(frame.usage)
#sys.exit("Error message")
return frame<file_sep>/src/root/Preprocessing/backprojection.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def backprojection(fr, camType):
# Local Variables: distances, fr, scale, points3D_org, i, camType, j, points3D, yHelp, distLocal, v1, v2, v3, xHelp, frame
# Function calls: reshape, backprojection, sqrt
#%frame = backprojection(fr, camType)
np.disp('Trwa wykonywanie: backprojection')
frame = fr
distances = frame.distances
distances = np.reshape(distances, (camType.width, camType.height)).cT
xHelp = 0
yHelp = 0
distLocal = 0
scale = 0
v1 = 0
v2 = 0
v3 = 0
j = 0
i = 0
while (j < camType.height):
i = 0
while (i < camType.width):
xHelp = (i - camType.principalPoint(1)) * camType.pixelWidth
yHelp = (j - camType.principalPoint(2)) * camType.pixelHeight * (-1)
distLocal = np.sqrt((camType.focalLength) ** 2 + xHelp ** 2 + yHelp ** 2)
scale = (distances(j + 1, i + 1) / distLocal) + 1
v1 = xHelp * scale
v2 = yHelp * scale
v3 = camType.focalLength * scale
frame.points3D = np.array(frame.points3D, np.vstack(np.hstack(v1), np.hstack(v2), np.hstack(v3)))
frame.points3D_org = np.array(frame.points3D_org, np.vstack(np.hstack(v1), np.hstack(v2), np.hstack(v3)))
i = i + 1
j = j + 1
return frame<file_sep>/src/root/IO/load_sequence.py
import numpy as np
import scipy
from srdat2frame import srdat2frame
from generate_camera_data import generate_camera_data
import string
import glob
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def load_sequence(seqName, camType, posStart=1, numOfFrames=0):
# Local Variables: distances, fr, seqName, amplitudes, d, idx, sequence, i, camType, help, posStart, currFrame, intensities, frame, usage, x, frames, numOfFrames, seq, name
# Function calls: disp, load_sequence, false, struct, filesep, arrayfun, generate_camera_data, load, strcmp, nargin, length, isempty, num2str, srdat2frame, strfind, true, find, dir
#% sequence = load_sequence(seqName, camType, posStart, numOfFrames):
#%
#%
#% input variables:
#%
#% - seqName: holds the complete path of the directory storing the sequence.
#% The files containing frames of the Swissranger
#% camera has to be named in the following way:
#% frame_0001.dat, frame_0002.dat, ...
#%
#% - posStart: determines that frame were the sequence should start
#% e.g. 1 for the first frame ...
#%
#% - numOfFrames: determines the number of frames the sequence should contain
#%
#% - camType: specifies the camera used
#% camera types known: 'PMD_16x64', 'PMD_120x160', 'SR_176x144'
if seqName[int(0)-1] != '/':
seqName = seqName + '/'
# verification if seqName ends with '/', if not, adding
if numOfFrames==0:
onlyfiles= glob.glob(str(seqName)+'*.dat')
numOfFrames= len(onlyfiles)
np.disp('Loading sequence data ...')
class my_sequence:
frames = []
camType
sequence = my_sequence()
sequence.camType = generate_camera_data(camType)
seq = []
class my_frame:
distances = []
intensities = []
amplitudes = []
points3D = []
points3D_org = []
usage = []
indx8=[]
frame = my_frame()
#np.disp(camType)
#np.disp(seq)
#np.disp(frame)
#np.disp(sequence)
if camType =='PMD_120x160' or camType == 'PMD_16x64': #not used camera for time beeing
# currFrame = posStart-1.
# name = camType
# help = np.array([])
i = 1.
# while i<=numOfFrames:
# #%distances in mm
# name = [seqName, 'frame', str(currFrame)]
# help = load(name)
#
# frame.distances = 1000 * help(mslice[3:end])
#
# name = mcat([seqName, mstring('frame'), num2str(currFrame), mstring('_amp')])
# help = load(name)
#
# frame.amplitudes = help(mslice[3:end])
#
# name = mcat([seqName, mstring('frame'), num2str(currFrame), mstring('_greyimg')])
# help = load(name)
#
# frame.intensities = help(mslice[3:end])
#
# frame.usage = mslice[1:1:(sequence.camType.height * sequence.camType.width)]
#
# seq = mcat([seq, frame])
#
# i = i + 1
# currFrame = currFrame + 1
elif np.logical_or(np.logical_or(camType == 'SR_176x144', camType == 'SR4_176x144'), camType == 'SR_176x144calib'):
currFrame = posStart
name = ""
help1 = string
fr = np.array([])
i = 1
while i<=numOfFrames:
np.disp(i)
help1 = str(currFrame)
_switch_val=len(help1)
if False: # switch
pass
elif _switch_val == 1:
help1 = '000' + help1
elif _switch_val == 2:
help1 = '00' + help1
elif _switch_val == 3:
help1 = '0' + help1
name = seqName+'frame_'+help1+'.dat'
#removed try catch
fr = np.loadtxt(name,dtype=float,comments='%',delimiter='\t')
#np.disp(np.size(fr))
#i = i+1
#currFrame = currFrame+1
frame = srdat2frame(fr, sequence.camType)
#np.savetxt('frame_distances.txt', frame.distances, delimiter=' ', newline=' ')
#np.savetxt('frame_intensities.txt', frame.intensities, delimiter=' ', newline=' ')
#np.savetxt('frame_amplitudes.txt', frame.amplitudes, delimiter=' ', newline=' ')
#np.savetxt('frame_points3D_0.txt', frame.points3D[0], delimiter=' ', newline=' ')
#np.savetxt('frame_points3D_1.txt', frame.points3D[1], delimiter=' ', newline=' ')
#np.savetxt('frame_points3D_2.txt', frame.points3D[2], delimiter=' ', newline=' ')
#np.savetxt('frame_points3D_3.txt', frame.points3D[3], delimiter=' ', newline=' ')
#np.savetxt('frame_points3D_org.txt', frame.points3D_org, delimiter=' ', newline=' ')
#np.savetxt('frame_usage.txt', frame.usage, delimiter=' ', newline=' ')
seq = np.array(np.hstack((seq, frame)))
currFrame = currFrame+1
i = i+1
else:
np.disp('Unkown camera type!')
sequence.frames = seq
#np.savetxt('sequence.frames.distances', sequence.frames.distances, delimiter=' ', newline=' ')
#np.disp(seq)
return sequence<file_sep>/src/root/PlaneExtraction/automatic_kmeans.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def automatic_kmeans(X):
# Local Variables: CMIN, C, mindx, g3, d, cl, i, c, MIN, indx, clIndx, X, cmindx, sumd, D
# Function calls: min, gradient, sum, kmeans, pnts2clusters, automatic_kmeans
d = np.array([])
indx = np.array([])
#% for i = 1:10
#% [i,C,sumd,D] = kmeans(X',i);
#% d = [d sum(sumd)];
#% indx = [indx {i}];
#% end
[i, C, sumd, D] = kmeans(X.conj().T, 1.)
d = np.array(np.hstack((d, np.sum(sumd))))
indx = np.array(np.hstack((indx, cellarray(np.hstack((i))))))
[i, C, sumd, D] = kmeans(X.conj().T, 2.)
d = np.array(np.hstack((d, np.sum(sumd))))
indx = np.array(np.hstack((indx, cellarray(np.hstack((i))))))
[i, C, sumd, D] = kmeans(X.conj().T, 3.)
d = np.array(np.hstack((d, np.sum(sumd))))
indx = np.array(np.hstack((indx, cellarray(np.hstack((i))))))
[i, C, sumd, D] = kmeans(X.conj().T, 4.)
d = np.array(np.hstack((d, np.sum(sumd))))
indx = np.array(np.hstack((indx, cellarray(np.hstack((i))))))
g3 = np.gradient(np.gradient(np.gradient(d)))
[MIN, mindx] = matcompat.max(g3)
c = 5.
while 1.:
[i, C, sumd, D] = kmeans(X.conj().T, c)
d = np.array(np.hstack((d, np.sum(sumd))))
indx = np.array(np.hstack((indx, cellarray(np.hstack((i))))))
g3 = np.gradient(np.gradient(np.gradient(d)))
[CMIN, cmindx] = matcompat.max(g3)
if mindx == cmindx:
break
mindx = cmindx
c = c+1.
[cl, clIndx] = pnts2clusters(X, indx.cell[int(mindx)-1])
return [cl, clIndx]<file_sep>/src/root/PlaneExtraction/patch_merging.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def patch_merging(patches, method):
# Local Variables: patches, nOld, rIndx, rest, n, r, patchesMerged, method, restIndx
# Function calls: length, patch_merging, merge_planes
#%% planesMerged = patch_merging(patches, method)
#%
#% possible methods:
#% - 'mean': uses the mean of the patches
#% - 'median': uses the median of the patches
#% - 'ngbPatches': uses the nearest neighbor patches
#% - 'fastNgbPatches': finds quick nearest neighbor patches
nOld = 0.
n = length(patches)
rest = np.array([])
restIndx = np.array([])
patchesMerged = patches
while nOld != n:
[patchesMerged, r, rIndx] = merge_planes(patchesMerged, method)
rest = np.array(np.hstack((rest, r)))
restIndx = np.array(np.hstack((restIndx, rIndx)))
nOld = n
n = length(patchesMerged)
return [patchesMerged, rest, restIndx]<file_sep>/src/root/PlaneExtraction/pnts2plane_classification_dac.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def pnts2plane_classification_dac(pnts, display):
# Local Variables: help, voxels_new, pos, in, pnts, patches, a_thresh, clusters, currIndx, in1, in2, workingIndx, d_thresh, angles, voxels, d, allIndx, center, currSet, i, coeff, n, planes, y, x, display, dis
# Function calls: princomp, pi, false, main_plane_extraction, show_clusters, generate_voxels, nargin, length, abs, pnts2plane_classification_dac, intersect, cellfun, isempty, acos, repmat, find, cell2struct, mean
#%% planes = pnts2plane_classification_dac(pnts)
#%
#% reference:
#% <NAME> et al: " A Fast and Robust 3D Feature Extraction Algorithm
#% for Structured Environment Reconstuction"
#%% some defaults:
if nargin<2.:
display = false
#%% discretization of the point cloud
voxels = generate_voxels(pnts, np.array(np.hstack((60., 60., 60.))))
#%% segmentation
pos = cellfun(lambda x: main_plane_extraction(x[0:3.,:]), voxels, 'UniformOutput', false)
voxels_new = cellfun(lambda x, i: x[:,int(i)-1], voxels, pos, 'UniformOutput', false)
voxels_new = voxels_new[int((not cellfun('isempty', voxels_new)))-1]
#%[n, d] = cellfun(@(x)(least_square_plane_fitting(x)), voxels_new, 'UniformOutput', false);
coeff = cellfun(lambda x: princomp(x[0:3.,:].conj().T), voxels_new, 'UniformOutput', false)
n = cellfun(lambda x: x[:,2], coeff, 'UniformOutput', false)
center = cellfun(lambda x: np.mean(x[0:3.,:], 2.), voxels_new, 'UniformOutput', false)
d = cellfun(lambda x, y: np.dot(x.conj().T, y), n, center, 'UniformOutput', false)
help = np.array(np.vstack((np.hstack((n.conj().T)), np.hstack((d.conj().T)), np.hstack((center.conj().T)), np.hstack((voxels_new.conj().T)), np.hstack((matcompat.repmat(cellarray(np.hstack((np.array(np.hstack((1., 0., 0.)))))), 1., length(d)))), np.hstack((matcompat.repmat(cellarray(np.hstack((30.))), 1., length(d)))))))
patches = cell2struct(help, cellarray(np.hstack(('normal', 'd', 'center', 'pnts', 'color', 'radius'))), 1.).conj().T
#%help = [n'; d'; voxels_new'];
#%planes = cell2struct(help, {'n', 'd', 'pnts'}, 1)';
#%
#%planes = smooth_planes(planes);
#%% region growing:
a_thresh = np.dot(1./18., np.pi)
#%d_thresh = 70;
allIndx = np.array(np.hstack((np.arange(1., (length(patches))+1))))
clusters = np.array([])
while not isempty(allIndx):
currSet = np.array([])
workingIndx = allIndx[0]
allIndx[0] = np.array([])
while not isempty(workingIndx):
currIndx = workingIndx[0]
currSet = np.array(np.hstack((currSet, patches[int(currIndx)-1].pnts)))
workingIndx[0] = np.array([])
d_thresh = np.dot(4.*0.05, np.mean((patches[int(currIndx)-1].pnts[2,:]), 2.))
if isempty(allIndx):
continue
angles = acos(np.dot(patches[int(currIndx)-1].normal.conj().T, np.array(np.hstack((patches[int(allIndx)-1].normal)))))
in1 = nonzero((angles<a_thresh))
dis = np.abs((np.dot(patches[int(currIndx)-1].normal.conj().T, np.array(np.hstack((patches[int(allIndx)-1].center))))-matcompat.repmat(np.dot(patches[int(currIndx)-1].normal.conj().T, patches[int(currIndx)-1].center), 1., length(allIndx))))
in2 = nonzero((dis<d_thresh))
#% % coplanarity measure:
#% currPnt = patches(currIndx).center;
#% currNormal = patches(currIndx).normal;
#% ngbPnts = [patches(allIndx).center];
#% ngbNormals = [patches(allIndx).normal];
#%
#% r12 = ngbPnts - currPnt * ones(1, size(ngbPnts, 2));
#%
#% firstTerm = abs(currNormal'*r12);
#% secondTerm = zeros(1, size(r12, 2));
#% for j = 1:size(r12, 2)
#% secondTerm(j) = abs(ngbNormals(:,j)'*r12(:,j));
#% end
#%
#% decider = max([firstTerm; secondTerm]);
#%
#% in2 = find(decider < d_thresh);
in = intersect(in1, in2)
workingIndx = np.array(np.hstack((workingIndx, allIndx[int(in)-1])))
allIndx[int(in)-1] = np.array([])
clusters = np.array(np.hstack((clusters, cellarray(np.hstack((currSet))))))
planes = clusters
#%% display results:
if display:
show_clusters(clusters, 25.)
return [planes]<file_sep>/src/root/IO/frame2srdat.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def frame2srdat(frame, camType):
# Local Variables: frame, srMatrix, u, amp, y, x, z, camType
# Function calls: frame2srdat, reshape, zeros
#% srMatrix = frame2srdat(frame, camType)
x = frame.points3D_org[0,:]/1000.
y = frame.points3D_org[1,:]/1000.
z = frame.points3D_org[2,:]/1000.
amp = frame.amplitudes
x = np.reshape(x, (camType.width), np.array([])).conj().T
y = np.reshape(y, (camType.width), np.array([])).conj().T
z = np.reshape(z, (camType.width), np.array([])).conj().T
amp = np.reshape(amp, (camType.width), np.array([])).conj().T
u = np.zeros(1., np.dot(camType.width, camType.height))
u[int((frame.usage))-1] = 1.
u = np.reshape(u, (camType.width), np.array([])).conj().T
srMatrix = np.array(np.vstack((np.hstack((z)), np.hstack((x)), np.hstack((y)), np.hstack((amp)), np.hstack((u)))))
return [srMatrix]<file_sep>/src/root/PlaneExtraction/plane_computation.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def plane_computation(pnts):
# Local Variables: p2, p3, p1, d, coeff, n, b, a, pnts
# Function calls: disp, princomp, plane_computation, cross, mean, norm, size
#% [n, d] = plane_computation(pnts)
#%
#% n: normal vector of E
#% - -
#% |n1|
#% n = |n2|
#% |n3|
#% - -
#% d: distanz of E to the origin
#% p1, p2, p3: points in E (if #pnts = 3)
#% - - - - - -
#% |p11| |p21| |p31|
#% p1 = |p12| p2 = |p22| p3 = |p32|
#% |p13| |p23| |p33|
#% - - - - - -
#%
#% the plane is described in Hesse normal form:
#% -> -> ->
#% E: n * x = d, where n is the normal vector of E
pnts = pnts[0:3.,:]
n = np.array([])
d = 0.
if matcompat.size(pnts, 2.)<3.:
np.disp('Error: not enough pnts for plane computation')
return []
elif matcompat.size(pnts, 2.) == 3.:
p1 = pnts[:,0]
p2 = pnts[:,1]
p3 = pnts[:,2]
a = p2-p1
b = p3-p1
n = np.cross(a, b)
n = matdiv(n, linalg.norm(n))
d = np.dot(n.conj().T, p1)
else:
coeff = princomp(pnts.conj().T)
n = coeff[:,2]
d = np.dot(n.conj().T, np.mean(pnts, 2.))
return [n, d]<file_sep>/src/root/Preprocessing/thresholding.py
import sys
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def thresholding(fr, camType):
np.disp('thresholding ...')
# Local Variables: meanAmp, fr, camType, usage, threshold, frame
# Function calls: length, thresholding, sum, find
#%% frame = thresholding(fr, camType)
frame = fr
#%% thresholding on amplitudes:
meanAmp = np.sum(frame.amplitudes)/frame.amplitudes.size
#print frame.amplitudes.size
#print np.sum(frame.amplitudes)
#print meanAmp
#np.savetxt('meanAmp.txt', meanAmp, delimiter='\n', newline='\n')
threshold = 1./3. * meanAmp
#print threshold
frame.usage = np.nonzero((frame.amplitudes >= threshold))
#np.savetxt('thFrameUsage.txt', frame.usage, delimiter='\n', newline='\n')
#sys.exit("Error message")
#%% add some additional data with bad amplitudes but stable neighborhood
#% (slow operation)
#% dis = reshape(frame.distances, camType.width, [])';
#%
#% j = 1:camType.width;
#% j = repmat(j, 1, camType.height);
#% j = num2cell(j);
#%
#% i = 1:camType.height;
#% i = i';
#% i = repmat(i, 1, camType.width);
#% i = reshape(i', 1, []);
#% i = num2cell(i);
#%
#% currD = num2cell(frame.distances);
#%
#% currN = cellfun(@(x,y,d) (reshape(abs(get8region(dis,x,y) - d)', 1, [])), ...
#% i, j, currD, 'UniformOutput', false);
#%
#% distribution = cellfun(@(x)(sqrt(sum((x-mean(x)).^2)/(length(x)-1))), currN, 'UniformOutput', false);
#% distribution = [distribution{1:end}];
#%
#% stdD = std(distribution);
#%
#% add = find(frame.amplitudes < threshold & distribution < stdD/3);
#%
#% dis7 = medfilt2(dis, [9 9]);
#% dis7 = reshape(dis7', 1, []);
#% frame.distances(add) = dis7(add);
#%
#% frame.usage = [frame.usage add];
return frame<file_sep>/src/root/Utilities/iscolinear.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def iscolinear(p1, p2, p3):
# Local Variables: p2, p3, c, b, theta1, theta2, beta, p1, bool, a, alpha, gamma
# Function calls: false, sum, sqrt, nargin, iscolinear, acos, pi, true, size
#% function bool = test_colinearity(p1, p2, p3)
return [bool]<file_sep>/src/root/PlaneExtraction/pnts2plane_classification_rgrow.py
import numpy as np
import scipy
import matcompat
import sys
import csv
def pnts2plane_classification_rgrow(fr=None, cam=None, display=0):
np.disp('Trwa wykonywanie: pnts2plane_classification_rgrow')
#% [planes, rest, patchesIndx, restIndx] = pnts2plane_classification_rgrow(fr, cam, display)
#
# This function classifies points as planar or not. Afterwards the planar
# points are associated with a certain plane. The function is based on the
# paper "Geometry and Texture Recovery" of Stamos and Allen. This function
# does take into account the neighborhood (based on the organization
# within the matrix structure) of each point. Use of region growing
# techniques.
#
# pnts: set of points with the following structure
# | p1x p2x p3x p4x |
# pnts = | p1y p2y p3y p4y ... |
# | p1z p2z p3z p4z |
# width, height: dimension of the matrix the points of 'pnts' are organized in
# usage: specifies which of the points in 'pnts' are valid points
# display: 1 - visualize clusters; 0 - no visulaization (optinal; default: 0)
#% some default values:
#doda seq jako parametr? to jest zabezpieczenie przed niewykonaniem preprocessingu, wiec mozna wstepnie olac
#if not(hasattr(fr, 'indx8')):
# seq.frames = fr
# seq.camType = cam
# seq = preprocessing(seq, 'normals')
# fr = seq.frames
# end
rest = []
restIndx = []
with open('fr', 'wb') as myfile:
wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
wr.writerow(fr)
normals = fr.normals
#deviation = fr.dev;
usage = fr.usage
pnts = fr.points3D
planarIndx = fr.planar
planar = fr.planar
restIndx = fr.notplanar
temp=np.zeros((3, len(restIndx)))
for it in range(0,3):
for it2 in range(len(restIndx)):
temp[it][it2]=pnts[it][restIndx[it2]-1]
#temp.append(pnts[it][ngbIndx[it2]])
rest=temp
#rest = pnts((1,3), restIndx)
#% start region growing:
patchesIndx = []
patches = []
workingIndx=[]
i = 1
#print planarIndx[0]
#print len(planarIndx[0])
#planarIndx=planarIndx[0]
for x in np.nditer(planarIndx):
#while (not len(planarIndx)==0):
workingIndx.append(planarIndx[x])
# temp=[]
#for it in range(len(ngbIndx)):
# if u[it] == 1:
# temp.append(ngbIndx[it])
#patchesIndx[i].lvalue = [] czy ok???
for y in np.nditer(workingIndx):
currIndx = workingIndx[0][y]
#print 'cuurind', currIndx
#workingIndx(y).lvalue = [] czy ok???
patchesIndx.append(currIndx)
# find indices of neighbors
#ngbIndx = getNgbIndx(currIndx, width, height, 3); %Swissranger: 8-neighboorhood
#ngbIndx = getNgbIndx(currIndx, width, height, 21); %DC_Tracking: 440-neighboorhood
ngbIndx = fr.indx8[currIndx] # jfr.indx8 zupelnie inna wartosc, sasiedztwo 8 nie dziala
print 'ngbIndx po sasiedztwie',ngbIndx #podaje sama siebie + os X iY zmienione
np.savetxt('ngbIndxPNTS.txt', ngbIndx, delimiter='\n', newline='\n')
#print 'fr.indx8',fr.indx8
np.savetxt('fr.indx8PNTS.txt', fr.indx8[currIndx], delimiter='\n', newline='\n')
# find the indices, that are unprocessed until now and refer to a planar
# point (-> stored in 'planar')
#ngbIndx = ngbIndx(ismember(ngbIndx, usage));
#ngbIndx=ngbIndx[np.in1d(ngbIndx, planar)]
u = np.in1d(ngbIndx, planar)
u = u*1
print 'u',u
temp=[]
for it in range(len(ngbIndx)):
if u[it] == 1:
temp.append(ngbIndx[it])
ngbIndx=temp
print 'ngbIndx po planar',ngbIndx
if (len(ngbIndx)==0): #czy to ma sens? chyba trzeba while albo cos
continue
np.savetxt('ngbIndx.txt', ngbIndx, delimiter=' ', newline=' ')
# conormality measure:
print 'ngbIndx' ,ngbIndx
print 'normals.size' ,normals.shape[0]
ngbNormals=np.zeros((normals.shape[0], len(ngbIndx)))
#ngbNormals = normals[:, ngbIndx]
for it in range(normals.shape[0]):
for it2 in range(len(ngbIndx)):
ngbNormals[it][it2]=normals[it][ngbIndx[it2]]
#ngbNormals=temp
currNormal = normals[:, currIndx]
#print ngbNormals.shape
print ngbNormals
np.savetxt('currNormal.txt', currNormal, delimiter=' ', newline=' ')
np.savetxt('ngbNormals[0].txt', ngbNormals[0], delimiter=' ', newline=' ')
sys.exit("Debug break")
print currNormal.conj().T
angles = np.arccos(currNormal.conj().T * ngbNormals)
# find acute angles
f = np.nonzero((angles > (np.pi / 2)))[0]
angles(f).lvalue = np.pi - angles(f)
_in = np.nonzero((angles < (1 / 18 * np.pi)))[0]
ngbIndx = ngbIndx(_in)
if (len(ngbIndx)==0):
continue
# coplanarity measure:
currPnt = pnts((0,3), currIndx)
ngbPnts = pnts((0,3), ngbIndx)
ngbNormals = normals[:, ngbIndx]
r12 = ngbPnts - currPnt * np.ones((1, len(ngbPnts[2])))
firstTerm = abs(currNormal.conj().T * r12)
secondTerm = np.zeros(1, len(r12[2]))
for j in len(r12[2]):
secondTerm[j] = abs(ngbNormals[:, j] * r12[:, j])
decider = max(firstTerm, secondTerm)
#threshold = log(10*currPnt(3));
#threshold = 32 * 0.05 * currPnt(3); %Swissranger
threshold = 4 * 0.05 * currPnt(3) #Swissranger
#threshold = 100; %DC_Tracking
#threshold = 30;
_in = np.nonzero(decider < threshold)
ngbIndx = ngbIndx(_in)
workingIndx = (workingIndx, ngbIndx)
workingIndx = np.unique(workingIndx)
workingIndx(np.in1d(workingIndx, patchesIndx(i))).lvalue = []
#patches(i).lvalue = pnts([1:3], patchesIndx(i))
patches(i).lvalue = pnts((0,3), patchesIndx(i))
#planarIndx(ismember(planarIndx, patchesIndx(i))) = [] u = np.in1d(fr.usage[1], use[1])
w = np.in1d(planarIndx, patchesIndx(i))
planarIndx(w).lvalue = []
i = i + 1
#% display results:
#if (display):
# fig = show_clusters(patches, 50)
# fig = plot_3Dpoints(rest, mstring('k'), fig)
planes = patches
#return [clusters, rest, clusterIndx, restIndx]<file_sep>/src/root/Utilities/sindx2mindx.py
import sys
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def sindx2mindx(num, width, height):
# Local Variables: column, width, height, num, row
# Function calls: mod, floor, sindx2mindx
#% [row, column] = sindx2mindx(num, width, height)
#num ma z dupy wartosc
#print 'index', num
row = np.floor(((num-1)/width+1))
column = np.mod((num-1), width)+1.
#print 'sind2mindx', row, column
return [row, column]
<file_sep>/src/root/IO/generate_camera_data.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def generate_camera_data(camType):
# Local Variables: principalPoint, name, focalLength, camType, height, width, camera, pixelWidth, pixelHeight
# Function calls: display, generate_camera_data, struct, strcmp
#% cameraData = generate_camera_data(camType)
#%
#% camType: 'PMD_16x64', 'PMD_120x160', 'SR_176x144', 'SR_176x144calib'
#all values are given in mm
class my_camera:
name = 0
height = 0
width = 0
focalLength = 0
principalPoint = [0, 0]
pixelWidth = 0.0
pixelHeight = 0.0
camera = my_camera()
if (camType == 'PMD_16x64'):
camera.name = 'PMD_16x64'
camera.height = 16
camera.width = 64
camera.focalLength = 16
camera.principalPoint = [31.5, 7.5]
camera.pixelWidth = 0.1553
camera.pixelHeight = 0.2108
elif (camType == 'PMD_120x160'):
camera.name = 'PMD_120x160'
camera.height = 120
camera.width = 160
camera.focalLength = 12
camera.principalPoint = [79.5, 59.5]
camera.pixelWidth = 0.04
camera.pixelHeight = 0.04
elif (camType == 'SR_176x144'):
camera.name = 'SR_176x144'
camera.height = 144
camera.width = 176
camera.focalLength = 8
camera.principalPoint = [92, 60]
#camera.principalPoint = [88 72]; %take data from calibration
camera.pixelWidth = 0.04
camera.pixelHeight = 0.04
elif (camType == 'SR_176x144calib'):
camera.name = 'SR_176x144'
camera.height = 144
camera.width = 176
camera.focalLength = 8
camera.principalPoint = [86, 70]
camera.pixelWidth = 0.04
camera.pixelHeight = 0.04
elif (camType == 'SR4_176x144'):
camera.name = 'SR4_176x144'
camera.height = 144
camera.width = 176
camera.focalLength = 10
camera.principalPoint = [88, 72]
camera.pixelWidth = 0.04
camera.pixelHeight = 0.04
else:
np.disp('Unknown camera type.')
return camera<file_sep>/src/root/PlaneExtraction/merge_planes.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def merge_planes(planes, method):
# Local Variables: distances, currMin, decider, allMins, posEnd, disDecider, allMean, rest, candMins, radius, in, allNormPnts, absoluteNum, radiusDecider, nCurr, cNormPnts, nEnd, currAllMins, pnts, candidates, workingPlanes, dEnd, method, currPlane, allRadius, disCand, currCells, allDistMean, plane, allPlanes, currMean, angles, surCand, restIndx, currRadius, d, currSet, planesNew, cAllMins, indx, n, i, points, emp, planes, y, x
# Function calls: disp, false, repmat, mat2cell, any, size, main_plane_extraction, merge_planes, min, sum, sqrt, find, realmax, pi, max, isfield, ones, isempty, median, length, cellfun, acos, strcmp, mean
#%% planesNew = merge_planes(planes, method)
#%
#% approach based on region growing
#%
#% possible methods:
#% - 'mean': uses the mean of the patches
#% - 'median': uses the median of the patches
#% - 'ngbPatches': uses the nearest neighbor patches
#% - 'fastNgbPatches': finds quick nearest neighbor patches
emp = cellfun('isempty', cellarray(np.hstack((planes.pnts))))
allPlanes = planes[int((not emp))-1]
planesNew = np.array([])
rest = np.array([])
restIndx = np.array([])
absoluteNum = length(allPlanes)
while not isempty(allPlanes):
#%progressbar(1 - length(allPlanes) / absoluteNum);
#%progressbar(1);
#% planesNew = [];
#% plane = struct('pnts', [], 'n', [], 'd', 0);
#%
#% currSet = [];
#%
#% while(~isempty(planes))
#%
#% currSet = [];
#% workingPlanes = planes(1);
#% planes(1) = [];
#%
#% while(~isempty(workingPlanes))
#%
#% currPlane = workingPlanes(1);
#% currSet = [currSet currPlane.pnts];
#% workingPlanes(1) = [];
#%
#% if(isempty(planes))
#% continue;
#% end
#%
#% % conormality measure:
#% angles = acos(currPlane.n'*[planes.n]);
#%
#% % coplanarity measure:
#% % currMean = mean(currPlane.pnts, 2);
#% % planesMean = arrayfun(@(x)mean(x.pnts,2), planes, 'UniformOutput', false);
#% % planesMean= cell2mat(planesMean);
#% % currN = size(currPlane.pnts, 2);
#% % l = 1;
#% % while(l <= currN)
#% %
#% % planesCurrR12 = arrayfun(@(x)(x.pnts - repmat(currPlane.pnts(1:3,l), 1, size(x.pnts,2))), planes, 'UniformOutput', false);
#% %
#% % l = l+1;
#% %
#% % end
#%
#% r12 = zeros(3, length(planes));
#%
#% l = 1;
#% while(l <= length(planes))
#%
#% k = 1;
#% currR12 = [];
#% currLength = realmax;
#% while(k <= size(currPlane.pnts, 2))
#%
#% helpR12 = planes(l).pnts - repmat(currPlane.pnts(1:3,k), 1, size(planes(l).pnts, 2));
#% helpLengths = sum(helpR12.^2);
#% [mi, indx] = min(helpLengths);
#%
#% if(mi < currLength)
#% currR12 = helpR12(:, indx);
#% currLength = mi;
#% end
#%
#% k = k+1;
#%
#% end
#%
#% r12(:,l) = currR12;
#%
#% l = l+1;
#%
#% end
#%
#% % r12 = planesMean - repmat(currMean, 1, size(planesMean, 2));
#%
#% firstTerm = abs(currPlane.n'*r12);
#% secondTerm = zeros(1, size(r12, 2));
#% for j = 1:size(r12, 2)
#% secondTerm(j) = abs(planes(j).n'*r12(:,j));
#% end
#%
#% decider = max([firstTerm; secondTerm]);
#% %threshold = 8 * 0.005 * currMean(3);
#% threshold = 30;
#% in = find(angles < (2/18 * pi) & decider < threshold);
#%
#% % ds = abs([planes.d] - currPlane.d);
#% % in = find(angles < (2/18 * pi) & ds < 40);
#%
#% workingPlanes = [workingPlanes planes(in)];
#% planes(in) = [];
#%
#% end
#%
#% plane.pnts = currSet;
#% coeff = princomp(currSet');
#% plane.n = coeff(:,3);
#% plane.d = plane.n' * mean(currSet, 2);
#%
#% planesNew = [planesNew plane];
#%
#% end
return [planesNew, rest, restIndx]<file_sep>/src/root/PlaneExtraction/cluster_through_histNormals.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def cluster_through_histNormals(fr, cam, display):
# Local Variables: n_x, n_y, seq, angle_z, camType, angle_x, frames, n_z, planarIndx, clusterIndx, usage, clusters, u_y, u_x, angle_y, deviation, fr, u_xyz, edges, u_xy, u_z, Y, X, Z, i, XYZ, bin_z, thres_dev, cam, x, display, bin_y, bin_x
# Function calls: std, asin, false, abs, isfield, pnts2clusters, sqrt, show_clusters, nargin, length, preprocessing, intersect, cellfun, histc, pi, find, cluster_through_histNormals, mean
#%% [clusters, clusterIndx] = cluster_through_histNormals(fr, cam, display)
#%% some defaults:
if nargin<3.:
display = false
if not isfield(fr, 'normals'):
seq.frames = fr
seq.camType = cam
seq = preprocessing(seq, 'normals')
fr = seq.frames
deviation = fr.dev
thres_dev = 1.*np.mean(deviation)+np.std(deviation)
planarIndx = nonzero((deviation<=thres_dev))
fr.usage = intersect((fr.usage), planarIndx)
#%plot_3Dpoints(fr.points3D(:, fr.usage)); drawnow;
#%% compute angles along the three axis X, Y, Z:
X = fr.normals[0,int((fr.usage))-1]
Y = fr.normals[1,int((fr.usage))-1]
Z = fr.normals[2,int((fr.usage))-1]
XYZ = np.sqrt((X**2.+Y**2.+Z**2.))
angle_x = np.abs(asin((X/XYZ)))
angle_y = np.abs(asin((Y/XYZ)))
angle_z = np.abs(asin((Z/XYZ)))
#%angle = max([angle_x; angle_y; angle_z]);
#%% compute histograms over these angles:
edges = np.array(np.hstack((np.arange(0., (np.pi/2.-matdiv(np.pi, 4.5))+(matdiv(np.pi, 4.5)), matdiv(np.pi, 4.5)))))
[n_x, bin_x] = histc(angle_x, edges)
[n_y, bin_y] = histc(angle_y, edges)
[n_z, bin_z] = histc(angle_z, edges)
#%[n, bin] = histc(angle, [min(angle):(max(angle)-min(angle))/10:max(angle)]);
#%bar(n);
u_x = pnts2clusters((fr.usage), bin_x)
u_y = pnts2clusters((fr.usage), bin_y)
u_z = pnts2clusters((fr.usage), bin_z)
#%u = pnts2clusters(fr.usage, bin);
#%% compute clusters of points, which fall in the same bins of the three
#% histograms.
u_xy = np.array([])
i = 1.
while i<=length(u_x):
u_xy = np.array(np.hstack((u_xy, cellfun(lambda x: intersect(u_x.cell[int(i)-1], x), u_y, 'UniformOutput', false))))
i = i+1.
u_xy[int(cellfun[int('isempty')-1,int(u_xy)-1])-1] = np.array([])
u_xyz = np.array([])
i = 1.
while i<=length(u_xy):
u_xyz = np.array(np.hstack((u_xyz, cellfun(lambda x: intersect(u_xy.cell[int(i)-1], x), u_z, 'UniformOutput', false))))
i = i+1.
u_xyz[int(cellfun[int('isempty')-1,int(u_xyz)-1])-1] = np.array([])
clusterIndx = u_xyz
#%clusterIndx = u;
clusters = cellfun(lambda x: fr.points3D[0:3.,int(x)-1], clusterIndx, 'UniformOutput', false)
if display:
show_clusters(clusters, 0., np.array([]), np.array([]), 1.)
return [clusters, clusterIndx]<file_sep>/src/root/PlaneExtraction/extract_plane_manually.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def extract_plane_manually(pnts):
# Local Variables: normal, pntsIndx, initPlane, pInfo, i, coeff, initIndx, indx, d, dcm_obj, center, plane, fig, w, score, pnts, points
# Function calls: disp, plot_3Dpoints, princomp, set, datacursormode, figure, getCursorInfo, extract_plane_manually, close, mean, input, waitforbuttonpress, size
pntsIndx = np.array(np.hstack((np.arange(1., (matcompat.size(pnts, 2.))+1))))
fig = plt.figure
fig = plot_3Dpoints(pnts, 'k', fig, 0.3)
dcm_obj = datacursormode(fig)
np.disp('Select 4 points determing the corners of the plane.')
input('Press enter if ready.')
initIndx = np.array([])
i = 1.
while i<=4.:
set(dcm_obj, 'Enable', 'on')
plt.figure(fig)
w = waitforbuttonpress
pInfo = getCursorInfo(dcm_obj)
initIndx = np.array(np.hstack((initIndx, pInfo.DataIndex)))
fig = plot_3Dpoints(pnts[0:3.,int((pInfo.DataIndex))-1], 'r', fig)
i = i+1.
initPlane.points = pnts[0:3.,int(initIndx)-1]
initPlane.indx = initIndx
[coeff, score] = princomp(initPlane.points.conj().T)
initPlane.normal = coeff[:,2]
initPlane.d = np.dot(initPlane.normal.conj().T, np.mean((initPlane.points), 2.))
initPlane.points = initPlane.points-np.dot(initPlane.normal, score[:,2].conj().T)
initPlane.center = np.mean((initPlane.points), 2.)
plane = initPlane
plt.close(fig)
#%initPlane.radius = max(sqrt(sum( ...
#% (initPlane.points - repmat(initPlane.center,1,size(initPlane.points,2))).^2)));
#%indx = compute_pntsINrect(pnts, initPlane);
#%
#%clf(fig);
#%fig = plot_3Dpoints(pnts(1:3,:), 'k', fig, 0.3);
#%fig = plot_3Dpoints(pnts(1:3,indx), 'y', fig);
#% dev = initPlane.normal'*pnts - initPlane.d;
#% projPnts = pnts - initPlane.normal * dev;
#%
#% dis = sqrt(sum((projPnts - repmat(initPlane.center, 1, size(projPnts,2))).^2));
#%
#% planeIndx = find(dis <= initPlane.radius & abs(dev) < 100);
#% restIndx = pntsIndx;
#% restIndx(planeIndx) = [];
#%
#% clf(fig);
#% fig = plot_3Dpoints(pnts(:,restIndx), 'k', fig, 0.3);
#% fig = plot_3Dpoints(pnts(:, planeIndx), 'y', fig);
#%
#% disp('Click on all points which should be removed.');
#% disp('If you are ready enter press a key!');
#%
#% rmvIndx = [];
#% while(1)
#%
#% set(dcm_obj, 'Enable', 'on');
#% figure(fig);
#%
#% w = waitforbuttonpress;
#%
#% if(w) break; end
#%
#% pInfo = getCursorInfo(dcm_obj);
#%
#% rmvIndx = [rmvIndx pInfo.DataIndex];
#% fig = plot_3Dpoints(pnts(:,pInfo.DataIndex), 'c', fig);
#%
#% end
#%
#% rmvIndx
return [plane]<file_sep>/src/root/Preprocessing/backprojection_fast.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def backprojection_fast(fr, camType):
np.disp('backprojection_fast ...')
# Local Variables: fr, tScale, y, points3D_org, i, camType, dLocal, zLocal, xLocal, yLocal, x, z, points3D, frame
# Function calls: zeros, ones, backprojection_fast, sqrt, reshape
#%frame = backprojection_fast(fr, camType)
frame = fr
xLocal = np.zeros(((camType.width), (camType.height)))#zgodne
yLocal = np.zeros(((camType.width), (camType.height)))#zgodne
zLocal = np.ones(((1,(camType.height * camType.width))))*camType.focalLength#zgodne
#print len(xLocal), len(yLocal), len(zLocal)
#print camType.focalLength
#print zLocal
#zLocal[int(np.arange(camType.height*camType.width))] = camType.focalLength
dLocal = np.zeros(1, np.dot(camType.height, camType.width))
tScale = np.zeros(1, np.dot(camType.height, camType.width))
i = 2
while i<=camType.width:
xLocal[int(i)-1,:] = i-1.
i = i+1.
i = 2
#np.savetxt('xLocal.txt', xLocal, delimiter='\n', newline='\n')#zgodne
while i<=camType.height:
yLocal[:,int(i)-1] = i-1.
i = i+1.
#np.savetxt('yLocal.txt', yLocal, delimiter='\n', newline='\n') #zgodne
xLocal = np.reshape(xLocal.conj().T, (1, np.dot(camType.width, camType.height)))
#np.savetxt('xLocal_res.txt', xLocal, delimiter='\n', newline='\n') #zgodne
yLocal = np.reshape(yLocal.conj().T, (1, np.dot(camType.width, camType.height)))
#np.savetxt('yLocal_res.txt', yLocal, delimiter='\n', newline='\n') #zgodne
xLocal = xLocal-camType.principalPoint[0]
xLocal = np.dot(camType.pixelWidth, xLocal)
#np.savetxt('xLocal.txt', xLocal, delimiter='\n', newline='\n') #zgodne
yLocal = yLocal-camType.principalPoint[1]
yLocal = np.dot(np.dot(-1., camType.pixelHeight), yLocal)
#np.savetxt('yLocal.txt', yLocal, delimiter='\n', newline='\n') #zgodne
#print xLocal[0][13308], yLocal[0][13308], zLocal[0][13308]
dLocal = np.sqrt((np.power(xLocal,2)+np.power(yLocal,2)+np.power(zLocal,2)))
#np.savetxt('dLocal_backprojection.txt', dLocal, delimiter='\n', newline='\n') #zgodne
#for x in range(0,23444):
# if dLocal[0][x] == 0:
# print x
#np.savetxt('dLocal', dLocal)
#print frame.distances
#print frame.distances
#print len(frame.distances[0])
#print frame.distances.size
#print dLocal.size
tScale = frame.distances/dLocal
x = tScale*xLocal
#np.savetxt('x.txt', x, delimiter='\n', newline='\n') # zgodne
y = tScale*yLocal
#np.savetxt('y.txt', y, delimiter='\n', newline='\n') # zgodne
z = tScale*zLocal
#np.savetxt('z.txt', z, delimiter='\n', newline='\n') # zgodne
frame.points3D = np.array(np.vstack((np.hstack((x)), np.hstack((y)), np.hstack((z)), np.hstack((np.ones((1, np.dot(camType.height, camType.width))))))))
#np.savetxt('frame.points3D.txt', frame.points3D, delimiter='\n', newline='\n')
#np.savetxt('frame.points3D[0].txt', frame.points3D[0], delimiter='\n', newline='\n') # zgodne
#np.savetxt('frame.points3D[1].txt', frame.points3D[1], delimiter='\n', newline='\n')# zgodne
#np.savetxt('frame.points3D[2].txt', frame.points3D[2], delimiter='\n', newline='\n')# zgodne
#np.savetxt('frame.points3D[3].txt', frame.points3D[3], delimiter='\n', newline='\n')# zgodne
frame.points3D_org = np.array(np.vstack((np.hstack((x)), np.hstack((y)), np.hstack((z)), np.hstack((np.ones((1, np.dot(camType.height, camType.width))))))))
#np.savetxt('frame.points3D_org.txt', frame.points3D_org, delimiter='\n', newline='\n')
#np.savetxt('frame.points3D_org[0].txt', frame.points3D_org[0], delimiter='\n', newline='\n')# zgodne
#np.savetxt('frame.points3D_org[1].txt', frame.points3D_org[1], delimiter='\n', newline='\n')# zgodne
#np.savetxt('frame.points3D_org[2].txt', frame.points3D_org[2], delimiter='\n', newline='\n')# zgodne
#np.savetxt('frame.points3D_org[3].txt', frame.points3D_org[3], delimiter='\n', newline='\n')# zgodne
return frame<file_sep>/src/root/PlaneExtraction/pnts2plane_classification_RANSAC.py
import numpy as np
import scipy
import matcompat
from root.Utilities.random_positions import random_positions
from root.PlaneExtraction.princomp import princomp
from cluster2plane import cluster2plane
def pnts2plane_classification_RANSAC(fr=None, cam=None, display=False):
np.disp(('Trwa wykonywanie: pnts2plane_classification_RANSAC'))
#% [planes, plIndx, patches, rest, restIndx] = pnts2plane_classification_RANSAC(fr, cam, display)
#
# This implementation uses the fact that points determine a bigger plane
# depending on the own normal
# Nie uzywane raczej bo powinny byc wszystkie pola!
#if not isstruct(fr):
# pnts = fr
# op = generate_oriented_particles(pnts)
# normals = op.normal
# deviation = op.dev
#else:
# if (not isfield(fr, mstring('normals'))):
# seq.frames = fr
# seq.camType = cam
# seq = preprocessing(seq, mstring('normals'))
# fr = seq.frames
pnts = fr.points3D
normals = fr.normals
deviation = fr.dev
usage = fr.usage
#% classify if points are planar or not:
thres_dev = np.mean(deviation) + np.std(deviation)
planarIndx = np.nonzero((deviation <= thres_dev)) #Swissranger
notPlanarIndx = np.nonzero((deviation > thres_dev)) #Swissranger
#planarIndx = planarIndx(ismember(planarIndx, usage))
u = np.in1d(planarIndx, usage)#moze plind[1] sprawdzic przy debugu
u = u*1
#print u
#print len(u)
#print len(frame.usage[1])
temp=[]
for it in range(len(planarIndx)):
if u[it] == 1:
temp.append(planarIndx[it])
planarIndx=temp
#notPlanarIndx = notPlanarIndx(ismember(notPlanarIndx, usage))
wu = np.in1d(planarIndx, usage)#moze plind[1] sprawdzic przy debugu
wu = wu*1
#print u
#print len(u)
#print len(frame.usage[1])
temp=[]
for it in range(len(notPlanarIndx)):
if wu[it] == 1:
temp.append(notPlanarIndx[it])
notPlanarIndx=temp
allIndx = planarIndx
#rest = pnts(mslice[1:3], notPlanarIndx)
temp=np.zeros((3, len(notPlanarIndx)))
for it in range(0,3):
for it2 in range(len(notPlanarIndx)):
temp[it][it2]=pnts[it][notPlanarIndx[it2]-1]
#temp.append(pnts[it][ngbIndx[it2]])
notPlanarIndx=temp
restIndx = notPlanarIndx
#% RANSAC-parameters:
maxIter = 40
minIn = 30
inlierIndx = []
bench_ang = []
bench_dis = []
n = []
planes = []
plIndx = []
ln = len(allIndx)
#% main loop:
counter = 0
while (counter > maxIter):
counter = 0
n = np.size(allIndx, 2)
tIn = 0.9 * n
inlierIndx = []
bench_ang = []
bench_dis = []
while (counter > maxIter):
# select randomly one point with normal
pos = random_positions(1, n)
currNormal = normals[:, allIndx(pos)]
#currPnt = pnts(mslice[1:3], allIndx(pos))
temp=np.zeros((3, len(allIndx(pos))))
for it in range(0,3):
for it2 in range(len(allIndx(pos))):
temp[it][it2]=pnts[it][allIndx(pos)[it2]-1]
#temp.append(pnts[it][ngbIndx[it2]])
currPnt=temp
currD = currNormal.cT * currPnt
angles = np.arccos((currNormal.cT * (normals[:, allIndx]))) #acos z matlaba
f = np.nonzero((angles > np.pi / 2))
angles(f).lvalue = np.pi - angles(f)
in1 = np.nonzero((angles < (4 / 18 * np.pi)))
#dis = abs(currNormal.cT * mcat([pnts(mslice[1:3], allIndx)]) - currD)
temp=np.zeros((3, len(allIndx)))
for it in range(0,3):
for it2 in range(len(allIndx)):
temp[it][it2]=pnts[it][allIndx[it2]-1]
dis = abs(currNormal.cT *temp - currD)
in2 = np.nonzero((dis < 100))
_in = np.intersect1d(in1, in2)
if (len(_in) < minIn):
counter = counter + 1
else:
temp3=np.zeros((3, len(allIndx(_in)).cT))
for it in range(0,3):
for it2 in range(len(allIndx(_in)).cT):
temp3[it][it2]=pnts[it][allIndx(_in).cT[it2]-1]
#temp.append(pnts[it][ngbIndx[it2]])
[coeff, score, roots] = princomp(temp3) #[coeff, score, roots] = princomp(pnts(mslice[1:3], allIndx(_in)).cT)
if (len(_in) > tIn):
inlierIndx = allIndx(_in)
bench_dis = sum(abs(score[3,:]))
bench_ang = sum(angles(_in))
if (len(_in) == len(inlierIndx)):
if (sum(abs(score[3,:]))) < bench_dis and sum(angles(_in)) < bench_ang:
inlierIndx = allIndx(_in)
bench_dis = sum(abs(score[3,:]))
bench_ang = sum(angles(_in))
elif (len(_in) > len(inlierIndx)):
inlierIndx = allIndx(_in)
bench_dis = sum(abs(score[3,:]))
bench_ang = sum(angles(_in))
counter = counter + 1
#disp(['counter: ' num2str(counter) '; size: ' num2str(length(inlierIndx))]);
[i, ia, ib] = np.intersect1d(allIndx, inlierIndx)
allIndx(ia).lvalue = []
#disp(['rest: ' num2str(length(allIndx))]);
#currPlanes = mcellarray([pnts(mslice[1:3], inlierIndx)])
temp2=np.zeros((3, len(inlierIndx)))
for it in range(0,3):
for it2 in range(len(inlierIndx)):
temp[it][it2]=pnts[it][inlierIndx[it2]-1]
#temp.append(pnts[it][ngbIndx[it2]])
currPlanes=temp2
planes = [planes, currPlanes]
plIndx = [plIndx(inlierIndx)]
#j = j+1;
restIndx = [restIndx, allIndx]
#rest = pnts(mslice[1:3], restIndx)
temp=np.zeros((3, len(restIndx)))
for it in range(0,3):
for it2 in range(len(restIndx)):
temp[it][it2]=pnts[it][restIndx[it2]-1]
#temp.append(pnts[it][ngbIndx[it2]])
rest=temp
[patches, r, rIndx] = cluster2plane(planes, plIndx)
rest = [rest, r]
restIndx = [restIndx, rIndx]
#
# if (display):
# fig = show_clusters(mcellarray([patches.pnts]), 0, [])
# fig = plot_3Dpoints(rest, mstring('k'), fig, 4)
<file_sep>/src/root/IO/srdat2frame.py
import numpy as np
import scipy
import matcompat
import root.Preprocessing.projection as pro
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def srdat2frame(srMatrix, camType):
# Local Variables: amplitudes, points3D_org, points3D, frame, srMatrix, amp, y, x, z, camType
# Function calls: reshape, ones, srdat2frame, struct, projection
class my_frame:
distances = []
intensities = []
amplitudes = []
points3D = []
points3D_org = []
usage = []
indx8= []
frame = my_frame()
z = 1000.*srMatrix[0:camType.height,:]
#np.disp(np.size(z,0))
#np.disp(np.size(z,1))
#%z = z(:,end:-1:1);
w = np.size(z,0)*(np.size(z,1))
#np.disp(w)
z = np.reshape(z, (1, w))
#np.savetxt('z.txt', z, delimiter=' ', newline=' ')
x = 1000.*srMatrix[int(camType.height+1.)-1:2*camType.height,:]
#%x = x(:,end:-1:1);
w = np.size(x,0)*(np.size(x,1))
#np.disp(w)
x = np.reshape(x, (1, w))
y = 1000.*srMatrix[int(2.*camType.height+1.)-1:3*camType.height,:]
#%y = y(:,end:-1:1);
w = np.size(y,0)*(np.size(y,1))
#np.disp(w)
y = np.reshape(y, (1, w))
amp = srMatrix[int(3.*camType.height+1.)-1:4*camType.height,:]
#np.savetxt('amp.txt', amp, delimiter=' ', newline=' ')
w = np.size(amp,0)*(np.size(amp,1))
#np.disp(w)
amp = np.reshape(amp, (1, w))
#np.savetxt('amp2.txt', amp, delimiter=' ', newline=' ')
frame.amplitudes = amp
#np.disp(amp)
#% The Swissranger delivers the data in a right handed coordinate system
#% with the first pixel being in the top-left corner. (-> positive x-values
#% to the left)
#% I prefer a left handed system with positive x-values to the right,
#% therefore the sign of the x-values have to be switched.
#% Warning: As MatLab uses a right-handed system the data has to be mirrored
#% again in plot_3Dpoints for displaying
frame.points3D = np.array(np.vstack((np.hstack((-x)), np.hstack((y)), np.hstack((z)), np.hstack((np.ones(w, dtype=np.int))))))
frame.points3D_org = frame.points3D
#% if(size(srMatrix,1) > 4*camType.height)
#% u = srMatrix((4*camType.height+1):(5*camType.height),:);
#% u = reshape(u',1,[]);
#% frame.usage = find(u == 1);
#% else
#% frame.usage = 1:1:(camType.width*camType.height);
#% end
#%
#% if(size(srMatrix,1) > 5*camType.height)
#% nX = srMatrix((5*camType.height+1):(6*camType.height),:);
#% nX = reshape(nX',1,[]);
#% nY = srMatrix((6*camType.height+1):(7*camType.height),:);
#% nY = reshape(nY',1,[]);
#% nZ = srMatrix((7*camType.height+1):(8*camType.height),:);
#% nZ = reshape(nZ',1,[]);
#% frame.normals = [nX; nY; nZ];
#% frame.planar = frame.usage;
#% frame.notplanar = find(u == 0);
#%
#% i = 1 : camType.width*camType.height;
#% pos = reshape(i, camType.width, [])';
#% i = mat2cell(i, 1, ones(1, camType.width*camType.height));
#% indx = cellfun(@(x)(getNgbIndx(x, camType.width, camType.height, 3, true, pos)), i, 'UniformOutput', false);
#% frame = setfield(frame, 'indx8', indx);
#%
#% end
frame = pro.projection(frame, camType)
#np.disp(frame.amplitudes)
#np.disp(amp)
return frame<file_sep>/src/root/Preprocessing/copy_NgbIndx.py
import sys
import numpy as np
import scipy
import matcompat
from root.PlaneExtraction.local_plane_patches import local_plane_patches
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def copy_NgbIndx(fr, ind):
np.disp('copy_NgbIndx ...')
# Local Variables: fr, d, notplanar, planarIndx, h, camType, planar, dev, thres_dev, w, normals, notPlanarIndx, frame
# Function calls: std, local_plane_patches, compute_normals, ismember, find, mean
#%% frame = compute_normals(fr, camType)
frame = fr
indx8=ind
frame.indx8 = indx8
return frame<file_sep>/src/root/Visualization/plot_3Dpoints.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def plot_3Dpoints(pnts=None, color=None, fig=None, msize=None, marker=None, values=None):
#% fig = plot_3Dpoints(pnts, color, fig, msize)
# - -
# |p11 p21 p31 |
# pnts = |p12 p22 p32 ... |
# |p13 p23 p33 |
# - -
#
# color: 'r', 'g', 'b', 'c', 'm', 'y', 'k', 'w', 'jet', 'copper', 'bone'
#
# fig: handle for a specific figure
#
# msize: size of the marker of the 3D points
if (nargin < 2):
color = mstring('jet')
end
if (nargin < 3 or isempty(fig)):
fig = figure
axis("equal")
set(fig, mstring('Name'), mstring('3D point cloud'))
else:
fig = figure(fig)
axis(mstring('equal'))
end
if (nargin < 4 or isempty(msize)):
msize = 4
end
if (nargin < 5):
marker = mstring('.')
end
if (nargin < 6):
values = pnts(3, mslice[:])
end
hold(mstring('on'))
axis(mstring('off'))
axis(mstring('equal'))
if (isempty(pnts)):
fig = figure(fig); print fig
return
end
X = pnts(1, mslice[:])
Y = pnts(2, mslice[:])
Z = -1 * pnts(3, mslice[:])
mi = min(values)
ma = max(values)
if (logical_or(strcmp(color, mstring('jet')), logical_or(strcmp(color, mstring('copper')), strcmp(color, mstring('bone'))))):
# whitebg('w');
#mi = 0;
#ma = 7500;
map = colormap(color)
if (strcmp(color, mstring('bone'))):
map = map(mslice[end:-1:1], mslice[:])
end
steps = length(map) - 1
range = (ma - mi)
p = mcat([])
i = 1
tdown = mi
tup = mi + i / steps * range
while (i <= steps):
p = find(values >= logical_and(tdown, values <= tup))
plot3(X(p), Y(p), Z(p), marker, mstring('Color'), map(i, mslice[:]), mstring('MarkerSize'), msize)
i = i + 1
tdown = tup
tup = mi + i / steps * range
end
p = find(values > tup)
plot3(X(p), Y(p), Z(p), marker, mstring('Color'), map(end, mslice[:]), mstring('MarkerSize'), msize)
#nieskonwertowana czesc
elseif(~isstr(color))
# whitebg('w');
if (size(color, 1) > 1):
i = 1
while (i <= size(pnts, 2)):
plot3(X(i), Y(i), Z(i), marker, mstring('Color'), color(i, mslice[:]), mstring('MarkerSize'), msize)
i = i + 1
end
else
plot3(X,Y,Z, marker, 'Color', color, 'MarkerSize', msize);
end
else
% whitebg('w');
plot3(X,Y,Z, [marker color], 'MarkerSize', msize);
end
figure(fig);
hold off;<file_sep>/src/root/PlaneExtraction/local_plane_patches.py
import sys
import numpy as np
import scipy
import matcompat
from root.Utilities.getNgbIndx import getNgbIndx
from root.PlaneExtraction.princomp import princomp
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def local_plane_patches(pnts, width, height, usage, neighborhood, woCenter=False):
np.disp('local_plane_patches ...')
# Local Variables: neighborhood, pos, height, meanPnt, pnts, roots, ngbIndx, width, score, vec, usage, deviation, currIndx, ngbPnts, d, i, woCenter, coeff, l, normals, y, x, z
# Function calls: princomp, false, local_plane_patches, reshape, sum, getNgbIndx, nargin, length, abs, zeros, ismember, mean
#%% [normals, deviation] = local_plane_patches(pnts, width, height, usage, neighborhood, woCenter)
#%
#% compute for each point its normal using a certain neighborhood of points
#%% initialize same values:
#print 'pnts', pnts.size, len(pnts), len(pnts[0])
deviation = np.zeros((1, height* width))
d = np.zeros((1, height* width))
deviation=deviation[0]
d=d[0]
pos = np.arange(1, (len(pnts[0])+1))
#np.savetxt('pos.txt', pos, delimiter='\n', newline='\n')
#print 'pos', len (pos),
# pos w matlabie ma 144 x 176... przed resize 1 x 25344
#pos to zmienna o wymaireze 1x 25344 z wartosciami od 1 do 25344.
pos = np.reshape(pos, (height,width)).conj().T #zmiana 27.12 zamiana width z heinght
x = np.zeros((1, height * width))
y = np.zeros((1, height * width))
z = np.zeros((1, height * width))
x=x[0]
y=y[0]
z=z[0]
#%% normal computation:
#% Compute for each point its normal based on points of any surrounding
#% neighborhood
#usage jest blednie liczone! wrocic wyzej
i = 1
#print 'lenusage', len(usage[0]), usage[0]
while i<len(usage):
currIndx = usage[int(i)]#tu musi byc od normalnego i
#print 'currIndx', currIndx
#sys.exit("Error message")
#print 'usage', usage.size, usage
#print 'currINDX', currIndx.size, currIndx
ngbIndx = getNgbIndx(currIndx, width, height, neighborhood, woCenter, pos) #zmiana 27.12 zamiana width z heinght
#print 'ngbIndx',ngbIndx, 'size', ngbIndx.size, 'len', len(ngbIndx)
#print 'ngbIndx',ngbIndx, 'size', ngbIndx.size, 'len', len(ngbIndx)
#np.savetxt('usage.txt', usage, delimiter='\n', newline='\n')
u = np.in1d(ngbIndx, usage)
u = u*1
#print 'u',u
#print u
#print len(u)
#print len(frame.usage[1])
temp=[]
for it in range(len(ngbIndx)):
if u[it] == 1:
temp.append(ngbIndx[it])
ngbIndx=temp
#ngbIndx = ngbIndx[np.in1d(ngbIndx, usage)]
#print 'ngbIndx',ngbIndx
#print 'ngbIndx', ngbIndx.size, len(ngbIndx), ngbIndx
l = len(ngbIndx)
#print 'l', l
#porownac pnts po kolejnych wierszach/kolumnach
temp=np.zeros((3, len(ngbIndx)))
#print 'pnts', len(pnts), pnts.size
#np.savetxt('pnts[0].txt', pnts[0], delimiter='\n', newline='\n')
for it in range(0,3):
for it2 in range(len(ngbIndx)):
temp[it][it2]=pnts[it][ngbIndx[it2]-1]
#temp.append(pnts[it][ngbIndx[it2]])
ngbPnts=temp
#print 'ngbPnts', len(ngbPnts), ngbPnts
meanPnt = (np.sum(ngbPnts, axis=1)/l)
#print 'meanPnt', meanPnt
#Do tego momentu zgodnosc wartosci, mozliwe ze mean pt jest w poziomie zamiast w pionie
#%ngbPnts = [ngbPnts(1,:) - meanPnt(1); ngbPnts(2,:) - meanPnt(2); ...
#% ngbPnts(3,:) - meanPnt(3)];
#%cov = ngbPnts * ngbPnts';
#%[vec, val] = eig(cov);
#%[mi, in] = min([val(1,1) val(2,2) val(3,3)]);
#%x(currIndx) = vec(1, in);
#%y(currIndx) = vec(2, in);
#%z(currIndx) = vec(3, in);
#%deviation(currIndx) = mi;
#%d(currIndx) = vec(:, in)' * meanPnt;
#% slower in computation -> question: better results? no?!
[coeff, score, roots] = princomp(ngbPnts.conj().T)
#print 'coeff', coeff # zamieniona druga z trzecia kolumna
#print 'score', score #[2,:] #w drugim musze sie odwolac do 2,: zeby bylo ok, jakies cujowe sortowanie
vec = coeff[:,1]
#print 'vec', vec
#print x.size
x[int(currIndx)-1] = vec[0] #zgodna wartosc
#print 'x', x[int(currIndx)-1]
y[int(currIndx)-1] = vec[1] #zgodna wartosc
#print 'y', y[int(currIndx)-1]
z[int(currIndx)-1] = vec[2] #zgodna wartosc
#print 'z', z[int(currIndx)-1]
#print 'deviation', deviation
deviation[int(currIndx)-1]=np.mean(np.abs(score[0,:])) # matlab sortuje SCORE, TA METODA NIE
for w in range(0, 3):
temp2=np.mean(np.abs(score[w,:]))
if temp2 < deviation[int(currIndx)-1]:
deviation[int(currIndx)-1]=temp2
#deviation[int(currIndx)-1] = np.mean(np.abs(score[2,:])) #zgodna wartosc
#print 'deviation[int(currIndx)-1]', deviation[int(currIndx)-1] #
#sys.exit("Debug break") #- do tego miejsca dociera kod!
d[int(currIndx)-1] = np.dot(vec.conj().T, meanPnt)
i = i+1.
normals = np.array(np.vstack((np.hstack((x)), np.hstack((y)), np.hstack((z)))))
return [normals, d, deviation]<file_sep>/src/root/Preprocessing/projection.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def projection(fr, camType):
# Local Variables: distances, fr, tScale, zLocal, i, camType, dLocal, yLocal, xLocal, Y, X, Z, frame
# Function calls: reshape, zeros, projection, sqrt
#%frame = projection(fr, camType)
frame = fr
X = fr.points3D[0,:]
Y = fr.points3D[1,:]
Z = fr.points3D[2,:]
xLocal = np.zeros(((camType.height), (camType.width)))
yLocal = np.zeros(((camType.height), (camType.width)))
zLocal = np.zeros(((camType.height), (camType.width)))
zLocal [0:np.dot(camType.height, camType.width)] = camType.focalLength
#zLocal= camType.focalLength #change here from zLocal [0:np.dot(camType.height, camType.width)] = camType.focalLength need verification
dLocal = np.zeros(np.dot(camType.height, camType.width))
tScale = np.zeros(np.dot(camType.height, camType.width))
i = 2.
while i<=camType.width:
xLocal[:,int(i)-1] = i-1.
i = i+1.
i = 2.
while i<=camType.height:
yLocal[int(i)-1,:] = i-1.
i = i+1.
xLocal = np.reshape(xLocal, (1, np.dot(camType.width, camType.height)))
yLocal = np.reshape(yLocal, (1, np.dot(camType.width, camType.height)))
zLocal = np.reshape(zLocal, (1, np.dot(camType.width, camType.height)))
xLocal = xLocal-camType.principalPoint[0]
xLocal = np.dot(camType.pixelWidth, xLocal)
yLocal = yLocal-camType.principalPoint[1]
yLocal = np.dot(np.dot(-1., camType.pixelHeight), yLocal)
dLocal = np.sqrt((xLocal**2.+yLocal**2.+zLocal**2.))
#np.savetxt('dLocal.txt', dLocal[0],delimiter='\n', newline='\n')
tScale = fr.points3D_org[2,:]/zLocal
#np.savetxt('tScale.txt', tScale[0], delimiter='\n', newline='\n')
frame.distances = dLocal[0]*tScale[0]
#np.savetxt('frame.distances_from_projection.txt', frame.distances, delimiter='\n', newline='\n')
#print frame.distances
return frame<file_sep>/src/root/PlaneExtraction/voxel_plane_patches.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def voxel_plane_patches(voxel, vList, nbrVoxel):
# Local Variables: deviation, voxel, curr, d, ngb, cov, i, in, mi, l, n, y, nbrVoxel, ngbPnts, meanPnt, vec, normals, val, x, z, vList
# Function calls: currIndx, eig, voxel_plane_patches, sum, find_voxel_neigbors, length, min, ismember, repmat, find, size
#%% [normal, d deviation] = voxel_plane_patches(pnts, ngh)
return [normals, d, deviation]<file_sep>/src/root/Utilities/get_angle.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def get_angle(n1, n2):
# Local Variables: n1, n2, angle
# Function calls: acos, pi, get_angle
#% angle = get_angle(n1, n2)
angle = np.arccos(np.dot(n1.conj().T, n2))
if angle > np.pi/2.:
angle = np.pi-angle
return [angle]<file_sep>/src/root/PlaneExtraction/frame_decompostion.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def frame_decompostion(frame, camType):
# Local Variables: frame, colorstep, bwDis, ni, uRest, regions, maxi, fig, ns, camType, map, imDis, scrsz, plane, regionsVec, d, i, n, p, s, points, ui, se, planes, bins
# Function calls: figure, strel, imdilate, ismember, frame_decompostion, find, struct, reshape, imshow, mod, sort, plot_3Dpoints, colormap, get, max, main_plane_extraction, region_growing, length, edge, histc, imerode, round
#% regions = frame_decomposition(frame)
scrsz = plt.get(0., 'ScreenSize')
se = strel('square', 5.)
imDis = np.reshape((frame.points3D_org[2,:]), (camType.width), np.array([])).conj().T
plt.figure('Position', np.array(np.hstack((1., scrsz[3]/2., scrsz[2]/2., scrsz[3]/2.))))
plt.imshow(imDis, np.array([]))
imDis = imerode(imdilate(imDis, se), se)
bwDis = edge(imDis, 'canny')
bwDis = imerode(imdilate(bwDis, se), se)
regions = region_growing(bwDis)
regionsVec = np.reshape(regions.conj().T, 1., np.array([]))
bins = np.arange(-2., (matcompat.max(matcompat.max(regions)))+(1.), 1.)
n = histc(regionsVec, bins)
n = n[3:]
[ns, ni] = np.sort(n, 'descend')
uRest = frame.usage
plane = struct('points', np.array([]), 'n', np.array(np.vstack((np.hstack((0.)), np.hstack((0.)), np.hstack((0.))))), 'd', 0.)
planes = np.array([])
fig = plt.figure('Position', np.array(np.hstack((1., 1., scrsz[2]/2., scrsz[3]/2.))))
map = colormap('jet')
i = 1.
while i<=6.:
if i<=length(ni):
maxi = ni[int(i)-1]
ui = nonzero((regionsVec == maxi))
ui = ui[int(ismember(ui, (frame.usage)))-1]
uRest[int(ismember[int(uRest)-1,int(ui)-1])-1] = np.array([])
s.cell[int(i)-1] = frame.points3D_org[0:3.,int(ui)-1]
[p, n, d] = main_plane_extraction(s.cell[int(i)-1])
plane.points = s.cell[int(i)-1,:,int(p)-1]()
plane.n = n
plane.d = d
planes = np.array(np.hstack((planes, plane)))
ui[int(p)-1] = np.array([])
uRest = np.array(np.hstack((uRest, ui)))
#%fig = plot_3Dpoints(plane.points, map(mod(1 + (i-1)*5, length(map)), :), fig);
i = i+1.
i = 1.
colorstep = np.round(matdiv(length(map), length(planes)))
while i<=length(planes):
fig = plot_3Dpoints((planes[int(i)-1].points), map[int(np.mod((65.-np.dot(i-1., colorstep)), length(map)))-1,:], fig)
i = i+1.
fig = plot_3Dpoints((frame.points3D_org[0:3.,int(uRest)-1]), 'k', fig)
#% max1 = ni(1);
#% max2 = ni(2);
#% max3 = ni(3);
#% max4 = ni(4);
#%
#% u1 = find(regionsVec == max1);
#% u2 = find(regionsVec == max2);
#% u3 = find(regionsVec == max3);
#% u4 = find(regionsVec == max4);
#%
#% u1 = u1(ismember(u1, frame.usage));
#% u2 = u2(ismember(u2, frame.usage));
#% u3 = u3(ismember(u3, frame.usage));
#% u4 = u4(ismember(u4, frame.usage));
#%
#% uRest = frame.usage;
#% uRest(ismember(uRest, u1)) = [];
#% uRest(ismember(uRest, u2)) = [];
#% uRest(ismember(uRest, u3)) = [];
#% uRest(ismember(uRest, u4)) = [];
#%
#% s1 = frame.points3D_org(1:3, u1);
#% [p1, n1, d1] = main_plane_extraction(s1);
#% p1Rest = 1:1:length(s1);
#% p1Rest(ismember(p1Rest, p1)) = [];
#%
#% s2 = frame.points3D_org(1:3, u2);
#% [p2, n2, d2] = main_plane_extraction(s2);
#% p2Rest = 1:1:length(s2);
#% p2Rest(ismember(p2Rest, p2)) = [];
#%
#% s3 = frame.points3D_org(1:3, u3);
#% [p3, n3, d3] = main_plane_extraction(s3);
#% p3Rest = 1:1:length(s3);
#% p3Rest(ismember(p3Rest, p3)) = [];
#%
#% s4 = frame.points3D_org(1:3, u4);
#% [p4, n4, d4] = main_plane_extraction(s4);
#% p4Rest = 1:1:length(s4);
#% p4Rest(ismember(p4Rest, p4)) = [];
#% s4 = frame.points3D_org(1:3, uRest);
#% [p4, n4, d4] = main_plane_extraction(s4);
#% p4Rest = 1:1:length(s4);
#% p4Rest(ismember(p4Rest, p4)) = [];
#% s1plane = s1(:, p1);
#% s2plane = s2(:, p2);
#% s3plane = s3(:, p3);
#% s4plane = s4(:, p4);
#% s1Rest = s1(:, p1Rest);
#% s2Rest = s2(:, p2Rest);
#% s3Rest = s3(:, p3Rest);
#% s4Rest = s4(:, p4Rest);
#% sRest = [s1(:, p1Rest) s2(:, p2Rest) s3(:, p3Rest) s4(:,p4Rest)];
#%
#% fig1 = plot_3Dpoints(s1plane, 'r');
#% fig1 = plot_3Dpoints(s1Rest, 'k', fig1);
#% fig2 = plot_3Dpoints(s2plane, 'g');
#% fig2 = plot_3Dpoints(s2Rest, 'k', fig2);
#% fig3 = plot_3Dpoints(s3plane, 'b');
#% fig3 = plot_3Dpoints(s3Rest, 'k', fig3);
#% fig4 = plot_3Dpoints(s4plane, 'y');
#% fig4 = plot_3Dpoints(s4Rest, 'k', fig4);
#%
#% fig = plot_3Dpoints(s1plane, 'r');
#% fig = plot_3Dpoints(s2plane, 'g', fig);
#% fig = plot_3Dpoints(s3plane, 'b', fig);
#% fig = plot_3Dpoints(s4plane, 'y', fig);
#% fig = plot_3Dpoints(sRest, 'k', fig);
#% fig = plot_3Dpoints(frame.points3D_org(1:3, u1), 'r');
#% fig = plot_3Dpoints(frame.points3D_org(1:3, u2), 'g', fig);
#% fig = plot_3Dpoints(frame.points3D_org(1:3, u3), 'b', fig);
return [planes]<file_sep>/src/root/IO/save_3Dpoints.py
#Currently not used
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def save_3Dpoints(points3D, filename):
# Local Variables: points3D, n, points, fid, filename
# Function calls: reshape, fclose, length, save_3Dpoints, fprintf, fopen
#% save_3Dpoints(points3D, filename)
#%
#% points3D has to have the following structure:
#% | p1x p2x p3x p4x ... |
#% points 3D = | p1y p2y p3y p4y ... |
#% | p1z p2z p3z p4z ... |
points = points3D
n = matcompat.length(points)
#%transformation of z-values to negative values, because of the display
#%settings of viewer (ptcvis)
points[2,:] = np.dot(points[2,:], -1.)
points = np.reshape(points, 1., (3.*n))
#%points = [camType.height camType.width points];
points = np.array(np.hstack((1., n, points)))
fid = fopen(filename, 'w')
fprintf(fid, '%g ', points)
fclose(fid)
return <file_sep>/src/root/Preprocessing/svd_enhancing.py
import numpy as np
import scipy
import matcompat
from backprojection_fast import backprojection_fast
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def svd_enhancing(fr, camType):
# Local Variables: disNew, fr, distances, camType, gdach, Sdach, pos, neri, S, U, V, frame, neriG
# Function calls: max, gradient, reshape, svd, abs, zeros, diag, backprojection_fast, find, svd_enhancing, mean
#%% frame = svd_enhancing(fr, camType)
#%
#% This function is based on the paper:
#% "SwissRanger SR-3000 Range Images Enhancement by a Singular Value
#% Decomposition Filter"
#% from
#% <NAME> and <NAME>
#%
#% problem: normals needed to be computed => time consuming
#%% build NERI image (Normal-Enhanced Range Image)
neri = np.zeros((camType.height), (camType.width), 3.)
neri[:,:,0] = np.reshape((fr.normals[0,:]), (camType.width), np.array([])).conj().T
neri[:,:,1] = np.reshape((fr.normals[1,:]), (camType.width), np.array([])).conj().T
neri[:,:,2] = np.reshape((fr.distances), (camType.width), np.array([])).conj().T
neriG = np.mean(neri, 3.)
#%% decompose NERI image and determine appropiate threshold
[U, S, V] = plt.svd(neriG)
Sdach = np.diag(S)/max(np.diag(S))
gdach = np.abs(np.gradient(Sdach))
pos = np.nonzero((gdach<0.001))
S[int(pos[0])-1:,int(pos[0])-1:] = 0.
#%% compose new image
disNew = np.dot(np.dot(U, S), V.conj().T)
frame = fr
frame.distances = np.reshape(disNew.conj().T, 1., np.array([]))
frame = backprojection_fast(frame, camType)
return frame<file_sep>/src/root/PlaneExtraction/foreground_background_separation.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def foreground_background_separation(scene):
# Local Variables: backgr, fig, ma, iMax1, nSort, mi, scene, n, iSort, t, tPos, iMax2, z, bins, foregr
# Function calls: sort, plot_3Dpoints, min, max, find, hist, foreground_background_separation, round
#% [foregr, backgr] = foreground_background_separation(scene)
#%
#% find the two z-ranges where most of the points are lying in
#% assumption: in the background a lot of points will have a similar z-value as
#% well as the points in the foreground -> find threshold (somewhere between the
#% two significant z-values) which determines if a point belongs to the
#% foreground or to the background
mi = matcompat.max(scene[2,:])
ma = matcompat.max(scene[2,:])
bins = np.round(((ma-mi)/200.))
[n, z] = plt.hist(scene[2,:], bins)
[nSort, iSort] = np.sort(n)
iMax1 = iSort[int(0)-1]
iMax2 = iSort[int((0-1.))-1]
tPos = np.round(matdiv(np.dot(iMax1, n[int(iMax1)-1])+np.dot(iMax2, n[int(iMax2)-1]), n[int(iMax1)-1]+n[int(iMax2)-1]))
t = z[int(tPos)-1]
foregr = scene[0:3.,nonzero((scene[2,:]<t))]
backgr = scene[0:3.,nonzero((scene[2,:] >= t))]
fig = plot_3Dpoints(foregr, 'b')
fig = plot_3Dpoints(backgr, 'r', fig)
return [foregr, backgr]<file_sep>/src/root/PlaneExtraction/extract_planes.py
import numpy as np
import sys
import scipy
import string
from cluster_through_regions import cluster_through_regions
from pnts2plane_classification_rgrow import pnts2plane_classification_rgrow
from pnts2plane_classification_RANSAC import pnts2plane_classification_RANSAC
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def extract_planes(fr, cam, minSize, method, display=False):
## by <NAME>
# University Bielefeld
# Applied Informatics
# contact: <EMAIL>
#
# [planes, clusters, rest, restIndx] = extract_planes(fr, cam, minSize, method, display)
#
# frame: a struct consisting of distances, amplitudes, points3D, usage,
# normals, ...
# cam: a struct for the camera consisting of focalLength, principalPoint,
# pixelWidth, pixelHeight, ...
# minSize: specify the number points a plane has to consist of at least
# method: specify the method that will be used to form clusters of points within
# the point cloud;
# possible:
# - 'regions' (cluster points lying inside of
# connected edges the socalled regions; a region image is
# realized through computing edges on a distances image)
# -> takes texture into consideration
# - 'normals' (cluster points which have similar normals)
# -> is not a very suitable method
# - 'connectedPnts' (points are connected to their neighbors
# and therefore clustered into the same cluster, when the
# Euclidean distance in 3D between them is smaller than a
# certain threshold)
# -> very good method
# - 'planarClsts' (local planar patches are clustered to the
# same plane cluster depending on a conormality and a
# coplanarity measure)
# -> very good method
# - 'rGrow' is based on region growing using the information of
# local neighborhood. The method proposed by
# <NAME> is used to realize a rough
# segmentation which is refined by RANSAC
# (e.g. extract two walls connected via a
# corner)
## some default values:
np.disp('Extract_planes ...')
# if (method=='histNormals' or method=='histNormals+gmd'):
# pntsNew = position_point_cloud(fr.points3D);
# fr.points3D = pntsNew;
#
rest = []
restIndx = []
# return 0
if(method =='regions'):
[clusters, clusterIndx, rest, restIndx] = cluster_through_regions(fr, cam);
# elif(method== 'normals'):
# # threshold = 30 = 3*pi/18 = 0.5236
# [clusters, clusterIndx] = cluster_through_normals(fr, cam, 0.5236);
# elif(method== 'connectedPnts'):
# camProportion = 0.04 / 8;
# camProportion = 1;
# [clusters, rest, clusterIndx] = cluster_through_connectedPoints(fr);
#clusters = cluster_through_connectedPoints_rgrow(pnts, width, height, camProportion, usage);
elif(method== 'planarClsts'):
[clusters, rest, clusterIndx, restIndx] = pnts2plane_classification_rgrow(fr, cam);
# elif(method== 'rGrow'):
# [clusters, rest, clusterIndx, restIndx] = pnts2plane_classification_rgrowpure(fr, cam);
# elif(method== 'gmd'):
# restIndx = 1:cam.width*cam.height;
# restIndx(fr.usage) = [];
# rest = fr.points3D(1:3,restIndx);
# [clusters, clusterIndx] = cluster_through_gmd(fr.points3D(1:3,fr.usage));
# clusterIndx = cellfun(@(x)(fr.usage(x)), clusterIndx, 'UniformOutput', false);
# elif(method== 'histNormals'):
# rest = [];
# restIndx = [];
# [clusters, clusterIndx] = cluster_through_histNormals(fr, cam);
# elif(method== 'histNormals+gmd'):
# rest = [];
# restIndx = [];
# [cl, clIndx] = cluster_through_histNormals(fr, cam);
# clusters = [];
# clusterIndx = [];
# i = 1;
# while(i <= len(cl))
# [help, indx] = cluster_through_gmd(cl{i});
# orgIndx = clIndx{i};
# helpIndx = cellfun(@(x)(orgIndx(x)), indx, 'UniformOutput', false);
# clusters = [clusters help];
# clusterIndx = [clusterIndx helpIndx];
#
# i = i+1;
#
# elif(method== 'cuefusion'))
# [cl1, cl1Indx] = cluster_through_histNormals(fr, cam);
# [cl2, cl2Indx] = cluster_through_regions(fr, cam);
#
# restIndx = 1:cam.width*cam.height;
# clIndx = [];
# i = 1;
# while( i <= length(cl1Indx) )
#
# j = 1;
# while( j <= length(cl2Indx) )
#
# interIndx = intersect(cl1Indx{i}, cl2Indx{j});
# clIndx = [clIndx {interIndx}];
#
# restIndx(interIndx) = 0;
#
# j = j+1;
#
# end
#
# i = i+1;
#
# end
#
# clusterIndx = clIndx;
# clusters = [];
#
# i = 1;
# while( i <= length(clIndx) )
#
# clusters = [clusters {fr.points3D(1:3, clIndx{i})}];
#
# i = i+1;
#
# end
#
# restIndx(find(restIndx == 0)) = [];
# restIndx = intersect(restIndx, fr.usage);
# rest = fr.points3D(1:3, restIndx);
#
# show_clusters(clusters);
else:
np.disp('Error: Unknown clustering method! Please choose between the regions or the normals method');
# if(display):
# fig = figure;
# fig = show_clusters(clusters, 0, fig, [], [], 1);
# if(~isempty(rest))
# fig = plot_3Dpoints(rest, 'k', fig, 0.3);
# end
# end
inCl = clusters;
inClIndx = clusterIndx;
l = np.size(clusters, 2) #l = cellfun('size', clusters, 2);
lo = np.nonzero((l < minSize)) #lo = find(l < minSize);
rest = [rest, np.concatenate(clusters(lo), axis=2)] #rest = [rest cat(2, clusters{lo})];
restIndx = [restIndx, np.concatenate(clusterIndx(lo), axis=2)] #restIndx = [restIndx cat(2, clusterIndx{lo})];
temp=[]
for it in range(len(lo)): # inCl(lo) = np.array([])
inCl[it]=np.array([])
for it in range(len(lo)): # inClIndx(lo) = np.array([])
inClIndx[it]=np.array([])
planesIndx = inClIndx
## refining the extracted planar cluster using RANSAC
np.disp('Refining the extracted planar cluster using RANSAC');
planes = [];
i = 1;
while i <= len(inCl):
if planesIndx(i).size== 0:
i = i+1;
frame = fr;
frame.usage = planesIndx(i);
#[p, r, rIndx] = plane_segmentation(inCl{i},planesIndx{i});
[cl, clIndx, p, r, rIndx] = pnts2plane_classification_RANSAC(frame, cam);
if p.size== 0 :
rest = [rest. r];
restIndx = [restIndx. rIndx];
i = i+1;
l = np.size(p.pnts, 2) #l = cellfun('size', {p.pnts}, 2);
li = np.nonzero(l >= minSize);
lo = np.nonzero(l < minSize);
planes = [planes, p(li)];
rest = [rest, r, [p(lo).pnts]];
restIndx = [restIndx, rIndx, [p(lo).indx]];
i = i+1;
## assign plane-id
i=1
while i<= len(planes) :
planes(i).id = i
i = i+1
## displaying planes
#if(display):
# fig = figure
# fig = show_clusters({planes.pnts}, 0, fig, [], [], 1)
# if(~isempty(rest)):
# fig = plot_3Dpoints(rest, 'k', fig, 0.3);
# end
return frame<file_sep>/src/root/Preprocessing/edgepoint_removing.py
import sys
import numpy as np
import scipy
import matcompat
from skimage import feature
from skimage.morphology import square
from skimage.morphology import dilation
from numpy import sqrt
from time import sleep
#import matplotlib.pyplot as plt
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def edgepoint_removing(fr, camType):
np.disp('edgepoint_removing ...')
# Local Variables: use, camType, fr, bw, u, usage, frame, se
# Function calls: edgepoint_removing, strel, reshape, imdilate, edge, ismember, find
frame = fr
#test=(np.reshape(fr.distances, (camType.height, camType.width))).conj().T
#np.savetxt('test.txt', test, delimiter='\n', newline='\n')
#usunieta transpozycja, niekoniecznie dobra dla wyniku .conj().T
dismax = np.amax(fr.distances)
#print dismax
bw = feature.canny((np.reshape(fr.distances, (camType.height, camType.width))).conj().T, sigma=np.sqrt(2),low_threshold=0.01*dismax, high_threshold=0.058*dismax)
#np.savetxt('bw.txt', bw, delimiter='\n', newline='\n')
#TYMCZASOWY IMPORT DLA DEBUGA!
bw = np.loadtxt('IC.txt',dtype=float,comments='%',delimiter='\n') #TYMCZASOWY IMPORT DLA DEBUGA!
bw=np.reshape(bw, (camType.width, camType.height)) #TYMCZASOWY IMPORT DLA DEBUGA!
#np.savetxt('bwimport.txt', bw, delimiter='\n', newline='\n')
bw = dilation(bw, square(3))
#bw=bw.conj().T
#plt.imshow(bw)
#plt.show()
bw = np.reshape(bw.conj().T,(1,camType.height*camType.width))
use = np.nonzero((bw == 0))
#np.savetxt('fr.usage[1].txt', fr.usage[1], delimiter='\n', newline='\n') ZGODNE
#np.savetxt('use[1].txt', use[1], delimiter='\n', newline='\n')
u = np.in1d(fr.usage[1], use[1])
u = u*1
#print u
#print len(u)
#print len(frame.usage[1])
temp=[]
for it in range(len(frame.usage[1])):
if u[it] == 1:
temp.append(frame.usage[1][it])
frame.usage=temp
#np.savetxt('frame.usageafter.txt', frame.usage, delimiter='\n', newline='\n')
return frame
#<NAME>. POWODUJE Z<NAME>
<file_sep>/src/root/PlaneExtraction/get4ngb.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def get4ngb(rows, cols, x, y):
# Local Variables: y, x, rows, cols, ngb
# Function calls: get4ngb
#% function ngb = get4ngb(rows,cols,x,y)
#% x = row, y = column
#% This function returns the cooridinates of the 4-neighbours
#% of an element in a matrix. The values are returned in the
#% list ngb. If the neighbour does not exist,- that is (x,y)
#% corredsponds to an edge or corner of the array,
#% the list of neighbours contains only those coordinates corresponding
#% to real neighbours.
#% Copyright <NAME>/FFIE.
#% Handle left edge.
#% Handle upper left corner.
return [ngb]<file_sep>/src/root/Preprocessing/distance_adaptive_median.py
import numpy as np
import scipy
import matcompat
from scipy.signal import medfilt
from time import sleep
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def distance_adaptive_median(dis, camType):
np.disp('distance_adaptive_median ...')
# Local Variables: dismax, distances, dis2, dis3, dis1, u1, camType, t2, dismin, t1, u3, u2, dis
# Function calls: medfilt2, max, min, find, distance_adaptive_median
distances = dis
#print len(dis),len(dis[1]), dis.size
dis1 = medfilt(dis, np.array(np.hstack((7, 7))))
#np.savetxt('dis1.txt', dis1, delimiter='\n', newline='\n') #sa identyczne dla obu
dis2 = medfilt(dis, np.array(np.hstack((5, 5))))
#np.savetxt('dis2.txt', dis2, delimiter='\n', newline='\n') #sa identyczne dla obu
dis3 = medfilt(dis, np.array(np.hstack((3, 3))))
#np.savetxt('dis3.txt', dis3, delimiter='\n', newline='\n') #sa identyczne dla obu
flat_dis1=np.resize(dis1,(1,dis.size))[0]
flat_dis2=np.resize(dis2,(1,dis.size))[0]
flat_dis3=np.resize(dis3,(1,dis.size))[0]
#% t1 = 0;
#% t2 = 0;
#%
#% if(strcmp(camType.name, 'PMD_16x64'))
#% t1 = 884.3;
#% t2 = 1768.6;
#% elseif(strcmp(camType.name, 'PMD_120x160'))
#% t1 = 3000;
#% t2 = 6000;
#% elseif(strcmp(camType.name, 'SR_176x144'))
#% t1 = 3000;
#% t2 = 6000;
#% else
#% display('Unknown camera type.');
#% end
dismin = np.amin(dis)
#print dismin
#np.disp(dismin)
dismax = np.amax(dis)
#print dismax
#np.disp(dismax)
#% dismin = min(min(amp));
#% dismax = max(max(amp));
#splaszczyc distances
t1 = dismin+(dismax-dismin)/3.
#print t1
t2 = dismin+2.*(dismax-dismin)/3.
#print t2
flat_dis=np.resize(distances,(1,dis.size))[0]
#np.savetxt('flat_dis.txt', flat_dis, delimiter='\n', newline='\n')
#print len(flat_dis), flat_dis.size
u1 = np.nonzero((flat_dis<t1))[0]
#np.savetxt('u1.txt', u1, delimiter='\n', newline='\n') #sa identyczne dla obu
u2 = np.nonzero(np.logical_and(flat_dis >= t1, flat_dis<t2))[0]
#np.savetxt('u2.txt', u2, delimiter='\n', newline='\n') #sa identyczne dla obu
u3 = np.nonzero((flat_dis >= t2))[0]
#np.savetxt('u3.txt', u3, delimiter='\n', newline='\n')#sa identyczne dla obu
#print u1
#% u1 = find(amp < t1);
#% u2 = find(amp >= t1 & dis < t2);
#% u3 = find(amp >= t2);
flat_dis[u1] = flat_dis1[u1]
flat_dis[u2] = flat_dis2[u2]
flat_dis[u3] = flat_dis3[u3]
#print len(flat_dis)
distances =np.resize(flat_dis,(len(dis),len(dis[1])))
#np.savetxt('distances_po_distadaptmed.txt', distances, delimiter='\n', newline='\n') #sa identyczne dla obu
return distances<file_sep>/src/root/PlaneExtraction/pnts2plane_classification_vgrow.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def pnts2plane_classification_vgrow(pnts, display):
# Local Variables: decider, rest, in, absoluteNum, pnts, ngb, planarIndx, currNormal, notPlanarIndx, fig, clusters, deviation, currIndx, r12, secondTerm, in1, in2, workingIndx, d_thresh, angles, firstTerm, allIndx, currColor, a_thresh, currSet, j, thres_dev, planes, display, OP
# Function calls: plot_3Dpoints, ismember, unique, false, abs, generate_oriented_particles, max, nargin, progressbar, pnts2plane_classification_vgrow, show_clusters, ones, isempty, intersect, zeros, acos, pi, find, size
#%% [planes, rest] = pnts2plane_classification_rgrow(pnts, display)
#%
#% The function is based on the paper "Geometry and Texture Recovery"
#% of Stamos and Allen clustering arbitrary point clouds.
#% Use of region growing techniques.
#%
#% pnts: set of points with the following structure
#% | p1x p2x p3x p4x |
#% pnts = | p1y p2y p3y p4y ... |
#% | p1z p2z p3z p4z |
#% display: 1 - visualize clusters; 0 - no visualization (optional; default: 0)
#%% some default values:
if nargin<2.:
display = false
rest = np.array([])
#%% generate oriented particels:
#% [VoxelPoints, voxelWithPoint, VoxelColors, n, nbrVoxel, startingPoint] = ...
#% generate_voxels(pnts, [20 20 20], 'r');
#%
#% OrientedParticles = calc_plane(voxelWithPoint, VoxelPoints, VoxelColors, n, ...
#% nbrVoxel, [20 20 20], startingPoint, 'Ransac');
OP = generate_oriented_particles(pnts)
#%% merging:
#%[patchesNew, patches, rest] = cluster_merging(OrientedParticles,'Stamos');
#% classify if points are planar or not:
deviation = np.array(np.hstack((OP.dev)))
#%thres_dev = 0.67 * mean(deviation);
thres_dev = 15.
planarIndx = nonzero((deviation<=thres_dev))
#%Swissranger
notPlanarIndx = nonzero((deviation > thres_dev))
#%Swissranger
rest = np.array(np.hstack((rest, np.array(np.hstack((OP[int(notPlanarIndx)-1].center))))))
allIndx = planarIndx
#%allPatches = OrientedParticles;
#%patchesNew = [];
clusters = cellarray([])
absoluteNum = matcompat.size(allIndx, 2.)
#% region growing:
while not isempty(allIndx):
progressbar((1.-matdiv(matcompat.size(allIndx, 2.), absoluteNum)))
currSet = np.array([])
currNormal = np.array([])
currColor = np.array([])
workingIndx = allIndx[0]
allIndx[0] = np.array([])
while not isempty(workingIndx):
currIndx = workingIndx[0]
currSet = np.array(np.hstack((currSet, OP[int(currIndx)-1].center)))
#%currNormal = [currNormal currPatch.normal];http://www.spiegel.de/politik/ausland/0,1518,543512,00.html
#%currColor = [currColor currPatch.color];
#%workingPatches(randnumberworking) = [];
workingIndx[0] = np.array([])
if isempty(allIndx):
continue
#% for redundant point elimination:
#% a_thresh = 1/18* pi;
#% d_thresh = 2;
#% for plane estalishing on arbitrary point clouds
a_thresh = np.dot(3./18., np.pi)
d_thresh = 120.
#%Swissranger
ngb = intersect(allIndx, (OP[int(currIndx)-1].ngb))
if isempty(ngb):
continue
#% conormality measure:
angles = acos(np.dot(OP[int(currIndx)-1].normal.conj().T, np.array(np.hstack((OP[int(ngb)-1].normal)))))
#% find patches, which fulfill constraints:
in1 = nonzero((angles<a_thresh))
if isempty(in1):
#% patchesNew = [patchesNew currPatch];
continue
ngb = ngb[int(in1)-1]
#% coplanarity measure:
r12 = np.array(np.hstack((OP[int(ngb)-1].center)))-np.dot(OP[int(currIndx)-1].center, np.ones(1., matcompat.size(ngb, 2.)))
firstTerm = np.abs(np.dot(OP[int(currIndx)-1].normal.conj().T, r12))
secondTerm = np.zeros(1., matcompat.size(r12, 2.))
for j in np.arange(1., (matcompat.size(r12, 2.))+1):
secondTerm[int(j)-1] = np.abs(np.dot(OP[int(ngb[int(j)-1])-1].normal.conj().T, r12[:,int(j)-1]))
decider = matcompat.max(np.array(np.vstack((np.hstack((firstTerm)), np.hstack((secondTerm))))))
in2 = nonzero((decider<d_thresh))
if isempty(in2):
#% patchesNew = [patchesNew currPatch];
continue
in = ngb[int(in2)-1]
workingIndx = np.array(np.hstack((workingIndx, in)))
workingIndx = np.unique(workingIndx)
allIndx[int(ismember[int(allIndx)-1,int(in)-1])-1] = np.array([])
clusters = np.array(np.hstack((clusters, cellarray(np.hstack((currSet))))))
#%patch.center = mean(currSet,2);
#%patch.color = mean(currColor,2);
#%coeff = princomp(currSet');
#%patch.normal = coeff(:,3);
#%patch.normal = mean(currNormal,2);
#% radius = max(sqrt(sum((currSet-repmat(currPatch.center,1,size(currSet,2))).^2)));
#%d = patch.normal' * center;
#%patch.center = center - ((patch.normal'*center)-d)*patch.normal;
#%radius = max(sqrt(sum((currSet-repmat(patch.center,1,size(currSet,2))).^2)));
#%if radius < currPatch.radius
#% patch.radius = currPatch.radius;
#%else
#% patch.radius = radius;
#%end
#%patchesNew = [patchesNew patch];
progressbar(1.)
#%% display results:
if display:
fig = show_clusters(clusters, 25.)
fig = plot_3Dpoints(rest, 'k', fig)
planes = clusters
return [planes, rest]<file_sep>/src/root/Utilities/getNgbIndx.py
import sys
import numpy as np
import scipy
import matcompat
from sindx2mindx import sindx2mindx
#from mindx2sindx import mindx2sindx
import numpy.matlib
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def getNgbIndx(indx, width, height, nHood, woC= True, pos=None):
np.disp('getNgbIndx ...')
# Local Variables: c, h1, ngb, currC, rs, h2, half, indx, ce, height, width, r, pos, accelerate, currR, cs, re, ngbIndx, nHood, woC
# Function calls: sort, mindx2sindx, false, floor, reshape, getNgbIndx, ceil, nargin, length, repmat, true, find, sindx2mindx
#%% ngbIndx = getNgbIndx(indx, width, height, nHood, woIndx)
#%
#% Computes the sequential indices (row-wise, not column-wise as default in
#% Matlab) of an arbitrary neighborhood
#%
#% If no nHood is specified the default value is 3
#% If woC = true, then current center (specified by indx) is removed, else center
#% is kept. The default is set to true.
#%% some default values:
#to nie jest skonwertowane
#print(woC)
if (pos==None):
accelerate = 0
else:
accelerate = 1
#% computing the neighboring indices:
#print 'indx', indx
[currR, currC] = sindx2mindx(indx, width, height)
#print 'currR, currC', currR, currC
half = (nHood - 1.) / 2.
h1 = np.floor(half)
h2 = np.ceil(half)
#print 'h1, h2', h1, h2
if (accelerate):
rs = currR - h1
if (rs < 1):
rs = 1
re = currR + h2
if (re > height):
re = height
cs = currC - h1
if (cs < 1):
cs = 1
ce = currC + h2
if (ce > width):
ce = width
#print 'values rs , re , cs, ce', rs , re , cs, ce #do tego momentu wartosci w pliku zgodne
temp=[]
for it in range(int(rs)-1,int(re)):
for it2 in range(int(cs)-1,int(ce)):
temp.append(pos[it2][it]) #zamieniono it2 z IT tylko ze wzgledu na zamiane w z h 27.12 /ANULOWANE? /10.02 zamiana wrocone
ngbIndx=temp
#ngbIndx = pos[(rs,re),(cs,ce)] # chyba trzeba to zamienic na piekne fory //zrobione
#print 'ngbIndx.size, ngbIndx', len(ngbIndx), ngbIndx # zgodne
#ngbIndx = np.reshape(ngbIndx, (1, -1))
#else: # nie istnieje metoda mindx...
#r = slice((currR - h1),(currR + h2))
#r = np.extract(np.logical_or(r < 1, r > height), r)
#c = slice[currC - h1,currC + h2]
#c = np.extract(np.logical_or(c < 1, c > width), c)
#ngb = np.sort(np.vstack((numpy.matlib.repmat(r, 1, c.np.size), numpy.matlib.repmat(c, 1, c.np.size))))
#ngbIndx = mindx2sindx(ngb[0,], ngb[1,], width, height)
#ngbIndx = unique(ngbIndx);
if (woC):
if indx==1:
print ngbIndx
print 'ngbIndx'
#sys.exit("Debug break")
# ngbIndx = np.extract(ngbIndx == indx, ngbIndx)
return ngbIndx<file_sep>/src/root/Utilities/get_plane_expansion.py
import numpy as np
import scipy
import matcompat
from get_expansion import get_expansion
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def get_plane_expansion(plane):
np.disp(('Trwa wykonywanie: get_plane_expansion'))
# Local Variables: a, base2, scale2, s1max, s1min, area, s2min, s2max, shape, base1, s, plane, b1, b2, scale1
# Function calls: get_plane_expansion, get_expansion
#% plane = get_plane_expansion(plane)
[a, s, b1, b2, s1min, s1max, s2min, s2max] = get_expansion((plane.pnts))
plane.area = a
plane.shape = s
plane.base1 = b1
plane.base2 = b2
plane.scale1 = np.array(np.hstack((s1min, s1max)))
plane.scale2 = np.array(np.hstack((s2min, s2max)))
return [plane]<file_sep>/src/root/PlaneExtraction/cluster_through_normals.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def cluster_through_normals(fr, cam, threshold, display):
# Local Variables: angles, posZeroNormals, camType, pos, threshold, frames, diff, pnts, nCurr, seq, usage, clusters, fr, zeroNormals, pntsZeroNormals, normclusters, iCurr, d, indx, n, pCurr, cam, clustersIndx, display
# Function calls: cluster_through_normals, false, isfield, show_clusters, nargin, length, preprocessing, isempty, ismember, acos, find
#% clusters = cluster_through_normals(pnts, normals, threshold, usage, display)
#%
#% points with similar normals are clustered
#% threshold: normals with an Euclidean distance smaller than the threshold value
#% are declared as similar
#% usage: specify which points in 'pnts' will be used (optional; default: use
#% all)
#% display: 1 - visualize clusters; 0 - no visulaization (optinal; default: 0)
if nargin<4.:
display = false
if not isfield(fr, 'normals'):
seq.frames = fr
seq.camType = cam
seq = preprocessing(seq, 'normals')
fr = seq.frames
n = fr.normals[:,int((fr.usage))-1]
pnts = fr.points3D[0:3.,int((fr.usage))-1]
usage = fr.usage
pos = np.arange(1., (np.dot(cam.width, cam.height))+(1.), 1.)
pos = pos[int(usage)-1]
clusters = np.array([])
normclusters = np.array([])
diff = np.array([])
d = np.array([])
#% find [0;0;0] normals
posZeroNormals = ismember(n, np.array(np.vstack((np.hstack((0.)), np.hstack((0.)), np.hstack((0.))))))
posZeroNormals = np.logical_and(np.logical_and(posZeroNormals[0,:], posZeroNormals[1,:]), posZeroNormals[2,:])
zeroNormals = n[:,int(posZeroNormals)-1]
pntsZeroNormals = pnts[:,int(posZeroNormals)-1]
n = n[:,int((not posZeroNormals))-1]
pnts = pnts[:,int((not posZeroNormals))-1]
pos = pos[:,int((not posZeroNormals))-1]
while not isempty(n):
nCurr = n[:,0]
pCurr = pnts[:,0]
iCurr = pos[0]
n[:,0] = np.array([])
pnts[:,0] = np.array([])
pos[0] = np.array([])
#% conormality measure:
#% computes angle between two normals n1 and n2
#% angle = acos(n1 * n2) (Scalar Product)
angles = acos(np.dot(nCurr.conj().T, n))
indx = nonzero((angles<threshold))
#% diff = [n(1,:) - nCurr(1); n(2,:) - nCurr(2); n(3,:) - nCurr(3)];
#% d = sum(diff.^2,1);
#% indx = find(d < threshold);
#% cluster points with similar normals
clusters.cell[int((length[int(clusters)-1]+1.))-1] = np.array(np.hstack((pCurr, pnts[:,int(indx)-1])))
clustersIndx.cell[int((length[int(clusters)-1]+1.))-1] = np.array(np.hstack((iCurr, pos[int(indx)-1])))
normclusters.cell[int((length[int(normclusters)-1]+1.))-1] = np.array(np.hstack((nCurr, n[:,int(indx)-1])))
#% remove clustered points from the working set
n[:,int(indx)-1] = np.array([])
pnts[:,int(indx)-1] = np.array([])
pos[int(indx)-1] = np.array([])
normclusters.cell[int((length[int(normclusters)-1]+1.))-1] = zeroNormals
clusters.cell[int((length[int(clusters)-1]+1.))-1] = pntsZeroNormals
if display:
show_clusters(clusters, 100.)
return [clusters, clustersIndx, normclusters]<file_sep>/src/root/Preprocessing/amplitude_adaptive_median.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def amplitude_adaptive_median(dis, amp, camType):
# Local Variables: distances, dis2, dis3, maxAmp, dis1, minAmp, u1, camType, t2, u3, t1, range, amp, u2, dis
# Function calls: medfilt2, max, amplitude_adaptive_median, find, min
distances = dis
dis1 = medfilt2(dis, np.array(np.hstack((7., 7.))))
dis2 = medfilt2(dis, np.array(np.hstack((5., 5.))))
dis3 = medfilt2(dis, np.array(np.hstack((3., 3.))))
t1 = 0.
t2 = 0.
minAmp = matcompat.max(matcompat.max(amp))
maxAmp = matcompat.max(matcompat.max(amp))
range = maxAmp-minAmp
t1 = minAmp+np.dot(1./3., range)
t2 = minAmp+np.dot(2./3., range)
u1 = nonzero((dis<t1))
u2 = nonzero(np.logical_and(dis >= t1, dis<t2))
u3 = nonzero((dis >= t2))
distances[int(u1)-1] = dis1[int(u1)-1]
distances[int(u2)-1] = dis2[int(u2)-1]
distances[int(u3)-1] = dis3[int(u3)-1]
return [distances]<file_sep>/src/root/PlaneExtraction/cluster_through_gmd.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def cluster_through_gmd(pnts, display, gmdata):
# Local Variables: clStd, cl, pnts, score, clusterIndx, slog, cl_set, clusters, log1, sgrad, clIndx, thresh, stdtest, cl_indx, log, obj, center, idx, i, coeff, gmdata, grad, display
# Function calls: princomp, false, cluster, pnts2clusters, gmdistribution, nargin, cluster_through_gmd, abs, show_clusters, mean, true, size
#%% clusters = cluster_through_gmd(pnts)
#%
#% This function fits an increasing number of gaussian mixture distribution
#% to the 3D point data until the log-likelihood falls below 0.8 or starts
#% to increase again
return [clusters, clusterIndx, clStd]<file_sep>/src/root/Utilities/align_pnts2plane.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def align_pnts2plane(pnts, normal, center):
# Local Variables: center, normal, Rot1, T2, normal_new, Rot2, newPnts, T1, angle1, angle2, Rot, pnts
# Function calls: cos, atan, ones, align_pnts2plane, sin, size
#%% [newPnts, Rot] = align_pnts2plane(pnts, normal, center)
if np.size(pnts, 1.) == 3.:
pnts = np.array(np.vstack((np.hstack((pnts)), np.hstack((np.ones(1., matcompat.size(pnts, 2.)))))))
#%% move points with center to origin
#%Tc = eye(4);
#%Tc(1:3,4) = -1*center(1:3);
#%Pnts_new = Tc * Pnts_new;
#%Pnts_new = Pnts-repmat([center(1:3); 0], 1, size(Pnts,2));
T1 = np.array(np.vstack((np.hstack((1., 0., 0., -center[0])), np.hstack((0., 1., 0., -center[1])), np.hstack((0., 0., 1., -center[2])), np.hstack((0., 0., 0., 1.)))))
T2 = np.array(np.vstack((np.hstack((1., 0., 0., 0.)), np.hstack((0., 1., 0., 0.)), np.hstack((0., 0., 1., center[2])), np.hstack((0., 0., 0., 1.)))))
#%% calculate angles for rotation
angle1 = np.arctan(normal[0]/normal[1]) #pewnie trzeba divide przez elementy 1 do 1?
Rot1 = np.array(np.vstack((np.hstack((np.cos(angle1), -np.sin(angle1), 0., 0.)), np.hstack((np.sin(angle1), np.cos(angle1), 0., 0.)), np.hstack((0., 0., 1., 0.)), np.hstack((0., 0., 0., 1.)))))
normal_new = np.dot(Rot1, np.array(np.vstack((np.hstack((normal)), np.hstack((1.))))))
angle2 = np.arctan(normal_new[1]/normal[2])
Rot2 = np.array(np.vstack((np.hstack((1., 0., 0., 0.)), np.hstack((0., np.cos(angle2), -np.sin(angle2), 0.)), np.hstack((0., np.sin(angle2), np.cos(angle2), 0.)), np.hstack((0., 0., 0., 1.)))))
#%% transformation matrix
Rot = np.dot(np.dot(Rot2, Rot1), T1)
#% Rot = [cos(angle1) -sin(angle1) 0 -center(1)*cos(angle1)+center(2)*sin(angle1); ...
#% cos(angle2)*sin(angle1) cos(angle2)*cos(angle1) -sin(angle2) -center(1)*cos(angle2)*sin(angle1)-center(2)*cos(angle2)*cos(angle1)+center(3)*sin(angle2); ...
#% sin(angle2)*sin(angle1) sin(angle2)*cos(angle1) cos(angle2) -center(1)*sin(angle2)*sin(angle1)-center(2)*sin(angle2)*cos(angle1)- center(3)*cos(angle2)+center(3); ...
#% 0 0 0 1];
#% rotate points in origin
newPnts = np.dot(Rot, pnts)
return [newPnts, Rot]<file_sep>/src/root/Visualization/generate_colormap.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def generate_colormap(nColor):
# Local Variables: map, mapEntry, i, nColor, rest, step, nPerSlot
# Function calls: zeros, mod, generate_colormap, find, floor
#% map = generate_colormap(nColor)
map = np.zeros(nColor, 3.)
map[0,:] = np.array(np.hstack((0., 0., 0.5)))
nPerSlot = np.floor(((nColor-1.)/5.))
rest = np.mod((nColor-1.), 5.)
mapEntry = 2.
#%+z:
step = 0.5 / nPerSlot
i = 1.
while i<=nPerSlot:
map[int(mapEntry)-1,:] = map[int((mapEntry-1.))-1,:]+np.array(np.hstack((0., 0., step)))
i = i+1.
mapEntry = mapEntry+1.
#%+y:
step = 1./nPerSlot
i = 1.
while i<=nPerSlot:
map[int(mapEntry)-1,:] = map[int((mapEntry-1.))-1,:]+np.array(np.hstack((0., step, 0.)))
i = i+1.
mapEntry = mapEntry+1.
#%+x-z:
step = 1./(nPerSlot+rest)
i = 1.
while i<=nPerSlot+rest:
map[int(mapEntry)-1,:] = map[int((mapEntry-1.))-1,:]+np.array(np.hstack((step, 0., -step)))
i = i+1.
mapEntry = mapEntry+1.
#%-y:
step = 1./nPerSlot
i = 1.
while i<=nPerSlot:
map[int(mapEntry)-1,:] = map[int((mapEntry-1.))-1,:]-np.array(np.hstack((0., step, 0.)))
i = i+1.
mapEntry = mapEntry+1.
#%-x:
step = 0.5/ nPerSlot
i = 1.
while i<=nPerSlot:
map[int(mapEntry)-1,:] = map[int((mapEntry-1.))-1,:]-np.array(np.hstack((step, 0., 0.)))
i = i+1.
mapEntry = mapEntry+1.
map[np.nonzero[map > 1]-1] = 1
map[np.nonzero[map<0]-1] = 0
return map<file_sep>/src/root/PlaneExtraction/cluster_through_regions.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def cluster_through_regions(fr, cam, display):
# Local Variables: fr, imRegions, imDis, posEdges, edgesIndx, pos, display, regions, width, bwDis, edges, pnts, cam, usage, curr, height, regionsIndx, se, posCurr
# Function calls: false, cluster_through_regions, strel, reshape, imdilate, nargin, length, edge, isempty, edge_region_growing, show_clusters, imerode, find
#%% [regions, regionsIndx] = cluster_through_regions(fr, cam, display)
#%
#% points lying inside connected edges = regions are clustered
#% usage: specify which points in 'pnts' will be used
#% display: 1 - visualize clusters; 0 - no visulaization (optinal; default: 0)
#%% some default settings:
if nargin<3.:
display = false
pnts = fr.points3D[0:3.,:]
width = cam.width
height = cam.height
usage = fr.usage
#%% compute edge image and indices of these edges
se = strel('square', 5.)
imDis = np.reshape(pnts[2,:], width, np.array([])).conj().T
#%imDis = imerode(imdilate(imDis, se), se);
bwDis = edge(imDis, 'canny')
bwDis = imerode(imdilate(bwDis, se), se)
imRegions = edge_region_growing(bwDis)
imRegions = np.reshape(imRegions.conj().T, 1., np.array([]))
imRegions = imRegions[int(usage)-1]
pos = np.arange(1., (length(pnts))+(1.), 1.)
pos = pos[int(usage)-1]
#%% find edges in image (are denoted by -2)
posEdges = nonzero((imRegions == -2.))
edges = pnts[:,int(pos[int(posEdges)-1])-1]
edgesIndx = posEdges
imRegions[int(posEdges)-1] = np.array([])
pos[int(posEdges)-1] = np.array([])
#%% region growing
regions = np.array([])
regionsIndx = np.array([])
curr = 0.
while not isempty(imRegions):
curr = imRegions[0]
posCurr = nonzero((imRegions == curr))
regions.cell[int((length[int(regions)-1]+1.))-1] = pnts[:,int(pos[int(posCurr)-1])-1]
regionsIndx.cell[int((length[int(regionsIndx)-1]+1.))-1] = pos[int(posCurr)-1]
imRegions[int(posCurr)-1] = np.array([])
pos[int(posCurr)-1] = np.array([])
#%regions{length(regions)+1} = edges;
#%regionsIndx{length(regionsIndx)+1} = posEdges;
if display:
show_clusters(regions, 100.)
return [regions, regionsIndx, edges, edgesIndx]<file_sep>/src/root/Preprocessing/preprocessing.py
import numpy as np
import sys
import scipy
import string
from median_filtering import median_filtering
from thresholding import thresholding
from edgepoint_removing import edgepoint_removing
from open_close_usage import open_close_usage
from compute_normals import compute_normals
from root.Utilities.getNgbIndx import getNgbIndx
from svd_enhancing import svd_enhancing
from copy_NgbIndx import copy_NgbIndx
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def preprocessing(seq=None, mode=None):
#% sequence = preprocessing(seq, mode)
#
# the possible parameters for 'mode' are:
# ---------------------------------------
# - 'median' : performs a distance-adaptive median filter on the
# distances
#
# - 'threshld' : applies a dynamic amplitude threshold rejecting invalid
# distance measurements via its amplitude value
#
# - 'edgerm' : remove false measurements arising in the case of edges
#
# - 'open' : applies an opening on the binary image of the usage vector
# holding the valid distance measurements
#
# - 'normals' : computes for each point its normal using its
# 8-neighborhood
#
# - 'ngb' : stores for each point the indices of its 8-neighborhood
#
#
# - 'standard' : performs the methods of 'median', 'threshld', 'open',
# 'edgerm'
# - 'all' : performs all available methods
np.disp('Preprocessing ...')
if (mode == None):
mode = 'standard'
else:
#% determine the methods that should be performed:
med = 0
thres = 0
edge = 0
open = 0
norm = 0
ngb = 0
svd = 0
__switch_0__ = mode
if 0:
pass
elif __switch_0__ == 'all':
med = 1
thres = 1
edge = 1
open = 1
norm = 1
ngb = 1
elif __switch_0__ == 'median':
med = 1
elif __switch_0__ == 'threshld':
thres = 1
elif __switch_0__ == 'edgerm':
edge = 1
elif __switch_0__ == 'open':
open = 1
elif __switch_0__ == 'normals':
norm = 1
ngb = 1
elif __switch_0__ == 'ngb':
ngb = 1
elif __switch_0__ == 'svd':
thres = 1
edge = 1
open = 1
svd = 1
norm = 1
elif __switch_0__ == 'standard':
med = 1
thres = 1
edge = 1
open = 1
else:
np.disp('Error: Unknown value for parameter "mode"')
indx = []
sequence = seq
w = sequence.camType.width
h = sequence.camType.height
if (med):
sequence.frames =[median_filtering(x, sequence.camType) for x in sequence.frames]
#sequence.frames = cell2mat(arrayfun(lambda x: median_filtering(x, sequence.camType), sequence.frames)
if (thres):
sequence.frames =[thresholding(x, sequence.camType) for x in sequence.frames]
#sequence.frames = cell2mat(arrayfun(lambda x: thresholding(x, sequence.camType), sequence.frames)
if (edge):
sequence.frames =[edgepoint_removing(x, sequence.camType) for x in sequence.frames]
#sequence.frames = cell2mat(arrayfun(lambda x: edgepoint_removing(x, sequence.camType), sequence.frames, 'UniformOutput', false))
if (open):
sequence.frames =[open_close_usage(x, sequence.camType, 'open') for x in sequence.frames]
#sequence.frames = cell2mat(arrayfun(lambda x: open_close_usage(x, sequence.camType, 'open'))), sequence.frames, 'UniformOutput', false))
if (norm):#Nadal niezgodna numerycznie dev i wszystko co dalej!
sequence.frames =[compute_normals(x, sequence.camType) for x in sequence.frames]
if (ngb): # czy jest potrzeba ponownie, jak juz liczone w norm? Sprawdzic ale tutaj sa bledy
i = np.arange(w*h)
pos = np.arange(1, (w*h)+1)
pos = np.reshape(pos, (w, h)).conj().T
#pos = np.reshape(i, (w*h))
i = np.reshape(i, (1,w*h))
indx =[getNgbIndx(x, h, w, 3., 'true' , pos) for x in (i[0]+1)] #zamieniono kolejnosc w z h!!! ? 10.02 <NAME>
sequence.frames =[ (x, indx) for x in sequence.frames]
#sequence.frames =[x.indx8.setfield(indx) for x in sequence.frames]
#sequence.frames = cell2mat(arrayfun(lambda x: (setfield(x, 'indx8', indx)), sequence.frames, 'Uniformoutput', false))
if (svd):
sequence.frames =[svd_enhancing(x, sequence.camType) for x in sequence.frames]
#sequence.frames = cell2mat(arrayfun(lambda x: (svd_enhancing(x, sequence.camType)), sequence.frames, 'UniformOutput', false))
#% perform selected preprocessing for each frame of the sequence:
# f=1;
# while(f<=length(sequence.frames))
#
# % find points with z-values == 0: Points would lie on the image plane
# use = find(sequence.frames(f).points3D_org(3,:) ~= 0);
# u = ismember(sequence.frames(f).usage, use);
# sequence.frames(f).usage = sequence.frames(f).usage(u);
#
# % if no point of a frame will be used (bad frame) this frame is deleted:
# if(length(sequence.frames(f).usage) == 0)
# sequence.frames(f) = [];
# else
# f=f+1;
# end
#
# end
return sequence
<file_sep>/src/root/Utilities/pnts2clusters.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def pnts2clusters(pnts, indx):
# Local Variables: last, cl, i, indx, clIndx, p, pnts, first
# Function calls: max, find, pnts2clusters, min
#%% [cl, clIndx] = pnts2clusters(pnts, indx)
cl = np.array([])
clIndx = np.array([])
#%% determine clusternumbers:
first = matcompat.max(indx)
#%first = 1;
last = matcompat.max(indx)
i = first
while i<=last:
p = nonzero((indx == i))
cl = np.array(np.hstack((cl, cellarray(np.hstack((pnts[:,int(p)-1]))))))
clIndx = np.array(np.hstack((clIndx, cellarray(np.hstack((p.conj().T))))))
i = i+1.
return [cl, clIndx]<file_sep>/src/root/PlaneExtraction/tidyup_patches.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def tidyup_patches(patches):
# Local Variables: patches, means, coeff, scores, mi, indx, values, x, threshold, patchesTidy, bins
# Function calls: princomp, false, min, hist, abs, cellfun, find, tidyup_patches, mean
#% patchesTidy = tidyUp_patches(patches)
[coeff, scores] = cellfun(lambda x: princomp(x.conj().T), cellarray(np.hstack((patches.pnts))), 'UniformOutput', false)
means = cellfun(lambda x: np.mean(np.abs(x[:,2])), scores, 'UniformOutput', false)
means = np.array(np.hstack((means.cell[0:])))
[bins, values] = plt.hist(means)
[mi, indx] = matcompat.max(bins)
threshold = values[int(indx)-1]
patchesTidy = patches[int(nonzero((means<threshold)))-1]
return [patchesTidy]<file_sep>/src/root/PlaneExtraction/smooth_planes.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def smooth_planes(planes):
# Local Variables: i, dev, n, plane, planesSmoothed, planes, pnts
# Function calls: length, smooth_planes
#% planesSmoothed = smooth_planes(planes)
n = length(planes)
planesSmoothed = np.array([])
plane = np.array([])
i = 1.
while i<=n:
plane = planes[int(i)-1]
dev = np.dot(plane.n.conj().T, plane.pnts)-plane.d
plane.pnts = plane.pnts-np.dot(plane.n, dev)
planesSmoothed = np.array(np.hstack((planesSmoothed, plane)))
i = i+1.
return [planesSmoothed]<file_sep>/main.py
import sys
'''
Created on Oct 16, 2017
@author: mavitis
'''
from root.IO.load_sequence import load_sequence
from root.Preprocessing.preprocessing import preprocessing
from root.PlaneExtraction.extract_planes import extract_planes
if __name__ == '__main__':
seq = load_sequence('kitchen/0', 'SR_176x144')
seq = preprocessing(seq, 'all')
class my_ext_plane:
planes = []
clusters = []
rest = []
restIndx = []
ext_plane = my_ext_plane()
minSize=50
method='planarClsts'
display = True
for it in range(len(seq.frames)):
fr_planes=extract_planes(seq.frames[it], seq.camType, minSize, method, display)
print 'lol'
sys.exit("Debug break")
#ext_plane=[extract_planes(x, seq.camType, minSize, method, display) for x in seq.frames]
#for i = 1:length(seq.frames)
#fr_planes = extract_planes(seq.frames(i), seq.camType, minSize, method, display)
#end
# - zaimplementowac wywolanie, a potem ruszyc z modyfikacja extract plane
pass<file_sep>/src/root/PlaneExtraction/pnts2plane_classification_rgrowpure.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def pnts2plane_classification_rgrowpure(fr, cam, display=0):
# Local Variables: decider, seq, camType, rest, frames, in, threshold, pnts, patches, ngbIndx, fig, usage, currIndx, fr, workingIndx, patchesIndx, restIndx, allIndx, d, i, n, p, cam, planes, initSeedIndx, display
# Function calls: plot_3Dpoints, ismember, plane_computation, false, main_plane_extraction, isfield, preprocessing, nargin, length, pnts2plane_classification_rgrowpure, isempty, intersect, show_clusters, unique, find
#%% [planes, rest, patchesIndx, restIndx] = pnts2plane_classification_rgrow(fr, cam, display)
#%
#% This function is an implementation of the algorithm described Olaf
#% Kaehler in "On Fusion of Range and Intensity Information Using
#% Graph-Cut for Planar Patch Segmentation
#%% some default values:
#doda seq jako parametr? to jest zabezpieczenie przed niewykonaniem preprocessingu, wiec mozna wstepnie olac
#if not(hasattr(fr, 'indx8')):
# seq.frames = fr
# seq.camType = cam
# seq = preprocessing(seq, 'ngb')
# fr = seq.frames
rest = np.array([])
restIndx = np.array([])
usage = fr.usage
pnts = fr.points3D[0:3.,:]
allIndx = usage
threshold = 30.
#%% start region growing:
patchesIndx = np.array([])
patches = np.array([])
i = 1.
while not isempty(allIndx):
#% initialize seed:
#%% display results:
if display:
fig = show_clusters(patches, 50.)
fig = plot_3Dpoints(rest, 'k', fig)
planes = patches
rest = pnts[:,int(restIndx)-1]
return [planes, rest, patchesIndx, restIndx]<file_sep>/src/root/Preprocessing/median_filtering.py
import numpy as np
import scipy
import matcompat
from distance_adaptive_median import distance_adaptive_median
from backprojection_fast import backprojection_fast
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def median_filtering(fr, camType):
np.disp('median_filtering ...')
# Local Variables: camType, frame, fr, distances
# Function calls: median_filtering, distance_adaptive_median, backprojection_fast, reshape
#% frame = median_filtering(fr, camType)
frame = fr
#np.savetxt('frame.distances_input.txt', frame.distances)
#np.disp(np.size(frame.distances))
distances = np.reshape((frame.distances), (camType.height, camType.width)) #tutaj zamienione heigyht z weight i dziala! resazy odwrotnie?
distances = distances.conj().T
#np.savetxt('distances.txt', distances, delimiter='\n', newline='\n')
#%amplitudes = reshape(frame.amplitudes, camType.width, camType.height);
#%amplitudes = amplitudes';
#%intensities = reshape(frame.intensities, camType.width, camType.height);
#%intensities = intensities';
#%amplitudes = reshape(frame.amplitudes, camType.width, camType.height);
#%amplitudes = amplitudes';
#%intensities = medfilt2(intensities, [3 3]);
#%amplitudes = medfilt2(amplitudes, [3 3]);
#%distances = medfilt2(distances, [3 3]);
distances = distance_adaptive_median(distances, camType)
#%distances = amplitude_adaptive_median(distances, amplitudes, camType);
#%frame.intensities = reshape(intensities', 1, camType.width*camType.height);
#%frame.amplitudes = reshape(amplitudes', 1, camType.width*camType.height);
frame.distances = np.reshape(distances.conj().T, (1, camType.width * camType.height))
#print frame.distances[0]
#np.savetxt('frame.distances.txt', frame.distances[0])
frame = backprojection_fast(frame, camType)
return frame<file_sep>/src/root/Preprocessing/compute_normals.py
import sys
import numpy as np
import scipy
import matcompat
from root.PlaneExtraction.local_plane_patches import local_plane_patches
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def compute_normals(fr, camType):
np.disp('compute_normals ...')
# Local Variables: fr, d, notplanar, planarIndx, h, camType, planar, dev, thres_dev, w, normals, notPlanarIndx, frame
# Function calls: std, local_plane_patches, compute_normals, ismember, find, mean
#%% frame = compute_normals(fr, camType)
frame = fr
w = camType.width
h = camType.height
#print 'frame.3dpoints', frame.points3D.size, len(frame.points3D), len(frame.points3D[0])
[normals, d, dev] = local_plane_patches((frame.points3D), w, h, (frame.usage), 5.)
#%% classify if points are planar or not:
#%thres_dev = 0.67 * mean(deviation);
#%thres_dev = 1 * mean(deviation);
#%planarIndx = find(deviation <= 2000); %Swissranger
#%notPlanarIndx = find(deviation > 2000); %Swissranger
#%planarIndx = find(deviation <= 3000); %DC_Tracking
#%notPlanarIndx = find(deviation > 3000); %DC_Tracking
#print 'dev', dev
# nieznaczne roznice w wartosci!
np.savetxt('dev.txt', dev, delimiter='\n', newline='\n')
thres_dev = 1.*np.mean(dev)+np.std(dev)
print 'thres_dev', thres_dev
planarIndx = np.nonzero((dev<=thres_dev))
notPlanarIndx = np.nonzero((dev > thres_dev))
u = np.in1d(frame.usage, planarIndx)
u = u*1
temp=[]
for it in range(len(planarIndx)):
if u[it] == 1:
temp.append(planarIndx[it])
planarIndx=temp
np.savetxt('planarIndx=.txt', planarIndx, delimiter='\n', newline='\n')
#Problemy - nieznacznie rozniaca sie macierz dev,-> rozniacy sie podzial na planarIndx i not planar INDX
u1 = np.in1d(frame.usage, notPlanarIndx)
u1 = u1*1
temp1=[]
for it in range(len(notPlanarIndx)):
if u1[it] == 1:
temp1.append(notPlanarIndx[it])
notPlanarIndx=temp1
#notPlanarIndx = notPlanarIndx[np.in1d(frame.usage, notPlanarIndx)]
#do weryfikacji poprawnosc
#%% store
frame.normals = normals
frame.d = d
frame.dev = dev
frame.planar = planarIndx
frame.notplanar = notPlanarIndx
return frame<file_sep>/src/root/PlaneExtraction/cluster2plane.py
import numpy as np
import scipy
import matcompat
from root.PlaneExtraction.princomp import princomp
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def cluster2plane(cl, indx):
np.disp(('Trwa wykonywanie: cluster2plane'))
# Local Variables: d, cl, coeff, normal, help, l, rest, indx, planes, y, x, out, restIndx
# Function calls: disp, princomp, false, cluster2plane, isempty, cellfun, iscell, find, cell2struct, mean
#%% plane = cluster2plane(cl,indx)
#if not iscell(cl):
# np.disp('Error: Parameter "cl" has to be a cell array')
# return []
rest = np.array([])
restIndx = np.array([])
l= np.size(cl, 2) #l = cellfun('size', cl, 2.)
out = np.nonzero(l < 3) #out = nonzero((l<3.))
for x in np.nditer(out): #if not isempty(out):
rest = cl.cell[int(out)-1]
restIndx = indx.cell[int(out)-1]
coeff =[princomp(x.conj().T) for x in cl] #coeff = cellfun(lambda x: princomp(x), cl, 'UniformOutput', false)
normal =[x[:,2] for x in coeff] #normal = cellfun(lambda x: x[:,2], coeff, 'UniformOutput', false)
#d = cellfun(lambda x, y: np.dot(x.conj().T, np.mean(y, 2.)), normal, cl, 'UniformOutput', false)
tempx=[x.conj().T for x in normal]
tempy=[np.mean(y, 2.) for y in cl]
d=[tempx,tempy]
#help = np.array(np.vstack((np.hstack((cl)), np.hstack((indx)), np.hstack((normal)), np.hstack((d)))))
class my_planes:
pnts = []
indx = []
n = []
d = []
planes = my_planes()
planes.pnts=cl
planes.indx=indx
planes.n=normal
planes.d=d
return [planes, rest, restIndx]<file_sep>/src/root/PlaneExtraction/lbg_kmeans.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def lbg_kmeans(pnts):
# Local Variables: clhelp, clI, cl, todopnts, clIndx, chelp, pnts, fig, v, ihelp, shelp
# Function calls: lbg_kmeans, plot_3Dpoints, kmeans, pnts2clusters, isempty, show_clusters
cl = np.array([])
clIndx = np.array([])
[ihelp, chelp, v] = kmeans(pnts.conj().T, 1., 'emptyaction', 'drop')
todopnts = cellarray(np.hstack((pnts)))
while not isempty(todopnts):
pnts = todopnts.cell[0]
todopnts[0] = np.array([])
[ihelp, chelp, shelp] = kmeans(pnts.conj().T, 2., 'emptyaction', 'drop')
[clhelp, clI] = pnts2clusters(pnts, ihelp)
shelp
matdiv(shelp, v)
if matdiv(shelp[0], v)<0.05:
cl = np.array(np.hstack((cl, clhelp[0])))
clIndx = np.array(np.hstack((clIndx, clI[0])))
else:
todopnts = np.array(np.hstack((todopnts, clhelp[0])))
if matdiv(shelp[1], v)<0.05:
cl = np.array(np.hstack((cl, clhelp[1])))
clIndx = np.array(np.hstack((clIndx, clI[1])))
else:
todopnts = np.array(np.hstack((todopnts, clhelp[1])))
#%if(~isempty(cl))
#% fig = show_clusters(cl);
#% plot_3Dpoints([todopnts{1:end}], 'k', fig);
#%end
fig = show_clusters(cl)
plot_3Dpoints(np.array(np.hstack((todopnts.cell[0:]))), 'k', fig)
return [cl, clIndx]<file_sep>/src/root/SceneAnalysis/compute_feature.py
import numpy as np
import scipy
import matcompat
import scipy.special
from root.Utilities.get_angle import get_angle
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def compute_feature(planes, method):
# Local Variables: ahist, arhist, means, histopt, arearatio, shaphist, shapes, anghist, angles, planes, var, x, comb, feat, method, areas
# Function calls: cell2mat, compute_feature, false, arrayfun, nchoosek, max, sum, min, length, ones, zeros, get_angle, exp, cellfun, realmax, histc, pi, mat2cell, strcmp, size
#%% feat = compute_feature(planes, method)
#%% histopt determines whether a data point contributes to its neighboring
#% bins or not
histopt = 'hard'
#% histopt = 'smooth';
feat = np.array([])
if len(planes) == 1.:
return []
comb = scipy.special.binom(np.arange(1, (len(planes))+1), 2)
comb=np.reshape(comb, (1,np.size(comb,1),2)) #comb = mat2cell(comb, np.ones(1., matcompat.size(comb, 1.)), 2.)
angles = []
#%% angles between all planes
if method == 'angles' or method == 'all':
#angles = cell2mat(cellfun(lambda x: get_angle((planes[x[0]].n), (planes[int(x[1])-1].n)), comb, 'UniformOutput', false)).conj().T
for x in np.nditer(comb):
angles[x]=get_angle((planes[x[0]].n), (planes[x[1]].n))
angles=angles.conj().T
#np.arange cell2mat!
if histopt =='hard':
anghist = np.digitize(angles, np.array(np.hstack((np.arange(0., (np.pi/2.)+(np.pi/18.), np.pi/18.)))))
anghist = anghist[0:0-1.]/np.sum(anghist)
if histopt =='smooth':
means = np.arange(np.pi/36., (np.pi/2.)+(np.pi/18.), np.pi/18.)
var = np.pi/18.
#anghist = cell2mat(arrayfun(lambda x: np.sum(np.exp(np.dot(-0.5, matdiv(angles-x, var)**2.))), means, 'UniformOutput', false))
for x in np.nditer(means):
anghist[x]=np.sum(np.exp(-0.5* (angles-x/var)**2))
anghist = anghist/np.sum(anghist)
feat = np.array(np.vstack((np.hstack((feat)), np.hstack((anghist.conj().T)))))
#%% shapes of the planes defined by ratio of the main axis
if method=='shapes' or method=='all':
shapes = np.array(np.hstack((planes.shape)))
shaphist = np.array([])
if histopt == 'hard':
shaphist = np.digitize(shapes, np.array(np.hstack((np.arange(0., 1.2, 0.2)))))
shaphist = shaphist[0:0-1.]/np.sum(shaphist)
if histopt == 'smooth':
means = np.arange(0.1, 1.2, 0.2)
var = 0.2
#shaphist = cell2mat(arrayfun(lambda x: np.sum(np.exp(np.dot(-0.5, matdiv(shapes-x, var)**2.))), means, 'UniformOutput', false))
for x in np.nditer(means):
shaphist[x]=np.sum(np.exp(-0.5* (shapes-x/var)**2))
shaphist = shaphist/np.sum(shaphist)
feat = np.array(np.vstack((np.hstack((feat)), np.hstack((shaphist.conj().T)))))
#%% ratio of the areas
if method == 'arearatio' or method== 'all':
arearatio=[]
#arearatio = cell2mat(cellfun(lambda x: matdiv(matcompat.max((planes[int(x[0])-1].area), (planes[int(x[1])-1].area)), matcompat.max((planes[int(x[0])-1].area), (planes[int(x[1])-1].area))), comb, 'UniformOutput', false)).conj().T
for x in np.nditer(comb):
arearatio[x]=np.min(planes[x[0].area], planes[x[1].area]) / np.max(planes(x[0].area, planes(x[1].area)))
arhist = np.zeros(1., (len(np.array(np.hstack((np.arange(0., 1.2, 0.2)))))-1.))
if histopt == 'hard':
arhist = np.digitize(arearatio, np.array(np.hstack((np.arange(0., 1.2, 0.2))))) # arhist = histc(arearatio, [0:0.2:1]);
arhist = arhist[0:0-1.]/np.sum(arhist)
if histopt == 'smooth':
means = np.arange(0.1, 1.2, 0.2)
var = 0.2
#arhist = cell2mat(arrayfun(lambda x: np.sum(np.exp(np.dot(-0.5, matdiv(arearatio-x, var)**2.))), means, 'UniformOutput', false))
for x in np.nditer(means):
arhist[x]=np.sum(np.exp(-0.5* (arearatio-x/var)**2))
arhist = arhist/np.sum(arhist)
feat = np.array(np.vstack((np.hstack((feat)), np.hstack((arhist.conj().T)))))
if method== 'areas' or method== 'all':
areas = np.array(np.hstack((planes.area)))
ahist = np.digitize(areas, np.array(np.hstack((0, (np.array(np.hstack((0.25, 0.5, np.arange(1, 4.0))))*1000)**2))))
ahist = ahist[0:0-1]/np.sum(ahist)
feat = np.array(np.vstack((np.hstack((feat)), np.hstack((ahist.conj().T)))))
return [feat]<file_sep>/src/root/Utilities/get_expansion.py
import numpy as np
import numpy.matlib
import scipy
import matcompat
from root.PlaneExtraction.princomp import princomp
from align_pnts2plane import align_pnts2plane
from scipy.spatial import ConvexHull
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def get_expansion(pnts, display=False):
np.disp(('Trwa wykonywanie: get_expansion'))
# Local Variables: m, s2max, b1, b2, pnts, s1max, s1min, fig, psort_i1, psort_i2, pnts2, pnts1, R2, i1, i2, c2, c, b, coeff, area, s2min, shape, n, r, k, display
# Function calls: size, sort, princomp, align_pnts2plane, false, figure, get_expansion, max, plot, min, all, quiver, nargin, abs, convhull, eye, repmat, rectangle, mean
#%% [area, shape, b1, b2, s1min, s1max, s2min, s2max] = get_expansion(pnts, display)
#if nargin<2.:
# display = false
#%% rotate plane so that it is parallel to xy-plane and main principle axis
#% are parallel to the x-/y-axis
coeff = princomp(pnts[0:3.,:].conj().T)
b1 = coeff[:,0]
b2 = coeff[:,1]
n = coeff[:,2]
if np.all((n == np.array(np.vstack((np.hstack((0.)), np.hstack((0.)), np.hstack((1.))))))):
pnts1 = pnts-numpy.matlib.repmat(np.mean(pnts, 2), 1, np.size(pnts, 2))
else:
pnts1 = align_pnts2plane(pnts, n, np.mean(pnts, 2.))
try:
k = ConvexHull(pnts1[0,:], pnts1[1,:]) #mozliwe ze metoda dziala inaczej
except :
k = np.arange(1, (np.size(pnts1, 2))+1)
c = princomp(pnts1[0:2.,int(k)-1].conj().T)
b = c[:,0]
r = np.array(np.vstack((np.hstack((b[1], -b[0])), np.hstack((b[0], b[1])))))
R2 = np.eye(4.)
R2[0:2.,0:2.] = r
pnts2 = np.dot(R2, pnts1)
c2 = princomp(pnts2[0:2.,int(k)-1].conj().T)
#%% compute the expansion along the principle axis -> area and shape feature
[m, i1] = np.maximum(np.abs(c2[:,0]))
[m, i2] = np.maximum(np.abs(c2[:,1]))
psort_i1 = np.sort(pnts2[int(i1)-1,:])
psort_i2 = np.sort(pnts2[int(i2)-1,:])
s1min = np.maximum(np.abs(psort_i1[0]), np.abs(psort_i1[int(0)-1]))
s1max = np.maximum(np.abs(psort_i1[0]), np.abs(psort_i1[int(0)-1]))
s2min = np.maximum(np.abs(psort_i2[0]), np.abs(psort_i2[int(0)-1]))
s2max = np.maximum(np.abs(psort_i2[0]), np.abs(psort_i2[int(0)-1]))
area = np.dot(s1min+s1max, s2min+s2max)
shape = np.min((s2min+s2max), (s1min+s1max)/np.maximum(s2min+s2max), (s1min+s1max))
#%% show expansion
#if display:
# fig = plt.figure('Position', np.array(np.hstack((1000., 1280., 900., 900.))))
# #%subplot(1,2,1);
# #%plot_3Dpoints(pnts, 'k', fig);
# #%subplot(1,2,2);
# plt.plot(pnts2[0,:], pnts2[1,:], '.')
# plt.axis(equal)
# plt.hold(on)
# plt.quiver(0., 0., c2[0,0], c2[1,0], (-s1max), 'Color', 'r')
# plt.quiver(0., 0., c2[0,1], c2[1,1], (-s2max), 'Color', 'g')
# #%rectangle('Position', [-s2max -s1max 2*s2max 2*s1max], 'Curvature', [1 1]);
#%rectangle('Position', [-s2min -s1min 2*s2min 2*s1min], 'Curvature', [1 1]);
# rectangle('Position', np.array(np.hstack((psort_i2[0], psort_i1[0], s2min+s2max, s1min+s1max))))
return [area, shape, b1, b2, s1min, s1max, s2min, s2max]<file_sep>/src/root/PlaneExtraction/transform_planes.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def transform_planes(planes, m):
# Local Variables: d, i, coeff, m, n, planesMoved, planes, pnts
# Function calls: princomp, transform_planes, length, ones, size, mean
#% planesMoved = transform_planes(planes, m)
planesMoved = planes
n = length(planes)
i = 1.
while i<=n:
pnts = np.array(np.vstack((np.hstack((planes[int(i)-1].pnts)), np.hstack((np.ones(1., matcompat.size((planes[int(i)-1].pnts), 2.)))))))
pnts = np.dot(m, pnts)
planesMoved[int(i)-1].pnts = pnts[0:3.,:]
coeff = princomp(pnts.conj().T)
planesMoved[int(i)-1].n = coeff[0:3.,2]
planesMoved[int(i)-1].d = np.dot(planesMoved[int(i)-1].n.conj().T, np.mean((planesMoved[int(i)-1].pnts), 2.))
i = i+1.
return [planesMoved]<file_sep>/src/root/PlaneExtraction/edge_region_growing.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def edge_region_growing(bw, display):
# Local Variables: pr, c, posZeros, num, ngb, bwZeros, ran, segments, pc, p, display, ngbRC, width, bw, bwOnes, fig, n, height, seed, scrsz
# Function calls: drawnow, false, figure, get, random_positions, floor, any, nargin, length, zeros, edge_region_growing, get4ngb, mod, find, imagesc, size
#% segments = edge_region_growing(bw)
#%
#% Find all regions in the image "bw" (a black/white image, where edges are shown
#% white).
#% A region is defined as an area inside of connected edges
return [segments]<file_sep>/src/root/Utilities/random_positions.py
import numpy as np
import scipy
import matcompat
import random
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def random_positions(numOfPos, maxNum):
# Local Variables: l, c, maxNum, pos, numOfPos
# Function calls: rand, random_positions, find, length, unique, round
#% pos random_positions(numOfPos, maxNum)
np.disp(('Trwa wykonywanie: random_positions(numOfPos, maxNum)'))
pos = []
while(len(pos) < numOfPos):
l = len(pos)
c = 1
while(c <= (numOfPos-l)):
pos.append(round(random.uniform(0, 1)*maxNum))
c=c+1
pos = np.unique(pos);
np.delete(pos,0) #pos(find(pos == 0)) = []; - po co?
#pos(find(pos > maxNum)) = [];-po co?
return pos<file_sep>/src/root/Utilities/position_point_cloud.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def position_point_cloud(Pnts):
# Local Variables: Rot2, center, Pnts_new, normal, Rot1, normal_new, posEnd, T2, T1, angle1, angle2, Rot, Pnts, dEnd
# Function calls: cos, main_plane_extraction, atan, sum, position_point_cloud, sin, size
#% Pnts_new = position_point_cloud(Pnts)
#% Pnts = 3 x n matrix = 3D point cloud
#% Pnts_new = 3 x n matrix, new relocated point cloud
#%
#% Positions given point cloud to be parallel to the image plane.
#% finding plane in point_cloud
[posEnd, normal, dEnd] = main_plane_extraction(Pnts[0:3.,:])
#%[coeff, score, roots] = princomp(Pnts(1:3,:)');
#%normal = coeff(:,3);
#% determine center
center = np.sum(Pnts, 2.)/matcompat.size(Pnts, 2.)
#%% move points with center to origin
#%Tc = eye(4);
#%Tc(1:3,4) = -1*center(1:3);
#%Pnts_new = Tc * Pnts_new;
#%Pnts_new = Pnts-repmat([center(1:3); 0], 1, size(Pnts,2));
T1 = np.array(np.vstack((np.hstack((1., 0., 0., -center[0])), np.hstack((0., 1., 0., -center[1])), np.hstack((0., 0., 1., -center[2])), np.hstack((0., 0., 0., 1.)))))
T2 = np.array(np.vstack((np.hstack((1., 0., 0., 0.)), np.hstack((0., 1., 0., 0.)), np.hstack((0., 0., 1., center[2])), np.hstack((0., 0., 0., 1.)))))
#%% calculate angles for rotation
angle1 = atan(matdiv(normal[0], normal[1]))
Rot1 = np.array(np.vstack((np.hstack((np.cos(angle1), -np.sin(angle1), 0., 0.)), np.hstack((np.sin(angle1), np.cos(angle1), 0., 0.)), np.hstack((0., 0., 1., 0.)), np.hstack((0., 0., 0., 1.)))))
normal_new = np.dot(Rot1, np.array(np.vstack((np.hstack((normal)), np.hstack((1.))))))
angle2 = atan(matdiv(normal_new[1], normal[2]))
Rot2 = np.array(np.vstack((np.hstack((1., 0., 0., 0.)), np.hstack((0., np.cos(angle2), -np.sin(angle2), 0.)), np.hstack((0., np.sin(angle2), np.cos(angle2), 0.)), np.hstack((0., 0., 0., 1.)))))
#%% transformation matrix
Rot = np.dot(np.dot(np.dot(T2, Rot2), Rot1), T1)
#% Rot = [cos(angle1) -sin(angle1) 0 -center(1)*cos(angle1)+center(2)*sin(angle1); ...
#% cos(angle2)*sin(angle1) cos(angle2)*cos(angle1) -sin(angle2) -center(1)*cos(angle2)*sin(angle1)-center(2)*cos(angle2)*cos(angle1)+center(3)*sin(angle2); ...
#% sin(angle2)*sin(angle1) sin(angle2)*cos(angle1) cos(angle2) -center(1)*sin(angle2)*sin(angle1)-center(2)*sin(angle2)*cos(angle1)- center(3)*cos(angle2)+center(3); ...
#% 0 0 0 1];
#% rotate points in origin
Pnts_new = np.dot(Rot, Pnts)
#% % move points to have center on z-axis
return [Pnts_new, Rot]<file_sep>/src/root/Visualization/dis2color.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def dis2color(pnts):
# Local Variables: maxDis, map, minDis, i, step, pos, colors, steps, pnts, dis
# Function calls: colormap, jet, min, max, dis2color, length, zeros, repmat, find, size
#% colors = dis2color(pnts)
dis = pnts[2,:]
minDis = matcompat.max(dis)
maxDis = matcompat.max(dis)
colors = np.zeros(3., matcompat.size(pnts, 2.))
map = colormap(plt.jet)
#%map = map(end:-1:1,:);
step = matdiv(maxDis-minDis, matcompat.size(map, 1.)-1.)
steps = np.arange(minDis, (maxDis)+(step), step)
i = 2.
while i<=matcompat.size(map, 1.):
pos = nonzero(np.logical_and(dis >= steps[int((i-1.))-1], dis<steps[int(i)-1]))
colors[:,int(pos)-1] = matcompat.repmat(map[int(i)-1,:].conj().T, 1., length(pos))
i = i+1.
return [colors]<file_sep>/src/root/Visualization/show_clusters.py
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def show_clusters(clusters, minSize= 0, fig, method='points', s=[], p=0, marker='.', cMap):
# Local Variables: map, i, lo, K, l, rest, minSize, p, s, cMap, fig, X, in, marker, clusters, perm, method, ls
# Function calls: disp, plot_3Dpoints, repmat, false, figure, trisurf, randperm, find, convhulln, nargin, length, abs, isempty, cellfun, input, show_clusters, cat, generate_colormap, strcmp, size
#% fig = show_clusters(clusters, minSize, fig, method, s, p, marker, cMap)
#%
#% methods: -'points'; 'convexhull'
#do testu co to
#axis("off")
#axis("equal")
#if (nargin < 3 or isempty(fig)):
# #fig = figure('Position', [1 1 600 600]);
# fig = figure
#else:
# fig = figure(fig)
# end
if (logical_and(strcmp(method, mstring('convexhull')), isempty(s))):
s = input(mstring('Specific color for all hulls? \\n [default: press enter - each hull gets an other color]\\n'))
end
rest = []
_in = clusters
l = np.size(clusters, 2)#l = cellfun(mstring('size'), clusters, 2)
#[ls, li] = sort(l, 'descend');
#in = in(li);
ls = l
lo = np.nonzero((ls<minSize))#lo = find(ls < minSize)
if lo.size!= 0: #if (not isempty(lo)):
rest = cat(2, clusters(lo))
_in(lo).lvalue = mcat([])
if (nargin > 7):
map = cMap
else:
map = generate_colormap(length(_in))
map = abs(map)
map(find(map > 1)).lvalue = 1
end
if (p):
perm = randperm(length(_in))
_in = _in(perm)
end
i = 1
while (i <= length(_in)):
if (strcmp(method, mstring('points'))):
fig = plot_3Dpoints(_in(i), map(i, mslice[:]), fig, 6, marker)
elif (strcmp(method, mstring('convexhull'))):
hold("on")
X = _in(i).cT
K = convhulln(X(mslice[:], mslice[1:3]))
if (isempty(s)):
trisurf(K, X(mslice[:], 1), X(mslice[:], 2), -X(mslice[:], 3), repmat(mcat([i]), 1, size(K, 1)), mstring('FaceAlpha'), 0.5)
else:
trisurf(K, X(mslice[:], 1), X(mslice[:], 2), -X(mslice[:], 3), mstring('FaceAlpha'), 0.5, mstring('FaceColor'), map(i, mslice[:]))
end
else:
disp(mstring('Error: unknown display method!'))
end
i = i + 1
end
if (p):
map = map(perm, mslice[:])
end
if (not isempty(rest)):
fig = plot_3Dpoints(rest, mstring('k'), fig)
end
return [fig, map] | 278ab17809ff1947d5d4b193c14171d73835686e | [
"Python"
] | 60 | Python | Mavitis/RoomInspector | c70669fa62bbec3ed67e3d453bb6f4df2e5c0e71 | cd4e77c5eb397f4d719de1d912493dd4bca828ff |
refs/heads/master | <repo_name>rafmsou/node-express-sample<file_sep>/utils/travis-scripts/pullrequest.sh
#!/bin/bash
#The -e flag causes the script to exit as soon as one command returns a non-zero exit code.
#The -v flag makes the shell print all lines in the script before executing them
set -ev
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
cd public
ls
npm run lint
fi
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
echo rafael2
fi
<file_sep>/build-test.sh
#!/usr/bin/env sh
cd public
ls -l<file_sep>/db.js
module.exports = {
url : 'mongodb://localhost:8000/passport'
}<file_sep>/app.js
require('coffee-script').register();
var express = require('express')
, path = require('path')
, http = require('http')
, bodyParser = require('body-parser')
, favicon = require('serve-favicon')
, logger = require('morgan')
, methodOverride = require('method-override');
// Web Configuration and Middlewares
var app = express();
var router = express.Router();
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(favicon(__dirname + '/public/images/favicon.png'));
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(methodOverride('_method'));
app.use(express.static(path.join(__dirname, 'public')));
app.locals.basedir = path.join(__dirname, 'views');
if (app.get('env') == 'development') {
app.locals.pretty = true;
}
// Configuring Passport
var passport = require('passport');
var expressSession = require('express-session');
app.use(expressSession({secret: 'mySecretKey'}));
app.use(passport.initialize());
app.use(passport.session());
// Using the flash middleware provided by connect-flash to store messages in session and displaying in templates
var flash = require('connect-flash');
app.use(flash());
// Initialize Passport
var initPassport = require('./lib/middleware/passport/init');
initPassport(passport);
// Routes Setup
var routeConfig = require('./lib/base/routeConfig');
routeConfig.registerAppRoutes(router);
app.use('/', router);
// Database Setup
// var dbConfig = require('./db.js');
// var mongoose = require('mongoose');
// mongoose.connect(dbConfig.url);
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
}); | c05c8c4a5408e33fe7469eb9238f7cbe48b51fb0 | [
"JavaScript",
"Shell"
] | 4 | Shell | rafmsou/node-express-sample | ec1d32a6356ed912de4060d49e38dcdde1567212 | 0bfe023ee5dbe5c4f5b8fa2a93056a932da538a6 |
refs/heads/master | <file_sep>class Product < ActiveRecord::Base
belongs_to :category
belongs_to :user
has_many :reviews
validates :description, :title, presence: true
validates :price, :format => { :with => /\A\d+(?:\.\d{0,2})?\z/ }, presence: true
def average_rating
sum = 0
self.reviews.each do |review|
sum += review.rating
end
unless self.reviews.empty?
sum.to_f / self.reviews.length.to_f
else
0
end
end
end
<file_sep>class UsersController < ApplicationController
expose(:user)
def show
@reviews = user.reviews.order('created_at DESC').limit(5)
end
end<file_sep>Rails.application.routes.draw do
devise_for :users
resources :categories do
resources :products do
resources :reviews
end
end
get '/profile/:id' , to: 'users#show', as: 'user_profile'
root 'categories#index'
end
| d4945b42972281f15dcf00168426d7025c1df1c5 | [
"Ruby"
] | 3 | Ruby | badamziom/adam-workshops | 42e1756a7191b16d7b414eda8b29b43aed93facf | 2bb544c800e0e122b3188c233c59eceac82a3770 |
refs/heads/master | <repo_name>girishf15/DataFlairApp<file_sep>/dataflair/demo/views.py
from django.shortcuts import redirect
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
@cache_page(200)
def index(request):
return HttpResponse("<h1>Data Flair Django</h1>Hello, you just configured your First URL")
#cookie
@cache_page(200)
def setcookie(request):
html = HttpResponse("<h1>Dataflair Django Tutorial</h1>")
if request.COOKIES.get('visits'):
html.set_cookie('dataflair', 'Welcome Back')
value = int(request.COOKIES.get('visits'))
html = HttpResponse("<h1>Welcome Back</h1>")
html.set_cookie('visits', value + 1)
else:
value = 1
text = 'Welcome for the First Time'
html = HttpResponse("<h1>{}</h1>".format(text))
html.set_cookie('visits', value)
html.set_cookie('dataflair', text)
return html
#The cache_page() method takes in one argument, the expiration\
#time of cache data. The value is in seconds and we have given 200 in the above example.
@cache_page(200)
def showcookie(request):
if request.COOKIES.get('visits') is not None:
value = request.COOKIES.get('visits')
text = request.COOKIES.get('dataflair')
html = HttpResponse("<center><h1>{0}<br>You have requested this page {1} times</h1></center>".format(text, value))
html.set_cookie('visits', int(value) + 1)
return html
else:
return redirect('/setcookie')
#cookie sesssion
def cookie_session(request):
request.session.set_test_cookie()
return HttpResponse("<h1>dataflair</h1>")
def cookie_delete(request):
if request.session.test_cookie_worked():
request.session.delete_test_cookie()
response = HttpResponse("dataflair<br> cookie createed")
else:
response = HttpResponse("Dataflair <br> Your browser doesnot accept cookies")
return response
#seesssion based
def create_session(request):
request.session['name'] = 'username'
request.session['password'] = '<PASSWORD>'
return HttpResponse("<h1>dataflair<br> the session is set</h1>")
def access_session(request):
response = "<h1>Welcome to Sessions of dataflair</h1><br>"
if request.session.get('name'):
response += "Name : {0} <br>".format(request.session.get('name'))
if request.session.get('password'):
response += "Password : {0} <br>".format(request.session.get('password'))
return HttpResponse(response)
else:
return redirect('createsession/')
def delete_session(request):
try:
del request.session['name']
del request.session['password']
except:
pass
return HttpResponse("<h1>dataflair<br>Session Data cleared</h1>")
<file_sep>/requirements.txt
Django==2.2.8
djangorestframework==3.9.1
requests==2.20.0
boto==2.48.0
boto3==1.4.7
awscli==1.11.178
google-cloud==0.27.0
mysqlclient
python-memcached==1.59
<file_sep>/dataflair/subscribe/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('mailindex', views.subscribe),
]
<file_sep>/dataflair/demo/urls.py
from django.contrib import admin
from django.urls import path, include
from .views import *
urlpatterns = [
path('admin/', admin.site.urls),
path('', index),
#coockie
path('setcookie', setcookie),
path('getcookie', showcookie),
#request.session
path('testcookie/', cookie_session),
path('deletecookie/', cookie_delete),
#request.session[]
path('createsession/', create_session),
path('accesssession/', access_session),
path('deletesession/', delete_session),
]
| 4c7af901db1fa16cdf1cc566c749abb0b663ce84 | [
"Python",
"Text"
] | 4 | Python | girishf15/DataFlairApp | 3dd0a9cd55006b29af02b21d85975563126551ac | 2ac27533d953bea2be3227e083414eb7faf711c6 |
refs/heads/master | <file_sep>public class ArrayDeque<T> {
private T[] items;
private int capacity;
private int size;
private int nextFirst;
private int nextLast;
private int modCapacity(int i) {
return (i % capacity);
}
private boolean isFull() {
return (size == capacity);
}
private void resize(int cap) {
T[] newItems = (T[]) new Object[cap];
int index = modCapacity(nextFirst + 1);
for (int i = 0; i < size; i++) {
newItems[i] = items[index];
index = modCapacity(index + 1);
}
items = newItems;
capacity = cap;
nextFirst = capacity - 1;
nextLast = size;
}
public ArrayDeque() {
items = (T[]) new Object[8];
capacity = 8;
size = 0;
nextFirst = 7;
nextLast = 0;
}
public boolean isEmpty() {
return (size == 0);
}
public int size() {
return size;
}
public void addFirst(T item) {
if (isFull()) {
resize(size() * 2);
}
size += 1;
items[nextFirst] = item;
nextFirst = modCapacity(nextFirst - 1);
}
public void addLast(T item) {
size += 1;
items[nextLast] = item;
nextLast = modCapacity(nextLast + 1);
}
public T removeFirst() {
if (isEmpty()) {
return null;
}
size -= 1;
nextFirst = modCapacity(nextFirst + 1);
T res = items[nextFirst];
items[nextFirst] = null;
return res;
}
public T removeLast() {
if (isEmpty()) {
return null;
}
size -= 1;
nextLast = modCapacity(nextLast - 1);
T res = items[nextLast];
items[nextLast] = null;
return res;
}
public T get(int index) {
return items[modCapacity((nextFirst + 1 + index))];
}
public void printDeque() {
int index = modCapacity(nextFirst + 1);
for (int i = 0; i < size(); i++) {
System.out.print(items[index]);
System.out.print(' ');
index = modCapacity(index + 1);
}
}
}
<file_sep>package hw4.puzzle;
public class SearchNode implements Comparable<SearchNode>{
private WorldState currentWorld;
private int moves;
private SearchNode previousSearchNode;
public SearchNode(WorldState X, int mvs, SearchNode Y) {
currentWorld = X;
moves = mvs;
previousSearchNode = Y;
}
public WorldState getCurrentWorld() {
return currentWorld;
}
public SearchNode getPreviousSearchNode() {
return previousSearchNode;
}
public int getMoves() {
return moves;
}
@Override
public int compareTo(SearchNode other) {
return (this.getMoves() + this.getCurrentWorld().estimatedDistanceToGoal())
- (other.getMoves() + other.getCurrentWorld().estimatedDistanceToGoal());
}
}
<file_sep>package byog.Core;
import org.junit.Test;
import static org.junit.Assert.*;
public class testRoom {
@Test
public void testRoom() {
Position p1 = new Position(0, 0);
Position q1 = new Position(10, 10);
Room r1 = new Room(p1, q1);
Position p2 = new Position(8, 8);
Position q2 = new Position(15, 15);
Room r2 = new Room(p2, q2);
Position p3 = new Position(7, 7);
Position q3 = new Position(-2, 5);
Room r3 = new Room(p3, q3);
assertTrue(r1.isIntersect(r2));
assertFalse(r3.isIntersect(r2));
assertTrue(r3.isIntersect(r1));
}
}
<file_sep>package hw2;
import java.util.Random;
public class PercolationStats {
private int[] res;
private int T;
private Random random = new Random();
public PercolationStats(int N, int T, PercolationFactory pf) {
if (N <= 0 || T <= 0) {
throw new java.lang.IllegalArgumentException();
}
res = new int[T];
this.T = T;
for (int i = 0; i < T; i++) {
Percolation tmpTest = pf.make(N);
while (!tmpTest.percolates()) {
tmpTest.open(random.nextInt(N), random.nextInt(N));
}
res[i] = tmpTest.numberOfOpenSites();
}
}
public double mean() {
int sum = 0;
for (int i: res) {
sum += i;
}
return (double) sum / T;
}
public double stddev() {
int sum = 0;
for (int i: res) {
sum += (i - mean()) * (i - mean());
}
return (double) sum / (T - 1);
}
public double confidenceLow() {
return mean() - 1.96 * Math.sqrt(stddev() / T);
}
public double confidenceHigh() {
return mean() + 1.96 * Math.sqrt(stddev() / T);
}
}
| ec7e366ba23d78b323f8a63eb8e2a659208835c1 | [
"Java"
] | 4 | Java | Asuka20/cs61b-2018-spring | af63284b208b94106a9378bf0ef202ca09a6ac8f | 8b11484956dbe8f261052d790bca8f9d2a1d1683 |
refs/heads/master | <file_sep>class ShoppingExperience < ApplicationRecord
has_many :items , through: :cart
end
<file_sep>Rails.application.routes.draw do
resources :shex_items
resources :shopping_experiences
resources :items
resources :categories
root to: 'posts#index'
resources :posts
resources :home
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
<file_sep>json.extract! shex_item, :id, :shopping_experience_id, :item_id, :created_at, :updated_at
json.url shex_item_url(shex_item, format: :json)
<file_sep>class ShexItem < ApplicationRecord
belongs_to :shopping_experience
belongs_to :item
end
| bcec7c4ce3874f31b5c462b09f284606c2382113 | [
"Ruby"
] | 4 | Ruby | HaroonAzhar/shop_rails | b26555ba3b159439d830552cae9b8e237f1c2064 | 5bccca246387775d178e6c5e6690129a2d45e075 |
refs/heads/master | <repo_name>sabates/couchdb4j<file_sep>/src/test/com/fourspaces/couchdb/test/TestHttpClient.java
package com.fourspaces.couchdb.test;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
import java.io.IOException;
import java.net.SocketTimeoutException;
/**
* Date: 11/10/12
*
* @author lreeder
*/
public class TestHttpClient implements HttpClient
{
private IOException exceptionToThrow = null;
public TestHttpClient()
{
}
public TestHttpClient(IOException exceptionToThrow)
{
this.exceptionToThrow = exceptionToThrow;
}
public HttpParams getParams()
{
throw new UnsupportedOperationException("Method getParams not implemented.");
}
public ClientConnectionManager getConnectionManager()
{
throw new UnsupportedOperationException("Method getConnectionManager not implemented.");
}
public HttpResponse execute(HttpUriRequest httpUriRequestIn) throws IOException, ClientProtocolException
{
if(exceptionToThrow != null)
{
throw exceptionToThrow;
}
throw new UnsupportedOperationException("Method execute not implemented.");
}
public HttpResponse execute(HttpUriRequest httpUriRequestIn,
HttpContext httpContextIn) throws IOException, ClientProtocolException
{
throw new UnsupportedOperationException("Method execute not implemented.");
}
public HttpResponse execute(HttpHost httpHostIn,
HttpRequest httpRequestIn) throws IOException, ClientProtocolException
{
throw new UnsupportedOperationException("Method execute not implemented.");
}
public HttpResponse execute(HttpHost httpHostIn, HttpRequest httpRequestIn,
HttpContext httpContextIn) throws IOException, ClientProtocolException
{
throw new UnsupportedOperationException("Method execute not implemented.");
}
public <T> T execute(HttpUriRequest httpUriRequestIn,
ResponseHandler<? extends T> responseHandlerIn) throws IOException, ClientProtocolException
{
throw new UnsupportedOperationException("Method execute not implemented.");
}
public <T> T execute(HttpUriRequest httpUriRequestIn, ResponseHandler<? extends T> responseHandlerIn,
HttpContext httpContextIn) throws IOException, ClientProtocolException
{
throw new UnsupportedOperationException("Method execute not implemented.");
}
public <T> T execute(HttpHost httpHostIn, HttpRequest httpRequestIn,
ResponseHandler<? extends T> responseHandlerIn) throws IOException, ClientProtocolException
{
throw new UnsupportedOperationException("Method execute not implemented.");
}
public <T> T execute(HttpHost httpHostIn, HttpRequest httpRequestIn, ResponseHandler<? extends T> responseHandlerIn,
HttpContext httpContextIn) throws IOException, ClientProtocolException
{
throw new UnsupportedOperationException("Method execute not implemented.");
}
}
| 1362cedb356371b0dd399a500d2f9ab59fdfccc9 | [
"Java"
] | 1 | Java | sabates/couchdb4j | b75e6f6c83ccb7f7fa52f272bb035a711ff9b9cd | 595e0d5e6dfb8aa9206cc00baf1659c60626423c |
refs/heads/main | <file_sep>function DeleteEvents() {
/* The DeleteEvents function in Calendar Scheduler takes input from
the AHS Personal Scheduler Google Spreadsheet and then deletes the
appointments for each class on each school day from the specified
Google Calendar. It only deletes events made by CreateEvents, denoted
by the text "This event was created by the webapp AHS Personal Calendar."
in the description of the event.
Author: <NAME>
Date Updated: September 16, 2021
Github code: https://github.com/mbezaire/ahs-scheduler
Report issues with this code to: https://github.com/mbezaire/ahs-scheduler/issues > New issue
*/
var ss = SpreadsheetApp.getActiveSpreadsheet();
Logger.log("Spreadsheet = " + ss);
var nowdate = new Date();
var bnames = ss.getSheets()[0];
var range = bnames.getRange("M6:N7");
var TermDates = range.getValues();
Logger.log(TermDates);
var range = bnames.getRange("H5");
if (range.getValue()=="All") {
var Term = 9;
} else {
var Term = range.getValue();
}
if (Term==1) {
var startYear = new Date(TermDates[0][0]);
var endYear = new Date(TermDates[0][1]);
} else if (Term==2) {
var startYear = new Date(TermDates[1][0]);
var endYear = new Date(TermDates[1][1]);
} else if (Term==9) {
var startYear = new Date(TermDates[0][0]);
var endYear = new Date(TermDates[1][1]);
}
Logger.log(startYear + " - " + endYear);
var bnames = ss.getSheets()[0];
var range = bnames.getRange("H3");
var CalName = range.getValue();
var range = bnames.getRange("H4");
var updateAll = (range.getValue()=='All');
var range = bnames.getRange("N5");
var sleepTime = range.getValue();
Logger.log("Will be deleting events from Calendar: " + CalName);
var events = CalendarApp.getCalendarsByName(CalName)[0].getEvents(startYear, endYear,
{search: "This event was created by the webapp AHS Personal Calendar."});
Logger.log("Events = " + events.length);
bnames.getRange("H10").setValue("You'll need to run the script again; still working.");
for (e=0; e<events.length; e++) {
if (nowdate<=events[e].getStartTime() || updateAll==true) {
events[e].deleteEvent();
Utilities.sleep(sleepTime)
}
if (e%20==0) {
Logger.log("Deleted " + e + " events so far...");
}
}
bnames.getRange("N2:N4").setValues([[0],[1],[ 0]]);
bnames.getRange("H10").setValue("All done, last updated at " + Date());
}
<file_sep># ahs-scheduler
AHS Personal Scheduler Google Script
<file_sep>function CreateEvents() {
/* The CreateEvents function in Calendar Scheduler takes input from
the AHS Personal Scheduler Google Spreadsheet and then populates
a Google Calendar with appointments for each class on each school day.
Author: <NAME>
Date Updated: September 16, 2021
Github code: https://github.com/mbezaire/ahs-scheduler
Report issues with this code to: https://github.com/mbezaire/ahs-scheduler/issues > New issue
*/
var ss = SpreadsheetApp.getActiveSpreadsheet();
Logger.log("Will be pulling data from Spreadsheet " + ss)
// Get class times for full day, half day, and delayed (1,1.5,2 hrs) days
// These data are set in the spreadsheet and can be updated there
var scheds = ss.getSheets()[5];
var range = scheds.getRange("J2:J6");
const fullStartTimes = range.getValues();// ["8:15", "9:23", "10:47", "11:49", "13:49"];
var range = scheds.getRange("K2:K6");
const fullEndTimes = range.getValues();// ["9:17", "10:41", "11:47", "13:43", "14:51"];
var range = scheds.getRange("AA2:AA4");
const halfStartTimes = range.getValues();// ["8:15", "9:22", "10:27"];
var range = scheds.getRange("AB2:AB4"); //
const halfEndTimes = range.getValues();// ["9:18", "10:23", "11:30"];
var range = scheds.getRange("J16:R19"); //
const LunchClassTimes = range.getValues();// ["9:18", "10:23", "11:30"];
// The rotating cycle of class meetings over 8 days
var range = scheds.getRange("B8:I8");
const dayTypeBlocks =range.getValues()[0];// ["ACHEG", "BDFGE", "AHDCF", "BAHGE", "CBFDG", "AHEFC", "BADEG", "CBHFD"];
var range = scheds.getRange("T8:Z8");
const halfDayTypeBlocks = range.getValues()[0];// ["ABC","DEF","GAB","CDE","FGA","BCD","EFG"];
// read in i and block - if the script times out in the middle of nested for loops, we want
// to be able to continue where we left off. Where we left off is saved in a range of cells
// in the sheet:
var bnames = ss.getSheets()[0];
// Initialize the counters for the nested for loops
var termStart = 0; // Semester
var iStart = 1; // Day in Semester
var blockStart = 0; // Block in Day
// Find whether user wants to work with events in Fall (1), Spring (2), or all year (9/All)
var range = bnames.getRange("H5");
if (range.getValue()=="All") {
var Term = 9; // Fall and Spring Semesters
} else {
var Term = range.getValue(); // One Semester only
}
var range = bnames.getRange("N5");
var sleepTime = range.getValue();
var range = bnames.getRange(2,14,3); // N2:N4
var loopvals = range.getValues();
termStart = loopvals[0];
iStart = loopvals[1];
blockStart = loopvals[2];
Logger.log("termstart = " + termStart + "istart = " + iStart + ", blockStart = " + blockStart)
bnames.getRange("H10").setValue("You'll need to run the script again; still working.");
var range = bnames.getRange("H3");
var CalName = range.getValue();
if (CalName=="") {
var calendars = CalendarApp.createCalendar('MyClasses');
bnames.getRange("H3").setValue("MyClasses");
return
}
Logger.log("Will be adding events to Calendar: " + CalName);
var range = bnames.getRange("H2");
var allDayDesc = range.getValue();
var range = bnames.getRange("H4");
var updateAll = (range.getValue()=='All');
if (Term==1) {var Sheets2Do=[3];}
else if (Term==2) {var Sheets2Do=[4]}
else if (Term==9) {var Sheets2Do=[3,4];}
for (term2do=termStart;term2do<Sheets2Do.length;term2do++) {
var sheet = ss.getSheets()[Sheets2Do[term2do]];
var range = sheet.getDataRange();
var values = range.getValues();
var range = bnames.getRange(2 + (Sheets2Do[term2do]-3)*9, 2, 8);
var blocknames = range.getValues();
var range = bnames.getRange(2 + (Sheets2Do[term2do]-3)*9, 3, 8);
var blockletters = range.getValues();
var range = bnames.getRange(2 + (Sheets2Do[term2do]-3)*9, 5, 8);
var blockrooms = range.getValues();
var range = bnames.getRange(2 + (Sheets2Do[term2do]-3)*9, 6, 8);
var lunches = range.getValues();
Logger.log("Will be adding events from Term: " + sheet.getName());
var blankcheck=0
for (q=0;q<blocknames.length;q++) {
if (blocknames[q]=="") {
blankcheck += 1
}
}
for (q=0;q<blockletters.length;q++) {
if (blockletters[q]=="") {
blankcheck += 1
}
}
for (q=0;q<blockrooms.length;q++) {
if (blockrooms[q]=="") {
blankcheck += 1
}
}
for (q=0;q<lunches.length;q++) {
if (lunches[q]=="") {
blankcheck += 1
}
}
//Only run this check for students
var range = bnames.getRange("H6");
var PersonType = range.getValue();
if (blankcheck>0 && PersonType=="Student") {
bnames.getRange("H10").setValue("Make sure all the classes, letters, rooms, and lunches"
+ " are filled out for the semester you want to schedule");
return
}
var durations = [0,0,0,0,0,0,0,0]; // Not implemented yet
for (var i = iStart; i < values.length; i++) { // start at 1 due to header in 0th row
var dayType = values[i][2];
var dayDesc = values[i][1] + ", " + values[i][2];
Logger.log("Day Description: " + dayDesc);
var calendars = CalendarApp.getCalendarsByName(CalName)[0]; // getDefaultCalendar();
if (calendars==null)
{
var calendars = CalendarApp.createCalendar(CalName);
bnames.getRange("H10").setValue("Just created Calendar " + CalName);
}
var nowdate = new Date();
if (allDayDesc==1 && (nowdate<=startTime || updateAll==true)) {
var event = calendars.createAllDayEvent(dayDesc, new Date(values[i][0]),
{description: "This event was created by the webapp AHS Personal Calendar." +
" To delete all these events or update in bulk, use the buttons in your Google Sheet entitled" +
" 'AHS Personal Calendar', available at: " + ss.getUrl() + ""});
}
if (["X","Y","Z","EXAM"].indexOf(dayType) > -1) {
var startTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1) + "-"
+ (values[i][0].getDate()) + " 8:15");
var endTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1) + "-"
+ (values[i][0].getDate()) + " 14:51");
caltitle = dayType;
Logger.log("Different day startTime=" + startTime + ", endTime=" + endTime + ", caltitle="
+ caltitle + ", dayDesc=" + dayDesc);
if (nowdate<=startTime || updateAll==true) {
event = calendars.createEvent("Day " + caltitle, startTime, endTime,
{description: dayDesc + "\n\nThis event was created by the webapp AHS Personal Calendar." +
" To delete all these events or update in bulk, use the buttons in your Google Sheet entitled" +
" 'AHS Personal Calendar', available at: " + ss.getUrl() + ""});
}
continue;
} else if (values[i][1]=="Full Day") {
var todayBlocks = dayTypeBlocks[dayType-1];
var startTimes = fullStartTimes;
var endTimes = fullEndTimes;
} else if (values[i][1]=="Half Day") {
var todayBlocks = halfDayTypeBlocks[dayType[dayType.length - 1]-1];
var startTimes = halfStartTimes;
var endTimes = halfEndTimes;
}
// Block #
for (var block = blockStart; block < todayBlocks.length; block++) {
var mystart = new Date(startTimes[block]);
var myend = new Date(endTimes[block]);
Logger.log(mystart.getHours() + ":" + mystart.getMinutes() + ":00 - " +myend.getHours() + ":"
+ myend.getMinutes() + ":00")
// class ends at ... LunchClassTimes[lunch][0]
// class starts again at ... LunchClassTimes[lunch][1]
var startTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1)
+ "-" + (values[i][0].getDate()) + " " + mystart.getHours() + ":" + mystart.getMinutes() + ":00");
var endTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1)
+ "-" + (values[i][0].getDate()) + " " + myend.getHours() + ":" + myend.getMinutes() + ":00");
if (nowdate>startTime && updateAll==false) {
continue;
}
var durToday = endTime.getHours()*60 + endTime.getMinutes() - startTime.getHours()*60
- startTime.getMinutes();
var blockLetter = todayBlocks[block];
Logger.log("todayBlocks = " + todayBlocks + ", block = " + block + ", blockLetter = "
+ blockLetter + ", blockletters = " + blockletters);
var ind = blockletters.join('').indexOf(blockLetter);
if (blocknames[ind][0]=="") {
Logger.log("empty blocknames for ind = " + ind + ", move on from i=" + i)
continue
} // if no class specified (can happen for Staff) then skip making a calendar entry
var caltitle = blocknames[ind][0] + " (" + blockLetter + ")"; // Look up name on 1st tab given block letter
var calloc = "Room #" + blockrooms[ind]; // Look up room on first tab given block letter
var mydesc = "Session #" + values[i][3+ind]
// Not implemented yet, for duration:
// + " for this class.\n\nMinutes of class before today: " + durations[ind] + "\nMinutes of class today: "
// + durToday + "\nMinutes of class after today: " + durations[ind]+durToday
+ "\n\nThis event was created by the webapp AHS Personal Calendar."+
" To delete all these events or update in bulk, use the buttons in your Google Sheet entitled" +
" 'AHS Personal Calendar', available at: " + ss.getUrl() + "";
Logger.log("startTime=" + startTime + ", endTime=" + endTime + ", caltitle=" + caltitle
+ ", calloc=" + calloc)
durations[ind] += durToday;
if (block==3) {// reg full day, 0-based block 4
var lunch = lunches[ind];
if (lunch=="") {
Logger.log("No lunch specified, making Block 3 the full time");
} else {
Logger.log("Todays lunch is #" + lunch);
mydesc = "Lunch #" + lunch + "\n" + mydesc;
if (lunch==1) {
// updateStartTime
var mystart = new Date(LunchClassTimes[lunch-1][1]);
var startTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1) + "-"
+ (values[i][0].getDate()) + " " + mystart.getHours() + ":" + mystart.getMinutes() + ":00");
} else if (lunch==4) {
// class ends at ... LunchClassTimes[lunch-1][0]
var myend = new Date(LunchClassTimes[lunch-1][0]);
var endTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1) + "-"
+ (values[i][0].getDate()) + " " + myend.getHours() + ":" + myend.getMinutes() + ":00");
} else {
Logger.log("lunch = "+lunch+", tmes="+LunchClassTimes)
var myend = new Date(LunchClassTimes[lunch-1][0]);
var NewendTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1) + "-"
+ (values[i][0].getDate()) + " " + myend.getHours() + ":" + myend.getMinutes() + ":00");
var event =
calendars.createEvent(caltitle, startTime, NewendTime, {location: calloc, description: mydesc});
// class starts again at ... updateStartTime
var mystart = new Date(LunchClassTimes[lunch-1][1]);
var startTime = new Date(values[i][0].getFullYear() + "-" + (values[i][0].getMonth()+1) + "-"
+ (values[i][0].getDate()) + " " + mystart.getHours() + ":" + mystart.getMinutes() + ":00");
}
}
}
var event = calendars.createEvent(caltitle, startTime, endTime, {location: calloc, description: mydesc});
// write out i and block
bnames.getRange("N2:N4").setValues([[term2do],[i],[ block+1]]);
Utilities.sleep(sleepTime);
} // added all the blocks for a day
blockStart = 0; // if the script had to restart where it left off for one day, blockStart>0, but of course
// the next day we want to start again at 0 to add all blocks.
bnames.getRange("H10").setValue("You'll need to run the script again; still working.");
} // added all the days for this term
//SpreadsheetApp.getUi().prompt('Your class appointments in Google Calendar have been added/updated.');;
bnames.getRange("N2:N4").setValues([[0],[1],[ 0]]);
bnames.getRange("H10").setValue("All done, last updated at " + Date());
} // finished all the terms for this function
iStart = 1;
}// finished the fcn
| 0b2a98bda7a5a86a2ca6bfa983431055cfb7f876 | [
"JavaScript",
"Markdown"
] | 3 | JavaScript | mbezaire/ahs-scheduler | 0d405b2fdf480c5de0526779358902744c13d62a | 5c55dc9c7bb45e27e09bb9dd93821d8891558a96 |
refs/heads/master | <file_sep>function Game(dimensions){//Class
this.dimensions = dimensions;
this.progress = 0;
this.grid = this.generate_grid();
this.previous_square = {};
this.current_square = {};
}
Game.prototype.generate_grid = function(){
arr_of_ns = custom_array(this.dimensions);
my_grid = []
for (var i=0; i<this.dimensions; i++){
for (var j=0; j<this.dimensions; j++){
custom_value = arr_of_ns.splice(Math.floor(Math.random()*arr_of_ns.length),1)//when finished returns []
n_s = new Square(i, j, custom_value[0])
my_grid.push(n_s)
}
}
return my_grid;
}
function custom_array(dimensions){//creates a custom array of nrs with dim*dim length
var arr =[]//works
var i=0
while (i<dimensions*dimensions/2){
nr = Math.floor(Math.random()*1000)
if (!(nr in arr)) {i++ ; arr.push(nr);}
}
newarr = arr.concat(arr)
return newarr
}
Game.prototype.check = function(){// checks the values of the Square obj of 2!
if (! Object.keys(this.previous_square).length) return true
if (this.previous_square.value == this.current_square.value
&& (this.previous_square.x != this.current_square.x
|| this.previous_square.y != this.current_square.y)) {
this.progress+=1
return true
};
return false;
}
Game.prototype.play = function(x, y){
for (var i=0; i<this.grid.length;i++){
var arr = [this.grid[i].x, this.grid[i].y]
if (this.grid[i].x == x && this.grid[i].y == y){
this.grid[i].visible = true;
this.current_square = this.grid[i];
continue;
}
}
var inst = this.progress;
var check = this.check()
if (!check){
this.previous_square.visible = false;
this.current_square.visible = false;
this.previous_square = {}
this.current_square = {}
}
if (inst != this.progress){
this.previous_square = {}
}
else{
this.previous_square =this.current_square
}
if (this.progress == this.dimensions*this.dimensions/2){
console.log('game over')
}
this.print_grid()
if (this instanceof HTMLRenderer){
this.generate_html_grid()
}
}
Game.prototype.print_grid = function (){////prints in console WORKS
var str='';
for (var i=0; i<this.grid.length; i++){
if (this.grid[i].visible){
str += this.grid[i].value + '||'
}
else {
str+="O||"
}
if (!((i+1)%this.dimensions) && Math.floor(i+1/this.dimensions)>0){
console.log(str + "\n" + i)
str = ''
}
}
}
function Square(x, y ,value){//class
this.x = x;
this.y = y
this.value = value;
this.visible = false;
this.element = document.createElement('button');
this.element.addEventListener('click', this, false)
}
Square.prototype.handleEvent = function(e) {
switch (e.type) {
case "click": console.log(this);
render.play(this.x, this.y);
render.generate_html_grid();//shouldnt render every time....
/*if (this.visible) this.element.innerHTML = this.value
else this.element.innerHTML = 'OO'
if (render.previous_square.visible) render.previous_square.innerHTML = render.previous_square.value
else render.previous_square.innerHTML = 'OO'*/
}
}
function HTMLRenderer(dimensions){
Game.call(this, dimensions)
this.html_grid = this.generate_html_grid()
}
// subclass extends superclass
HTMLRenderer.prototype = Object.create(Game.prototype);
HTMLRenderer.prototype.constructor = HTMLRenderer;
HTMLRenderer.prototype.generate_html_grid = function(){
document.body.innerHTML = ''
for (i=0; i<this.grid.length; i++){
if (!((i+1)%this.dimensions) && Math.floor(i+1/this.dimensions)>0){
document.body.appendChild(this.grid[i].element)
document.body.appendChild(document.createElement('br'))
}
else document.body.appendChild(this.grid[i].element)
if (this.grid[i].visible) this.grid[i].element.innerHTML = this.grid[i].value;
else this.grid[i].element.innerHTML = 'OO';
}
}
var render ;
function onLoad(){
var dim = window.prompt('enter dimension from 2 to 24', '4')
render = new HTMLRenderer(Number(dim))
}<file_sep>FROM proudmail/ubuntu-16.04
MAINTAINER <NAME> "<EMAIL>"
ADD ./ /tmp/comp
WORKDIR /tmp/comp
RUN apt-get update --upgrade && apt-get install nodejs && \
apt-get install npm && \
ln -s /usr/bin/nodejs /usr/bin/node && \
npm install -g lite-server
EXPOSE 3000
CMD ["lite-server"]
| c155e85ea1d5504ceab77ae3c028ca7443326aa7 | [
"JavaScript",
"Dockerfile"
] | 2 | JavaScript | nekatak/js-game | 15ca0960d27e87d957c90b89fa0f6de3bad74930 | efe74da6d3ad81b6c144e8624d10c0f1360fe176 |
refs/heads/master | <repo_name>objcio/S01E225-swiftui-layout-explained-view-protocols-and-shapes<file_sep>/README.md
# Swift Talk
## SwiftUI Layout Explained: View Protocols and Shapes
This is the code that accompanies Swift Talk Episode 225: [SwiftUI Layout Explained: View Protocols and Shapes](https://talk.objc.io/episodes/S01E225-swiftui-layout-explained-view-protocols-and-shapes)
<file_sep>/SwiftUILayout/ContentView.swift
//
// ContentView.swift
// NotSwiftUI
//
// Created by <NAME> on 05.10.20.
//
import SwiftUI
protocol View_ {
associatedtype Body: View_
var body: Body { get }
}
typealias RenderingContext = CGContext
typealias ProposedSize = CGSize
protocol BuiltinView {
func render(context: RenderingContext, size: ProposedSize)
typealias Body = Never
}
extension View_ where Body == Never {
var body: Never { fatalError("This should never be called.") }
}
extension Never: View_ {
typealias Body = Never
}
extension View_ {
func _render(context: RenderingContext, size: ProposedSize) {
if let builtin = self as? BuiltinView {
builtin.render(context: context, size: size)
} else {
body._render(context: context, size: size)
}
}
}
protocol Shape_: View_ {
func path(in rect: CGRect) -> CGPath
}
extension Shape_ {
var body: some View_ {
ShapeView(shape: self)
}
}
extension NSColor: View_ {
var body: some View_ {
ShapeView(shape: Rectangle_(), color: self)
}
}
struct ShapeView<S: Shape_>: BuiltinView, View_ {
var shape: S
var color: NSColor = .red
func render(context: RenderingContext, size: ProposedSize) {
context.saveGState()
context.setFillColor(color.cgColor)
context.addPath(shape.path(in: CGRect(origin: .zero, size: size)))
context.fillPath()
context.restoreGState()
}
}
struct Rectangle_: Shape_ {
func path(in rect: CGRect) -> CGPath {
CGPath(rect: rect, transform: nil)
}
}
struct Ellipse_: Shape_ {
func path(in rect: CGRect) -> CGPath {
CGPath(ellipseIn: rect, transform: nil)
}
}
let sample = NSColor.blue
func render<V: View_>(view: V) -> Data {
let size = CGSize(width: 600, height: 400)
return CGContext.pdf(size: size) { context in
view._render(context: context, size: size)
}
}
struct ContentView: View {
var body: some View {
Image(nsImage: NSImage(data: render(view: sample))!)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
| 37d124abd3a7b8fac97fe7015c03df5733d21f49 | [
"Markdown",
"Swift"
] | 2 | Markdown | objcio/S01E225-swiftui-layout-explained-view-protocols-and-shapes | 987f2f643393c955c15292df6c84735fd30fb524 | 783d876428cb9db7b0c3cd2caff9d16642c58269 |
refs/heads/master | <file_sep>class SmsBox:
def __init__(self, id_box, box_code, description):
self._id_box = id_box
self._box_code = box_code
self._description = description
@property
def id_box(self):
return self._id_box
@id_box.setter
def id_box(self, id_box):
self._id_box = id_box
@property
def box_code(self):
return self._box_code
@box_code.setter
def box_code(self, box_code):
self._box_code = box_code
@property
def description(self):
return self._description
@description.setter
def description(self, description):
self.description = description
<file_sep>class CallsLog:
def __init__(self, id_call, from_number, to_number, duration, time, type_call, is_deleted):
self._id_call = id_call
self._from_number = from_number
self._to_number = to_number
self._duration = duration
self._time = time
self._type_call = type_call
self._is_deleted = is_deleted
@property
def id_call(self):
return self._id_call
@id_call.setter
def id_call(self, id_call):
self._id_call = id_call
@property
def from_number(self):
return self._from_number
@from_number.setter
def from_number(self, from_number):
self._from_number = from_number
@property
def to_number(self):
return self._to_number
@to_number.setter
def to_number(self, to_number):
self.to_number = to_number
<file_sep>import sqlite3
from Config import app_config as appconfig
class DbConnector:
conn = None
dbFile = appconfig.Configuration.default()["datasource"]
cursor = None
@staticmethod
def __open_connect():
try:
global conn, dbFile, cursor
conn = sqlite3.connect(dbFile)
cursor = conn.cursor()
return True
except sqlite3.Error as e:
print("Error when connect to database: " + e.args[0])
return False
@staticmethod
def execute_fetch_all(self, sql):
try:
self.__open_connect()
global cursor
cursor.execute(sql)
return cursor.fetchall()
except sqlite3.Error as e:
print("Error when execute fetch data " + e.args[0])
return None
@staticmethod
def execute_fetch_one(self, sql):
try:
self.__open_connect()
global cursor
cursor.execute(sql)
return cursor.fetchone()
except sqlite3.Error as e:
print("Error when execute fetch data: " + e.args[0])
return None
@staticmethod
def execute_non_query(self, sql):
try:
self.__open_connect()
global cursor, conn
cursor.execute(sql)
conn.commit()
return True
except sqlite3.Error as e:
print("Error when execute non-query " + e.args[0])
return False
<file_sep>class Message:
def __init__(self, message_id, message, phonenumber, belongs_to_contact, created, box_id, is_deleted, updated):
self._message_id = message_id
self._message = message
self._phonenumber = phonenumber
self._belongs_to_contact = belongs_to_contact
self._created = created
self._box_id = box_id
self._is_deleted = is_deleted
self._updated = updated
@property
def message_id(self):
return self._message_id
@message_id.setter
def message_id(self, message_id):
self._message_id = message_id
@property
def message(self):
return self._message
@message.setter
def message(self, message):
self._message = message
@property
def phonenumber(self):
return self._phonenumber
@phonenumber.setter
def phonenumber(self, phonenumber):
self._phonenumber = phonenumber
@property
def belongs_to_contact(self):
return self._belongs_to_contact
@belongs_to_contact.setter
def belongs_to_contact(self, belongs_to_contact):
self._belongs_to_contact = belongs_to_contact
@property
def created(self):
return self._created
@created.setter
def created(self, created):
self._created = created
@property
def box_id(self):
return self._box_id
@box_id.setter
def box_id(self, box_id):
self._box_id = box_id
@property
def is_deleted(self):
return self._is_deleted
@is_deleted.setter
def is_deleted(self, is_deleted):
self._is_deleted = is_deleted
@property
def updated(self):
return self._updated
@updated.setter
def updated(self, updated):
self._updated = updated
<file_sep>class TypeCall:
def __init__(self, id_type, type_code, description):
self._id_type = id_type
self._type_code = type_code
self._description = description
@property
def id_type(self):
return self._id_type
@id_type.setter
def id_type(self, id_type):
self._id_type = id_type
@property
def type_code(self):
return self._type_code
@type_code.setter
def type_code(self, type_code):
self._type_code = type_code
@property
def description(self):
return self._description
@description.setter
def description(self, description):
self._description = description
<file_sep>"# PiPhone"
Phone emulator running on Raspberry Pi using Python and GPIO library
<file_sep>pyserial
git+https://github.com/adafruit/Adafruit_Nokia_LCD.git
Pillow<file_sep>import time
import datetime
def convert_to_unix_timestamp(valuedatetime):
unixtime = time.mktime(valuedatetime.timetuple())
return unixtime
def convert_timestamp_to_time(valuetimestamp):
d = datetime.datetime.fromtimestamp(valuetimestamp)
return d
<file_sep>from constants import Constants
import serial
from serial import SerialException
from serial import SerialTimeoutException
import sys
import glob
import time
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import Adafruit_Nokia_LCD as Lcd
import Adafruit_GPIO.SPI as SPI
import os
com = None
list_ports = []
font = ImageFont.load_default()
mainMenu = False
left_button_text = "Select"
right_button_text = "Back"
# Raspberry Pi hardware SPI config:
DC = 23
RST = 24
SPI_PORT = 0
SPI_DEVICE = 0
# Raspberry Pi software SPI config:
# SCLK = 4
# DIN = 17
# DC = 23
# RST = 24
# CS = 8
# Hardware SPI usage:
disp = Lcd.PCD8544(DC, RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=4000000))
# Software SPI usage (defaults to bit-bang SPI interface):
# disp = LCD.PCD8544(DC, RST, SCLK, DIN, CS)
# Initialize library.
disp.begin(contrast=60)
# Clear display.
disp.clear()
disp.display()
def detect_env():
if sys.platform.startswith('win'): return Constants.WIN_SYS
elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'): return Constants.LINUX_SYS
elif sys.platform.startswith('darwin'): return Constants.LINUX_SYS
def scan_port():
global list_ports
if sys.platform.startswith('win'):
ports = ['COM%s' % (i + 1) for i in range(256)]
elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
ports = glob.glob('/dev/tty[A-Za-z]*')
elif sys.platform.startswith('darwin'):
ports = glob.glob('/dev/tty.*')
else:
raise EnvironmentError('Unsupported platform')
result = []
for port in ports:
try:
s = serial.Serial(port)
s.close()
result.append(port)
except (OSError, serial.SerialException):
pass
list_ports = result
def init_port():
global com
com = serial.Serial("COM1")
com.baudrate = 9600
com.timeout = 1
com.parity = serial.PARITY_NONE
com.bytesize = serial.EIGHTBITS
com.stopbits = serial.STOPBITS_ONE
com.xonxoff = serial.XOFF
com.rtscts = 0
def send_command(cmd):
if com is None:
init_port()
if not com.is_open:
com.open()
try:
com.write(cmd)
except SerialTimeoutException:
print("Sent command timeout")
except SerialException:
print("Error while send packet")
def receive_serial_packet():
pass
def show_screen():
pass
def build_nav_button():
image = Image.new('1', (Lcd.LCDWIDTH, Lcd.LCDHEIGHT))
draw = ImageDraw.Draw(image)
selectMaxWidth, selectHeight = draw.textsize(left_button_text, font=font)
backMaxWidth, backHeight = draw.textsize(right_button_text, font=font)
def build_calling_screen():
pass
def build_main_menu_screen():
build_nav_button()
main_dir = os.path.dirname(__file__)
contacts_menu = ('Contacts', os.path.join(main_dir, './Resources/contacts_icon.png'))
messages_menu = ('Messages', os.path.join(main_dir, './Resources/messages_icon.png'))
calls_menu = ('Calls', os.path.join(main_dir, './Resources/call_register_icon.png'))
def build_idle_screen():
pass
def build_contact_menu_screen():
build_nav_button()
add_menu_item = "Add contact"
view_all_menu_item = "List all"
def build_list_screen(items):
build_nav_button()
for item in items:
print(item)
if __name__ == "__main__":
scan_port()
if len(list_ports) == 0:
print("There are no COM port to connect on this computer/device! Please connect target device into device")
else:
while True:
time.sleep(1)
<file_sep>
class Configuration:
@staticmethod
def default():
return {
'datetime_format': '%y-%m-%d %H:%M-%S',
'default_lang': 'en-us',
'datasource': r"C:\Users\aquoc\Desktop\PiPhone.db",
'emergency_number_1': 113,
'emergency_number_2': 114
}
<file_sep>from dbconnect import DbConnector
from Models.Contact import Contact
import sys
class ContactController:
TABLE_NAME = 'contacts'
@staticmethod
def add_contact(contact):
if contact is None:
return False
global TABLE_NAME
try:
sql_insert = "insert into {0}(name, phone_number, created, is_deleted) values({1}, {2}, {3}, {4})"\
.format(TABLE_NAME, contact.name, contact.phone_number, contact.created, 0)
res = DbConnector.execute_non_query(DbConnector, sql_insert)
return res
except Exception as ex:
print("Error occurred when add contact " + ex.args[0])
return False
@staticmethod
def update_contact(contact):
if contact is None:
return False
global TABLE_NAME
try:
sql_check = "select * from {0} where is_deleted = 0 and name = {1} and phone_number = {2}"\
.format(TABLE_NAME, contact.name, contact.phone_number)
result_exists = DbConnector.execute_fetch_all(DbConnector, sql_check)
if result_exists is not None:
if len(result_exists) > 0:
return False
else:
sql_update = "update {0} set name = {1}, phone_number = {2}, created = {3} where is_deleted = 0" \
" and id = {4}".format(TABLE_NAME, contact.name, contact.phone_number, contact.created, contact.contact_id)
result_update = DbConnector.execute_non_query(DbConnector, sql_update)
return result_update
except Exception as ex:
print("Error occured when update contact " + ex.args[0])
return False
@staticmethod
def get_single(contact_id):
if contact_id == 0:
return None
else:
global TABLE_NAME
try:
sql_select = "select * from {0} where is_deleted = 0 and id = {1}".format(TABLE_NAME, contact_id)
result = DbConnector.execute_fetch_one(DbConnector, sql_select)
if result is not None:
contact = Contact(
result["id"],
result["name"],
result["phone_number"],
result["created"],
result["is_deleted"]
)
return contact
else:
return None
except Exception as ex:
print("Error occurred while execute query: " + ex.args[0])
return None
@staticmethod
def get_all():
global TABLE_NAME
try:
sql_select = "select * from {0} where is_deleted = 0".format(TABLE_NAME)
result = DbConnector.execute_fetch_all(DbConnector, sql_select)
if result is not None and len(result) > 0:
list_result = []
for item in result:
list_result.append(
Contact(
item["id"],
item["name"],
item["phone_number"],
item["created"],
item["is_deleted"]
)
)
else:
return None
except Exception as ex:
print("Error occurred while execute query: " + ex.args[0])
return None
<file_sep>class Contact:
def __init__(self, contact_id, name, phone_number, created, is_deleted):
self._contact_id = contact_id
self._name = name
self._phone_number = phone_number
self._created = created
self._is_deleted = is_deleted
@property
def contact_id(self):
return self._contact_id
@contact_id.setter
def contact_id(self, contact_id):
self._contact_id = contact_id
@property
def name(self):
return self._name
@name.setter
def name(self, name):
self._name = name
@property
def phone_number(self):
return self._phone_number
@phone_number.setter
def phone_number(self, phone_number):
self._phone_number = phone_number
@property
def created(self):
return self._created
@created.setter
def created(self, created):
self._created = created
@property
def is_deleted(self):
return self._is_deleted
@is_deleted.setter
def is_deleted(self, is_deleted):
self.is_deleted = is_deleted
<file_sep>
class Constants:
COMMAND_START_DIAL = "ATD"
COMMAND_CHECK_SIGNAL_STATUS = "AT+CSQ"
COMMAND_CHECK_NETWORK = "AT+COPS?"
COMMAND_SEND_USSD = ""
COMMAND_HANGUP_CALL = "ATH"
COMMAND_GET_REG_STATUS = "AT+CREG?"
OK_SIGNAL = "OK"
WIN_SYS = 1
LINUX_SYS = -1
DARWIN_SYS = 0
MAX_CONTACTS = 2000
MAX_SMS_CHARS = 255
MAX_SMS_MESSAGES = 1000
| 3b9b74deb568732bf97a9ac6f352dbfed6e88b32 | [
"Markdown",
"Python",
"Text"
] | 13 | Python | anhquoctran/PiPhone | 47ff148dc267127ab65c1181d5151d1d52081a72 | 122d327dec044f9c25508435e24627bde94b7b5c |
refs/heads/master | <file_sep>//copied from a web site
var propName={0:'project',1:'coder',2:'story',3:'task',4:'iteration',5:'complexity'};
var taskList=Array();
window.addEventListener('load', eventWindowLoaded,false);
function readSingleFile(evt) {
//Retrieve the first (and only!) File from the FileList object
var f = evt.target.files[0];
if (f) {
var r = new FileReader();
r.onload = function(e) {
var contents = e.target.result;
/*
alert( "Got the file.n"
+"name: " + f.name + "n"
+"type: " + f.type + "n"
+"size: " + f.size + " bytesn"
+ "starts with: " + contents.substr(0, contents.indexOf("n"))
);
*/
var arrResults= contents.split('\n');
document.write('length'+arrResults.length);
document.write('<br/>');
/*
for(var val in arrResults){
document.write(arrResults[val]+' ');
var index=val+1;
if (!(val%6)){
document.write('<br/>');
}
}
*/
for (var i=0; i<6;i++){
document.write('PropName:'+i);
document.write(propName[i]);
}
for (var i=0; i< arrResults.length; i++){
var task= new Object();
var splitResults=arrResults[i].split(',');
for(var k=0; k < splitResults.length;k++){
//document.write(splitResults[k]);
task[propName[k]]=splitResults[k];
}
//document.write('<br/>');
taskList[i]=task;
}
// try to write out the taskList array
for(var i=0; i< taskList.length;i++){
document.write('Task:'+i+' ');
for(var k=0; k< 6;k++){
document.write(taskList[i][propName[k]]);
}
document.write('<br/>');
}
document.write('done writing');
};
r.readAsText(f);
} else {
alert("Failed to load file");
}
}
function eventWindowLoaded(){
document.getElementById('csvFile').addEventListener('change', readSingleFile, false);
} | 2b395c2e3947501309369fcbed52cda59d9e5bab | [
"JavaScript"
] | 1 | JavaScript | davidbethke/Spike2 | 0c84f67bc95b7362b92350323f6b4d4758d387c3 | 9539164322d110c14252db83edcb7ffabc34de52 |
refs/heads/master | <file_sep><h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>Default suite</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
<table border="1">
<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:29</td> <td>0</td> <td> </td><td> </td><td title=">>HomePageTest.setUp()[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]">>>setUp</td>
<td> </td><td> </td><td> </td> <td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:48</td> <td>18328</td> <td> </td><td> </td><td> </td><td> </td><td title="<<HomePageTest.tearDown(org.testng.ITestResult)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]"><<tearDown</td>
<td> </td> <td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:50</td> <td>20713</td> <td> </td><td> </td><td> </td><td> </td><td title="<<HomePageTest.tearDown(org.testng.ITestResult)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]"><<tearDown</td>
<td> </td> <td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:52</td> <td>22798</td> <td> </td><td> </td><td> </td><td> </td><td title="<<HomePageTest.tearDown(org.testng.ITestResult)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]"><<tearDown</td>
<td> </td> <td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:55</td> <td>25480</td> <td> </td><td> </td><td> </td><td> </td><td title="<<HomePageTest.tearDown(org.testng.ITestResult)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]"><<tearDown</td>
<td> </td> <td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:37</td> <td>8043</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="HomePageTest.validateHomePage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]">validateHomePage</td>
<td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:48</td> <td>19060</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="HomePageTest.validateHomePage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]">validateHomePage</td>
<td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:50</td> <td>21197</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="HomePageTest.validateHomePage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]">validateHomePage</td>
<td>main@306193139</td> <td></td> </tr>
<tr bgcolor="b4b38d"> <td>16/10/03 13:17:53</td> <td>23287</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="HomePageTest.validateHomePage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.wirecard.ntltaxi.testcases.HomePageTest@570698ea]">validateHomePage</td>
<td>main@306193139</td> <td></td> </tr>
</table>
<file_sep>package temp;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
public class ReportTest {
public static WebDriver wd;
public static ExtentReports report;
public static ExtentTest log;
@Test(priority = 1)
public void googleTest() {
wd=new FirefoxDriver();
report = new ExtentReports(
"C:\\seleniumWorkspace\\DDDTest\\reports\\Sample.html");
log = report.startTest("GooleTest");// log get start here
wd.get("https://www.google.co.in/");
}
@Test(priority = 2)
public void yahooTest() {
log = report.startTest("YahooTest");
wd.get("https://in.yahoo.com/");
}
@Test(priority = 3)
public void bingTest() {
log = report.startTest("BingTest");
wd.get("https://www.bing.com/");
}
@AfterMethod
public void tearDown(ITestResult result) throws IOException
{
if(result.isSuccess())
{
String path = getScreenShot(result.getName());
log.addScreenCapture(path);
log.log(LogStatus.PASS, "TestCase Passed", path);
}
else
{
String path = getScreenShot(result.getName());
log.addScreenCapture(path);
log.log(LogStatus.FAIL, "TestCase Failed", path);
}
report.endTest(log);
report.flush();
}
public static String getScreenShot(String name) throws IOException
{
File src = ((TakesScreenshot)wd).getScreenshotAs(OutputType.FILE);
File dest = new File("C:\\seleniumWorkspace\\DDDTest\\ScreenShot\\"+name+".jpg");
FileUtils.copyFile(src, dest);
return dest.toString();
}
}
<file_sep>package com.wirecard.ntltaxi.reportgenerator;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.testng.ITestResult;
import com.relevantcodes.extentreports.LogStatus;
import com.wirecard.ntltaxi.initializer.Initializer;
public class ScreenshotGenerator extends Initializer {
public static void takeScreenShot(ITestResult result) throws IOException
{
Object[] data=result.getParameters();
if(result.isSuccess())
{
String path = getScreenShot(data[0].toString());
log.addScreenCapture(path);
log.log(LogStatus.PASS, "TestCase Passed", path);
}
else
{
String path = getScreenShot(data[0].toString());
log.addScreenCapture(path);
log.log(LogStatus.FAIL, "TestCase Failed", path);
}
report.endTest(log);
report.flush();
}
public static String getScreenShot(String name) throws IOException
{
File src = ((TakesScreenshot)wd).getScreenshotAs(OutputType.FILE);
File dest = new File("C:\\seleniumWorkspace\\DDDTest\\ScreenShot\\"+name+".jpg");
FileUtils.copyFile(src, dest);
return dest.toString();
}
}
<file_sep>package com.wirecard.ntltaxi.testcases;
import java.io.IOException;
import java.sql.Driver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.wirecard.nlttaxi.inputreader.inputReader;
import com.wirecard.ntltaxi.initializer.DriverFunctions;
import com.wirecard.ntltaxi.initializer.Initializer;
import com.wirecard.ntltaxi.pageobjects.HomePage;
import com.wirecard.ntltaxi.reportgenerator.ScreenshotGenerator;
public class HomePageTest extends Initializer {
@BeforeClass
public void setUp() throws IOException
{
initialize();
}
@Test(dataProvider="HomePageTest")
public void validateHomePage(String Testdata,String Username,String Mobileno,String Pickup,String Drop,String Basic) throws IOException {
DriverFunctions.loadURL();
log = report.startTest(Testdata);
HomePage.enterUserName(Username);
HomePage.enterMoblieNumber(Mobileno);
HomePage.enterPickUpAddress(Pickup);
HomePage.enterDropAddress(Drop);
HomePage.selectBasic(Basic);
HomePage.clickBookLater();
}
@DataProvider(name="HomePageTest")
public static Object[][] getHomePageData() throws Exception
{
if(inputReader.RunModeVerification("HomePageTest")){
//Object [] [] data = new Object[3][6];
Object [] [] data =inputReader.selectSingleDataOrMulitiData("HomePageTest");
// data[0][0] = "HomePageTest_dataset1";
// data[0][1] = "TestA";
// data[0][2] = "12222222222";
// data[0][3] = "ADYAR";
// data[0][4] = "ADYAR";
// data[0][5] = "Sedan";
//
//
// data[1][0] = "HomePageTest_dataset2";
// data[1][1] = "TestB";
// data[1][2] = "12222222222";
// data[1][3] = "ADYAR";
// data[1][4] = "ADYAR";
// data[1][5] = "Sedan";
//
// data[2][0] = "HomePageTest_dataset3";
// data[2][1] = "TestC";
// data[2][2] = "12222222222";
// data[2][3] = "ADYAR";
// data[2][4] = "ADYAR";
// data[2][5] = "Sedan";
//
return data;
}
return null;
}
@AfterMethod
public void tearDown(ITestResult result) throws IOException{
ScreenshotGenerator.takeScreenShot(result);
}
}
| aec6fa71f3a148cf2ec2f6b21628abf5c684b584 | [
"Java",
"HTML"
] | 4 | HTML | sumithrawirecard/DDDTest | 1addc3e6b78dc9b010b782f9cd9c75e312a15863 | 90afa4171d5e3a7ec3cec13b46352b9c7cea8bbe |
refs/heads/master | <file_sep>#! /usr/bin/python3
# -*- coding:utf-8 -*-
import emoji
import telepot
import traceback
from datetime import datetime, timedelta
class ProgressBot:
def __init__(self, task = "", updates = (0.1, 5*60)):
"""Init the bot."""
# Load the config file
self.loadConfig()
# Save parameters
self.task = task
self.update_percent_rate = updates[0]
self.update_time_rate = updates[1]
# Create the bot
self.bot = telepot.Bot(self.token)
# Create intern flags
self.F_pause = False
# F_silentMode: stay silent until the first tick. This is a
# trick to ignore commands send between two
# runs.
self.F_silentMode = True
# F_mute: turn it on to mute tick reports.
self.F_mute = False
def __enter__(self):
msg = "Hello, I am looking on a new task: <b>{task}</b>.".format(
task = self.task)
self.sendMessage(msg)
# Init the progress status
self.progress = 0
self.start_time = datetime.now()
self.last_percent_update = 0
self.last_time_update = self.start_time
# Start the message loop
# note: incoming message will be ignore until the first tick
# (in order to flush messages sent between two tasks)
self.bot.message_loop(self.handle)
return self
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is KeyboardInterrupt:
msg = "The task <b>{task}</b> was interrupted. :confounded_face:".format(
task = self.task)
else:
msg = "The task <b>{task}</b> is complete. :grinning_face_with_smiling_eyes:".format(
task = self.task)
self.sendMessage(msg)
return True
def loadConfig(self):
with open('./ProgressBot.cfg', 'r') as f:
for line in f.readlines():
if line[0] == '#':
continue
parsed_line = line.split('=')
if parsed_line[0] == 'token':
if len(parsed_line) == 2:
self.token = parsed_line[1].strip()
else:
raise ValueError("Please provide a valid tokken in ProgressBot.cfg")
if parsed_line[0] == 'chat_id':
if len(parsed_line) == 2:
self.chat_id = parsed_line[1].strip()
else:
# If the chat_id is empty, maybe it is because
# it is still unknown.
print("Hello, you didn't provide any chat_id. Maybe you do not know it. The get_chat_id in the tools directory may help you with this issue.")
raise ValueError("You have to provide a valid chat_id, use the get_chat_id script to get help with that.")
def sendMessage(self, msg):
# Emojize the message
msg = emoji.emojize(msg)
self.bot.sendMessage(self.chat_id, msg, parse_mode = "HTML")
def handle(self, msg):
content_type, chat_type, chat_id = telepot.glance(msg)
if not self.F_silentMode and content_type == 'text':
if msg['text'] == '/pause':
print("Task: pause")
self.F_pause = True
self.send_status(cmt = "pause")
elif msg['text'] == '/resume':
print("Task: resume")
self.F_pause = False
self.send_status(cmt = "resume")
elif msg['text'] == '/status':
self.send_status()
elif msg['text'] == '/mute':
self.F_mute = True
elif msg['text'] == '/unmute':
self.F_mute = False
# API
def info(self, msg):
msg = '<b>[Info]</b> ' + msg
self.sendMessage(msg)
def warning(self, msg):
msg = ':warning_sign: <b>[Warning]</b> ' + msg
self.sendMessage(msg)
def error(self, msg, force = True):
msg = ':fearful_face: <b> [Error]</b> ' + msg
self.sendMessage(msg)
def tick(self, progress):
# Turn off the silentMode
self.F_silentMode = False
# Update the progress
self.progress = progress
# Freeze if paused
while self.F_pause:
time.sleep(1)
# Check if a progress update is necessary based on progress
if self.progress - self.last_percent_update >= self.update_percent_rate:
self.send_status()
# Check if a progress update is necessary based on time ellapsed
if datetime.now() - self.last_time_update >= timedelta(seconds=self.update_time_rate):
self.send_status()
def send_status(self, cmt = "", force = False):
"""Send the current status of the task."""
# Return without sending anything if mute
if self.F_mute and not force:
return
# Send the current status
if cmt:
msg = "{timestamp} − {progress:3.0f}% ({cmt})".format(
timestamp = datetime.now().strftime('%H:%M:%S'),
progress = 100*self.progress,
cmt = cmt)
else:
msg = "{timestamp} − {progress:3.0f}%".format(
timestamp = datetime.now().strftime('%H:%M:%S'),
progress = 100*self.progress)
self.sendMessage(msg)
# Update progress status
self.last_percent_update = self.progress
self.last_time_update = datetime.now()
if __name__ == '__main__':
# Demo of ProgressBot
import time
task= "Example"
with ProgressBot(task, updates = (0.2, 60)) as pbot:
#for i in range(10):
# time.sleep(1)
# pbot.tick(progress = i/10)
# Test logging functions
pbot.info('This is an info.')
pbot.warning('This is a warning.')
pbot.error('This is an error.')
<file_sep># ProgressBot
## Installation
1. Install [telepot](http://telepot.readthedocs.io/en/latest/).
1. Install [emoji](https://github.com/carpedm20/emoji).
2. Clone this repo.
3. Copy `ProgressBot.cfg.blank` and create a valid `ProgressBot.cfg`
file giving your `token` and your `chat_id`.
<file_sep>#! /usr/bin/python3
# -*- coding:utf-8 -*-
# by <EMAIL>
import sys
import time
import telepot
def handle(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
print("\tchat_id: {}".format(chat_id))
if content_type == 'text' and msg['text'] == '/start':
ans = """
Hello <b>{first_name}</b>, nice to meet you!\n
Your chat_id is <code>{chat_id}</code>.\n
You can stop the <code>get_chat_id</code> script with <code>CTRL+C</code> and start using the ProgressBot right now.\n
See you soon!
""".format(first_name = msg['from']['first_name'],
chat_id = chat_id)
bot.sendMessage(chat_id, ans, parse_mode = "HTML")
TOKEN = "PUT_YOUR_TOKKEN_HERE"
bot = telepot.Bot(TOKEN)
bot.message_loop(handle)
print ('Listening ...')
# Keep the program running.
while 1:
try:
time.sleep(10)
except KeyboardInterrupt:
print()
sys.exit()
| fd9ac6fad68f476dfa814812945dd75fb22edb9e | [
"Markdown",
"Python"
] | 3 | Python | a2ohm/ProgressBot | 38657e687ef5e3348ffa52d6bab1fa4a10c1f254 | 1f323aec3b3bdf733960cfbf86a1f5696dc907fa |
refs/heads/master | <file_sep>var app = require('http').createServer(handler).listen(1337);
var io = require('socket.io').listen(app,{origins: '*:*'});
var User = {};
var Ids = [];
var text = [];
function handler(req,res){
res.writeHead(200, {'Content-Type':'text/plain'});
res.end('Hello Node\n You are really really awesome!');
}
io.sockets.on('connection',function(socket){
User[socket.id] = {
name:'',
msg:[]
};
Ids.push(socket.id);
// io.sockets.emit('send',text);
socket.on("send",function(data){
text.push(data.data);
User[socket.id].msg.push(data.data);
// socket.emit("send",);
io.sockets.emit('send',User[socket.id]);
console.log(User);
});
socket.on("join",function(data){
User[socket.id].name = data.name;
User[socket.id].time = new Date();
data.ids = User;
io.sockets.emit("join",data);
});
socket.on("disconnect",function(){
delete User[socket.id];
});
});
// io.sockets.on('disconnect',function(socket){
// io.sockets.emit('disconnection',{data:true});
// console.log(222);
// User = {};
// Ids = [];
// }) | 4352817581db8ea11de638fc23115cc49f930b5c | [
"JavaScript"
] | 1 | JavaScript | tamamadesu/whoisspy | e4ab860379863d84a653c9329a1c03dddda7bb70 | c9fd2720cf86741e60c746ecac33de10e8c6a712 |
refs/heads/master | <repo_name>brtos/simulador<file_sep>/platforms/eclipse_mingw_win32/src/config/tasks.h
void TarefaTempoDoSistema(void);
void TarefaADC(void);
void TarefaGPIO(void);
void SerialTask(void);
void TerminalTask(void);
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/GPIOx.c
/*
* GPIOx.c
*
* Created on: 10 de ago de 2016
* Author: gustavo
*/
//#include "WinBase.h"
#include "BRTOS.h"
#include "device.h"
int ff1 (int x)
{
int i=0;
if(!x) return -1;
while(!((x>>(i++)) & 1));
return i;
}
static size_t GPIO_Write(OS_Device_Control_t *dev, void *string, size_t size)
{
uint32_t mask = (uint32_t)string;
if(size)
{
Beep(dev->device->base_address*mask/1000, 1000);
}
return 0;
}
static size_t GPIO_Read(OS_Device_Control_t *dev, char *string, size_t size ){
uint32_t temp = (uint32_t)string;
(void)size;
return (size_t)(1);
}
static size_t GPIO_Set(OS_Device_Control_t *dev, uint32_t request, uint32_t value){
return 0;
}
static size_t GPIO_Get(OS_Device_Control_t *dev, uint32_t request){
uint32_t ret;
gpio_config_t *gpio_conf = (gpio_config_t *)dev->device->DriverData;
switch(request){
default:
ret = 0;
break;
}
return ret;
}
const device_api_t GPIO_api ={
.read = (Device_Control_read_t)GPIO_Read,
.write = (Device_Control_write_t)GPIO_Write,
.set = (Device_Control_set_t)GPIO_Set,
.get = (Device_Control_get_t)GPIO_Get
};
#define GPIOA_BASE 110000
#define GPIOB_BASE 123471
#define GPIOC_BASE 65406
#define GPIOD_BASE 73416
#define GPIOE_BASE 82407
#define GPIOF_BASE 87307
#define GPIOG_BASE 97999
void OSOpenGPIO(void *pdev, void *parameters){
int i = 0;
gpio_config_t *gpio_conf = (gpio_config_t *)parameters;
OS_Device_Control_t *dev = pdev;
switch(dev->device_number)
{
case 'A':
dev->device->base_address = GPIOA_BASE;
break;
case 'B':
dev->device->base_address = GPIOB_BASE;
break;
case 'C':
dev->device->base_address = GPIOC_BASE;
break;
case 'D':
dev->device->base_address = GPIOD_BASE;
break;
case 'E':
dev->device->base_address = GPIOE_BASE;
break;
case 'F':
dev->device->base_address = GPIOF_BASE;
break;
case 'G':
dev->device->base_address = GPIOG_BASE;
break;
default:
break;
}
dev->api = &GPIO_api;
}
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/SPIx.c
#include "BRTOS.h"
#include "device.h"
#include "drivers.h"
#define NUM_SPI 1
static BRTOS_Sem *SPITX[NUM_SPI];
static BRTOS_Queue *SPIQ[NUM_SPI];
static BRTOS_Mutex *SPIMutex[NUM_SPI];
char SPI_buffer;
static uint32_t SPIHandler(void)
{
char c = SPI_buffer;
OSQueuePost(SPIQ[0], c);
return TRUE;
}
static void Init_SPI(void *parameters)
{
spi_config_t *spi_conf = (spi_config_t *)parameters;
ConfiguraInterruptHandler( INTERRUPT_SPI, SPIHandler);
// todo: Configure SPI Baud
//SPIConfigSet(spi_conf->baudrate, config);
ASSERT(OSSemCreate(0, &SPITX[0]) == ALLOC_EVENT_OK);
ASSERT(OSQueueCreate(spi_conf->queue_size, &SPIQ[0]) == ALLOC_EVENT_OK);
if (spi_conf->mutex == true)
{
OSMutexCreate (&SPIMutex[0], 0);
}
}
#define spi_rwchar(x)
static size_t SPI_Write(OS_Device_Control_t *dev, char *string, size_t size ){
size_t nbytes = 0;
while(size)
{
spi_rwchar((char)string);
nbytes++;
size--;
string++;
}
return nbytes;
}
static size_t SPI_Read(OS_Device_Control_t *dev, char *string, size_t size ){
size_t nbytes = 0;
spi_config_t *spi_conf = (spi_config_t *)dev->device->DriverData;
while(nbytes < size)
{
if (OSQueuePend(SPIQ[dev->device_number], (uint8_t*)string, spi_conf->timeout) != READ_BUFFER_OK) goto failed_rx;
string++;
nbytes++;
}
failed_rx:
return nbytes;
}
static size_t SPI_Set(OS_Device_Control_t *dev, uint32_t request, uint32_t value){
size_t ret = 0;
spi_config_t *spi_conf = (spi_config_t *)dev->device->DriverData;
switch(request){
case SPI_BAUDRATE:
spi_conf->baudrate = value;
break;
case SPI_POLARITY:
spi_conf->polarity = value;
break;
case SPI_QUEUE_SIZE:
/* somente pode ser alterado se filar dināmicas forem utilizadas. */
break;
case SPI_TIMEOUT:
spi_conf->timeout = value;
break;
case CTRL_ACQUIRE_WRITE_MUTEX:
if (SPIMutex[dev->device_number] != NULL){
ret = OSMutexAcquire(SPIMutex[dev->device_number],value);
}
break;
case CTRL_RELEASE_WRITE_MUTEX:
if (SPIMutex[dev->device_number] != NULL){
ret = OSMutexRelease(SPIMutex[dev->device_number]);
}
break;
default:
break;
}
return ret;
}
static size_t SPI_Get(OS_Device_Control_t *dev, uint32_t request){
uint32_t ret;
spi_config_t *spi_conf = (spi_config_t *)dev->device->DriverData;
switch(request){
case SPI_BAUDRATE:
ret = spi_conf->baudrate;
break;
case SPI_POLARITY:
ret = spi_conf->polarity;
break;
case SPI_QUEUE_SIZE:
ret = spi_conf->queue_size;
break;
case SPI_TIMEOUT:
ret = spi_conf->timeout;
break;
default:
ret = 0;
break;
}
return ret;
}
static const device_api_t SPI_api =
{
.read = (Device_Control_read_t)SPI_Read,
.write = (Device_Control_write_t)SPI_Write,
.set = (Device_Control_set_t)SPI_Set,
.get = (Device_Control_get_t)SPI_Get
};
void OSOpenSPI(void *pdev, void *parameters)
{
OS_Device_Control_t *dev = pdev;
Init_SPI(parameters);
dev->api = &SPI_api;
}
<file_sep>/platforms/eclipse_mingw_win32/src/hal/MingW/HAL.c
/**
* \file HAL.c
* \brief BRTOS Hardware Abstraction Layer Functions.
*
* This file contain the functions that are processor dependent.
*
*
**/
/*********************************************************************************************************
* BRTOS
* Brazilian Real-Time Operating System
* Acronymous of Basic Real-Time Operating System
*
*
* Open Source RTOS under MIT License
*
*
*
* OS HAL Functions for Win32 port
*
*
* Author: <NAME>
* Revision: 1.0
* Date: 25/03/2016
*
*********************************************************************************************************/
/* Obs.: este codigo para simular o BRTOS no Windows foi baseado no simulador para Windows do sistema FreeRTOS,
* disponivel em: http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
* */
#include "BRTOS.h"
#include "stdint.h"
#include "stdio.h"
#ifdef __GNUC__
#include "mmsystem.h"
#else
#pragma comment(lib, "winmm.lib")
#endif
/* Cria uma thread de alta prioridade para simular o Tick Timer. */
static DWORD WINAPI TimerSimulado( LPVOID lpParameter );
/* Cria uma thread de alta prioridade para simular a UART. */
static DWORD WINAPI UARTSimulada( LPVOID Parameter );
/*
* Processa todas as interrupcoes simuladas - cada bit em
* PendingInterrupts representa uma interrupcao.
*/
static void ProcessaInterrupcoesSimuladas( void );
/* "Interrupt handlers" usados pelo BRTOS. */
static uint32_t SwitchContext( void );
static uint32_t TickTimer( void );
/*-----------------------------------------------------------*/
/* O simulador para Windows utiliza a biblioteca de threads do Windows para criar as tarefas e realizar
* a troca de contexto. Cada tarefa é uma thread. */
typedef struct
{
void *Thread; /* Ponteiro para a thread que representa a tarefa. */
} ThreadState;
/* Variavel usada para simular interrupcoes. Cada bi representa uma interrupcao. */
static volatile uint32_t PendingInterrupts = 0UL;
#define MAX_INTERRUPTS 3 //(sizeof(PendingInterrupts)*8)
/* Evento usado para avisar a thread que simula as interrupcoes (e tem prioridade mais alta) de que uma interrupcao aconteceu. */
static void *InterruptEvent = NULL;
/* Mutex ussado para proteger o acesso das variaveis usadas nas interrupcoes simuladas das tarefas. */
static void *InterruptEventMutex = NULL;
/* Vetor de inrerrupcoes simuladas. */
static uint32_t (*IsrHandler[ MAX_INTERRUPTS ])( void ) = { 0 };
#define TICK_PERIOD_MS (1000/configTICK_RATE_HZ)
INT32U SPvalue;
static void usleep(__int64 usec)
{
HANDLE timer;
LARGE_INTEGER ft;
/* Convert to 100 nanosecond interval,
* negative value indicates relative time
*/
ft.QuadPart = -(10*usec);
timer = CreateWaitableTimer(NULL, TRUE, NULL);
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
WaitForSingleObject(timer, INFINITE);
CloseHandle(timer);
}
/*-----------------------------------------------------------*/
/* Executado no fim da simulacao para retornar o timer com a
* resolucao anterior
*/
static BOOL WINAPI EndSimulation( DWORD dwCtrlType )
{
TIMECAPS TimeCaps;
( void ) dwCtrlType;
if( timeGetDevCaps( &TimeCaps, sizeof( TimeCaps ) ) == MMSYSERR_NOERROR )
{
timeEndPeriod( TimeCaps.wPeriodMin );
}
return OK;
}
static __int64 increase_timer_resolution(void)
{
TIMECAPS tc;
__int64 res;
/* Aumenta para maxima resolucao do timer. */
if(timeGetDevCaps( &tc, sizeof( TIMECAPS ) ) == MMSYSERR_NOERROR )
{
res = tc.wPeriodMin;
}else
{
res = 20;
}
timeBeginPeriod(res);
SetConsoleCtrlHandler( EndSimulation, TRUE );
return res;
}
/* Simulacao da interrupcao do Tick Timer*/
static DWORD WINAPI TimerSimulado( LPVOID Parameter )
{
uint32_t tick_period_ms = (TICK_PERIOD_MS==0)?1:TICK_PERIOD_MS;
__int64 res, freq = 0, time_1 = 0, time_2 = 0, elapsed_time_us,
avg_tick_time = 0;
/* Previne aviso do compilador. */
( void ) Parameter;
QueryPerformanceFrequency((LARGE_INTEGER *) &freq);
res=increase_timer_resolution();
if( tick_period_ms < res ) tick_period_ms = res;
QueryPerformanceCounter((LARGE_INTEGER *) &time_1);
for( ;; )
{
/* Gera uma interrupcao simulada do Timer */
QueryPerformanceCounter((LARGE_INTEGER *) &time_2);
elapsed_time_us = (time_2-time_1);
elapsed_time_us = elapsed_time_us*(1000000UL)/freq;
usleep(tick_period_ms*1000-elapsed_time_us);
QueryPerformanceCounter((LARGE_INTEGER *) &time_1);
GeraInterrupcaoSimulada(INTERRUPT_TICK);
elapsed_time_us = (time_1-time_2);
elapsed_time_us = elapsed_time_us*(1000000UL)/freq;
avg_tick_time+=elapsed_time_us;
if(OSGetTickCount()%1000 == 0)
{
avg_tick_time = avg_tick_time/1000;
//printf("%u\r\n",(uint32_t)avg_tick_time);
avg_tick_time = 0;
}
}
#ifdef __GNUC__
return 0;
#endif
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
/* Simulacao da interrupcao da UART */
#define BAUDRATE 9600
#define CHARTIME_MS (10000/BAUDRATE)
#include "../drivers/drivers.h"
#include "stdio.h"
#include "conio.h"
static DWORD WINAPI UARTSimulada( LPVOID Parameter )
{
/* Just to prevent compiler warnings. */
( void ) Parameter;
for( ;; )
{
char c;
static HANDLE stdinHandle;
// Get the IO handles
stdinHandle = GetStdHandle(STD_INPUT_HANDLE);
while( 1 )
{
switch( WaitForSingleObject( stdinHandle, 1000 ) )
{
case( WAIT_TIMEOUT ):
break; // return from this function to allow thread to terminate
case( WAIT_OBJECT_0 ):
if( _kbhit() ) // _kbhit() always returns immediately
{
c = _getch();
goto get_char;
}
else // some sort of other events , we need to clear it from the queue
{
// clear events
INPUT_RECORD r[512];
DWORD read;
ReadConsoleInput( stdinHandle, r, 512, &read );
}
break;
case( WAIT_FAILED ):
break;
case( WAIT_ABANDONED ):
break;
default:
break;
}
}
get_char:
WaitForSingleObject( InterruptEventMutex, INFINITE );
Sleep((CHARTIME_MS > 0)? CHARTIME_MS:1);
/* store received char */
do{
extern char UART_RX_buffer;
UART_RX_buffer = c;
}while(0);
/* The UART has received a char, generate the simulated event. */
PendingInterrupts |= ( 1 << INTERRUPT_UART );
/* The interrupt is now pending - notify the simulated interrupt
handler thread. */
if( iNesting == 0 )
{
SetEvent( InterruptEvent );
}
/* Give back the mutex so the simulated interrupt handler unblocks
and can access the interrupt handler variables. */
ReleaseMutex( InterruptEventMutex );
}
#ifdef __GNUC__
/* Should never reach here - MingW complains if you leave this line out,
MSVC complains if you put it in. */
return 0;
#endif
}
/*-----------------------------------------------------------*/
#if (TASK_WITH_PARAMETERS == 1)
void CreateVirtualStack(void(*FctPtr)(void*), INT16U NUMBER_OF_STACKED_BYTES, void *parameters)
#else
void CreateVirtualStack(void(*FctPtr)(void), INT16U NUMBER_OF_STACKED_BYTES)
#endif
{
#if (TASK_WITH_PARAMETERS == 0)
void *parameters = NULL;
#endif
extern OS_CPU_TYPE STACK[];
ThreadState *pThreadState = NULL;
pThreadState = ( ThreadState * )((OS_CPU_TYPE)&STACK[iStackAddress] + (OS_CPU_TYPE)NUMBER_MIN_OF_STACKED_BYTES);
/* Cria a thread da tarefa. */
pThreadState->Thread = CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE ) FctPtr, parameters, CREATE_SUSPENDED, NULL );
if( pThreadState->Thread == NULL) return;
SetThreadAffinityMask( pThreadState->Thread, 0x01 );
SetThreadPriorityBoost( pThreadState->Thread, TRUE );
SetThreadPriority( pThreadState->Thread, THREAD_PRIORITY_IDLE );
return;
}
/*-----------------------------------------------------------*/
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
///// OS Tick Timer Setup /////
///// /////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/* Nao utilizda, pois no simulador o timer é simulador por uma thread com prioridade mais alta.
*/
void TickTimerSetup(void){}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
///// OS RTC Setup /////
///// /////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/* Nao utilizado */
void OSRTCSetup(void){}
/*-----------------------------------------------------------*/
/* "handler" da interrupcao do timer */
static uint32_t TickTimer(void)
{
OSIncCounter();
OS_TICK_HANDLER();
return TRUE;
}
/*-----------------------------------------------------------*/
/* "handler" da interrupcao para troca de contexto */
static uint32_t SwitchContext(void)
{
return TRUE;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
void BTOSStartFirstTask( void )
{
uint8_t Success = TRUE;
void *Handle;
ThreadState *pThreadState;
/* Instala os "interrupt handlers" usados pelo BRTOS. */
ConfiguraInterruptHandler( INTERRUPT_SWC, SwitchContext );
ConfiguraInterruptHandler( INTERRUPT_TICK, TickTimer );
/* Cria os eventos e mutexes usados para sincronizar as threads. */
InterruptEventMutex = CreateMutex( NULL, FALSE, NULL );
InterruptEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
if( ( InterruptEventMutex == NULL ) || ( InterruptEvent == NULL ) )
{
Success = FALSE;
}
/* Coloca a prioridade desta para um valor mais alto. Assim, ela pode simular
* as interrupcoes que "interrompem" as tarefas. */
Handle = GetCurrentThread();
if( Handle == NULL )
{
Success = FALSE;
}
if( Success == TRUE )
{
if( SetThreadPriority( Handle, THREAD_PRIORITY_NORMAL ) == 0 )
{
Success = FALSE;
}
SetThreadPriorityBoost( Handle, TRUE );
SetThreadAffinityMask( Handle, 0x01 );
}
if( Success == TRUE )
{
/* Cria e inicia a thread que simula o Tick Timer */
Handle = CreateThread( NULL, 0, TimerSimulado, NULL, CREATE_SUSPENDED, NULL );
if( Handle != NULL )
{
SetThreadPriority( Handle, THREAD_PRIORITY_BELOW_NORMAL );
SetThreadPriorityBoost( Handle, TRUE );
SetThreadAffinityMask( Handle, 0x01 );
ResumeThread( Handle );
}
/* Cria e inicia a thread que simula a UART */
Handle = CreateThread( NULL, 0, UARTSimulada, NULL, CREATE_SUSPENDED, NULL );
if( Handle != NULL )
{
SetThreadPriority( Handle, THREAD_PRIORITY_BELOW_NORMAL );
SetThreadPriorityBoost( Handle, TRUE );
SetThreadAffinityMask( Handle, 0x01 );
ResumeThread( Handle );
}
/* Inicia a tarefa de maior prioridade */
pThreadState = ( ThreadState * ) ( ( size_t * ) SPvalue );
iNesting = 0;
ResumeThread( pThreadState->Thread );
/* Atende aos pedidos de interrupcoes */
ProcessaInterrupcoesSimuladas();
}
}
/*-----------------------------------------------------------*/
static void ProcessaInterrupcoesSimuladas( void )
{
uint32_t SwitchRequired, i;
ThreadState *pThreadState;
void *ObjectList[ 2 ];
CONTEXT Context;
/* Cria bloco com mutex e evento usado para indicar que uma interrupcao ocorreu. */
ObjectList[ 0 ] = InterruptEventMutex;
ObjectList[ 1 ] = InterruptEvent;
/* Indica que uma interrupcao do Tick Timer ocorreu. */
PendingInterrupts |= ( 1 << INTERRUPT_TICK );
SetEvent( InterruptEvent );
for(;;)
{
WaitForMultipleObjects( sizeof( ObjectList ) / sizeof( void * ), ObjectList, TRUE, INFINITE );
/* Indica se e necessario realizar a troca de contexto */
SwitchRequired = FALSE;
/* Executa cada interrupcao que estiver pendente */
for( i = 0; i < MAX_INTERRUPTS; i++ )
{
/* Interrupcao esta pendente ? */
if( PendingInterrupts & ( 1UL << i ) )
{
/* Tem um "handler" associado ? */
if( IsrHandler[ i ] != NULL )
{
/* Executa-o. */
if( IsrHandler[ i ]() != FALSE )
{
SwitchRequired |= ( 1 << i );
}
}
/* Limpa o bit de interrupcao pendente. */
PendingInterrupts &= ~( 1UL << i );
}
}
if( SwitchRequired != FALSE )
{
/* Seleciona a proxima tarefa. */
SelectedTask = OSSchedule();
/* Verifica se a tarefa selecionada e diferente da atual. */
if( currentTask != SelectedTask )
{
/* Suspende a thread antiga */
pThreadState = ( ThreadState *) ( ( size_t * ) ContextTask[currentTask].StackPoint );
SuspendThread( pThreadState->Thread );
/* Verifica se a thread foi mesmo suspensa. */
Context.ContextFlags = CONTEXT_INTEGER;
( void ) GetThreadContext( pThreadState->Thread, &Context );
currentTask = SelectedTask;
/* Executa a proxima thread e respectiva tarefa. */
pThreadState = ( ThreadState * ) ( ( size_t *) ContextTask[currentTask].StackPoint);
ResumeThread( pThreadState->Thread );
}
}
ReleaseMutex( InterruptEventMutex );
}
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
void GeraInterrupcaoSimulada( uint32_t InterruptNumber )
{
if( ( InterruptNumber < MAX_INTERRUPTS ) && ( InterruptEventMutex != NULL ) )
{
WaitForSingleObject( InterruptEventMutex, INFINITE );
PendingInterrupts |= ( 1 << InterruptNumber );
/* Se estiver em uma secao critica a interrupcao sera agendada mas nao sera executada. */
if( iNesting == 0 )
{
SetEvent( InterruptEvent );
}
ReleaseMutex( InterruptEventMutex );
}
}
/*-----------------------------------------------------------*/
void ConfiguraInterruptHandler( uint32_t InterruptNumber, uint32_t (*Handler)( void ) )
{
if( InterruptNumber < MAX_INTERRUPTS )
{
if( InterruptEventMutex != NULL )
{
WaitForSingleObject( InterruptEventMutex, INFINITE );
IsrHandler[ InterruptNumber ] = Handler;
ReleaseMutex( InterruptEventMutex );
}
else
{
IsrHandler[ InterruptNumber ] = Handler;
}
}
}
/*-----------------------------------------------------------*/
void EnterCritical( void )
{
/* Adquire o mutex para desabilitar as interrupcoes simuladas. */
WaitForSingleObject( InterruptEventMutex, INFINITE );
iNesting++;
}
/*-----------------------------------------------------------*/
void ExitCritical( void )
{
int32_t MutexNeedsReleasing;
/* Se esta aqui, entao esta com o mutex. */
MutexNeedsReleasing = TRUE;
/* Verifica se ocorreram mais interrupcoes */
if(iNesting>0)
{
iNesting--;
if(iNesting == 0 && PendingInterrupts != 0UL )
{
SetEvent( InterruptEvent );
/* Mutex sera liberado */
MutexNeedsReleasing = FALSE;
ReleaseMutex( InterruptEventMutex );
}
}
if( InterruptEventMutex != NULL )
{
if( MutexNeedsReleasing == TRUE )
{
ReleaseMutex( InterruptEventMutex );
}
}
}
/*-----------------------------------------------------------*/
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/DACx.c
#include "BRTOS.h"
#include "device.h"
#include "drivers.h"
#define NUM_DAC 1
static BRTOS_Sem *DAC[NUM_DAC];
static BRTOS_Queue *DACQ[NUM_DAC];
static BRTOS_Mutex *DACRMutex[NUM_DAC];
#define NUM_DAC_CHAN 16
#define NUM_POINTS 256
uint16_t DAC_buffer[NUM_DAC_CHAN][NUM_POINTS];
uint16_t DAC_chan;
uint16_t DAC_chan_idx[NUM_DAC_CHAN];
struct DAC_signal
{
int freq;
int amp;
};
struct DAC_signal DAC_Signals[] = {{60,3}};
static int DAC_res = 8;
static int DAC_rate = 1000;
#if 0
static time_t clock_time(void)
{
unsigned long long time;
GetSystemTimeAsFileTime((PFILETIME)&time);
return (time_t)(time);
}
#endif
static void DAC_Config(int res, int rate)
{
DAC_res = res;
DAC_rate = rate;
}
static int DAC_Simulado(int chan, int val)
{
uint8_t idx = DAC_chan_idx[chan];
DAC_buffer[chan][idx++] = val;
if(idx>NUM_POINTS) idx = 0;
DAC_chan_idx[chan] = idx;
return 0;
}
static uint32_t DACHandler(void)
{
uint8_t val;
uint8_t chan = DAC_chan;
if(NUM_DAC_CHAN < chan) return FALSE;
OSRQueue((OS_QUEUE *)DACQ[0]->OSEventPointer, &val);
DAC_Simulado(chan,val);
return TRUE;
}
static int DAC_SetSample(uint8_t num, uint16_t val, ostick_t timeout)
{
uint8_t chan = DAC_chan;
if(NUM_DAC_CHAN < chan) return FALSE;
DAC_Simulado(chan, val);
return TRUE;
}
static void Init_DAC(void *parameters)
{
dac_config_t *dac_conf = (dac_config_t *)parameters;
ConfiguraInterruptHandler( INTERRUPT_DAC, DACHandler);
ASSERT(OSSemCreate(0, &DAC[0]) == ALLOC_EVENT_OK);
ASSERT(OSQueueCreate(dac_conf->queue_size, &DACQ[0]) == ALLOC_EVENT_OK);
if (dac_conf->write_mutex == true)
{
OSMutexCreate (&DACRMutex[0], 0);
}
DAC_Config(dac_conf->resolution, dac_conf->samplerate);
}
static size_t DAC_Write(OS_Device_Control_t *dev, char *buf, size_t size ){
size_t nbytes = 0;
dac_config_t *dac_conf = (dac_config_t *)dev->device->DriverData;
while(nbytes < size)
{
if(dac_conf->polling_irq == DAC_IRQ)
{
uint8_t val = (*buf);
if (OSWQueue((OS_QUEUE *)DACQ[dev->device_number]->OSEventPointer, val) != WRITE_BUFFER_OK) goto exit_on_error;
if(dac_conf->resolution > 8)
{
val = (*(buf++));
if (OSWQueue((OS_QUEUE *)DACQ[dev->device_number]->OSEventPointer, val) != WRITE_BUFFER_OK) goto exit_on_error;
}
}else
{
uint16_t val = 0;
if(dac_conf->resolution > 8)
{
val = (uint16_t)(((*buf)<<8)+(*(buf++)));
}else
{
val = (*buf);
}
if (DAC_SetSample(dev->device_number, val, dac_conf->timeout) != TRUE) goto exit_on_error;
}
buf++;
nbytes++;
}
exit_on_error:
return nbytes;
}
static size_t DAC_Set(OS_Device_Control_t *dev, uint32_t request, uint32_t value){
size_t ret = 0;
dac_config_t *dac_conf = (dac_config_t *)dev->device->DriverData;
switch(request){
case DAC_SAMPLERATE:
dac_conf->samplerate = value;
break;
case DAC_RESOLUTION:
dac_conf->resolution = value;
break;
case DAC_QUEUE_SIZE:
/* somente pode ser alterado se filas dināmicas forem utilizadas. */
break;
case DAC_TIMEOUT:
dac_conf->timeout = value;
break;
case CTRL_ACQUIRE_WRITE_MUTEX:
if (DACRMutex[dev->device_number] != NULL)
{
ret = OSMutexAcquire(DACRMutex[dev->device_number],value);
}
break;
case CTRL_RELEASE_WRITE_MUTEX:
if (DACRMutex[dev->device_number] != NULL)
{
ret = OSMutexRelease(DACRMutex[dev->device_number]);
}
break;
default:
break;
}
return ret;
}
static size_t DAC_Get(OS_Device_Control_t *dev, uint32_t request){
uint32_t ret;
dac_config_t *dac_conf = (dac_config_t *)dev->device->DriverData;
switch(request){
case DAC_SAMPLERATE:
ret = dac_conf->samplerate;
break;
case DAC_RESOLUTION:
ret = dac_conf->resolution;
break;
case DAC_QUEUE_SIZE:
ret = dac_conf->queue_size;
break;
case DAC_TIMEOUT:
ret = dac_conf->timeout;
break;
default:
ret = 0;
break;
}
return ret;
}
static const device_api_t DAC_api ={
.read = (Device_Control_read_t)NULL,
.write = (Device_Control_write_t)DAC_Write,
.set = (Device_Control_set_t)DAC_Set,
.get = (Device_Control_get_t)DAC_Get
};
void OSOpenDAC(void *pdev, void *parameters)
{
OS_Device_Control_t *dev = pdev;
Init_DAC(parameters);
dev->api = &DAC_api;
}
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/drivers.h
/*
* drivers.h
*
* Created on: 02/09/2016
* Author: Avell
*/
#ifndef DRIVERS_DRIVERS_H_
#define DRIVERS_DRIVERS_H_
#define INTERRUPT_UART 2
#define INTERRUPT_SPI 3
#define INTERRUPT_I2C 4
#define INTERRUPT_ADC 5
#define INTERRUPT_DAC 6
#define ASSERT(x) if(!(x)) while(1){}
typedef enum{
ADC_POLLING,
ADC_IRQ,
}adc_irq_t;
typedef enum{
ADC_RES_8 = 8,
ADC_RES_10 = 10,
ADC_RES_12 = 12,
ADC_RES_16 = 16
}adc_res_t;
typedef enum
{
ADC_SAMPLERATE,
ADC_RESOLUTION,
ADC_QUEUE_SIZE,
ADC_TIMEOUT
}adc_request_t;
typedef struct adc_config_t_{
int samplerate;
adc_res_t resolution;
adc_irq_t polling_irq;
int queue_size;
ostick_t timeout;
bool read_mutex;
}adc_config_t;
typedef enum{
DAC_POLLING,
DAC_IRQ,
}dac_irq_t;
typedef enum{
DAC_RES_8 = 8,
DAC_RES_10 = 10,
DAC_RES_12 = 12,
DAC_RES_16 = 16
}dac_res_t;
typedef enum
{
DAC_SAMPLERATE,
DAC_RESOLUTION,
DAC_QUEUE_SIZE,
DAC_TIMEOUT
}dac_request_t;
typedef struct dac_config_t_
{
int samplerate;
dac_res_t resolution;
dac_irq_t polling_irq;
int queue_size;
ostick_t timeout;
bool write_mutex;
}dac_config_t;
typedef enum{
SPI_POLLING,
SPI_IRQ,
}spi_irq_t;
typedef enum{
SPI_MASTER,
SPI_SLAVE,
}spi_mode_t;
typedef enum{
SPI_BAUDRATE,
SPI_POLARITY,
SPI_QUEUE_SIZE,
SPI_TIMEOUT
}spi_request_t;
typedef enum{
SPI_P,
SPI_N
}spi_pol_t;
typedef struct spi_config_t_{
int baudrate;
spi_pol_t polarity;
spi_irq_t polling_irq;
spi_mode_t mode;
int queue_size;
ostick_t timeout;
bool mutex;
}spi_config_t;
typedef enum{
I2C_POLLING,
I2C_IRQ,
}i2c_irq_t;
typedef enum{
I2C_MASTER,
I2C_SLAVE,
}i2c_mode_t;
typedef enum{
I2C_ADDR7,
I2C_ADDR10,
}i2c_size_t;
typedef enum{
I2C_BAUDRATE,
I2C_DIRECTION,
I2C_QUEUE_SIZE,
I2C_TIMEOUT
}i2c_request_t;
typedef enum{
I2C_R,
I2C_W
}i2c_dir_t;
typedef struct i2c_config_t_{
int baudrate;
i2c_dir_t direction;
i2c_irq_t polling_irq;
i2c_mode_t mode;
i2c_size_t addr_size;
int addr;
int queue_size;
ostick_t timeout;
bool mutex;
}i2c_config_t;
#endif /* DRIVERS_DRIVERS_H_ */
<file_sep>/brtos/modules/terminal/terminal_cfg_def.h
/*
* terminal_cfg_def.h
*
* Created on: 28/04/2016
* Author: <NAME>
*/
#ifndef TERMINAL_CFG_DEF_H_
#define TERMINAL_CFG_DEF_H_
/************* TERMINAL CONFIG *************************/
#ifndef TERM_INPUT_BUFSIZE
#define TERM_INPUT_BUFSIZE 32
#endif
#ifndef UP_KEY_CHAR
#define UP_KEY_CHAR (char)-32
#endif
#ifndef CHARS_TO_DISCARD
#define CHARS_TO_DISCARD 1
#endif
//** Only for reference. Copy and paste this file to a local folder, and chaneg it according your platform*/
#if 0
/* Supported commands */
/* Must be listed in alphabetical order !!!! */
/* ------ NAME ------- HELP --- */
#define COMMAND_TABLE(ENTRY) \
ENTRY(help,"Help Command") \
ENTRY(runst,"Running stats") \
ENTRY(top,"System info") \
ENTRY(ver,"System version")
#define HELP_DESCRIPTION 1
#endif
#ifndef TERM_PRINT
#include "printf_lib.h"
#define CUSTOM_PRINTF 1
#define TERM_PRINT(...) printf_lib(__VA_ARGS__);
#define SPRINTF(a,...) snprintf_lib(a,256,__VA_ARGS__);
#endif
/*******************************************************/
#endif /* TERMINAL_CFG_DEF_H_ */
<file_sep>/platforms/eclipse_mingw_win32/src/brtos_win32.c
/*
============================================================================
Nome : brtos_win32.c
Autor : <NAME>
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
/* BRTOS includes */
#include "BRTOS.h"
#include "tasks.h"
BRTOS_TH th1, th2, th3;
#define STACK_SIZE_DEF 8 /* tamanho de pilha padrão */
#if 0
#include <assert.h>
#define ASSERT(x) assert(x)
#else
#define ASSERT(x) if(!(x)) while(1){}
#endif
int main(void) {
/* Inicia as variaveis do BRTOS */
BRTOS_Init();
#if STIMER_TEST
extern void stimer_test(void);
stimer_test();
#endif
/* Instala as tarefas */
ASSERT(OSInstallTask(&TarefaTempoDoSistema,"Tempo do sistema",STACK_SIZE_DEF,31,&th1) == OK);
ASSERT(OSInstallTask(&TarefaADC,"Teste de driver ADC",STACK_SIZE_DEF,5,&th1) == OK);
// ASSERT(OSInstallTask(&TarefaGPIO,"Teste driver GPIO",STACK_SIZE_DEF,10,&th2) == OK);
// ASSERT(OSInstallTask(&SerialTask,"Teste driver UART",STACK_SIZE_DEF,4,&th3) == OK);
ASSERT(OSInstallTask(&TerminalTask,"Terminal de comandos",STACK_SIZE_DEF,6,NULL) == OK);
/* Inicia o escalonador do BRTOS */
ASSERT(BRTOSStart() == OK);
return EXIT_SUCCESS;
}
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/I2Cx.c
#include "BRTOS.h"
#include "device.h"
#include "drivers.h"
#define NUM_I2C 1
static BRTOS_Sem *I2CTX[NUM_I2C];
static BRTOS_Queue *I2CQ[NUM_I2C];
static BRTOS_Mutex *I2CMutex[NUM_I2C];
char I2C_buffer;
static uint32_t I2CHandler(void)
{
char c = I2C_buffer;
OSQueuePost(I2CQ[0], c);
return TRUE;
}
static void Init_I2C(void *parameters)
{
i2c_config_t *i2c_conf = (i2c_config_t *)parameters;
ConfiguraInterruptHandler( INTERRUPT_I2C, I2CHandler);
// todo: Configure I2C Baud
//I2CConfigSet(i2c_conf->baudrate, config);
ASSERT(OSSemCreate(0, &I2CTX[0]) == ALLOC_EVENT_OK);
ASSERT(OSQueueCreate(i2c_conf->queue_size, &I2CQ[0]) == ALLOC_EVENT_OK);
if (i2c_conf->mutex == true)
{
OSMutexCreate (&I2CMutex[0], 0);
}
}
#define i2c_rwchar(x)
static size_t I2C_Write(OS_Device_Control_t *dev, char *string, size_t size ){
size_t nbytes = 0;
while(size)
{
i2c_rwchar((char)string);
nbytes++;
size--;
string++;
}
return nbytes;
}
static size_t I2C_Read(OS_Device_Control_t *dev, char *string, size_t size ){
size_t nbytes = 0;
i2c_config_t *i2c_conf = (i2c_config_t *)dev->device->DriverData;
while(nbytes < size)
{
if (OSQueuePend(I2CQ[dev->device_number], (uint8_t*)string, i2c_conf->timeout) != READ_BUFFER_OK) goto failed_rx;
string++;
nbytes++;
}
failed_rx:
return nbytes;
}
static size_t I2C_Set(OS_Device_Control_t *dev, uint32_t request, uint32_t value){
unsigned long config = 0;
size_t ret = 0;
i2c_config_t *i2c_conf = (i2c_config_t *)dev->device->DriverData;
switch(request){
case I2C_BAUDRATE:
i2c_conf->baudrate = value;
break;
case I2C_DIRECTION:
i2c_conf->direction = value;
break;
case I2C_QUEUE_SIZE:
/* somente pode ser alterado se filar dināmicas forem utilizadas. */
break;
case I2C_TIMEOUT:
i2c_conf->timeout = value;
break;
case CTRL_ACQUIRE_WRITE_MUTEX:
if (I2CMutex[dev->device_number] != NULL){
ret = OSMutexAcquire(I2CMutex[dev->device_number],value);
}
break;
case CTRL_RELEASE_WRITE_MUTEX:
if (I2CMutex[dev->device_number] != NULL){
ret = OSMutexRelease(I2CMutex[dev->device_number]);
}
break;
default:
break;
}
return ret;
}
static size_t I2C_Get(OS_Device_Control_t *dev, uint32_t request){
uint32_t ret;
i2c_config_t *i2c_conf = (i2c_config_t *)dev->device->DriverData;
switch(request){
case I2C_BAUDRATE:
ret = i2c_conf->baudrate;
break;
case I2C_DIRECTION:
ret = i2c_conf->direction;
break;
case I2C_QUEUE_SIZE:
ret = i2c_conf->queue_size;
break;
case I2C_TIMEOUT:
ret = i2c_conf->timeout;
break;
default:
ret = 0;
break;
}
return ret;
}
static const device_api_t I2C_api ={
.read = (Device_Control_read_t)I2C_Read,
.write = (Device_Control_write_t)I2C_Write,
.set = (Device_Control_set_t)I2C_Set,
.get = (Device_Control_get_t)I2C_Get
};
void OSOpenI2C(void *pdev, void *parameters){
OS_Device_Control_t *dev = pdev;
Init_I2C(parameters);
dev->api = &I2C_api;
}
<file_sep>/platforms/eclipse_mingw_win32/src/hal/MingW/HAL.h
/**
* \file HAL.h
* \brief BRTOS Hardware Abstraction Layer defines and inline assembly
*
* This file contain the defines and inline assembly that are processor dependant.
*
*
**/
/*********************************************************************************************************
* BRTOS
* Brazilian Real-Time Operating System
* Acronymous of Basic Real-Time Operating System
*
*
* Open Source RTOS under MIT License
*
*
*
* OS HAL Header for Windows port
*
*
* Author: <NAME>
* Revision: 1.0
* Date: 20/03/2009
*
* Authors: <NAME> e <NAME>
* Revision: 1.2
* Date: 01/10/2010
*
*********************************************************************************************************/
#ifndef OS_HAL_H
#define OS_HAL_H
#include "OS_types.h"
#include <Windows.h>
/// Supported processors
#define X86 99
/// Define the used processor
#define PROCESSOR X86
/// Define the CPU type
#define OS_CPU_TYPE INT32U
#define STACK_MARK 1
/// Define if the optimized scheduler will be used
#define OPTIMIZED_SCHEDULER 0
/// Define if nesting interrupt is active
#define NESTING_INT 1
#define TASK_WITH_PARAMETERS 0
/// Define if its necessary to save status register / interrupt info
#define OS_SR_SAVE_VAR
/// Define stack growth direction
#define STACK_GROWTH 1 /// 1 -> down; 0-> up
/// Define CPU Stack Pointer Size
#define SP_SIZE 32
extern INT8U iNesting;
extern INT32U SPvalue;
#define INTERRUPT_SWC ( 0UL )
#define INTERRUPT_TICK ( 1UL )
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
///// Port Defines /////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/// Defines the change context command of the choosen processor
#define ChangeContext() GeraInterrupcaoSimulada( INTERRUPT_SWC )
#define OS_INT_ENTER() iNesting++;
#define OS_INT_EXIT() if(iNesting > 0) iNesting--;
/* Critical section handling. */
void EnterCritical( void );
void ExitCritical( void );
/// Defines the disable interrupts command
#define UserEnterCritical() EnterCritical();
/// Defines the enable interrupts command
#define UserExitCritical() ExitCritical();
/// Defines the disable interrupts command
#define OSEnterCritical() UserEnterCritical()
/// Defines the enable interrupts command
#define OSExitCritical() UserExitCritical()
/// Defines the low power command
#define OS_Wait
/// Defines the tick timer interrupt handler code
#define TICKTIMER_INT_HANDLER
#define NUMBER_MIN_OF_STACKED_BYTES (8)
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
///// Functions Prototypes /////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
#if (TASK_WITH_PARAMETERS == 1)
void CreateVirtualStack(void(*FctPtr)(void*), INT16U NUMBER_OF_STACKED_BYTES, void *parameters);
#else
void CreateVirtualStack(void(*FctPtr)(void), INT16U NUMBER_OF_STACKED_BYTES);
#endif
/*****************************************************************************************//**
* \fn void TickTimerSetup(void)
* \brief Tick timer clock setup
* \return NONE
*********************************************************************************************/
void TickTimerSetup(void);
/*****************************************************************************************//**
* \fn void OSRTCSetup(void)
* \brief Real time clock setup
* \return NONE
*********************************************************************************************/
void OSRTCSetup(void);
#if (OPTIMIZED_SCHEDULER == 1)
#define Optimezed_Scheduler()
#endif
void BTOSStartFirstTask(void);
/*
* Sinaliza que uma interrupcao simulada aconteceu.
*/
void GeraInterrupcaoSimulada( uint32_t InterruptNumber );
/*
* Instala um "interrupt handler". O numero deve ser unico e maior do que 2
* (pois 0 e 1 sao usados pelo sistema) e menor do que 32.
*
* O "handler" deve retornar um valor maior que 0 (TRUE) para verificar se ncessita-se
* realizar a troca de contexto
*/
void ConfiguraInterruptHandler( uint32_t InterruptNumber, uint32_t (*Handler)( void ) );
#endif
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/PWMx.c
/*
* PWMx.c
*
* Created on: 18 de ago de 2016
* Author: gustavo
*/
#include "BRTOS.h"
#include "device.h"
static size_t PWM_Set(OS_Device_Control_t *dev, uint32_t request, uint32_t value){
size_t ret = 0;
return ret;
}
static size_t PWM_Get(OS_Device_Control_t *dev, uint32_t request){
uint32_t ret = 0;
return ret;
}
static const device_api_t PWM_api ={
.read = (Device_Control_read_t)NULL,
.write = (Device_Control_write_t)NULL,
.set = (Device_Control_set_t)PWM_Set,
.get = (Device_Control_get_t)PWM_Get
};
void Init_PWM(unsigned long base, void *parameters)
{
pwm_config_t *pwm_conf = (pwm_config_t *)parameters;
}
void OSOpenPWM(void *pdev, void *parameters)
{
OS_Device_Control_t *dev = pdev;
dev->api = &PWM_api;
}
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/UARTx.c
#include "BRTOS.h"
#include "device.h"
#include "drivers.h"
#include "stdio.h"
#define NUM_UART 1
static BRTOS_Sem *SerialTX[NUM_UART];
static BRTOS_Queue *SerialQ[NUM_UART];
static BRTOS_Mutex *SerialRMutex[NUM_UART];
static BRTOS_Mutex *SerialWMutex[NUM_UART];
char UART_RX_buffer;
static uint32_t UARTHandler(void)
{
char c = UART_RX_buffer;
if(SerialQ[0] != NULL)
{
OSQueuePost(SerialQ[0], c);
}
return TRUE;
}
static void Init_UART(void *parameters)
{
uart_config_t *uart_conf = (uart_config_t *)parameters;
ConfiguraInterruptHandler( INTERRUPT_UART, UARTHandler);
// todo: Configure UART Baud
//UARTConfigSet(uart_conf->baudrate, config);
ASSERT(OSSemCreate(0, &SerialTX[0]) == ALLOC_EVENT_OK);
ASSERT(OSQueueCreate(uart_conf->queue_size, &SerialQ[0]) == ALLOC_EVENT_OK);
if (uart_conf->write_mutex == true){
OSMutexCreate (&SerialWMutex[0], 0);
}
if (uart_conf->read_mutex == true){
OSMutexCreate (&SerialRMutex[0], 0);
}
}
static size_t UART_Write(OS_Device_Control_t *dev, char *string, size_t size ){
size_t nbytes = 0;
while(size){
putchar((char)*string);
nbytes++;
size--;
string++;
}
return nbytes;
}
static size_t UART_Read(OS_Device_Control_t *dev, char *string, size_t size ){
size_t nbytes = 0;
uart_config_t *uart_conf = (uart_config_t *)dev->device->DriverData;
while(nbytes < size)
{
if (OSQueuePend(SerialQ[dev->device_number], (uint8_t*)string, uart_conf->timeout) != READ_BUFFER_OK) goto failed_rx;
string++;
nbytes++;
}
failed_rx:
return nbytes;
}
static size_t UART_Set(OS_Device_Control_t *dev, uint32_t request, uint32_t value){
unsigned long config = 0;
size_t ret = 0;
uart_config_t *uart_conf = (uart_config_t *)dev->device->DriverData;
switch(request){
case UART_BAUDRATE:
uart_conf->baudrate = value;
break;
case UART_PARITY:
uart_conf->parity = value;
break;
case UART_STOP_BITS:
uart_conf->polling_irq = value;
break;
case UART_QUEUE_SIZE:
/* somente pode ser alterado se filar dināmicas forem utilizadas. */
break;
case UART_TIMEOUT:
uart_conf->timeout = value;
break;
case CTRL_ACQUIRE_READ_MUTEX:
if (SerialRMutex[dev->device_number] != NULL){
ret = OSMutexAcquire(SerialRMutex[dev->device_number],value);
}
break;
case CTRL_ACQUIRE_WRITE_MUTEX:
if (SerialWMutex[dev->device_number] != NULL){
ret = OSMutexAcquire(SerialWMutex[dev->device_number],value);
}
break;
case CTRL_RELEASE_WRITE_MUTEX:
if (SerialWMutex[dev->device_number] != NULL){
ret = OSMutexRelease(SerialWMutex[dev->device_number]);
}
break;
case CTRL_RELEASE_READ_MUTEX:
if (SerialRMutex[dev->device_number] != NULL){
ret = OSMutexRelease(SerialRMutex[dev->device_number]);
}
break;
default:
break;
}
return ret;
}
static size_t UART_Get(OS_Device_Control_t *dev, uint32_t request){
uint32_t ret;
uart_config_t *uart_conf = (uart_config_t *)dev->device->DriverData;
switch(request){
case UART_BAUDRATE:
ret = uart_conf->baudrate;
break;
case UART_PARITY:
ret = uart_conf->parity;
break;
case UART_STOP_BITS:
ret = uart_conf->stop_bits;
break;
case UART_QUEUE_SIZE:
ret = uart_conf->queue_size;
break;
case UART_TIMEOUT:
ret = uart_conf->timeout;
break;
default:
ret = 0;
break;
}
return ret;
}
static const device_api_t UART_api ={
.read = (Device_Control_read_t)UART_Read,
.write = (Device_Control_write_t)UART_Write,
.set = (Device_Control_set_t)UART_Set,
.get = (Device_Control_get_t)UART_Get
};
void OSOpenUART(void *pdev, void *parameters){
OS_Device_Control_t *dev = pdev;
Init_UART(parameters);
dev->api = &UART_api;
}
<file_sep>/platforms/eclipse_mingw_win32/src/drivers/ADCx.c
#include "BRTOS.h"
#include "device.h"
#include "drivers.h"
#include "time.h"
#define NUM_ADC 1
static BRTOS_Sem *ADC[NUM_ADC];
static BRTOS_Queue *ADCQ[NUM_ADC];
static BRTOS_Mutex *ADCRMutex[NUM_ADC];
#define NUM_ADC_CHAN 16
uint16_t ADC_buffer[NUM_ADC_CHAN];
uint16_t ADC_chan;
struct adc_signal
{
int freq;
int amp;
};
struct adc_signal ADC_Signals[] = {{60,3}};
static int ADC_res = 8;
static int ADC_rate = 1000;
time_t clock_time(void)
{
unsigned long long time;
GetSystemTimeAsFileTime((PFILETIME)&time);
return (time_t)(time);
}
#include "math.h"
static uint16_t quantizacao (double valor, double amp, int n)
{
double D = 2*amp/n;
double x = valor + amp;
double q = floor(x/D);
uint16_t y;
y = (uint16_t)((D/2 + D*q - amp)*(n-1)/amp);
return y;
}
static void ADC_Config(int res, int rate)
{
ADC_res = res;
ADC_rate = rate;
}
static int ADC_Simulado(int canal)
{
int freq = ADC_Signals[canal].freq;
int amp = ADC_Signals[canal].amp;
double y = amp*sin(2*M_PI*freq*clock_time()/10000);
return quantizacao(y, amp,(1<<ADC_res));
}
static uint32_t ADCHandler(void)
{
uint8_t chan = ADC_chan;
if(NUM_ADC_CHAN < chan) return FALSE;
uint16_t val = ADC_buffer[chan];
OSQueuePost(ADCQ[0], val);
return TRUE;
}
static int ADC_GetSample(uint8_t num, uint8_t* buf, ostick_t timeout)
{
static uint16_t valor;
static int adc_state = 0;
if(adc_state == 0)
{
valor = ADC_Simulado(num);
*buf = (uint8_t)(valor>>8);
adc_state = 1;
}else
{
adc_state = 0;
*buf = (uint8_t)valor;
}
return TRUE;
}
static void Init_ADC(void *parameters)
{
adc_config_t *adc_conf = (adc_config_t *)parameters;
ConfiguraInterruptHandler( INTERRUPT_ADC, ADCHandler);
ASSERT(OSSemCreate(0, &ADC[0]) == ALLOC_EVENT_OK);
ASSERT(OSQueueCreate(adc_conf->queue_size, &ADCQ[0]) == ALLOC_EVENT_OK);
if (adc_conf->read_mutex == true)
{
OSMutexCreate (&ADCRMutex[0], 0);
}
ADC_Config(adc_conf->resolution, adc_conf->samplerate);
}
static size_t ADC_Read(OS_Device_Control_t *dev, char *buf, size_t size ){
size_t nbytes = 0;
adc_config_t *adc_conf = (adc_config_t *)dev->device->DriverData;
while(nbytes < size)
{
if(adc_conf->polling_irq == ADC_IRQ)
{
if (OSQueuePend(ADCQ[dev->device_number], (uint8_t*)buf, adc_conf->timeout) != READ_BUFFER_OK) goto exit_on_error;
}else
{
if (ADC_GetSample(dev->device_number, (uint8_t*)buf, adc_conf->timeout) != TRUE) goto exit_on_error;
}
buf++;
nbytes++;
}
exit_on_error:
return nbytes;
}
static size_t ADC_Set(OS_Device_Control_t *dev, uint32_t request, uint32_t value){
size_t ret = 0;
adc_config_t *adc_conf = (adc_config_t *)dev->device->DriverData;
switch(request){
case ADC_SAMPLERATE:
adc_conf->samplerate = value;
break;
case ADC_RESOLUTION:
adc_conf->resolution = value;
break;
case ADC_QUEUE_SIZE:
/* somente pode ser alterado se filas dināmicas forem utilizadas. */
break;
case ADC_TIMEOUT:
adc_conf->timeout = value;
break;
case CTRL_ACQUIRE_READ_MUTEX:
if (ADCRMutex[dev->device_number] != NULL)
{
ret = OSMutexAcquire(ADCRMutex[dev->device_number],value);
}
break;
case CTRL_RELEASE_READ_MUTEX:
if (ADCRMutex[dev->device_number] != NULL)
{
ret = OSMutexRelease(ADCRMutex[dev->device_number]);
}
break;
default:
break;
}
return ret;
}
static size_t ADC_Get(OS_Device_Control_t *dev, uint32_t request){
uint32_t ret;
adc_config_t *adc_conf = (adc_config_t *)dev->device->DriverData;
switch(request){
case ADC_SAMPLERATE:
ret = adc_conf->samplerate;
break;
case ADC_RESOLUTION:
ret = adc_conf->resolution;
break;
case ADC_QUEUE_SIZE:
ret = adc_conf->queue_size;
break;
case ADC_TIMEOUT:
ret = adc_conf->timeout;
break;
default:
ret = 0;
break;
}
return ret;
}
static const device_api_t ADC_api ={
.read = (Device_Control_read_t)ADC_Read,
.write = (Device_Control_write_t)NULL,
.set = (Device_Control_set_t)ADC_Set,
.get = (Device_Control_get_t)ADC_Get
};
void OSOpenADC(void *pdev, void *parameters)
{
OS_Device_Control_t *dev = pdev;
Init_ADC(parameters);
dev->api = &ADC_api;
}
<file_sep>/README.md
# Simulador
Simulador do BRTOS para Windows
<file_sep>/platforms/eclipse_mingw_win32/src/config/OSLibcConfig.h
/*
* OSLibcConfig.h
*
*/
#ifndef CONFIG_OSLIBCCONFIG_H_
#define CONFIG_OSLIBCCONFIG_H_
#define INC_STDIO_H 0
#define INC_FATFS_H 0
/* stdio config */
#if INC_STDIO_H
#include <dirent.h>
#define OS_FILETYPE FILE*
#define OS_FILEPOS fpos_t
#define OS_DIRTYPE DIR*
#define OS_DIRINFO struct dirent *
#define OS_FILEINFO struct stat
#define OSfopenread(filename,file) ((*(file) = fopen((filename),"rb+")) != NULL)
#define OSfopenwrite(filename,file) ((*(file) = fopen((filename),"wb")) != NULL)
#define OSfopenappend(filename,file) ((*(file) = fopen((filename),"ab+")) != NULL)
#define OSfclose(file) (fclose(*(file)) == 0)
#define OSfread(buffer,size,file) (fgets((char*)(buffer),(size),*(file)) != NULL)
#define OSfwrite(buffer,file) (fputs((char*)(buffer),*(file)) >= 0)
#define OSrename(source,dest) (rename((source), (dest)) == 0)
#define OSremove(filename) (remove(filename) == 0)
#define OSftell(file,pos) ((*(pos) = ftell(*(file))) != (-1L))
#define OSfseek(file,pos) (fseek(*(file), *(pos), SEEK_SET) == 0)
#define OSfseek_end(file) (fseek(*(file), 0, SEEK_END) == 0)
#define OSfseek_begin(file) (fseek(*(file), 0, SEEK_SET) == 0)
#define OSfstat(filename, fileinfo) (stat((filename), (fileinfo)) == 0)
#define OSopendir(dirname,dir) (((dir) = opendir(dirname)) != NULL)
#define OSclosedir(dir) closedir(dir)
#define OSreaddir(dirinfo,dir) (((dirinfo) = readdir(dir)) != NULL)
#define OSchdir(dirname) chdir(dirname)
#define OSmkdir(dirname) (_mkdir(dirname) == 0)
#endif
#elif INC_FATFS_H
/* You must set _USE_STRFUNC to 1 or 2 in the include file ff.h
* to enable the "string functions" fgets() and fputs().
*/
#include "ff.h" /* include ff.h for FatFs */
#define OS_BUFFERSIZE 256 /* maximum line length, maximum path length */
#define OS_FILETYPE FIL
#define OS_FILEPOS DWORD
#define OS_DIRTYPE DIR
#define OS_DIRINFO FILINFO
#define OS_FILEINFO FILINFO
#define OSfopenread(filename,file) (f_open((file), (filename), FA_READ+FA_OPEN_EXISTING) == FR_OK)
#define OSfopenwrite(filename,file) (f_open((file), (filename), FA_WRITE+FA_CREATE_ALWAYS) == FR_OK)
#define OSfopenappend(filename,file) (f_open((file), (filename), FA_WRITE) == FR_OK)
#define OSfclose(file) (f_close(file) == FR_OK)
#define OSfread(buffer,size,file) f_gets((buffer), (size),(file))
#define OSfwrite(buffer,file) (f_puts((buffer), (file)) != EOF)
#define OSrename(source,dest)
#define OSremove(filename) (f_unlink(filename) == FR_OK)
#define OSftell(file,pos) (*(pos) = f_tell((file)))
#define OSfseek(file,pos) (f_lseek((file), *(pos)) == FR_OK)
#define OSfseek_end(file) (f_lseek((file), f_size((file))) == FR_OK)
#define OSfseek_begin(file)
#define OSfstat(filename, fileinfo) (f_stat((filename), (fileinfo)) == FR_OK)
#define OSopendir(dirname,dir) (f_opendir(&(dir),dirname) == FR_OK)
#define OSclosedir(dir) f_closedir(&(dir))
#define OSreaddir(dirinfo,dir) (f_readdir(&(dir), &(dirinfo)) == FR_OK)
#define OSchdir(dirname) f_chdir(dirname)
#define OSmkdir(dirname) (f_mkdir(dirname) == FR_OK)
#else
#define OS_FILETYPE
#define OS_FILEPOS
#define OS_DIRTYPE
#define OS_DIRINFO
#define OS_FILEINFO
#define OSfopenread(filename,file)
#define OSfopenwrite(filename,file)
#define OSfopenappend(filename,file)
#define OSfclose(file)
#define OSfread(buffer,size,file)
#define OSfwrite(buffer,file)
#define OSrename(source,dest)
#define OSremove(filename)
#define OSftell(file,pos)
#define OSfseek(file,pos)
#define OSfseek_end(file)
#define OSfseek_begin(file)
#define OSfstat(filename, fileinfo)
#define OSopendir(dirname,dir)
#define OSclosedir(dir)
#define OSreaddir(dirinfo,dir)
#define OSchdir(dirname)
#define OSmkdir(dirname)
#endif
#endif /* CONFIG_OSLIBCCONFIG_H_ */
<file_sep>/platforms/eclipse_mingw_win32/src/config/OSDevConfig.h
/*
* OSDevConfig.h
*
* Created on: 9 de ago de 2016
* Author: gustavo
*/
#ifndef CONFIG_OSDEVCONFIG_H_
#define CONFIG_OSDEVCONFIG_H_
#define MAX_INSTALLED_DEVICES 5
#define AVAILABLE_DEVICES_TYPES 5
#define DRIVER_NAMES {"UART", "SPI", "I2C", "GPIO","ADC","DAC","PWM"}
typedef enum
{
UART_TYPE = 0,
SPI_TYPE,
I2C_TYPE,
GPIO_TYPE,
ADC_TYPE,
DAC_TYPE,
PWM_TYPE,
END_TYPE
} Device_Types_t;
/* Drivers disponiveis */
void OSOpenUART(void *pdev, void *parameters);
void OSOpenGPIO(void *pdev, void *parameters);
void OSOpenADC(void *pdev, void *parameters);
void OSOpenPWM(void *pdev, void *parameters);
#define DRIVER_LIST {{UART_TYPE, OSOpenUART},{GPIO_TYPE, OSOpenGPIO}, {ADC_TYPE, OSOpenADC},{PWM_TYPE, OSOpenPWM}}
#endif /* CONFIG_OSDEVCONFIG_H_ */
<file_sep>/libs/utils.c
#include "BRTOS.h"
#include "utils.h"
#include <stdlib.h>
#include <string.h>
#include "terminal.h"
#if ENABLE_UART1 || ENABLE_UART2
#include "uart.h"
#else
#define putchar_uart1(c)
#define printf_uart1(s)
#define putchar_uart2(c)
#define printf_uart2(s)
#endif
#if ENABLE_USB_CDC
extern void putchar_usb(char);
extern void printf_usb(char*);
#else
#define putchar_usb(c)
#define printf_usb(s)
#endif
void printSer(INT8U SerialPort, const CHAR8 *string)
{
switch(SerialPort)
{
case USE_UART1:
printf_uart1(string);
break;
case USE_UART2:
printf_uart2(string);
break;
case USE_USB:
printf_usb((char*)string);
break;
default:
break;
}
}
void putcharSer(INT8U SerialPort, CHAR8 caracter)
{
switch(SerialPort)
{
case USE_UART1:
putchar_uart1(caracter);
break;
case USE_UART2:
putchar_uart2(caracter);
break;
case USE_USB:
putchar_usb(caracter);
break;
default:
break;
}
}
INT32U StringToInteger(char p[])
{
INT32U k = 0;
while (*p)
{
k = (k << 3) + (k << 1) + (*p) - '0';
p++;
}
return k;
}
#if 0
int strcmp(char s1[], char s2[])
{
for (; *s1 == *s2; s1++, s2++)
{
if (*s1 == '\0')
{
return 0;
}
}
return *s1 - *s2;
}
void strcpy(char dest[], char src[])
{
unsigned i;
for (i = 0; src[i] != '\0'; ++i)
dest[i] = src[i];
dest[i] = '\0';
}
void strcat(char dest[], char src[])
{
INT8U i, j;
for (i = 0; dest[i] != '\0'; i++);
for (j = 0; src[j] != '\0'; j++)
dest[i + j] = src[j];
dest[i + j] = '\0';
}
int strlen(char *str)
{
char *s;
for (s = str; *s; ++s);
return (s - str);
}
#endif
/* reverse: reverse string s in place */
void reverse(char s[])
{
int i, j;
char c;
for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
{
c = s[i];
s[i] = s[j];
s[j] = c;
}
}
/* conv inteiro n para string s */
void IntToString(int n, char s[])
{
int i;
i = 0;
do
{
s[i++] = n % 10 + '0';
} while ((n /= 10) > 0);
s[i] = '\0';
reverse(s);
}
char *ltoa(long N, char *str, int base)
{
#define BUFSIZE_LTOA (sizeof(long) * 8 + 1)
register int i = 2;
long uarg;
char *tail, *head = str, buf[BUFSIZE_LTOA];
if (36 < base || 2 > base)
base = 10; /* can only use 0-9, A-Z */
tail = &buf[BUFSIZE_LTOA - 1]; /* last character position */
*tail-- = '\0';
if (10 == base && N < 0L)
{
*head++ = '-';
uarg = -N;
}
else uarg = N;
if (uarg)
{
for (i = 1; uarg; ++i)
{
register ldiv_t r;
r = ldiv(uarg, base);
*tail-- = (char)(r.rem + ((9L < r.rem) ?
('A' - 10L) : '0'));
uarg = r.quot;
}
}
else *tail-- = '0';
memcpy(head, ++tail, i);
return str;
}
INT32U LWordSwap(INT32U u32DataSwap)
{
INT32U u32Temp;
u32Temp = (u32DataSwap & 0xFF000000) >> 24;
u32Temp += (u32DataSwap & 0xFF0000) >> 8;
u32Temp += (u32DataSwap & 0xFF00) << 8;
u32Temp += (u32DataSwap & 0xFF) << 24;
return (u32Temp);
}
#if 0
void PrintDecimal(INT16S val, CHAR8 *buff)
{
INT16U backup;
INT32U i = 0;
CHAR8 s = ' ';
// Fill buffer with spaces
for (i = 0; i < 6; i++)
{
*(buff + i) = ' ';
}
// Null termination for data
*(buff + i) = 0;
if (val < 0)
{
val = -val;
s = '-';
}
// Convert binary value to decimal ASCII
for (i = 5; i > 0;)
{
backup = val;
val /= 10;
*(buff + i) = (backup - (val * 10)) + '0';
i--;
if (val == 0)
break;
}
// Completes the string for sign information
*(buff + i) = s; // Sign character
}
#endif
void Print4Digits(INT16U number, INT8U align, CHAR8 *buff)
{
INT8U caracter = 0;
INT8U mil, cent, dez;
INT8U escreve_zero = FALSE;
INT32U i = 0;
if (number < 10000)
{
if (align == ZEROS_ALIGN)
{
escreve_zero = TRUE;
}
mil = (number / 1000);
caracter = mil + '0';
if (caracter != '0')
{
*(buff + i) = caracter;
i++;
escreve_zero = TRUE;
}
else
{
if (escreve_zero == TRUE)
{
*(buff + i) = caracter;
i++;
}
else
{
if (align == SPACE_ALIGN)
{
*(buff + i) = ' ';
i++;
}
}
}
cent = ((number - mil * 1000) / 100);
caracter = cent + '0';
if (caracter != '0')
{
*(buff + i) = caracter;
i++;
escreve_zero = TRUE;
}
else
{
if (escreve_zero == TRUE)
{
*(buff + i) = caracter;
i++;
}
else
{
if (align == SPACE_ALIGN)
{
*(buff + i) = ' ';
i++;
}
}
}
dez = ((number - 1000 * mil - cent * 100) / 10);
caracter = dez + '0';
if (caracter != '0')
{
*(buff + i) = caracter;
i++;
}
else
{
if (escreve_zero == TRUE)
{
*(buff + i) = caracter;
i++;
}
else
{
if (align == SPACE_ALIGN)
{
*(buff + i) = ' ';
i++;
}
}
}
caracter = (number % 10) + '0';
*(buff + i) = caracter;
i++;
*(buff + i) = 0;
}
}
void Print3Digits(INT16U number, INT8U align, CHAR8 *buff)
{
INT8U caracter = 0;
INT8U cent, dez;
INT8U escreve_zero = FALSE;
INT32U i = 0;
if (number < 1000)
{
if (align == ZEROS_ALIGN)
{
escreve_zero = TRUE;
}
cent = (number / 100);
caracter = cent + '0';
if (caracter != '0')
{
*(buff + i) = caracter;
i++;
escreve_zero = TRUE;
}
else
{
if (escreve_zero == TRUE)
{
*(buff + i) = caracter;
i++;
}
else
{
if (align == SPACE_ALIGN)
{
*(buff + i) = ' ';
i++;
}
}
}
dez = ((number - cent * 100) / 10);
caracter = dez + '0';
if (caracter != '0')
{
*(buff + i) = caracter;
i++;
escreve_zero = TRUE;
}
else
{
if (escreve_zero == TRUE)
{
*(buff + i) = caracter;
i++;
}
else
{
if (align == SPACE_ALIGN)
{
*(buff + i) = ' ';
i++;
}
}
}
caracter = (number % 10) + '0';
*(buff + i) = caracter;
i++;
*(buff + i) = 0;
}
}
void Print2Digits(INT8U number, INT8U align, CHAR8 *buff)
{
INT8U caracter = 0;
INT8U dez;
INT8U escreve_zero = FALSE;
INT32U i = 0;
if (number < 100)
{
if (align == ZEROS_ALIGN)
{
escreve_zero = TRUE;
}
dez = number / 10;
caracter = dez + '0';
if (caracter != '0')
{
*(buff + i) = caracter;
i++;
escreve_zero = TRUE;
}
else
{
if (escreve_zero == TRUE)
{
*(buff + i) = caracter;
i++;
}
else
{
if (align == SPACE_ALIGN)
{
*(buff + i) = ' ';
i++;
}
}
}
caracter = (number % 10) + '0';
*(buff + i) = caracter;
i++;
*(buff + i) = 0;
}
}
#if 0
// formato yyyymmddhhmmss
void PrintDateTime(OSDateTime *dt, CHAR8 *buff)
{
Print4Digits(dt->date.RTC_Year,ZEROS_ALIGN, &buff[0]);
Print2Digits(dt->date.RTC_Month,ZEROS_ALIGN, &buff[4]);
Print2Digits(dt->date.RTC_Day,ZEROS_ALIGN, &buff[6]);
Print2Digits(dt->time.RTC_Hour,ZEROS_ALIGN, &buff[8]);
Print2Digits(dt->time.RTC_Minute,ZEROS_ALIGN, &buff[10]);
Print2Digits(dt->time.RTC_Second,ZEROS_ALIGN, &buff[12]);
}
#endif
<file_sep>/platforms/eclipse_mingw_win32/src/tasks.c
#include "BRTOS.h"
#include "stdio.h"
#include "device.h"
#include "drivers/drivers.h"
void TarefaTempoDoSistema(void)
{
OSResetTime();
while(1)
{
OSUpdateUptime();
DelayTask(configTICK_RATE_HZ);
}
}
void TarefaADC(void)
{
OS_Device_Control_t *adc;
adc_config_t adc0;
uint8_t buf[2];
uint16_t idx = 0;
uint16_t val;
#define BUFSIZE 256
uint16_t big_buffer[BUFSIZE];
adc0.polling_irq = ADC_POLLING;
adc0.resolution = ADC_RES_16;
adc0.samplerate = 1000;
adc0.timeout = 0;
adc = OSDevOpen("ADC0", &adc0);
while(1)
{
OSDevRead(adc,buf,2);
val = (buf[0] << 8) + buf[1];
big_buffer[idx++%BUFSIZE] = val;
DelayTask(100);
}
}
void TarefaGPIO(void)
{
OS_Device_Control_t *dev_gpiob;
gpio_config_t gpiob;
OS_Device_Control_t *dev_gpiod;
gpio_config_t gpiod;
gpiob.used_pins_out = GPIO_PIN_8 | GPIO_PIN_7;
gpiob.used_pins_in = 0;
gpiob.irq_pins = 0;
dev_gpiob = OSDevOpen("GPIOB", &gpiob);
gpiod.used_pins_out = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_8;
gpiod.used_pins_in = 0;
gpiod.irq_pins = 0;
dev_gpiod = OSDevOpen("GPIOD", &gpiod);
OSGPIOWrite(dev_gpiob,GPIO_PIN_8 | GPIO_PIN_7,1);
OSGPIOWrite(dev_gpiod,GPIO_PIN_1,1);
while(1)
{
//printf("Task 3, input: %c\r\n", c);
DelayTask(200);
OSGPIOWrite(dev_gpiob,GPIO_PIN_8,1);
}
}
#define INF_TIMEOUT 0
void SerialTask(void)
{
char data;
OS_Device_Control_t *uart;
uart_config_t uart0;
uart0.baudrate = 9600;
uart0.parity = UART_PAR_EVEN;
uart0.polling_irq = UART_IRQ;
uart0.queue_size = 128;
uart0.stop_bits = UART_STOP_ONE;
uart0.timeout = 10;
uart0.read_mutex = false;
uart0.write_mutex = true;
uart = OSDevOpen("UART0", &uart0);
OSDevWrite(uart,"Porta serial ativa!\n\r",21);
while(1){
if (OSDevRead(uart,&data,1) >= 1){
if (OSDevSet(uart,CTRL_ACQUIRE_WRITE_MUTEX,50) == OK)
{
OSDevWrite(uart,&data,1);
OSDevSet(uart,CTRL_RELEASE_WRITE_MUTEX,0);
}
}
}
}
#include "terminal.h"
static void uart_init(uart_config_t* uart0 )
{
uart0->baudrate = 9600;
uart0->parity = UART_PAR_EVEN;
uart0->polling_irq = UART_IRQ;
uart0->queue_size = 128;
uart0->stop_bits = UART_STOP_ONE;
uart0->timeout = 10;
uart0->read_mutex = false;
uart0->write_mutex = true;
}
OS_Device_Control_t *uart;
static char term_putchar(char c)
{
if (OSDevSet(uart,CTRL_ACQUIRE_WRITE_MUTEX,50) == OK)
{
OSDevWrite(uart,&c,1);
OSDevSet(uart,CTRL_RELEASE_WRITE_MUTEX,0);
}
return c;
}
void TerminalTask(void)
{
uint8_t data = '\0';
uart_config_t uart0;
uart_init(&uart0);
uart = OSDevOpen("UART0", &uart0);
terminal_init(term_putchar);
printf_terminal("BRTOS terminal\r\n");
while(1)
{
if (OSDevRead(uart,&data,1) >= 1)
{
if (terminal_input(data)) terminal_process();
}
}
}
<file_sep>/tests/cppcheck/Makefile
SOURCEDIR:= ../../brtos/brtos
all:
cppcheck $(SOURCEDIR) | 6555089d11fdb5ba8d28183ec3281fed22bae340 | [
"Markdown",
"C",
"Makefile"
] | 19 | C | brtos/simulador | 6ebab3b36f2cca31feabeec148b6bc21cd9e8fae | 1bc83cba9aec07872b06ffc35ce9478a34802214 |
refs/heads/main | <repo_name>BAHSharma/VACovid<file_sep>/CCTPull.py
import pandas as pd
import numpy as np
def CCTPull(CountyVACOVID):
VAMC = pd.read_csv('data_folder/CleanVAMC.csv',dtype={'VISN':'int','VAMC':'str','FIPS':'str','COUNTY':'str','STATE':'str'})
UScovid = pd.read_csv('https://raw.githubusercontent.com/nytimes/covid-19-data/master/us.csv')
#Formatting of NYTimes COVID-19 Data - Country Level
UScovid[['cases','deaths']] = UScovid[['cases','deaths']].fillna(0).astype(int)
UScovid['date'] = pd.to_datetime(UScovid['date'])
UScovid = UScovid.rename(columns={'date':'DATE','cases':'CASES','deaths':'DEATHS'})
USCasesToday = UScovid.loc[ UScovid.DATE == UScovid.DATE.max(),'CASES'].values[0]
USCasesYesterday = UScovid.loc[ UScovid.DATE == UScovid.DATE.max() - pd.to_timedelta(1, unit='D'),'CASES'].values[0]
USNewCases = USCasesToday - USCasesYesterday
TodayDate = CountyVACOVID['DATE'][0]
#State level Pulls
StateDataSet = {}
StateList = ["Ohio",
"Indiana",
"Michigan",
"Illinois",
"Wisconsin",
"Washington",
"Idaho",
"Oregon",
"Alaska",
"Maryland",
"Virginia",
"District of Columbia",
"Missouri"]
for state in StateList:
StateData = CountyVACOVID[CountyVACOVID.STATE == state]
Cases = StateData['CASES'].sum()
NewCases = Cases - StateData['YESTER_CASES'].sum()
VACases = StateData['VET_CASES'].sum()
NewVACases = VACases - StateData['VET_YESTER'].sum()
values = [Cases, NewCases, VACases, NewVACases]
StateDataSet['%s' %state] = values
#VISN 10 level Pulls
VISN10List = VAMC[VAMC.VISN == 10]['FIPS']
VISN10Data = CountyVACOVID[CountyVACOVID['FIPS'].isin(VISN10List)]
VISN10Cases = VISN10Data['CASES'].sum()
VISN10_VACases = VISN10Data['VET_CASES'].sum()
#VISN 12 level Pulls
VISN12List = VAMC[VAMC.VISN == 12]['FIPS']
VISN12Data = CountyVACOVID[CountyVACOVID['FIPS'].isin(VISN12List)]
VISN12Cases = VISN12Data['CASES'].sum()
VISN12_VACases = VISN12Data['VET_CASES'].sum()
#VISN 20 level Pulls
VISN20List = VAMC[VAMC.VISN == 20]['FIPS']
VISN20Data = CountyVACOVID[CountyVACOVID['FIPS'].isin(VISN20List)]
VISN20Cases = VISN20Data['CASES'].sum()
VISN20_VACases = VISN20Data['VET_CASES'].sum()
#Facility level Pulls
DataSet ={}
VAMCList = [ "Anchorage VA Medical Center",
"Portland VA Medical Center",
"North Las Vegas VA Medical Center",
"<NAME> Memorial VA Medical Center",
"White City VA Medical Center",
"Roseburg VA Medical Center",
"Seattle VA Medical Center",
"Mann-Grandstaff Department of Veterans Affairs Medical Center",
"Boise VA Medical Center",
"<NAME> Department of Veterans Affairs Medical Center",
'<NAME> Memorial Veterans\' Hospital',
'<NAME> Veterans\' Administration Medical Center',
"<NAME> Department of Veterans Affairs Medical Facility",
"<NAME> <NAME> VA Medical Center",
"Battle Creek VA Medical Center",
"<NAME> Department of Veterans Affairs Medical Center",
"<NAME> Department of Veterans Affairs Medical Center",
"Fort Wayne VA Medical Center",
"Marion VA Medical Center",
"<NAME> Veterans\' Administration Medical Center",
"Cincinnati VA Medical Center",
"Chillicothe VA Medical Center",
"Louis Stokes Cleveland Department of Veterans Affairs Medical Center",
"Dayton VA Medical Center",
"Danville VA Medical Center",
"<NAME> Junior Hospital",
"<NAME> Federal Health Care Center",
"Tomah VA Medical Center"
]
for vamc in VAMCList:
FacilityList = VAMC[VAMC.VAMC == vamc]['FIPS']
FacilityData = CountyVACOVID[CountyVACOVID['FIPS'].isin(FacilityList)]
ECases = FacilityData['VET_CASES'].sum()
NewCases = ECases - FacilityData['VET_YESTER'].sum()
values = [ECases, NewCases]
DataSet['%s' %vamc] = values
#Hard-coding for Columbus
COFacilityList = ['39159','39097', '39129','39049','39045','39089','39041','39117']
COFacilityData = CountyVACOVID[CountyVACOVID['FIPS'].isin(COFacilityList)]
COECases = COFacilityData['VET_CASES'].sum()
CONewCases = COECases - COFacilityData['VET_YESTER'].sum()
COValues = [COECases, CONewCases]
DataSet["Columbus VA Medical Center"] = COValues
#Establish a cyclical chart to add new rows for every date it is run
CCTVAChart = pd.read_csv('CCTVAChart2.csv')
CCTVAChart = CCTVAChart.set_index('index').T.rename_axis('DATE').reset_index()
CCTVAChart_newrow = pd.DataFrame({ 'DATE': TodayDate,
'US Cases': USCasesToday,
'New US Cases': USNewCases,
'VISN10 Cases': VISN10Cases,
'VISN12 Cases': VISN12Cases,
'VISN20 Cases': VISN20Cases,
'OH Cases': StateDataSet["Ohio"][0],
'OH NewCases' : StateDataSet["Ohio"][1],
'IN Cases': StateDataSet["Indiana"][0],
'IN NewCases' : StateDataSet["Indiana"][1],
'MI Cases': StateDataSet["Michigan"][0],
'MI NewCases' : StateDataSet["Michigan"][1],
'IL Cases': StateDataSet["Illinois"][0],
'IL NewCases' : StateDataSet["Illinois"][1],
'WI Cases': StateDataSet["Wisconsin"][0],
'WI NewCases' : StateDataSet["Wisconsin"][1],
'WA Cases': StateDataSet["Washington"][0],
'WA NewCases' : StateDataSet["Washington"][1],
'OR Cases': StateDataSet["Oregon"][0],
'OR NewCases' : StateDataSet["Oregon"][1],
'ID Cases': StateDataSet["Idaho"][0],
'ID NewCases' : StateDataSet["Idaho"][1],
'AK Cases': StateDataSet["Alaska"][0],
'AK NewCases': StateDataSet["Alaska"][1],
'MD Cases': StateDataSet["Maryland"][0],
'MD NewCases' : StateDataSet["Maryland"][1],
'VA Cases': StateDataSet["Virginia"][0],
'VA NewCases' : StateDataSet["Virginia"][1],
'DC Cases': StateDataSet["District of Columbia"][0],
'DC NewCases' : StateDataSet["District of Columbia"][1],
'MO Cases': StateDataSet["Missouri"][0],
'MO NewCases' : StateDataSet["Missouri"][1],
'VISN10 VACases': VISN10_VACases,
'VISN12 VACases': VISN12_VACases,
'VISN20 VACases': VISN20_VACases,
'OH VACases': StateDataSet["Ohio"][2],
'OH NewVACases' : StateDataSet["Ohio"][3],
'IN VACases': StateDataSet["Indiana"][2],
'IN NewVACases' : StateDataSet["Indiana"][3],
'MI VACases': StateDataSet["Michigan"][2],
'MI NewVACases' : StateDataSet["Michigan"][3],
'IL VACases': StateDataSet["Illinois"][2],
'IL NewVACases' : StateDataSet["Illinois"][3],
'WI VACases': StateDataSet["Wisconsin"][2],
'WI NewVACases' : StateDataSet["Wisconsin"][3],
'WA VACases': StateDataSet["Washington"][2],
'WA NewVACases' : StateDataSet["Washington"][3],
'OR VACases': StateDataSet["Oregon"][2],
'OR NewVACases' : StateDataSet["Oregon"][3],
'ID VACases': StateDataSet["Idaho"][2],
'ID NewVACases' : StateDataSet["Idaho"][3],
'AK VACases': StateDataSet["Alaska"][2],
'AK NewVACases': StateDataSet["Alaska"][3],
'MD VACases': StateDataSet["Maryland"][2],
'MD NewVACases' : StateDataSet["Maryland"][3],
'VA VACases': StateDataSet["Virginia"][2],
'VA NewVACases' : StateDataSet["Virginia"][3],
'DC VACases': StateDataSet["District of Columbia"][2],
'DC NewVACases' : StateDataSet["District of Columbia"][3],
'MO VACases': StateDataSet["Missouri"][2],
'MO NewVACases' : StateDataSet["Missouri"][3],
#Anchorage (AN)
'AN ECases': DataSet["Anchorage VA Medical Center"][0],
'AN NewECases': DataSet["Anchorage VA Medical Center"][1],
#Portland (PO)
'PO ECases': DataSet["Portland VA Medical Center"][0],
'PO NewECases': DataSet["Portland VA Medical Center"][1],
#WCPAC (WC)
'WC ECases': DataSet["North Las Vegas VA Medical Center"][0],
'WC NewECases': DataSet["North Las Vegas VA Medical Center"][1],
#Walla Walla (WW)
'WW ECases': DataSet["<NAME> Memorial VA Medical Center"][0],
'WW NewECases': DataSet["<NAME> Memorial VA Medical Center"][1],
#White City (WH)
'WH ECases': DataSet["White City VA Medical Center"][0],
'WH NewECases': DataSet["White City VA Medical Center"][1],
#Roseburg (RO)
'RO ECases': DataSet["Roseburg VA Medical Center"][0],
'RO NewECases': DataSet["Roseburg VA Medical Center"][1],
#Puget Sound (PS)
'PS ECases': DataSet["Seattle VA Medical Center"][0],
'PS NewECases': DataSet["Seattle VA Medical Center"][1],
#Mann-Grandstaff (MG)
'MG ECases': DataSet["Mann-Grandstaff Department of Veterans Affairs Medical Center"][0],
'MG NewECases': DataSet["Mann-Grandstaff Department of Veterans Affairs Medical Center"][1],
#Boise (BO)
'BO ECases': DataSet["Boise VA Medical Center"][0],
'BO NewECases': DataSet["Boise VA Medical Center"][1],
#Jesse Brown (JE)
'JE ECases': DataSet["Jesse Brown Department of Veterans Affairs Medical Center"][0],
'JE NewECases': DataSet["Jesse Brown Department of Veterans Affairs Medical Center"][1],
#William S. Middleton Memorial (WM)
'WM ECases': DataSet['William S. Middleton Memorial Veterans\' Hospital'][0],
'WM NewECases': DataSet['William S. Middleton Memorial Veterans\' Hospital'][1],
#<NAME> (CZ)
'CZ ECases': DataSet['Clement J. Zablocki Veterans\' Administration Medical Center'][0],
'CZ NewECases': DataSet['Clement J. Zablocki Veterans\' Administration Medical Center'][1],
#<NAME> (OJ)
'OJ ECases': DataSet["<NAME> Department of Veterans Affairs Medical Facility"][0],
'OJ NewECases': DataSet["<NAME> Department of Veterans Affairs Medical Facility"][1],
#Ann Arbor (AA)
'AA ECases': DataSet["L<NAME> VA Medical Center"][0],
'AA NewECases': DataSet["L<NAME> VA Medical Center"][1],
#Battle Creek (BC)
'BC ECases': DataSet["Battle Creek VA Medical Center"][0],
'BC NewECases': DataSet["Battle Creek VA Medical Center"][1],
#Detroit (DE)
'DE ECases': DataSet["<NAME> Department of Veterans Affairs Medical Center"][0],
'DE NewECases': DataSet["<NAME> Department of Veterans Affairs Medical Center"][1],
#Saginaw (SA)
'SA ECases' : DataSet["Aleda E. Lutz Department of Veterans Affairs Medical Center"][0],
'SA NewECases' : DataSet["Aleda E. Lutz Department of Veterans Affairs Medical Center"][1],
#Fort Wayne (FW)
'FW ECases' : DataSet["Fort Wayne VA Medical Center"][0],
'FW NewECases' : DataSet["Fort Wayne VA Medical Center"][1],
#Marion (MA)
'MA ECases' : DataSet["Marion VA Medical Center"][0],
'MA NewECases' : DataSet["Marion VA Medical Center"][1],
#Indianapolis (IN)
'IN ECases' : DataSet["Richard L. Roudebush Veterans\' Administration Medical Center"][0],
'IN NewECases' : DataSet["Richard L. Roudebush Veterans\' Administration Medical Center"][1],
#Chillicothe (CH)
'CH ECases' : DataSet["Chillicothe VA Medical Center"][0],
'CH NewECases' : DataSet["Chillicothe VA Medical Center"][1],
#Cincinnati (CN)
'CN ECases' : DataSet["Cincinnati VA Medical Center"][0],
'CN NewECases' : DataSet["Cincinnati VA Medical Center"][1],
#Cleveland (CL)
'CL ECases' : DataSet["Louis Stokes Cleveland Department of Veterans Affairs Medical Center"][0],
'CL NewECases' : DataSet["Louis Stokes Cleveland Department of Veterans Affairs Medical Center"][1],
#Dayton (DA)
'DA ECases' : DataSet["Dayton VA Medical Center"][0],
'DA NewECases' : DataSet["Dayton VA Medical Center"][1],
#Danville (DN)
'DN ECases' : DataSet["Danville VA Medical Center"][0],
'DN NewECases' : DataSet["Danville VA Medical Center"][1],
#Hines (HN)
'HN ECases' : DataSet["Edward Hines Junior Hospital"][0],
'HN NewECases' : DataSet["Edward Hines Junior Hospital"][1],
#North Chicago (NC)
'NC ECases' : DataSet["Captain James A. Lovell Federal Health Care Center"][0],
'NC NewECases' : DataSet["Captain James A. Lovell Federal Health Care Center"][1],
#Tomah (TO)
'TO ECases' : DataSet["Tomah VA Medical Center"][0],
'TO NewECases' : DataSet["Tomah VA Medical Center"][1],
#Columbus (CO) (Hard-Coded)
'CO ECases' : DataSet["Columbus VA Medical Center"][0],
'CO NewECases' : DataSet["Columbus VA Medical Center"][1]}, index=[0])
CCTVAChart = pd.concat([CCTVAChart_newrow, CCTVAChart]).reset_index(drop=True).drop_duplicates(subset='DATE',keep='first').round(2)
CCTVAChart = CCTVAChart.set_index('DATE').T.reset_index()
CCTVAChart.to_csv('CCTVAChart2.csv',index=False) | 4fc6415464071e14bf1fa65a28d4c5172bd6a653 | [
"Python"
] | 1 | Python | BAHSharma/VACovid | 31f7d4e26de5d75a1bef0668b6808a840f17d534 | afa544cb00d0b284a5f8ef23b6933185ec987695 |
refs/heads/master | <file_sep>from module import *
while True :
print('Menu', '---------', '1: add', "2: sub", '3: multiply', '4: divide','5: stop', sep='\n')
x = int(input(':'))
if x == 1:
a = int(input('num1 :'))
b = int(input('num2 :'))
print(add(a, b))
elif x == 2:
a = int(input('num1 :'))
b = int(input('num2 :'))
print(sub(a, b))
elif x == 3:
a = int(input('num1 :'))
b = int(input('num2 :'))
print(mul(a, b))
elif x == 4:
a = int(input('num1 :'))
b = int(input('num2 :'))
if b == 0:
print('님 초등학교 안나오심..? 다시 하세요')
else:
print(div(a, b))
elif x == 5:
print('Have a good day!')
break
else :
print('눈을 크게 뜨고 보이는 숫자중에 선택하세요')
<file_sep>from django.apps import AppConfig
class BlogHwConfig(AppConfig):
name = 'blog_hw'
<file_sep># Generated by Django 2.2 on 2019-04-10 16:07
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('blog_hw', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='created_date',
),
migrations.AddField(
model_name='post',
name='grade',
field=models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5')], default='3', max_length=5),
),
migrations.AddField(
model_name='post',
name='price',
field=models.CharField(default=django.utils.timezone.now, max_length=20),
preserve_default=False,
),
]
<file_sep># # 1-1
# x = 0
# y = 0
# while x < 1000:
# if x % 3 == 0:
# y += x
# x += 1
# print(y)
# 1-2
# x = 10
# while x > 0:
# print('*'*x)
# x += -1
# 1-3
# A = [20, 55, 67, 82, 45, 33, 90, 87, 100, 25]
# A.sort()
# A.reverse()
# x = 0
# i = 0
# while A[i] >= 50 :
# x += A[i]
# i += 1
# print(x)
# 2-1
# for i in range(1,101):
# print(i)
# 2-2
# A = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100]
# x = 0
# for i in A:
# x += i
# print(x/len(A))
# 2-3
# number = [1, 2, 3, 4, 5]
# result = [n*2 for n in number if n%2 == 1]
# print(result)
# 연습문제(리스트 내장함수)
# A = ['Life', 'is', 'too', 'short']
# s = ' '
# print(s.join(A))
# 연습문제(if)
# a = 'Life is too short, you need python'
# if 'wife' in a:
# print('wife')
# elif 'python' in a and 'you' not in a:
# print('python')
# elif 'shirt' not in a:
# print('shirt')
# elif 'need' in a:
# print('need')
# else:
# print('none')
# 결과로 'shirt' 나오게 된다.
# 연습문제(while)
# x=1
# while x < 5:
# print(x * '*')
# x += 1
# 연습문제(모음 찾기)
# A = 'mutzangesazachurum'
# x = 0
# for i in A:
# if i in 'aeiou':
# x += 1
# else:
# continue
# print(x)<file_sep>from django.db import models
from django.utils import timezone
# Create your models here.
class Post(models.Model):
title = models.CharField(max_length=200)
contents = models.TextField()
price = models.CharField(max_length = 20)
book_grade_choices = (
('1', '★'),
('2', '★★'),
('3', '★★★'),
('4', '★★★★'),
('5', '★★★★★')
)
grade = models.CharField(max_length = 5, choices = book_grade_choices, default = '3')
def __str__(self):
return self.title<file_sep># Generated by Django 2.2 on 2019-05-01 17:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog_hw', '0002_auto_20190411_0107'),
]
operations = [
migrations.AlterField(
model_name='post',
name='grade',
field=models.CharField(choices=[('1', '★'), ('2', '★★'), ('3', '★★★'), ('4', '★★★★'), ('5', '★★★★★')], default='3', max_length=5),
),
migrations.CreateModel(
name='Comment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.TextField()),
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='blog_hw.Post')),
],
),
]
| d89852c2779b77e0feb26756f308d8fe50226b12 | [
"Python"
] | 6 | Python | 10kdkd/first_repo | 5ccfd668ec4a06945b65687229acc753b0043369 | f880f04446ca3e4ae230840f6e6a6479042e5e25 |
refs/heads/master | <file_sep>// Create a weapon class
// Fetch data from http://rpg-api.com/weapons - there's conveniently 25 objects
// Make that data objects of the class
// Add objects to an array, and duplicate for filtering
// Show the filtered list
// new objects are pushed to both lists
// filtered list can reset to master
// Cards flip to show stats on the back
// Scales fine on mobile and desktop displays
// Referenced w3schools, MDN, Bootstrap 5 documentation, and the provided CodePens for the card flip
class Weapon {
constructor(attack, description, imageUrl, name, ranged, twoHanded) {
this.description = description;
this.imageUrl = imageUrl;
this.name = name;
this.ranged = ranged;
this.twoHanded = twoHanded;
this.attack = attack;
}
}
let weaponList = [];
let filtered = []
function makeWeapon(data) {
weaponList.push(new Weapon(data.attack, data.description, data.imageUrl, data.name, data.ranged, data.twoHanded));
}
fetch('http://rpg-api.com/weapons').then(response => response.json()).then(data => data.forEach(item => makeWeapon(item))).then(showAll);
function createCard(item) {
let col = document.createElement('div');
col.className = 'col flip-card';
col.onclick = function () {
flipCard(this)
};
let card_inner = document.createElement('div');
card_inner.className = 'flip-card-inner';
let card_front = document.createElement('div');
card_front.className = 'flip-card-front card h100';
let card_back = document.createElement('div');
card_back.className = 'flip-card-back card h100';
let image = document.createElement('img');
image.src = item.imageUrl;
image.className = 'card-img-top img-fluid';
image.alt = 'image of ' + item.name;
let front_body = document.createElement('div');
front_body.className = 'card-body';
let back_body = document.createElement('div');
back_body.className = 'card-body align-middle';
let title = document.createElement('h5');
title.className = 'card-title';
title.innerText = item.name;
let description = document.createElement('p');
description.className = 'card-text';
description.innerText = item.description;
let ranged = document.createElement('p');
ranged.className = 'card-text';
let twoHanded = document.createElement('p');
twoHanded.className = 'card-text';
let attack = document.createElement('p');
attack.className = 'card-text';
attack.innerText = 'Attack: ' + item.attack;
if (item.ranged) {
ranged.innerText = 'Ranged';
} else {
ranged.innerText = 'Melee';
}
if (item.twoHanded) {
ranged.innerText = 'Two Handed';
} else {
ranged.innerText = 'Single Hand';
}
let main_doc = document.querySelector('#weapons');
front_body.append(title);
back_body.append(description, ranged, twoHanded, attack);
card_front.append(image);
card_front.append(front_body);
card_back.append(back_body);
card_inner.append(card_front, card_back);
col.append(card_inner)
main_doc.append(col);
}
function addWeapon(event) {
event.preventDefault()
console.log('running')
let name = document.getElementsByName('name')[0].value;
let description = document.getElementsByName('description')[0].value;
let imageUrl = document.getElementsByName('imageUrl')[0].value;
let attack = document.getElementsByName('attack')[0].value;
let ranged = document.getElementsByName('ranged')[0].value;
let twoHanded = document.getElementsByName('twoHanded')[0].value;
let weapon = new Weapon(attack, description, imageUrl, name, ranged, twoHanded);
createCard(weapon);
weaponList.push(weapon);
filtered.push(weapon)
document.querySelectorAll('input').forEach(item => (item.value = ''));
}
document.addEventListener('submit', addWeapon)
function flipCard(card) {
card.classList.toggle('is-flipped');
}
function sortAttack() {
filtered.sort(function (a, b) {
return a.attack - b.attack;
}
)
showFiltered()
}
function sortName() {
filtered.sort(function (a, b) {
let x = a.name.toLowerCase();
let y = b.name.toLowerCase();
if (x < y) {
return -1;
}
if (x > y) {
return 1;
}
return 0;
}
)
showFiltered()
}
function filterMelee() {
filtered = filtered.filter(weapon => weapon.ranged === false);
showFiltered()
}
function filterRanged() {
filtered = filtered.filter(weapon => weapon.ranged === true);
showFiltered()
}
function filterOne() {
filtered = filtered.filter(weapon => weapon.twoHanded === false);
showFiltered()
}
function filterTwo() {
filtered = filtered.filter(weapon => weapon.twoHanded === true);
showFiltered()
}
function showFiltered() {
let list = document.getElementById('weapons');
while (list.firstChild) {
list.removeChild(list.firstChild);
}
filtered.forEach((value) => createCard(value));
}
// Could add additional logic to this, maybe a switch, so that the lists didn't have to reset each time. Not going to.
function showAll() {
filtered = weaponList;
showFiltered()
}
console.log('Running Scripts')
| 330b587b8e09420491bf82bc36e7ba78559bad88 | [
"JavaScript"
] | 1 | JavaScript | pteroborne/card_project | 40499defa2e6b4305c2aefc6418ee851ac62fb10 | 623b8be661e60faef7c1f19e79ae58460dfb3643 |
refs/heads/master | <file_sep>/**
Problem: Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.
IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots ("."), e.g.,172.16.254.1;
Besides, leading zeros in the IPv4 is invalid. For example, the address 172.16.254.01 is invalid.
IPv6 addresses are represented as eight groups of four hexadecimal digits, each group representing 16 bits. The groups are separated by colons (":"). For example, the address 2001:0db8:85a3:0000:0000:8a2e:0370:7334 is a valid one. Also, we could omit some leading zeros among four hexadecimal digits and some low-case characters in the address to upper-case ones, so 2001:db8:85a3:0:0:8A2E:0370:7334 is also a valid IPv6 address(Omit leading zeros and using upper cases).
However, we don't replace a consecutive group of zero value with a single empty group using two consecutive colons (::) to pursue simplicity. For example, 2001:0db8:85a3::8A2E:0370:7334 is an invalid IPv6 address.
Besides, extra leading zeros in the IPv6 is also invalid. For example, the address 02001:0db8:85a3:0000:0000:8a2e:0370:7334 is invalid.
Note: You may assume there is no extra space or special characters in the input string.
*/
class Solution {
public String validIPAddress(String IP) {
if (IP == null || IP.length() == 0) {
return "Neither";
}
if (IP.contains(".")) {
boolean valid = validateIPv4(IP);
if (valid) {
return "IPv4";
}
} else if (IP.contains(":")) {
boolean valid = validateIPv6(IP);
if (valid) {
return "IPv6";
}
}
return "Neither";
}
private boolean validateIPv4(String s) {
String[] tokens = s.split("[.]");
if (tokens.length != 4) {
return false;
}
if (s.charAt(0) == '.' || s.charAt(s.length() - 1) == '.') {
return false;
}
for (String token : tokens) {
if (!validateIpv4Helper(token)) {
return false;
}
}
return true;
}
private boolean validateIpv4Helper(String s) {
if (s == null || s.length() == 0 || s.length() > 3) {
return false;
}
if (s.length() > 1 && s.charAt(0) == '0') {
return false;
}
int num = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c < '0' || c > '9') {
return false;
}
int digit = (int)(c - '0');
num = num * 10 + digit;
}
if (num < 0 || num > 255) {
return false;
}
return true;
}
private boolean validateIPv6(String s) {
if (s.charAt(0) == ':' || s.charAt(s.length() - 1) == ':') {
return false;
}
String[] tokens = s.split("[:]");
if (tokens.length != 8) {
return false;
}
for (String token : tokens) {
if (!validateIpv6Helper(token)) {
return false;
}
}
return true;
}
private boolean validateIpv6Helper(String s) {
if (s == null || s.length() == 0 || s.length() > 4) {
return false;
}
s = s.toLowerCase();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (Character.isDigit(c)) {
if (c < '0' || c > '9') {
return false;
}
} else {
if (c < 'a' || c > 'f') {
return false;
}
}
}
return true;
}
}
<file_sep>/**
Problem: Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.
If there are multiple solutions, return any subset is fine.
*/
class Solution {
public List<Integer> largestDivisibleSubset(int[] nums) {
List<Integer> ans = new ArrayList<>();
if (nums == null || nums.length == 0) {
return ans;
}
Arrays.sort(nums);
int[] dp = new int[nums.length];
int max = 1;
for (int i = 0; i < nums.length; i++) {
dp[i] = 1;
for (int j = 0; j < i; j++) {
if (nums[i] % nums[j] == 0) {
dp[i] = Math.max(dp[i], dp[j] + 1);
max = Math.max(max, dp[i]);
}
}
}
// print the largest set
//
int i = nums.length - 1;
while (i >= 0 && dp[i] != max) {
i--;
}
ans.add(nums[i]);
i--;
max--;
while (i >= 0) {
if ((ans.get(ans.size() - 1) % nums[i]) == 0 && dp[i] == max) {
ans.add(nums[i]);
max--;
}
i--;
}
return ans;
}
}
<file_sep>/**
Problem - There are 2N people a company is planning to interview. The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the i-th person to city B is costs[i][1].
Return the minimum cost to fly every person to a city such that exactly N people arrive in each city.
*/
import java.util.*;
class Solution {
public int twoCitySchedCost(int[][] costs) {
int result = 0;
int n = costs.length;
Arrays.sort(costs, new Comparator<int[]>() {
@Override
public int compare(int[] a, int[] b) {
return a[0] - a[1] - (b[0] - b[1]);
}
});
for (int i = 0; i < n / 2; i++) {
result += costs[i][0];
}
for (int i = n / 2; i < n;i++) {
result += costs[i][1];
}
return result;
}
}<file_sep>/**
Problem: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.
*/
class Solution {
public int findDuplicate(int[] nums) {
boolean arr[] = new boolean[nums.length];
for(int i=0;i<arr.length;i++){
arr[i] = false;
}
for(int i=0;i<nums.length;i++){
if(arr[nums[i]]){
return nums[i];
}
else
arr[nums[i]] = true;
}
return -1;
}
} | 1bc32779fbdd9c496962a6db8191bd20ac9e00d6 | [
"Java"
] | 4 | Java | itnug987/LeetCode-June-Challenge | a0b7a71afc82c9e87d0da7567d265dfec53e505c | 2737ba6d3cb08192bb486875813154b8b65c01b0 |
refs/heads/master | <repo_name>svick/XAML-conversion<file_sep>/XAML conversion/Parsers/XamlParser.cs
using System.Xml.Linq;
namespace XamlConversion.Parsers
{
abstract class XamlParser : ParserBase
{
protected XamlParser(XamlConvertor.State state)
: base(state)
{}
public void Parse(XElement element)
{
ParseName(element.Name);
foreach (var attribute in element.Attributes())
ParseAttribute(attribute);
foreach (var childElement in element.Elements())
ParseElement(childElement);
ParseEnd();
}
protected abstract void ParseName(XName name);
protected abstract void ParseAttribute(XAttribute attribute);
protected abstract void ParseElement(XElement element);
protected abstract void ParseEnd();
}
}<file_sep>/XAML conversion/XamlConvertor.cs
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Xml.Linq;
using Microsoft.CSharp;
using XamlConversion.Parsers;
namespace XamlConversion
{
public class XamlConvertor
{
internal class State
{
private readonly Dictionary<string, int> m_variables = new Dictionary<string, int>();
public CodeMemberMethod Method { get; set; }
public State()
{
Method = new CodeMemberMethod { Name = "Get" };
}
public void AddStatement(CodeStatement statement)
{
Method.Statements.Add(statement);
}
public void SetReturnType(Type returnType)
{
Method.ReturnType = new CodeTypeReference(returnType.Name);
}
public string GetVariableName(string originalName)
{
originalName = originalName.Substring(0, 1).ToLower() + originalName.Substring(1);
if (m_variables.ContainsKey(originalName))
{
var number = ++m_variables[originalName];
return originalName + number;
}
else
{
m_variables.Add(originalName, 1);
return originalName;
}
}
}
public string ConvertToString(string xamlCode)
{
var dom = ConvertToDom(xamlCode);
var compiler = new CSharpCodeProvider();
var stringWriter = new StringWriter();
compiler.GenerateCodeFromMember(dom, stringWriter, new CodeGeneratorOptions{BracingStyle = "C"});
return stringWriter.ToString();
}
public CodeMemberMethod ConvertToDom(string xamlCode)
{
var state = new State();
XElement root = XElement.Parse(xamlCode);
new RootObjectParser(state).Parse(root);
return state.Method;
}
}
}<file_sep>/XAML conversion/Parsers/PropertyObjectParser.cs
using System;
using System.CodeDom;
using System.Xml.Linq;
namespace XamlConversion.Parsers
{
class PropertyObjectParser : PropertyParser
{
private bool m_firstElement = true;
public PropertyObjectParser(XamlConvertor.State state, ObjectParser parent)
: base(state, parent)
{}
protected override void ParseName(XName name)
{
Name = name.LocalName.Split('.')[1];
Type = GetPropertyType(Name, Parent.Type);
}
protected override void ParseElement(XElement element)
{
if (!m_firstElement)
throw new InvalidOperationException();
var objectParser = new ObjectParser(State);
objectParser.Parse(element);
var left = new CodePropertyReferenceExpression(
new CodeVariableReferenceExpression(Parent.VariableName), Name);
var right = new CodeVariableReferenceExpression(objectParser.VariableName);
var assignment = new CodeAssignStatement(left, right);
State.AddStatement(assignment);
}
protected override void ParseEnd()
{}
}
}<file_sep>/XAML conversion/Parsers/PropertyCollectionParser.cs
using System.CodeDom;
using System.Xml.Linq;
namespace XamlConversion.Parsers
{
class PropertyCollectionParser : PropertyParser
{
public PropertyCollectionParser(XamlConvertor.State state, ObjectParser parent)
: base(state, parent)
{}
protected override void ParseName(XName name)
{
Name = name.LocalName.Split('.')[1];
Type = GetPropertyType(Name, Parent.Type);
}
protected override void ParseElement(XElement element)
{
var objectParser = new ObjectParser(State);
objectParser.Parse(element);
var addExpression =
new CodeMethodInvokeExpression(
new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(Parent.VariableName), Name),
"Add", new CodeVariableReferenceExpression(objectParser.VariableName));
State.AddStatement(new CodeExpressionStatement(addExpression));
}
protected override void ParseEnd()
{}
}
}<file_sep>/XAML conversion/Parsers/ObjectParser.cs
using System;
using System.Xml.Linq;
namespace XamlConversion.Parsers
{
class ObjectParser : XamlParser
{
public ObjectParser(XamlConvertor.State state)
: base(state)
{}
public string VariableName { get; protected set; }
public Type Type { get; protected set; }
protected override void ParseName(XName name)
{
Type = GetTypeFromXName(name);
VariableName = CreateObject(Type, name.LocalName);
}
protected override void ParseAttribute(XAttribute attribute)
{
if (attribute.IsNamespaceDeclaration)
return;
var propertyName = attribute.Name.LocalName;
SetProperty(VariableName, Type, propertyName, attribute.Value);
}
protected override void ParseElement(XElement element)
{
// is it a property?
if (element.Name.LocalName.Contains("."))
{
var propertyParser = new PropertyParser(State, this);
propertyParser.Parse(element);
}
else
{
throw new NotImplementedException();
}
}
protected override void ParseEnd()
{}
}
}<file_sep>/XAML conversion/Parsers/RootObjectParser.cs
using System.CodeDom;
namespace XamlConversion.Parsers
{
class RootObjectParser : ObjectParser
{
public RootObjectParser(XamlConvertor.State state)
: base(state)
{}
protected override void ParseEnd()
{
var returnStatement = new CodeMethodReturnStatement(new CodeVariableReferenceExpression(VariableName));
State.AddStatement(returnStatement);
State.SetReturnType(Type);
}
}
}<file_sep>/XAML conversion/Parsers/ParserBase.cs
using System;
using System.CodeDom;
using System.ComponentModel;
using System.Globalization;
using System.Windows.Data;
using System.Xaml.Schema;
using System.Xml.Linq;
namespace XamlConversion.Parsers
{
abstract class ParserBase
{
protected XamlConvertor.State State { get; set; }
protected ParserBase(XamlConvertor.State state)
{
State = state;
}
protected string CreateObject(Type type, string proposedName)
{
var variableName = State.GetVariableName(proposedName);
var variableDeclaration = new CodeVariableDeclarationStatement(
type.Name, variableName, new CodeObjectCreateExpression(type.Name));
State.AddStatement(variableDeclaration);
return variableName;
}
protected static Type GetTypeFromXName(XName xName)
{
string ns = xName.Namespace.NamespaceName;
if (string.IsNullOrEmpty(ns))
ns = "http://schemas.microsoft.com/netfx/2007/xaml/presentation";
var xamlSchemaContext = new XamlSchemaContextWithDefault();
return xamlSchemaContext.GetXamlType(new XamlTypeName(ns, xName.LocalName)).UnderlyingType;
}
protected static Type GetPropertyType(string name, Type type)
{
return type.GetProperty(name).PropertyType;
}
protected CodeExpression ConvertTo(string value, Type type)
{
var valueExpression = new CodePrimitiveExpression(value);
var converter = TypeDescriptor.GetConverter(type);
if (type == typeof(string) || type == typeof(object))
return valueExpression;
if (type == typeof(double))
return new CodePrimitiveExpression(double.Parse(value, CultureInfo.InvariantCulture));
if (type == typeof(BindingBase))
{
var bindingParser = new BindingParser(State);
var bindingVariableName = bindingParser.Parse(value);
return new CodeVariableReferenceExpression(bindingVariableName);
}
// there is no conversion availabe, the generated code won't compile, but there is nothing we can do about that
if (converter == null)
return valueExpression;
var conversion = new CodeCastExpression(
type.Name,
new CodeMethodInvokeExpression(
new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("TypeDescriptor"), "GetConverter",
new CodeTypeOfExpression(type.Name)), "ConvertFromInvariantString",
new CodePrimitiveExpression(value)));
return conversion;
}
protected void SetProperty(string variableName, Type variableType, string propertyName, string value)
{
var left = new CodePropertyReferenceExpression(
new CodeVariableReferenceExpression(variableName), propertyName);
var right = ConvertTo(value, GetPropertyType(propertyName, variableType));
var assignment = new CodeAssignStatement(left, right);
State.AddStatement(assignment);
}
}
}<file_sep>/XAML conversion/Parsers/PropertyParser.cs
using System;
using System.Collections;
using System.Xml.Linq;
namespace XamlConversion.Parsers
{
class PropertyParser : XamlParser
{
public string Name { get; protected set; }
public Type Type { get; protected set; }
protected ObjectParser Parent { get; private set; }
private PropertyParser m_child;
public PropertyParser(XamlConvertor.State state, ObjectParser parent)
: base(state)
{
Parent = parent;
}
protected override void ParseName(XName name)
{
Name = name.LocalName.Split('.')[1];
Type = GetPropertyType(Name, Parent.Type);
// is it a collection?
if (typeof(IEnumerable).IsAssignableFrom(Type) && Type != typeof(string))
m_child = new PropertyCollectionParser(State, Parent);
else
m_child = new PropertyObjectParser(State, Parent);
m_child.ParseName(name);
}
protected override void ParseAttribute(XAttribute attribute)
{
throw new InvalidOperationException();
}
protected override void ParseElement(XElement element)
{
m_child.ParseElement(element);
}
protected override void ParseEnd()
{
m_child.ParseEnd();
}
}
}<file_sep>/Demo app/Program.cs
using System;
using System.Windows.Controls;
using XamlConversion;
namespace Demo_app
{
class Program
{
static void Main()
{
string xaml = @"
<ListView Name=""listView"" Margin=""0,0,0,164"">
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn Header=""Devise"" DisplayMemberBinding=""{Binding Path=devise}"" Width=""80"" />
<GridViewColumn Header=""Libelle"" DisplayMemberBinding=""{Binding Path=label}"" Width=""120"" />
<GridViewColumn Header=""Unite"" DisplayMemberBinding=""{Binding Path=unite}"" Width=""80"" />
<GridViewColumn Header=""Achat"" DisplayMemberBinding=""{Binding Path=achatBanque}"" Width=""80"" />
<GridViewColumn Header=""Vente"" DisplayMemberBinding=""{Binding Path=venteBanque}"" Width=""80"" />
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>";
Console.WriteLine(new XamlConvertor().ConvertToString(xaml));
xaml = @"<ListView xmlns:local=""clr-namespace:Demo_app""><ListView.View><local:CustomView /></ListView.View></ListView>";
Console.WriteLine(new XamlConvertor().ConvertToString(xaml));
}
}
class CustomView : ViewBase
{}
}<file_sep>/XAML conversion/Parsers/BindingParser.cs
using System;
using System.Text.RegularExpressions;
namespace XamlConversion.Parsers
{
class BindingParser : ParserBase
{
public BindingParser(XamlConvertor.State state)
: base(state)
{}
static readonly Regex BindingRegex = new Regex(@"\{([\w]+)(\s+\w+=\w+)*\}");
static readonly Regex BindingPropertyRegex = new Regex(@"(\w+)=(\w+)");
public string Parse(string text)
{
var match = BindingRegex.Match(text);
if (!match.Success)
throw new InvalidOperationException();
var type = GetTypeFromXName(match.Groups[1].Value);
string variableName = CreateObject(type, type.Name);
foreach (Capture capture in match.Groups[2].Captures)
{
var propertyMatch = BindingPropertyRegex.Match(capture.Value);
if (!propertyMatch.Success)
throw new InvalidOperationException();
SetProperty(variableName, type, propertyMatch.Groups[1].Value, propertyMatch.Groups[2].Value);
}
return variableName;
}
}
}<file_sep>/XAML conversion/XamlSchemaContextWithDefault.cs
using System.Collections.Generic;
using System.Reflection;
using System.Xaml;
using System.Linq;
namespace XamlConversion
{
class XamlSchemaContextWithDefault : XamlSchemaContext
{
private readonly Assembly m_defaultAssembly;
public XamlSchemaContextWithDefault() : this(Assembly.GetEntryAssembly())
{}
public XamlSchemaContextWithDefault(Assembly defaultAssembly)
: base(GetReferenceAssemblies())
{
m_defaultAssembly = defaultAssembly;
}
static IEnumerable<Assembly> GetReferenceAssemblies()
{
return new[] { "WindowsBase", "PresentationCore", "PresentationFramework" }.Select(an => Assembly.LoadWithPartialName(an));
}
protected override Assembly OnAssemblyResolve(string assemblyName)
{
if (string.IsNullOrEmpty(assemblyName))
return m_defaultAssembly;
return base.OnAssemblyResolve(assemblyName);
}
}
} | 6cad43d055405337772bcff9613ebc2a8b9b69cc | [
"C#"
] | 11 | C# | svick/XAML-conversion | 17e66d0130931cdd4134f30787479de00869967c | 06741d723e4a6d748e05ebd30c009151b7cd1224 |
refs/heads/master | <file_sep>class TagPicture < ApplicationRecord
belongs_to :picture
belongs_to :tag
def self.findByPictures(args)
TagPicture.where('picture_id LIKE :query', query: args)
end
def self.findByTags(args)
TagPicture.where('tag_id LIKE :query', query: args)
end
end
<file_sep>class Picture < ApplicationRecord
mount_uploader :image, ImageUploader
belongs_to :category
belongs_to :user
has_many :favoris
has_many :tag_pictures
has_many :tags, through: :tag_pictures
validates_presence_of :image
def self.search(args)
if args[:keywords]
if args[:keywords].first == '#'
Picture.joins(:tags).where('tags.name LIKE :query', query: "%#{args[:keywords].gsub(/#/, '')}%")
else
Picture.joins(:user).where('users.first_name LIKE :query', query: "%#{args[:keywords]}%")
end
elsif args[:category_id]
Picture.where(['category_id = ?', args[:category_id]])
elsif args[:tag_id]
Picture.joins(:tag_pictures).where(['tag_pictures.tag_id = ?', args[:tag_id]])
elsif args[:slug]
Picture.where(['user_id = ?', args[:slug].to_i])
else
Picture.all
end
end
end
<file_sep>class ChangeId < ActiveRecord::Migration[5.1]
def change
remove_column :favoris, :id_user
remove_column :favoris, :id_picture
remove_column :pictures, :id_user
remove_column :pictures, :id_category
remove_column :tag_pictures, :id_tag
remove_column :tag_pictures, :id_picture
add_column :favoris, :user_id, :integer
add_column :favoris, :picture_id, :integer
add_column :pictures, :user_id, :integer
add_column :pictures, :category_id, :integer
add_column :tag_pictures, :tag_id, :integer
add_column :tag_pictures, :picture_id, :integer
end
end
<file_sep>class Tag < ApplicationRecord
validates_presence_of :name
has_many :tag_pictures
has_many :pictures, through: :tag_pictures
end
<file_sep>class CreatePictures < ActiveRecord::Migration[5.1]
def change
create_table :pictures do |t|
t.timestamps
t.integer :id_user
t.integer :id_category
end
create_table :favoris do |t|
t.timestamps
t.integer :id_user
t.integer :id_picture
end
create_table :tag_pictures do |t|
t.timestamps
t.integer :id_picture
t.integer :id_tag
end
end
end
<file_sep>require 'test_helper'
class PictureTest < ActiveSupport::TestCase
test "the truth" do
assert true
# listings = Listing.search(keywords: 'iphone')
#
# assert_equal 1, listings.length
# assert_equal 'iphone title', listings.first.title
end
end
<file_sep>Rails.application.routes.draw do
devise_for :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'pictures#index'
resources :pictures
get 'categories/:category_id', to: 'pictures#index', as: 'category'
get 'tags/:tag_id', to: 'pictures#index', as: 'tag'
get 'users/:slug', to: 'pictures#index', as: 'user'
resources :favoris
get '/upload', to: 'pictures#new', as: 'upload'
#get '/users/:slug', to: 'users#show', as: 'users'
#get '/users/', to: 'users#index', as: 'user'
end
<file_sep>window.last = null;
$(document).on('turbolinks:load', function() {
$("body").on('click'," [data-do='like']",function (e) {
e.preventDefault();
var that = this;
console.log($(that).data);
$.ajax({
type:'POST',
url:'/favoris',
data: {
picture_id: $(that).data('picture')
},
success:function(data){
location.reload();
}
});
});
$("body").on('click'," [data-do='unlike']",function (e) {
e.preventDefault();
var that = this;
console.log($(that).data);
$.ajax({
type:'DELETE',
url:'/favoris/' + $(that).data('id'),
success:function(data){
location.reload();
}
});
});
})
<file_sep>class Category < ApplicationRecord
has_many :pictures
validates_presence_of :name
end
<file_sep>class FavorisController < ApplicationController
def index
end
def create
@favori = Favori.create!(favoris_params)
end
def destroy
@favori = Favori.delete(params[:id])
end
private
def favoris_params
params.permit(:picture_id).merge(user_id: current_user.id)
end
end
<file_sep>class PicturesController < ApplicationController
def index
@pictures = Picture.search(params)
end
def new
@picture = Picture.new
end
def create
@picture = Picture.new(picture_params)
if @picture.save
redirect_to '/'
else
redirect_to upload_path
end
end
private
def picture_params
params.required(:picture).permit(:category_id, :image, tag_ids: [] ).merge(user_id: current_user.id)
end
end
| 36927f054befc36cbbc0fd177a9d1e617f6b4bb8 | [
"JavaScript",
"Ruby"
] | 11 | Ruby | PierrePlessy/ynsta | 854ed820130dc77d78be1bcc1378881f5ed13740 | e3a06ad3e7ea3827b1af13f20f618d0ce872b142 |
refs/heads/master | <repo_name>Vadrey/PAI_lab<file_sep>/View/lab01.php
<!DOCTYPE html>
<html>
<body>
<?php
echo "
Małpy!
";
$zmienna="Definicja-";
echo
"<h2>Przykładowa \n $zmienna...</h2>";
echo
"$zmienna\n", "Ssaki o czterech chwytnych kończynach\n.";
print
"Zwykle większe od małpiatek\n.";
echo
"Obejmuje małpy szerokonose i małpy wąskonose\n.";
class Student {
var $surname;
var $name;
function
__construct($surname, $name){
$this->surname = $nazwisko;
$this->name = $name;
}
function setSurname($surname){$this->surname= $surname;}
function getName(){return $this->name;}
}
$s =
"To JEST \"przykładowy\" <b>ciąg 'tekstowy'</b>";
echo "<br>\n 1 ". $s ;
echo "<br>\n 2 ". addslashes($s);
echo "<br>\n 3 ". crc32($s) ;
echo "<br>\n 4 ". explode(" ", $s) ;
echo "<br>\n 5 ". htmlspecialchars($s) ;
echo "<br>\n 6 ". htmlspecialchars_decode (htmlspecialchars($s)) ;
echo "<br>\n 7 ". implode (" ", explode(" ", $s)) ;
echo "<br>\n 8 ". md5($s) ;
echo "<br>\n 9 ". sha1($s) ;
echo "<br>\n";
?>
</body>
</html>
| c0072b763ff4d0e90fe297e46f334ad77bf25afb | [
"PHP"
] | 1 | PHP | Vadrey/PAI_lab | 5c2435fa77caa6e5d86da7147b3b4accac3553ac | 0bdb2b98c260744d51b6e3f5b078312b9811407a |
refs/heads/master | <repo_name>Boochoo/finland-conora-stats<file_sep>/src/component/templates/Charts/CommonPieChart/index.js
import CommonPieChart from './CommonPieChart';
export default CommonPieChart;
<file_sep>/src/pages/world.js
import fetch from 'isomorphic-fetch';
import dynamic from 'next/dynamic';
import Link from 'next/link';
import getConfig from 'next/config';
import { Component, useState } from 'react';
import paths from '../utils/path';
import {
getConfirmedByCountry,
digitSeparator,
mapDataForCharts,
} from '../utils/utils';
import Header from '../component/organisms/Header/Header';
import HeroContainer from '../component/organisms/HeroContainer/';
import {
ContentContainer,
ContentWrapper,
MenuBar,
} from '../component/organisms/HeroContainer/HeroContainer.style';
import Footer from '../component/organisms/Footer/Footer';
import Layout from '../component/organisms/Layout/Layout';
import { TableWrapper } from '../component/organisms/TableLayout/TableLayout';
import LogarithmicLinearConmponent from '../component/organisms/UI/LogarithmicLinearComponent/';
import {
Section,
InputWrapper,
} from '../component/organisms/UI/SectionWrapper/Section.style';
import ComposedBarLineChart from '../component/templates/Charts/ComposedBarLineChart';
import CommonLineChart from '../component/templates/Charts/CommonLineChart';
import CountriesListComponent from '../component/templates/WorldPage/CountriesListComponent';
import CountriesTableComponent from '../component/templates/WorldPage/CountriesTableComponent';
const WorldMap = dynamic(
() => import('../component/templates/WorldMap/WorldMap'),
{
ssr: false,
}
);
const World = (props) => {
const { data, confirmedData, dailyData } = props;
const { confirmed, deaths, recovered, lastUpdate } = data;
const confirmedResponses = getConfirmedByCountry(confirmedData);
const uniqueConfirmed = [...new Set(confirmedResponses)];
const sortedConfrimed = uniqueConfirmed.sort(
(a, b) => b.confirmed - a.confirmed
);
const [searchTerm, setSearchTerm] = useState('');
const [active, setActive] = useState({ isByConfirmed: true });
const [sortedList, setSorted] = useState(sortedConfrimed);
const [isLinear, setLinear] = useState(false);
const [activeButton, setActiveButton] = useState('logarithmic');
const worldDailyData = mapDataForCharts(dailyData);
const source = `//github.com/mathdroid/covid-19-api`;
const lastUpdatedAt = new Date(lastUpdate).toGMTString();
const setSelectedFilter = (filterProp) => {
const sorted = [...sortedList].sort(
(a, b) => b[filterProp] - a[filterProp]
);
setSorted(sorted);
};
const sortByConfirmed = () => {
setSelectedFilter('confirmed');
setActive({ isByConfirmed: true });
};
const sortByRecovered = () => {
setSelectedFilter('recovered');
setActive({ isByRecovered: true });
};
const sortByDeaths = () => {
setSelectedFilter('deaths');
setActive({ isByDeaths: true });
};
const handlesearch = (event) => {
setSearchTerm(event.target.value);
};
const searchResults = !searchTerm
? sortedList
: sortedList.filter((cases) =>
cases.countryRegion.toLowerCase().includes(searchTerm.toLowerCase())
);
const HeroBanner = () => (
<HeroContainer
title='World'
confirmed={confirmed.value}
recovered={recovered.value}
deaths={deaths.value}
/>
);
return (
<Layout
title={`World's coronavirus stats`}
desc='Coronavirus stats confirmed updates by country, recovered, deaths'
keywords='world coronavirus, coronavirus update, coronavirus, coronavirus stats, coronavirus numbers, maailma koronavirus, koronavirus'
>
<MenuBar>
<Header path={paths.home} page='Finland' />
</MenuBar>
<ContentWrapper>
<ContentContainer>
<div className='hero-mobile'>
<HeroBanner />
</div>
</ContentContainer>
</ContentWrapper>
<WorldMap data={uniqueConfirmed} initialZoomLevel={2.5} />
<ContentWrapper>
<ContentContainer>
<div className='hero-desktop'>
<HeroBanner />
</div>
<LogarithmicLinearConmponent
isActive={activeButton}
linearLogHandler={(event) => {
setActiveButton(event.target.id);
setLinear(isLinear);
}}
buttons={['Linear', 'Logarithmic']}
/>
<CommonLineChart
data={worldDailyData}
isLinear={activeButton.toLowerCase() === 'linear' ? true : false}
xAxisName='reportDate'
dataKey='totalConfirmed'
dataKey1='incidentRate'
/>
<ComposedBarLineChart
data={worldDailyData}
dataKey='reportDate'
totalCases='totalConfirmed'
casesData={[
{ title: 'Daily confirmed', amount: 'deltaConfirmed' },
{ title: 'Deaths', amount: 'totalDeaths' },
]}
/>
<Section>
<InputWrapper>
<label htmlFor='search-input'>Search by country name</label>
<input
id='search-input'
type='text'
onChange={handlesearch}
value={searchTerm}
/>
</InputWrapper>
<p>
Currently sorted by:{' '}
<strong>{`${
active.isByConfirmed
? 'confirmed'
: active.isByRecovered
? 'recovered'
: 'death'
} cases`}</strong>
</p>
<TableWrapper tableSize={4}>
<CountriesTableComponent
tableList={[
{
name: 'Confirmed',
state: active.isByConfirmed,
clickHandler: sortByConfirmed,
},
{
name: 'Recovered',
state: active.isByRecovered,
clickHandler: sortByRecovered,
},
{
name: 'Deaths',
state: active.isByDeaths,
clickHandler: sortByDeaths,
},
]}
/>
<CountriesListComponent searchResults={searchResults} />
</TableWrapper>
</Section>
<Footer
footerElements={[
{
description: `The number of reported cases for some countries might be
different from the local reports. The API used in this page
obtains data from the Center for Systems Science and Engineering
(CSSE) at Johns Hopkins University (JHU).`,
author: 'Mathdroid',
source: source,
lastUpdate: lastUpdatedAt,
},
]}
/>
</ContentContainer>
</ContentWrapper>
</Layout>
);
};
World.getInitialProps = async () => {
const { COVID19_API, COVID19_DAILY_API } = getConfig().publicRuntimeConfig;
const response = await fetch(COVID19_API);
const data = await response.json();
const fetchDets = await fetch(data.confirmed.detail);
const confirmedData = await fetchDets.json();
const dailyResponse = await fetch(COVID19_DAILY_API);
const dailyData = await dailyResponse.json();
return { data, confirmedData, dailyData };
};
export default World;
<file_sep>/src/component/organisms/Header/Header.js
import PropTypes from 'prop-types';
import Link from 'next/link';
const Header = (props) => {
return (
<Link href={props.path}>
<a>{`Click to see ${props.page}'s stats`}</a>
</Link>
);
};
Header.propTypes = {
path: PropTypes.string.isRequired,
page: PropTypes.string.isRequired,
};
export default Header;
<file_sep>/src/component/templates/Charts/ComposedBarLineChart/ComposedBarLineChart.js
import PropTypes from 'prop-types';
import {
ResponsiveContainer,
ComposedChart,
BarChart,
Bar,
Line,
CartesianGrid,
XAxis,
YAxis,
Legend,
} from 'recharts';
import { themeColors } from '../../../organisms/Layout/Layout.style';
import CustomisedToolPit from '../Customized/CustomisedToolpit';
const getColors = (index) => {
const colors = [
'#400082',
'#c02739',
'#29c7ac',
'#84142d',
'#54123b',
'#ffa41b',
];
return colors[index];
};
const CustomMixedBar = (name, dataKey, index) => (
<Bar
type='monotone'
name={name}
dataKey={dataKey}
barSize={30}
fill={getColors(index)}
stackId='a'
key={index}
/>
);
const ComposedBarLineChart = (props) => (
<ResponsiveContainer width='100%' height={500}>
<ComposedChart
data={props.data}
margin={{ top: 25, right: 0, left: 20, bottom: 20 }}
>
<XAxis dataKey={props.dataKey} />
<YAxis />
{CustomisedToolPit()}
<Legend />
<CartesianGrid stroke='#f5f5f5' strokeDasharray='3' />
<Line
type='monotone'
name='Total cases'
dataKey={props.totalCases}
dot={false}
stroke={themeColors.lightRed}
strokeWidth={2.5}
/>
{props.casesData &&
props.casesData.map((cases, index) =>
CustomMixedBar(cases.title, cases.amount, index)
)}
</ComposedChart>
</ResponsiveContainer>
);
ComposedBarLineChart.propTypes = {
data: PropTypes.array.isRequired,
casesData: PropTypes.array.isRequired,
totalCases: PropTypes.string.isRequired,
dataKey: PropTypes.string.isRequired,
};
export default ComposedBarLineChart;
<file_sep>/src/component/organisms/HeroContainer/HeroContainer.style.js
import styled from 'styled-components';
import { themeColors } from '../Layout/Layout.style';
export const Container = styled.div`
.hero-wrapper {
display: flex;
flex-direction: column;
justify-content: center;
flex-wrap: wrap;
justify-content: space-between;
background: ${themeColors.creamWhite};
margin-bottom: 2rem;
text-align: center;
@media screen and (min-width: 540px) {
flex-direction: row;
}
div {
margin: 0.25rem;
color: ${themeColors.creamWhite};
flex: 1 0 30%;
font-size: 1.2rem;
strong {
font-size: 2rem;
}
p {
padding: 1rem;
margin: 0;
display: flex;
flex-direction: column-reverse;
}
}
}
h1 {
color: ${themeColors.black};
text-align: left;
}
.hero-wrapper div {
&:nth-of-type(1) {
background-color: ${themeColors.blue};
}
&:nth-of-type(2) {
background-color: ${themeColors.green};
}
&:nth-of-type(3) {
background-color: ${themeColors.red};
}
}
`;
export const ContentWrapper = styled.div`
@media screen and (min-width: 880px) {
position: fixed;
top: 0;
left: 0;
padding: 1rem;
width: 600px;
height: 100vh;
max-width: 90%;
background: ${themeColors.creamWhite};
overflow: hidden;
z-index: 99999;
.hero-mobile {
display: none;
}
}
@media screen and (max-width: 880px) {
margin: 1rem;
.hero-desktop {
display: none;
}
}
.chart-area {
min-width: 0;
overflow: hidden;
}
.chart-container {
display: grid;
grid-auto-flow: column;
min-width: 0;
max-width: 100%;
width: 100%;
height: 100%;
}
`;
export const ContentContainer = styled.div`
@media screen and (min-width: 880px) {
overflow-x: scroll;
max-height: 100%;
-ms-overflow-style: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
a {
color: ${themeColors.blue};
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
`;
export const MenuBar = styled.div`
padding: 1.5rem;
margin-bottom: 2.5rem;
background: ${themeColors.black};
@media screen and (min-width: 880px) {
position: fixed;
top: 0.15rem;
left: 603px;
width: 8rem;
text-align: center;
border-radius: 50%;
z-index: 9999;
}
a {
color: ${themeColors.creamWhite};
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
@media screen and (max-width: 880px) {
a {
font-size: 1.24rem;
}
}
`;
export const ButtonsWrapper = styled.div`
display: flex;
justify-content: center;
`;
export const Button = styled.button`
appearance: none;
width: 9rem;
padding: 0.5rem 1.2rem;
font-size: 1rem;
font-family: inherit;
background-color: ${themeColors.black};
color: ${themeColors.creamWhite};
text-decoration: none;
text-align: center;
cursor: pointer;
&:hover,
&:focus {
outline: 0;
text-decoration: underline;
}
&.is-active {
background-color: ${themeColors.blue};
}
`;
<file_sep>/README.md
# Finland Conoravirus case updates and stats
<file_sep>/src/component/templates/Charts/CommonLineChart/CommonLineChart.js
import PropTypes from 'prop-types';
import {
CartesianGrid,
XAxis,
YAxis,
ResponsiveContainer,
Area,
AreaChart,
Line,
ComposedChart,
} from 'recharts';
import { themeColors } from '../../../organisms/Layout/Layout.style';
import CustomisedToolPit from '../Customized/CustomisedToolpit';
const CommonLineChart = (props) => (
<ResponsiveContainer width='100%' height={500} className='chart-area'>
<ComposedChart
data={props.data}
margin={{ top: 25, right: 0, left: 20, bottom: 20 }}
>
<XAxis dataKey={props.xAxisName} />
{!props.isLinear ? (
<YAxis scale='log' domain={['dataMax', 'dataMax']} />
) : (
<YAxis />
)}
{CustomisedToolPit()}
<CartesianGrid stroke='#eee' strokeDasharray='5 5' />
<Area
type='monotone'
dataKey={props.dataKey}
stroke={themeColors.blue}
strokeWidth={3.5}
fillOpacity={0.25}
fill={themeColors.blue}
/>
{props.dataKey1 && (
<Area
type='monotone'
dataKey={props.dataKey1}
name='Incident rates'
stroke={themeColors.lightRed}
strokeWidth={3.5}
fillOpacity={0.25}
fill={themeColors.lightRed}
/>
)}
</ComposedChart>
</ResponsiveContainer>
);
CommonLineChart.propTypes = {
data: PropTypes.array.isRequired,
dataKey: PropTypes.string.isRequired,
xAxisName: PropTypes.string.isRequired,
isLinear: PropTypes.bool.isRequired,
dataKey1: PropTypes.string,
};
export default CommonLineChart;
<file_sep>/src/component/organisms/DropDownContainer/index.js
import DropDownContainer from './DropDownContainer';
import DropDownHero from './DropDownHero';
import DropDownHeader from './DropDownHeader';
module.exports = {
DropDownContainer,
DropDownHero,
DropDownHeader,
};
<file_sep>/src/component/templates/Charts/MapChart/mapUtils.js
const getConfirmedCases = (data) =>
data.map((d) => {
return {
district: d[0],
cases: d[1],
};
});
const parseMapDetails = (jsonData, callback) => {
return jsonData.map((data) => {
const lan = data[1].properties.latitude;
const lng = data[1].properties.longitude;
const gn_name =
data[1].properties.Maakunta === 'Uusimaa'
? 'HUS'
: data[1].properties.Maakunta;
const distName = callback(gn_name);
return {
lan,
lng,
gn_name,
cases: distName.length > 0 ? distName[0].cases : 0,
};
});
};
const getColors = (feature, data) => {
const allConfirmed = data.map((d) => {
return {
cases: d.cases,
gn_name: d.gn_name,
};
});
const districtCases = (value) =>
allConfirmed.filter((district) => {
const name = district.gn_name === 'HUS' ? 'Uusimaa' : district.gn_name;
return name === feature && district.cases > value;
})[0];
return districtCases(1000)
? '#800026'
: districtCases(500)
? '#BD0026'
: districtCases(200)
? '#E31A1C'
: districtCases(100)
? '#FC4E2A'
: districtCases(50)
? '#FD8D3C'
: districtCases(20)
? '#FEB24C'
: districtCases(10)
? '#FED976'
: '#FFEDA0';
};
const mapRadius = (rad) => {
if (rad > 80000) return 60;
else if (rad > 70000) return 55;
else if (rad > 60000) return 50;
else if (rad > 50000) return 40;
else if (rad > 40000) return 35;
else if (rad > 30000) return 32.5;
else if (rad > 20000) return 30;
else if (rad > 10000) return 27.5;
else if (rad > 9000) return 25;
else if (rad > 8000) return 22.5;
else if (rad > 5000) return 20;
else if (rad > 2500) return 17.5;
else if (rad > 1000) return 15;
else if (rad > 500) return 12.5;
else if (rad > 100) return 10;
else if (rad > 20) return 7.5;
else return 5;
};
module.exports = {
parseMapDetails,
getConfirmedCases,
getColors,
mapRadius,
};
<file_sep>/src/component/templates/Charts/utils.js
import { Tooltip } from 'recharts';
import { rgbaColors } from '../../organisms/Layout/Layout.style';
const getColors = (index) => {
const colors = [
'#000839',
'#005082',
'#00a8cc',
'#00bdaa',
'#400082',
'#29c7ac',
'#c02739',
'#84142d',
'#54123b',
'#ffa41b',
];
return colors[index];
};
const PieChartCustomColors = (index) => {
const colors = [rgbaColors.orange2, rgbaColors.orange3, rgbaColors.orange4];
return colors[index];
};
const mapHospitalArea = () => {
return {
HYKS: [
'Helsinki and Uusimaa',
'Etelä-Karjala',
'Kymenlaakso',
'Päijät-Häme',
],
KYS: [
'Pohjoinen-Savo',
'Etelä-Savo',
'Itä-Savo',
'Keski-Suomi',
'Pohjois-Karjala',
],
OYS: [
'Pohjois-Pohjanmaa',
'Kainuu',
'Keski-Pohjanmaa',
'Lapin',
'Länsi-Pohja',
],
TAYS: ['Pirkanmaa', 'Etelä-Pohjanmaa', 'Kanta-Häme'],
TYKS: ['Varsinais-Suomi', 'Satakunta', 'Vaasa'],
};
};
module.exports = {
getColors,
PieChartCustomColors,
mapHospitalArea,
};
<file_sep>/src/component/organisms/HomePage/CommonTable.js
import {
TableHeader,
TableWrapper,
TableLayoutContainer
} from '../TableLayout/TableLayout';
export const CommonTable = props => {
return (
<TableWrapper tableSize={props.headers.length}>
<TableHeader headTitle={props.headers} />
<ul>
{props.data.map((rec, index) => {
return (
props.districts[index] && (
<TableLayoutContainer
key={index}
tableRows={[
props.districts[index][0],
props.districts[index][1]
]}
/>
)
);
})}
</ul>
</TableWrapper>
);
};
<file_sep>/src/component/organisms/DropDownContainer/DropDownContainer.js
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { themeColors } from '../Layout/Layout.style';
const Wrapper = styled.div`
position: relative;
display: flex;
width: 13.5rem;
height: 2.75rem;
line-height: 3;
background: ${themeColors.gray};
overflow: hidden;
&:after {
content: '';
position: absolute;
top: 50%;
right: 1rem;
transform: translateY(-50%);
width: 0;
height: 0;
border-left: 0.7rem solid transparent;
border-right: 0.7rem solid transparent;
border-top: 0.7rem solid ${themeColors.creamWhite};
pointer-events: none;
cursor: pointer;
}
select {
appearance: none;
outline: 0;
box-shadow: none;
border: 0;
background: ${themeColors.black};
background-image: none;
flex: 1;
padding: 0 0.5rem;
cursor: pointer;
border-radius: 0;
font-size: 1.2rem;
color: ${themeColors.creamWhite};
}
`;
const DropDownContainer = ({ city, handleCityChange, citiesList }) => {
return (
<Wrapper>
<select
name='survey'
value={city}
id='survey'
onChange={handleCityChange}
>
{citiesList.map((cityName, index) => (
<option value={cityName} key={`city-${index}`}>
{cityName}
</option>
))}
</select>
</Wrapper>
);
};
DropDownContainer.propTypes = {
city: PropTypes.string.isRequired,
handleCityChange: PropTypes.func.isRequired,
citiesList: PropTypes.array.isRequired,
};
export default DropDownContainer;
<file_sep>/src/pages/index.js
import { Fragment, useState } from 'react';
import styled from 'styled-components';
import dynamic from 'next/dynamic';
import fetch from 'isomorphic-fetch';
import getConfig from 'next/config';
import CommonLineChart from '../component/templates/Charts/CommonLineChart';
import CommonBarChart from '../component/templates/Charts/CommonBarChart';
import CommonPieChart from '../component/templates/Charts/CommonPieChart';
import ComposedBarLineChart from '../component/templates/Charts/ComposedBarLineChart';
import SymptomsSurveyComponent from '../component/templates/SymptomsSurveyComponent';
import LogarithmicLinearConmponent from '../component/organisms/UI/LogarithmicLinearComponent/';
import {
ContentContainer,
ContentWrapper,
MenuBar,
ButtonsWrapper,
Button,
} from '../component/organisms/HeroContainer/HeroContainer.style';
import { Section } from '../component/organisms/Layout/Layout.style';
import HeroContainer from '../component/organisms/HeroContainer/';
import { themeColors } from '../component/organisms/Layout/Layout.style';
import {
getConfirmedByDistrict,
getConfirmedBySource,
getConfirmedByDate,
displayDate,
sortData,
dailyCasesTotal,
getChangesInTotalCases,
getHospitalArea,
digitSeparator,
} from '../utils/utils';
import paths from '../utils/path';
import Layout from '../component/organisms/Layout/Layout';
import Header from '../component/organisms/Header/Header';
import Footer from '../component/organisms/Footer/Footer';
import { CommonTable } from '../component/organisms/HomePage/CommonTable';
import { CommonBottomTable } from '../component/organisms/HomePage/BottomTables';
const MapChartWithNoSSR = dynamic(
() => import('../component/templates/Charts/MapChart/MapChart'),
{
ssr: false,
}
);
const MainWrapper = styled.div``;
const HeroTopWrapper = styled.div``;
const HeroBottomWrapper = styled.div``;
const Index = ({ data }) => {
const { confirmed, deaths, recovered } = data;
const confirmedByDistrict = getConfirmedByDistrict(confirmed);
const recoveredByDistrict = getConfirmedByDistrict(recovered);
const deathsByHospitalArea = getHospitalArea(deaths);
const confirmedBySource = getConfirmedBySource(confirmed);
const confirmedByDate = getConfirmedByDate(confirmed);
const sortedConfirmedByDistrict = sortData(confirmedByDistrict);
const sortedConfirmedBySource = sortData(confirmedBySource);
const totalDailyCases = dailyCasesTotal(Object.entries(confirmedByDate));
const recoveredData = dailyCasesTotal(
Object.entries(getConfirmedByDate(recovered))
);
const deathsData = dailyCasesTotal(
Object.entries(getConfirmedByDate(deaths))
);
const sortedConfirmed = Object.entries(confirmedByDate).sort(
(a, b) => new Date(a[0]) - new Date(b[0])
);
const localDataSource = `//github.com/HS-Datadesk/koronavirus-avoindata`;
const lastUpdatedAt = sortedConfirmed[sortedConfirmed.length - 1][0];
const mapDataForCharts = (data) =>
data.map((item) => {
return { name: item[0], cases: item[1] };
});
const mapSortedConfirmed = mapDataForCharts(
sortedConfirmedBySource.reverse()
);
const mapSortedConfirmedByDistrict = mapDataForCharts(
sortedConfirmedByDistrict.reverse()
);
const mappedIncremental = getChangesInTotalCases(
totalDailyCases,
recoveredData,
deathsData
);
const [isLinear, setLinear] = useState(false);
const [activeButton, setActiveButton] = useState('logarithmic');
const HeroBanner = () => (
<Fragment>
<Fragment>
<HeroContainer
title='Finland'
confirmed={confirmed.length}
recovered={recovered.length}
deaths={deaths.length}
/>
</Fragment>
<Fragment>
<h2>Total confirmed and daily cases</h2>
<ComposedBarLineChart
data={mappedIncremental}
dataKey='name'
totalCases='cases'
casesData={[
{ title: 'Daily cases', amount: 'daily' },
{ title: 'Recoveries', amount: 'recoveries' },
{ title: 'Deaths', amount: 'deaths' },
]}
/>
</Fragment>
</Fragment>
);
return (
<Layout
title={`Finland's coronavirus updates`}
desc='Coronavirus stats confirmed updates by city, recovered, deaths'
keywords='finland coronavirus, coronavirus update, coronavirus, coronavirus stats, coronavirus numbers, suomi koronavirus, koronavirus'
>
<MainWrapper>
<HeroTopWrapper>
<MenuBar>
<Header path={paths.world} page='world' />
</MenuBar>
<ContentWrapper>
<ContentContainer>
<div className='hero-mobile'>
<HeroBanner />
</div>
</ContentContainer>
</ContentWrapper>
</HeroTopWrapper>
<MapChartWithNoSSR data={sortedConfirmedByDistrict} />
<ContentWrapper>
<ContentContainer>
<div className='hero-desktop'>
<HeroBanner />
</div>
<Fragment>
<div>
<LogarithmicLinearConmponent
isActive={activeButton}
linearLogHandler={(event) => {
setActiveButton(event.target.id);
setLinear(isLinear);
}}
buttons={['Linear', 'Logarithmic']}
/>
<CommonLineChart
data={mappedIncremental}
isLinear={
activeButton.toLowerCase() === 'linear' ? true : false
}
xAxisName='name'
dataKey='cases'
/>
</div>
</Fragment>
<div>
<h2>Confirmed cases by health care district</h2>
<CommonBarChart
data={mapSortedConfirmedByDistrict}
marginBottom={100}
smallerFont
fillColor={themeColors.lightRed}
/>
</div>
<Fragment>
<SymptomsSurveyComponent />
</Fragment>
<HeroBottomWrapper>
<div>
<h2>Recovered</h2>
<CommonPieChart
data={mapDataForCharts(Object.entries(recoveredByDistrict))}
width='100%'
/>
<CommonTable
headers={['Health care district', 'Cases']}
data={recovered}
districts={Object.entries(recoveredByDistrict)}
/>
</div>
<div>
<h2>Deaths :(</h2>
<CommonPieChart
data={mapDataForCharts(Object.entries(deathsByHospitalArea))}
width='100%'
isDeathCasesChart
/>
<CommonTable
headers={['Health care area', 'Cases']}
data={deaths}
districts={Object.entries(deathsByHospitalArea)}
/>
</div>
</HeroBottomWrapper>
<div>
<h2>Confirmed daily total</h2>
<CommonBottomTable
headers={['Date', 'Cases']}
data={Object.entries(totalDailyCases)}
/>
</div>
<Footer
footerElements={[
{
description: `The Coronanavirus updates in this page are obtained from Helsinki Sanomat's API, which collects it from THL's published reports.`,
author: 'HS-Datadesk',
source: localDataSource,
lastUpdate: lastUpdatedAt,
},
{
description: `Symptomradar (Oiretutka) crowdsources coronavirus symptoms from news media audience`,
author: 'Futurice and Helsinki Sanomat',
source: `//github.com/futurice/symptomradar`,
lastUpdate: '',
},
{
description: `The website is done by`,
author: '<NAME>',
descSource: '//www.linkedin.com/in/ermi/',
},
]}
/>
</ContentContainer>
</ContentWrapper>
</MainWrapper>
</Layout>
);
};
export async function getStaticProps() {
try {
const { FINNISH_CORONA_DATA } = getConfig().publicRuntimeConfig;
const response = await fetch(FINNISH_CORONA_DATA);
const data = await response.json();
const hasError = response.status !== 200;
if (hasError) throw Error(data.message);
return { props: { data } };
} catch (error) {
if (error) {
console.error(error);
}
}
}
export default Index;
<file_sep>/src/component/templates/Charts/SymptomsSurveyPieChart/SymptomsSurveyPieChart.js
import PropTypes from 'prop-types';
import {
ResponsiveContainer,
PieChart,
Pie,
Cell,
Legend,
Tooltip,
} from 'recharts';
import { themeColors } from '../../../organisms/Layout/Layout.style';
import { PieChartCustomColors } from '../utils';
import CustomisedToolPit from '../Customized/CustomisedToolpit';
const payloadFormatter = (data) => {
if (data.payload.length === 0) return;
return data.payload.map((el, index) => {
const key = el.name.split('_');
const name = key[key.length - 1];
return (
<div
style={{
backgroundColor: themeColors.black,
color: themeColors.creamWhite,
marginBottom: '0.5rem',
padding: '1rem',
}}
key={`city-level-toolpit-${index}`}
>
<p
style={{
textTransform: 'capitalize',
margin: 0,
}}
>
{name} : <strong>{el.value}</strong>{' '}
</p>
</div>
);
});
};
const renderLegend = (value, entry) => {
const keyArr = value.split('_');
const name = keyArr[keyArr.length - 1];
return <span>{name}</span>;
};
const SymptomsSurveyPieChart = (props) => (
<ResponsiveContainer width={props.width} height={150}>
<PieChart>
<Pie data={props.data} dataKey='cases' paddingAngle={2} cursor='pointer'>
{props.data.map((entry, index) => {
return <Cell key={entry} fill={PieChartCustomColors(index)} />;
})}
</Pie>
{CustomisedToolPit(payloadFormatter)}
<Legend formatter={renderLegend} verticalAlign='bottom' align='center' />
</PieChart>
</ResponsiveContainer>
);
SymptomsSurveyPieChart.propTypes = {
width: PropTypes.string.isRequired,
data: PropTypes.array.isRequired,
};
export default SymptomsSurveyPieChart;
<file_sep>/src/component/organisms/HeroContainer/HeroContainer.js
import PropTypes from 'prop-types';
import { Container } from './HeroContainer.style';
const HeroContainer = (props) => {
return (
<>
<Container>
<h1>{props.title}'s Coronavirus (CoVID-19) updates</h1>
<div className='hero-wrapper'>
{props.casesList &&
props.casesList.map((cases, index) => (
<div key={`case-list-${index}`}>
<p>
{cases.title} <strong> {cases.amount}</strong>
</p>
</div>
))}
</div>
</Container>
</>
);
};
HeroContainer.propTypes = {
title: PropTypes.string.isRequired,
casesList: PropTypes.array.isRequired,
};
export default HeroContainer;
<file_sep>/src/component/templates/WorldMap/PopUp/PopUpComponent.js
import React from 'react';
import PropTypes from 'prop-types';
import { Popup } from 'react-leaflet';
import { themeColors } from '../../../organisms/Layout/Layout.style';
import PopUpText from './PopUpText';
const PopUpComponent = (props) => {
return (
<Popup minWidth={50} offset={[-1, -3]} className='custom-popup'>
<div
style={{
marginBottom: '0.25em',
}}
>
<PopUpText text={props.region} isTitle />
<PopUpText text={`${props.confirmed} confirmed`} />
<PopUpText
text={`${props.recovered} recovered`}
color={themeColors.green}
/>
<PopUpText text={`${props.deaths} deaths`} color={themeColors.red} />
</div>
</Popup>
);
};
PopUpComponent.propTypes = {
region: PropTypes.string.isRequired,
confirmed: PropTypes.number.isRequired,
recovered: PropTypes.number.isRequired,
deaths: PropTypes.number.isRequired,
};
export default PopUpComponent;
<file_sep>/server.js
const express = require('express');
const next = require('next');
const PORT = parseInt(process.env.PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();
app
.prepare()
.then(() => {
const server = express();
server.get('/', (req, res) => app.render(req, res, '/', req.query));
server.get('/world', (req, res) =>
app.render(req, res, '/world', req.query)
);
server.get('/country/:id', (req, res) => {
return app.render(
req,
res,
'/country',
Object.assign({ id: req.params.id }, req.query)
);
});
server.get('/country', (req, res) => {
if (req.params.id) return res.redirect(`/country?id=${req.query.id}`);
res.redirect(301, '/world');
});
server.get('*', (req, res) => handle(req, res));
server.listen(PORT, err => {
if (err) throw err;
console.log(dev);
console.log(`> ready on ${PORT}`);
});
})
.catch(execution => {
console.error(execution.stack);
process.exit(1);
});
<file_sep>/src/component/templates/SymptomsSurveyComponent/utils.js
const groups = [
'fever',
'cough',
'breathing_difficulties',
'muscle_pain',
'headache',
'sore_throat',
'rhinitis',
'stomach_issues',
'sensory_issues',
'longterm_medication',
'smoking',
'corona_suspicion',
];
const groupData = (items) => {
return [items].map((item, index) => {
return Object.keys(item).map((key) => {
return groups
.filter((group) => {
const excludeKeys = ['cough_fine', 'cough_impaired', 'cough_bad'];
return !excludeKeys.includes(key) && key.includes(group);
})
.map((currEl) => {
return {
group: currEl,
[key]: Number(item[key]),
};
});
});
});
};
const mergeObjectsByGroup = (array, property) => {
const newArray = new Map();
array.forEach((element) => {
const propertyValue = element[property];
newArray.has(propertyValue)
? newArray.set(propertyValue, {
...element,
...newArray.get(propertyValue),
})
: newArray.set(propertyValue, element);
});
return Array.from(newArray.values());
};
const mapDataForCharts = (data) =>
Object.values(data).map((item, i) => {
const keys = Object.keys(item)
.map((key, index) => {
if (key === 'group') return;
return {
name: key,
cases: Object.values(item)[index],
};
})
.filter((el) => el);
return keys;
});
const getAllCities = (items) =>
items.map((item) => {
return item.city;
});
module.exports = {
groups,
groupData,
mergeObjectsByGroup,
mapDataForCharts,
getAllCities,
};
<file_sep>/src/component/templates/Charts/CommonBarChart/index.js
import CommonBarChart from './CommonBarChart';
export default CommonBarChart;
<file_sep>/src/component/templates/WorldPage/CountriesTableComponent.js
import { useState } from 'react';
const CountriesTableComponent = (props) => {
return (
<li className='header'>
<div>
<strong>Country</strong>
</div>
{props.tableList.map((table, index) => {
return (
<div
role='button'
tabIndex='0'
className={`header__title ${table.state ? 'active' : ''}`}
onClick={table.clickHandler}
key={`table-${index}`}
id={`table-${index}`}
>
<strong>{table.name}</strong>
</div>
);
})}
</li>
);
};
export default CountriesTableComponent;
<file_sep>/src/component/templates/Charts/ComposedBarLineChart/index.js
import ComposedBarLineChart from './ComposedBarLineChart';
export default ComposedBarLineChart;
<file_sep>/src/pages/country.js
import { useRouter, withRouter } from 'next/router';
import fetch from 'isomorphic-fetch';
import styled from 'styled-components';
import dynamic from 'next/dynamic';
import getConfig from 'next/config';
import Layout from '../component/organisms/Layout/Layout';
import HeroContainer from '../component/organisms/HeroContainer/';
import {
ContentContainer,
ContentWrapper,
MenuBar,
} from '../component/organisms/HeroContainer/HeroContainer.style';
import Header from '../component/organisms/Header/Header';
import Footer from '../component/organisms/Footer/Footer';
import paths from '../utils/path';
import {
getConfirmedByProvinceState,
getConfirmedByCountry,
} from '../utils/utils';
const MainWrapper = styled.div``;
const WorldMap = dynamic(
() => import('../component/templates/WorldMap/WorldMap'),
{
ssr: false,
}
);
const Country = (props) => {
const router = useRouter();
const {
confirmed,
recovered,
deaths,
active,
countryRegion,
lat,
long,
lastUpdate,
} = getConfirmedByCountry(props.data)[0];
const combinedConfirmed = getConfirmedByProvinceState(props.data);
const uniqueConfirmed = [...new Set(combinedConfirmed)];
const source = `//github.com/mathdroid/covid-19-api`;
const lastUpdatedAt = new Date(lastUpdate).toGMTString();
return (
<Layout
title={`${countryRegion}'s coronavirus stats`}
desc={`${countryRegion} Coronavirus stats confirmed updates by country, recovered, deaths`}
keywords={`${countryRegion} world coronavirus, coronavirus update, coronavirus, coronavirus stats, coronavirus numbers, ${countryRegion} coronavirus`}
>
<MainWrapper>
<MenuBar>
<Header path={paths.world} page='World' />
</MenuBar>
<ContentWrapper>
<ContentContainer>
<div className='hero-mobile'>
<HeroContainer
title={countryRegion}
confirmed={confirmed}
recovered={recovered}
deaths={deaths}
/>
</div>
</ContentContainer>
</ContentWrapper>
<WorldMap
data={uniqueConfirmed}
initialZoomLevel={4}
countryCenter={[lat, long - 45]}
/>
<ContentWrapper>
<ContentContainer>
<div className='hero-desktop'>
<HeroContainer
title={countryRegion}
confirmed={confirmed}
recovered={recovered}
deaths={deaths}
/>
</div>
<Footer
footerElements={[
{
description: `The number of reported cases for some countries might be
different from the local reports. The API used in this page
obtains data from the Center for Systems Science and Engineering
(CSSE) at Johns Hopkins University (JHU).`,
author: 'Mathdroid',
source: source,
lastUpdate: lastUpdatedAt,
},
]}
/>
</ContentContainer>
</ContentWrapper>
</MainWrapper>
</Layout>
);
};
Country.getInitialProps = async ({ query }) => {
const { COVID19_COUNTRIES_API } = getConfig().publicRuntimeConfig;
const response = await fetch(`${COVID19_COUNTRIES_API}${query.id}/confirmed`);
const data = await response.json();
return { data };
};
export default withRouter(Country);
<file_sep>/src/utils/utils.js
export const displayDate = (date) => new Date(date).toGMTString();
export const digitSeparator = (num) => num.toLocaleString();
export const getConfirmedByDate = (data) =>
data.reduce(
(prev, curr) => (
(prev[displayDate(curr.date)] = ++prev[displayDate(curr.date)] || 1), prev
),
{}
);
const getCombinedSum = (data, prop) =>
data.reduce((prev, curr) => {
let district = curr[prop];
let location = district ? district : 'No details';
return (prev[location] = ++prev[location] || 1), prev;
}, {});
export const getConfirmedByDistrict = (data) =>
getCombinedSum(data, 'healthCareDistrict');
export const getConfirmedBySource = (data) =>
getCombinedSum(data, 'infectionSourceCountry');
export const getHospitalArea = (data) => getCombinedSum(data, 'area');
export const sortData = (data) =>
Object.entries(data)
.slice()
.sort((a, b) => b[1] - a[1]);
const getDailyData = (d) => {
return d.map((currData, index) => {
let key = currData[0];
let value = currData[1];
return {
date: key,
cases: value,
};
});
};
export const dailyCasesTotal = (data) => {
const sortedData = getDailyData(data).sort(function(a, b) {
return new Date(a.date) - new Date(b.date);
});
return sortedData.reduce((acc, obj) => {
let key = obj.date.slice(5, -13);
acc[key] = (acc[key] || 0) + obj.cases;
return acc;
}, {});
};
const getConfirmedObject = (data, prop) =>
data.reduce((acc, currVal) => {
let filteredObj = acc
.filter((obj) => {
return obj[prop] === currVal[prop];
})
.pop() || {
countryRegion: currVal.countryRegion,
provinceState: currVal.provinceState,
confirmed: 0,
recovered: 0,
deaths: 0,
lat: currVal.lat,
long: currVal.long,
lastUpdate: currVal.lastUpdate,
};
filteredObj.confirmed += currVal.confirmed;
filteredObj.recovered += currVal.recovered;
filteredObj.deaths += currVal.deaths;
acc.push(filteredObj);
return acc;
}, []);
export const getConfirmedByProvinceState = (data) =>
getConfirmedObject(data, 'provinceState');
export const getConfirmedByCountry = (data) =>
getConfirmedObject(data, 'countryRegion');
export const getChangesInTotalCases = (
confirmedData,
recoveredData,
deathsData
) => {
const getValues = Object.values(confirmedData).map((item, index, array) => {
return (array[index] += array[index - 1] ? array[index - 1] : 0);
});
const keys = Object.keys(confirmedData);
const getRecoveredKey = Object.keys(recoveredData);
const getRecoveredValue = Object.entries(recoveredData);
const getDeathsKey = Object.keys(deathsData);
const getDeathsValue = Object.entries(deathsData);
return keys.map((item, i) => {
const deaths = getDeathsKey.includes(item)
? getDeathsValue.filter((el) => el[0] === item).map((el) => el[1])[0]
: 0;
const recoveries = getRecoveredKey.includes(item)
? getRecoveredValue.filter((el) => el[0] === item).map((el) => el[1])[0]
: 0;
return {
name: item,
cases: getValues[i],
daily: Object.values(confirmedData)[i],
deaths,
recoveries,
};
});
};
export const mapDataForCharts = (data) =>
data
.map((item, index) => {
const {
confirmed,
deaths,
reportDate,
deltaConfirmed,
incidentRate,
} = item;
return Object.assign(
{ totalConfirmed: confirmed.total },
{ totalDeaths: deaths.total },
{ reportDate: reportDate },
{ deltaConfirmed: deltaConfirmed },
{ incidentRate: incidentRate.toFixed(2) }
);
})
.reduce((a, b) => a.concat(b), []);
<file_sep>/src/component/templates/WorldPage/CountriesListComponent.js
import Link from 'next/link';
import { TableLayoutContainer } from '../../organisms/TableLayout/TableLayout';
const CountriesListComponent = (props) => {
return (
<ul>
{props.searchResults.length > 0 &&
props.searchResults.map((d, i) => (
<Link
href={`/country?id=${d.countryRegion.toLowerCase()}`}
key={`country-${i}`}
>
<a>
<TableLayoutContainer
key={i}
tableRows={[
d.countryRegion,
d.confirmed,
d.recovered,
d.deaths,
]}
/>
</a>
</Link>
))}
</ul>
);
};
export default CountriesListComponent;
<file_sep>/src/component/organisms/HomePage/BottomTables.js
import {
TableHeader,
TableWrapper,
TableLayoutContainer
} from '../TableLayout/TableLayout';
export const ConfirmedByRegionTable = props => {
return (
<TableWrapper tableSize={props.headers.length}>
<TableHeader headTitle={props.headers} />
<ul>
{props.data.map((item, index) => (
<TableLayoutContainer
key={index}
tableRows={[
item[0] && item[0] !== 'null' ? item[0] : 'No details',
item[1]
]}
/>
))}
</ul>
</TableWrapper>
);
};
export const CommonBottomTable = props => {
return (
<TableWrapper tableSize={props.headers.length}>
<TableHeader headTitle={props.headers} />
<ul>
{props.data
.map((item, index) => {
const time = new Date(item[0]).toLocaleString().slice(0, -10);
return (
<TableLayoutContainer key={index} tableRows={[time, item[1]]} />
);
})
.reverse()}
</ul>
</TableWrapper>
);
};
<file_sep>/src/component/organisms/Footer/Footer.js
import PropTypes from 'prop-types';
import Link from 'next/link';
import { themeColors } from '../Layout/Layout.style';
const linkToSource = (source, author) => {
return (
<Link href={source}>
<a>{author}</a>
</Link>
);
};
const Footer = (props) => {
return (
<footer>
{props.footerElements.map((el, index) => {
const { source, author, lastUpdate, description, descSource } = el;
return (
<div
style={{
borderTop: `0.1rem solid ${themeColors.gray}`,
marginTop: '1rem',
}}
key={`source-${index}`}
>
<p>
{description} {descSource && linkToSource(descSource, author)}{' '}
</p>
{lastUpdate && (
<p>
Last update: <i>{lastUpdate}</i>{' '}
</p>
)}
{source && <p>Source: {linkToSource(source, author)}</p>}
</div>
);
})}
</footer>
);
};
Footer.propTypes = {
footerElements: PropTypes.array.isRequired,
};
export default Footer;
<file_sep>/src/component/organisms/UI/LogarithmicLinearComponent/LogarithmicLinearConmponent.js
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { themeColors } from '../../Layout/Layout.style';
export const ButtonsWrapper = styled.div`
display: flex;
justify-content: center;
`;
export const Button = styled.button`
appearance: none;
width: 9rem;
padding: 0.5rem 1.2rem;
font-size: 1rem;
font-family: inherit;
background-color: ${themeColors.black};
color: ${themeColors.creamWhite};
text-decoration: none;
text-align: center;
cursor: pointer;
&:hover,
&:focus {
outline: 0;
text-decoration: underline;
}
&.is-active {
background-color: ${themeColors.blue};
}
`;
const LogarithmicLinearConmponent = (props) => {
return (
<ButtonsWrapper>
{props.buttons.map((name, index) => (
<Button
onClick={props.linearLogHandler}
id={name.toLowerCase() === 'logarithmic' ? 'logarithmic' : 'linear'}
className={name.toLowerCase() === props.isActive ? 'is-active' : ''}
key={`log-linear-${index}`}
>
{name}
</Button>
))}
</ButtonsWrapper>
);
};
LogarithmicLinearConmponent.propTypes = {
buttons: PropTypes.array.isRequired,
linearLogHandler: PropTypes.func.isRequired,
isActive: PropTypes.string,
};
export default LogarithmicLinearConmponent;
<file_sep>/src/component/templates/Charts/SymptomsSurveyPieChart/index.js
import SymptomsSurveyPieChart from './SymptomsSurveyPieChart';
export default SymptomsSurveyPieChart;
<file_sep>/src/partials/head.js
import Head from 'next/head';
const Meta = props => (
<Head>
<title>{props.title}</title>
<meta name='description' content={props.desc} />
<meta name='keywords' content={props.keywords} />
<meta name='og:title' property='og:title' content={props.title} />
<meta name='og:description' content={props.desc} />
<meta name='og:type' content='website' />
{/* <meta name='og:url' content={props.page} /> */}
<link
rel='stylesheet'
href='https://fonts.googleapis.com/css?family=Raleway:400,600&display=swap'
/>
<link
rel='stylesheet'
href='https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css'
/>
<link
href='https://unpkg.com/leaflet-geosearch@latest/assets/css/leaflet.css'
rel='stylesheet'
/>
<style dangerouslySetInnerHTML={{ __html: props.css }} />
<script
dangerouslySetInnerHTML={{
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K49S7R2');`
}}
/>
</Head>
);
export default Meta;
<file_sep>/src/component/organisms/UI/LogarithmicLinearComponent/index.js
import LogarithmicLinearConmponent from './LogarithmicLinearConmponent';
export default LogarithmicLinearConmponent;
<file_sep>/src/component/organisms/UI/SectionWrapper/Section.style.js
import styled from 'styled-components';
import { themeColors } from '../../Layout/Layout.style';
const Section = styled.section`
margin-top: 2.5rem;
.header {
top: 14% !important;
}
ol li div:nth-of-type(1),
ul li div:nth-of-type(1) {
font-size: 1.2rem;
font-weight: 800;
}
@media (max-width: 860px) {
width: 100%;
ol li {
grid-template-columns: 34% 33% 33%;
grid-template-rows: auto auto;
}
ol li div:nth-of-type(1),
ul li div:nth-of-type(1) {
text-align: center;
}
ol li div:nth-child(1) {
grid-column-start: 1;
grid-column-end: 4;
grid-row-start: 1;
grid-row-end: 2;
}
}
`;
const InputWrapper = styled.div`
position: sticky;
top: 0;
background-color: ${themeColors.creamWhite};
padding: 1rem 0;
label {
display: block;
margin-bottom: 1rem;
}
input,
label {
font-size: 1.35rem;
cursor: pointer;
}
input {
padding: 0.5rem;
width: 100%;
border: solid 0.1rem ${themeColors.gray};
background-color: ${themeColors.creamWhite};
&:focus {
border: solid 0.125rem ${themeColors.blue};
border-top: none;
outline: none;
}
}
`;
module.exports = {
Section,
InputWrapper,
};
<file_sep>/src/component/templates/Charts/MapChart/MapChart.js
import { Component } from 'react';
import PropTypes from 'prop-types';
import L from 'leaflet';
import {
Map,
TileLayer,
Marker,
Popup,
GeoJSON,
Tooltip,
CircleMarker,
} from 'react-leaflet';
import { MapContainer } from './MapChart.style';
import MapJson from '../../../../utils/finland-provinces.json';
import {
parseMapDetails,
getConfirmedCases,
getColors,
} from '../MapChart/mapUtils';
import Legend from './Legend';
export default class MyMap extends Component {
static propTypes = {
data: PropTypes.array.isRequired,
};
render() {
const dataMarkers = Object.entries(MapJson.features);
const confirmedCases = getConfirmedCases(this.props.data);
const filterByName = (districtName) =>
confirmedCases.filter((cases) => {
const district =
cases.district === 'Vaasa' ? 'Pohjanmaa' : cases.district;
return district && districtName.includes(district);
});
const getPositionsData = (data) => parseMapDetails(data, filterByName);
const colors = (feature) =>
getColors(feature, getPositionsData(dataMarkers));
const featureWithStyle = (feature) => {
const district = feature.properties.Maakunta;
return {
fillColor: colors(district),
weight: 2,
opacity: 1,
dashArray: '3',
fillOpacity: 0.7,
};
};
const isSmallerScreen = window && window.innerWidth < 880;
return (
<MapContainer>
<Map
center={isSmallerScreen ? [65.25, 25] : [66.25, 14.5]}
zoom={5}
minZoom={5}
dragging={!L.Browser.mobile}
tap={!L.Browser.mobile}
>
<TileLayer
attribution='&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
/>
<GeoJSON data={MapJson} style={featureWithStyle} />
{getPositionsData(dataMarkers).map((pos, index) => (
<Marker key={index} draggable={false} position={[pos.lan, pos.lng]}>
<CircleMarker
center={[pos.lan, pos.lng]}
opacity={0.5}
fillOpacity={1}
fillColor='#0b1560'
color='#d6bd8d'
weight={5}
radius={15}
onMouseOver={(e) => e.target.openPopup()}
onMouseOut={(e) => e.target.closePopup()}
>
{
<Popup
minWidth={50}
offset={[-1, -3]}
className='custom-popup'
>
<div>
<span>{pos.gn_name}</span>
</div>
</Popup>
}
<Tooltip direction='center' permanent>
<span>{pos.cases}</span>
</Tooltip>
</CircleMarker>
</Marker>
))}
<Legend />
</Map>
</MapContainer>
);
}
}
<file_sep>/src/component/organisms/DropDownContainer/DropDownHeader.js
import React from 'react';
import PropTypes from 'prop-types';
import Link from 'next/link';
const DropDownHeader = ({ description }) => {
return (
<div>
<h2>Coronavirus symptoms survey collected by Symptomradar(Oiretutka) </h2>
<div>
<p>{description}</p>
<p>
You can fill the form by heading to{' '}
<Link href='//www.oiretutka.fi/embed/v1/index.en.html'>
<a target='_blank'>Oiretutka.fi</a>
</Link>
</p>
</div>
</div>
);
};
DropDownHeader.propTypes = {
description: PropTypes.string.isRequired,
};
export default DropDownHeader;
<file_sep>/next.config.js
const sitemap = require('nextjs-sitemap-generator');
const webpack = require('webpack');
const withFonts = require('nextjs-fonts');
sitemap({
baseUrl: 'https://finlandcoronastats.com',
pagesDirectory: __dirname + '/src/pages',
targetDirectory: 'public/',
});
module.exports = withFonts({
exportPathMap: () => {
return {
'/': { page: '/' },
'/world': { page: '/world' },
// '/country': { page: '/[country]' }
};
},
devIndicators: {
autoPrerender: false,
},
webpack: (config, { isServer }) => {
if (isServer) {
const antStyles = /antd\/.*?\/style\/css.*?/;
const origExternals = [...config.externals];
config.externals = [
(context, request, callback) => {
if (request.match(antStyles)) return callback();
if (typeof origExternals[0] === 'function') {
origExternals[0](context, request, callback);
} else {
callback();
}
},
...(typeof origExternals[0] === 'function' ? [] : origExternals),
];
config.module.rules.unshift({
test: antStyles,
use: 'null-loader',
});
}
return config;
},
prerenderPages: false,
serverRuntimeConfig: {},
publicRuntimeConfig: {
FINNISH_CORONA_DATA: `https://w3qa5ydb4l.execute-api.eu-west-1.amazonaws.com/prod/finnishCoronaData/v2`,
COVID19_API: `https://covid19.mathdro.id/api`,
COVID19_DAILY_API: `https://covid19.mathdro.id/api/daily`,
COVID19_COUNTRIES_API: `https://covid19.mathdro.id/api/countries/`,
OIRETUTKA_API: `https://data.oiretutka.fi/city_level_general_results.json`,
},
});
<file_sep>/src/component/organisms/HeroContainer/HeroBanner.js
import HeroContainer from './HeroContainer';
const digitSeparator = (num) => num.toLocaleString();
const HeroBanner = (props) => {
const { confirmed, recovered, deaths } = props;
return (
<HeroContainer
title={props.title}
casesList={[
{ title: 'Confirmed', amount: digitSeparator(confirmed) },
{ title: 'Recovered', amount: digitSeparator(recovered) },
{ title: 'Deaths', amount: digitSeparator(deaths) },
]}
/>
);
};
export default HeroBanner;
| bfcd81a939de371b3eb940e515407fd329979699 | [
"JavaScript",
"Markdown"
] | 35 | JavaScript | Boochoo/finland-conora-stats | 3b9c706e1c726270c87980d5b568ab42c495fe6c | ca4637ceeaa64ac70a153f3f23a0a40e8e21b3c4 |
refs/heads/master | <repo_name>nhatthinh253/Global_Terrorism_Analysis<file_sep>/global_terrorism.py
import streamlit as st
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import matplotlib.pyplot as plt
import pydeck as pdk
from plotly.subplots import make_subplots
@st.cache
def load_data(path):
data = pd.read_csv(path)
return data
# Title
st.markdown(f'<h1 style="text-align: center; color: darkred;">Global Terrorism Analysis</h1>',
unsafe_allow_html=True)
st.sidebar.header("Navigation")
content = [ "Terrorist activities",
"Attacks by region",
"Terrorist groups",
"Target of terrorist groups",
"Military Spending vs. Casualties",
]
nag = st.sidebar.radio("Go to:",content)
st.sidebar.header("Contribute")
st.sidebar.info(
'''This project is contributed by:
**<NAME>**: [GitHub](https://github.com/nhatthinh253) | [LinkedIn](https://linkedin.com/in/nhatthinh253)
**<NAME>**,
**<NAME>**.
The source code can be found in this [Github Repo](https://github.com/nhatthinh253/Global_Terrorism_Analysis).'''
)
st.sidebar.header("About")
st.sidebar.info("This app is maintained by [**<NAME>)**](https://linkedin.com/in/nhatthinh253). You can reach me at <EMAIL>")
# Import data_1
data1 = load_data('./data1.csv')
# data2 with a new col
data2 = data1.copy()
data2.nkill.fillna(0,inplace = True)
data2.nwound.fillna(0,inplace = True)
data2['ncasualty'] = data2.nkill + data2.nwound
if nag == "Terrorist activities":
st.markdown('## **1. Terrorist activities from 1970 to 2017**')
# Slider, set default 2014
year = st.slider('Year', 1970,2017, 2014)
# prepare data
map_data = data1[~data1.longitude.isnull()][data1.iyear ==year]
map_data = map_data[map_data['longitude'] > -180][['latitude','longitude','nkill', 'nwound']]
map_data.nkill.fillna(0, inplace = True)
map_data.nwound.fillna(0, inplace = True)
map_data['ncasualty'] = map_data['nkill'] + map_data['nwound']
st.markdown(f'- Total number of attacks: {map_data.shape[0]}')
st.markdown(f'- Total number of casualties: {int(map_data.ncasualty.sum())}')
# Severity of attacks
st.write(pdk.Deck(
map_style="mapbox://styles/mapbox/light-v9",
layers=[
pdk.Layer(
"ScatterplotLayer",
data=map_data,
get_position=["longitude", "latitude"],
pickable=False,
opacity=0.4,
stroked=True,
filled=True,
radius_scale=100,
radius_min_pixels=4,
radius_max_pixels=40,
line_width_min_pixels=0.5,
get_radius= 'ncasualty',
get_fill_color=[252, 136, 3],
get_line_color=[255,0,0],
tooltip="test test",
),
],
))
st.subheader(f'Map of terrorist activities in {year}')
if st.checkbox('Show sample raw data'):
st.write(map_data[0:10])
# Key takeaways
st.markdown('''Up to 2011, the number of attacks never exceeded 5000 per year.
However, there has been a major increase in the number of attacks since 2012,
with a spike to almost 17k attacks in 2014''')
# Bar graph to visualize terrorism around the globe
year_casualties = data2.groupby('iyear').agg({'eventid':'count','ncasualty':'sum'}).rename(columns={'eventid':'Number of attacks'})
year_casualties['Casualties/attack'] = year_casualties['ncasualty']/ year_casualties['Number of attacks']
fig = go.Figure()
fig.add_trace(go.Scatter(x=year_casualties.index, y=year_casualties['ncasualty'], mode='lines+markers',name='casualties'))
fig.add_trace(go.Bar(x=year_casualties.index, y=year_casualties['Number of attacks'],name='Number of attacks'))
fig.update_layout(title_text="Attacks vs. Casualties from 1970 to 2017", xaxis_title="Year", yaxis_title="Total number", width = 780, height=500)
fig.update_layout(legend=dict( orientation = 'h', yanchor="top",y= 1.15,xanchor="right", x=1))
st.plotly_chart(fig)
# Show data with checkbox
if st.checkbox('Show data'):
year_casualties
if nag == "Attacks by region":
st.markdown('## **2. Attacks by region from 1970 to 2017**')
# Create multiple selecter with st.multiselect
st.markdown("#### " +"Which region would you like to see?")
regions = data1.region_txt.unique()
selected_region = st.multiselect(
label="Choose a region", options= regions
)
# prepare data to plot
df = pd.crosstab(data1.iyear,data1.region_txt)
# Create traces
fig = go.Figure()
if selected_region:
for region in regions:
if region in selected_region :
fig.add_trace(go.Scatter(x=df.index, y=df[region], mode='lines+markers', name= region ))
fig.update_layout(title=f"Attacks in {', '.join(selected_region)} from 1970 to 2017", xaxis_title="Year", yaxis_title="Number of attacks", legend_title="Regions",
autosize=False, width=780, height=600,legend=dict( yanchor="top", y=1, xanchor="left", x=0.01))
st.plotly_chart(fig)
else:
for region in regions:
fig.add_trace(go.Scatter(x=df.index, y=df[region], mode='lines', name= region))
fig.update_layout(title="Attacks by region from 1970 to 2017", xaxis_title="Year", yaxis_title="Number of attacks", legend_title="Regions",
autosize=False, width=780, height=600,legend=dict( yanchor="top", y=1, xanchor="left", x=0.01))
st.plotly_chart(fig)
# key takeaways
st.markdown('MENA (Middle East & North Africa) and South Asia were the most affected regions by this increase in global terrorism, followed by Sub-Saharan Africa.')
if nag == "Terrorist groups":
st.markdown('## **3. Notorious Terrorist Groups from 1970 to 2017**')
# Top 10 all-time terrorist groups
top_10_data = data1['gname'].value_counts()[1:11]
fig = px.bar(x = top_10_data, y = top_10_data.index, title = "Top 10 Notorious Groups from 1970 - 2017",
labels = {'y':'Terrorist Group', 'x':'Number of attacks'} )
fig.update_layout( autosize=False, width=780, height=400,legend=dict(yanchor="top", y=1, xanchor="left", x=0.01))
st.plotly_chart(fig)
# show data top 10
if st.checkbox('Show top 10 terrorist groups data'):
top_10_data
# Activities of top 5 notorious groups across the period
terror_group = pd.crosstab(data1.iyear, data1.gname)
top_10= top_10_data.index
selected_groups = st.multiselect(
label="Choose a terrorist group", options= top_10
)
fig = go.Figure()
if selected_groups:
for group in top_10:
if group in selected_groups :
fig.add_trace(go.Scatter(x= terror_group[top_10].index, y=terror_group[top_10][group],mode='lines + markers',
name=group))
else:
for group in top_10:
fig.add_trace(go.Scatter(x= terror_group[top_10].index, y=terror_group[top_10][group],mode='lines + markers',
name=group))
fig.update_layout(legend=dict(yanchor="top",y=0.99,xanchor="left",x=0.01), autosize=False, width=800, height=600,
title = 'Activities of top notorious groups from 1970 to 2017', xaxis_title="Year", yaxis_title="Number of attacks", legend_title="Terrorist groups")
st.plotly_chart(fig, use_container_width = False)
# Key takeaways
st.markdown('''Before 2000, Farabundo Marti National Liberation Front (FMLN) and Shining Path (SL)
were the two major groups. These groups gradually weakened and seemed to stop in 1990s.
Taliban, Islamic State of Iraq and the Levant (ISIL) and Al-Shabaab emerged in 2000s and
have quickly become dominant in their own regions: South Asia, MENA,
and Sub-Saharan Africa respectively.''' )
# Scope of operation
st.subheader('Which regions do the terrorist groups operate in?')
scope_top_10 = pd.crosstab(data1.region_txt,data1.gname )[top_10]
scope_top_10.columns = ['Taliban', 'ISIL', 'SL', 'FMLN', 'Al-Shabaab', 'NPA', 'IRA', 'FARC','Boko Haram', 'PKK']
st.dataframe(scope_top_10.style.highlight_max(axis=0))
# Middle East & North Africa
st.markdown('### **3.1 Middle East & North Africa**')
# Prepare data
MENA = data2[(data2.region_txt == 'Middle East & North Africa')]
MENA_casualty = MENA.pivot_table(values='ncasualty', index=['iyear'], columns=['country_txt'], aggfunc='sum')
MENA_countries = MENA.country_txt.value_counts()[0:5].index
fig = go.Figure()
for country in MENA_countries:
fig.add_trace(go.Scatter(x=MENA_casualty.index, y=MENA_casualty[country],mode='lines+markers',
name=country))
fig.update_layout(title="Casualties by country in MENA from 1970 to 2017", xaxis_title="Year", yaxis_title="Number of casualties", legend_title="Countries",
autosize=False, width=780, height=400,legend=dict( bgcolor = 'rgba(255,255,255, 0.5)', yanchor="top", y=1, xanchor="left", x=0.01))
st.plotly_chart(fig)
# key takeaways
st.markdown('**ISIL is responsible for most of the attacks in the region**')
ISIL_data = data2[(data2.gname == 'Islamic State of Iraq and the Levant (ISIL)')
& (data2.region_txt == 'Middle East & North Africa')]
ISIL_casualty = ISIL_data.groupby(['country_txt'])['ncasualty'].sum().sort_values(ascending = False)
ISIL_weapon = ISIL_data.attacktype1_txt.value_counts()
ISIL_target = ISIL_data.targtype1_txt.value_counts()
# create subplots
fig = make_subplots(rows=1, cols=3, shared_yaxes=False, horizontal_spacing= 0.1)
# plot each subplot
fig.add_trace(go.Bar(x = ISIL_casualty[0:5].index, y=ISIL_casualty[0:5], name = "Casualty"),1, 1)
fig.add_trace(go.Bar(x = ISIL_weapon[0:5].index, y = ISIL_weapon[0:5], name = 'Weapon'),1, 2)
fig.add_trace(go.Bar(x = ISIL_target[0:5].index, y = ISIL_target[0:5], name = "Target"), 1,3)
# styling
fig.update_layout(title_text="ISIL in Middle East & North Africa ", width = 780, height=500)
fig.update_layout(legend=dict( orientation = 'h', yanchor="top",y= 1.2,xanchor="right", x=1))
st.plotly_chart(fig)
# key takeways
st.markdown('- Since 2003 bombings in Iraq have killed thousands of people, mostly Iraqi civilians by suicide bombings')
st.markdown('''- The War in Iraq was an armed conflict.
the Iraqi insurgency escalated into a full-scale war with the conquest of Ramadi,
Fallujah, Mosul, Tikrit and in the major areas of northern Iraq by the ISIS''')
# South Asia
st.markdown('### **3.2 South Asia**')
# prepare data
South_asia = data2[(data2.region_txt == 'South Asia')]
South_asia_casualty = South_asia.pivot_table(values='ncasualty', index=['iyear'], columns=['country_txt'], aggfunc='sum')
SAsia_countries = South_asia.country_txt.value_counts()[0:5].index
fig = go.Figure()
for country in SAsia_countries:
fig.add_trace(go.Scatter(x=South_asia_casualty.index, y=South_asia_casualty[country],mode='lines+markers',
name=country))
fig.update_layout(title="Casualties by country in South Asia from 1970 to 2017", xaxis_title="Year", yaxis_title="Number of casualties", legend_title="Countries",
autosize=False, width=780, height=400,legend=dict( bgcolor = 'rgba(255,255,255, 0.5)', yanchor="top", y=1, xanchor="left", x=0.01))
st.plotly_chart(fig)
st.markdown('**Taliban is responsible for most of the attacks in Afghanistan and Pakistan**')
Taliban_data = data2[(data2.gname == 'Taliban') & (data2.region_txt == 'South Asia')]
Taliban_casualty = Taliban_data.groupby(['country_txt'])['ncasualty'].sum().sort_values(ascending = False)
Taliban_target = Taliban_data.attacktype1_txt.value_counts()
Taliban_weapon = Taliban_data.targtype1_txt.value_counts()
# create subplots
fig = make_subplots(rows=1, cols=3, shared_yaxes=False, horizontal_spacing= 0.1)
# plot each subplot
fig.add_trace(go.Bar(x = Taliban_casualty[0:5].index, y=ISIL_casualty[0:5], name = "Casualty"),1, 1)
fig.add_trace(go.Bar(x = Taliban_weapon[0:5].index, y = Taliban_weapon[0:5], name = 'Weapon'),1, 2)
fig.add_trace(go.Bar(x = Taliban_target[0:5].index, y = Taliban_target[0:5], name = "Target"), 1,3)
# styling
fig.update_layout(title_text="Taliban in South Asia ", width = 780, height=500)
fig.update_layout(legend=dict( orientation = 'h', yanchor="top",y= 1.2,xanchor="right", x=1))
st.plotly_chart(fig)
# key takeaways
st.markdown('**1. Afghanistan:**')
st.markdown("- Followed by Afghan Civil War's 1996–2001 phase when the U.S. aimed to dismantle al-Qaeda's safe operational base in Afghanistan by removing the power of Taliban after the 9/11 attack in NYC")
st.markdown('- Over 100k have been killed in the war: 4k ISAF soldiers and civilian contractors, 60k+ Afghan national security forces, 30k+ civilians and even more Taliban')
st.markdown('**2. Pakistan:**')
st.markdown('- The Kashmir issue and across the border terrorism have been the cause of conflicts between the two countries mostly with the exception of the Indo-Pakistani War of 1971')
if nag == "Target of terrorist groups":
st.markdown('## **4. Target of top 10 nororious terrorist groups**')
ReT= {'Government (Diplomatic)':'Government','Government (General)':'Government',
'Police':'Police & Military',
'Military':'Police & Military',
'Airports & Aircraft':'Business and Utilities',
'Business':'Business and Utilities',
'Utilities':'Business and Utilities',
'Food or Water Supply':'Business and Utilities',
'Tourists':'Private Citizens & Property',
'Journalists & Media':'Telecoms and Journalism',
'Telecommunication':'Telecoms and Journalism',
'Transportation':'Business and Utilities',
'Violent Political Party':'Other Violent Group',
'Terrorists/Non-State Militia':'Other Violent Group',
'Other':'Private Citizens & Property',
'Abortion Related':'Private Citizens & Property',
'Maritime':'Business and Utilities',
'Religious Figures/Institutions':'Religious, Educational, Political',
'Educational Institution':'Religious, Educational, Political',
'NGO':'Religious, Educational, Political'}
data2['targtype1_txt'].replace(ReT, inplace = True)
gkk = data2.groupby(['gname'])
all_groups = data2.gname.unique()
top_10_data = data1['gname'].value_counts()[1:11]
top_10= top_10_data.index
selected_group = st.selectbox(
label="Choose a terrorist group", options= top_10
# or all_groups
)
group = gkk.get_group(selected_group)
pd.crosstab(group.iyear,group.targtype1_txt).plot.bar(stacked=True,width=0.8)
fig=plt.gcf()
fig.set_size_inches(12,8)
st.pyplot(fig)
if nag == "Military Spending vs. Casualties":
st.markdown('## **5. Military Spending vs. Casualties**')
# load new data
warspending = pd.read_csv(r'./Militaryspending.csv',encoding='ISO-8859-1')
# Cleaning for world spending
warspending = warspending.drop(['Indicator Name'], axis=1)
World = warspending[warspending['Name']=='World']
World = World.drop(['Code', 'Type'], axis=1)
World = World.set_index('Name')
World.index = World.index.rename('Year')
World = World.T
World = World[:]
# cleaning for individual Nations
Nations = warspending[warspending['Type']=='Country']
Nations = Nations.drop(['Code', 'Type'], axis=1)
Nations = Nations.set_index('Name')
Nations.index = Nations.index.rename('Year')
Nations = Nations.dropna(axis=0, how='all')
Nations = Nations.T
casualties = data2.groupby('iyear')['ncasualty'].sum()
# plot data
fig = go.Figure()
fig.add_trace(go.Bar(x=casualties.index, y=casualties, name='casualties'))
fig.add_trace(go.Scatter(x=Nations.index, y=Nations['Nigeria']/1e5,
mode='lines+markers',
name='Nigeria Spending in $100,000'))
fig.add_trace(go.Scatter(x=Nations.index, y=Nations['Iraq']/1e5,
mode='lines+markers',
name='Iraq Spending in $100,000'))
fig.add_trace(go.Scatter(x=Nations.index, y=Nations['United States']/1e7,
mode='lines+markers',
name='US Spending in $10,000,000'))
fig.update_layout(title_text="Spending vs Casualties ", width = 780, height=500)
fig.update_layout(legend=dict( orientation = 'h', yanchor="top",y= 1.15,xanchor="right", x=1))
st.plotly_chart(fig)
<file_sep>/requirements.txt
streamlit==0.72.0
numpy==1.19.2
pandas==1.1.0
plotly==4.9.0
plotly-express==0.4.1
pydeck==0.5.0b1
matplotlib==3.3.1
seaborn==0.11.0
<file_sep>/README.md
# Global Terrorism Analysis
Building an app with streamlit to analyze Global terrorism
Demo

Please follow this link for a full version:
https://share.streamlit.io/nhatthinh253/global_terrorism_analysis/global_terrorism.py
| 5f8e658f55c4e83f29fbd7a3a531300dea8c7622 | [
"Markdown",
"Python",
"Text"
] | 3 | Python | nhatthinh253/Global_Terrorism_Analysis | 65b7ed5452f9a18a46ef36010242deb20ba1f855 | 7faad8d63ba7ea3b9ecb3c0ca8171ce3bfac7ead |
refs/heads/master | <file_sep>import numpy as np
from PIL import Image
import matplotlib.pylab as plt
#plt.rcParams['figure.figsize'] = (10, 12.0)
NUM_HADAMARD = 64
def normalize(y):
a,b=np.shape(y)
n = np.zeros((a,b))
for i in range(a):
for j in range(b):
n[i,j] = np.int(y[i,j])
return n
RD_dir = u'C:/Users/zh/Desktop/hadamard/32RD.png'
RD=Image.open(RD_dir)
RD = np.array(RD)
CC = np.ones((1024,1024))
RD_p = 2*RD - CC
RD_anti = -1 * RD_p
#RD_n = -1 * RD_p
# K = 256
# RD_use =np.vstack((RD_p[0:K,:],RD_n[0:K,:])) #创造需要使用的 Hadamard 矩阵
#NUM_PICTURE = 42000
#RATIO = 0.1
DIM = 1024
i = np.random.randint(100)
#rand_pattern = np.random.randn(DIM,DIM)
filename1 = 'F:\Code\kaggle\Digit Recognizer\image\image' + '%d' % i+ '.jpg'
x = Image.open(filename1)
image_test = x.resize((32,32))
image_test = np.array(image_test)
pic = image_test.reshape((1,1024))
sum1 = np.zeros((32,32))
signal = []
for j in range(1024):
RD_pattern = RD_p[j].reshape((1024,1))
anti_pattern = RD_anti[j].reshape((1024,1))
pattern = RD_p[j].reshape((1024,1))
temp = np.dot(pic,RD_pattern) - np.dot(pic,anti_pattern)
signal.append(temp)
sum1 = sum1 + temp * pattern.reshape((32,32))
#sum1 = normalize(((sum1 - np.min(sum1))/(np.max(sum1) - np.min(sum1)))*256)
#image_ghost = Image.fromarray(sum1)
#image_ghost = image_ghost.convert('L')
sum1[0,0] = np.mean(sum1)
plt.figure(figsize=(8,10))
plt.subplot(211)
plt.title("Sequence Signal",fontsize =18)
plt.xlabel("Hadamard Row")
plt.ylabel("Idensity")
plt.plot(np.squeeze(signal))
plt.subplot(212)
signal_sorted = sorted(np.abs(signal),reverse=True)
plt.title("Sorted Signal",fontsize =18)
plt.plot(np.squeeze(signal_sorted))
plt.tight_layout()
plt.show()
print("****************** ")
print("****************** ")
print("****************** ")
print("Get the bigger signal ... ")
signal_abs = np.abs(np.squeeze(signal))
signal_dict = {}
j= 0
for i in signal_abs:
j = j+1
signal_dict[j] = i
## 排序
xxx =sorted(signal_dict.items(),key = lambda items:items[1],reverse = True)
signal_picture = [i[0] for i in xxx]
sum2 = np.zeros((32,32))
sum3 = np.zeros((32,32))
signal = np.squeeze(signal)
for j in signal_picture[:NUM_HADAMARD]:
RD_pattern = RD_p[j-1].reshape((1024,1))
anti_pattern = RD_anti[j-1].reshape((1024,1))
pattern = RD_p[j-1].reshape((1024,1))
temp = np.dot(pic,RD_pattern) - np.dot(pic,anti_pattern)
sum2 = sum2 + temp * pattern.reshape((32,32))
y = 0
for k in signal[:NUM_HADAMARD]:
y= y+1
pattern = RD_p[y-1].reshape((1024,1))
sum3 = sum3 + k * pattern.reshape((32,32))
#sum1 = normalize(((sum1 - np.min(sum1))/(np.max(sum1) - np.min(sum1)))*256)
#image_ghost = Image.fromarray(sum1)
#image_ghost = image_ghost.convert('L')
sum2[0,0] = np.mean(sum2)
sum3[0,0] = np.mean(sum3)
plt.figure()
plt.subplot(131)
plt.title("Full Samples",fontsize =18)
plt.imshow(sum1,cmap = plt.cm.gray)
plt.axis('off')
plt.subplot(132)
plt.title("Bigger "+str(NUM_HADAMARD),fontsize =18)
plt.imshow(sum2,cmap = plt.cm.gray)
plt.axis('off')
plt.subplot(133)
plt.title("First " +str(NUM_HADAMARD),fontsize =18)
plt.imshow(sum3,cmap = plt.cm.gray)
plt.axis('off')
plt.show()<file_sep>import tensorflow as tf
import numpy as np
def inference(input_data):
with tf.variable_scope('fc1') as scope:
# X = tf.placeholder(tf.float32,[1 256],name = 'X1')
weights = tf.get_variable('w1',
shape = [256,1024],
dtype = tf.float32,
initializer = tf.truncated_normal_initializer(stddev=0.03,dtype=tf.float32))
bias = tf.get_variable('b1',shape=[1024],dtype = tf.float32 ,initializer = tf.constant_initializer(0.1))
Y = tf.add(tf.matmul(input_data,weights),bias)
output1 = tf.nn.relu(Y,name = scope.name)
with tf.variable_scope('fc2') as scope:
weights = tf.get_variable(name = 'w2',
shape = [1024,1024],
dtype = tf.float32,
initializer = tf.truncated_normal_initializer(stddev=0.03,dtype = tf.float32))
bias = tf.get_variable(name ='b2',
shape = [1024],
dtype = tf.float32,
initializer = tf.constant_initializer(0.1))
output2 = tf.nn.relu(tf.add(tf.matmul(output1,weights),bias),name = scope.name)
with tf.variable_scope('fc3') as scope:
weights = tf.get_variable(name = 'w3',
shape = [1024,256],
dtype = tf.float32,
initializer = tf.truncated_normal_initializer(stddev=0.03,dtype = tf.float32))
bias = tf.get_variable(name ='b3',
shape = [256],
dtype = tf.float32,
initializer = tf.constant_initializer(0.1))
output2 = tf.add(tf.matmul(output1,weights),bias,name = scope.name)
return output2<file_sep>import numpy as np
from PIL import Image
import matplotlib.pylab as plt
import pandas as pd
#plt.rcParams['figure.figsize'] = (10, 12.0)
NUM_HADAMARD = 64
#def normalize(y):
# a,b=np.shape(y)
# n = np.zeros((a,b))
# for i in range(a):
# for j in range(b):
# n[i,j] = np.int(y[i,j])
# return n
RD_dir = u'C:/Users/zh/Desktop/hadamard/32RD.png'
RD=Image.open(RD_dir)
RD = np.array(RD)
CC = np.ones((1024,1024))
RD_p = 2*RD - CC
RD_anti = -1 * RD_p
#RD_n = -1 * RD_p
# K = 256
# RD_use =np.vstack((RD_p[0:K,:],RD_n[0:K,:])) #创造需要使用的 Hadamard 矩阵
#NUM_PICTURE = 42000
#RATIO = 0.1
DIM = 1024
#i = np.random.randint(100)
#rand_pattern = np.random.randn(DIM,DIM)
signals = []
for i in range(40000):
filename1 = 'F:\Code\kaggle\Digit Recognizer\image\image' + '%d' % i+ '.jpg'
x = Image.open(filename1)
image_test = x.resize((32,32))
image_test = np.array(image_test)
pic = image_test.reshape((1,1024))
sum1 = np.zeros((32,32))
signal = []
for j in range(1024):
RD_pattern = RD_p[j].reshape((1024,1))
anti_pattern = RD_anti[j].reshape((1024,1))
pattern = RD_p[j].reshape((1024,1))
temp = np.dot(pic,RD_pattern) - np.dot(pic,anti_pattern)
signal.append(temp)
sum1 = sum1 + temp * pattern.reshape((32,32))
if i%2000 == 0:
print("Have finished %d signal" %i)
signal = np.squeeze(signal)
signals.append(signal)
#sig = np.squeeze(signals)
data_full_samples = pd.DataFrame(data = signals)
data_full_samples.to_csv('F:/Code/signal-signal_fromscratch/data/data_full_samples.csv')
print("Signals have been written in CSV")
#**********************************************
#**********************************************
#**********************************************#**********************************************
#**********************************************#**********************************************
#**********************************************#**********************************************
#**********************************************#**********************************************
#**********************************************#**********************************************
x = pd.read_csv('F:/Code/signal-signal_fromscratch/data/data_full_samples.csv')
original_signals =np.array(x)
original_signals =original_signals[:,1:]
print("We get the original data")
signals_full_sample = np.abs(original_signals)
def normalize(x):
return (x - np.min(x))/(np.max(x) - np.min(x))*255
signals_normalized = []
for i in range(signals_full_sample.shape[0]):
one_of_signals = normalize(signals_full_sample[i])
signals_normalized.append(one_of_signals)
signals_normalized = np.array(signals_normalized)
print(signals_normalized.shape)
print("Signals normalize have been finished ")
preSort_signals = np.sum(signals_normalized,axis=0)
#signal_abs = np.abs(np.squeeze(signal))
signal_dict = {}
j= 0
for i in preSort_signals:
j = j+1
signal_dict[j] = i
xxx =sorted(signal_dict.items(),key = lambda items:items[1],reverse = True)
collect_sorted_signal= [i[0] for i in xxx]
print("We get the collective sorted picture index !")
haha = pd.DataFrame(collect_sorted_signal)
haha.to_csv('F:/Code/signal-signal_fromscratch/data/collect_sorted_index.csv')
collect_sorted_signal1 = [x-1 for x in collect_sorted_signal]
sorted_signals =original_signals[:,collect_sorted_signal1]
sorted_signals_pd = pd.DataFrame(sorted_signals)
sorted_signals_pd.to_csv('F:/Code/signal-signal_fromscratch/data/sorted_signals.csv')<file_sep>import numpy as np
from PIL import Image
import matplotlib.pylab as plt
import pandas as pd
import os
import tensorflow as tf
def load_data(data_dir):
data = np.array(pd.read_csv(data_dir))
return data[:,1:]
def save_data(x,data_dir):
save_data = pd.DataFrame(x)
save_data.to_csv(data_dir)
def save_model(sess,ckpt_dir,global_step,model_name='signaltosignal'):
saver = tf.train.Saver()
checkpoint_dir = ckpt_dir
if not os.path.exists(checkpoint_dir):
os.makedirs(checkpoint_dir)
print("Saving model....")
saver.save(sess,os.path.join(checkpoint_dir,model_name),global_step = global_step)
def load_model(ckpt_dir):
print("Loading model...")
saver = tf.train.Saver()
ckpt = tf.train.get_checkpoint_state(ckpt_dir)
if ckpt and ckpt.model_checkpoint_path:
full_path = tf.train.latest_checkpoint(ckpt_dir)
global_step = int(full_path.split('/')[-1].split('-')[-1])
saver.restore(sess,full_path)
return True,global_step
else :
return False,0
def save_image(file_name,original_image,generate_image,noise_image):
original_image = normalize(np.squeeze(original_image))
generate_image = normalize(np.squeeze(generate_image))
noise_image = normalize(np.squeeze(noise_image))
image = np.concatenate([original_image,generate_image,noise_image],axis = 1)
im = Image.fromarray(image.astype('uint8')).convert('L')
im.save(file_name, 'png')
def normalize(x):
return (x - np.min(x))/(np.max(x) - np.min(x))*255 <file_sep>import tensorflow as tf
import numpy as np
from utils import *
from model import inference
def train(Xdata , Ydata ,Xevaldata,Yevaldata,sort_index,RD_p, learning_rate = 0.0001, epoch = 20 , batch_size = 32):
# tf.reset_default_graph()
logs = r"F:/Code/signal-signal_fromscratch/logs/"
ckpt = r"F:/Code/signal-signal_fromscratch/checkpoints/"
sample_dir = r'F:/Code/signal-signal_fromscratch/data/evaluate'
X = tf.placeholder(dtype = tf.float32, shape =[None,256] ,name = 'X')
Y = tf.placeholder(name = 'Y', shape =[None,256] ,dtype = tf.float32)
output = inference(X)
losses = tf.reduce_mean(tf.square(output-Y))
tf.summary.scalar('loss',losses)
optimizer = tf.train.AdamOptimizer(learning_rate = learning_rate)
train_op = optimizer.minimize(losses)
init = tf.global_variables_initializer()
print("Start training ...")
print("Please wait for a while ...")
with tf.Session() as sess:
sess.run(init)
iter_num = 0
merged = tf.summary.merge_all()
summary_writer = tf.summary.FileWriter(logs,sess.graph)
numBatch = np.int(Xdata.shape[0]/batch_size)
for i in range(epoch):
for batch_id in range(numBatch):
batch_Xdata = Xdata[batch_id*batch_size:(batch_id+1)*batch_size,:]
batch_Ydata = Ydata[batch_id*batch_size:(batch_id+1)*batch_size,:]
_ , loss,summary = sess.run([train_op , losses,merged] , feed_dict ={X:batch_Xdata ,Y:batch_Ydata })
iter_num += 1
summary_writer.add_summary(summary,iter_num)
if i%2 == 0:
print("epoch %d loss %f " % (i,loss))
if i%10 == 0:
print("Evaluating ...")
for j in range(Xevaldata.shape[0]):
data = [Xevaldata[j][:]]
eval_out = sess.run(output,feed_dict = {X:data})
sum1 = np.zeros((32,32))
sum2 = np.zeros((32,32))
sum3 = np.zeros((32,32))
y = 0
for k in np.squeeze(eval_out):
y = y+1
pattern = RD_p[sort_index[y-1]].reshape((1024,1))
sum1 = sum1 + Xevaldata[j][y-1] * pattern.reshape((32,32))
sum2 = sum2 + Yevaldata[j][y-1] * pattern.reshape((32,32))
sum3 = sum3 + k * pattern.reshape((32,32))
sum1[0,0] = np.mean(sum1)
sum2[0,0] = np.mean(sum2)
sum3[0,0] = np.mean(sum3)
save_image(os.path.join(sample_dir, 'test%d_%d.png' % (y, iter_num)),sum2,sum1,sum3)
save_model(sess,ckpt,iter_num)
<file_sep>import tensorflow as tf
import numpy as np
from train import *
from utils import *
#plt.rcParams['figure.figsize'] = (10, 12.0)
NUM_HADAMARD = 256
sort_index = pd.read_csv('F:/Code/signal-signal_fromscratch/data/collect_sorted_index.csv')
sort_index = np.array(sort_index)
sort_index = sort_index[:,1:]
sort_index = [x-1 for x in sort_index]
RD_dir = u'C:/Users/zh/Desktop/hadamard/32RD.png'
RD=Image.open(RD_dir)
RD = np.array(RD)
CC = np.ones((1024,1024))
RD_p = 2*RD - CC
RD_anti = -1 * RD_p
x = load_data('F:/Code/signal-signal_fromscratch/data/sorted_noise_signals.csv')
y = load_data('F:/Code/signal-signal_fromscratch/data/sorted_signals.csv')
x_train_data = x[:39895,:256]
y_train_data = y[:39895,:256]
x_test_data = x[39895:39995,:256]
y_test_data = y[39895:39995,:256]
x_eval_data = x[39995:,:256]
y_eval_data = y[39995:,:256]
BATCH_SIZE = 64
if __name__=='__main__':
train(x_train_data,y_train_data,x_eval_data,y_eval_data,sort_index,RD_p,epoch = 50)
print("The train has been done . -_-")<file_sep>思路 and 笔记
1.文件夹设置。
2.子程序
(1)数据预处理
(2)建立前向传播 inference:
tf.get_variables(name,shape,dtype,initializer) tf.Variable(constant,name) 变量
tf.placeholder(dtype,shape,name)
(3)loss\optimizer\global_variable_initializer\sess.run\learning_rate\batch_size
batch 这里有一个除不尽的问题 有些数据没用到
(4)summary(tensorboard) / ckpt(save_model)
双斜杠,即tensorboard --logdir=E://MyTensorBoard//logs
(5)一边train 一边evaluate
3.数据
①. 40000张图片 通过关联成像仿真 得到 40000个 1024维信号 √
②. 每个信号单独归一化,到0~255. 将所有信号相加 再进行排序 得到256张图片的序号 √
③. 通过序号图片进行成像 (检查) √ (这种排序效果一般,因为数据太多太不同 40000张图综合排序)
④. 给相应的序号的 [1,256]维 信号增加噪声 (加性噪声 乘性噪声)
⑤. 通过深度学习给信号去噪 。 (这里有个疑问,我们已知hadamard图片,信号到图片只需要进行关联计算即可)
<file_sep>import numpy as np
from PIL import Image
import matplotlib.pylab as plt
import pandas as pd
#plt.rcParams['figure.figsize'] = (10, 12.0)
NUM_HADAMARD = 64
RD_dir = u'C:/Users/zh/Desktop/hadamard/32RD.png'
RD=Image.open(RD_dir)
RD = np.array(RD)
CC = np.ones((1024,1024))
RD_p = 2*RD - CC
RD_anti = -1 * RD_p
#RD_n = -1 * RD_p
# K = 256
# RD_use =np.vstack((RD_p[0:K,:],RD_n[0:K,:])) #创造需要使用的 Hadamard 矩阵
#NUM_PICTURE = 42000
#RATIO = 0.1
DIM = 1024
#i = np.random.randint(100)
signals = []
for i in range(200):
filename1 = 'F:\Code\kaggle\Digit Recognizer\image\image' + '%d' % i+ '.jpg'
x = Image.open(filename1)
image_test = x.resize((32,32))
image_test = np.array(image_test)
pic = image_test.reshape((1,1024))
sum1 = np.zeros((32,32))
signal = []
for j in range(1024):
RD_pattern = RD_p[j].reshape((1024,1))
anti_pattern = RD_anti[j].reshape((1024,1))
pattern = RD_p[j].reshape((1024,1))
temp = np.dot(pic,RD_pattern) - np.dot(pic,anti_pattern)
signal.append(temp)
sum1 = sum1 + temp * pattern.reshape((32,32))
if i%2000 == 0:
print("Have finished %d signal" %i)
signal = np.squeeze(signal)
signals.append(signal)
plt.figure()
for i in range(200):
sum3 = np.zeros((32,32))
signal = signals[i]
y=0
for k in signal[:1024]:
y= y+1
pattern = RD_p[y-1].reshape((1024,1))
sum3 = sum3 + k * pattern.reshape((32,32))
sum3[0,0] = np.mean(sum3)
plt.imshow(sum3,cmap = plt.cm.gray)
plt.axis('off')
plt.pause(2)
# plt.show() | 93b854bce7252bd14893599e8bed2ca90f968c41 | [
"Python",
"Text"
] | 8 | Python | Wink-Xu/signaltosignal_demo | 3787ca7f7a79dee58d643e1572cead39231e785b | a37feb3e99c5b1c5b3cff363093cbb7bd56139eb |
refs/heads/master | <repo_name>EnochSpevivo/fls-international<file_sep>/src/components/application/PersonalInfo.js
import React, { useState } from 'react';
import Formsy from 'formsy-react';
import _isNil from 'lodash.isnil';
import { getCode } from 'country-list';
import TextInput from 'src/components/application/form/TextInput';
import SelectInput from 'src/components/application/form/SelectInput';
import DateInput from 'src/components/application/form/DateInput';
import CountryInput from 'src/components/application/form/CountryInput';
// TODO: Figure out how best to handle validation
export default function PersonalInfo({
nextStep,
userData,
handleApplicationState,
}) {
const genderOptions = [
{ label: 'Male', value: 'Male' },
{ label: 'Female', value: 'Female' },
{ label: 'Non-binary', value: 'Non-binary' },
];
const [isValidForm, setIsValidForm] = useState();
return (
<Formsy
onChange={handleApplicationState}
onValid={() => setIsValidForm(true)}
onInvalid={() => setIsValidForm(false)}
>
<div className="columns is-multiline">
<div className="column is-full">
<div className="application__header-container">
<h3 className="fls-post__title">
Personal Information
</h3>
</div>
</div>
<div className="column is-one-third">
<TextInput
validations="isExisty"
validationError="Field cannot be blank"
name="firstName"
placeholder="<NAME>"
value={userData.firstName}
label={'<NAME>'}
required
/>
</div>
<div className="column is-one-third">
<TextInput
validations="isExisty"
validationError="Field cannot be blank"
name="lastName"
placeholder="<NAME>"
value={userData.lastName}
label={'<NAME>'}
required
/>
</div>
<div className="column is-one-third">
<TextInput
validations="isEmail"
validationError="Cannot be blank and must be a valid email."
name="email"
placeholder="Email"
value={userData.email}
label={'Email'}
required
/>
</div>
<div className="column is-one-third">
<TextInput
validations="isNumeric"
validationError="Cannot be blank and must only contain numbers."
name="phoneNumber"
placeholder="Phone Number"
value={userData.phoneNumber}
label={'Phone Number'}
required
/>
</div>
<div className="column is-one-third">
<SelectInput
name="gender"
label={'Gender'}
value={{
label: userData.gender,
value: userData.gender,
}}
options={genderOptions}
/>
</div>
<div className="column is-one-third">
<DateInput
validations="isExisty"
validationError="Please select a date."
label={'Date of Birth'}
selected={
!_isNil(userData.birthDate)
? userData.birthDate
: userData.birthDate
}
name={'birthDate'}
placeholderText={'Birthday (MM/DD/YY)'}
required
/>
</div>
<div className="column is-one-third">
<CountryInput
validations="isExisty"
validationError="Please select a country."
label={'Country of Citizenship'}
defaultCountry={
userData.citizenshipCountry
? getCode(userData.citizenshipCountry)
: null
}
name={'citizenshipCountry'}
searchable={true}
required
/>
</div>
<div className="column is-one-third">
<CountryInput
validations="isExisty"
validationError="Please select a country."
label={'Country of Birth'}
defaultCountry={
userData.birthCountry
? getCode(userData.birthCountry)
: null
}
searchable={true}
name={'birthCountry'}
required
/>
</div>
{/* TODO: Arrow icon */}
<div className="column is-offset-8 is-4">
<button
onClick={() => {
nextStep();
}}
disabled={!isValidForm}
className={
isValidForm
? 'fls__button'
: 'fls__button fls__button--disabled'
}
>
Save & Continue
</button>
</div>
</div>
</Formsy>
);
}
<file_sep>/src/pages/contact.js
import React from 'react';
import Layout from 'src/components/Layout';
import Section from 'src/components/section/Section';
import 'src/styles/contact-us.scss';
export const ContactUsTemplate = () => {
// TODO: This is a critical page that needs to be generated by the CMS. It should be possible to dynamically generate pages like this entirely through the CMS
return (
<Section>
<div className="columns">
<div className="column is-5">
<div className="columns">
<div className="column is-full">
<div className="contact-us__email-call-container">
<div className="contact-us__email fls__blue-gradient-bg">
<span className="icon-envelop icon-envelop--contact-us"></span>
<div className="contact-us__email-call-title">
Email Us
</div>
<div className=""><EMAIL></div>
</div>
<div className="contact-us__call">
<span className="icon-phone icon-phone--contact-us"></span>
<div className="contact-us__email-call-title">
Call Us
</div>
<div className="">(626) 795-2912</div>
</div>
</div>
</div>
</div>
<div className="column is-full">
<div className="contact-us__address-container">
<span className="icon-location icon-location--contact-us"></span>
<div className="contact-us__title">Address</div>
<a
className="contact-us__address"
target="_blank"
href="https://goo.gl/maps/2Je8N1Goh3uWuZDE8"
>
680 E Colorado Blvd Suite 180 Second Floor
Pasadena, CA 91101
</a>
</div>
</div>
</div>
<div className="column is-7">
<div className="columns is-multiline">
<div className="column is-full">
<h3 className="contact-us__title">
Looking For Answers?
</h3>
<p className="contact-us__copy">
Do you want free information on how to learn
English In America? Are you looking for Study
Travel or College Pathway options? Contact us.
Find out if FLS is the right option for you.
</p>
<h3 className="contact-us__subtitle">Contact Us</h3>
</div>
<div className="column is-full">
<div className="columns is-multiline">
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input fls__text-input"
type="text"
placeholder="<NAME>"
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input fls__text-input"
type="text"
placeholder="<NAME>"
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input"
type="email"
placeholder="Email Address"
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input"
type="tel"
placeholder="Phone Number"
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field has-addons">
<div className="control is-expanded">
<div className="select is-fullwidth">
<select>
<option>
United States
</option>
<option>
Other Countries
</option>
</select>
</div>
</div>
</div>
</div>
<div className="column is-full">
<div className="field">
<div className="control">
<textarea
className="textarea has-fixed-size"
placeholder="Message"
></textarea>
</div>
</div>
</div>
<div className="column is-half">
<button className="fls__button">
Send Message
</button>
</div>
<div className="column is-full">
<h3 className="contact-us__title">
Looking For Answers?
</h3>
<ul>
<li className="fls__list-item contact-us__copy">
Tips and information on learning
English in America
</li>
<li className="fls__list-item contact-us__copy">
Answers to questions regarding
student visas
</li>
<li className="fls__list-item contact-us__copy">
Help with transfers and admissions
to U.S. Colleges
</li>
<li className="fls__list-item contact-us__copy">
Information on housing, and so much
more
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</Section>
);
};
const ContactUsPage = ({ data }) => {
// const { frontmatter } = data.markdownRemark;
return (
<Layout isScrolled={true} hasNavHero={true} pageTitle={'Contact Us'}>
<ContactUsTemplate />
</Layout>
);
};
export default ContactUsPage;
// TODO: Here, all the individual fields are specified.
// Is there a way to just say 'get all fields'?
// export const pageQuery = graphql`
// query {
// markdownRemark {
// frontmatter {
// program_cards {
// card_description
// card_image
// card_title
// }
// }
// }
// }
// `;
<file_sep>/src/pages/locations-centers/index.js
import React, { Fragment } from 'react';
import { graphql, useStaticQuery } from 'gatsby';
import 'src/bulma/bulma.scss';
// TODO: Eventually, css module this
// import programsStyles from 'src/styles/Programs.module.scss';
import 'src/styles/locations.scss';
import Layout from 'src/components/Layout';
import Section from 'src/components/section/Section';
import Card from 'src/components/card/Card';
export const LocationsPageTemplate = ({ data }) => {
const locations = data.allMarkdownRemark.edges.map(
edge => edge.node.frontmatter
);
return (
<Section
sectionClasses={['section', 'programs']}
containerClasses={['container']}
>
<div className="columns is-multiline">
{locations.map(location => (
<div className="column is-one-third-desktop is-half-tablet">
<Card isLocation={true} cardData={location} />
</div>
))}
</div>
</Section>
);
};
const LocationsPage = (
{
/*data*/
}
) => {
const data = useStaticQuery(graphql`
{
allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/pages/dynamic/locations//" }
}
) {
edges {
node {
frontmatter {
path
name
centerNameRelation
carousel_images
name
description
}
}
}
}
}
`);
return (
<Layout isScrolled={true} hasNavHero={true} pageTitle={'Locations'}>
<LocationsPageTemplate data={data} />
</Layout>
);
};
export default LocationsPage;
<file_sep>/src/netlify-content/data/programs/in-person/general-english-2.md
---
name: <NAME>
location:
- Citrus College
- Saddleback College
centerNameRelation:
- Citrus College
- Saddleback College
durationOptions:
maxWeeks: 32
exceedMaxWeeks: true
weekThresholds:
- thresholdMax: 3
pricePerWeek: 430
- pricePerWeek: 415
thresholdMax: 11
- thresholdMax: 23
pricePerWeek: 400
- thresholdMax: 31
pricePerWeek: 380
- thresholdMax: 32
pricePerWeek: 360
hoursPerWeek: '20'
lessonsPerWeek: 24
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/data/programs/online/virtual-cinema-camp-1.md
---
name: <NAME>
onlineProgramType: Online Summer Camp
durationOptions:
maxWeeks: 2
priceDetails:
price: 390
payPeriod: weekly
hoursPerWeek: '10'
lessonsPerWeek: 9
minutesPerLesson: 50
timesOffered:
- 6:00 AM
- 6:00 PM
termDates:
- start: 7/6
end: 7/17
- start: 7/20
end: 7/31
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/acting-camp.md
---
name: <NAME>
centerNameRelation:
- Cal State Long Beach (Summer Only)
minimumAge: 15
priceDetails:
package:
duration: 3
price: 4450
payPeriod: once
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Aug 1st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/pages/dynamic/programs/in-person/toefl-preparation.md
---
path: toefl-preparation
name: TOEFL Preparation
hero-image: /assets/dsc08818.jpg
programDetails:
lessonsPerWeek: 36
hoursPerWeek: "30"
minutesPerLesson: 50
description: Take your TOEFL score to new heights with our proven preparation program!
program-post-content: >-
### Take your TOEFL score to new heights with our proven preparation program!
International students often face great challenges in order to enter American colleges and universities. These include the need to achieve English fluency and obtain high scores on standardized tests. The FLS TOEFL Preparation Program helps you meet those challenges. This popular program is specifically designed to give students a critical advantage in taking the most commonly accepted exam at American institutions.
Our comprehensive program includes a total of 36 teacher-led lessons per week. These include 18 lessons of integrated study to improve all English skills, 12 lessons devoted to specific TOEFL strategies and skills and 6 lessons of Academic Workshops for additional language practice and skill development.
Students work with an experienced instructor to hone their ability in the interrelated TOEFL skills of reading, writing, listening and speaking. Practice exams allow instructors to analyze students' abilities and familiarize students with the test format and strategies.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
program-features-content: >-
## PROGRAM FEATURES
All TOEFL Preparation Program students enjoy these exceptional features:
* Small class sizes of 15 or fewer, guaranteeing individual attention from your teacher.
* Core Class emphasizing the four key language skills: speaking, listening, reading and writing.
* TOEFL Preparation class featuring practice tests, analytics, and concentrated practice in reading comprehension, writing, and advanced listening skills.
* Lab-style Academic Workshop offering a range of academic options each week, including Pronunciation Clinics, Conversation Clubs, Homework Labs, Computer Labs, and more.
* Our exclusive English Everywhere program with weekly Hot Sheets, involving your host family, activity guides and FLS staff in your learning process.
* Weekly English tests and individualized progress reports every four weeks.
* Language Extension Day (LED) activities once per term, encouraging students to use English in new settings and contexts.
* Readers to increase reading comprehension and understanding of American culture.
* Access to numerous free activities and specially priced excursions.
* Certificate of Completion upon successful graduation from each level.
* Articulation agreements with numerous colleges allowing admission without a TOEFL score based on completion of the designated FLS level.
* Personalized counseling and academic assistance.
program-details:
lessons-per-week: 36
hours-per-week: 30
minutes-per-lesson: 50
pageName: TOEFL Preparation
programType: in-person
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/core-english.md
---
path: online-core
name: Core English
type: Online Pathway Program
hero-image: /assets/dsc08677.jpg
programDetails:
lessonsPerWeek: 18
hoursPerWeek: "15"
minutesPerLesson: 50
description: Master the fundamentals of English
program-post-content: >-
For those looking for a part-time yet robust study option, our Core English
Program offers the perfect schedule, providing a thorough study of English
fundamentals with an easy to manage time commitment. Learn the fundamentals
of English in our core integrated skills course.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
As part of our Online Pathway Program you will participate via webcam with a live in-person class.
program-features-content: >-
### Program Features:
* 3 hours of study per day/ 15 hours per week
* 18 levels
* Textbooks and materials provided
* Small class size
* All classes taught by TEFL-certified teachers with native fluency in American English
---
<file_sep>/src/netlify-content/data/general-fees/online/application-fee.md
---
name: Application Fee
priceDetails:
price: 50
payPeriod: Once
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/acting-camp-1.md
---
name: Computer Science
centerNameRelation:
- Cal State Long Beach (Summer Only)
price: 4675
duration: 3
minimumAge: 12
priceDetails:
package:
price: 4675
payPeriod: once
duration: 3
programDates:
- arrive: 2021-06-20T07:00:00.000Z
depart: 2021-07-10T07:00:00.000Z
- arrive: Jul 11th, 2021
depart: Aug 1st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/toefl-sat.md
---
name: TOEFL/SAT
centerNameRelation:
- Suffolk University
price: 4875
duration: 3
minimumAge: 15
priceDetails:
range:
maxWeeks: 3
weekThresholds:
- thresholdMax: 3
pricePerWeek: 1625
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/data/locations/cal-state-fullerton.md
---
name: Orange County, CA
centerName: Saddleback College (Summer Only)
---
<file_sep>/src/netlify-content/data/programs/in-person/intensive-english-1.md
---
name: <NAME>
location:
- Boston Commons
centerNameRelation:
- Boston Commons
durationOptions:
maxWeeks: 32
exceedMaxWeeks: true
weekThresholds:
- thresholdMax: 3
pricePerWeek: 505
- thresholdMax: 11
pricePerWeek: 465
- thresholdMax: 23
pricePerWeek: 445
- thresholdMax: 31
pricePerWeek: 420
- thresholdMax: 32
pricePerWeek: 400
hoursPerWeek: '25'
lessonsPerWeek: 30
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/pages/dynamic/programs/in-person/intensive-english.md
---
path: intensive-english
name: Intensive English
hero-image: /assets/intensive-english.jpeg
programDetails:
lessonsPerWeek: 30
hoursPerWeek: "25"
minutesPerLesson: 50
description: Our most popular program, the Intensive English Program includes 30
lessons of instruction per week from qualified, native-speaking teachers.
program-post-content: >-
### Our most popular program!
The Intensive English Program includes 30 lessons of instruction per week from qualified, native-speaking teachers.
This program is a comprehensive approach to studying English, ensuring that students develop well-rounded English abilities. Students have the advantage of three different classes: an integrated Core Class at one of 18 FLS levels, a focused elective class covering a specific skill or topic and an Academic Workshop to round out the school day.
Our program places an exceptional emphasis on speaking. Students practice speaking skills frequently in class, receiving regular guidance and correction from their instructor.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
program-features-content: >-
## PROGRAM FEATURES
All Intensive English Program students enjoy these exceptional features:
* Eighteen levels of study from low beginner to high advanced.
* Small class sizes of 15 or fewer, guaranteeing individual attention from your teacher.
* Core Class emphasizing the four key language skills: speaking, listening, reading and writing.
* An Elective Class devoted to a specific topic or skill, such as Slang, Business English, American Culture, Public Speaking, Grammar, or Composition.
* Lab-style Academic Workshop offering a range of academic options each week, including Pronunciation Clinics, Conversation Clubs, Homework Labs, Computer Labs, and more.
* Our exclusive English Everywhere program with weekly Hot Sheets, involving your host family, activity guides and FLS staff in your learning process.
* Weekly English tests and individualized progress reports every four weeks.
* Language Extension Day (LED) activities once per term, encouraging students to use English in new settings and contexts.
* Readers and novels to increase reading comprehension and understanding of American culture (for High Beginner and above).
* Access to numerous free activities and specially priced excursions.
* Certificate of Completion upon successful graduation from each level.
* Articulation agreements with numerous colleges allowing admission without a TOEFL score based on completion of the designated FLS level.
* Personalized counseling and academic assistance.
program-details:
lessons-per-week: 30
hours-per-week: 25
minutes-per-lesson: 50
pageName: Intensive English
programType: in-person
---
<file_sep>/src/components/post-navbar/PostNavbar.js
import React from 'react';
import { Link } from 'gatsby';
import postNavbarStyles from './PostNavbar.module.scss';
export default function PostNavbar({ data }) {
return (
<div className="column is-full-desktop is-half-tablet">
{data.map(mappedData => {
return (
<Link
key={mappedData.path}
className={postNavbarStyles.fls__postNavbarItem}
to={mappedData.path}
>
<span>{mappedData.name}</span>
</Link>
);
})}
</div>
);
}
<file_sep>/src/netlify-content/data/general-fees/in-person/express-mail-fee.md
---
name: <NAME>
centerNameRelation:
- Boston Commons
- Citrus College
- Saddleback College (Summer Only)
- Cal State Long Beach (Summer Only)
- Harvard University Campus
- Marymount Manhattan College
- Suffolk University
- Chestnut Hill College (from Summer, 2021)
priceDetails:
price: 65
payPeriod: Once
---
<file_sep>/src/netlify-content/data/programs/online/young-learner-english.md
---
name: <NAME>
onlineProgramType: Online Essential Program
durationOptions:
maxWeeks: 36
exceedMaxWeeks: true
minWeeks: 1
hoursPerWeek: "3"
lessonsPerWeek: 6
minutesPerLesson: 30
timesOffered:
- 3:00 AM
- 3:00 PM
termDates: []
---
<file_sep>/src/components/application/AdditionalInfoFormHeader.js
import React, { Fragment } from 'react';
import ReactTooltip from 'react-tooltip';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faChevronLeft } from '@fortawesome/free-solid-svg-icons';
export default function AdditionalInfoFormHeader({
programType,
calculatePrice,
prices,
handleDataChange,
setApplicationData,
setPrices,
}) {
return (
<Fragment>
<ReactTooltip
type="info"
effect="solid"
html={true}
multiline={true}
className="fls__tooltip"
clickable={true}
/>
<div className="column is-full">
<div className="application__header-container">
<h3 className="fls-post__title">
{/* TODO: This section, before the program specific info form component, needs to be DRYed */}
{`Additional Info - ${programType.replace(/-/g, ' ')}`}
</h3>
<h3 className="application__total-price">
Total Price: ${calculatePrice(prices)}
</h3>
</div>
</div>
<div className="column is-full">
<button
className="fls__button fls__button--half"
onClick={() => {
handleDataChange('programType', '', 'application');
setApplicationData({});
setPrices([]);
}}
>
<FontAwesomeIcon
className="fls-post__subhero-icon"
icon={faChevronLeft}
/>{' '}
Return to Program Type Selection
</button>
</div>
</Fragment>
);
}
<file_sep>/src/netlify-content/data/programs/in-person/vacation-english.md
---
name: <NAME>
location:
- Boston Commons
centerNameRelation:
- Boston Commons
durationOptions:
maxWeeks: 12
weekThresholds:
- thresholdMax: 3
pricePerWeek: 395
- thresholdMax: 5
pricePerWeek: 390
- pricePerWeek: 385
thresholdMax: 12
hoursPerWeek: '15'
lessonsPerWeek: 18
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/pages/static/home.md
---
carousel_settings:
- title: FLS International
copy: ENGLISH LANGUAGE PROGRAMS, PATHWAYS & SPECIALTY TOURS
carousel-image: /assets/dsc09147-smaller-.jpg
- title: Start Your Journey
copy: FLS PROVIDES OUTSTANDING VALUES IN ENGLISH PROGRAMS.
carousel-image: /assets/home-carousel-2.jpeg
- copy: FLS HAS THE RIGHT OPTIONS FOR INTERNATIONAL STUDENTS
carousel-image: /assets/our-programs-geo-.jpg
title: FIND YOUR EDUCATIONAL FUTURE
explore_your_world:
title: EXPLORE YOUR WORLD
subtitle: Study in the U.S.A.
copy: Choose any of our destinations in the U.S. and you'll find yourself in a
great place to explore America, learn English and meet other students from
around the world!
start_your_journey:
title: Start Your Journey!
subtitle: Welcome to Our School
copy: FLS provides outstanding values in high quality English programs. To find
your program’s price, try our easy cost tool.
our_popular_programs:
title: Popular Programs
subtitle: Our
copy: Having over 9 million students worldwide and more than 50,000 online
courses available.
how_is_your_english:
title: Your English
subtitle: How Is
copy: >-
Test your English ability and find your approximate FLS level with our FREE
test!
Sign up to take our brief test and receive your results.
An FLS representative can then help you make a study plan to meet your goals.
---
<file_sep>/src/netlify-content/data/programs/in-person/vacation-english-2.md
---
name: <NAME>
location:
- Citrus College
- Saddleback College
centerNameRelation:
- Citrus College
- Saddleback College
durationOptions:
maxWeeks: 12
weekThresholds:
- thresholdMax: 3
pricePerWeek: 395
- thresholdMax: 7
pricePerWeek: 385
- thresholdMax: 12
pricePerWeek: 375
hoursPerWeek: '15'
lessonsPerWeek: 18
minutesPerLesson: 50
---
<file_sep>/src/components/horizontal-nav/HorizontalNav.js
import React from 'react';
import navHeroStyles from './HorizontalNav.module.scss';
export default function NavHero({ navItems = [], isDownloads }) {
return (
<div className="column is-full">
<div className={`columns is-multiline ${navHeroStyles.fls__nav}`}>
{navItems.map(navItem => {
return (
<div
className={`column is-2-desktop is-one-third-tablet ${
navHeroStyles.fls__navItem
} ${isDownloads ? 'fls__nav-item--downloads' : ''}`}
>
{navItem}
</div>
);
})}
</div>
</div>
);
}
<file_sep>/src/netlify-content/navbar-items/partners.md
---
path: "#"
name: Partners
order: 7
links:
- isExternalLink: true
path: http://www.uppcolleges.com/
name: UPP
links: []
- path: https://flstutors.com/
name: <NAME>
isExternalLink: true
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/stem.md
---
path: stem
name: STEM
centerNameRelation:
- Harvard University Campus
programDates:
- arrive: Jun 27th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 24th, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/stem-1.jpeg
- /assets/stem-2.jpg
programDetails:
minimumAge: 12
duration: 2
price: 4325
durationRelation: 2
specialty-tour-description: >-
Located in Cambridge, Harvard University is the oldest and most revered
institution of higher education in the United States and the perfect
environment to inspire young people to excel academically. Our innovative STEM
Camp gives students the invaluable opportunity to engage with these vibrant
fields at this exceptional location. Working closely with their teacher on
robotics projects, students will exercise a wide range of skills.
Students will enjoy university dormitory accommodation in downtown Boston and benefit from an environment rich with historical and educational landmarks. Our camp is rounded off with stimulating visits to MIT, the Museum of Science, the New England Aquarium, and more.
activities-and-excursions: |-
* Newbury Street
* Faneuil Hall and Quincy Market
* Beacon Hill and the State House
* Harvard University and Harvard Square
* New England Aquarium
* MIT Tour
* Freedom Trail
* Duck Tour
### Optional Tours available:
* New York Weekend
features: |-
* 18 lessons on STEM topics each week
* Evening games, sports, movies, and parties
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation at Suffolk University
* Includes three meals on weekdays, brunch on Saturdays and brunch & dinner on Sundays
---
<file_sep>/src/netlify-content/data/programs/online/essential-english.md
---
name: <NAME>
onlineProgramType: Online Essential Program
durationOptions:
minWeeks: 1
maxWeeks: 52
exceedMaxWeeks: true
hoursPerWeek: '7.5'
lessonsPerWeek: 9
minutesPerLesson: 50
timesOffered:
- 3:00 AM
- 3:00 PM
- 7:00 AM
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/discover-california-winter-and-spring.md
---
path: discover-california-winter-spring
name: Discover California, Winter and Spring
centerNameRelation:
- Citrus College
programDates:
- arrive: Jan 3rd, 2021
depart: Jan 23rd, 2021
- arrive: Jan 10th, 2021
depart: Jan 30th, 2021
- arrive: Jan 17th, 2021
depart: Feb 6th, 2021
- arrive: Jan 24th, 2021
depart: Feb 13th, 2021
- arrive: Jan 31st, 2021
depart: Feb 20th, 2021
- arrive: Feb 7th, 2021
depart: Feb 27th, 2021
- arrive: Feb 14th, 2021
depart: Mar 6th, 2021
- arrive: Feb 21st, 2021
depart: Mar 13th, 2021
- arrive: Feb 28th, 2021
depart: Mar 20th, 2021
- arrive: Mar 7th, 2021
depart: Mar 27th, 2021
- arrive: Mar 14th, 2021
depart: Apr 3rd, 2021
- arrive: Dec 12th, 2021
depart: Jan 1st, 2022
- arrive: Dec 19th, 2021
depart: Jan 8th, 2022
- arrive: Dec 26th, 2021
depart: Jan 15th, 2022
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/discover-california-2.jpeg
programDetails:
minimumAge: 15
duration: 3
price: 3795
durationRelation: 3
specialty-tour-description: Come experience the best of exciting southern
California! This popular program is hosted on the attractive campus of Citrus
College. Citrus is located minutes from downtown Los Angeles in the
comfortable suburb of Glendora, and sits at the base of the San Gabriel
mountains. You'll enjoy the ideal weather and our friendly guides as they take
you to the best attractions in the region and improve your English with our
highly qualified instructors!
activities-and-excursions: |-
* Hollywood
* Beverly Hills
* Old Town Pasadena
* Huntington Library
* Downtown Los Angeles
* USC Tour
* Grand Central Market
* Broad Museum
* California Science Center
* La Brea Tar Pits
* Griffith Observatory
* LA Zoo
### Optional Tours include:
* Disneyland
* Universal Studios
* Knott's Berry Farm
* Six Flags Magic Mountain
* Santa Monica Beach
features: |-
* 18 lessons of English per week
* 20 students or fewer per class
accommodations: |-
* Twin room accommodation with carefully selected American families
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/data/online-program-types/online-essential-program.md
---
name: Online Essential Program
onlineProgramTypeDescription: Our Essential English courses provide you with
instruction from our TEFL-certified teachers and our proven curriculum and
techniques in short blocks to fit your busy lifestyle.
---
<file_sep>/src/pages/index.js
import React, { Fragment } from 'react';
import Slick from 'react-slick';
import { graphql, useStaticQuery, Link } from 'gatsby';
import { formatEdges } from 'src/utils/helpers';
import 'src/bulma/bulma.scss';
import 'slick-carousel/slick/slick.css';
import sectionStyles from 'src/components/section/Section.module.scss';
import Layout from 'src/components/Layout';
import Hero from 'src/components/hero/Hero';
import Section from 'src/components/section/Section';
import Card from 'src/components/card/Card';
import Landing from 'src/components/application/landing/Landing';
import videoSampleImg from 'src/img/video-sample.jpeg';
export const HomePageTemplate = ({ data }) => {
const slickSettings = {
infinite: true,
slidesToShow: 3,
slidesToScroll: 3,
arrows: true,
responsive: [
{
breakpoint: 1023,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 768,
settings: {
slidesToShow: 1,
},
},
],
};
const homeCopy = formatEdges(data.homeCopy);
const programs = data.programs.edges.map(edge => edge.node.frontmatter);
const locations = data.locations.edges.map(edge => edge.node.frontmatter);
return (
<Fragment>
<Hero carouselItems={homeCopy.carousel_settings} />
<Section
sectionClasses={['section', sectionStyles.sectionWhoWeAre]}
containerClasses={['']}
>
<div className="columns is-multiline">
<div className="column is-full-tablet is-half-desktop">
<div
className={`container ${sectionStyles.exploreYourWorld__copyContainer}`}
>
<div
className={
sectionStyles.section__titleContainer
}
>
<h3 className="subtitle subtitle--fls subtitle--red">
{homeCopy.explore_your_world.subtitle}
</h3>
<h1 className="title title--fls">
{homeCopy.explore_your_world.title}
</h1>
</div>
<p className={sectionStyles.exploreYourWorld__copy}>
{homeCopy.explore_your_world.copy}
</p>
</div>
</div>
<div className="column is-full-tablet is-half-desktop fls__home-video">
{/* <img src={videoSampleImg} alt="" /> */}
<iframe
src="https://www.youtube.com/embed/DbmbJZC--h0"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
{/* https://www.youtube.com/watch?v=DbmbJZC--h0&ab_channel=FLSInternational */}
</div>
</div>
</Section>
<Section
sectionClasses={['section', sectionStyles.sectionAlternate]}
>
<div className="columns is-centered">
<div className="column is-6">
<div className={sectionStyles.section__titleContainer}>
<h3 className="subtitle subtitle--fls subtitle--red">
{homeCopy.start_your_journey.subtitle}
</h3>
<h2 className="title title--fls">
{homeCopy.start_your_journey.title}
</h2>
</div>
</div>
</div>
<div className="columns is-multiline">
<div className="column is-half-desktop is-full-tablet">
<p
className={
sectionStyles.startYourJourney__copyContainer
}
>
{homeCopy.start_your_journey.copy}
</p>
</div>
<div className="column is-half-desktop is-full-tablet">
<Landing
isHome={true}
on_location_program_information={
homeCopy.on_location_program_information
}
/>
</div>
</div>
</Section>
<Section>
<div className="columns is-centered">
<div className="column is-7">
<div className={sectionStyles.section__titleContainer}>
<h3 className="subtitle subtitle--fls subtitle--red">
{homeCopy.our_popular_programs.subtitle}
</h3>
<h2 className="title title--fls">
{homeCopy.our_popular_programs.title}
</h2>
</div>
<p className={sectionStyles.popularPrograms__subcopy}>
{homeCopy.our_popular_programs.copy}
</p>
</div>
</div>
<div className="columns is-multiline is-centered">
{programs.map(program => {
return (
<div className="column is-one-quarter-desktop is-half-tablet is-full-mobile">
{/* TODO: These are hard coded to in-person programs, right now */}
<Link
className={
sectionStyles.popularPrograms__programContainer
}
to={`/programs/in-person/${program.path}`}
>
<img
className={
sectionStyles.popularPrograms__bgImg
}
src={program.hero_image}
alt={`${program.name} background image`}
/>
<h3
className={
sectionStyles.popularPrograms__programTitle
}
>
{program.name}
</h3>
</Link>
</div>
);
})}
</div>
<div className="columns is-centered">
<div className="column is-one-quarter-tablet is-full-mobile">
<Link to="/programs" className="fls__button">
View More
</Link>
</div>
</div>
</Section>
<Section
sectionClasses={['section', sectionStyles.highlightedSection]}
>
<div className="columns is-centered">
<div className="column is-6">
<div className={sectionStyles.section__titleContainer}>
<h3
className={`subtitle ${sectionStyles.highlightedSection__subtitle}`}
>
{homeCopy.how_is_your_english.subtitle}
</h3>
<h2 className="title title--fls title--white">
{homeCopy.how_is_your_english.title}
</h2>
</div>
</div>
</div>
<div className="columns is-centered is-multiline">
<div className="column is-half-desktop is-full-tablet">
{/* TODO: Change bullet icons */}
<ul className={sectionStyles.hiye__list}>
<li className="fls__list-item">
Test your English ability and find your
approximate FLS level with our FREE test!
</li>
<li className="fls__list-item">
Sign up to take our brief test and receive your
results.
</li>
<li className="fls__list-item">
An FLS representative can then help you make a
study plan to meet your goals.
</li>
</ul>
</div>
{/* TODO: This needs to be properly reinserted once the proficiency test is integrated into the app */}
{/* <div className="column is-half-desktop is-full-tablet">
<div className="columns is-multiline">
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input fls__text-input fls__text-input--highlighted-section"
type="text"
placeholder="<NAME>"
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input fls__text-input fls__text-input--highlighted-section"
type="text"
placeholder="<NAME>"
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input fls__text-input fls__text-input--highlighted-section"
type="text"
placeholder="Select a Country"
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<div className="control">
<input
className="input fls__text-input fls__text-input--highlighted-section"
type="text"
placeholder="Your Email"
/>
</div>
</div>
</div>
<div className="column is-half">
<p>Are you working with an agency?</p>
</div>
<div className="column is-half">
<div className="control">
<label className="radio">
<input
type="radio"
className="fls-input__radio"
name="answer"
/>
Yes
</label>
<label className="radio">
<input
type="radio"
name="answer"
className="fls-input__radio"
/>
No
</label>
</div>
</div>
<div className="column is-full">
<button className="button fls__button">
Begin the Test
</button>
</div>
</div>
</div> */}
</div>
<div className="columns is-centered">
<div className="column is-half">
<a
target="_blank"
href="https://fls-international.web.app/"
className="button fls__button"
>
Begin the Test
</a>
</div>
</div>
</Section>
<Section sectionClasses={['section', 'locations']}>
{/* template these carousel slides */}
<div className="columns is-centered">
<div className="column is-6">
<div className={sectionStyles.section__titleContainer}>
<h2 className="title title--fls">Locations</h2>
</div>
</div>
</div>
<div className="columns is-multiline is-centered">
{locations.map(location => (
<div className="column is-one-third">
<Card
key={location.path}
cardData={location}
isLocation={true}
isCarouselLocation={true}
/>
</div>
))}
{/* TODO: Slick refuses to work with a map. Look into this. */}
{/* <Slick {...slickSettings}>
{locations.map(location => (
<Card
key={location.path}
cardData={location}
isLocation={true}
isCarouselLocation={true}
/>
))}
</Slick> */}
</div>
</Section>
</Fragment>
);
};
const HomePage = (
{
/*data*/
}
) => {
const data = useStaticQuery(graphql`
{
homeCopy: allMarkdownRemark(
filter: { fileAbsolutePath: { regex: "pages/static/home/" } }
) {
edges {
node {
frontmatter {
carousel_settings {
carousel_image
copy
title
}
explore_your_world {
subtitle
copy
title
}
how_is_your_english {
copy
subtitle
title
}
start_your_journey {
copy
subtitle
title
}
our_popular_programs {
copy
subtitle
title
}
}
}
}
}
programs: allMarkdownRemark(
limit: 8
filter: {
fileAbsolutePath: {
regex: "/pages/dynamic/programs/in-person//"
}
}
) {
edges {
node {
frontmatter {
path
name
hero_image
}
}
}
}
locations: allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/pages/dynamic/locations//" }
}
) {
edges {
node {
frontmatter {
path
name
centerNameRelation
carousel_images
description
}
}
}
}
}
`);
return (
<Layout>
<HomePageTemplate data={data} />
</Layout>
);
};
export default HomePage;
<file_sep>/src/components/Layout.js
import React, { Fragment } from 'react';
import { Helmet } from 'react-helmet';
import Footer from './footer/Footer';
import Navbar from './navbar/Navbar';
import Metadata from './Metadata';
import NavHero from './nav-hero/NavHero';
import AnnouncementBanner from './announcement-banner/AnnouncementBanner';
// import { withPrefix } from 'gatsby';
// TODO: Properly implement the content of the <head> tag
// <!DOCTYPE html>
// <html>
// <head>
// <meta charset="utf-8" />
// <meta http-equiv="X-UA-Compatible" content="IE=edge" />
// <meta name="viewport" content="width=device-width, initial-scale=1" />
// <title>FLS International</title>
// <link
// rel="shortcut icon"
// href="../images/fav_icon.png"
// type="image/x-icon"
// />
// <!-- TODO: Do we really need all of animate.css? -->
// <link
// rel="stylesheet"
// href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css"
// />
// <!-- TODO: Transfer this font over to the WordPress implementation -->
// <link
// href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&display=swap"
// rel="stylesheet"
// />
// <link rel="stylesheet" href="../css/bulma.min.css" />
// <link rel="stylesheet" href="../css/icons.css" />
// <link rel="stylesheet" type="text/css" href="../css/style.css" />
// <!-- Only necessary on front page -->
// <link
// rel="stylesheet"
// href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css"
// integrity="<KEY>
// crossorigin="anonymous"
// />
// <style>
// html {
// /* TODO: Figure out what's applying a margin-top, and remove this */
// margin-top: 0 !important;
// }
// </style>
const TemplateWrapper = ({
children,
isHome,
isScrolled,
hasNavHero,
hasNavButtons,
pageTitle,
}) => {
const { title, description } = Metadata();
const handleHasNavHero = hasNavHero =>
hasNavHero ? (
<NavHero hasNavButtons={hasNavButtons} pageTitle={pageTitle} />
) : (
''
);
return (
<Fragment>
<Helmet>
<html lang="en" />
<title>{title}</title>
<meta name="description" content={description} />
{/* <link
rel="apple-touch-icon"
sizes="180x180"
href={`${withPrefix('/')}img/apple-touch-icon.png`}
/>
<link
rel="icon"
type="image/png"
href={`${withPrefix('/')}img/favicon-32x32.png`}
sizes="32x32"
/>
<link
rel="icon"
type="image/png"
href={`${withPrefix('/')}img/favicon-16x16.png`}
sizes="16x16"
/>
<link
rel="mask-icon"
href={`${withPrefix('/')}img/safari-pinned-tab.svg`}
color="#ff4400"
/>
<meta charSet="utf-8" /> */}
{/* TODO: Set up all the social media meta content */}
{/* <meta property="og:type" content="business.business" />
<meta property="og:title" content={title} />
<meta property="og:url" content="/" />
<meta
property="og:image"
content={`${withPrefix('/')}img/og-image.jpg`}
/> */}
</Helmet>
<Navbar isHome={isHome} isScrolled={isScrolled} />
{handleHasNavHero(hasNavHero)}
{children}
<Footer />
<AnnouncementBanner />
</Fragment>
);
};
export default TemplateWrapper;
<file_sep>/src/netlify-content/data/enhancements/online/high-school-completion-course.md
---
name: High School Completion Course
onlineProgramTypeRelation:
- Online Essential Program
- Online Pathway Program
priceDetails:
price: 1500
payPeriod: once
---
<file_sep>/gatsby-config.js
/**
* Configure your Gatsby site with this file.
*
* See: https://www.gatsbyjs.org/docs/gatsby-config/
*/
const path = require('path');
module.exports = {
siteMetadata: {
title: 'FLS International',
description:
"The official website for FLS International's programs and online services.",
},
plugins: [
'gatsby-plugin-root-import',
`gatsby-plugin-sass`,
{
resolve: 'gatsby-plugin-netlify-cms',
options: {
modulePath: `${__dirname}/src/cms/cms.js`,
},
},
{
resolve: `gatsby-plugin-google-fonts`,
options: {
// TODO: Italics
fonts: [`Montserrat\:300,400,500,600`],
display: 'swap',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/img`,
name: 'images',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/netlify-content/pages`,
name: 'pages',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/netlify-content/data`,
name: 'data',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/netlify-content/general-fees`,
name: 'general-fees',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/netlify-content/program-cards`,
name: 'program-cards',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/netlify-content/navbar-items`,
name: 'navbar-items',
},
},
{
resolve: 'gatsby-plugin-exclude',
options: { paths: ['/locations/**'] },
},
`gatsby-transformer-remark`,
],
};
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/discover-california-summer.md
---
path: discover-california-summer
name: Discover California, Summer
centerNameRelation:
- Citrus College
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
- arrive: Jul 18th, 2021
depart: Aug 7th, 2021
- arrive: Jul 25th, 2021
depart: Aug 14th, 2021
- arrive: Aug 1st, 2021
depart: Aug 21st, 2021
- arrive: Aug 8th, 2021
depart: Aug 28th, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/vacation-english-hero.jpeg
programDetails:
minimumAge: 15
duration: 3
price: 4110
durationRelation: 3
specialty-tour-description: Come spend your summer enjoying the best of exciting
southern California! This popular program is hosted on the attractive campus
of Citrus College, and features activities and events especially selected for
the summer months. Citrus is located minutes from downtown Los Angeles in the
comfortable suburb of Glendora, and sits at the base of the San Gabriel
mountains with easy access to shopping, theme parks, and southern California's
famous beaches!
activities-and-excursions: |-
* Hollywood
* Beverly Hills
* Old Town Pasadena
* Huntington Library
* Downtown Los Angeles
* USC Tour
* Grand Central Market
* Broad Museum
* California Science Center
* La Brea Tar Pits
* Griffith Observatory
* LA Zoo
### Optional Tours include:
* Disneyland
* Universal Studios
* Knott's Berry Farm
* Six Flags Magic Mountain
* Santa Monica Beach
* Dance Party
* MLB Baseball Game
features: |-
* 18 lessons of English per week
* 20 students or fewer per class
accommodations: |-
* Twin room accommodation with carefully selected American families
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/discover-boston.md
---
path: discover-boston
name: Discover Boston
centerNameRelation:
- Boston Commons
programDates:
- arrive: Jul 18th, 2021
depart: Aug 7th, 2021
- arrive: Jul 25th, 2021
depart: Aug 14th, 2021
sampleCalendar: /assets/discover-boston.pdf
carousel-images:
- /assets/discover-boston-2.jpg
- /assets/discover-boston-2.png
- /assets/discover-boston-1.jpg
- /assets/discover-boston-5.jpeg
programDetails:
minimumAge: 15
durationRelation: 3
price: 3795
duration: 3
specialty-tour-description: Boston combines unmatched cultural attractions,
prestigious universities and colleges, and top-notch entertainment and dining
opportunities. Students will experience East Coast American culture at its
finest against the backdrop of Boston’s historic landmarks. Whether its a
visit to legendary Harvard University or a shopping trip to Newbury Street,
our program will introduce students to the essential Boston experiences!
activities-and-excursions: |-
* Newbury Street
* Faneuil Hall and Quincy Market
* Beacon Hill and the State House
* Harvard University and Harvard Square
* Prudential Center
* New England Aquarium
* Museum of Fine Arts
* MIT
* Freedom Trail
* Duck Tour
* Revere Beach
* Little Italy
* CambridgeSide Galleria
* Assembly Square Outlets
### Optional Activities:
* Six Flags Amusement Park
* New York City Weekend
features: |-
* 18 English lessons per week
* 20 students or fewer per class
accommodations: |-
* Twin room accommodation with carefully selected American families
* Full-board meal plan included (Meals not included in optional excursions)
* Public Transportation Pass included in program fee
center: Boston Commons
---
<file_sep>/src/netlify-content/elements/announcement-element.md
---
copy: Live FLS classes are now online. Study in the US or in your home country.
Click to read more!
path: /announcements
showBanner: true
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/cinema-camp.md
---
path: cinema-camp
name: <NAME>
centerNameRelation:
- Cal State Long Beach
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Aug 1st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/cinema-camp-1.jpg
- /assets/cinema-camp-2.png
- /assets/cinema-camp-carousel-3.jpeg
programDetails:
durationRelation: 3
price: 4450
minimumAge: 16
duration: 3
specialty-tour-description: This program introduces participants to the exciting
process of filmmaking. Students will study under experienced teachers who have
worked on major Hollywood projects as they learn every part of the moviemaking
process, from writing their own short screenplay to editing their film on
Adobe Premiere. Participants also learn basic camera moves and improve their
skills with on-location shooting using a 4k professional digital cinema
camera. Our program is rounded out with trips to major Hollywood studios and
more must-see Los Angeles attractions!
activities-and-excursions: |-
* Film Screening
* Hollywood
* Beverly Hills
* Cinema Make-up Workshop
* DJ Dance Party
* Farewell Party
**STUDIO TOURS**
* <NAME>.
* Sony/MGM
* Paramount
### Optional Tours Include:
* Disneyland
* Universal Studios
* Knott’s Berry Farm
* Santa Monica Beach
* MLB Baseball Game
features: |-
* 18 lessons of English per week
* 8 movie production lessons per week
* Evening activities, including dances, sports, games & movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/discover-california.md
---
name: Discover California, Winter and Spring
centerNameRelation:
- Citrus College
price: 3795
duration: 3
minimumAge: 15
priceDetails:
range:
maxWeeks: 2
weekThresholds:
- thresholdMax: 3
pricePerWeek: 1265
programDates:
- arrive: Dec 13th, 2020
depart: Jan 2nd, 2021
- arrive: Dec 20th, 2020
depart: Jan 9th, 2021
- arrive: Dec 27th, 2020
depart: Jan 16th, 2021
- arrive: Jan 3rd, 2021
depart: Jan 23rd, 2021
- arrive: Jan 10th, 2021
depart: Jan 30th, 2021
- arrive: Jan 17th, 2021
depart: Feb 6th, 2021
- arrive: Jan 24th, 2021
depart: Feb 13th, 2021
- arrive: Jan 31st, 2021
depart: Feb 20th, 2021
- arrive: Feb 7th, 2021
depart: Feb 27th, 2021
- arrive: Feb 14th, 2021
depart: Mar 6th, 2021
- arrive: Feb 21st, 2021
depart: Mar 13th, 2021
- arrive: Feb 28th, 2021
depart: Mar 20th, 2021
- arrive: Mar 7th, 2021
depart: Mar 27th, 2021
- arrive: Mar 14th, 2021
depart: Apr 3rd, 2021
- arrive: Dec 12th, 2021
depart: Jan 1st, 2022
- arrive: Dec 19th, 2021
depart: Jan 8th, 2022
- arrive: Dec 26th, 2021
depart: Jan 15th, 2022
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/data/programs/online/virtual-winter-camp-jr.md
---
name: <NAME>
onlineProgramType: Online Summer Camp
durationOptions:
minWeeks: 1
maxWeeks: 4
priceDetails:
price: 210
payPeriod: weekly
hoursPerWeek: '15'
lessonsPerWeek: 18
minutesPerLesson: 50
timesOffered:
- 6:00 AM
- 5:00 PM
termDates:
- start: 12/27
end: 1/8
- start: 1/25
end: 2/19
---
<file_sep>/src/components/navbar/NavbarMobileCollapsibleSubsection.js
// TODO: This collapsible component architecture can absolutely be better architected ... but god dammit if it doesn't work
import React, { useState } from 'react';
import { Link } from 'gatsby';
import navbarStyles from './Navbar.module.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCaretRight } from '@fortawesome/free-solid-svg-icons';
import NavMobileDropdown from 'src/components/navbar/NavMobileDropdown';
export default function Navbar({ item, rootNavPath, isSubItem }) {
const [isCollapsed, setIsCollapsed] = useState(true);
const handleExpandButton = item => {
if (item.links || item.collectionName)
return (
<div
className={'fls--flex-align-center'}
onClick={() => setIsCollapsed(prevState => !prevState)}
>
<span>Expand</span>
<FontAwesomeIcon
icon={faCaretRight}
className={`${navbarStyles.flsNav__expand} ${
!isCollapsed
? navbarStyles.flsNav__expandExpanded
: ''
}`}
/>
</div>
);
};
const renderItems = isSubItem => {
if (isSubItem) {
return (
<div className="column is-one-third has-text-centered">
<Link
to={
item.collectionName === 'program-pages'
? `${rootNavPath}#${item.path}`
: `${rootNavPath}/${item.path}`
}
className={`${navbarStyles.flsNav__mobileItem} fls--light-blue`}
>
{item.name}
</Link>
{item.collectionName || item.links ? (
<NavMobileDropdown
rootNavPath={`${rootNavPath}/${item.path}`}
mainNavItem={item}
isSubItem={true}
/>
) : null}
</div>
);
} else {
return (
<div className={`column is-full`}>
<div className={navbarStyles.flsNav__mobileHeaderContainer}>
<Link
to={
item.collectionName === 'program-pages'
? `${rootNavPath}#${item.path}`
: `${rootNavPath}/${item.path}`
}
className={`${navbarStyles.flsNav__mobileItemHeader} fls--light-blue`}
>
{item.name}
</Link>
{handleExpandButton(item)}
</div>
{item.collectionName || item.links ? (
<NavMobileDropdown
rootNavPath={`${rootNavPath}/${item.path}`}
mainNavItem={item}
isSubItem={true}
isCollapsed={isCollapsed}
/>
) : null}
</div>
);
}
};
return renderItems(isSubItem);
}
<file_sep>/src/components/navbar/NavbarMobile.js
import React, { Fragment } from 'react';
import { Link } from 'gatsby';
import navbarStyles from './Navbar.module.scss';
import 'hamburgers/dist/hamburgers.css';
import NavbarMobileCollapsibleSection from 'src/components/navbar/NavbarMobileCollapsibleSection';
export default function Navbar({
isMobileMenuOpen,
mobileDropdownPadding,
mainNavItems,
}) {
return (
<nav
className={`${navbarStyles.flsNav__mobile} ${
isMobileMenuOpen ? 'fls__show' : 'fls__hide'
}`}
style={mobileDropdownPadding}
>
<div className="fls-nav__mobile-container">
<div className="columns is-multiline ">
{mainNavItems.map(mainNavItem => {
if (mainNavItem.links || mainNavItem.collectionName) {
return (
<NavbarMobileCollapsibleSection
mainNavItem={mainNavItem}
/>
);
} else {
return (
<div
className="column is-full"
style={{
paddingBottom: 0,
}}
>
<Link
to={`/${mainNavItem.path}`}
className={`${navbarStyles.flsNav__mobileHeader} fls--white`}
>
{mainNavItem.name}
</Link>
</div>
);
}
})}
</div>
</div>
</nav>
);
}
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/explore-california.md
---
path: explore-california
name: Explore California
centerNameRelation:
- Cal State Long Beach
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/explore-ca-regular-2.jpg
- /assets/explore-ca-regular-1.jpg
- /assets/location-preview-la.jpg
programDetails:
minimumAge: 15
duration: 3
price: 4475
durationRelation: 3
specialty-tour-description: Improve your English skills on the beautiful campus
of one of California's largest universities with instruction from our
TEFL-certified team of teachers. Then, enjoy afternoons and weekends with
trips to iconic attractions like Hollywood, Beverly Hills, beautiful beach
cities, and fashionable shopping centers. You'll go back home with increased
English skills and a summer full of California adventures to remember!
activities-and-excursions: |-
* Hollywood
* Huntington Beach
* Beverly Hills
* Newport Beach
* Downtown LA
* Laguna Beach
* Fashion Island
* UC Irvine Tour
* Aquarium of the Pacific
* Harbor Cruise and Whale Watching
### Optional Tours Include:
* Disneyland
* Universal Studios
* Six Flags Magic Mountain
* Knott's Berry Farm
* Santa Monica Pier
* MLB Baseball Game
features: |-
* 18 lessons of English each week with students from around the world
* Evening activities, including dances, parties, sports, and movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls, in shared
room accommodation.
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/pages/about-us.js
import React, { Fragment } from 'react';
import Layout from 'src/components/Layout';
import Section from 'src/components/section/Section';
import HorizontalNav from 'src/components/horizontal-nav/HorizontalNav';
import Card from 'src/components/card/Card';
import francineImg from 'src/img/francine-img.png';
import francineSignature from 'src/img/francine-signature.png';
export const AboutUsTemplate = () => {
// TODO: This is a critical page that needs to be generated by the CMS. It should be possible to dynamically generate pages like this entirely through the CMS
return (
<Fragment>
<Section
sectionClasses={['section']}
containerClasses={['container']}
>
<div className="columns is-multiline">
<HorizontalNav
navItems={[
'Welcome',
'Mission Statement',
'FLS Advantage',
'Ethical Conduct',
'Accreditations',
'Our Team',
]}
/>
<div className="column is-full">
<div className="columns is-variable is-5">
<div className="column is-3">
<figure className="image is-4by5">
{/* TODO: There is an annoying gap on the left side of this image, when rendered on the page */}
<img src={francineImg} />
</figure>
</div>
<div className="column is-9">
<h1 className="title title--fls">
Welcome to Fls
</h1>
<p className="fls__generic-copy">
With globalization increasing, it’s more
important than ever to learn about other
cultures. There’s no better way to
understand a new culture than by learning
its language. This is what FLS International
has been about for over 30 years.
</p>
<p className="fls__generic-copy">
By joining an FLS program, students improve
their English, gain an understanding of
other cultures and develop their
independence. Studying overseas can be
life-changing, leading students to challenge
themselves, find their true passions and
increase their personal growth.
</p>
<p className="fls__generic-copy">
At FLS we invite each student to appreciate
the allure of a new language and immerse
themselves in a new culture. We strive to
give students both the edge and motivation
necessary to become part of the global
marketplace and pursue endless opportunities
for personal growth.
</p>
<p className="fls__generic-copy">
As America’s largest network of family-owned
and operated language schools, FLS is proud
of our excellent record of student
satisfaction and client service. For over
three decades, we have offered programs that
entice students to reach new levels of
success and expand their dreams. With our
responsiveness and individualized attention
to student concerns, we are confident that
FLS is the best choice for a unique and
valuable American experience.
</p>
<p className="fls__generic-copy">Sincerely,</p>
<img
className="about-us__contact-card-icon"
src={francineSignature}
alt="Francine Forman Swain signature"
/>
<p className="fls__generic-copy">
Francine Forman Swain
</p>
<p>Director and Founder - FLS International</p>
</div>
</div>
</div>
</div>
</Section>
<Section
sectionClasses={['section', 'highlighted-section']}
containerClasses={['container']}
>
<div className="columns is-centered is-multiline">
<div className="column is-full">
<div className="section__title-container">
<h2 className="title title--fls title--white title--underline">
Mission Statement
</h2>
</div>
</div>
<div className="column is-9">
<p className="highlighted-section__copy">
FLS International is committed to providing
effective English as a Foreign Language education
and cultural training to international students and
assisting clients during each phase of their
educational experience, from their initial entry
into the United States to their transfer to a
college or university.
</p>
</div>
</div>
</Section>
<Section
sectionClasses={['section']}
containerClasses={['container']}
>
<div className="columns is-centered is-multiline">
<div className="column is-8 has-text-centered">
<h3 className="subtitle subtitle--fls subtitle--red">
The
</h3>
<h2 className="title title--fls">FLS Advantage</h2>
<div className="section__title-copy">
Here are just a few of the reasons why FLS
International offers international students an
unbeatable learning and cultural experience. As
America’s largest family-owned and operated network
of language schools, we pride ourselves on our
personalized and flexible service.
</div>
</div>
{/* TODO: we'll need to make sure any arbitrary amount of bullet points can be inputted, and that they will render (reasonably) well */}
<div className="column is-half">
{/* TODO: Figure out icons */}
<ul>
<li className="fls__list-item">
Small class sizes ensuring individual student
attention.
</li>
<li className="fls__list-item">
College and university placement assistance at
no additional charge.
</li>
<li className="fls__list-item">
Programs using the immersion method of language
instruction, emphasizing spoken English.
</li>
<li className="fls__list-item">
Structured Pathway programs to effectively
prepare students for college entrance.
</li>
<li className="fls__list-item">
Eighteen levels of English study.
</li>
<li className="fls__list-item">
Unique English Everywhere program highlighting
key curriculum points each week.
</li>
</ul>
</div>
<div className="column is-half">
{/* TODO: Figure out icons */}
<ul>
<li className="fls__list-item">
Experienced academic counselors.
</li>
<li className="fls__list-item">
Accreditation by CEA (Commission on English
Language Program Accreditation).
</li>
<li className="fls__list-item">
Centers located in secure, safe environments.
</li>
<li className="fls__list-item">
Monthly Language Extension Day, letting students
use their English in new settings.
</li>
<li className="fls__list-item">
Highly qualified teaching staff with all faculty
holding Master’s Degrees or TESOL credentials.
</li>
</ul>
</div>
</div>
</Section>
<Section
sectionClasses={['section', 'section--alternate']}
containerClasses={['container']}
>
<div className="columns is-centered is-multiline">
<div className="column is-full has-text-centered">
<h3 className="subtitle subtitle--fls subtitle--red">
About
</h3>
<h2 className="title title--fls">Ethical Conduct</h2>
</div>
<div className="column is-full">
<div className="columns">
<div className="column is-9 fls__post-container">
<h3 className="fls-post__title">Integrity</h3>
<p className="fls__post-copy">
We will manifest the highest level of
integrity in all our professional
undertakings, dealing with others honestly
and fairly, abiding by our commitments, and
always acting in a manner that merits the
trust and confidence others have placed in
us.
</p>
<h3 className="fls-post__title">
Respect For The Law
</h3>
<p className="fls__post-copy">
We will follow all applicable laws and
regulations and carefully and reflectively
advise students and scholars regarding those
laws and regulations. We will seek out
appropriate guidance and advice when
regulations appear contradictory, ambiguous,
or confusing or when a situation is beyond
our role or competency.
</p>
<h3 className="fls-post__title">Quality</h3>
<p className="fls__post-copy">
We will strive constantly to provide high
quality and educationally valuable programs
and services. We regularly will evaluate and
review our work in order to improve those
programs and services and will seek out and
adopt exemplary practices.
</p>
<h3 className="fls-post__title">Competence</h3>
<p className="fls__post-copy">
We will undertake our work with the highest
levels of competence and professionalism,
regularly seeking and acquiring the training
and knowledge necessary to do so. Our
commitment to professional competence will
extend to exercising thorough oversight of
external programs and placements. Through
careful planning and the development and
implementation of appropriate policies, we
will do our utmost to ensure the safety,
security, and success of students, staff,
faculty, and scholars.
</p>
</div>
<div className="column is-3">
<img src="../../img/about-img-1.jpeg" alt="" />
</div>
</div>
</div>
<div className="column is-full">
<div className="columns">
<div className="column is-3">
<img src="../../img/about-img-2.jpeg" alt="" />
</div>
<div className="column is-9 fls__post-container--left">
<h3 className="fls-post__title">Diversity</h3>
<p className="fls__post-copy">
In both word and deed we will respect the
dignity and worth of all people and be
properly attentive and responsive to the
beliefs and cultural commitments of others.
In the planning, development, and
implementation of programs and services we
will engage respectfully with the diversity
of peoples and perspectives. We will strive
to ensure that our programs reflect the
diversity of our institutions and their
educational goals.
</p>
<h3 className="fls-post__title">
Transparency
</h3>
<p className="fls__post-copy">
We will demonstrate the appropriate level of
transparency in dealings with individuals
and organizations. In collaborations with
other institutions and individuals we will
proceed on the bases of equality and
mutuality. Transactions with external
providers of programs and services will be
conducted professionally, always keeping the
welfare of students foremost, and disclosing
any potential conflicts of interests. We
will provide faculty, staff, students, and
scholars with the information they need to
make good decisions about program
participation and to facilitate their
adjustment to the locales and cultures where
they will study or work.
</p>
<h3 className="fls-post__title">Access</h3>
<p className="fls__post-copy">
In planning developing, and implementing our
programs we will strive to ensure that they
are accessible to all qualified individuals,
doing our utmost to guarantee that
international education is available to all
who desire it and can benefit from it.
</p>
<h3 className="fls-post__title">
Responsiveness
</h3>
<p className="fls__post-copy">
We will maintain open and readily accessible
communication with individuals in our
programs and services and with our
institutional partners. This includes
providing students with the appropriate
level of support based on age, experience,
language ability, and placement.
</p>
</div>
</div>
</div>
</div>
</Section>
<Section sectionClasses={['section', 'section--alternate-2']}>
<div className="columns is-multiline is-centered">
<div className="column is-8 has-text-centered">
<h3 className="subtitle subtitle--fls subtitle--red">
About
</h3>
<h2 className="title title--fls">
Accreditations & Affiliations
</h2>
<p className="fls__post-copy">
FLS is one of a select number of schools accredited
both by CEA (Commission on English Language Program
Accreditation) and ACCET (Accrediting Council on
Continuing Education and Training). Both are
national accrediting agencies recognized by the U.S.
Department of Education. We are also members of the
American Association of Intensive English Programs
(AAIEP) and active participants in NAFSA and TESOL.
</p>
</div>
<div className="column is-full">
<div className="columns is-multiline">
{/* TODO: Should come from the CMS */}
<Card isAffiliate={true} />
<Card isAffiliate={true} />
<Card isAffiliate={true} />
</div>
</div>
</div>
</Section>
<Section sectionClasses={['section']}>
<div className="columns is-centered is-multiline">
<div className="column is-8 has-text-centered">
<h3 className="subtitle subtitle--fls subtitle--red">
Meet the Team
</h3>
<h2 className="title title--fls">Contact FLS</h2>
<p className="fls__post-copy">
Call or email us with any questions about FLS
international or this website.
</p>
</div>
</div>
<div className="columns is-multiline">
<div className="column is-full">
<h3 className="fls-post__title">
FLS International Administrators
</h3>
</div>
<Card isContact={true} />
<Card isContact={true} />
<Card isContact={true} />
<Card isContact={true} />
<Card isContact={true} />
<Card isContact={true} />
<Card isContact={true} />
<Card isContact={true} />
</div>
</Section>
</Fragment>
);
};
const AboutUsPage = ({ data }) => {
// const { frontmatter } = data.markdownRemark;
return (
<Layout isScrolled={true} hasNavHero={true} pageTitle={'About Us'}>
<AboutUsTemplate />
</Layout>
);
};
export default AboutUsPage;
// TODO: Here, all the individual fields are specified.
// Is there a way to just say 'get all fields'?
// export const pageQuery = graphql`
// query {
// markdownRemark {
// frontmatter {
// program_cards {
// card_description
// card_image
// card_title
// }
// }
// }
// }
// `;
<file_sep>/src/netlify-content/data/housing/homestay-single-room-2.md
---
name: Homestay Single Room
centerNameRelation:
- Chestnut Hill College
priceDetails:
price: 275
payPeriod: weekly
mealsPerWeek: 16
---
<file_sep>/src/components/application/MoreInfo.js
import React, { Fragment } from 'react';
import ReactTooltip from 'react-tooltip';
import Select from 'react-select';
import EstimatedPrices from './EstimatedPrices';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
// TODO: Figure out how best to handle validation
export default function MoreInfo({
applicationData,
nextStep,
previousStep,
userData,
handleDataChange,
calculatePrice,
prices,
}) {
const referralOptions = [
{
label: 'Other',
value: 'other',
},
{
label: 'Agent',
value: 'other',
},
];
return (
<Fragment>
<ReactTooltip
type="info"
effect="solid"
html={true}
multiline={true}
className="fls__tooltip"
clickable={true}
/>
<div className="columns is-multiline">
<div className="column is-full">
<div className="application__header-container">
<h3 className="fls-post__title">More Info</h3>
<h3 className="application__total-price">
Total Price: ${calculatePrice(prices)}
</h3>
</div>
</div>
<div className="column is-half">
<label className="label">How did you hear about FLS?</label>
<Select
className="fls__select-container"
classNamePrefix={'fls'}
value={{
label: userData.howDidYouHearAboutFls,
value: userData.howDidYouHearAboutFls,
}}
onChange={referralOption => {
handleDataChange(
'howDidYouHearAboutFls',
referralOption.label,
'user'
);
}}
options={referralOptions}
/>
</div>
{/* TODO: Casing issues here make this condition highly fragile */}
{userData.howDidYouHearAboutFls === 'Other' ? (
<div className="column is-half">
{/* TODO: Should only show if they select 'Other' for 'How did you hear about FLS?' */}
<label className="label">
Specify How You Heard About FLS
</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
value={userData.specifyHowHeardAboutFls}
onChange={e =>
handleDataChange(
'specifyHowHeardAboutFls',
e.target.value,
'user'
)
}
/>
</div>
</div>
) : null}
{userData.howDidYouHearAboutFls === 'Agent' ? (
<div className="column is-half">
{/* TODO: Should only show if they select 'Other' for 'How did you hear about FLS?' */}
<label className="label">Which Agency?</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
value={userData.specifyHowHeardAboutFls}
onChange={e =>
handleDataChange(
'specifyHowHeardAboutFls',
e.target.value,
'user'
)
}
/>
</div>
</div>
) : null}
{/* TODO: Need to see if there's a way to get this into Netlify */}
{applicationData.requiresI20 === 'yes' ? (
<Fragment>
<ReactTooltip
type="info"
effect="solid"
html={true}
multiline={true}
className="fls__tooltip"
clickable={true}
/>
<div className="column is-full">
<div className="columns">
<div className="column is-half">
<label className="label">
Passport Photo (.jpg, .png, .pdf)(Max
File Size 5mb)
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="A passport photo is not required now. This can be provided at a future date."
/>
</label>
<div className="file has-name">
<label className="file-label">
<input
className="file-input"
type="file"
name="passport"
/>
<span className="file-cta">
<span className="file-icon">
<i className="fas fa-upload"></i>
</span>
<span className="file-label">
Choose a file…
</span>
</span>
<span className="file-name">
Screen Shot 2017-07-29 at
15.54.25.png
</span>
</label>
</div>
</div>
<div className="column is-half">
<label className="label">
Financial Document (.jpg, .png,
.pdf)(Max File Size 5mb)
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="A financial document
is not required now. This can be provided at a future date."
/>
</label>
<div className="file has-name">
<label className="file-label">
<input
className="file-input"
type="file"
name="financial-document"
/>
<span className="file-cta">
<span className="file-icon">
<i className="fas fa-upload"></i>
</span>
<span className="file-label">
Choose a file…
</span>
</span>
<span className="file-name">
Screen Shot 2017-07-29 at
15.54.25.png
</span>
</label>
</div>
</div>
</div>
</div>
</Fragment>
) : null}
<div className="column is-full">
<label className="label">Additional Comments</label>
<textarea
className="textarea"
value={userData.additionalComments}
onChange={e =>
handleDataChange(
'additionalComments',
e.target.value,
'user'
)
}
></textarea>
</div>
<div className="column is-full">
<label className="checkbox">
<input type="checkbox" />
<span className="fls__radio-label">
I acknowledge, by checking the box below, that I
have read and agree to the above GDPR privacy policy
and FLS <a href="#">Terms and Conditions.</a> *
</span>
</label>
</div>
<EstimatedPrices prices={prices} />
<div className="column is-4">
<button onClick={previousStep} className="fls__button">
Previous
</button>
</div>
{/* TODO: This works for now... but it's probably not the best implementation */}
<div className="column is-4"></div>
<div className="column is-4">
<button
onClick={() => {
nextStep();
}}
className="fls__button"
>
Save & Continue
</button>
</div>
</div>
</Fragment>
);
}
<file_sep>/src/netlify-content/data/general-fees/in-person/sevis-application-fee.md
---
name: SEVIS Application Fee
centerNameRelation:
- Citrus College
- Boston Commons
- Chestnut Hill College (from Summer, 2021)
- Saddleback College (Summer Only)
priceDetails:
price: 350
payPeriod: Once
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/cinema-camp.md
---
name: <NAME>
centerNameRelation:
- Cal State Long Beach
price: 4450
duration: 3
minimumAge: 16
priceDetails:
package:
duration: 3
price: 4450
payPeriod: once
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Aug 1st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/virtual-winter-camp.md
---
path: virtual-winter-camp
name: Virtual Winter Camp
type: Online Summer Camp
hero-image: /assets/adobestock_316253397.jpeg
programDetails:
lessonsPerWeek: 18
hoursPerWeek: "15"
minutesPerLesson: 50
description: Enjoy English language instruction and guided activities in a fun
online program!
program-post-content: >-
Don't let this winter pass you by without enjoying one of our popular winter
camps! This winter we are offering an online version of our popular winter
activity programs. No travel hassles, no visa issues, and no worries. Just
join us from your computer or online device and enjoy spending time with other
students from around the world. With just a few hours per week during your
vacation time, you'll both improve your English and have fun participating in
our guided activities.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience. Activities are led by experienced, friendly American Activity Guides.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* For students aged 14-18
* Start any Monday at 6:00 AM Pacific Time, or any Sunday at 5 PM Pacific Time
* Study from 1-4 weeks
* Daily 2-hour English lesson
* Daily 1-hour guided online activity
* One-to-one tutorial with your teacher
* FLS Attendance Certificate
### Activities include:
* Trivia Games
* Virtual Escape Room
* Yoga
* Hip Hop Dance
* Tik Tok Workshop
* Virtual Tours
* Slang Workshop
* Social Media Workshops
---
<file_sep>/src/components/application/Address.js
import React, { useState } from 'react';
import Formsy from 'formsy-react';
import { GoogleApiWrapper } from 'google-maps-react';
import PlacesAutocomplete, {
geocodeByAddress,
} from 'react-places-autocomplete';
import TextInput from 'src/components/application/form/TextInput';
const formatAddressComponents = addressComponents => {
const desiredComponentTypes = [
'locality',
'administrative_area_level_1',
'postal_code',
'country',
],
componentTypeMapping = {
locality: 'city',
administrative_area_level_1: 'stateProvince',
postal_code: 'postalCode',
country: 'addressCountry',
};
return addressComponents.reduce((accum, addressComponent) => {
// TODO: Probably not a good idea to directly access the array like this
if (desiredComponentTypes.includes(addressComponent.types[0]))
accum[componentTypeMapping[addressComponent.types[0]]] =
addressComponent.long_name;
return accum;
}, {});
};
export default GoogleApiWrapper({
apiKey: process.env.GATSBY_GOOGLE_PLACE_API_KEY,
})(
({
previousStep,
nextStep,
userData,
handleDataChange,
handleBatchInputChange,
handleApplicationState,
}) => {
const handleSelect = address => {
geocodeByAddress(address)
.then(results => {
const formattedAddressComponents = formatAddressComponents(
results[0].address_components
);
// handleBatchInputChange(
// {
// ...formattedAddressComponents,
// address,
// },
// 'user'
// );
handleApplicationState({
...formattedAddressComponents,
address,
});
})
.catch(error => console.error('Error', error));
};
const [isValidForm, setIsValidForm] = useState();
return (
<Formsy
onChange={handleApplicationState}
onValid={() => setIsValidForm(true)}
onInvalid={() => setIsValidForm(false)}
>
<div className="columns is-multiline">
<div className="column is-full">
<div className="application__header-container">
<h3 className="fls-post__title">Your Address</h3>
</div>
</div>
<div className="column is-full">
<div className="field">
{/* TODO: Add the required asterisk */}
<label className="label">Address</label>
<div className="control">
<PlacesAutocomplete
value={userData.address}
name="address"
onChange={address => {
handleDataChange(
'address',
address,
'user'
);
}}
onSelect={handleSelect}
>
{({
getInputProps,
suggestions,
getSuggestionItemProps,
loading,
}) => (
<div>
<input
{...getInputProps({
placeholder:
'Search Places ...',
className:
'input fls__base-input',
})}
/>
<div className="autocomplete-dropdown-container">
{loading && (
<div>Loading...</div>
)}
{suggestions.map(suggestion => {
const className = suggestion.active
? 'suggestion-item--active'
: 'suggestion-item';
// inline style for demonstration purpose
const style = suggestion.active
? {
backgroundColor:
'#fafafa',
cursor:
'pointer',
}
: {
backgroundColor:
'#ffffff',
cursor:
'pointer',
};
return (
<div
{...getSuggestionItemProps(
suggestion,
{
className,
style,
}
)}
>
<span>
{
suggestion.description
}
</span>
</div>
);
})}
</div>
</div>
)}
</PlacesAutocomplete>
</div>
</div>
</div>
<div className="column is-full">
<div className="columns is-multiline">
<div className="column is-half">
<TextInput
validations="isExisty"
validationError="Field cannot be blank"
name="city"
placeholder="City"
value={userData.city}
label={'City'}
required
/>
</div>
<div className="column is-half">
<TextInput
validations="isExisty"
validationError="Field cannot be blank"
name="stateProvince"
placeholder="State/Province/Department"
value={userData.stateProvince}
label={'State/Province/Department'}
required
/>
</div>
<div className="column is-half">
<TextInput
validations="isExisty"
validationError="Field cannot be blank"
name="stateProvince"
placeholder="Zip/Postal Code"
value={userData.postalCode}
label={'Zip/Postal Code'}
required
/>
</div>
<div className="column is-half">
{/* TODO: This should probably eventually be a CountryInput. It's more annoying than it should be to programatically set the country input based on local storage. */}
<TextInput
validations="isExisty"
validationError="Field cannot be blank"
name="addressCountry"
placeholder="Country"
value={userData.addressCountry}
label={'Country'}
required
/>
</div>
</div>
</div>
<div className="column is-4">
<button onClick={previousStep} className="fls__button">
Previous
</button>
</div>
{/* TODO: This works for now... but it's probably not the best implementation */}
<div className="column is-4"></div>
<div className="column is-4">
<button
onClick={() => {
nextStep();
}}
disabled={!isValidForm}
className={
isValidForm
? 'fls__button'
: 'fls__button fls__button--disabled'
}
>
Save & Continue
</button>
</div>
</div>
</Formsy>
);
}
);
<file_sep>/src/netlify-content/pages/dynamic/locations/saddleback-college.md
---
path: orange-county-ca
name: Orange County, CA
centerNameRelation:
- Saddleback College (Summer Only)
description: Located in sunny Orange County, Saddleback College has been a top
choice in education since 1968 on a beautiful campus near picture-perfect
beaches.
quick-facts:
- name: Campus Facilities
icon: /assets/campus-facilities-icon.png
items: |-
* Cafeteria
* McKinney Theatre
* Library
* Free WiFI
* Smartboards
* Tennis Courts
- name: Popular Majors
icon: /assets/popular-majors-icon.png
items: |-
* Liberal Arts
* Health Sciences
* Business
* Psychology
* Environmental Sciences
- name: Airport Pickup
icon: /assets/airport-pickup-icon.png
items: "* Los Angeles Int. Airport (LAX) - 91 kilometers"
- name: Average Temp
icon: /assets/average-temp-icon.png
items: |-
* Spring - 23°C
* Summer - 26°C
* Fall - 22°C
* Winter - 20°C
- name: Enrollment
icon: /assets/enrollment-icon.png
items: "* Approximately 27,000 students, including 14,000 degree-seeking
undergraduates"
- name: Programs Offered
icon: /assets/programs-offered-icon.png
items: |-
* Core English
* General English
* Intensive English
* Academic English
* TOEFL Preparation
* High School Completion
- name: Local Transportation
icon: /assets/local-transportation-icon.png
items: |-
* Bus: OCTA stop on campus
* Light rail: Metrolink line, 1 mile from campus
- name: Distance to Major Attractions
icon: /assets/major-attractions-icon.png
items: |-
* Laguna Beach - 11 miles
* Disneyland - 26 Miles
* Downtown Los Angeles - 52 miles
* San Diego - 70 miles
carousel-images:
- /assets/location-preview-saddleback.jpg
- /assets/junior-beach.jpg
- /assets/saddleback-college-1.jpg
- /assets/saddleback-2.jpeg
- /assets/housing5.jpg
- /assets/saddleback-3.jpeg
post-content: >-
# Open for Summer, 2021
## OVERVIEW
### Enjoy the Great Weather and Surroundings of Orange County
With 42 miles of world-famous beaches, legendary theme parks, and enough shopping destinations to satisfy even the most dedicated shopper, it's no wonder that visiting Orange County is the ultimate Southern California experience. The "OC," as local residents call it, blends a casual, active lifestyle with laid-back sophistication. This unique lifestyle was integral to the development and culture of professional surfing, and the perfect weather continues to bring millions of visitors every year.
### Safe and Friendly Community
The beautifully landscaped campus of Saddleback College is set on a hilltop surrounded by the gorgeous neighborhoods and shopping districts of Mission Viejo. Known as one of California's safest cities, Mission Viejo provides comfortable surroundings near some of Southern California's greatest attractions.
### Orange County's Choice for Education
Saddleback College has been the first choice for higher education in South Orange County since 1968. The college offers more than 190 different degrees and certificates, giving students an excellent foundation to transfer to UC Irvine or other schools in the California State University or University of California systems.
## CAMPUS PROFILE
Located in safe and sunny Orange County, Saddleback College has offered a wide range of programs since 1968 and currently enrolls more than 27,000 students. Many students go on to four-year degree programs at nearby California State University and University of California campuses.
### Campus Facilities
* **Learning Resource Center**
Housing computer stations, language lab, and campus library.
* **McKinney Theater**
Performing arts stage, with seating for 400, offering a variety of live entertainment events to students and the public.
* **Student Services Center**
Housing a student lounge and cafeteria providing a full range of food services.
* **Athletic Facilities**
Including tennis courts, golf driving range, gymnasium, baseball field and swimming pool.
* **KSBR Radio Station**
A commercial-free contemporary jazz and community information station serving Orange County. KSBR has won multiple awards and trains students enrolled in Saddleback’s Cinema/TV/Radio program.
## HOUSING
### Homestay
A homestay is a great way to experience American culture while improving your English ability! All FLS centers offer homestay accommodation with American families individually selected by FLS. Learn about American daily life, practice English on a regular basis and participate in many aspects of American culture that visitors often don't get to see. (Twin and Single options available).
<iframe width="560" height="349" src="https://www.youtube.com/embed/cQJKGECy8i4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen ></iframe>
## AREA PROFILE
**The Saddleback Experience**
With great weather, access to amazing beaches and a picturesque location between Los Angeles and San Diego, Mission Viejo offers an unbeatable quality of life with easy freeway access to classic California attractions like Sea World and Disneyland!
* Visit Disneyland Resort including the original Disneyland theme park, with Galaxy's Edge, and the expanded California Adventure park, featuring Cars Land and Ariel’s Undersea Adventure.
* Relax on the sandy shores of Laguna Beach, considered one of the most beautiful beaches in California, and visit the many unique art galleries and cafes.
* Spend a fun-filled day at Sea World and see Shamu, sea lions and otters in action and enjoy rides like Manta and Wild Arctic.
* Enjoy the best of shopping, entertainment and dining at the huge Irvine Spectrum Center, offering over 130 specialty stores and restaurants.
* Take a surfing lesson on the shores of Huntington Beach, Surf City USA, the home of the annual US Open of Surf.
**Mission Viejo, CA**
Recently named the safest city in the United States, Mission Viejo is an affluent suburban community of nearly 100,000. The center of the city contains a large man-made lake and beautiful tree-lined streets overlooked by the Saddleback mountain range. Mission Viejo offers an ideal climate with a temperature range of 11-23 degrees Celsius year-round. Summers are sunny, warm and dry. Fall and winter bring occasional rain showers, with snow in the local mountains. Due to close proximity to the ocean, nighttime and morning clouds are common.
**English + Volunteering**
FLS offers ESL students a wonderful way to practice their new English skills while immersing themselves in American society by volunteering at local charities and community service centers. Join other FLS students as they perfect their conversational English while helping others! Here are some of the opportunities you will enjoy at FLS Saddleback College:
* Mission Viejo Library
* G.I. Joe Search and Rescue
* Irvine Senior Services
* Boys & Girls Club of Laguna Beach
**Optional Weekend and Evening Activities**
FLS offers ESL students memorable and educational tour experiences, and opportunities to visit the best attractions of California. Students will have many chances to take part in excursions with the full supervision of our trained FLS staff.
**Activities Include:**
* Disneyland
* Six Flags Magic Mountain
* Soak City
* Knott's Berry Farm
* San Diego
---
<file_sep>/src/netlify-content/data/general-fees/in-person/housing-placement-fee.md
---
name: Housing Placement Fee
centerNameRelation:
- Boston Commons
- Chestnut Hill College (from Summer, 2021)
- Citrus College
- Saddleback College (Summer Only)
- Cal State Long Beach (Summer Only)
- Harvard University Campus
- Marymount Manhattan College
- Suffolk University
priceDetails:
price: 200
payPeriod: Once
---
<file_sep>/src/netlify-content/data/enhancements/in-person/airport-transfer-3.md
---
name: Airport Transfer
centerNameRelation:
- Citrus College
priceDetails:
price: 150
payPeriod: each-way
notes:
- Los Angeles International Airport, LAX
---
<file_sep>/src/netlify-content/pages/dynamic/programs/in-person/academic-english.md
---
path: academic-english
name: <NAME>
hero-image: /assets/dsc08615.jpg
programDetails:
lessonsPerWeek: 36
hoursPerWeek: "30"
minutesPerLesson: 50
description: "Our high-powered Academic English program offers the fastest way
to develop your English. "
program-post-content: >-
### Our high-powered Academic English program offers the fastest way to
develop your English.
The Academic English Program features six hours a day of quality language instruction, including a core class, your choice of two electives or one premium test preparation class, and a daily academic workshop. Designed for students who plan to transfer to an American college or university, the program is suitable for any student interested in gaining English fluency as quickly as possible.
Our program places an exceptional emphasis on speaking. Students practice speaking skills frequently in class, receiving regular guidance and correction from their instructor.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
program-features-content: >-
## PROGRAM FEATURES
All Academic English students enjoy these exceptional features:
* Eighteen levels of study from low beginner to high advanced.
* Small class sizes of 15 or fewer, guaranteeing individual attention from your teacher.
* Core Class emphasizing the four key language skills: speaking, listening, reading and writing.
* Two Elective Classes devoted to a specific topic or skill, such as Slang, Business English, American Culture, Public Speaking, Grammar, or Composition. Or One Premium Test Preparation class to prepare for the TOEFL, SAT, or IELTS.
* Lab-style Academic Workshop offering a range of academic options each week, including Pronunciation Clinics, Conversation Clubs, Homework Labs, Computer Labs, and more.
* Our exclusive English Everywhere program with weekly Hot Sheets, involving your host family, activity guides and FLS staff in your learning process.
* Weekly English tests and individualized progress reports every four weeks.
* Language Extension Day (LED) activities once per term, encouraging students to use English in new settings and contexts.
* Readers and novels to increase reading comprehension and understanding of American culture (for High Beginner and above).
* Access to numerous free activities and specially priced excursions.
* Certificate of Completion upon successful graduation from each level.
* Articulation agreements with numerous colleges allowing admission without a TOEFL score based on completion of the designated FLS level.
* Personalized counseling and academic assistance.
program-details:
lessons-per-week: 36
hours-per-week: 30
minutes-per-lesson: 50
pageName: Academic English
programType: in-person
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/toefl-preparation.md
---
path: online-toefl-preparation
name: <NAME>
type: Online Essential Program
hero-image: /assets/hannah-olinger-nxiivnzbwz8-unsplash.jpg
programDetails:
lessonsPerWeek: 12
hoursPerWeek: "10"
minutesPerLesson: 50
description: Achieve a higher TOEFL Score!
program-post-content: >-
The TOEFL test challenges students to analyze and synthesize academic passages
and use advanced discourse. Our program will give students test-taking
strategies and enhance their ability at making inferences, integrating
information, finding factual material and analyzing reading passages.
Available for students in Level 9 and above, our online TOEFL Preparation course includes a rigorous review of all components of the test and extensive text practice, allowing students to achieve higher scores.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* 2 hours per day/ 12 lessons per week
* Start any Monday
* Small class sizes
* 3 Start times available: 12:15 and 3 PM Pacific Time or 3 AM Pacific Time
### Price
* $150 per week
---
<file_sep>/src/netlify-content/data/programs/online/sat-preparation.md
---
name: <NAME>
onlineProgramType: Online Essential Program
durationOptions:
minWeeks: 4
maxWeeks: 16
exceedMaxWeeks: true
priceDetails:
price: 150
payPeriod: weekly
hoursPerWeek: '10'
lessonsPerWeek: 12
minutesPerLesson: 50
timesOffered:
- 3:00 AM
- 7:00 AM
- 3:00 PM
---
<file_sep>/src/netlify-content/data/programs/in-person/vacation-english-1.md
---
name: <NAME>
location:
- Chestnut Hill College
centerNameRelation:
- Chestnut Hill College
durationOptions:
maxWeeks: 12
weekThresholds:
- thresholdMax: 3
pricePerWeek: 395
- thresholdMax: 7
pricePerWeek: 385
- thresholdMax: 12
pricePerWeek: 375
hoursPerWeek: "15"
lessonsPerWeek: 18
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/data/programs/in-person/general-english-1.md
---
name: <NAME>
location:
- Chestnut Hill College
centerNameRelation:
- Boston Commons
durationOptions:
maxWeeks: 32
exceedMaxWeeks: true
weekThresholds:
- thresholdMax: 3
pricePerWeek: 420
- thresholdMax: 11
pricePerWeek: 415
- thresholdMax: 23
pricePerWeek: 390
- thresholdMax: 31
pricePerWeek: 375
- thresholdMax: 32
pricePerWeek: 355
hoursPerWeek: "20"
lessonsPerWeek: 24
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/university-tour.md
---
path: university-tour
name: University Tour
centerNameRelation:
- Suffolk University
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/discover-boston-2.png
programDetails:
price: 4875
duration: 3
minimumAge: 15
durationRelation: 3
specialty-tour-description: The American higher education system offers many
paths to success, but often international students don't know where to begin
their journey. FLS provides students with insightful introductions to some of
the most famous and prestigious institutions in the US with our University
Tour. During your program, you'll enjoy guided tours to the most important
campuses in the region, along with stops at culturally significant and
entertaining attractions. At the same time, you'll get familiar with the great
city of Boston, America's educational capital!
activities-and-excursions: |-
* Newbury Street
* Faneuil Hall and Quincy Market
* Beacon Hill and the State House
* Prudential Center
* Duck Tour
### University Tours:
* Harvard University
* MIT
* UMass Boston
* Brown University
* Suffolk University
* Boston College
* Boston University
### Optional Tours available:
* New York Weekend
* Six Flags Amusement Park
features: |-
* 18 lessons of English per week
* 1 college preparation workshop per week
* 7 university visits
* Evening activities, including games, parties, and dances
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation at Suffolk University
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/components/application/form/SelectInput.js
import React from 'react';
import { withFormsy } from 'formsy-react';
import Select from 'react-select';
import { renderRequirement } from 'src/utils/helpers';
function SelectInput({
errorMessage,
setValue,
name,
value,
label,
options,
onChangeCallback,
requirement,
className,
isDisabled,
}) {
return (
<div className="field">
<div className="application__label-container">
<label className="label label--application">{label}</label>
{renderRequirement(requirement)}
</div>
<div className="control">
<Select
className={className ? className : 'fls__select-container'}
classNamePrefix={'fls'}
value={value}
onChange={selection => {
if (onChangeCallback) onChangeCallback(selection);
setValue(selection);
}}
options={options}
name={name}
isDisabled={isDisabled}
/>
</div>
<div className="fls__form-error">
{errorMessage ? errorMessage : null}
</div>
</div>
);
}
export default withFormsy(SelectInput);
<file_sep>/src/netlify-content/program-cards/academic-english.md
---
path: academic-english
background-image: /assets/elp-card-bg.jpeg
name: Academic English
short-description: Our high-powered Academic English program offers the fastest
way to develop your English.
lessons-per-week: 36
hours-per-week: 30
---
<file_sep>/src/netlify-content/data/programs/online/essential-english-weekend-course.md
---
name: <NAME>
onlineProgramType: Online Essential Program
durationOptions:
maxWeeks: 52
exceedMaxWeeks: true
minWeeks: 1
priceDetails:
price: 85
payPeriod: weekly
hoursPerWeek: '4'
lessonsPerWeek: 6
minutesPerLesson: 50
timesOffered:
- 4:00 AM
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/acting-camp.md
---
path: acting-camp
name: <NAME>
centerNameRelation:
- Cal State Long Beach (Summer Only)
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/acting-camp-1.jpeg
programDetails:
minimumAge: 15
duration: 3
price: 4450
durationRelation: 3
specialty-tour-description: >-
Take a journey to Hollywood - the home of the stars - and pursue your acting
dreams. The beautiful CSULB campus provides an ideal setting to work on your
acting style with expert teachers from Hollywood's unmatched acting
community.
You'll join students form the FLS Cinema Camp to create a short film. Students will learn to act in front of a camera and hone their skills in enunciation, character analysis, improvisation, and reacting to other characters in a scene.
You'll round out your tour with visits to some of the legendary sites and studios of Los Angeles!
activities-and-excursions: |-
* Hollywood
* Beverly Hills
* Makeup Workshop
* Warner Bros Studio
* Sony/MGM Studio
* Paramount Studio
* Dance Party
### Optional Tours Include:
* Santa Monica
* Disneyland
* MLB Baseball Game
* Universal Studios
* Knott's Berry Farm
features: |-
* 18 lessons of English each week with students from around the world
* 8 acting lessons each week
* Copy of the final film
* Evening activities, including dances, sports, and movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls, in shared
room accommodation.
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/data/enhancements/specialty-tours/unaccompanied-minor-service.md
---
name: Unaccompanied Minor Service
centerNameRelation:
- Boston Commons
- Saddleback College (Summer Only)
- Chestnut Hill College (from Summer, 2021)
- Cal State Long Beach (Summer Only)
- Harvard University Campus
- Citrus College
- Marymount Manhattan College
- Suffolk University
priceDetails:
price: 100
payPeriod: once
---
<file_sep>/src/netlify-content/data/general-fees/in-person/extra-night-student-residences.md
---
name: 'Extra Night: Student Residences'
centerNameRelation:
- Boston Commons
- Cal State Long Beach (Summer Only)
- Harvard University Campus
- Marymount Manhattan College
- Suffolk University
priceDetails:
price: 75
payPeriod: Per Night
---
<file_sep>/src/netlify-content/data/online-program-types/online-pathway-program.md
---
name: Online Pathway Program
onlineProgramTypeDescription: Our Pathway courses replicate the same experience
we provide in our physical schools in the United States. Increase your English
skills quickly to propel you to success in your university studies or your
career.
---
<file_sep>/src/components/quick-facts/QuickFacts.js
import React from 'react';
import quickFactsStyles from './QuickFacts.module.scss';
import MarkdownContent from '../MarkdownContent';
const classMap = {
li: quickFactsStyles.fls__quickFactItem,
};
export default function QuickFacts({ data }) {
return (
<div className={`${quickFactsStyles.fls__quickFacts} column is-full`}>
<h6 className="fls-post__subtitle">Quick Facts</h6>
{data.map(quickFact => (
<div
className={quickFactsStyles.fls__quickFactContainer}
key={quickFact.name}
>
<img
src={quickFact.icon}
alt={`${quickFact.name} icon`}
className={quickFactsStyles.fls__quickFactIcon}
/>
<div className={quickFactsStyles.fls__quickFactCopy}>
<div className={quickFactsStyles.fls__quickFactTitle}>
{quickFact.name}
</div>
<ul>
<MarkdownContent
classMap={classMap}
content={quickFact.items}
/>
</ul>
</div>
</div>
))}
</div>
);
}
<file_sep>/src/netlify-content/data/locations/harvard-university-campus.md
---
name: Boston, MA
centerName: Harvard University Campus
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/general-english.md
---
path: online-general
name: General English
type: Online Pathway Program
hero-image: /assets/laika-notebooks-3i3ornntd5a-unsplash.jpg
programDetails:
lessonsPerWeek: 24
hoursPerWeek: "20"
minutesPerLesson: 50
description: Learn the most essential English skills quickly
program-post-content: >-
For students who want to learn the most essential English skills and still
have time for other activities and responsibilities, our General English
Program is the ideal choice. Study in our integrated skills Core class, along
with an daily academic workshop.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
As part of our Online Pathway Program you will participate via webcam with a live in-person class.
program-features-content: >-
### Program Features:
* 4 hours of study per day/ 20 hours per week
* 18 levels
* Textbooks and materials provided
* Small class size
* All classes taught by TEFL-certified teachers with native fluency in American English
---
<file_sep>/src/netlify-content/data/programs/online/academic-english.md
---
name: <NAME>
onlineProgramType: Online Pathway Program
priceDetails:
range:
maxWeeks: 31
weekThresholds:
- thresholdMax: 3
pricePerWeek: 385
- thresholdMax: 11
pricePerWeek: 365
- thresholdMax: 23
pricePerWeek: 355
- thresholdMax: 31
pricePerWeek: 310
- thresholdMax: 32
pricePerWeek: 295
hoursPerWeek: '30'
lessonsPerWeek: 36
minutesPerLesson: 50
timesOffered:
- 6:00 AM
- 9:00 AM
---
<file_sep>/src/netlify-content/data/enhancements/online/one-to-one-tutoring.md
---
name: One-to-One Tutoring
onlineProgramTypeRelation:
- Online Essential Program
- Online Pathway Program
priceDetails:
price: 55
payPeriod: once
---
<file_sep>/src/netlify-content/navbar-items/locations.md
---
path: locations-centers
pageName: Locations
collectionName: locations
collection-name: location-pages
name: Locations
order: 1
links: []
---
<file_sep>/src/netlify-content/data/programs/in-person/academic-english-1.md
---
name: Academic English
centerNameRelation:
- Boston Commons
durationOptions:
maxWeeks: 32
weekThresholds:
- thresholdMax: 3
pricePerWeek: 515
- thresholdMax: 11
pricePerWeek: 480
- thresholdMax: 23
pricePerWeek: 445
- thresholdMax: 31
pricePerWeek: 435
- thresholdMax: 32
pricePerWeek: 410
exceedMaxWeeks: true
hoursPerWeek: "30"
lessonsPerWeek: 36
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/essential-english-weekend-course.md
---
path: ee-weekend
name: Essential Weekend Course
type: Online Essential Program
hero-image: /assets/adobestock_331412996.jpeg
programDetails:
lessonsPerWeek: 6
hoursPerWeek: "4"
minutesPerLesson: 50
description: Improve your English conversation ability in your free time!
program-post-content: >-
Give your weekends an educational upgrade with our motivating weekend course!
Our Essential English Weekend course gives you the opportunity to learn all of
the fundamental skills of English without school- or work-day
distractions. Our relaxed small group classes will open up new avenues of
cultural and academic knowledge!
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* Small class sizes
* 2 hours per day/ 4hours per week
* Start any Saturday
* 18 levels of instruction
* Start time: Saturdays and Sundays, 4:00 AM (US Pacific Time)
### Price
* $110 per week
---
<file_sep>/src/components/media-item/MediaItem.js
import React from 'react';
import mediaItemStyles from './MediaItem.module.scss';
export default function NavHero({ navItems = [], isDownloads }) {
return (
<div className={mediaItemStyles.fls__mediaContainer}>
<div className={mediaItemStyles.fls__download}></div>
</div>
);
}
<file_sep>/src/components/application/form/CountryInput.js
import React from 'react';
import { withFormsy } from 'formsy-react';
import { getName } from 'country-list';
import ReactFlagsSelect from 'react-flags-select';
import 'react-flags-select/scss/react-flags-select.scss';
function DateInput({
setValue,
label,
name,
defaultCountry,
searchable,
errorMessage,
}) {
return (
<div className="field">
<label className="label label--required">{label}</label>
<div className="control">
<ReactFlagsSelect
defaultCountry={defaultCountry}
searchable={searchable}
onSelect={countryCode => setValue(getName(countryCode))}
name={name}
/>
</div>
<div className="fls__form-error">
{errorMessage ? errorMessage : null}
</div>
</div>
);
}
export default withFormsy(DateInput);
<file_sep>/src/netlify-content/data/locations/chestnut-hill-college.md
---
name: Philadelphia, PA
centerName: Chestnut Hill College (from Summer, 2021)
---
<file_sep>/src/pages/application/index.js
import React, { useState, Fragment } from 'react';
import { useStaticQuery, graphql } from 'gatsby';
import StepWizard from 'react-step-wizard';
import useLocalStorageState from 'use-local-storage-state';
import { addValidationRule } from 'formsy-react';
import _reduce from 'lodash.reduce';
import Layout from 'src/components/Layout';
import Section from 'src/components/section/Section';
import Steps from 'src/components/steps/Steps';
import PersonalInfo from 'src/components/application/PersonalInfo';
import Address from 'src/components/application/Address';
import AdditionalInfo from 'src/components/application/AdditionalInfo';
import MoreInfo from 'src/components/application/MoreInfo';
import BillingCheckout from 'src/components/application/BillingCheckout';
import NetlifyStaticForm from 'src/components/application/NetlifyStaticForm';
import { calculatePrice } from 'src/utils/helpers';
// Custom validator for React Select inputs
addValidationRule(
'isSelected',
(values, value) => !!value.value && !!value.label
);
export const ApplicationTemplate = () => {
const data = useStaticQuery(graphql`
{
generalFees: allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/data/general-fees//" } }
) {
edges {
node {
frontmatter {
name
centerNameRelation
priceDetails {
price
payPeriod
}
}
}
}
}
}
`);
const applicationDefaults = {
user: {
firstName: '',
lastName: '',
email: '',
phoneNumber: '',
gender: '',
birthDate: '',
citizenshipCountry: '',
birthCountry: '',
address: '',
city: '',
stateProvince: '',
postalCode: '',
addressCountry: '',
},
application: {
center: '',
duration: '',
programStartDate: '',
programEndDate: '',
housing: '',
program: '',
extraNightsOfHousing: '',
housingCheckInDate: '',
housingCheckOutDate: '',
airport: '',
airportPickUp: false,
airportDropOff: false,
requiresI20: false,
transferStudent: false,
flsHealthInsurance: false,
expressMail: false,
processSEVISAppFee: false,
unaccompaniedMinorService: false,
howDidYouHearAboutFls: '',
specifyHowHeardAboutFls: '',
additionalComments: '',
termsAndConditions: false,
programType: '',
// TODO: Figure out passport photo & financial document image upload
},
billing: {
billingAddressCountry: '',
},
};
const [price, setPrice] = useState(0);
// TODO: Going to want to create a warning that states that if localStorage is disabled, the app will not work properly
const [prices, setPrices] = useLocalStorageState('prices', []);
const [userData, setUserData] = useLocalStorageState(
'userData',
applicationDefaults.user
);
const [applicationData, setApplicationData] = useLocalStorageState(
'applicationData',
applicationDefaults.application
);
const [billingData, setBillingData] = useLocalStorageState(
'billingData',
applicationDefaults.billing
);
const [currentCenter, setCurrentCenter] = useState(null);
const [currentProgram, setCurrentProgram] = useState(null);
// TODO: Because this is async, we should probably create a flag to prevent form submission until state has updated
const handleDataChange = (name, value, type) => {
// console.table({ name, value, type });
if (type === 'user') {
setUserData({
...userData,
[name]: value,
});
} else if (type === 'billing') {
setBillingData({
...billingData,
[name]: value,
});
} else if (type === 'application') {
setApplicationData({
...applicationData,
[name]: value,
});
}
};
const handleBatchInputChange = (values, type) => {
// TODO: This is a nonce function, to be replaced with a DRYer solution later
if (type === 'user') {
setUserData({
...userData,
...values,
});
} else if (type === 'billing') {
setBillingData({
...billingData,
...values,
});
} else if (type === 'application') {
setApplicationData({
...applicationData,
...values,
});
}
};
const handleApplicationState = currentValues => {
console.log('incoming values', currentValues);
let applicationDataType;
for (const property in currentValues) {
// Using a lodash methods to make object iteration easier
if (!applicationDataType) {
applicationDataType = _reduce(
applicationDefaults,
(accum, appDefault, appDefaultKey) => {
if (!accum) {
// This has to be, without a doubt, the worst variable name I've ever come up with, and on that principle alone I am honorbound to use it
const isIncomingPropertyInCurrentAppDefault = Object.keys(
appDefault
).some(key => key === property);
accum = isIncomingPropertyInCurrentAppDefault
? appDefaultKey
: null;
}
return accum;
},
null
);
}
/* This checks if an incoming state change came from a mutli select, and parses that into something that is more human readable for the final
submission, as well as for local storage. */
if (
currentValues[property] &&
currentValues[property].hasOwnProperty('value')
) {
console.log('got in');
currentValues[property] = currentValues[property].value;
}
}
console.log('formatted current values', currentValues);
console.log('applicationDataType', applicationDataType);
handleBatchInputChange(currentValues, applicationDataType);
};
return (
<Fragment>
<NetlifyStaticForm
formFields={[
...Object.keys(userData),
...Object.keys(applicationData),
...Object.keys(billingData),
]}
/>
{/* // NOTE: There's a bug with stepwizard wherein it fails if you
provide only one child */}
<Section
sectionClasses={['section']}
containerClasses={['container']}
>
{/* TODO: For some reason, the hash has stepped rendering in the URL bar? */}
<StepWizard isHashEnabled={true} nav={<Steps stepsNum={5} />}>
<PersonalInfo
hashKey={'personal-info'}
handleDataChange={handleDataChange}
userData={userData}
prices={prices}
setPrices={setPrices}
price={price}
setPrice={setPrice}
calculatePrice={calculatePrice}
handleApplicationState={handleApplicationState}
/>
<Address
hashKey={'address'}
userData={userData}
handleDataChange={handleDataChange}
handleBatchInputChange={handleBatchInputChange}
prices={prices}
setPrices={setPrices}
price={price}
setPrice={setPrice}
calculatePrice={calculatePrice}
handleApplicationState={handleApplicationState}
/>
{/* TODO: Might want to consider unifying these two components, if
the step wizard allows duplicates */}
<AdditionalInfo
hashKey={'additional-info'}
handleDataChange={handleDataChange}
handleBatchInputChange={handleBatchInputChange}
prices={prices}
setPrices={setPrices}
price={price}
setPrice={setPrice}
calculatePrice={calculatePrice}
applicationData={applicationData}
currentCenter={currentCenter}
setCurrentCenter={setCurrentCenter}
currentProgram={currentProgram}
setCurrentProgram={setCurrentProgram}
setApplicationData={setApplicationData}
handleApplicationState={handleApplicationState}
/>
<MoreInfo
hashKey={'more-info'}
userData={userData}
applicationData={applicationData}
handleDataChange={handleDataChange}
prices={prices}
setPrices={setPrices}
price={price}
setPrice={setPrice}
calculatePrice={calculatePrice}
/>
<BillingCheckout
hashKey={'billing-checkout'}
userData={userData}
billingData={billingData}
handleDataChange={handleDataChange}
handleBatchInputChange={handleBatchInputChange}
prices={prices}
setPrices={setPrices}
price={price}
setPrice={setPrice}
calculatePrice={calculatePrice}
applicationData={applicationData}
/>
</StepWizard>
</Section>
</Fragment>
);
};
const ApplicationPage = ({ data }) => {
// TODO: Page title needs to change as user progress through application
return (
<Layout
isScrolled={true}
hasNavHero={true}
hasNavButtons={false}
pageTitle={'Personal Information'}
>
<ApplicationTemplate />
</Layout>
);
};
export default ApplicationPage;
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/computer-science.md
---
path: computer-science
name: <NAME>
centerNameRelation:
- Cal State Long Beach
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/computer-science-camp-1.jpg
- /assets/computer-science-2.jpg
programDetails:
minimumAge: 12
duration: 3
price: 4675
durationRelation: 3
specialty-tour-description: Increase your computer knowledge using the latest
technology at our camp in the innovative state of California! Learn how to
design your own website from scratch and develop skills that will help prepare
you for your future. We'll also introduce you to various programming languages
such as Java, Python, HTML. and CSS. Not to mention, you'll enjoy excursions
to some of California's best attractions!
activities-and-excursions: |-
* Discovery Cube
* California Science Center
* Hollywood
* Beverly Hills
* Downtown LA
* Aquarium of the Pacific
### Optional Tours Include:
* Disneyland
* Universal Studios
* Six Flags Amusement Park
* Santa Monica
* MLB Baseball Game
features: |-
* 18 lessons of English each week with students from around the world
* 6 computer science lessons each week
* Evening activities, including dances, sports, and movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls, in shared
room accommodation.
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/data/enhancements/in-person/airport-transfer-1.md
---
name: Airport Transfer
centerNameRelation:
- Saddleback College (Summer Only)
priceDetails:
price: 175
payPeriod: once
notes:
- Los Angeles International Airport, LAX
---
<file_sep>/src/netlify-content/data/housing/homestay-twin-room-2.md
---
name: <NAME>
centerNameRelation:
- Chestnut Hill College
priceDetails:
price: 225
payPeriod: weekly
mealsPerWeek: 16
---
<file_sep>/src/netlify-content/data/locations/cal-state-long-beach.md
---
name: Long Beach, CA
centerName: Cal State Long Beach (Summer Only)
---
<file_sep>/src/netlify-content/data/enhancements/in-person/airport-transfer.md
---
name: Airport Transfer
centerNameRelation:
- Chestnut Hill College (from Summer, 2021)
priceDetails:
price: 150
payPeriod: once
notes:
- Newark International Airport, EWR
---
<file_sep>/src/netlify-content/navbar-items/about-us.md
---
path: about-us
pageName: About Us
name: About Us
order: 3
---
<file_sep>/src/netlify-content/data/programs/online/virtual-cinema-camp.md
---
name: Weekend TOEFL
onlineProgramType: Online Essential Program
durationOptions:
maxWeeks: 4
exceedMaxWeeks: true
minWeeks: 1
priceDetails:
price: 95
payPeriod: weekly
hoursPerWeek: '5'
lessonsPerWeek: 4
minutesPerLesson: 50
timesOffered:
- 4:00 AM
termDates: []
numWeeks: 4+
---
<file_sep>/src/netlify-content/data/programs/online/general-english.md
---
name: <NAME>
onlineProgramType: Online Pathway Program
durationOptions:
maxWeeks: 32
exceedMaxWeeks: true
weekThresholds:
- threshold-max: 3
price-per-week: 295
hours-per-week: 15
lessons-per-week: 19
pricePerWeek: 325
- threshold-max: 11
price-per-week: 290
hours-per-week: 15
lessons-per-week: 18
pricePerWeek: 310
- threshold-max: 23
price-per-week: 285
hours-per-week: 15
lessons-per-week: 18
pricePerWeek: 300
- threshold-max: 31
pricePerWeek: 285
- threshold-max: 32
pricePerWeek: 270
minWeeks: 1
priceDetails:
price: 0
payPeriod: weekly
hoursPerWeek: '20'
lessonsPerWeek: 24
minutesPerLesson: 50
timesOffered:
- 6:00 AM
- 9:00 AM
---
<file_sep>/src/netlify-content/pages/dynamic/locations/philadelphia-pa.md
---
path: philadelphia-pa
name: <NAME>
centerNameRelation:
- Chestnut Hill College
description: Study and live in "The City of Brotherly Love"
quick-facts:
- name: Campus Facilities
icon: /assets/campus-facilities-icon.png
items: |-
* Fournier Dining Hall
* Academic Computer Center
* Griffin's Den Café
* Logue Library
* Sports Facilities
* Free WiFi
* Smartboards
* Student Lounge
* Shuttle to Philadelphia train
- name: Popular Majors
icon: /assets/popular-majors-icon.png
items: |-
* Business
* Biology
* Health Sciences
* Psychology
* Social Sciences
- name: Airport Pickup
icon: /assets/airport-pickup-icon.png
items: |-
* Philadelphia International Airport (PHL) - 37 kilometers
* Newark International Airport (EWR) - 138 kilometers
- name: Average Temp
icon: /assets/average-temp-icon.png
items: |-
* Spring - 18°C
* Summer - 27°C
* Fall - 20°C
* Winter - 5°C
- name: Enrollment
icon: /assets/enrollment-icon.png
items: "* Approximately 1,500 full-time graduate and undergraduate students"
- name: Programs Offered
icon: /assets/programs-offered-icon.png
items: |-
* Core English
* General English
* Intensive English
* Academic English
* TOEFL Preparation
* High School Completion
- name: Local Transportation
icon: /assets/local-transportation-icon.png
items: >-
* Shuttle: Free campus shuttle provides transportation to local shopping
and Philadelphia trains
* Bus: Bus service throughout the Philadelphia area
* Train: SEPTA provides rail service to Philadelphia and surrounding communities
- name: Distance to Major Attractions
icon: /assets/major-attractions-icon.png
items: |-
* Valley Forge - 14 miles
* Downtown Philadelphia - 15 miles
* Gettysburg National Military Park - 134 miles
* Washington, DC - 147 miles
carousel-images:
- /assets/chestnut-hill-college-1.jpg
- /assets/study-30-1.jpg
- /assets/chestnut-hill-3.jpg
- /assets/chestnut-hill-2.jpg
- /assets/concurrent.jpg
- /assets/location-preview-philly.jpg
post-content: >-
# Open for Summer, 2021
## OVERVIEW
### Learn English in Philadelphia, "The City of Brotherly Love"
Famous as the birthplace of the United States, Philadelphia is a diverse, urban destination that preserves four centuries of American history and architecture, as well as fascinating museums and endless shopping. While visiting "The City of Brotherly Love," students can see such historic attractions as the Liberty Bell and Independence Hall, then get a taste of some of Philadelphia's many culinary flavors, like the renowned Philly cheesesteak sandwich, from dozens of bakers, farmers, and restaurants at Reading Terminal Market.
### A Beautiful, Relaxing Campus Setting
A private Catholic school, Chestnut Hill College is located on the outskirts of the city in the beautiful Germantown area. The college was founded in 1924 and its striking Gothic buildings have earned it a spot on the National Register of Historic Places. The campus houses modern facilities integrated with its historic buildings to meet the needs of today's students.
### Extensive Opportunities to Pursue Educational Goals
The attractive campus includes the picturesque St. Joseph Hall, a chapel, tennis courts, a soccer field, and complete fitness facilities. Chestnut Hill College offers a rigorous liberal arts education with a mission of helping prepare students for success in all areas of life.
## CAMPUS PROFILE
FLS is located on the campus of Chestnut Hill College in northwest Philadelphia's quaint Germantown neighborhood. A private Catholic school, the college was founded in 1924 and is listed on the National Register of Historic Places. The beautiful campus includes striking Gothic structures like St. Joseph Hall, a chapel, tennis courts, a soccer filed, and an indoor swimming pool.
### Campus Facilities
* **Academic Computer Center**
Providing students with Internet access and word processing tools, the computer lab is perfect for students doing research for class or simply checking their email.
* **Logue Library**
Offering a selection of course-related books as well as books for casual reading, the library provides students additional space for reading and study after class.
* **Student Lounge**
With comfy sofas and plenty of table space, the student lounge is the perfect place to relax for some reading, have a quick snack, or catch up with your friends.
## HOUSING OPTIONS
### Homestay
A homestay is a great way to experience American culture while improving your English ability! All FLS centers offer homestay accommodation with American families individually selected by FLS. Learn about American daily life, practice English on a regular basis and participate in many aspects of American culture that visitors often don't get to see. (Twin and Single options available).
### Residence Halls
Chestnut Hill College offers safe and secure student housing in traditional residence halls. Each room provides shared accommodation for FLS students on the same floor as American students. Students enjoy access to TV lounges and game rooms. All residence halls are located a short distance from key campus facilities such as the dining hall, library, sports facilities, and break areas. Students will have an accommodation experience identical to that of a typical American college student. (Shared housing - fall and spring semesters only)
Residence in the dormitory requires proof of the following immunizations:
* Two doses of Varicella vaccine (Chicken Pox) or a history of infection
* Two doses of MMR (measles, mumps, and rubella) vaccine or a history of infection
* One dose of the DPT, Hepatitis B, and Meningitis vaccines
* TB test
<iframe width="560" height="349" src="https://www.youtube.com/embed/cQJKGECy8i4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen ></iframe>
## AREA PROFILE
**The Chestnut Hill Experience**
Philadelphia is a major international city with a rich history extending back to America's founding. Throughout the city you'll find reminders of America's past, such as Independence Hall and the Liberty Bell. Today Philadelphia is a vigorous, modern metropolis with a full range of attractions from world-class museums to major sports teams to diverse ethnic neighborhoods.
* Visit the shops in downtown Philadelphia then have a picnic lunch at Rittenhouse Square
* Get your photo taken with <NAME>'s famous LOVE sculpture at LOVE Park
* Spend a day in natural splendor as you walk among the flowers and trees of <NAME>
* Dine at one of the many superb restaurants in Philadelphia, or enjoy street-side dining as you grab a famous Philadelphia Cheesesteak sandwich while on the go.
* Catch a musical performance at one of Philadelphia's many clubs and concert venues.
* Enjoy the many seasonal and holiday events and festivals throughout Philadelphia, including the nation's largest free concert celebrating America's Independence Day on July 4.
**English + Volunteering**
FLS offers ESL students a wonderful way to practice their new English skills while immersing themselves in American society by volunteering at local charities and community service centers. Join other FLS students as they perfect their conversational English while helping others! Here are some of the opportunities you will enjoy at FLS Chestnut Hill College:
* Teens, Inc.
* Chestnut Hill Elementary School
* Meadowview Rehabilitation Center
**Optional Weekend and Evening Activities**
FLS offers ESL students memorable and educational tour experiences, and opportunities to visit the best attractions of the United States. Students will have many opportunities to take part in excursions with the full supervision of our trained FLS staff.
**Activities Include:**
* Historic Philadelphia
* Philadelphia Museum of Art
* Six Flags Great Adventure
* Philadelphia Zoo
* Washington, DC
---
<file_sep>/src/components/navbar/NavbarDropdownContainer.js
import React, { useState, useRef, Fragment } from 'react';
import { Link, useStaticQuery } from 'gatsby';
import navbarStyles from 'src/components/navbar/Navbar.module.scss';
import NavbarDropdown from 'src/components/navbar/NavbarDropdown';
export default function NavbarDropdownContainer({
title,
items,
parentEl,
rootNavPath,
mainNavItem,
}) {
const data = useStaticQuery(graphql`
{
allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/pages//" } }
) {
edges {
node {
frontmatter {
path
name
}
fileAbsolutePath
}
}
}
}
`);
if (mainNavItem.collectionName) {
items = data.allMarkdownRemark.edges
.filter(edge => {
return edge.node.fileAbsolutePath.includes(
mainNavItem.collectionName
);
})
.map(sublink => {
return {
...sublink.node.frontmatter,
fileAbsolutePath: sublink.node.fileAbsolutePath,
};
});
}
const [isHoveringDropdown, setIsHoveringDropdown] = useState(false);
const [dropdownPos, setDropdownPos] = useState(0);
const [dropdownWidth, setDropdownWidth] = useState(0);
const dropdownContainerEl = useRef(null);
// TODO: Figure out why the dropdown is slightly offset
return (
<Link
to={`${rootNavPath}`}
className={navbarStyles.navbar__navItem}
onMouseEnter={() => {
let newDropdownPos = {};
newDropdownPos.top =
parentEl.current.getBoundingClientRect().top +
parentEl.current.offsetHeight;
setDropdownWidth(dropdownContainerEl.current.offsetWidth);
setDropdownPos(newDropdownPos);
setIsHoveringDropdown(true);
}}
onMouseLeave={() => {
setIsHoveringDropdown(false);
}}
ref={dropdownContainerEl}
>
<span>{title}</span>
<NavbarDropdown
isHovering={isHoveringDropdown}
dropdownPos={dropdownPos}
dropdownWidth={dropdownWidth}
items={items}
rootNavPath={rootNavPath}
/>
</Link>
);
}
<file_sep>/src/pages/test-identity.js
import netlifyIdentity from 'netlify-identity-widget';
import React, { useEffect, useState } from 'react';
import Section from 'src/components/section/Section';
export default () => {
useEffect(() => {
netlifyIdentity.on('init', user => console.log('init', user));
netlifyIdentity.init();
netlifyIdentity.on('login', user => console.log('login', user));
}, []);
const reportUser = () => {
console.log('retrieved user', netlifyIdentity.gotrue.currentUser());
};
const [userInput, setUserInput] = useState('');
return (
<Section>
<div className="columns is-multiline">
<div className="column is-full">
<h1>Test Identity Flow</h1>
</div>
<div className="column is-full">
<input
value={userInput}
onChange={e => setUserInput(e.target.value)}
type="text"
/>
</div>
<div className="column is-full">
<button
className="fls__button"
onClick={() => {
netlifyIdentity.gotrue.currentUser().update({
data: {
nestedValues: {
iAm: 'an object',
hereIsAnArray: [
{
yes: true,
},
{ no: false },
],
},
},
});
}}
>
Persist Data
</button>
</div>
<div className="column is-full">
<button className="fls__button" onClick={reportUser}>
Report User
</button>
</div>
<div className="column is-full">
<button
className="fls__button"
onClick={() => netlifyIdentity.open()}
>
Log In/Sign Up
</button>
</div>
</div>
</Section>
);
};
<file_sep>/src/netlify-content/pages/dynamic/programs/online/sat-preparation.md
---
path: online-sat-preparation
name: <NAME>
type: Online Essential Program
hero-image: /assets/nick-morrison-fhnnjk1yj7y-unsplash.jpg
programDetails:
lessonsPerWeek: 12
hoursPerWeek: "10"
minutesPerLesson: 50
description: A complete program for increased SAT scores!
program-post-content: >-
The SAT is the most commonly taken test for U.S. students entering college.
Our program provides students with an understanding of the test structure and
improves their ability to analyze written passages, understand key academic
vocabulary, use standard writing conventions and solve problems in data
analysis and algebra.
Available for students in Level 13 and above, our SAT Preparation course will make students more confident in every aspect of the test, and provides extensive practice testing, to secure higher scores for our students.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* 2 hours per day/ 12 lessons per week
* Start any Monday
* Small class sizes
* 3 Start times available: 3 PM Pacific Time or 3 AM Pacific Time
### Price
* $150 per week
---
<file_sep>/src/components/application/landing/SpecialtyToursForm.js
import React, { useState, Fragment } from 'react';
import { useStaticQuery, graphql } from 'gatsby';
import { formatEdges } from 'src/utils/helpers';
import moment from 'moment';
import sectionStyles from 'src/components/section/Section.module.scss';
import 'react-datepicker/dist/react-datepicker.css';
import DatePicker from 'react-datepicker';
import Select from 'react-select';
import {
calculatePrice,
calculateDateOffset,
removePrices,
updatePrices,
generatePriceThresholds,
} from 'src/utils/helpers';
export default function InPersonForm({
applicationData,
setApplicationData,
handleSetApplicationData,
programsData,
setPrices,
prices,
}) {
const data = useStaticQuery(graphql`
{
locations: allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/data/locations/" } }
) {
edges {
node {
frontmatter {
name
centerName
}
}
}
}
housing: allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/data/housing/" } }
) {
edges {
node {
frontmatter {
name
centerNameRelation
priceDetails {
payPeriod
price
}
}
}
}
}
}
`);
programsData = formatEdges(programsData);
const centersData = formatEdges(data.locations);
const [programOptions, setProgramOptions] = useState([]);
const [durationOptions, setDurationOptions] = useState([]);
const [startDateOptions, setStartDateOptions] = useState([]);
const centerOptions = centersData
.map(center => {
return {
value: center.centerName,
label: `${center.centerName} @ ${center.name}`,
};
})
.filter(center =>
programsData.some(program =>
program.centerNameRelation.includes(center.value)
)
);
const handleCenterChange = centerChange => {
// Set state operatons are async, so we'll use this non-async version for the below operations
const currentCenter = centersData.find(
center => center.centerName === centerChange.value
);
handleSetApplicationData('center', currentCenter, 'application');
/*
If the duration or program is already selected, and the user picks a new center, this can cause complications with already selected programs
and durations. It seems easier, then, to just require them to reselect a program & duration.
*/
if (applicationData.duration || applicationData.program) {
/*
Originally, this was two state changes in quick succession. This was causing problems, and though there may be a better way to handle it,
manually batching the state changes seems to solve the problem.
*/
let blankedApplicationData = {};
if (applicationData.duration)
blankedApplicationData.duration = null;
if (applicationData.program) blankedApplicationData.program = null;
if (applicationData.housing) blankedApplicationData.housing = null;
setApplicationData({
...applicationData,
...blankedApplicationData,
});
setPrices(removePrices(prices, ['program', 'housing']));
}
// Set program options to be the programs associated with the selected center
setProgramOptions(
programsData
.filter(program => {
return program.centerNameRelation.includes(
centerChange.value
);
})
.map(program => {
return {
value: program.name.toLowerCase().split(' ').join('-'),
label: program.name,
};
})
);
};
const handleProgramChange = programChange => {
const currentProgram = programsData.find(
program => program.name === programChange.label
);
// TODO: State changes are async, so we keep using 'currentProgram' inside this function scope
// With some refactoring, we could probably change 'handleDataChange' to take a callback that can be passed to the state change
handleSetApplicationData('program', currentProgram);
// TODO: Need to re-enter dates in the CMS for the new date format
const formattedDates = currentProgram.programDates.map(programDate => {
const parsedDateString = parseInt(programDate.arrive);
return {
value: new Date(parsedDateString),
label: moment(parsedDateString).format('MMM Do, YY'),
};
});
setStartDateOptions(formattedDates);
if (currentProgram.priceDetails.range) {
// TODO: This 'generatePriceThresholds' function should be distributed among the other program types
setDurationOptions(
generatePriceThresholds(
currentProgram.priceDetails.range.maxWeeks,
currentProgram.priceDetails.range.exceedMaxWeeks
)
);
handleSetApplicationData('program', currentProgram);
} else if (currentProgram.priceDetails.package) {
setDurationOptions([
{
label: `${currentProgram.priceDetails.package.duration} weeks`,
value: currentProgram.priceDetails.package.duration,
},
]);
setApplicationData({
...applicationData,
...{
program: currentProgram,
duration: {
label: `${currentProgram.priceDetails.package.duration} weeks`,
value: currentProgram.priceDetails.package.duration,
},
},
});
}
};
const handleDurationChange = durationChange => {
// If programStartDate exists, we can be confident there's also a program end date & housing check in/check out dates
// TODO: Implement this new 'calculateDateOffset' helpers into the other program types
if (applicationData.programStartDate) {
setApplicationData({
...applicationData,
...{
programEndDate: calculateDateOffset(
applicationData.programStartDate,
durationChange.value * 7 - 3
),
duration: {
label: durationChange.label,
value: durationChange.value,
},
housingCheckInDate: calculateDateOffset(
applicationData.programStartDate,
-1
),
housingCheckOutDate: calculateDateOffset(
applicationData.programStartDate,
durationChange.value * 7 - 2
),
},
});
} else {
handleSetApplicationData('duration', {
label: durationChange.label,
value: durationChange.value,
});
}
let pricePerWeek = applicationData.program.priceDetails.range.weekThresholds.reduce(
(pricePerWeek, currentWeek, index, arr) => {
// If there are no previous thresholds, previous max defaults to 0. Otherwise, the minimum threshold value is last week's max threshold, plus one.
let thresholdMin =
index === 0 ? 1 : arr[index - 1].thresholdMax + 1;
if (
durationChange.value >= thresholdMin &&
durationChange.value <= currentWeek.thresholdMax
) {
return currentWeek.pricePerWeek;
} else {
return pricePerWeek;
}
},
0
);
let updatedPrices = [...prices];
/*
The duration input is only responsible for adding a new program,
since programs are inextricably tied to duration. Other price types, like housing,
are handled by the change of their respective inputs.
*/
if (!updatedPrices.find(priceItem => priceItem.type === 'program')) {
updatedPrices.push({
type: 'program',
label: `${applicationData.program.name} @ ${applicationData.center.centerName}`,
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
// TODO: Is there a way to capture the payPeriod for programs in the CMS?
payPeriod: 'Per Week',
},
});
} else {
// TODO: This function might be clearer if it supports chaining, or a way to pass in multiple changes as arguments
updatedPrices = updatePrices(updatedPrices, 'program', {
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
},
});
}
setPrices(updatedPrices);
};
const isMonday = date => date.getDay() === 1;
return (
<Fragment>
<div className="column is-full">
<Select
className="fls__select-container"
classNamePrefix={'fls'}
value={{
label: applicationData.center
? `${applicationData.center.centerName} @ ${applicationData.center.name}`
: 'Select a center.',
value: applicationData.center
? applicationData.center.centerName
: null,
}}
onChange={centerOption => {
handleCenterChange(centerOption);
}}
options={centerOptions}
/>
</div>
<div className="column is-full">
<Select
className={`fls__select-container ${
!applicationData.center
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.program
? applicationData.program.name
: 'Select a program',
value: applicationData.program
? applicationData.program.name
: 'Select a program',
}}
onChange={handleProgramChange}
options={programOptions}
isDisabled={!applicationData.center}
/>
</div>
<div className="column is-full">
<Select
className={`fls__select-container ${
!applicationData.program
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.duration
? applicationData.duration.label
: 'Select a duration.',
value: applicationData.duration
? applicationData.duration.value
: null,
}}
onChange={handleDurationChange}
options={durationOptions}
isDisabled={
!applicationData.program ||
applicationData.program.priceDetails.package
}
/>
</div>
<div className="column is-full">
<DatePicker
selected={
applicationData.programStartDate
? new Date(applicationData.programStartDate)
: applicationData.programStartDate
}
onChange={date => {
setApplicationData({
...applicationData,
...{
programStartDate: date,
programEndDate: (() => {
const clonedDate = new Date(date);
// Each 'week' needs to end on a friday, hence this weird math
return clonedDate.setDate(
clonedDate.getDate() +
(applicationData.duration.value *
7 -
3)
);
})(),
// Default check in date to suinday before start of program
housingCheckInDate: (() => {
const clonedDate = new Date(date);
return clonedDate.setDate(
clonedDate.getDate() - 1
);
})(),
// Default checkout date to saturday after end of program
housingCheckOutDate: (() => {
const clonedDate = new Date(date);
return clonedDate.setDate(
clonedDate.getDate() +
(applicationData.duration.value *
7 -
2)
);
})(),
},
});
}}
minDate={new Date()}
wrapperClassName={`fls__date-wrapper ${
!applicationData.duration
? 'fls__select-container--disabled'
: ''
}`}
className={'input fls__base-input'}
placeholderText={'Choose Your Start Date'}
filterDate={isMonday}
readOnly={!applicationData.duration}
/>
</div>
<div className="column is-half">
<p className={sectionStyles.startYourJourney__price}>
$ {calculatePrice(prices)} USD
</p>
</div>
</Fragment>
);
}
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/toefl-sat.md
---
path: toefl-sat
name: TOEFL/SAT
centerNameRelation:
- Suffolk University
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/masks-in-class1.jpeg
- /assets/toefl-2.jpg
programDetails:
price: 4875
duration: 3
minimumAge: 15
durationRelation: 3
specialty-tour-description: International students must overcome many obstacles
when planning to attend an American college, including English fluency
requirements, minimum standardized test scores, and knowledge of the US higher
education system. Developed especially for rising juniors and seniors in high
school, this camp immerses students in a combination of classes, workshops,
and college visits with an advanced, content-based curriculum to prepare them
for college success. At the same time, students will enjoy an introduction to
the great city of Boston, America's educational capital!
activities-and-excursions: |-
* Newbury Street
* Faneuil Hall and Quincy Market
* Beacon Hill and the State House
* Museum of Fine Arts
* Freedom Trail
* Duck Tour
* Revere Beach
### University Tours:
* Harvard University
* MIT
* UMass Boston
* Brown University (optional)
### Optional Tours available:
* New York Weekend
* Six Flags Amusement Park
features: |-
* 18 lessons of English per week
* 1 college preparation workshop per week
* 4 university visits
* Evening activities, including games, parties, and dances
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation at Suffolk University
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/navbar-items/contact.md
---
path: contact
pageName: Contact
name: Contact
order: 4
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/academic-english.md
---
path: online-adademic
name: <NAME>
type: Online Pathway Program
hero-image: /assets/selective-focus-photo-of-man-using-laptop-1438081.jpg
programDetails:
lessonsPerWeek: 36
hoursPerWeek: "30"
minutesPerLesson: 50
description: Learn the English you need for academic success
program-post-content: >-
The FLS Academic English Program is perfect for students who want to improve
their English skills as quickly as possible and get on the right track for
college and university success! This program offers the most lessons per week
available at FLS. Students will study in our core integrated skills class,
will attend a daily workshop, and have a choice of either two electives, a
test preparation class, or our high school completion course.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
As part of our Online Pathway Program you will participate via webcam with a live in-person class.
program-features-content: >-
### Program Features:
* 6 hours of study per day/ 30 hours per week
* 18 levels
* Textbooks and materials provided
* Small class size
* All classes taught by TEFL-certified teachers with native fluency in American English
---
<file_sep>/src/netlify-content/data/programs/in-person/academic-english-2.md
---
name: <NAME>
centerNameRelation:
- Saddleback College
- Citrus College
durationOptions:
maxWeeks: 32
weekThresholds:
- thresholdMax: 3
pricePerWeek: 510
- thresholdMax: 11
pricePerWeek: 485
- thresholdMax: 23
pricePerWeek: 470
- thresholdMax: 31
pricePerWeek: 425
- thresholdMax: 32
pricePerWeek: 400
exceedMaxWeeks: true
hoursPerWeek: "30"
lessonsPerWeek: 36
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/data/housing/international-guest-house.md
---
name: <NAME>
centerNameRelation:
- Boston Commons
priceDetails:
price: 475
payPeriod: weekly
mealsPerWeek: 14
minimumAge: 16
notes:
- Shared room
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/boston-summer.md
---
name: <NAME>
centerNameRelation:
- Suffolk University
price: 4875
duration: 3
minimumAge: 15
priceDetails:
range:
maxWeeks: 3
weekThresholds:
- thresholdMax: 3
pricePerWeek: 1625
programDates:
- arrive: 2021-06-21T07:00:00.000Z
depart: 2021-07-10T07:00:00.000Z
- arrive: 2021-06-27T07:00:00.000Z
depart: 2021-07-17T07:00:00.000Z
- arrive: 2021-07-04T07:00:00.000Z
depart: 2021-07-24T07:00:00.000Z
- arrive: 2021-07-11T07:00:00.000Z
depart: 2021-07-31T07:00:00.000Z
- arrive: 2021-07-18T07:00:00.000Z
depart: 2021-08-07T07:00:00.000Z
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/components/application/StripeForm.js
import React, { Fragment } from 'react';
import { CardElement, useStripe, useElements } from '@stripe/react-stripe-js';
export default function () {
const stripe = useStripe();
const elements = useElements();
return <CardElement className="fls__base-input fls__base-input--payment" />;
}
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/explore-california-jr.md
---
path: explore-california-jr
name: <NAME>
centerNameRelation:
- Cal State Long Beach
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/explore-ca-jr.-2.jpg
programDetails:
minimumAge: 12
duration: 3
price: 4635
durationRelation: 3
specialty-tour-description: As the home of Disneyland, the beach, and sunny
weather, it's no surprise that California is popular with kids. Our calendar
keeps campers active with trips to legendary beaches, famous sites, and some
of the best shopping malls around! After motivating English classes with our
friendly teachers, students will need to get their cameras ready for visits to
some of the top tourist attractions in Southern California.
activities-and-excursions: |-
* Hollywood
* Huntington Beach
* Beverly Hills
* Newport Beach
* Downtown LA
* Laguna Beach
* Fashion Island
* UC Irvine Tour
* Aquarium of the Pacific
* Harbor Cruise and Whale Watching
### Optional Tours Include:
* Disneyland
* Universal Studios
* Six Flags Magic Mountain
* Knott's Berry Farm
* Santa Monica Pier
* MLB Baseball Game
features: |-
* 18 lessons of English each week with students from around the world
* Evening activities, including dances, sports, and movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation.
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/surf.md
---
name: Surf
centerNameRelation:
- Cal State Long Beach (Summer Only)
price: 4475
duration: 3
minimumAge: 15
priceDetails:
range:
maxWeeks: 3
weekThresholds:
- thresholdMax: 3
pricePerWeek: 1495
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/data/programs/in-person/general-english.md
---
name: <NAME>
location:
- Chestnut Hill College
centerNameRelation:
- Chestnut Hill College
durationOptions:
maxWeeks: 32
exceedMaxWeeks: true
weekThresholds:
- thresholdMax: 3
pricePerWeek: 430
- thresholdMax: 11
pricePerWeek: 415
- thresholdMax: 23
pricePerWeek: 400
- thresholdMax: 31
pricePerWeek: 380
- thresholdMax: 32
pricePerWeek: 360
hoursPerWeek: "20"
lessonsPerWeek: 24
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/data/locations/suffolk-university.md
---
name: Boston, MA
centerName: Suffolk University
---
<file_sep>/src/components/section/section.js
import React from 'react';
export default function Section(props) {
const containerClasses =
'containerClasses' in props
? props.containerClasses.join(' ')
: 'container',
sectionClasses =
'sectionClasses' in props
? props.sectionClasses.join(' ')
: 'section';
return (
<section className={sectionClasses}>
<div className={containerClasses}>{props.children}</div>
</section>
);
}
<file_sep>/src/components/hero/Hero.js
import React from 'react';
import heroStyles from './Hero.module.scss';
import 'slick-carousel/slick/slick.css';
import Slick from 'react-slick';
export default function Hero({ carouselItems }) {
// TODO: The carousel needs to be its own component
const slickSettings = {
autoplay: true,
draggable: false,
focusOnSelect: false,
arrows: false,
autoplaySpeed: 4000,
infinite: true,
adaptiveHeight: true,
};
return (
<section className={`hero is-fullheight ${heroStyles.heroFls}`}>
<Slick {...slickSettings}>
{carouselItems.map(carouselItem => (
<div key={carouselItem.title}>
<div
className={heroStyles.heroBody__carouselItem}
style={{
backgroundImage: `url(${carouselItem.carousel_image})`,
}}
>
<div className={heroStyles.hero__copyContainer}>
<h2
className={`subtitle ${heroStyles.hero__copyTitle}`}
>
{carouselItem.title}
</h2>
<h1 className={heroStyles.hero__copy}>
{carouselItem.copy}
</h1>
</div>
</div>
</div>
))}
</Slick>
</section>
);
}
<file_sep>/src/components/navbar/Navbar.js
import React, { useState, useRef, Fragment } from 'react';
import { Link, useStaticQuery } from 'gatsby';
import navbarStyles from './Navbar.module.scss';
import flsLogo from 'src/img/fls-international-logo.png';
import 'hamburgers/dist/hamburgers.css';
import NavbarDropdownContainer from 'src/components/navbar/NavbarDropdownContainer';
import NavbarMobile from 'src/components/navbar/NavbarMobile';
export default function Navbar(props) {
const data = useStaticQuery(graphql`
{
allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/navbar-items//" } }
) {
edges {
node {
frontmatter {
path
name
collectionName
order
links {
collectionName
name
path
isExternalLink
}
}
fileAbsolutePath
}
}
}
}
`);
const mainNavItems = data.allMarkdownRemark.edges.map(edge => {
return {
...edge.node.frontmatter,
fileAbsolutePath: edge.node.fileAbsolutePath,
};
});
mainNavItems.sort((a, b) => a.order - b.order);
/* TODO: This is a silly way to get the program category links (speciality tours, online, in-person) to
link to the /programs page using a "#" instead of "/". This is because I'm using hash routing on the
programs page so that the programs can be filtered in a "single page app" style. */
mainNavItems.forEach(mainNavItem => {
if (
mainNavItem.links &&
mainNavItem.fileAbsolutePath.includes('programs')
)
mainNavItem.links.forEach(link => (link.isProgramCategory = true));
});
const navParentEl = useRef(null);
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
// TODO: This state, and its logic, is a near duplicate of the desktop nav's position logic. Could be consolidated?
const [mobileDropdownPadding, setMobileDropdownPadding] = useState({
top: 0,
});
return (
<Fragment>
<nav
className={`navbar is-fixed-top ${navbarStyles.navbarFls}`}
ref={navParentEl}
>
<div className="container">
<div
className={`navbar-brand ${navbarStyles.navbarBrandFls}`}
>
<a className="navbar-item" href="/">
<img
className={navbarStyles.navbar__logo}
src={flsLogo}
alt="Logo"
/>
</a>
<button
className={`hamburger hamburger--spin ${
navbarStyles.hamburgerFls
} ${isMobileMenuOpen ? 'is-active' : ''} `}
onClick={() => {
let newDropdownPadding = {};
newDropdownPadding['padding-top'] =
navParentEl.current.getBoundingClientRect()
.top + navParentEl.current.offsetHeight;
setMobileDropdownPadding(newDropdownPadding);
setIsMobileMenuOpen(prevState => !prevState);
}}
type="button"
>
<span className="hamburger-box">
<span
className={`hamburger-inner ${navbarStyles.hamburgerInnerFls}`}
></span>
</span>
</button>
</div>
<div id="navbarMenu" className="navbar-menu">
<div className={navbarStyles.flsNav__content}>
{mainNavItems.map(mainNavItem => {
if (
mainNavItem.links ||
mainNavItem.collectionName
) {
return (
<NavbarDropdownContainer
mainNavItem={mainNavItem}
title={mainNavItem.name}
items={mainNavItem.links}
rootNavPath={`/${mainNavItem.path}`}
parentEl={navParentEl}
key={`/${mainNavItem.path}`}
></NavbarDropdownContainer>
);
} else {
return (
<Link
to={`/${mainNavItem.path}`}
className={
navbarStyles.navbar__navItem
}
key={`/${mainNavItem.path}`}
>
{mainNavItem.name}
</Link>
);
}
})}
</div>
</div>
</div>
</nav>
<NavbarMobile
mobileDropdownPadding={mobileDropdownPadding}
isMobileMenuOpen={isMobileMenuOpen}
mainNavItems={mainNavItems}
/>
</Fragment>
);
}
<file_sep>/src/netlify-content/data/programs/in-person/academic-english.md
---
name: Academic English
centerNameRelation:
- Chestnut Hill College
durationOptions:
maxWeeks: 3
weekThresholds:
- thresholdMax: 3
pricePerWeek: 510
hoursPerWeek: '28'
lessonsPerWeek: 36
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/stem.md
---
name: STEM
centerNameRelation:
- Harvard University Campus
price: 4325
duration: 2
minimumAge: 12
priceDetails:
package:
duration: 3
price: 4325
payPeriod: once
programDates:
- arrive: Jun 27th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 24th, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/data/enhancements/in-person/airport-transfer-4.md
---
name: Airport Transfer
centerNameRelation:
- Chestnut Hill College (from Summer, 2021)
priceDetails:
price: 75
payPeriod: once
notes:
- Philadelphia International Airport, PHI
---
<file_sep>/src/netlify-content/data/programs/online/business-english.md
---
name: <NAME>
onlineProgramType: Online Essential Program
durationOptions:
minWeeks: 1
maxWeeks: 16
exceedMaxWeeks: true
priceDetails:
price: 110
payPeriod: weekly
hoursPerWeek: '7.5'
lessonsPerWeek: 9
minutesPerLesson: 50
timesOffered:
- 4:00 AM
---
<file_sep>/src/components/navbar/NavbarMobileCollapsibleSection.js
import React, { useState, Fragment } from 'react';
import { Link } from 'gatsby';
import navbarStyles from './Navbar.module.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCaretRight } from '@fortawesome/free-solid-svg-icons';
import NavMobileDropdown from 'src/components/navbar/NavMobileDropdown';
export default function NavbarMobileCollapsibleSection({ mainNavItem }) {
const [isCollapsed, setIsCollapsed] = useState(true);
return (
<Fragment>
<div
className="column is-full"
style={{
paddingBottom: 0,
}}
>
<div className={navbarStyles.flsNav__mobileHeaderContainer}>
<Link
to={`/${mainNavItem.path}`}
className={`${navbarStyles.flsNav__mobileHeader} fls--white`}
>
{mainNavItem.name}
</Link>
<div
className={'fls--flex-align-center'}
onClick={() => setIsCollapsed(prevState => !prevState)}
>
<span>Expand</span>
<FontAwesomeIcon
icon={faCaretRight}
className={`${navbarStyles.flsNav__expand} ${
!isCollapsed
? navbarStyles.flsNav__expandExpanded
: ''
}`}
/>
</div>
</div>
</div>
<NavMobileDropdown
mainNavItem={mainNavItem}
rootNavPath={`/${mainNavItem.path}`}
isCollapsed={isCollapsed}
/>
</Fragment>
);
}
<file_sep>/src/components/steps/Steps.js
import React from 'react';
export default function Steps({ stepsNum, currentStep, goToStep }) {
const renderSteps = () => {
let steps = [];
for (let i = 0; i < stepsNum; i++) {
steps.push(
<li
key={i}
onClick={goToStep.bind(this, i + 1)}
className={`steps-segment ${
i + 1 === currentStep ? 'is-active' : ''
}`}
>
<a href="#" className="steps-marker"></a>
</li>
);
}
return steps;
};
return <ul className="steps">{renderSteps()}</ul>;
}
<file_sep>/src/netlify-content/data/programs/online/core-english.md
---
name: <NAME>
onlineProgramType: Online Pathway Program
durationOptions:
maxWeeks: 13
exceedMaxWeeks: true
weekThresholds:
- threshold-max: 3
price-per-week: 295
hours-per-week: 15
lessons-per-week: 19
pricePerWeek: 295
- threshold-max: 7
price-per-week: 290
hours-per-week: 15
lessons-per-week: 18
pricePerWeek: 290
- threshold-max: 12
price-per-week: 285
hours-per-week: 15
lessons-per-week: 18
pricePerWeek: 285
- threshold-max: 13
pricePerWeek: 270
minWeeks: 1
priceDetails:
price: 0
payPeriod: weekly
hoursPerWeek: '15'
lessonsPerWeek: 18
minutesPerLesson: 50
timesOffered:
- 6:00 AM
- 9:00 AM
---
<file_sep>/src/pages/downloads.js
import React from 'react';
import Layout from 'src/components/Layout';
import Section from 'src/components/section/Section';
import HorizontalNav from 'src/components/horizontal-nav/HorizontalNav';
import MediaItem from 'src/components/media-item/MediaItem';
import 'src/styles/contact-us.scss';
export const DownloadsTemplate = () => {
// TODO: This is a critical page that needs to be generated by the CMS. It should be possible to dynamically generate pages like this entirely through the CMS
return (
<Section>
<div className="columns is-multiline">
<div className="column is-full">
{/* TODO: Needs to be made compatible for use on multiple pages */}
<HorizontalNav
navItems={[
'Brochures',
'Flyers',
'Forms',
'English Everywhere',
'CA Accreditation Documentation',
]}
isDownloads={true}
/>
</div>
<div className="column is-full">
<div className="columns">
<div className="column is-one-quarter">
<MediaItem />
</div>
</div>
</div>
</div>
</Section>
);
};
const DownloadsPage = ({ data }) => {
// const { frontmatter } = data.markdownRemark;
return (
<Layout isScrolled={true} hasNavHero={true} pageTitle={'Downloads'}>
<DownloadsTemplate />
</Layout>
);
};
export default DownloadsPage;
// TODO: Here, all the individual fields are specified.
// Is there a way to just say 'get all fields'?
// export const pageQuery = graphql`
// query {
// markdownRemark {
// frontmatter {
// program_cards {
// card_description
// card_image
// card_title
// }
// }
// }
// }
// `;
<file_sep>/src/netlify-content/data/locations/boston-commons.md
---
name: Boston, MA
centerName: Boston-by-the-Park
---
<file_sep>/src/netlify-content/navbar-items/downloads.md
---
path: downloads
pageName: Downloads
name: Downloads
order: 5
---
<file_sep>/src/components/LocationPage.js
import React from 'react';
import { graphql } from 'gatsby';
import Slick from 'react-slick';
import Layout from 'src/components/Layout';
import Section from 'src/components/section/Section';
import Testimonial from 'src/components/testimonial/Testimonial';
import QuickFacts from 'src/components/quick-facts/QuickFacts';
import PriceCalculator from 'src/components/price-calculator/PriceCalculator';
import MarkdownContent from 'src/components/MarkdownContent.js';
import 'slick-carousel/slick/slick.css';
export const LocationPageTemplate = ({ locationPageData }) => {
// TODO: See if there isn't some way to implement the 'alt' sections from before (i.e. the blocks with light gray backgrounds)
const postContent = locationPageData.post_content;
const slickSettings = {
autoplay: true,
arrows: false,
autoplaySpeed: 4000,
};
return (
<Section>
<div className="columns is-multiline">
<div className="column is-3-desktop is-full-tablet">
<PriceCalculator />
<QuickFacts data={locationPageData.quick_facts} />
{/* TODO: We want to implement testimonials, but not just yet */}
{/* <Testimonial /> */}
</div>
<div className="column is-9-desktop is-full-tablet">
<div className="columns is-multiline">
<div className="column is-full">
{/* TODO: Again, these 'programs' classes need genericizing */}
<h2 className="programs__post-title">
{locationPageData.name}
</h2>
</div>
<div className="column is-full">
<div className="fls__location-post-carousel">
<Slick {...slickSettings}>
{locationPageData.carousel_images.map(
carouselImagePath => {
return (
<img
key={carouselImagePath}
src={carouselImagePath}
alt={`${locationPageData.name} carousel image`}
/>
);
}
)}
</Slick>
</div>
</div>
{/* TODO: Figure out how to make anchor tags work with the markdown post */}
{/* <div className="column is-full">
<div className="columns is-variable is-1">
<div className="column">
<a className="fls__location-post-anchor-button">
Overview
</a>
</div>
<div className="column">
<a className="fls__location-post-anchor-button">
Campus Profile
</a>
</div>
<div className="column">
<a className="fls__location-post-anchor-button">
Area Profile
</a>
</div>
<div className="column">
<a className="fls__location-post-anchor-button">
Programs Offered
</a>
</div>
</div>
</div> */}
<div className="column is-full">
<MarkdownContent
content={postContent}
className={'fls__location-post-container'}
classMap={{
h2: 'fls-post__subtitle',
h3: 'fls__location-post-subtitle',
h6: 'fls__location-post-subtitle',
p: 'fls__post-copy',
ul: 'fls__location-post-list',
li: 'fls__list-item fls__list-item--small',
}}
/>
</div>
</div>
</div>
</div>
</Section>
);
};
const LocationPage = ({ data, pageContext, previewData }) => {
if (!previewData) {
const { pagePath } = pageContext;
const locationPageData = data.allMarkdownRemark.edges.find(
edge => edge.node.frontmatter.path === pagePath
).node.frontmatter;
return (
<Layout
isScrolled={true}
hasNavHero={true}
pageTitle={locationPageData.name}
>
<LocationPageTemplate locationPageData={locationPageData} />
</Layout>
);
} else {
return <LocationPageTemplate locationPageData={previewData} />;
}
};
export default LocationPage;
export const LocationPageData = graphql`
{
allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/pages/dynamic/locations//" }
}
) {
edges {
node {
frontmatter {
path
name
name
carousel_images
quick_facts {
name
icon
items
}
post_content
}
}
}
}
}
`;
<file_sep>/src/components/application/AdditionalInfo.js
import React, { useState } from 'react';
import AdditionalInfoForm from 'src/components/application/AdditionalInfoForm';
// TODO: Figure out how best to handle validation
export default function AdditionalInfo({
nextStep,
previousStep,
handleDataChange,
handleBatchInputChange,
prices,
setPrices,
calculatePrice,
applicationData,
currentCenter,
setCurrentCenter,
currentProgram,
setCurrentProgram,
setApplicationData,
handleApplicationState,
}) {
const handleRender = programType => {
if (!applicationData.programType) {
return (
<div className="columns is-multiline">
<div className="column is-full">
<h2 className="title title--fls has-text-centered">
Select Your Program Type
</h2>
</div>
<div className="column is-full">
<button
className="fls__button fls__button--additional-info"
onClick={() =>
handleDataChange(
'programType',
'in-person',
'application'
)
}
>
In-Person
</button>
</div>
<div className="column is-full">
<button
className="fls__button fls__button--additional-info"
onClick={() =>
handleDataChange(
'programType',
'online',
'application'
)
}
>
Online
</button>
</div>
<div className="column is-full">
<button
className="fls__button fls__button--additional-info"
onClick={() =>
handleDataChange(
'programType',
'specialty-tours',
'application'
)
}
>
Specialty Tours
</button>
</div>
</div>
);
} else {
return (
<AdditionalInfoForm
calculatePrice={calculatePrice}
nextStep={nextStep}
previousStep={previousStep}
currentCenter={currentCenter}
setCurrentCenter={setCurrentCenter}
currentProgram={currentProgram}
setCurrentProgram={setCurrentProgram}
handleDataChange={handleDataChange}
handleBatchInputChange={handleBatchInputChange}
prices={prices}
setPrices={setPrices}
applicationData={applicationData}
setApplicationData={setApplicationData}
handleApplicationState={handleApplicationState}
/>
);
}
};
return handleRender(applicationData.programType);
}
<file_sep>/src/netlify-content/data/programs/specialty-tours/playwriting.md
---
name: <NAME>
centerNameRelation:
- Marymount Manhattan College
price: 5250
duration: 3
minimumAge: 15
priceDetails:
package:
duration: 3
price: 5475
payPeriod: once
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/data/programs/in-person/intensive-english-2.md
---
name: <NAME>
location:
- Citrus College
- Saddleback College
centerNameRelation:
- Citrus College
- Saddleback College
durationOptions:
maxWeeks: 32
exceedMaxWeeks: true
weekThresholds:
- thresholdMax: 3
pricePerWeek: 500
- thresholdMax: 11
pricePerWeek: 475
- thresholdMax: 23
pricePerWeek: 440
- thresholdMax: 31
pricePerWeek: 415
- thresholdMax: 32
pricePerWeek: 395
hoursPerWeek: '25'
lessonsPerWeek: 30
minutesPerLesson: 50
---
<file_sep>/src/netlify-content/pages/static/programs.md
---
program_cards:
- card_title: English Language Programs
card_description: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Integer vitae tincidunt massa. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Nulla malesuada finibus tincidunt. Ut maximus ipsum non
ultrices mattis. Interdum et malesuada fames ac ante ipsum primis in
faucibus.
card_image: /assets/specialty-tours-bg.png
programTypeDescriptions:
specialityTours: Explore your favorite subject or sport, or just enjoy the
sights, as you study at the most fascinating destinations in the United
States!
inPerson: Compare FLS International's suite of top quality academic programs to
find the program that suits your goals.
online: Compare FLS International's suite of top quality academic programs to
find the program that suits your goals. all from the comfort of your own
home.
---
<file_sep>/src/netlify-content/pages/static/application-landing.md
---
on-location-program-information:
locations:
- programs:
- program_name: Vacation English
program-details:
duration: 1-3
price: 415
hours: 15
lessons: 18
- program_name: General English
program-details:
duration: 4-7
price: 410
hours: 15
lessons: 18
location_name: Saint Peter's University
- location_name: Chestnut Hill College
programs:
- program_name: Vacation English
program-details:
duration: 1-3
price: 395
hours: 15
lessons: 18
general-fees:
application_fee: 150
housing_placement_fee: 201
health_insurance_fee: 40
tutoring: 70
express_mail_fee: 65
extra_night_homestay: 55
extra_night_resources: 75
books_and_materials: -2
---
<file_sep>/src/netlify-content/data/housing/homestay-twin-room.md
---
name: Homestay Twin Room
centerNameRelation:
- Boston Commons
priceDetails:
price: 275
payPeriod: weekly
mealsPerWeek: 16
---
<file_sep>/src/netlify-content/pages/dynamic/programs/in-person/general-english.md
---
path: general-english
name: General English
hero-image: /assets/dsc08844.jpg
programDetails:
lessonsPerWeek: 24
hoursPerWeek: "20"
minutesPerLesson: 50
description: For students who want to balance English studies with exploring the
sights near our centers, our General English Program is the ideal choice.
program-post-content: >-
### For students who want to balance English studies with exploring the sights
near our centers, our General English Program is the ideal choice.
The General English program combines our core class with a variety of academic and informal methods to take your English proficiency to new levels. The core class thoroughly covers all fundamental aspects of English communication. Our academic workshops include pronunciation clinics, conversation clubs, homework assistance and more. Students will develop English rapidly with more skill practice and have fun at the same time!
Our program places an exceptional emphasis on speaking. Students will practice speaking skills frequently in class, receiving continual guidance and correction from their instructor.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
program-features-content: >-
## PROGRAM FEATURES
All General English Program students enjoy these exceptional features:
* Eighteen levels of study from low beginner to high advanced.
* Small class sizes of 15 or fewer, guaranteeing individual attention from your teacher.
* Core Class emphasizing the four key language skills: speaking, listening, reading and writing.
* Lab-style Academic Workshop offering a range of academic options each week, including Pronunciation Clinics, Conversation Clubs, Homework Labs, Computer Labs, and more.
* Our exclusive English Everywhere program with weekly Hot Sheets, involving your host family, activity guides and FLS staff in your learning process.
* Weekly English tests and individualized progress reports every four weeks.
* Language Extension Day (LED) activities once per term, encouraging students to use English in new settings and contexts.
* Readers and novels to increase reading comprehension and understanding of American culture (for High Beginner and above).
* Access to numerous free activities and specially priced excursions.
* Certificate of Completion upon successful graduation from each level.
* Articulation agreements with numerous colleges allowing admission without a TOEFL score based on completion of the designated FLS level.
* Personalized counseling and academic assistance.
program-details:
lessons-per-week: 20
hours-per-week: 4
minutes-per-lesson: 50
pageName: General English
programType: in-person
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/ielts-preparation.md
---
path: online-ielts-preparation
name: <NAME>
type: Online Essential Program
hero-image: /assets/brooke-cagle-uwvwq8gf8pe-unsplash.jpg
programDetails:
lessonsPerWeek: 12
hoursPerWeek: "10"
minutesPerLesson: 50
description: Gain the skills necessary for success on the IELTS!
program-post-content: >-
The IELTS is a popular test used by employers and colleges to measure student
English proficiency. Our program provides students with the skills to
understand native speakers, follow the development of an idea, find the main
idea, interpret points of view and discuss abstract ideas.
Available for students in Level 9 and above, our IELTS Preparation course gives participants the confidence they need to succeed on the exam, along with substantial test-taking practice.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* 2 hours per day/ 12 lessons per week
* Start any Monday
* Small class sizes
* 3 Start times available: 12:15 and 3 PM Pacific Time or 3 AM Pacific Time
### Price
* $150 per week
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/discover-new-york.md
---
path: discover-new-york
name: Discover New York
centerNameRelation:
- Marymount Manhattan College
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/discover-new-york-1.png
programDetails:
minimumAge: 15
duration: 3
price: 5250
durationRelation: 3
specialty-tour-description: Experience the excitement of New York City, one of
the world's cultural capitals, with our Discover New York program! Based in
the heart of the city, our camp includes New York's greatest sights, from the
hub of Times Square to the world-famous Statue of Liberty. We'll also explore
the Big Apple's many unique neighborhoods, including Lower Manhattan, Little
Italy, and the upscale shopping district of Fifth Avenue.
activities-and-excursions: |-
* Statue of Liberty
* Metropolitan Museum of Art
* Museum of Natural History
* Lower Manhattan
* New York Harbor Cruise
* Fifth Avenue Shopping
* Colombia University
* Times Square
* Little Italy and Chinatown
* Museum of Modern Art
### Optional Tours:
* Washington DC Weekend
* Six Flags Amusement Park
features: |-
* 18 English lessons per week
* Evening activities, including dances, parties, games, and movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/navbar-items/application.md
---
path: application
pageName: Application
name: Application
order: 2
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/young-learner-english.md
---
path: young-learner-english
name: <NAME>
type: Online Essential Program
hero-image: /assets/adobestock_337256050.jpeg
programDetails:
lessonsPerWeek: 6
hoursPerWeek: "3"
minutesPerLesson: 30
description: Build an English foundation to last a lifetime!
program-post-content: >-
Learning a language at a young age is the best way to build a solid foundation
and develop that language into a lifelong skill. For students aged 7-9,
Essential English for Young Learners develops fundamental language skills
while also giving children insights into the world and its cultures. Student
will enjoy colorful, engaging lessons with a curriculum specifically designed
for this age group.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* 60 minutes per day, 3 days per week/ 3 hours per week
* Start any Monday
* Available for ages 7-9
* 2 Start times available: 3 PM Pacific Time or 3 AM Pacific Time
### Price
* $85 per week
---
<file_sep>/src/netlify-content/data/locations/marymount-manhattan-college.md
---
name: New York, NY
centerName: Marymount Manhattan College
---
<file_sep>/src/netlify-content/pages/dynamic/programs/in-person/sat-prep.md
---
path: sat-preparation-program
name: <NAME>
hero-image: /assets/sat-prep-hero.jpeg
programDetails:
lessonsPerWeek: 36
hoursPerWeek: "30"
minutesPerLesson: 50
description: Gain the edge in preparing for university admission with our
thorough SAT Preparation Program!
program-post-content: >-
### Gain the edge in preparing for university admission with our thorough SAT
Preparation Program!
The Scholastic Aptitude Test, or SAT, is the most commonly used standard exam in undergraduate admissions for American colleges and universities. Throughout the United States, high school juniors and seniors prepare extensively for the exam, making it critical for non-native speaking international students to get an edge in their SAT test preparation.
The SAT is designed specifically to test skills that students have learned in the American high school system, putting students from other systems at a disadvantage. With our expertise in teaching international students, FLS is ideally suited to give students a solid foundation for SAT success!
Our intensive program includes a total of 36 teacher-led lessons per week: 18 lessons of integrated study to improve all English skills; 12 lessons devoted to specific SAT strategies and skills and 6 lessons of Academic Workshops for additional language practice and skill development.
Students work with experienced, carefully selected instructors to hone their ability in the SAT skills of Critical Reading, Writing and Mathematics. Practice exams allow instructors to analyze students’ abilities and familiarize students with the test format and strategies.
Please note that students must possess an English fluency of FLS Level 13 or better to enter the SAT Program.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
program-features-content: >-
## PROGRAM FEATURES
All SAT Preparation Program students enjoy these exceptional features:
* Small class sizes of 15 or fewer, guaranteeing individual attention from your teacher.
* Core Class emphasizing the four key language skills: speaking, listening, reading and writing.
* SAT Preparation class featuring practice tests, analytics, and concentrated practice in mathematics, reading comprehension, critical reasoning, and writing.
* Lab-style Academic Workshop offering a range of academic options each week, including Pronunciation Clinics, Conversation Clubs, Homework Labs, Computer Labs, and more.
* Our exclusive English Everywhere program with weekly Hot Sheets, involving your host family, activity guides and FLS staff in your learning process.
* Weekly English tests and individualized progress reports every four weeks.
* Language Extension Day (LED) activities once per term, encouraging students to use English in new settings and contexts.
* Readers and novels to increase reading comprehension and understanding of American culture.
* Access to numerous free activities and specially priced excursions.
* Certificate of Completion upon successful graduation from each level.
* Articulation agreements with numerous colleges allowing admission without a TOEFL score based on completion of the designated FLS level.
* Personalized counseling and academic assistance.
program-details:
lessons-per-week: 36
hours-per-week: 30
minutes-per-lesson: 50
pageName: SAT Prep
programType: in-person
---
<file_sep>/src/netlify-content/data/housing/homestay-twin-room-1.md
---
name: <NAME>
centerNameRelation:
- Citrus College
- Saddleback College
priceDetails:
price: 250
payPeriod: weekly
mealsPerWeek: 16
---
<file_sep>/src/netlify-content/pages/dynamic/programs/in-person/vacation-english.md
---
path: vacation-english
name: <NAME>
hero-image: /assets/dsc09116.jpg
programDetails:
lessonsPerWeek: 18
hoursPerWeek: "15"
minutesPerLesson: 50
description: "Our Vacation English Program offers basic instruction in the
fundamental skills of English in a relaxed context. "
program-post-content: >-
### Our Vacation English Program offers basic instruction in the fundamental
skills of English in a relaxed context.
Students in this program will develop their fluency while enjoying plenty of time to explore the rich cultural offerings and entertainment attractions available near our language schools.
Our program places an exceptional emphasis on speaking. Students practice speaking skills frequently in class, receiving regular guidance and correction from their instructor.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
*(Please note that students on an F-1 visa are not eligible to take the Vacation English Program.)*
program-features-content: >-
## Program Features
All Vacation English Program students enjoy these exceptional features:
* Eighteen levels of study from low beginner to high advanced.
* Small class sizes of 15 or fewer, guaranteeing individual attention from your teacher.
* Core Class emphasizing the four key language skills: speaking, listening, reading and writing.
* Our exclusive English Everywhere program with weekly Hot Sheets, involving your host family, activity guides and FLS staff in your learning process.
* Weekly English tests and individualized progress reports every four weeks.
* Language Extension Day (LED) activities once per term, encouraging students to use English in new settings and contexts.
* Readers and novels to increase reading comprehension and understanding of American culture (for High Beginner and above).
* Access to numerous free activities and specially priced excursions.
* Certificate of Completion upon successful graduation from each level.
* Articulation agreements with numerous colleges allowing admission without a TOEFL score based on completion of the designated FLS level.
* Personalized counseling and academic assistance.
program-details:
lessons-per-week: 18
hours-per-week: 15
minutes-per-lesson: 50
pageName: Vacation English
programType: in-person
---
<file_sep>/src/netlify-content/data/locations/citrus-college.md
---
name: Los Angeles, CA
centerName: Citrus College
---
<file_sep>/src/netlify-content/data/programs/online/essential-english-3-day.md
---
name: <NAME>
onlineProgramType: Online Essential Program
durationOptions:
minWeeks: 1
maxWeeks: 52
exceedMaxWeeks: true
priceDetails:
price: 90
payPeriod: weekly
hoursPerWeek: '3'
lessonsPerWeek: 3
minutesPerLesson: 90
timesOffered:
- 4:00 AM
termDates: []
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/surf.md
---
path: surf-camp
name: Surf
centerNameRelation:
- Cal State Long Beach
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/surf-camp-1.jpg
- /assets/what-to-bring-3.jpg
programDetails:
minimumAge: 15
duration: 3
price: 4475
durationRelation: 3
specialty-tour-description: California State University, Long Beach is set in
beautiful Orange County, near fabulous beaches and some of California's best
attractions. Students will enjoy surf lessons at nearby Huntington Beach.
Renowned as Surf City USA, it's home to the world-famous US Open and other
surfing championships, as well as some of the best surf in the United States.
Students will learn the skills to enjoy the ultimate California sport and see
some of California's most popular sights!
activities-and-excursions: |-
* Hollywood
* Huntington Beach
* Beverly Hills
* Laguna Beach
### Optional Tours Include:
* Disneyland
* Universal Studios
* Six Flags Magic Mountain
* Knott's Berry Farm
* Santa Monica Pier
* MLB Baseball Game
features: |-
* 18 lessons of English each week with students from around the world
* 10 lessons per week with surf instructors
* Surfboard and wetsuit rental included
* Evening activities, including parties, dances, sports, and movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls, in shared
room accommodation
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/cms/cms.js
import CMS from 'netlify-cms-app';
import InPersonProgramsDynamicPagesPreview from './preview-templates/InPersonProgramsPagePreview';
import LocationsDynamicPagesPreview from './preview-templates/LocationsDynamicPagesPreview';
import SpecialtyToursDynamicPages from './preview-templates/SpecialtyToursDynamicPagesPreview';
import OnlineProgramsDynamicPages from './preview-templates/OnlineProgramPagesPreview';
CMS.registerPreviewTemplate(
'inPersonProgramsDynamicPages',
InPersonProgramsDynamicPagesPreview
);
CMS.registerPreviewTemplate(
'locationsDynamicPages',
LocationsDynamicPagesPreview
);
CMS.registerPreviewTemplate(
'specialtyToursDynamicPages',
SpecialtyToursDynamicPages
);
CMS.registerPreviewTemplate(
'onlineProgramsDynamicPages',
OnlineProgramsDynamicPages
);
// TODO: Figure out styles at some point
// https://www.netlifycms.org/docs/beta-features/#raw-css-in-registerpreviewstyle
// CMS.registerPreviewStyle('../styles/test.css');
console.log(
'%c custom templates registered',
'color: green; font-size: 14px; font-weight: 400'
);
<file_sep>/src/components/SpecialtyToursPage.js
import React, { Fragment } from 'react';
import { graphql } from 'gatsby';
import Slick from 'react-slick';
import Layout from 'src/components/Layout';
import Section from 'src/components/section/Section';
import Testimonial from 'src/components/testimonial/Testimonial';
import PostNavbar from 'src/components/post-navbar/PostNavbar';
import MarkdownContent from 'src/components/MarkdownContent.js';
import 'slick-carousel/slick/slick.css';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faUserAlt } from '@fortawesome/free-solid-svg-icons';
import { faCalendarAlt } from '@fortawesome/free-solid-svg-icons';
export const SpecialtyTourPageTemplate = ({
specialtyTourData,
allSpecialtyTourNavData,
previewData,
}) => {
const slickSettings = {
autoplay: true,
arrows: false,
autoplaySpeed: 4000,
infinite: true,
};
console.log('specialtytoursdata', specialtyTourData);
return (
<Section>
<div className="columns is-multiline">
{/* TODO: We want to implement testimonials, but not just yet */}
{/* {previewData ? null : (
<Fragment>
<div className="column is-3-desktop is-full-tablet">
<PostNavbar data={allSpecialtyTourNavData} />
<Testimonial />
</div>
</Fragment>
)} */}
<div className="column is-full">
<div className="columns is-multiline">
<div className="column is-full">
{/* TODO: Again, these 'programs' classes need genericizing */}
<h2 className="programs__post-title">
{specialtyTourData.name}
</h2>
</div>
<div className="column is-full">
<div className="fls__location-post-carousel">
<Slick {...slickSettings}>
{specialtyTourData.carousel_images.map(
carouselImagePath => {
return (
<img
key={carouselImagePath}
src={carouselImagePath}
alt={`${specialtyTourData.name} carousel image`}
/>
);
}
)}
</Slick>
</div>
</div>
</div>
<div className="column is-full">
<div className="fls-post__subhero">
<span className="fls-post__subhero-item">
<FontAwesomeIcon
className="fls-post__subhero-icon"
icon={faUserAlt}
/>{' '}
{`Age ${specialtyTourData.programDetails.minimumAge}+`}
</span>
<span className="fls-post__subhero-item">
<FontAwesomeIcon
className="fls-post__subhero-icon"
icon={faCalendarAlt}
/>{' '}
{`${specialtyTourData.programDetails.durationRelation} weeks`}
</span>
</div>
</div>
<div className="column is-full">
{specialtyTourData.specialty_tour_description}
</div>
<div className="column is-full">
<div className="fls-post__copy-container fls-post__copy-container--alt">
<h3 className="fls-post__subtitle">
Activities and Excursions
</h3>
<MarkdownContent
content={
specialtyTourData.activities_and_excursions
}
classMap={{
h2: 'fls-post__subtitle',
p: 'fls-post__paragraph',
ul: 'fls__location-post-list',
li: 'fls__list-item',
}}
/>
</div>
</div>
<div className="column is-full">
<div className="fls-post__copy-container">
<h3 className="fls-post__subtitle">Features</h3>
<MarkdownContent
content={specialtyTourData.features}
classMap={{
h2: 'fls-post__subtitle',
p: 'fls-post__paragraph',
ul: 'fls__location-post-list',
li: 'fls__list-item',
}}
/>
</div>
</div>
<div className="column is-full">
<div className="fls-post__copy-container fls-post__copy-container--alt">
<h3 className="fls-post__subtitle">
Accommodations
</h3>
<MarkdownContent
content={specialtyTourData.accommodations}
classMap={{
h2: 'fls-post__subtitle',
p: 'fls-post__paragraph',
ul: 'fls__location-post-list',
li: 'fls__list-item',
}}
/>
</div>
</div>
<div className="column is-full">
<div className="fls-post__copy-container">
<div className="fls-post__copy-container-header">
<h3 className="fls-post__subtitle">
Program Dates
</h3>
<span className="fls-post__sample-calendar fls--red">
<FontAwesomeIcon
className="fls-post__subhero-icon fls--red"
icon={faCalendarAlt}
/>
<a
href={specialtyTourData.sampleCalendar}
className="fls--red"
target="_blank"
>
<strong>VIEW A SAMPLE CALENDAR</strong>
</a>
</span>
</div>
{/* Don't let the class name fool you, I refuse to
use actual tables */}
{/* TODO: This totally breaks on mobile */}
<div className="fls-post__table-header">
<div className="columns">
<span className="column is-one-quarter">
Arrive
</span>
<span className="column is-one-quarter">
Depart
</span>
<span className="column is-one-quarter">
Price
</span>
<span className="column is-one-quarter"></span>
</div>
</div>
{specialtyTourData.programDates.map(programDate => (
<div
className="fls-post__table-row"
key={programDate.arrive}
>
<div className="columns">
<span className="column is-one-quarter">
{programDate.arrive}
</span>
<span className="column is-one-quarter">
{programDate.depart}
</span>
<span className="column is-one-quarter">
$
{
specialtyTourData.programDetails
.price
}
</span>
<span className="column is-one-quarter">
<button className="fls__button fls__button--small">
Apply
</button>
</span>
</div>
</div>
))}
</div>
</div>
</div>
</div>
</Section>
);
};
const SpecialtyTourPage = ({ data, pageContext, previewData }) => {
if (!previewData) {
const { pagePath } = pageContext;
const specialtyTourData = data.allMarkdownRemark.edges.find(
edge => edge.node.frontmatter.path === pagePath
).node.frontmatter;
const allSpecialtyTourNavData = data.allMarkdownRemark.edges.map(
edge => {
return {
path: `/programs/specialty-tours/${edge.node.frontmatter.path}`,
name: edge.node.frontmatter.name,
};
}
);
return (
<Layout
isScrolled={true}
hasNavHero={true}
hasNavButtons={true}
pageTitle={'Specialty Tours'}
>
<SpecialtyTourPageTemplate
specialtyTourData={specialtyTourData}
allSpecialtyTourNavData={allSpecialtyTourNavData}
/>
</Layout>
);
} else {
return (
<SpecialtyTourPageTemplate
specialtyTourData={previewData}
previewData={previewData}
/>
);
}
};
export default SpecialtyTourPage;
export const SpecialityTourData = graphql`
{
allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: {
regex: "/pages/dynamic/programs/specialty-tours//"
}
}
) {
edges {
node {
frontmatter {
path
name
accommodations
activities_and_excursions
features
programDates {
arrive
depart
}
carousel_images
sampleCalendar
specialty_tour_description
programDetails {
durationRelation
minimumAge
price
}
}
}
}
}
}
`;
<file_sep>/src/netlify-content/pages/dynamic/programs/online/intensive-english.md
---
path: online-intensive
name: <NAME>
type: Online Pathway Program
hero-image: /assets/adobestock_219832523.jpeg
programDetails:
lessonsPerWeek: 30
hoursPerWeek: "25"
minutesPerLesson: 50
description: Learn English the way you want!
program-post-content: >-
Our popular Intensive English Program offers a well-rounded learning
experience for students who have varied English goals, allowing students
access to a wide range of FLS electives in order to provide a versatile,
personalized experience. The program includes our core integrated skills
class, a daily workshop, and your choice of elective classes (1 class, meets
daily).
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
As part of our Online Pathway Program you will participate via webcam with a live in-person class.
program-features-content: >-
### Program Features:
* 5 hours of study per day/ 25 hours per week
* 18 levels
* Textbooks and materials provided
* Small class size
* All classes taught by TEFL-certified teachers with native fluency in American English
---
<file_sep>/src/netlify-content/data/general-fees/in-person/one-on-one-tutoring.md
---
name: One-on-one Tutoring
centerNameRelation:
- Boston Commons
- Citrus College
- Chestnut Hill College (from Summer, 2021)
- Saddleback College (Summer Only)
priceDetails:
price: 70
payPeriod: Per Lesson
---
<file_sep>/src/netlify-content/data/housing/homestay-single-room-1.md
---
name: Homestay Single Room
centerNameRelation:
- Citrus College
- Saddleback College
priceDetails:
price: 300
payPeriod: weekly
mealsPerWeek: 16
notes:
- Single room may not be available July - August
---
<file_sep>/src/netlify-content/pages/dynamic/locations/boston-commons.md
---
path: boston-ma
name: Boston, MA
centerNameRelation:
- Boston Commons
description: Our Boston Commons center is ideally located in the bustling
Downtown district, overlooking America’s oldest park, Boston Common,
considered by local residents to be the heart and pulse of the city.
quick-facts:
- name: Campus Facilities
icon: /assets/campus-facilities-icon.png
items: |-
Free Wifi
Smartboards
Student Lounge
Cafes and Restaurants nearby
- name: Popular Majors
icon: /assets/popular-majors-icon.png
items: >-
Transfer to partner universities throughout Boston to study popular majors
such as:
* Business
* Communications
* Health Professions
* Psychology
* Social Sciences
- name: Airport Transfer
icon: /assets/airport-pickup-icon.png
items: |-
* Boston Logan International Airport (BOS)
* 6 kilometers
- items: |-
* SPRING 13 C
* SUMMER 21 C
* FALL 11 C
* WINTER 6 C
name: Average Temp
icon: /assets/average-temp-icon.png
- name: Enrollment
icon: /assets/enrollment-icon.png
items: Enrollment averages approximately150 students throughout the year, with
small class sizes to encourage student interaction.
- items: |-
**Academic Programs**
* Core English
* General English
* Intensive English
* Academic English
* High School Completion
* Test Preparation (TOEFL, SAT, IELTS)
**Specialty Tours**
* Discover Boston
* English + Volunteering
icon: /assets/programs-offered-icon.png
name: Programs Offered
- name: Distance to Major Attractions
icon: /assets/major-attractions-icon.png
items: |-
* Harvard Square - 5 miles
* Bradford Ski Resort - 37 miles
* Cape Cod - 70 miles
* Six Flags New England - 97 miles
- name: Local Transportation
icon: /assets/local-transportation-icon.png
items: |-
Subway - Steps away from the campus
Bus - Next to campus; covers the greater Boston area
Rail - Connects Boston to neighboring cities
carousel-images:
- /assets/boston-summer-1.jpg
- /assets/bostoncommons3.jpg
- /assets/location-preview-bos.jpg
- /assets/boston1.jpg
- /assets/our-programs-2.jpg
- /assets/discover-boston-1.jpg
post-content: >-
# OPEN FOR IN-PERSON PROGRAMS! HYBRID CLASSES HAVE STARTED.
##### Learn English in Boston, "The Cradle of American Liberty"
One of America’s most attractive cities, Boston offers a unique blend of historical sites, such as the fascinating Freedom Trail, and modern attractions, like the innovative Massachusetts Institute of Technology. Considered America’s education capital, Boston hosts the world’s largest college student population. Prestigious universities such as Harvard, MIT, Tufts and the University of Massachusetts are just a few of the many educational institutions in and around the city. Boston is also home to some of the best sports teams in the nation, giving students an opportunity to catch the Red Sox at Fenway Park or experience American football at a New England Patriots game.
##### Easy Access to Cultural Attractions, Dining, and Shopping
Our Boston Commons center is ideally located in the bustling Downtown district, overlooking America’s oldest park, Boston Common, considered by local residents to be the heart and pulse of the city. Students can step outside to hop on the subway at centrally located Park Street station or stroll across the park for picturesque views of the Massachusetts State House.
##### Surrounded by Prestigious Colleges and Universities
Our partner agreements with numerous nearby colleges and universities give students many options for pursuing a Bachelor’s or Master’s degree after completing their studies at Boston Commons.
##### Campus Profile
Located right in downtown Boston, our center offers a cosmopolitan experience in one of America's premiere cities. The center's modern facilities offer students all the tools they need for an exceptional educational experience. Our center overlooks the Boston Common public park, and is situated between the campuses of several colleges and universities. Students will enjoy studying in our comfortable student lounge, or taking their textbooks outside for study groups on the expansive Boston Common lawn.
## Housing Options
### Homestay
A homestay is a great way to experience American culture while improving your English ability! All of our centers offer homestay accommodation with American families individually selected by FLS. With your host family you'll learn about American daily life, practice English on a regular basis, and participate in many aspects of American culture that visitors often don't get to see. (Twin and Single options available).
### International Guest House
Located in Boston's historic Back Bay, just a few blocks from FLS, the International Guest House (IGH) offers shared accommodation with private bathrooms. The IGH is located near many of Boston's unique attractions, including Boston Common park, Newbury Street shopping, and the Boston Public Library. The dining room provides a daily buffet-style breakfast and dinner. Other common areas include a study room, TV room, and social room.
## Area Profile
### The Boston Experience
Known as America's Walking City, Boston provides all the excitement of a major city in a compact area that's easy to get around. You'll never be bored with all the events and diversions awaiting you in this unique and picturesque city!
* Take a unique ride on the Duck Tour as amphibious vehicles drive you by the city's great sights and then plunge into the Charles River for a watery finale.
* Have an all-American day and see the world-championship Boston Red Sox at Fenway Park.
* Sample famous New England seafood at historic waterfront oyster bars or try authentic Boston clam chowder at Quincy Market.
* Visit the impressive collections at the Museum of Fine Arts, including major works of impressionism, Egyptian antiquities and modern American painting.
* Stroll along fashionable Newbury Street and go shopping at high-end boutiques or sip a cappuccino at an elegant sidewalk café.
* Spend a day touring the quaint villages and scenic beaches of Cape Cod where Boston's elite travel for summer getaways.
### English and Volunteering
FLS offers our students a wonderful way to practice their new English skills while immersing themselves in American society by volunteering at local charities and community service centers. Join other FLS students as they perfect their conversational English while helping others! Here are some of the opportunities you will enjoy at FLS Boston Commons:
* Greater Boston Food Bank
* Haley House
* Community Servings
### Optional Weekend and Evening Activities:
FLS offers ESL students memorable and educational tour experiences, and opportunities to visit the best attractions of the United States. Students will have many opportunities to take part in excursions with the full supervision of our trained FLS staff.
Activities include:
* Harvard University and Harvard Square
* Six Flags New England
* Museum of Fine Arts
* Boston Red Sox Games
* Newbury Street Shopping
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/essential-english-3-day.md
---
path: essential-english-3-day
name: Essential English 3 Day
type: Online Essential Program
hero-image: /assets/dsc08885.jpg
programDetails:
lessonsPerWeek: 3
hoursPerWeek: "3"
minutesPerLesson: 90
description: Improve your English conversation ability!
program-post-content: >-
For anyone who wants to improve their everyday English conversational ability
with a comfortable time commitment, this program offers short sessions three
times during the week. You'll experience an integrated approach to all the
key language skills. These dynamic classes offer plenty of speaking practice
and an introduction to essential English grammar structures and vocabulary.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* Classes meet Monday, Wednesday and Friday
* 90 minutes per day, 3 days per week/ 4.5 hours per week
* Start any Monday
* 18 levels of instruction
* 2 Start times available: 3 PM Pacific Time or 3 AM Pacific Time
### Price
* $110 per week
---
<file_sep>/src/components/application/SpecialtyToursInfoForm.js
import React, { useState, Fragment } from 'react';
import ReactTooltip from 'react-tooltip';
import Select from 'react-select';
import DatePicker from 'react-datepicker';
import { RadioGroup, Radio } from 'react-radio-group';
import { useStaticQuery, graphql } from 'gatsby';
import Checkbox from 'rc-checkbox';
import moment from 'moment';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import {
formatEdges,
updatePrices,
removePrices,
generatePriceThresholds,
calculateDateOffset,
} from 'src/utils/helpers';
// TODO: Figure out a better way to implement this data
let airportData;
export default function InPersonInfoForm({
handleDataChange,
handleBatchInputChange,
prices,
setPrices,
applicationData,
programsData,
}) {
const data = useStaticQuery(graphql`
{
locations: allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/data/locations/" } }
) {
edges {
node {
frontmatter {
name
centerName
}
}
}
}
enhancements: allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/data/enhancements/in-person/" }
}
) {
edges {
node {
frontmatter {
name
centerNameRelation
priceDetails {
price
payPeriod
}
notes
}
}
}
}
generalFees: allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: {
regex: "/data/general-fees/specialty-tours/"
}
}
) {
edges {
node {
frontmatter {
name
centerNameRelation
priceDetails {
price
payPeriod
}
}
}
}
}
}
`);
programsData = formatEdges(programsData);
const generalFeesData = formatEdges(data.generalFees);
const centersData = formatEdges(data.locations);
const enhancementsData = formatEdges(data.enhancements);
const [durationOptions, setDurationOptions] = useState([]);
const [programOptions, setProgramOptions] = useState([]);
const [startDateOptions, setStartDateOptions] = useState([]);
const [airportOptions, setAirportOptions] = useState([]);
if (
!prices.find(priceItem =>
priceItem.label.toLowerCase().includes('application')
)
) {
const applicationFeeData = generalFeesData.find(generalFee =>
generalFee.name.toLowerCase().includes('application')
);
let updatedPrices = [...prices];
updatedPrices.push({
type: 'general fees',
label: applicationFeeData.name,
priceDetails: {
price: applicationFeeData.priceDetails.price,
// TODO: Is there a way to capture the payPeriod for programs in the CMS?
payPeriod: applicationFeeData.priceDetails.payPeriod,
},
});
setPrices(updatedPrices);
}
// Prune out any centers that have no in person programs
const centerOptions = centersData
.map(center => {
return {
value: center.centerName,
label: `${center.centerName} @ ${center.name}`,
};
})
.filter(center =>
programsData.some(program =>
program.centerNameRelation.includes(center.value)
)
);
// TODO: DRY up these functions
const handleCenterChange = centerChange => {
// Set state operatons are async, so we'll use this non-async version for the below operations
const currentCenter = centersData.find(
center => center.centerName === centerChange.value
);
handleDataChange('center', currentCenter, 'application');
/*
If the duration or program is already selected, and the user picks a new center, this can cause complications with already selected programs
and durations. It seems easier, then, to just require them to reselect a program & duration.
*/
if (applicationData.duration || applicationData.program) {
/*
Originally, this was two state changes in quick succession. This was causing problems, and though there may be a better way to handle it,
manually batching the state changes seems to solve the problem.
*/
let blankedApplicationData = {};
if (applicationData.duration)
blankedApplicationData.duration = null;
if (applicationData.program) blankedApplicationData.program = null;
handleBatchInputChange(blankedApplicationData, 'application');
setPrices(removePrices(prices, ['program']));
}
// Set program options to be the programs associated with the selected center
setProgramOptions(
programsData
.filter(program => {
return program.centerNameRelation.includes(
centerChange.value
);
})
.map(program => {
return {
value: program.name.toLowerCase().split(' ').join('-'),
label: program.name,
};
})
);
airportData = enhancementsData.filter(enhancement => {
return (
enhancement.centerNameRelation.includes(centerChange.value) &&
enhancement.name.toLowerCase().includes('airport')
);
});
if (airportData) {
setAirportOptions(
airportData.reduce((accum, enhancement) => {
enhancement.notes.forEach(note => {
accum.push({
value: note,
label: note,
});
});
return accum;
}, [])
);
}
};
const handleProgramChange = programChange => {
const currentProgram = programsData.find(
program => program.name === programChange.label
);
// TODO: State changes are async, so we keep using 'currentProgram' inside this function scope
// With some refactoring, we could probably change 'handleDataChange' to take a callback that can be passed to the state change
handleDataChange('program', currentProgram, 'application');
// TODO: Need to re-enter dates in the CMS for the new date format
const formattedDates = currentProgram.programDates.map(programDate => {
const parsedDateString = parseInt(programDate.arrive);
return {
value: new Date(parsedDateString),
label: moment(parsedDateString).format('MMM Do, YY'),
};
});
setStartDateOptions(formattedDates);
if (currentProgram.priceDetails.range) {
// TODO: This 'generatePriceThresholds' function should be distributed among the other program types
setDurationOptions(
generatePriceThresholds(
currentProgram.priceDetails.range.maxWeeks,
currentProgram.priceDetails.range.exceedMaxWeeks
)
);
handleDataChange('program', currentProgram, 'application');
} else if (currentProgram.priceDetails.package) {
setDurationOptions([
{
label: `${currentProgram.priceDetails.package.duration} weeks`,
value: currentProgram.priceDetails.package.duration,
},
]);
handleBatchInputChange(
{
program: currentProgram,
duration: {
label: `${currentProgram.priceDetails.package.duration} weeks`,
value: currentProgram.priceDetails.package.duration,
},
},
'application'
);
}
};
const handleDurationChange = durationChange => {
// If programStartDate exists, we can be confident there's also a program end date & housing check in/check out dates
// TODO: Implement this new 'calculateDateOffset' helpers into the other program types
if (applicationData.programStartDate) {
handleBatchInputChange(
{
programEndDate: calculateDateOffset(
applicationData.programStartDate,
durationChange.value * 7 - 3
),
duration: {
label: durationChange.label,
value: durationChange.value,
},
housingCheckInDate: calculateDateOffset(
applicationData.programStartDate,
-1
),
housingCheckOutDate: calculateDateOffset(
applicationData.programStartDate,
durationChange.value * 7 - 2
),
},
'application'
);
} else {
handleDataChange(
'duration',
{
label: durationChange.label,
value: durationChange.value,
},
'application'
);
}
let pricePerWeek = applicationData.program.priceDetails.range.weekThresholds.reduce(
(pricePerWeek, currentWeek, index, arr) => {
// If there are no previous thresholds, previous max defaults to 0. Otherwise, the minimum threshold value is last week's max threshold, plus one.
let thresholdMin =
index === 0 ? 1 : arr[index - 1].thresholdMax + 1;
if (
durationChange.value >= thresholdMin &&
durationChange.value <= currentWeek.thresholdMax
) {
return currentWeek.pricePerWeek;
} else {
return pricePerWeek;
}
},
0
);
let updatedPrices = [...prices];
/*
The duration input is only responsible for adding a new program,
since programs are inextricably tied to duration. Other price types, like housing,
are handled by the change of their respective inputs.
*/
if (!updatedPrices.find(priceItem => priceItem.type === 'program')) {
updatedPrices.push({
type: 'program',
label: `${applicationData.program.name} @ ${applicationData.center.centerName}`,
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
// TODO: Is there a way to capture the payPeriod for programs in the CMS?
payPeriod: 'Per Week',
},
});
} else {
// TODO: This function might be clearer if it supports chaining, or a way to pass in multiple changes as arguments
updatedPrices = updatePrices(updatedPrices, 'program', {
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
},
});
}
setPrices(updatedPrices);
};
const handleStartDateChange = startDateChange => {
if (applicationData.duration) {
handleBatchInputChange(
{
programStartDate: startDateChange.value,
programEndDate: calculateDateOffset(
startDateChange.value,
applicationData.duration.value * 7 - 3
),
housingCheckInDate: calculateDateOffset(
startDateChange.value,
-1
),
housingCheckOutDate: calculateDateOffset(
startDateChange.value,
applicationData.duration.value * 7 - 2
),
},
'application'
);
}
};
const handleAirportChange = airportChange => {
const currentAirport = airportData.find(airport =>
airport.notes.includes(airportChange.label)
);
handleDataChange('airport', airportChange.value, 'application');
let updatedPrices = [...prices];
const hasAirportPickUpPrice = updatedPrices.find(
priceItem =>
priceItem.type === 'enhancements' &&
priceItem.label.toLowerCase().includes('pick up')
);
const hasAirportDropOffPrice = updatedPrices.find(
priceItem =>
priceItem.type === 'enhancements' &&
priceItem.label.toLowerCase().includes('drop off')
);
// TODO: This very clearly needs DRYing
if (hasAirportPickUpPrice) {
// TODO: This can be refactored to use 'updatePrices,' which can be refactored to accept this kind of logic
updatedPrices = removePrices(
prices,
['enhancements'],
priceItem => !priceItem.label.toLowerCase().includes('pick up')
);
}
if (applicationData.airportPickUp) {
updatedPrices.push({
type: 'enhancements',
label: `${currentAirport.notes[0]} - Pick Up`,
priceDetails: {
price: currentAirport.priceDetails.price,
duration: 1,
payPeriod: currentAirport.priceDetails.payPeriod,
},
});
}
if (hasAirportDropOffPrice) {
// TODO: This can be refactored to use 'updatePrices,' which can be refactored to accept this kind of logic
updatedPrices = removePrices(
prices,
['general fees'],
priceItem => !priceItem.label.toLowerCase().includes('drop off')
);
}
if (applicationData.airportDropOff) {
updatedPrices.push({
type: 'general fees',
label: `${currentAirport.notes[0]} - Drop Off`,
priceDetails: {
price: currentAirport.priceDetails.price,
duration: 1,
payPeriod: currentAirport.priceDetails.payPeriod,
},
});
}
setPrices(updatedPrices);
};
const isMonday = date => date.getDay() === 1;
return (
<Fragment>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
FLS Center
</label>
</div>
<Select
className="fls__select-container"
classNamePrefix={'fls'}
value={{
label: applicationData.center
? `${applicationData.center.centerName} @ ${applicationData.center.name}`
: 'Select a center.',
value: applicationData.center
? applicationData.center.centerName
: null,
}}
onChange={centerOption => {
handleCenterChange(centerOption);
}}
options={centerOptions}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">Program</label>
{applicationData.center ? null : (
<span className="label label--application label--select-first fls--red">
Select a center first
</span>
)}
</div>
<Select
className={`fls__select-container ${
!applicationData.center
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.program
? applicationData.program.name
: 'Select a program',
value: applicationData.program
? applicationData.program.name
: 'Select a program',
}}
onChange={handleProgramChange}
options={programOptions}
isDisabled={!applicationData.center}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Duration
<FontAwesomeIcon
className={`application__info-icon ${
applicationData.program &&
applicationData.program.priceDetails.package
? ''
: 'fls__hide'
}`}
icon={faInfoCircle}
data-tip="This specialty tour has a fixed duraton."
/>
</label>
{applicationData.program ? null : (
<span className="label label--application label--select-first fls--red">
Select a program first
</span>
)}
</div>
<Select
className={`fls__select-container ${
!applicationData.program
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.duration
? applicationData.duration.label
: 'Select a duration.',
value: applicationData.duration
? applicationData.duration.value
: null,
}}
onChange={handleDurationChange}
options={durationOptions}
isDisabled={
!applicationData.program ||
applicationData.program.priceDetails.package
}
/>
</div>
{/* TODO: There's a better way to take up this space */}
<div className="column is-half"></div>
{/* TODO: This field needs some serious validation */}
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Program Start Date
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="In-person programs begin on Mondays."
/>
</label>
{applicationData.program ? null : (
<span className="label label--application label--select-first fls--red">
Select a program first
</span>
)}
</div>
<Select
className={`fls__select-container ${
!applicationData.program
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.programStartDate
? moment(applicationData.programStartDate).format(
'MMMM Do, YYYY'
)
: 'Select a start date.',
value: applicationData.programStartDate,
}}
onChange={handleStartDateChange}
options={startDateOptions}
isDisabled={!applicationData.program}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Program End Date
</label>
</div>
<DatePicker
selected={applicationData.programEndDate}
wrapperClassName={`fls__date-wrapper fls__date-wrapper--read-only ${
!applicationData.duration
? 'fls__select-container--disabled'
: ''
}`}
className={'input fls__base-input'}
placeholderText={'Program End Date'}
readOnly={true}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Housing Check In Date
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip={`Check in is the Sunday before the program start date. If you need different accommodations, please select "Extra Nights of Housing Required" below.`}
/>
</label>
{applicationData.programStartDate ? null : (
<span className="label label--application label--select-first fls--red">
Select a program start date
</span>
)}
</div>
<DatePicker
selected={applicationData.housingCheckInDate}
wrapperClassName={`fls__date-wrapper fls__date-wrapper--read-only ${
!applicationData.programStartDate
? 'fls__select-container--disabled'
: ''
}`}
className={'input fls__base-input'}
placeholderText={'Housing Check-in Date'}
readOnly={true}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Housing Check Out Date
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip={`Check out is the Saturday after the program end date. If you need different accommodations, please select "Extra Nights of Housing Required" below.`}
/>
</label>
</div>
<DatePicker
selected={applicationData.housingCheckOutDate}
className={'input fls__base-input'}
wrapperClassName={`fls__date-wrapper fls__date-wrapper--read-only ${
!applicationData.programStartDate
? 'fls__select-container--disabled'
: ''
}`}
placeholderText={'Housing Check Out Date'}
readOnly={true}
/>
</div>
{airportOptions.length ? (
<div className="column is-half">
<div className="label label--application">
Airport Transport
</div>
<label className="checkbox">
<Checkbox
className="checkbox"
defaultChecked={applicationData.airportPickUp}
onChange={e =>
handleDataChange(
'airportPickUp',
e.target.checked,
'application'
)
}
/>
<span className="fls__radio-label">
Airport Pick Up
</span>
</label>
<label className="checkbox">
<Checkbox
className="checkbox"
defaultChecked={applicationData.airportDropOff}
onChange={e =>
handleDataChange(
'airportDropOff',
e.target.checked,
'application'
)
}
/>
<span className="fls__radio-label">
Airport Drop Off
</span>
</label>
</div>
) : null}
{applicationData.airportPickUp || applicationData.airportDropOff ? (
<div className="column is-half">
<label className="label label--application">
{applicationData.center
? 'Airport Options'
: 'Airport Options * - Select a center first'}
</label>
<Select
className={`fls__select-container ${
!applicationData.center
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.airport,
value: applicationData.airport,
}}
onChange={handleAirportChange}
options={airportOptions}
/>
</div>
) : null}
{applicationData.airportPickUp || applicationData.airportDropOff ? (
<div className="column is-half">
<label className="label">
Airport Transport Special Requests
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="Note that any additional requests may incur extra charges."
/>
</label>
<input type="text" className="input" />
</div>
) : null}
<div className="column is-full">
<label className="label label--application">
Do you require an I-20 Form?
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="As of July 1, 2016, the redesigned Form I-20 is required for all F and M nonimmigrant visa applications, entry into the United States, travel and applications for nonimmigrant benefits. The previous version of the Form I-20 (with a barcode) is now invalid."
/>
</label>
<RadioGroup
selectedValue={applicationData.requiresI20}
onChange={value => {
handleDataChange('requiresI20', value, 'application');
}}
>
<Radio value="yes" />
<span className="fls__radio-label">Yes</span>
<Radio value="no" />
<span className="fls__radio-label">No</span>
</RadioGroup>
</div>
{applicationData.requiresI20 === 'yes' ? (
<Fragment>
<ReactTooltip
type="info"
effect="solid"
html={true}
multiline={true}
className="fls__tooltip"
clickable={true}
/>
<div className="column is-full">
<label className="label label--application">
Would you like your I-20 Form and acceptance
documents to be sent by Express Mail?
</label>
<RadioGroup
selectedValue={applicationData.expressMail}
onChange={value => {
const expressMailData = generalFeesData.find(
generalFee =>
generalFee.name
.toLowerCase()
.includes('express')
);
if (value === 'yes') {
// TODO: Looking for the word 'health' in the name is far from the most robust way of finding this specific general fee
if (
!prices.find(
priceItem =>
priceItem.type ===
'general fees' &&
priceItem.label
.toLowerCase()
.includes('express')
)
) {
prices.push({
type: 'general fees',
label: expressMailData.name,
priceDetails: {
price:
expressMailData.priceDetails
.price,
duration: 1,
payPeriod:
expressMailData.priceDetails
.payPeriod,
},
});
setPrices(prices);
}
} else if (value === 'no') {
setPrices(
removePrices(
prices,
['general fees'],
priceItem =>
!priceItem.label
.toLowerCase()
.includes('express')
)
);
}
handleDataChange(
'expressMail',
value,
'application'
);
}}
>
<Radio value="yes" />
<span className="fls__radio-label">Yes</span>
<Radio value="no" />
<span className="fls__radio-label">No</span>
</RadioGroup>
</div>
<div className="column is-full">
{/* TODO: Should have a helpful tooltip */}
<label className="label label--application">
{/* TODO: If chosen, should this actually add $350 to the final billing? */}
Would you like FLS to process the $350 SEVIS
Application Fee for you?
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="This is only for students who need an student F-1 visa from the US Embassy. This fee will be charged by the U.S. Government, not by FLS International."
/>
</label>
<RadioGroup
selectedValue={applicationData.processSEVISAppFee}
onChange={value => {
handleDataChange(
'processSEVISAppFee',
value,
'application'
);
}}
onChange={value => {
const sevisAppData = generalFeesData.find(
generalFee =>
generalFee.name
.toLowerCase()
.includes('sevis')
);
if (value === 'yes') {
// TODO: Looking for the word 'SEVIS' in the name is far from the most robust way of finding this specific general fee
if (
!prices.find(
priceItem =>
priceItem.type ===
'general fees' &&
priceItem.label
.toLowerCase()
.includes('sevis')
)
) {
prices.push({
type: 'general fees',
label: sevisAppData.name,
priceDetails: {
price:
sevisAppData.priceDetails
.price,
duration: 1,
payPeriod:
sevisAppData.priceDetails
.payPeriod,
},
});
setPrices(prices);
}
} else if (value === 'no') {
setPrices(
removePrices(
prices,
['general fees'],
priceItem =>
!priceItem.label
.toLowerCase()
.includes('sevis')
)
);
}
handleDataChange(
'processSEVISAppFee',
value,
'application'
);
}}
>
<Radio value="yes" />
<span className="fls__radio-label">Yes</span>
<Radio value="no" />
<span className="fls__radio-label">No</span>
</RadioGroup>
</div>
</Fragment>
) : null}
<div className="column is-full">
<div className="application__label-container">
<label className="label label--application">
Would you like to purchase health insurance through FLS?
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="Health insurance is mandatory for all students. If not purchased through FLS International, you must purchase insurance in your home country."
/>
</label>
{applicationData.duration ? null : (
<span className="label label--application label--select-first fls--red">
Select a duration first
</span>
)}
</div>
<RadioGroup
className={`fls-input__radio-group ${
!applicationData.duration
? 'fls-input__radio-group--disabled'
: ''
}`}
selectedValue={applicationData.flsHealthInsurance}
onChange={value => {
const healthInsuranceData = generalFeesData.find(
generalFee =>
generalFee.name.toLowerCase().includes('health')
);
if (value === 'yes') {
// TODO: Looking for the word 'health' in the name is far from the most robust way of finding this specific general fee
if (
!prices.find(
priceItem =>
priceItem.type === 'general fees' &&
priceItem.label
.toLowerCase()
.includes('health')
)
) {
prices.push({
type: 'general fees',
label: healthInsuranceData.name,
priceDetails: {
price:
healthInsuranceData.priceDetails
.price,
duration:
applicationData.duration.value || 0,
payPeriod:
healthInsuranceData.priceDetails
.payPeriod,
},
});
setPrices(prices);
}
} else if (value === 'no') {
setPrices(
removePrices(
prices,
['general fees'],
priceItem =>
!priceItem.label
.toLowerCase()
.includes('health')
)
);
}
handleDataChange(
'flsHealthInsurance',
value,
'application'
);
}}
>
<Radio value="yes" />
<span className="fls__radio-label">Yes</span>
<Radio value="no" />
<span className="fls__radio-label">No</span>
</RadioGroup>
</div>
<div className="column is-full">
{/* TODO: Should have a helpful tooltip */}
<label className="label label--application">
Would you like FLS to provide Unaccompanied Minor Service?
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="Upon request, FLS will provide the name and contact information of a specific designated driver to the agent and airline
for pick-up and provide chaperone service to airport security for airport drop-off."
/>
</label>
<RadioGroup
selectedValue={applicationData.unaccompaniedMinorService}
onChange={value => {
const unaccompaniedMinorServiceData = enhancementsData.find(
generalFee =>
generalFee.name
.toLowerCase()
.includes('unaccompanied')
);
if (value === 'yes') {
// TODO: Looking for the word 'health' in the name is far from the most robust way of finding this specific general fee
if (
!prices.find(
priceItem =>
priceItem.type === 'enhancements' &&
priceItem.label
.toLowerCase()
.includes('unaccompanied')
)
) {
prices.push({
type: 'enhancements',
label: unaccompaniedMinorServiceData.name,
priceDetails: {
price:
unaccompaniedMinorServiceData
.priceDetails.price,
duration: 1,
payPeriod:
unaccompaniedMinorServiceData
.priceDetails.payPeriod,
},
});
setPrices(prices);
}
} else if (value === 'no') {
setPrices(
removePrices(
prices,
['enhancements'],
priceItem =>
!priceItem.label
.toLowerCase()
.includes('unaccompanied')
)
);
}
handleDataChange(
'unaccompaniedMinorService',
value,
'application'
);
}}
>
<Radio value="yes" />
<span className="fls__radio-label">Yes</span>
<Radio value="no" />
<span className="fls__radio-label">No</span>
</RadioGroup>
</div>
</Fragment>
);
}
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/boston-summer.md
---
path: boston-summer
name: <NAME>
centerNameRelation:
- Suffolk University
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
- arrive: Jul 18th, 2021
depart: Aug 7th, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/boston-summer-1.jpg
programDetails:
price: 4875
duration: 3
minimumAge: 12
durationRelation: 3
specialty-tour-description: As one of America's oldest cities and the country's
educational capital, Boston is a unique place to soak up American culture
while you sharpen your English skills. Our ESL and activity program is the
perfect way to enjoy the best of Boston's many highlights while working on
your language abilities! Our program is located on the campus of Suffolk
University, set in the vibrant heart of Boston!
activities-and-excursions: |-
* Newbury Street
* Faneuil Hall and Quincy Market
* Beacon Hill and the State House
* Harvard University and Harvard Square
* Prudential Center
* New England Aquarium
* Museum of Fine Arts
* MIT Tour
* Freedom Trail
* Duck Tour
* Revere Beach
* Little Italy
### Optional Tours available:
* New York Weekend
* Six Flags Amusement Park
features: |-
* 18 lessons of English per week
* Evening activities including games, parties, and dances
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation at Suffolk University
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/high-school-completion.md
---
path: online-high-school-completion
name: High School Completion
type: Online Essential Program
hero-image: /assets/hs-completion.jpg
programDetails:
lessonsPerWeek: 12
hoursPerWeek: "10"
minutesPerLesson: 50
description: Earn your American high school diploma with FLS!
program-post-content: >-
The pathway to success begins with an American high school diploma! But many
international students hoping to complete a diploma don't have the time or
resources to attend a US high school and are searching for alternate
options. Now international high schools students can earn high school credit
and their high school diploma through FLS through our guided online program.
Students use nationally accredited high school curriculum online, with guidance and mentoring from FLS instructors specially trained to help our students succeed. After receiving your diploma, use FLS's placement service to get accepted to the best university for you!
program-features-content: |-
### Program Features:
* 2 hours of study per day/ 10 hours per week
* Start any Monday
* For students in FLS level 12 and up
### Price
* One-time curriculum fee
* $150 per week, four weeks minimum enrollment
### Study courses in:
* Earth Science
* Biology
* American History
* Mathematics
* Human Relations
* and more...
---
<file_sep>/src/pages/404.js
import React from 'react';
// TODO: This needs to actually look like a page
export default function NotFoundPage() {
return <h1>Page Not Found!</h1>;
}
<file_sep>/src/netlify-content/data/enhancements/in-person/high-school-completion-course.md
---
name: High School Completion Course
centerNameRelation:
- Boston Commons
priceDetails:
price: 1500
payPeriod: per-four-weeks
---
<file_sep>/src/components/application/OnlineInfoForm.js
import React, { useState, Fragment } from 'react';
import Select from 'react-select';
import DatePicker from 'react-datepicker';
import { RadioGroup, Radio } from 'react-radio-group';
import ReactTooltip from 'react-tooltip';
import { useStaticQuery, graphql } from 'gatsby';
import Checkbox from 'rc-checkbox';
import EstimatedPrices from 'src/components/application/EstimatedPrices';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import {
kebabToCamel,
formatEdges,
updatePrices,
removePrices,
} from 'src/utils/helpers';
// TODO: Figure out a better way to implement this data
let airportData;
export default function OnlineInfoForm({
applicationData,
programsData,
handleDataChange,
handleBatchInputChange,
prices,
setPrices,
}) {
const data = useStaticQuery(graphql`
{
onlineProgramTypes: allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/data/online-program-types/" }
}
) {
edges {
node {
frontmatter {
name
}
}
}
}
enhancements: allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/data/enhancements/online/" }
}
) {
edges {
node {
frontmatter {
name
priceDetails {
price
payPeriod
}
notes
}
}
}
}
generalFees: allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/data/general-fees/online/" }
}
) {
edges {
node {
frontmatter {
name
priceDetails {
price
payPeriod
}
}
}
}
}
}
`);
programsData = formatEdges(programsData);
const enhancementsData = formatEdges(data.enhancements);
const generalFeesData = formatEdges(data.generalFees);
const onlineProgramTypesData = formatEdges(data.onlineProgramTypes);
const [programOptions, setProgramOptions] = useState([]);
const [durationOptions, setDurationOptions] = useState([]);
const onlineProgramTypesOptions = onlineProgramTypesData.map(program => {
return {
value: program.name,
label: program.name,
};
});
if (
!prices.find(priceItem =>
priceItem.label.toLowerCase().includes('application')
)
) {
const applicationFeeData = generalFeesData;
let updatedPrices = [...prices];
updatedPrices.push({
type: 'general fees',
label: applicationFeeData.name,
priceDetails: {
price: applicationFeeData.priceDetails.price,
// TODO: Is there a way to capture the payPeriod for programs in the CMS?
payPeriod: applicationFeeData.priceDetails.payPeriod,
},
});
setPrices(updatedPrices);
}
const handleOnlineProgramTypesChange = onlineProgramTypesChange => {
// Set state operatons are async, so we'll use this non-async version for the below operations
const currentOnlineProgramType = onlineProgramTypesData.find(
onlineProgramType =>
onlineProgramType.name === onlineProgramTypesChange.value
);
handleDataChange(
'onlineProgramType',
currentOnlineProgramType.name,
'application'
);
/*
If the duration or program is already selected, and the user picks a new online program type, this can cause complications with already selected programs
and durations. It seems easier, then, to just require them to reselect a program & duration.
*/
if (applicationData.duration || applicationData.program) {
/*
Originally, this was two state changes in quick succession. This was causing problems, and though there may be a better way to handle it,
manually batching the state changes seems to solve the problem.
*/
let blankedApplicationData = {};
if (applicationData.duration)
blankedApplicationData.duration = null;
if (applicationData.program) blankedApplicationData.program = null;
if (applicationData.housing) blankedApplicationData.housing = null;
handleBatchInputChange(blankedApplicationData, 'application');
setPrices(removePrices(prices, ['program', 'housing']));
}
// Set program options to be the programs associated with the selected online program type
setProgramOptions(
programsData
.filter(program => {
return program.onlineProgramType.includes(
onlineProgramTypesChange.value
);
})
.map(program => {
return {
value: program.name.toLowerCase().split(' ').join('-'),
label: program.name,
};
})
);
};
const handleProgramChange = programChange => {
const currentProgram = programsData.find(
program => program.name === programChange.label
);
// TODO: State changes are async, so we keep using 'currentProgram' inside this function scope
// With some refactoring, we could probably change 'handleDataChange' to take a callback that can be passed to the state change
handleDataChange('program', currentProgram, 'application');
let durationOptions = [];
for (let i = 0; i <= currentProgram.priceDetails.range.maxWeeks; i++) {
const weekNum = i + 1;
// TODO: Likely need to make a special note during submission if they select more than the max weeks
if (
currentProgram.priceDetails.range.exceedMaxWeeks &&
i == currentProgram.priceDetails.range.maxWeeks
) {
durationOptions.push({
label: `${i}+ weeks`,
value: `${weekNum}+`,
});
} else if (i < currentProgram.priceDetails.range.maxWeeks) {
durationOptions.push({
label: weekNum === 1 ? `${i + 1} week` : `${i + 1} weeks`,
value: weekNum,
});
}
}
handleDataChange('program', currentProgram, 'application');
setDurationOptions(durationOptions);
};
const handleDurationChange = durationChange => {
handleDataChange(
'duration',
{
label: durationChange.label,
value: durationChange.value,
},
'application'
);
// If programStartDate exists, we can be confident there's also a program end date & housing check in/check out dates
if (applicationData.programStartDate) {
handleBatchInputChange(
{
programEndDate: (() => {
const clonedDate = new Date(
applicationData.programStartDate
);
// Each 'week' needs to end on a friday, hence this weird math
return clonedDate.setDate(
clonedDate.getDate() +
(durationChange.value * 7 - 3)
);
})(),
housingCheckOutDate: (() => {
const clonedDate = new Date(
applicationData.housingCheckInDate
);
return clonedDate.setDate(
clonedDate.getDate() +
(durationChange.value * 7 - 1)
);
})(),
},
'application'
);
}
let pricePerWeek = applicationData.program.priceDetails.range.weekThresholds.reduce(
(pricePerWeek, currentWeek, index, arr) => {
// If there are no previous thresholds, previous max defaults to 0. Otherwise, the minimum threshold value is last week's max threshold, plus one.
let thresholdMin =
index === 0 ? 1 : arr[index - 1].thresholdMax + 1;
if (
durationChange.value >= thresholdMin &&
durationChange.value <= currentWeek.thresholdMax
) {
return currentWeek.pricePerWeek;
} else {
return pricePerWeek;
}
},
0
);
let updatedPrices = [...prices];
/*
The duration input is only responsible for adding a new program,
since programs are inextricably tied to duration. Other price types, like housing,
are handled by the change of their respective inputs.
*/
if (!updatedPrices.find(priceItem => priceItem.type === 'program')) {
updatedPrices.push({
type: 'program',
label: `${applicationData.program.name}`,
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
// TODO: Is there a way to capture the payPeriod for programs in the CMS?
payPeriod: 'Per Week',
},
});
} else {
// TODO: This function might be clearer if it supports chaining, or a way to pass in multiple changes as arguments
updatedPrices = updatePrices(updatedPrices, 'program', {
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
},
});
}
// Housing price is tied to duration, so we make sure to update it when the duraton changes;
updatedPrices = updatePrices(updatedPrices, 'housing', {
priceDetails: {
duration: durationChange.value,
},
});
setPrices(updatedPrices);
};
const isMonday = date => date.getDay() === 1;
return (
<Fragment>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Online Program Type
</label>
</div>
<Select
className="fls__select-container"
classNamePrefix={'fls'}
value={{
label: applicationData.onlineProgramType
? applicationData.onlineProgramType
: 'Select an online program type.',
value: applicationData.onlineProgramType
? applicationData.onlineProgramType
: null,
}}
onChange={onlineProgramTypesOption => {
handleOnlineProgramTypesChange(
onlineProgramTypesOption
);
}}
options={onlineProgramTypesOptions}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">Program</label>
{applicationData.onlineProgramType ? null : (
<span className="label label--application label--select-first fls--red">
Select an online program type first
</span>
)}
</div>
<Select
className={`fls__select-container ${
!applicationData.onlineProgramType
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.program
? applicationData.program.name
: 'Select a program',
value: applicationData.program
? applicationData.program.name
: 'Select a program',
}}
onChange={handleProgramChange}
options={programOptions}
isDisabled={!applicationData.onlineProgramType}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">Duration</label>
{applicationData.program ? null : (
<span className="label label--application label--select-first fls--red">
Select a program first
</span>
)}
</div>
<Select
className={`fls__select-container ${
!applicationData.program
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.duration
? applicationData.duration.label
: 'Select a duration.',
value: applicationData.duration
? applicationData.duration.value
: null,
}}
onChange={handleDurationChange}
options={durationOptions}
isDisabled={!applicationData.program}
/>
</div>
{/* TODO: This field needs some serious validation */}
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Program Start Date
<FontAwesomeIcon
className="application__info-icon"
icon={faInfoCircle}
data-tip="In-person programs begin on Mondays."
/>
</label>
{applicationData.program ? null : (
<span className="label label--application label--select-first fls--red">
Select a program first
</span>
)}
</div>
<DatePicker
selected={
applicationData.programStartDate
? new Date(applicationData.programStartDate)
: applicationData.programStartDate
}
onChange={date => {
handleBatchInputChange(
{
programStartDate: date,
programEndDate: (() => {
const clonedDate = new Date(date);
// Each 'week' needs to end on a friday, hence this weird math
return clonedDate.setDate(
clonedDate.getDate() +
(applicationData.duration.value *
7 -
3)
);
})(),
},
'application'
);
}}
minDate={new Date()}
wrapperClassName={`fls__date-wrapper ${
!applicationData.duration
? 'fls__select-container--disabled'
: ''
}`}
className={'input fls__base-input'}
placeholderText={'Choose Your Start Date'}
filterDate={isMonday}
readOnly={!applicationData.duration}
/>
</div>
<div className="column is-full-tablet is-half-desktop">
<div className="application__label-container">
<label className="label label--application">
Program End Date
</label>
</div>
<DatePicker
selected={applicationData.programEndDate}
wrapperClassName={`fls__date-wrapper fls__date-wrapper--read-only ${
!applicationData.duration
? 'fls__select-container--disabled'
: ''
}`}
className={'input fls__base-input'}
placeholderText={'Program End Date'}
readOnly={true}
/>
</div>
<div className="column is-full">
<label className="label label--application">
Are you a transfer student?
</label>
<RadioGroup
selectedValue={applicationData.transferStudent}
onChange={value => {
handleDataChange(
'transferStudent',
value,
'application'
);
}}
>
<Radio value="yes" />
<span className="fls__radio-label">Yes</span>
<Radio value="no" />
<span className="fls__radio-label">No</span>
</RadioGroup>
</div>
</Fragment>
);
}
<file_sep>/src/netlify-content/data/programs/online/stem.md
---
name: STEM
onlineProgramType: Online Pathway Program
durationOptions:
maxWeeks: 2
hoursPerWeek: '2'
lessonsPerWeek: 3
minutesPerLesson: 1
timesOffered:
- 12:00 AM
---
<file_sep>/src/netlify-content/pages/dynamic/locations/los-angeles.md
---
path: los-angeles-ca
name: Los Angeles, CA
centerNameRelation:
- Citrus College
description: Study English in California! Citrus College offers a great
combination of suburban comfort with access to all of the attractions and
glamour of Los Angeles.
quick-facts:
- name: Campus Facilities
icon: /assets/campus-facilities-icon.png
items: |-
* <NAME> Performing Arts Center
Dan Angel Computer Center
Hayden Memorial Library
Language Lab
Tennis Courts
Golf Range
Track & Field
Smartboards
carousel-images:
- /assets/citrus-2-beach.jpg
- /assets/universal-globe.jpg
- /assets/citrus-college-1.jpeg
- /assets/housing4.jpg
- /assets/disney-princess-photo.jpg
- /assets/colllege-auditing.jpg
post-content: >-
# OPEN FOR IN-PERSON PROGRAMS! HYBRID CLASSES HAVE STARTED.
## OVERVIEW
###### Enjoy the Southern California Lifestyle near the World's Entertainment Capital
Los Angeles is a trend-setting global metropolis with a fascinating history and rich cultural heritage. The "City of Angels" is home to picture-perfect beaches and 75 miles of sunny coastline. Regarded as the entertainment capital of the world, Los Angeles is home to legendary Hollywood movie studios, responsible for the most popular movies anywhere. L.A. also boasts a thriving theater, music and gallery scene. Celebrities can often be seen shopping the streets of Beverly Hills, including the world-famous Rodeo Drive.
###### Comfortable, Suburban Environment
Located in Los Angeles County near the foothills of the San Gabriel Mountains, Citrus College offers a combination of suburban comfort along with access to all of L.A.'s attractions. The city of Glendora, known as the "Pride of the Foothills", offers a safe environment and Glendora Village with dozens of shops, restaurants and cafes.
###### Enjoy Access to Excellent Educational Opportunities
Having served students for over 100 years, Citrus College is one of California's first colleges and continues to expand its educational mission. Citrus offers an ideal place for students to begin exploring all the many educational and cultural opportunities that California has to offer. Students may transfer to prestigious institutions such as UCLA and UC Irvine.
<iframe width="560" height="315" src="https://www.youtube.com/embed/A6k8tgbVzoo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
## CAMPUS PROFILE
Citrus College has a long tradition of serving students and offers numerous university-level courses for the first two years of a bachelor’s degree. Students enjoy an active schedule of campus events, including a full range of athletic activities, performing arts and student fairs. Campus highlights include the Olympic-size swimming pool, the golf driving range and the state-of-the-art recording studio.
* **<NAME> Performing Arts Center** A 1,400 seat theatre providing entertainment offerings.
* **Angel Data Processing Center** Main computer lab with a variety of computers and software.
* **Hayden Library** This newly remodeled and enlarged library contains one hundred computer stations.
* **Learning Center** Houses multimedia computer labs and language labs.
* **Stuffed Owl Café** The café offers a wide range of food selections from pizza and salads to burritos, tacos, sandwiches and an entrée of the day.
* **Campus Center** The center includes the student lounge, student club offices and conference rooms.
## HOUSING
**Homestay**
A homestay is a great way to experience American culture while improving your English ability! All of our centers offer homestay accommodation with American families individually selected by FLS. With your host family you'll learn about American daily life, practice English on a regular basis and participate in many aspects of American culture that visitors often don't get to see. (Twin and Single options available).
## AREA PROFILE
**The Citrus Experience**
Located within reach of all Southern California’s biggest attractions, Glendora is a convenient starting point for a range of adventures that can take you from the beaches of Malibu to the ski slopes of Big Bear Resort.
* Visit the original Disneyland theme park, home to the Star Wars-themed Galaxy's Edge.
* Tour the sights of Hollywood and Beverly Hills, including the TCL Chinese Theater and the chic boutiques on Rodeo Drive.
* Visit the colorful ethnic communities of Little Tokyo, Olvera Street, Koreatown and Chinatown.
* Enjoy an exciting sports event and cheer on one of L.A.’s top-notch professional teams, including the Dodgers, the Angels, the Lakers, or the Clippers.
* Listen to world-famous artists in concert at the legendary Hollywood Bowl or at Disney Hall, an architectural landmark.
* Visit one of the world’s most impressive museum complexes, the Getty Center, offering great views of the city and art from the Renaissance to contemporary times.
###### **English + Volunteering**
FLS offers ESL students a wonderful way to practice their new English skills while immersing themselves in American society by volunteering at local charities and community service centers. Join other FLS students as they perfect their conversational English while helping others! Here are some of the opportunities you will enjoy at FLS Citrus College:
* Los Angeles Food Bank
* La Fetra Senior Center
* Heal the Bay
###### **Optional Weekend and Evening Activities**
FLS offers ESL students memorable and educational tour experiences, and opportunities to visit the best attractions of the United States. Students will have many opportunities to take part in excursions with the full supervision of our trained FLS staff.
###### **Activities include:**
* Disneyland
* Six Flags Magic Mountain
* Hollywood
* Downtown L.A.
* Knott's Berry Farm
* Santa Monica Pier and Beach
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/essential-english.md
---
path: essential-english
name: Essential English
type: Online Essential Program
hero-image: /assets/adobestock_352087154.jpeg
programDetails:
lessonsPerWeek: 9
hoursPerWeek: "7.5"
minutesPerLesson: 50
description: Improve your English conversation ability!
program-post-content: >-
For anyone who wants to improve their everyday English conversational ability,
this program offers convenient, short daily sessions. You'll experience an
integrated approach to all the key language skills. These dynamic classes
offer plenty of speaking practice and an introduction to essential English
grammar structures and vocabulary.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* 90 minutes per day/7.5 hours per week
* Start any Monday
* 18 levels of instruction
* 2 Start times available: 3 PM Pacific Time or 3 PM Pacific Time
### Price
* $110 per week
---
<file_sep>/src/components/testimonial/Testimonial.js
import React from 'react';
import testimonialStyles from './Testimonial.module.scss';
import testimonialImg from 'src/img/testimonial-avatar.jpeg';
export default function Section(props) {
// TODO: All this testimonial data should come from the CMS
return (
<div className="column is-full-desktop is-half-tablet">
<div
className={`${testimonialStyles.fls__testimonial} ${testimonialStyles.fls__testimonialPrograms}`}
>
<img
src={testimonialImg}
alt="testimonial avatar"
className={testimonialStyles.fls__testimonialAvatar}
/>
<p className={testimonialStyles.fls__testimonialCopy}>
I like everything about this program. When I get home it
will help me to get a job!
</p>
<div className={testimonialStyles.fls__testimonialSubcopy}>
<span>AHMED</span> -{' '}
<span className="fls--red">Saudi Arabia</span>
<a
href=""
className="fls__link fls__link--alt fls--red fls__testimonial-read-more"
>
Read more
</a>
</div>
</div>
</div>
);
}
<file_sep>/src/components/price-calculator/PriceCalculator.js
import React, { useState } from 'react';
import { useStaticQuery, graphql, Link } from 'gatsby';
import { formatEdges } from 'src/utils/helpers';
import useLocalStorageState from 'use-local-storage-state';
import 'react-datepicker/dist/react-datepicker.css';
import sectionStyles from 'src/components/section/Section.module.scss';
import DatePicker from 'react-datepicker';
import Select from 'react-select';
import { calculatePrice, removePrices, updatePrices } from 'src/utils/helpers';
export default function Navbar({ props }) {
const data = useStaticQuery(graphql`
{
inPersonPrograms: allMarkdownRemark(
limit: 1000
filter: {
fileAbsolutePath: { regex: "/data/programs/in-person//" }
}
) {
edges {
node {
frontmatter {
name
centerNameRelation
durationOptions {
maxWeeks
exceedMaxWeeks
weekThresholds {
pricePerWeek
thresholdMax
}
}
hoursPerWeek
lessonsPerWeek
minutesPerLesson
}
}
}
}
locations: allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/data/locations/" } }
) {
edges {
node {
frontmatter {
name
centerName
}
}
}
}
housing: allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/data/housing/" } }
) {
edges {
node {
frontmatter {
name
centerNameRelation
priceDetails {
payPeriod
price
}
}
}
}
}
}
`);
const [applicationData, setApplicationData] = useLocalStorageState(
'applicationData',
{
center: '',
duration: '',
programStartDate: '',
housing: '',
program: '',
onlineProgramType: '',
programType: 'in-person',
// TODO: Figure out passport photo & financial document image upload
}
);
const [prices, setPrices] = useLocalStorageState('prices', []);
const programsData = formatEdges(data.inPersonPrograms);
const centersData = formatEdges(data.locations);
const housingData = formatEdges(data.housing);
const [programOptions, setProgramOptions] = useState([]);
const [housingOptions, setHousingOptions] = useState([]);
const [durationOptions, setDurationOptions] = useState([]);
const centerOptions = centersData
.map(center => {
return {
value: center.centerName,
label: `${center.centerName} @ ${center.name}`,
};
})
.filter(center =>
programsData.some(program =>
program.centerNameRelation.includes(center.value)
)
);
const isMonday = date => date.getDay() === 1;
const handleProgramChange = programChange => {
const currentProgram = programsData.find(
program => program.name === programChange.label
);
setApplicationData({
...applicationData,
...{ program: currentProgram },
});
let durationOptions = [];
for (let i = 0; i <= currentProgram.durationOptions.maxWeeks; i++) {
const weekNum = i + 1;
// TODO: Likely need to make a special note during submission if they select more than the max weeks
if (
currentProgram.durationOptions.exceedMaxWeeks &&
i == currentProgram.durationOptions.maxWeeks
) {
durationOptions.push({
label: `${i}+ weeks`,
value: `${weekNum}+`,
});
} else if (i < currentProgram.durationOptions.maxWeeks) {
durationOptions.push({
label: weekNum === 1 ? `${i + 1} week` : `${i + 1} weeks`,
value: weekNum,
});
}
}
setApplicationData({
...applicationData,
...{ program: currentProgram },
});
setDurationOptions(durationOptions);
};
const handleCenterChange = centerChange => {
// Set state operatons are async, so we'll use this non-async version for the below operations
const currentCenter = centersData.find(
center => center.centerName === centerChange.value
);
setApplicationData({
...applicationData,
...{ center: currentCenter },
});
/*
If the duration or program is already selected, and the user picks a new center, this can cause complications with already selected programs
and durations. It seems easier, then, to just require them to reselect a program & duration.
*/
if (applicationData.duration || applicationData.program) {
/*
Originally, this was two state changes in quick succession. This was causing problems, and though there may be a better way to handle it,
manually batching the state changes seems to solve the problem.
*/
let blankedApplicationData = {};
if (applicationData.duration)
blankedApplicationData.duration = null;
if (applicationData.program) blankedApplicationData.program = null;
if (applicationData.housing) blankedApplicationData.housing = null;
setApplicationData({
...applicationData,
...blankedApplicationData,
});
setPrices(removePrices(prices, ['program', 'housing']));
}
// Set program options to be the programs associated with the selected center
setProgramOptions(
programsData
.filter(program => {
return program.centerNameRelation.includes(
centerChange.value
);
})
.map(program => {
return {
value: program.name.toLowerCase().split(' ').join('-'),
label: program.name,
};
})
);
setHousingOptions(
housingData
.filter(housing => {
return housing.centerNameRelation.includes(
centerChange.value
);
})
.map(housing => {
return {
value: housing.name.toLowerCase().split(' ').join('-'),
label: housing.name,
};
})
);
};
const handleHousingChange = housingChange => {
const currentHousing = housingData.find(
housing => housing.name === housingChange.label
);
setApplicationData({
...applicationData,
...{ housing: currentHousing },
});
// TODO: This 'new price' logic is begging to be refactored & DRYed up
if (prices.find(priceItem => priceItem.type === 'housing')) {
prices = prices.map(priceItem => {
if (priceItem.type === 'housing') {
return {
...priceItem,
priceDetails: {
duration: applicationData.duration.value,
price: currentHousing.priceDetails.price,
},
};
}
});
} else {
prices.push({
type: 'housing',
label: `${currentHousing.name}`,
priceDetails: {
duration: applicationData.duration
? applicationData.duration.value
: 0,
price: currentHousing.priceDetails.price,
payPeriod: currentHousing.priceDetails.payPeriod,
},
});
}
setPrices(prices);
};
const handleDurationChange = durationChange => {
setApplicationData({
...applicationData,
...{
duration: {
label: durationChange.label,
value: durationChange.value,
},
},
});
// If programStartDate exists, we can be confident there's also a program end date & housing check in/check out dates
if (applicationData.programStartDate) {
setApplicationData({
...applicationData,
...{
programEndDate: (() => {
const clonedDate = new Date(
applicationData.programStartDate
);
// Each 'week' needs to end on a friday, hence this weird math
return clonedDate.setDate(
clonedDate.getDate() +
(durationChange.value * 7 - 3)
);
})(),
housingCheckOutDate: (() => {
const clonedDate = new Date(
applicationData.housingCheckInDate
);
return clonedDate.setDate(
clonedDate.getDate() +
(durationChange.value * 7 - 1)
);
})(),
},
});
}
let pricePerWeek = applicationData.program.durationOptions.weekThresholds.reduce(
(pricePerWeek, currentWeek, index, arr) => {
// If there are no previous thresholds, previous max defaults to 0. Otherwise, the minimum threshold value is last week's max threshold, plus one.
let thresholdMin =
index === 0 ? 1 : arr[index - 1].thresholdMax + 1;
if (
durationChange.value >= thresholdMin &&
durationChange.value <= currentWeek.thresholdMax
) {
return currentWeek.pricePerWeek;
} else {
return pricePerWeek;
}
},
0
);
let updatedPrices = [...prices];
/*
The duration input is only responsible for adding a new program,
since programs are inextricably tied to duration. Other price types, like housing,
are handled by the change of their respective inputs.
*/
if (!updatedPrices.find(priceItem => priceItem.type === 'program')) {
updatedPrices.push({
type: 'program',
label: `${applicationData.program.name} @ ${applicationData.center.centerName}`,
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
// TODO: Is there a way to capture the payPeriod for programs in the CMS?
payPeriod: 'Per Week',
},
});
} else {
// TODO: This function might be clearer if it supports chaining, or a way to pass in multiple changes as arguments
updatedPrices = updatePrices(updatedPrices, 'program', {
priceDetails: {
duration: durationChange.value,
price: pricePerWeek,
},
});
}
// Housing price is tied to duration, so we make sure to update it when the duraton changes;
updatedPrices = updatePrices(updatedPrices, 'housing', {
priceDetails: {
duration: durationChange.value,
},
});
setPrices(updatedPrices);
};
return (
<div className="fls__location-price-calculator">
<h6 className="fls-post__subtitle">Price Calculator</h6>
<div className="columns is-multiline">
<div className="column is-full">
{/* TODO: This should automatically set to the center of the page we're on */}
<Select
className="fls__select-container"
classNamePrefix={'fls'}
value={{
label: applicationData.center
? `${applicationData.center.centerName} @ ${applicationData.center.name}`
: 'Select a center.',
value: applicationData.center
? applicationData.center.centerName
: null,
}}
onChange={centerOption => {
handleCenterChange(centerOption);
}}
options={centerOptions}
/>
</div>
<div className="column is-full">
<Select
className={`fls__select-container ${
!applicationData.center
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.program
? applicationData.program.name
: 'Select a program',
value: applicationData.program
? applicationData.program.name
: 'Select a program',
}}
onChange={handleProgramChange}
options={programOptions}
isDisabled={!applicationData.center}
/>
</div>
<div className="column is-full">
<Select
className={`fls__select-container ${
!applicationData.center
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.housing
? applicationData.housing.name
: 'Select your housing.',
value: applicationData.housing
? applicationData.housing.name
: null,
}}
onChange={handleHousingChange}
options={housingOptions}
isDisabled={!applicationData.center}
/>
</div>
<div className="column is-full">
{/* TODO: These styles need finessing */}
<Select
className={`fls__select-container ${
!applicationData.program
? 'fls__select-container--disabled'
: ''
}`}
classNamePrefix={'fls'}
value={{
label: applicationData.duration
? applicationData.duration.label
: 'Select a duration.',
value: applicationData.duration
? applicationData.duration.value
: null,
}}
onChange={handleDurationChange}
options={durationOptions}
isDisabled={!applicationData.program}
/>
</div>
<div className="column is-full">
<DatePicker
selected={
applicationData.programStartDate
? new Date(applicationData.programStartDate)
: applicationData.programStartDate
}
onChange={date => {
setApplicationData({
...applicationData,
...{
programStartDate: date,
programEndDate: (() => {
const clonedDate = new Date(date);
// Each 'week' needs to end on a friday, hence this weird math
return clonedDate.setDate(
clonedDate.getDate() +
(applicationData.duration
.value *
7 -
3)
);
})(),
// Default check in date to suinday before start of program
housingCheckInDate: (() => {
const clonedDate = new Date(date);
return clonedDate.setDate(
clonedDate.getDate() - 1
);
})(),
// Default checkout date to saturday after end of program
housingCheckOutDate: (() => {
const clonedDate = new Date(date);
return clonedDate.setDate(
clonedDate.getDate() +
(applicationData.duration
.value *
7 -
2)
);
})(),
},
});
}}
minDate={new Date()}
wrapperClassName={`fls__date-wrapper ${
!applicationData.duration
? 'fls__select-container--disabled'
: ''
}`}
className={'input fls__base-input'}
placeholderText={'Choose Your Start Date'}
filterDate={isMonday}
readOnly={!applicationData.duration}
/>
</div>
</div>
<div className="column is-full">
<p className={sectionStyles.startYourJourney__price}>
$ {calculatePrice(prices)} USD
</p>
</div>
<Link to="/application" className="fls__button">
Apply Now
</Link>
</div>
);
}
<file_sep>/src/netlify-content/data/enhancements/in-person/unaccompanied-minor-service.md
---
name: Unaccompanied Minor Service
centerNameRelation:
- Boston Commons
- Saddleback College
- Citrus College
- Chestnut Hill College
priceDetails:
price: 100
payPeriod: once
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/weekend-toefl.md
---
path: weekend-toefl
name: Weekend TOEFL
type: Online Essential Program
hero-image: /assets/toefl-option-7.jpg
programDetails:
lessonsPerWeek: 5
hoursPerWeek: "4"
minutesPerLesson: 50
description: Boost your TOEFL Score!
program-post-content: >-
Students with college plans have a lot of demands on their time. Get the most
out of your schedule with our focused Weekend TOEFL program.
Available for intermediate to advanced students eager to boost their test scores, our weekend course provides instruction in all the components of the TOEFL, as well as practice in the test, allowing students to achieve higher scores quickly.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* Small class sizes
* 2 hours per day/ 4hours per week
* Start any Saturday
* Open to students in FLS Level 9 or above (or equivalent)
* Start time: Saturdays and Sundays, 4:00 AM (US Pacific Time)
### Price
* $95 per week
---
<file_sep>/src/components/application/BillingCheckout.js
import React, { Fragment, useState, useEffect } from 'react';
import ReactFlagsSelect from 'react-flags-select';
import { Elements } from '@stripe/react-stripe-js';
import { loadStripe } from '@stripe/stripe-js';
import { getName, getCode } from 'country-list';
import { handleSubmission } from 'src/components/application/NetlifyStaticForm';
import EstimatedPrices from './EstimatedPrices';
import StripeForm from './StripeForm';
import paymentOptionsImg from 'src/img/stripe-payments.png';
import 'react-flags-select/scss/react-flags-select.scss';
// TODO: We need our REAL stripe key
const stripePromise = loadStripe(process.env.STRIPE_API_KEY);
export default function BillingCheckout({
previousStep,
nextStep,
userData,
billingData,
handleDataChange,
handleBatchInputChange,
prices,
calculatePrice,
applicationData,
}) {
const useHomeAddress = () => {
const billingKeys = [
'firstName',
'lastName',
'address',
'addressCountry',
'city',
'stateProvince',
'postalCode',
],
capitalizeFirstLetter = string => {
// TODO: There is probably a cleaner way to handle this weirdness
return string.charAt(0).toUpperCase() + string.slice(1);
};
const batchedBillingData = billingKeys.reduce((accum, billingKey) => {
accum[`billing${capitalizeFirstLetter(billingKey)}`] =
userData[billingKey];
return accum;
}, {});
handleBatchInputChange(batchedBillingData, 'billing');
};
const [clientSecret, setClientSecret] = useState('');
useEffect(() => {
// Create PaymentIntent as soon as the page loads
window
.fetch('/create-payment-intent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ items: [{ id: 'xl-tshirt' }] }),
})
.then(res => {
return res.json();
})
.then(data => {
setClientSecret(data.clientSecret);
});
}, []);
return (
<Fragment>
<div className="columns is-multiline">
<div className="column is-full">
<div className="application__header-container">
<h3 className="fls-post__title">Billing & Checkout</h3>
<h3 className="application__total-price">
Total Price: ${calculatePrice(prices)}
</h3>
</div>
</div>
<div className="column is-full">
<div className="columns">
<div className="column is-half">
<button
className="fls__button"
onClick={useHomeAddress}
>
Same as Home Address
</button>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<label className="label">First Name</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
onChange={e =>
handleDataChange(
'billingFirstName',
e.target.value,
'user'
)
}
value={billingData.billingFirstName}
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<label className="label">Last Name</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
onChange={e =>
handleDataChange(
'billingLastName',
e.target.value,
'user'
)
}
value={billingData.billingLastName}
/>
</div>
</div>
</div>
<div className="column is-full">
<div className="field">
<label className="label">Address</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
onChange={e =>
handleDataChange(
'billingAddress',
e.target.value,
'user'
)
}
value={billingData.billingAddress}
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<label className="label">City</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
onChange={e =>
handleDataChange(
'billingCity',
e.target.value,
'user'
)
}
value={billingData.billingCity}
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<label className="label">State/Province</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
onChange={e =>
handleDataChange(
'billingStateProvince',
e.target.value,
'user'
)
}
value={billingData.billingStateProvince}
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
<label className="label">Zip/Postal Code</label>
<div className="control">
<input
className="input fls__base-input"
type="text"
onChange={e =>
handleDataChange(
'billingPostalCode',
e.target.value,
'user'
)
}
value={billingData.billingPostalCode}
/>
</div>
</div>
</div>
<div className="column is-half">
<div className="field">
{/* TODO: figure out this country input */}
<label className="label">Country</label>
<div className="control">
{/* TODO: Figure out how to change this with state change */}
<ReactFlagsSelect
defaultCountry={getCode(
billingData.billingAddressCountry
)}
searchable={true}
onSelect={countryCode => {
handleDataChange(
'billingAddressCountry',
getName(countryCode),
'user'
);
}}
/>
</div>
</div>
</div>
<div className="column is-half">
<h3 className="fls-post__title">Payment Information</h3>
<div className="fls__payment-container">
<div className="fls__payment-label">
<span className="fls__payment-label-copy">
Credit or Debit Card Payment
</span>
<img
className="fls__payment-options-img"
src={paymentOptionsImg}
alt="payment options"
/>
</div>
<Elements stripe={stripePromise}>
<StripeForm />
</Elements>
</div>
</div>
</div>
<EstimatedPrices prices={prices} />
<div className="columns">
<div className="column is-4">
<button onClick={previousStep} className="fls__button">
Previous
</button>
</div>
{/* TODO: This works for now... but it's probably not the best implementation */}
<div className="column is-4"></div>
<div className="column is-4">
<button
onClick={() => {
// TODO: There is email copy here, and we likely want that to be controlled from the CMS, or somewhere else.
handleSubmission(
{
...applicationData,
...userData,
...billingData,
},
{
studentName: userData.firstName,
purchaseMessage:
'You have successfully purchased a course!',
}
// {
// clientSecret,
// stripe,
// elements,
// CardElement,
// }
);
}}
className="fls__button fls__button--yellow"
>
{/* TODO: Should probably be FLS yellow, to highlight its importance */}
Submit & Pay
</button>
</div>
</div>
</Fragment>
);
}
<file_sep>/src/netlify-content/data/programs/specialty-tours/discover-new-york.md
---
name: <NAME>
centerNameRelation:
- Marymount Manhattan College
price: 5250
duration: 3
minimumAge: 15
priceDetails:
range:
maxWeeks: 3
weekThresholds:
- thresholdMax: 3
pricePerWeek: 1750
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 11th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
<file_sep>/src/netlify-content/data/programs/online/intensive-english.md
---
name: <NAME>
onlineProgramType: Online Pathway Program
durationOptions:
maxWeeks: 32
exceedMaxWeeks: true
weekThresholds:
- threshold-max: 3
price-per-week: 295
hours-per-week: 15
lessons-per-week: 19
pricePerWeek: 375
- threshold-max: 11
price-per-week: 290
hours-per-week: 15
lessons-per-week: 18
pricePerWeek: 355
- threshold-max: 23
price-per-week: 285
hours-per-week: 15
lessons-per-week: 18
pricePerWeek: 330
- threshold-max: 31
pricePerWeek: 310
- threshold-max: 32
pricePerWeek: 295
minWeeks: 1
priceDetails:
price: 0
payPeriod: weekly
hoursPerWeek: '25'
lessonsPerWeek: 30
minutesPerLesson: 50
timesOffered:
- 6:00 AM
- 9:00 AM
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/discover-boston.md
---
name: <NAME>
centerNameRelation:
- Boston Commons
price: 3795
duration: 3
minimumAge: 15
priceDetails:
range:
maxWeeks: 3
weekThresholds:
- thresholdMax: 3
pricePerWeek: 1265
programDates:
- arrive: Jul 18th, 2021
depart: Aug 7th, 2021
- arrive: Jul 25th, 2021
depart: Aug 14th, 2021
sampleCalendar: /assets/discover-boston.pdf
---
<file_sep>/src/netlify-content/data/general-fees/in-person/health-insurance-fee.md
---
name: <NAME>
centerNameRelation:
- Boston Commons
- Citrus College
- Chestnut Hill College (from Summer, 2021)
- Saddleback College (Summer Only)
- Cal State Long Beach (Summer Only)
- Harvard University Campus
- Marymount Manhattan College
- Suffolk University
priceDetails:
price: 40
payPeriod: Per week
---
<file_sep>/src/netlify-content/data/general-fees/in-person/extra-night-homestay.md
---
name: 'Extra Night: Homestay'
centerNameRelation:
- Boston Commons
- Citrus College
- Saddleback College (Summer Only)
- Chestnut Hill College (from Summer, 2021)
priceDetails:
price: 55
payPeriod: Per Night
---
<file_sep>/src/netlify-content/data/programs/online/junior-english.md
---
name: <NAME>
onlineProgramType: Online Essential Program
durationOptions:
maxWeeks: 36
exceedMaxWeeks: true
hoursPerWeek: '8'
lessonsPerWeek: 5
minutesPerLesson: 90
timesOffered:
- 3:00 AM
- 3:00 PM
termDates: []
---
<file_sep>/src/components/card/Card.js
import React from 'react';
import { Link } from 'gatsby';
import cardStyles from './Card.module.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBook, faClock, faUser } from '@fortawesome/free-solid-svg-icons';
import lukePlaceholderImg from 'src/img/luke-icon.jpeg';
import ceaLogoPlaceholder from 'src/img/cea-logo.png';
export default function Card({
isLocation,
isCarouselLocation,
isAffiliate,
isContact,
programType,
cardData,
}) {
const renderProgramPill = programType => {
if (programType === 'in-person') {
return (
<span className="fls__pill fls__pill--in-person">
In Person
</span>
);
} else if (programType === 'online') {
return <span className="fls__pill fls__pill--online">Online</span>;
}
};
if (programType === 'specialty-tours') {
return (
<Link
to={`/programs/specialty-tours/${cardData.path}`}
className={cardStyles.fls__card}
>
<div className={cardStyles.fls__cardContents}>
<div className={cardStyles.fls__cardHeader}>
<FontAwesomeIcon
className={cardStyles.flsCard__userIcon}
icon={faUser}
/>
{`Age ${cardData.programDetails.minimumAge}+`}
</div>
<div>
<h5 className={cardStyles.fls__cardTitle}>
{cardData.name}
</h5>
<h6 className={cardStyles.fls__cardSubtitle}>
{cardData.centerName}
</h6>
<p className={cardStyles.fls__cardCopy}>
{cardData.speciality_tour_description}
</p>
</div>
<div
className={`${cardStyles.fls__cardDetails} ${cardStyles.fls__cardDetailsSpecialityTours}`}
>
<span>Read More</span>
</div>
</div>
<img
// NOTE: Default to the first carousel image
src={cardData.carousel_images[0]}
alt={`${cardData.name} background image`}
className={`${cardStyles.fls__cardBg} ${cardStyles.fls__cardBgSpecialityTours}`}
/>
<div className={cardStyles.fls__cardBgOverlay}></div>
<div className={cardStyles.fls__cardFooterOverlay}></div>
</Link>
);
} else if (isLocation) {
return (
<div
className={`fls__location ${
isCarouselLocation
? 'fls__location--carousel'
: 'fls__location--post'
}`}
>
<div className="fls__location-img-container">
<img
className="fls__location-img"
src={cardData.carousel_images[0]}
alt={`${cardData.name} background image`}
/>
<Link
to={`/locations-centers/${cardData.path}`}
className="fls__button fls__button--card fls__button--locations-card"
>
Read More
</Link>
</div>
<div
className={`fls__location-copy-container ${
isCarouselLocation
? ''
: 'fls__location-copy-container--post'
}`}
>
<h3 className="fls__location-title">
{cardData.centerNameRelation[0]}
</h3>
<h4 className="fls-location__subtitle">{cardData.name}</h4>
<p className="fls__location-copy">{cardData.description}</p>
</div>
</div>
);
} else if (isAffiliate) {
return (
<div className="column is-one-third">
<img
className={cardStyles.aboutUs__affiliateCardIcon}
src={ceaLogoPlaceholder}
alt=""
/>
<div className={cardStyles.aboutUs__affiliateCardTitle}>
Commission on English Language Program Accreditation
</div>
<div className={cardStyles.aboutUs__affiliateCardCopy}>
CEA is a national accrediting agency recognized by the U.S.
Department of Education. CEA is a specialized accrediting
agency founded by active professionals in English language
education and is the only U.S. agency designed specifically
to accredit English language programs.
</div>
</div>
);
} else if (isContact) {
return (
<div className="column is-one-third-desktop is-half-tablet">
<div className={cardStyles.aboutUs__contactCard}>
<div className={cardStyles.aboutUs__contactCardDetails}>
<img
className={cardStyles.aboutUs__contactCardIcon}
src={lukePlaceholderImg}
alt=""
/>
<strong>Mr. <NAME></strong>
<div
className={cardStyles.aboutUs__contactCardPosition}
>
President
</div>
</div>
<div className={cardStyles.aboutUs__contactCardEmail}>
<EMAIL>
</div>
</div>
</div>
);
} else if (programType === 'in-person' || programType === 'online') {
return (
// TODO: Render bg images based on CMS, and figure out why the pills don't have the space between them that they do in the static site
<Link
to={`/programs/${programType}/${cardData.path}`}
className={cardStyles.fls__card}
>
<div className={cardStyles.fls__cardContents}>
{renderProgramPill(programType)}
<div>
<h5 className={cardStyles.fls__cardTitle}>
{cardData.name}
</h5>
<p className={cardStyles.fls__cardCopy}>
{cardData.description}
</p>
</div>
<div className={cardStyles.fls__cardDetails}>
{/* TODO: Icons */}
<span>
<FontAwesomeIcon
className="fls-post__subhero-icon"
icon={faBook}
/>
{cardData.programDetails.lessonsPerWeek} lessons per
week
</span>
<span>
<FontAwesomeIcon
className="fls-post__subhero-icon"
icon={faClock}
/>
{cardData.programDetails.hoursPerWeek} hours per
week
</span>
</div>
</div>
<img
className={cardStyles.fls__cardBg}
src={cardData.hero_image}
/>
<div className={cardStyles.fls__cardBgOverlay}></div>
</Link>
);
}
}
<file_sep>/src/netlify-content/pages/dynamic/programs/online/junior-english.md
---
path: junior-english
name: <NAME>
type: Online Essential Program
hero-image: /assets/johnny-mcclung-rjdoqxj7-5k-unsplash.jpg
programDetails:
lessonsPerWeek: 5
hoursPerWeek: "7.5"
minutesPerLesson: 90
description: English for a head start in academic success!
program-post-content: >-
Students who begin their intensive English studies at a younger age have a
great head start on academic success. Available for students age 10 to 15,
Essential English for Juniors is a fast-moving program that covers the
fundamental English skills and beyond. Students will enjoy engaging lessons
with a curriculum designed specifically for younger students. Each lesson
involves students in actively practicing their English.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* 90 minutes per day/7.5 hours per week
* Start any Monday
* 18 levels of instruction
* 2 Start times available: 3 PM Pacific Time or 3 AM Pacific Time
### Price
* $110 per week
---
<file_sep>/src/netlify-content/data/online-program-types/online-summer-camp.md
---
name: Online Camp
onlineProgramTypeDescription: Give your kids the fun of an authentic summer camp
experience, all from the comfort of the living room!
---
<file_sep>/src/netlify-content/general-fees/on-location.md
---
title: on-location
fees:
- name: Application Fee
cost: 150
period: Once
pay-period: Once
- name: Housing Placement Fee
cost: 200
period: Once
pay-period: Once
- name: Health Insurance Fee
cost: 200
period: Per week
pay-period: Per week
- name: One-on-one tutoring
cost: 70
period: Per Lesson
pay-period: Per Lesson
- name: Express Mail Free (I-20 Applicants)
cost: 65
period: Once
pay-period: Once
- name: "Extra Night: Homestay"
cost: 55
period: Per Night
pay-period: Per Night
- name: "Extra Night: Student Residences"
cost: 72
period: Per Night
pay-period: Per Night
---
<file_sep>/src/netlify-content/pages/dynamic/programs/online/business-english.md
---
path: online-business-english
name: Business English
type: Online Essential Program
hero-image: /assets/hunters-race-mybhn8kaaec-unsplash-2.jpg
programDetails:
lessonsPerWeek: 9
minutesPerLesson: 50
hoursPerWeek: "7.5"
description: Learn the English you need for business success!
program-post-content: >-
For those too busy to get to English class, FLS comes to you with our
specialized online Business English option. Available for students in Level 9
and above, this involving daily program covers all the English necessary to
succeed in the global world of business as well as an inside look at American
business culture. Our small class sizes guarantee students extensive
interaction with our expert teachers and a targeted approach to the English
you need most.
#### TEACHERS
All of our teachers are based in the United States and speak native-proficient level English. Every teacher has a TEFL Certificate or Master's Degree and extensive instructional experience.
#### LIVE INSTRUCTION
Every lesson is given with live instruction, so your teacher is always there to provide feedback and correction. You'll meet and practice with students from around the world as you improve your English skills together!
program-features-content: |-
### Program Features:
* 90 minutes per day/ 7.5 hours per week
* Start any Monday
* Small class sizes
* Class is held at 4 AM Pacific Time
### Price
* $110 per week
---
<file_sep>/src/netlify-content/navbar-items/programs.md
---
path: programs
pageName: Programs
name: Programs
order: 0
links:
- path: online
pageName: Online
collectionName: online
name: Online
- path: specialty-tours
collectionName: specialty-tours
name: Specialty Tours
- path: in-person
pageName: In Person
collectionName: in-person
name: In Person
---
<file_sep>/src/netlify-content/data/programs/specialty-tours/discover-california-summer.md
---
name: Discover California, Summer
centerNameRelation:
- Citrus College
price: 4110
duration: 3
minimumAge: 15
priceDetails:
range:
maxWeeks: 3
weekThresholds:
- thresholdMax: 3
pricePerWeek: 1370
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
- arrive: Jul 18th, 2021
depart: Aug 7th, 2021
- arrive: Jul 25th, 2021
depart: Aug 14th, 2021
- arrive: Aug 1st, 2021
depart: Aug 21st, 2021
- arrive: Aug 8th, 2021
depart: Aug 28th, 2021
sampleCalendar: /assets/discover-california-calendar.pdf
---
<file_sep>/src/netlify-content/data/housing/homestay-single-room.md
---
name: Homestay Single Room
centerNameRelation:
- Boston Commons
priceDetails:
price: 325
payPeriod: weekly
mealsPerWeek: 16
notes:
- Single room may not be available July - August.
---
<file_sep>/src/netlify-content/data/housing/student-residence-shared-room.md
---
name: Student Residence Shared Room
centerNameRelation:
- Chestnut Hill College
priceDetails:
price: 350
payPeriod: weekly
mealsPerWeek: 19
minimumAge: 18
notes:
- Student residence available Fall and Spring semester
- Proof of immunizations are required for student residence
---
<file_sep>/src/netlify-content/pages/dynamic/programs/specialty-tours/scriptwriting-camp.md
---
path: scriptwriting-camp
name: Scriptwriting Camp
centerNameRelation:
- Marymount Manhattan College
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
carousel-images:
- /assets/discover-new-york-3.jpeg
programDetails:
minimumAge: 15
duration: 3
price: 5250
durationRelation: 3
specialty-tour-description: "Do you have an idea that could be the next Broadway
play? The best place to find out is New York City, the heart of the theater
world! Our camp for future playwrights introduces you to the key concepts of
creating a successful play: developing a great plot, creating memorable
characters, mastering the script format and more. You'll also analyze great
scenes, see a live performance and have plenty of time for sightseeing!"
activities-and-excursions: |-
* Lower Manhattan Sightseeing
* Lincoln Center Tour
* Live Theater Performance
* Acting Workshop
* Metropolitan Museum of Art
* Fifth Avenue Shopping
features: |-
* 18 lessons per week of English classes
* 10 lessons per week of script writing
* Evening activities, including dances, parties, games, and movies
accommodations: >-
* Students will stay in safe and secure on-campus residence halls in shared
room accommodation
* Full-board meal plan included (Meals not included in optional excursions)
---
<file_sep>/src/components/navbar/NavbarDropdown.js
import React from 'react';
import { Link } from 'gatsby';
import navbarStyles from 'src/components/navbar/Navbar.module.scss';
import NavbarDropdownItem from 'src/components/navbar/NavbarDropdownItem';
export default function NavbarDropdown({
isHovering,
dropdownPos,
dropdownWidth,
rootNavPath,
items = [],
}) {
return (
<div
className={`${navbarStyles.flsNav__dropdown} ${
isHovering ? 'fls__show' : 'fls__hide'
}`}
style={{
...dropdownPos,
minWidth: dropdownWidth,
}}
>
{items.map(dropdownItem => (
<NavbarDropdownItem
rootNavPath={rootNavPath}
dropdownItem={dropdownItem}
key={`${rootNavPath}/${dropdownItem.path}`}
/>
))}
</div>
);
}
<file_sep>/src/components/navbar/NavMobileDropdown.js
import React from 'react';
import { useStaticQuery } from 'gatsby';
import navbarStyles from './Navbar.module.scss';
import NavbarMobileCollapsibleSubsection from './NavbarMobileCollapsibleSubsection';
export default function Navbar({
mainNavItem,
rootNavPath,
isSubItem,
isCollapsed,
}) {
const data = useStaticQuery(graphql`
{
allMarkdownRemark(
limit: 1000
filter: { fileAbsolutePath: { regex: "/pages//" } }
) {
edges {
node {
frontmatter {
path
name
}
fileAbsolutePath
}
}
}
}
`);
let items = mainNavItem.links;
if (mainNavItem.collectionName) {
items = data.allMarkdownRemark.edges
.filter(edge => {
return edge.node.fileAbsolutePath.includes(
mainNavItem.collectionName
);
})
.map(sublink => sublink.node.frontmatter);
}
const handleRenderingItems = () => {
let renderedItems;
if (isSubItem) {
renderedItems = (
<div
className={`columns is-multiline is-mobile ${
navbarStyles.flsNav__collapsibleContainer
} ${isCollapsed ? 'fls--collapsed' : ''}`}
>
{items.map(item => (
<NavbarMobileCollapsibleSubsection
item={item}
isSubItem={isSubItem}
rootNavPath={rootNavPath}
/>
))}
</div>
);
} else {
// TODO: This 'collapsible' logic is likely better implemented with a wrapper or higher order component pattern
renderedItems = (
<div
className={`${navbarStyles.flsNav__collapsibleContainer} ${
isCollapsed ? 'fls--collapsed' : ''
}`}
>
{items.map(item => (
<NavbarMobileCollapsibleSubsection
item={item}
rootNavPath={rootNavPath}
isSubItem={false}
/>
))}
</div>
);
}
return renderedItems;
};
return handleRenderingItems();
}
<file_sep>/src/netlify-content/data/programs/specialty-tours/california-summer-jr.md
---
name: <NAME>
centerNameRelation:
- Cal State Long Beach
price: 4635
duration: 3
minimumAge: 12
priceDetails:
range:
maxWeeks: 3
weekThresholds:
- thresholdMax: 2
pricePerWeek: 1543
programDates:
- arrive: Jun 20th, 2021
depart: Jul 10th, 2021
- arrive: Jun 27th, 2021
depart: Jul 17th, 2021
- arrive: Jul 4th, 2021
depart: Jul 24th, 2021
- arrive: Jul 11th, 2021
depart: Jul 31st, 2021
sampleCalendar: /assets/tour-calendar-placeholder.pdf
---
| 3e66fd27a3585012a8140c5f812f2fbfc4c589cf | [
"JavaScript",
"Markdown"
] | 171 | JavaScript | EnochSpevivo/fls-international | ca629cc4bb8f42a71b1ee411daa66eba2645c836 | 53ac15352c8539c4a055e4bb68158652c807f83d |
refs/heads/master | <file_sep># boot-leetcode
没有什么好说的,干就完了
<file_sep>package com.boot.leetcode;
/**
* @ClassName: _4FindMedianSortedArrays
* @Description:
* @Author: <NAME>
* @CreateTime: 2020-07-16 23:46
* @Version: 1.0
**/
public class _4FindMedianSortedArrays {
public static double findMedianSortArrays(int[] nums1,int[] nums2) {
}
public static void main(String[] args) {
}
}
<file_sep>package com.boot.leetcode;
import java.util.List;
import java.util.Stack;
/**
* @ClassName: _2AddTwoNumbers
* @Description:
* @Author: jackson
* @Date: 2020/7/15 下午2:56
* @Version: v1.0
*/
public class _2AddTwoNumbers {
static class ListNode {
int val;
ListNode next;
public ListNode(int val) {
this.val = val;
}
}
//给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。
//
// 如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。
//
// 您可以假设除了数字 0 之外,这两个数都不会以 0 开头。
//
// 示例:
//
// 输入:(2 -> 4 -> 3) + (5 -> 6 -> 4)
//输出:7 -> 0 -> 8
//原因:342 + 465 = 807
//
// Related Topics 链表 数学
/**
* 逆向链表
* @param l1
* @param l2
* @return
*/
public static ListNode addTwoNumbersReverse(ListNode l1,ListNode l2) {
//定义一个结果链表
ListNode result = new ListNode(0);
//定义一个中间量链表
ListNode temp = result;
//定义进位标识
int carry = 0;
while (l1 != null || l2 != null) {
int x = l1 != null ? l1.val : 0;
int y = l2 != null ? l2.val : 0;
//计算每一位的值时,需要加上从上一位的进位
int sum = x + y + carry;
//计算进位
carry = sum / 10;
temp.next = new ListNode(sum % 10);
temp = temp.next;
if (l1 != null) {
l1 = l1.next;
}
if (l2 != null) {
l2 = l2.next;
}
}
//循环完成后,需要判断是否还有进位,有进位需要增加链表
if (carry > 0) {
temp.next = new ListNode(carry);
}
return result.next;
}
/**
* 顺向链表
* 如果链表中的数字不是按逆序存储的呢?例如:
*
* (3 -> 4 ->2) + (4 -> 6 -> 5) = 8 -> 0 -> 7
* (3→4→2)+(4→6→5)=8→0→7
*
* @return
*/
public static ListNode addTwoNumbersForward(ListNode l1,ListNode l2) {
ListNode result = new ListNode(0);
ListNode temp = result;
int carry = 0;
//利用栈先进后出的原理,将顺向链表组装成栈
Stack<Integer> s1 = new Stack<>();
Stack<Integer> s2 = new Stack<>();
while (l1 != null || l2 != null) {
if (l1 != null) {
s1.push(l1.val);
l1 = l1.next;
}
if (l2 != null) {
s2.push(l2.val);
l2 = l2.next;
}
}
while (!s1.empty() || !s2.empty()) {
int x = !s1.empty() ? s1.pop() : 0;
int y = !s2.empty() ? s2.pop() : 0;
int sum = x + y + carry;
carry = sum / 10;
//利用头插法,将结果按照从高位到地位顺序插入
ListNode node = new ListNode(sum % 10);
node.next = temp.next;
temp.next = node;
}
if (carry > 0) {
ListNode node = new ListNode(carry);
node.next = temp.next;
temp.next = node;
}
return result.next;
}
public static ListNode buildListNode(int[] nums) {
ListNode node = new ListNode(0);
ListNode temp = node;
for (int num : nums) {
temp.next = new ListNode(num);
temp = temp.next;
}
return node.next;
}
public static void main(String[] args) {
int[] nums1 = new int[] {2,4,3};
int[] nums2 = new int[] {5,6,4};
int[] nums3 = new int[] {3,4,2};
int[] nums4 = new int[] {4,6,5};
ListNode node1 = buildListNode(nums1);
ListNode node2 = buildListNode(nums2);
ListNode node3 = buildListNode(nums3);
ListNode node4 = buildListNode(nums4);
ListNode listNode = addTwoNumbersReverse(node1, node2);
ListNode listNode1 = addTwoNumbersForward(node3, node4);
System.out.println("逆序打印==============");
while (listNode != null) {
System.out.println(listNode.val);
listNode = listNode.next;
}
System.out.println("顺序打印==============");
while (listNode1 != null) {
System.out.println(listNode1.val);
listNode1 = listNode1.next;
}
}
}
| 91caec79a7e16f5abd4dafe08f6579ed34bb3aeb | [
"Markdown",
"Java"
] | 3 | Markdown | QinghangPeng/boot-leetcode | f6ac9874795b2fb6e620434b806755a2b0062382 | 2cc016e9fc086a1f651ebdfd5b49068a99e196c4 |
refs/heads/main | <repo_name>xhispams/Desafio_asteriscos_y_puntos<file_sep>/asteriscos_y_puntos.rb
#@Author: <NAME>
n = ARGV[0].to_i
n.times do |i|
if i % 2 == 0 # Si es par print i
print '*'
else
print '.'
end
end
print "\n"
| 32bdff4855be5e0caca7e5aac760fb5c65359384 | [
"Ruby"
] | 1 | Ruby | xhispams/Desafio_asteriscos_y_puntos | 8f72776dde62e69a63b0195b47b2f34f3b9c0b98 | 760fd6d6c945e5cc634c50e27d226c628ea02f68 |
refs/heads/master | <file_sep># newlog
A log system written by php
<file_sep><?php
/**
* Created by PhpStorm.
* User: levsion
* Date: 2016/8/5
* Time: 2:56 PM
*/
//配置log常量
if(IS_ONLINE_SERVER)
{
//define('NEW_LOG_HOST','');
define('NEW_LOG_PORT','5151');
define('NEW_LOG_CHANNEL','mapi');
define('NEW_LOG_EXECUTE_TIME',0.1);
define('NEW_LOG_REQUEST',false);
define('NEW_LOG_REQUEST_PARAM',false);
}else if(IS_DEV_SERVER)
{
//define('NEW_LOG_HOST','');
define('NEW_LOG_PORT','5152');
define('NEW_LOG_CHANNEL','mapi');
define('NEW_LOG_EXECUTE_TIME',0);
define('NEW_LOG_REQUEST',true);
define('NEW_LOG_REQUEST_PARAM',true);
}else{
//define('NEW_LOG_HOST','');
define('NEW_LOG_PORT','5153');
define('NEW_LOG_CHANNEL','mapi');
define('NEW_LOG_EXECUTE_TIME',0);
define('NEW_LOG_REQUEST',true);
define('NEW_LOG_REQUEST_PARAM',true);
}
new_log::log("hello new_log",'log_key');
| a6af3bd927f8af219952d4f9b148bd8953b79d09 | [
"Markdown",
"PHP"
] | 2 | Markdown | levsion/newlog | c7bf027ccec3b0eea7ea2cc83454a7fe66f72dd0 | e440bef852b3aefea40141564f37349105bbffec |
refs/heads/main | <repo_name>nomuyoshi/go_webapp_samples<file_sep>/chapter4/domainfinder/build.sh
#!/bin/zsh
# go install すれば $GOPATH/bin に置かれるのでこのスクリプトは不要
echo dmainfinder build
go build -o domainfinder
echo synonyms build
cd ../synonyms
go build -o ../domainfinder/lib/synonyms
echo available build
cd ../available
go build -o ../domainfinder/lib/available
echo sprinkle build
cd ../sprinkle
go build -o ../domainfinder/lib/sprinkle
echo coolify build
cd ../coolify
go build -o ../domainfinder/lib/coolify
echo domainify
cd ../domainify
go build -o ../domainfinder/lib/domainify
echo Done
<file_sep>/chapter1/chat/upload.go
package main
import (
"io"
"io/ioutil"
"net/http"
"path/filepath"
)
type uploadHandler struct{}
func (uploadHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
userID := r.FormValue("userID")
file, header, err := r.FormFile("avatarFile")
if err != nil {
io.WriteString(w, err.Error())
w.WriteHeader(http.StatusBadRequest)
return
}
defer file.Close()
data, err := ioutil.ReadAll(file)
if err != nil {
io.WriteString(w, err.Error())
w.WriteHeader(http.StatusInternalServerError)
return
}
filename := filepath.Join("avatars", userID+filepath.Ext(header.Filename))
err = ioutil.WriteFile(filename, data, 0644)
if err != nil {
io.WriteString(w, err.Error())
w.WriteHeader(http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusCreated)
}
<file_sep>/chapter4/domainfinder/main.go
package main
import (
"log"
"os"
"os/exec"
)
var cmdChain = []*exec.Cmd{
exec.Command("lib/synonyms"), // synonyms で類語リスト取得
exec.Command("lib/sprinkle"), // sprinkel で単語を改変(しない場合もある)
exec.Command("lib/coolify"), // coolify で母音字の数を増やす(かも)
exec.Command("lib/domainify"), // domainify でドメインに使用可能文字のみにする
exec.Command("lib/available"), // available で利用可能なドメインか判定
}
func main() {
// 1つ目のコマンドの標準入力をos.Stdin(domainfinderにとっての標準入力)にする
cmdChain[0].Stdin = os.Stdin
// 最後のコマンドの標準出力をos.Stdout(domainfinderにとっての標準出力)にする
cmdChain[len(cmdChain)-1].Stdout = os.Stdout
// それぞれのコマンドの標準出力を次のコマンドの標準入力に設定
for i := 0; i < len(cmdChain)-1; i++ {
thisCmd := cmdChain[i]
nextCmd := cmdChain[i+1]
stdout, err := thisCmd.StdoutPipe()
if err != nil {
log.Panicln(err)
}
nextCmd.Stdin = stdout
}
// コマンド実行
for _, cmd := range cmdChain {
if err := cmd.Start(); err != nil {
log.Panicln(err)
} else {
defer cmd.Process.Kill()
}
}
// コマンド完了待ち
for _, cmd := range cmdChain {
if err := cmd.Wait(); err != nil {
log.Panicln(err)
}
}
}
<file_sep>/chapter4/go.mod
module chapter4
go 1.16
<file_sep>/chapter1/chat/avatar_test.go
package main
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
gomniauthtest "github.com/stretchr/gomniauth/test"
)
func TestAuthAvatar(t *testing.T) {
var authAvatar AuthAvatar
testUser := &gomniauthtest.TestUser{}
testUser.On("AvatarURL").Return("", ErrNoAvatarURL)
testChatUser := &chatUser{User: testUser}
url, err := authAvatar.GetAvatarURL(testChatUser)
if err != ErrNoAvatarURL {
t.Error("値が存在しない場合、AuthAvatar.GetAvatarURLはErrNoAvatarURLを返すべきです")
}
testURL := "http://url-to-avatar/"
testUser := &gomniauthtest.TestUser{}
testUser.On("AvatarURL").Return(testURL, nil)
url, err := authAvatar.GetAvatarURL(testChatUser)
if err != nil && err != ErrNoAvatarURL {
t.Error("値が存在する場合、AuthAvatar.GetAvatarURLはエラーを返すべきではありません。unexpected error: ", err)
} else {
if url != testURL {
t.Error("AuthAvatar.GetAvatarURLは正しいURLを返すべきです")
}
}
}
func TestGravatarAvatar(t *testing.T) {
var gravatarAvatar GravatarAvatar
chatUser := &chatUser{uniqueID: "<KEY>"}
url, err := gravatarAvatar.GetAvatarURL(chatUser)
if err != nil {
t.Error("GravatarAvatar.GetAvatarURLはエラーを返すべきではありません。error: ", err)
}
if url != "//www.gravatar.com/avatar/0bc83cb571cd1c50ba6f3e8a78ef1346" {
t.Errorf("GravatarAvitar.GetAvatarURLが%sという誤った値を返しました", url)
}
}
func TestFileSystemAvatar(t *testing.T) {
var fileSystemAvatar FileSystemAvatar
filename := filepath.Join("avatars", "0bc83cb571cd1c50ba6f3e8a78ef1346.jpg")
ioutil.WriteFile(filename, []byte{}, 0644)
defer func() {
os.Remove(filename)
}()
chatUser := &chatUser{uniqueID: "<KEY>"}
url, err := fileSystemAvatar.GetAvatarURL(chatUser)
if err != nil {
t.Error("FileSystemAvatar.GetAvatarURLはエラーを返すべきではありません。error: ", err)
}
if url != "/avatars/abc.jpg" {
t.Errorf("FileSystemAvatar.GetAvatarURLが%sという誤った値を返しました", url)
}
}
<file_sep>/chapter4/sprinkle/main.go
package main
import (
"bufio"
"fmt"
"math/rand"
"os"
"strings"
"time"
)
const otherWord = "*"
// あえてスペースを入れている。domainifyで除外するため
var transforms = []string{
otherWord,
otherWord + " app",
otherWord + " site",
otherWord + " time",
"get " + otherWord,
"go " + otherWord,
"lets " + otherWord,
}
func main() {
rand.Seed(time.Now().UnixNano())
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
t := transforms[rand.Intn(len(transforms))]
fmt.Println(strings.Replace(t, otherWord, s.Text(), -1))
}
if s.Err() != nil {
fmt.Println("Error: ", s.Err())
}
}
<file_sep>/chapter1/trace/tracer.go
// ログ出力パッケージ
package trace
import (
"fmt"
"io"
)
// Tracer はログ出力できるオブジェクトを表すインターフェース
type Tracer struct {
out io.Writer
}
func (t Tracer) Trace(args ...interface{}) {
// ゼロ値の場合何もしない
if t.out == nil {
return
}
fmt.Fprintln(t.out, args...)
}
func New(w io.Writer) Tracer {
return Tracer{out: w}
}
<file_sep>/chapter4/synonyms/main.go
package main
import (
"bufio"
"chapter4/thesaurus"
"fmt"
"log"
"os"
)
func main() {
apiKey := os.Getenv("BHT_APIKEY")
bigHuge := thesaurus.NewBigHuge(apiKey)
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
word := s.Text()
syns, err := bigHuge.Synonyms(word)
if err != nil {
log.Fatalln("類語検索に失敗しました。err: ", err)
}
if len(syns) == 0 {
fmt.Printf("「%s」の類語はありませんでした。\n", word)
}
for i := range syns {
fmt.Println(syns[i])
}
}
}
<file_sep>/chapter1/chat/auth.go
package main
import (
"crypto/md5"
"fmt"
"io"
"log"
"net/http"
"strings"
"github.com/stretchr/gomniauth"
"github.com/stretchr/objx"
)
type authHandler struct {
next http.Handler
}
// ServeHTTP はHandlerを実装
func (h *authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if cookie, err := r.Cookie("auth"); err == http.ErrNoCookie || cookie.Value == "" {
// 未認証
w.Header().Set("Location", "/login")
w.WriteHeader(http.StatusTemporaryRedirect)
} else if err != nil {
// 何かしらの別のエラー
panic(err)
}
// ラップされた次のハンドラを呼び出す
h.next.ServeHTTP(w, r)
}
// MustAuth は任意のハンドラーをラップしたauthHandlerを返す
func MustAuth(handler http.Handler) http.Handler {
return &authHandler{next: handler}
}
// loginHandler はソーシャルログイン処理を行う
func loginHandler(w http.ResponseWriter, r *http.Request) {
segs := strings.Split(r.URL.Path, "/")
// パスは「/」から始まるので次のようなスライスになっている
// パスの形式: /auth/{action}/{provider}
// ["", "auth", "{action}", "{provider}"]
if len(segs) != 4 {
log.Println("未対応のpath: ", r.URL.Path)
w.WriteHeader(http.StatusNotFound)
return
}
action := segs[2]
provider := segs[3]
switch action {
case "login":
// TODO: facebook, githubログイン
authProvider, err := gomniauth.Provider(provider)
if err != nil {
log.Fatalln("認証プロバイダーの取得に失敗しました: ", provider, "-", err)
}
loginURL, err := authProvider.GetBeginAuthURL(nil, nil)
if err != nil {
log.Fatalln("loginURL取得に失敗しました: ", provider, "-", err)
}
w.Header().Set("Location", loginURL)
w.WriteHeader(http.StatusTemporaryRedirect)
case "callback":
authProvider, err := gomniauth.Provider(provider)
if err != nil {
log.Fatalln("認証プロバイダーの取得に失敗しました: ", provider, "-", err)
}
creds, err := authProvider.CompleteAuth(objx.MustFromURLQuery(r.URL.RawQuery))
if err != nil {
log.Fatalln("アクセストークン取得失敗: ", provider, "-", err)
}
user, err := authProvider.GetUser(creds)
if err != nil {
log.Fatalln("ユーザー取得に失敗: ", provider, "-", err)
}
m := md5.New()
io.WriteString(m, user.Email())
userID := fmt.Sprintf("%x", m.Sum(nil))
chatUser := &chatUser{User: user, uniqueID: userID}
avatarURL, err := tryAvatars.GetAvatarURL(chatUser)
if err != nil {
log.Fatalln("アバター取得に失敗. err: ", err)
}
authCookieValue := objx.New(map[string]interface{}{
"userID": userID,
"name": user.Name(),
"avatarURL": avatarURL,
"email": user.Email(),
}).MustBase64()
http.SetCookie(w, &http.Cookie{
Name: "auth",
Value: authCookieValue,
Path: "/",
})
w.Header().Set("Location", "/chat")
w.WriteHeader(http.StatusTemporaryRedirect)
default:
// 未対応のアクションの場合404
w.WriteHeader(http.StatusNotFound)
log.Println("未対応のアクション: ", action)
}
}
// logoutHandler はログアウト処理
func logoutHandler(w http.ResponseWriter, r *http.Request) {
http.SetCookie(w, &http.Cookie{
Name: "auth",
Value: "",
Path: "/",
MaxAge: -1,
})
w.Header().Set("Location", "/login")
w.WriteHeader(http.StatusTemporaryRedirect)
}
<file_sep>/chapter1/chat/avatar.go
package main
import (
"errors"
"fmt"
"path/filepath"
gomniauthcommon "github.com/stretchr/gomniauth/common"
)
// ErrNoAvatarURL はインスタンスがアバターURLを返すことが出来ないときに発生するエラー
var ErrNoAvatarURL = errors.New("chat: アバターURLを取得できません")
// ChatUser はチャットユーザーのインターフェイス
type ChatUser interface {
UniqueID() string
AvatarURL() string
}
type chatUser struct {
gomniauthcommon.User
uniqueID string
}
// UniqueID はチャットユーザーのユニークIDを返す
func (u chatUser) UniqueID() string {
return u.uniqueID
}
type Avatar interface {
// GetAvatarURL はクライアントのアバターURLを取得
GetAvatarURL(u ChatUser) (string, error)
}
type TryAvatars []Avatar
func (a TryAvatars) GetAvatarURL(u ChatUser) (string, error) {
for _, avatar := range a {
if url, err := avatar.GetAvatarURL(u); err == nil {
return url, nil
}
}
return "", ErrNoAvatarURL
}
type AuthAvatar struct{}
var UseAuthAvatar AuthAvatar
func (AuthAvatar) GetAvatarURL(u ChatUser) (string, error) {
url := u.AvatarURL()
if url != "" {
return url, nil
}
return "", ErrNoAvatarURL
}
type GravatarAvatar struct{}
var UseGravatarAvatar GravatarAvatar
func (GravatarAvatar) GetAvatarURL(u ChatUser) (string, error) {
if u.UniqueID() == "" {
return "", ErrNoAvatarURL
}
return fmt.Sprintf("//www.gravatar.com/avatar/%s", u.UniqueID()), nil
}
type FileSystemAvatar struct{}
var UseFileSystemAvatar FileSystemAvatar
func (FileSystemAvatar) GetAvatarURL(u ChatUser) (string, error) {
if u.UniqueID() == "" {
return "", ErrNoAvatarURL
}
matches, err := filepath.Glob(filepath.Join("avatars", u.UniqueID()+"*"))
if err != nil || len(matches) == 0 {
return "", ErrNoAvatarURL
}
return matches[0], nil
}
<file_sep>/chapter1/README.md
# go_webapp_samples chat
chapter1 ~ 3
サンプルチャットアプリケーション
Googleログインのみ実装。
環境変数を設定。
```
export GOOGLE_CLIENT_ID=xxx
export GOOGLE_SECRET_KEY=xxx
```
ビルドして実行。
```
$ cd chat
$ go build .
$ ./chat
```
| 749d83fe103157c5b21805f51765f97f887c64a5 | [
"Markdown",
"Go Module",
"Go",
"Shell"
] | 11 | Shell | nomuyoshi/go_webapp_samples | 72a174ebd212ceca95ac0ca362399fb214b6ebda | 2e0ac5fcb8bb1ef0acbd7e6ded9a8a1587080deb |
refs/heads/master | <file_sep># convert-png-to-jpeg
Converts png files in source dir to jpeg in destination dir.
Usage: convert.py "source directory" "destination directory"
<file_sep>#!/usr/local/bin/python3
import sys
import os
from PIL import Image
try:
src_dir = sys.argv[1]
dst_dir = sys.argv[2]
except IndexError:
print("You must supply a valid source and destination directory: convert.py <source directory> <destination directory>")
sys.exit(2)
for filename in os.listdir(src_dir):
if filename.endswith('.png'):
im = Image.open(src_dir + filename)
rgb_im = im.convert('RGB')
new_filename = filename.strip('.png')
rgb_im.save(dst_dir + new_filename+'.jpeg')
print('Saved converted file: '+dst_dir+new_filename+'.jpeg')
| a3ec977f7303ee2205c3047f93a782e8a21909e6 | [
"Markdown",
"Python"
] | 2 | Markdown | marstrander/convert-png-to-jpeg | acf539efa2ce440ad17eeb50c7394c0faa0217e2 | 8b54168f43346bdec564a08d5042dbc99ec3d0fc |
refs/heads/master | <repo_name>ricominten/getViewport<file_sep>/README.md
# getWidthHeight
Javascript get viewport width and height
<file_sep>/getViewport.js
// Get window height
function getHeight() {
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
};
// Get window width
function getWidth() {
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
};
| 93683623bca131fa698d07f17509a4c8faa8bd2e | [
"Markdown",
"JavaScript"
] | 2 | Markdown | ricominten/getViewport | d1ef854635e04c7d6c4c93c3965a2553a318fa2b | 9e2a67f7ad6fb1dd6c166972274971fa6cc8c826 |
refs/heads/master | <repo_name>cookinrelaxin/DS<file_sep>/sort.cpp
#include <iostream>
#include <ctime>
using namespace std;
void print_array(int a[], int N) {
for (int i = 0; i < N; i ++) {
cout<<a[i]<<" ";
}
cout<<endl;
}
void selection_sort(int a[], int N) {
for (int i = 0; i < N; i++) {
int smallest = a[i];
int smallest_index = i;
for (int j = i; j < N; j++) {
if (a[j] < smallest) {
smallest = a[j];
smallest_index = j;
}
}
swap(a[i],a[smallest_index]);
}
}
void bubble_sort(int a[], int N) {
for (int i = 0; i < N; i ++) {
for (int j = 0; j < N-1-i; j ++) {
if (a[j] > a[j+1])
swap(a[j],a[j+1]);
}
}
}
void insertion_sort(int a[], int N, bool (*predicate)(int v1, int v2)) {
if (N == 1) return;
for (int i = 1; i < N; i++) {
for (int j = i; j >= 1; j--) {
if (predicate(a[j],a[j-1]))
swap(a[j],a[j-1]);
else break;
}
}
}
void merge(int A[], int N, int a[], int a_n, int b[], int b_n) {
int i = 0, j = 0, k = 0;
while (i < a_n && j < b_n) {
if (a[i] < b[j]) {
A[k] = a[i];
i++;
}
else {
A[k] = b[j];
j++;
}
k++;
}
while (i < a_n) {
A[k] = a[i];
i ++;
k ++;
}
while (j < b_n) {
A[k] = b[j];
j ++;
k ++;
}
}
void merge_sort(int A[], int N) {
if (N<2) return;
int *a = new int[N/2];
int *b = new int[N/2];
int a_n = N/2;
int b_n = (N%2 == 0) ? N/2 : N/2 + 1;
for (int i = 0; i < a_n; i ++) {
a[i] = A[i];
}
for (int i = 0; i < b_n; i ++) {
b[i] = A[i+N/2];
}
merge_sort(a,a_n);
merge_sort(b,b_n);
merge(A,N,a,a_n,b,b_n);
delete a;
delete b;
}
bool greater_than(int v1, int v2) {
return v1>v2;
}
bool less_than(int v1, int v2) {
return v1<v2;
}
int partition(int a[], int start, int end) {
int pivot = a[end];
int p_index = start;
for (int i=start;i<end;i++)
if (a[i]<pivot) {
swap(a[i],a[p_index]);
p_index++;
}
swap(a[p_index],a[end]);
return p_index;
}
void quick_sort_helper(int a[], int start, int end){
if (start<end) {
int p_index = partition(a,start,end);
quick_sort_helper(a,start,p_index-1);
quick_sort_helper(a,p_index+1,end);
}
}
void quick_sort(int a[], int N) {return quick_sort_helper(a,0,N-1);}
void counting_sort(int a[], int N) {
int maximum = INT_MIN;
for (int i = 0; i < N; i++)
maximum = max(maximum,a[i]);
int *b = new int[maximum+1]();
for (int i = 0; i < N; i++)
b[a[i]]++;
int k = 0;
for (int i = 0; i < maximum+1; i++) {
int count = b[i];
int start_index = k;
while(k < start_index+count) {
a[k] = i;
k++;
}
}
delete [] b;
}
int main() {
int N = 1e8;
int *a = new int[N];
for (int i = 0; i < N; i ++) {
a[i] = rand()%N;
}
//print_array(a,N);
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
clock_t start,elapsed;
start = clock();
quick_sort(a,N);
//counting_sort(a,N);
elapsed = clock() - start;
//print_array(a,N);
printf("time elapsed: %ldms\n",elapsed);
return 0;
}
<file_sep>/search.cpp
#include <iostream>
int linear_search(int a[], int N, int x) {
for (int i = 0; i < N; i++)
if (a[i] == x) return i;
return -1;
}
int binary_search(int a[], int N, int x) {
}
int main() {
return 0;
}
<file_sep>/bigint.cpp
#include <string>
#include <sstream>
#include <map>
#include <stdexcept>
#include "bigint.h"
namespace Dodecahedron {
Bigint::Bigint() {
positive = true;
base = 1000000000;
skip = 0;
}
Bigint::Bigint(long long value) {
base = 1000000000;
skip = 0;
if (value < 0) {
positive = false;
value *= -1;
}
else
positive = true;
while (value) {
number.push_back((int) (value % base));
value /= base;
}
}
Bigint::Bigint(std::string stringInteger) {
int size = stringInteger.length();
positive = (stringInteger[0] != '-');
while (true) {
if (size <= 0) break;
if (!positive && size <= 1) break;
int length = 0;
int num = 0;
int prefix = 1;
for (int i(size - 1); i >= 0 && i >= size - 9; --i) {
if (stringInteger[i] < '0' || stringInteger[i] > '9') break;
num += (stringInteger[i] - '0') * prefix;
prefix *= 10;
++length;
}
number.push_back(num);
size -= length;
}
}
Bigint Bigint::operator+(Bigint const &b) const {
Bigint c = *this;
c += b;
return c;
}
Bigint &Bigint::operator+=(Bigint const &b) {
if (!b.positive)
return *this -= b;
std::vector<int>::iterator it1 = number.begin();
std::vector<int>::const_iterator it2 = b.number.begin();
int sum = 0;
while (it1 != number.end() || it2 != b.number.end()) {
if (it1 != number.end())
sum += *it1;
else
number.push_back(0);
if (it2 != b.number.end()) {
sum += *it2;
++it2;
}
*it1 = sum % base;
++it1;
sum /= base;
}
if (sum) number.push_back(1);
return *this;
}
<file_sep>/coin_change.cpp
#include <limits>
#include <climits>
#include <vector>
#include <iostream>
using namespace std;
void print_array(int A[], int N) {
for(int i=0;i<N;i++) cout<<A[i]<<" ";
cout<<endl;
}
int numberOfSolutions(int total, int coins[], int num_coins) {
int **temp = new int *[num_coins+1];
for (int i = 0; i < num_coins+1; i++)
temp[i] = new int[total+1];
for (int i = 0; i < num_coins; i++ )
temp[i][0] = 1;
for (int i = 1; i <= num_coins; i++) {
for (int j = 1; j <= total; j++) {
if (coins[i-1] > j)
temp[i][j] = temp[i-1][j];
else
temp[i][j] = temp[i][j-coins[i-1]] + temp[i-1][j];
}
}
for (int i = 0; i < num_coins+1; i++)
delete [] temp[i];
delete [] temp;
return temp[num_coins][total];
}
unsigned long long int make_change(int n, vector<int> M) {
int num_coins = M.size();
vector<vector<unsigned long long int>> S (num_coins+1,vector<unsigned long long int> (n+1));
for (int i=1; i <= num_coins; i++) {
for (int a=0; a <= n; a++) {
int m = M[i-1];
if (a == 0)
S[i][a] = 1;
else if (a >= m)
S[i][a] = S[i-1][a] + S[i][a-m];
else
S[i][a] = S[i-1][a];
}
}
return S[num_coins][n];
}
string vec_to_string(vector<int> vec) {
string s;
for (int &x : vec)
s += to_string(x) + " ";
return s;
}
int main() {
int n = 250;
vector<int> M = {41,34,46,9,37,32,42,21,7,13,1,24,3,43,2,23,8,45,19,30,29,18,35,11};
printf("# of ways to make change for %d with %s: %llu\n", n,vec_to_string(M).data(), make_change(n,M));
return 0;
}
<file_sep>/graph.cpp
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
using namespace std;
void DFS_recursive(map<char,set<char>> &adjacency_list, char initial_node) {
set<char> visted;
visted.insert(initial_node);
cout<<initial_node<<endl;
function<void (map<char,set<char>>&,set<char>&,char)> loop = [&loop](map<char,set<char>> &A, set<char> &V, char N) {
for (const char &n : A[N]) {
if (V.find(n) == V.end()) {
V.insert(n);
cout<<n<<endl;
loop(A,V,n);
}
}
};
loop(adjacency_list,visted,initial_node);
}
void DFS_iterative(map<char,set<char>> &A, char v) {
set<char> V;
stack<char> S;
S.push(v);
while (!(S.empty())) {
v = S.top();
S.pop();
if (V.find(v) == V.end()) {
cout<<v<<endl;
V.insert(v);
for (const char &w : A[v]) {
S.push(w);
}
}
}
}
void BFS(map<char,set<char>> &A, char n) {
queue<char> Q;
set<char> V;
Q.push(n);
while(!(Q.empty())) {
n = Q.front();
Q.pop();
if (V.find(n) == V.end()) {
V.insert(n);
cout<<n<<endl;
for (const char &w : A[n])
Q.push(w);
}
}
}
struct node {
int id;
int distance;
bool visited;
vector<int> neighbors;
};
void BFS_shortest_reach(map<int,node*> A, int n) {
queue<int> Q;
Q.push(n);
A[n]->visited = true;
A[n]->distance = 0;
int initial_node = n;
while (!Q.empty()) {
n = Q.front();
Q.pop();
for (int &w : A[n]->neighbors) {
if (!A[w]->visited) {
A[w]->visited = true;
A[w]->distance = A[n]->distance + 1;
Q.push(w);
}
}
}
for (auto const &w : A)
printf("node %d's distance from %d: %d\n",w.first,initial_node,w.second->distance);
}
int main() {
// map<char,set<char>> A;
// A['A'].insert('B');
// A['A'].insert('D');
// A['A'].insert('G');
// A['B'].insert('A');
// A['B'].insert('E');
// A['B'].insert('F');
// A['C'].insert('F');
// A['C'].insert('H');
// A['D'].insert('A');
// A['D'].insert('F');
// A['E'].insert('B');
// A['E'].insert('G');
// A['F'].insert('B');
// A['F'].insert('C');
// A['F'].insert('D');
// A['G'].insert('A');
// A['G'].insert('E');
// A['H'].insert('C');
//DFS_recursive(A,'A');
//DFS_iterative(A,'A');
//BFS(A,'A');
// map<int,node*> A;
// A[1] = new node{1,0,false,vector<int>()};
// A[1]->neighbors.push_back(2);
// A[1]->neighbors.push_back(4);
// A[1]->neighbors.push_back(6);
// A[2] = new node{2,0,false,vector<int>()};
// A[2]->neighbors.push_back(1);
// A[2]->neighbors.push_back(3);
// A[2]->neighbors.push_back(5);
// A[3] = new node{3,0,false,vector<int>()};
// A[3]->neighbors.push_back(2);
// A[3]->neighbors.push_back(4);
// A[4] = new node{4,0,false,vector<int>()};
// A[4]->neighbors.push_back(1);
// A[4]->neighbors.push_back(3);
// A[4]->neighbors.push_back(9);
// A[5] = new node{5,0,false,vector<int>()};
// A[5]->neighbors.push_back(2);
// A[5]->neighbors.push_back(6);
// A[5]->neighbors.push_back(7);
// A[6] = new node{6,0,false,vector<int>()};
// A[6]->neighbors.push_back(1);
// A[6]->neighbors.push_back(5);
// A[6]->neighbors.push_back(9);
// A[7] = new node{7,0,false,vector<int>()};
// A[7]->neighbors.push_back(5);
// A[7]->neighbors.push_back(8);
// A[8] = new node{8,0,false,vector<int>()};
// A[8]->neighbors.push_back(7);
// A[9] = new node{9,0,false,vector<int>()};
// A[9]->neighbors.push_back(4);
// A[9]->neighbors.push_back(6);
// BFS_shortest_reach(A,1);
id a = 5;
return 0;
}
<file_sep>/avl.cpp
#include <iostream>
using namespace std;
struct node {
int key;
unsigned char height;
node *left;
node *right;
node(int k) {key = k; left = right = 0; height = 1;}
};
unsigned char height(node *p) {
return p ? p->height : 0;
}
int bfactor(node *p) {
return height(p->right) - height(p->left);
}
void fixheight(node *p) {
unsigned char hl = height(p->left);
unsigned char hr = height(p->right);
p->height = (hl>hr ? hl : hr) + 1;
}
node* rotateright(node* p) {
node *q = p->left;
p->left = q->right;
q->right = p;
fixheight(p);
fixheight(q);
return q;
}
node* rotateleft(node* q) {
node *p = q->right;
q->right = p->left;
p->left = q;
fixheight(q);
fixheight(p);
return p;
}
node* balance(node *p) {
fixheight(p);
if (bfactor(p) == 2) {
if (bfactor(p->right) < 0)
p->right = rotateright(p->right);
return rotateleft(p);
}
else if (bfactor(p) == -2) {
if (bfactor(p->left) > 0)
p->left = rotateleft(p->left);
return rotateright(p);
}
return p;
}
node* insert(node *p, int k) {
if (!p) return new node(k);
else if (k < p->key)
p->left = insert(p->left,k);
else
p-right = insert(p->right,k);
return balance(p);
}
int main() {
return 0;
}
<file_sep>/MSS.cpp
#include <limits>
#include <climits>
#include <iostream>
using namespace std;
void print_array(int A[], int N) {
for(int i=0;i<N;i++) cout<<A[i]<<" ";
cout<<endl;
}
int MSS_brute_force(int a[], int N) {
int max_sum = numeric_limits<int>::min();
for (int size = 1; size <= N; size++) {
for (int i = 0; i+size-1 < N; i++) {
int sum = 0;
for (int j = i; j < size; j++)
sum+=a[j];
max_sum = max(sum,max_sum);
}
}
return max_sum;
}
int MSS_less_brute(int a[], int N) {
int max_sum=numeric_limits<int>::min();
for (int i = 0; i < N; i++) {
int sum = 0;
for (int size = 1; i+size <= N; size++) {
sum += a[i+size-1];
max_sum = max(sum,max_sum);
}
}
return max_sum;
}
int MSS_DC(int a[],int N) {
if (N==1) return a[0];
int m = N/2;
int left_MSS = MSS_DC(a,m);
int right_MSS = MSS_DC(a+m,N-m);
int left_sum = INT_MIN, right_sum = INT_MIN, sum = 0;
for (int i = m-1; i >= 0; i--) {
sum += a[i];
left_sum = max(left_sum,sum);
}
sum = 0;
for (int i = m; i < N; i++) {
sum += a[i];
right_sum = max(right_sum,sum);
}
return max(max(left_MSS,right_MSS),left_sum+right_sum);
}
int MSS_kadane(int a[], int N) {
int sum = 0, ans = 0;
for(int i = 0; i < N; i ++) {
sum += a[i];
if (sum < 0) sum = 0;
ans = max(ans,sum);
}
return ans;
}
int main() {
int N = 1000;
int *A = new int[N];
for (int i = 0; i < N; i ++)
A[i] = rand()%N - N/2;
// print_array(A,N);
// cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
clock_t start,elapsed;
start = clock();
cout<<"MSS: "<<MSS_kadane(A,N)<<endl;
elapsed = clock() - start;
printf("time elapsed: %ldms\n",elapsed);
return 0;
}
<file_sep>/list.cpp
#include <iostream>
#include <cassert>
using namespace std;
struct Node {
int data;
Node *next;
};
Node* insert(Node *head, int data, int position);
Node* append(Node *head, int data);
Node* remove(Node *head, int position);
Node* reverse(Node *head);
bool compare(Node *headA, Node *headB);
bool empty(Node *head);
Node* from_array(Node *head);
Node* merge(Node *head);
Node* dedupe(Node *head);
Node* merge_point(Node *headA, Node *headB);
int node_value(Node *head, int position);
int detect_cycle(Node *head);
void print_list(Node *head);
void print_reverse_list(Node *head);
int size(Node *head);
void print_list(Node *head) {
while (head) {
cout<<head->data<<" --> ";
head = head->next;
}
cout<<"NULL"<<endl;
return;
}
void test_passed(string test_name) {
cout<<"\033[1;32m"<<test_name<<" passed"<<endl;
cout<<"\033[0;30m";
}
void test_failed(string test_name) {
cout<<"\033[1;31m"<<test_name<<" failed"<<endl;
cout<<"\033[0;30m";
}
Node* from_array(int *a, int N) {
if (N == 1) {
return new Node{*a,NULL};
}
return new Node{*a,from_array(++a,--N)};
}
bool test_from_array() {
int arr0[3] = {5,6,7};
Node* n0 = from_array(arr0,3);
assert(n0->data == 5);
assert(n0->next->data == 6);
assert(n0->next->next->data == 7);
test_passed("from_array");
return true;
}
Node* insert(Node *head, int data, int position) {
if (!head)
return new Node{data,NULL};
if (!position) {
return new Node{data,head};
}
head->next = insert(head->next, data, --position);
return head;
}
bool test_insert() {
int arr0[3] = {1,2,3};
Node* n0 = from_array(arr0,3);
assert(n0->data == 1);
Node* n1 = insert(n0,7,0);
assert(n1->data == 7);
int arr1[2] = {5,6};
Node *n2 = from_array(arr1,2);
assert(n2->data == 5);
Node *n3 = insert(n2, 7, 2);
assert(n3->data == 5);
assert(n3->next->data == 6);
assert(n3->next->next->data == 7);
int arr2[3] = {5,6,8};
Node *n4 = from_array(arr2,3);
assert(n4->data == 5);
Node *n5 = insert(n4, 7, 2);
assert(n5->data == 5);
assert(n5->next->data == 6);
assert(n5->next->next->data == 7);
assert(n5->next->next->next->data == 8);
test_passed("test_insert");
return true;
}
Node* append(Node *head, int data) {
if (!head) return new Node{data,NULL};
head->next = append(head->next,data);
return head;
}
bool test_append() {
int arr0[1] = {1};
Node* n0 = from_array(arr0,1);
assert(n0->data == 1);
Node *n1 = append(n0,2);
assert(n0->data == 1);
assert(n0->next->data == 2);
Node *n2 = append(NULL,2);
assert(n2->data == 2);
test_passed("test_append");
return true;
}
Node* remove(Node *head, int position) {
return head;
}
bool test_remove() {
int arr0[1] = {1};
Node *n0 = from_array(arr0,1);
assert(n0->data == 1);
Node *n1 = remove(n0,0);
assert(n1 == NULL);
int arr1[3] = {1,2,3};
Node *n2 = from_array(arr1,3);
assert(n2->next->data == 2);
Node *n3 = remove(n2,1);
assert(n3->next == 3);
return true;
}
int main() {
test_from_array();
test_insert();
test_append();
test_remove();
return 0;
}
| 234209348cb7760acefaae8d9703c42dd8010227 | [
"C++"
] | 8 | C++ | cookinrelaxin/DS | f2a53651799cc38185c47f9ed6923405fc317f80 | 3af82fd9d05040045c8cd1e09551c83f583a525e |
refs/heads/master | <repo_name>russellsalcido/Quiz<file_sep>/assets/js/script.js
var StartScreen = document.getElementById("startscreen");
var Questionsdiv = document.getElementById("questions");
var StartBtn = document.getElementById("startbtn");
StartBtn.onclick = startquiz;
var CurrentQuestionIndex = 0;
var questiontitle = document.getElementById("questiontitle");
var choices = document.getElementById("choices");
var CurrentQuestion;
var EndScreen = document.getElementById("endscreen");
var finalscore = document.getElementById("finalscore");
function startquiz() {
setTime();
document.getElementById("startscreen");
//hide start screen
StartScreen.setAttribute("hidden", "true");
//display question screen
Questionsdiv.removeAttribute("class");
getQuestions();
}
function getQuestions() {
CurrentQuestion = questions[CurrentQuestionIndex];
questiontitle.textContent = CurrentQuestion.title;
// Loop over every question object
choices.innerHTML = "";
for (var i = 0; i < CurrentQuestion.choice.length; i++) {
var ChoiceBtn = document.createElement("button");
ChoiceBtn.textContent = i + 1 + ". " + CurrentQuestion.choice[i];
// console.log(CurrentQuestion.choice[i]);
choices.appendChild(ChoiceBtn);
}
}
//Timer
var timeEl = document.querySelector("#timer");
var secondsLeft = 60;
function setTime() {
var timerInterval = setInterval(function () {
secondsLeft--;
timeEl.textContent = "Time: " + secondsLeft;
if (secondsLeft === 0) {
clearInterval(timerInterval);
endGame();
}
}, 1000);
}
var score = 0;
choices.addEventListener("click", function (event) {
var element = event.target;
if (element.matches("button") === true) {
var answer = element.textContent.substring(3);
var outcome;
if (
element.textContent.substring(3) ===
questions[CurrentQuestionIndex].answer
) {
score = score + 1;
outcome = "Correct!";
} else {
secondsLeft = secondsLeft - 10;
outcome = "Incorrect!";
}
document.getElementById("outcome").innerHTML = outcome;
CurrentQuestionIndex++;
if (CurrentQuestionIndex === questions.length) {
endGame();
} else {
getQuestions();
}
}
});
function endGame() {
Questionsdiv.setAttribute("hidden", "true");
EndScreen.removeAttribute("hidden");
finalscore.textContent = score + "/" + questions.length;
}
var submit = document.getElementById("submit");
submit.addEventListener("click", function (event) {
var intials = document.getElementById("initials");
window.location.href = "score.html";
});
var highscores = localStorage.getItem("highScores");
if (highscores) {
highscores = JSON.parse(highscores);
} else {
highscores = [];
}
highscores.push({
initials: "KM",
score: "3/5",
});
localStorage.setItem("highScores", JSON.stringify(highscores));
| fc7caaaa78f40c29114760131bb5aab1e6132bed | [
"JavaScript"
] | 1 | JavaScript | russellsalcido/Quiz | 05b19a1d0e417289b49dd6db9cccf2cfba394bd4 | c5004c0941f7d94e9f0c09805e89312b5bc34f09 |
refs/heads/master | <repo_name>walter1999/sample_midterm_p3<file_sep>/p3/Hospital.h
#ifndef HOSPITAL_H_
#define HOSPITAL_H_
#include <string>
#include "Building.h"
class Hospital : public Building {
public:
Hospital(std::string address);
std::string getService();
};
#endif // HOSPITAL_H_
<file_sep>/p3/Hospital.cc
#include "Hospital.h"
Hospital::Hospital(std::string address) : Building(address) {
}
std::string Hospital::getService() {
return "Oncology";
}
<file_sep>/p2/main.cc
#include <iostream>
double Average(double *arr, int n) {
double sum = 0.0;
for (int i = 0; i < n; i++) {
sum += arr[i];
}
return sum / n;
}
int main() {
double array[5];
for (int i = 0; i < 5; i++) {
std::cin >> array[i];
}
std::cout << Average(array, 5) << "\n";
return 0;
}
<file_sep>/p2/Makefile
all:main.cc
g++ main.cc -o main
clean:
rm main
<file_sep>/p3/Makefile
all:main
main: main.o Hospital.o Building.o
g++ main.o Hospital.o Building.o -o main
main.o: main.cc
g++ main.cc -c -o main.o
Hospital.o: Hospital.cc Hospital.h
g++ Hospital.cc -c -o Hospital.o
Building.o: Building.cc Building.h
g++ Building.cc -c -o Building.o
clean:
rm *.o main
<file_sep>/p3/Building.h
#ifndef BUILDING_H_
#define BUILDING_H_
#include <string>
class Building {
std::string address;
public:
Building(std::string address);
virtual void Print();
virtual std::string getService() = 0;
};
#endif // BUILDING_H_
<file_sep>/p3/main.cc
#include <iostream>
#include "Hospital.h"
int main() {
Hospital *hosp = new Hospital("sample address");
hosp->Print();
std::cout << hosp->getService() << "\n";
delete hosp;
return 0;
}
<file_sep>/p3/Building.cc
#include "Building.h"
#include <iostream>
Building::Building(std::string address) {
this->address = address;
}
void Building::Print() {
std::cout << address << "\n";
}
| da21b0a2c7348e88ffec92b924a0e4040fbe028a | [
"Makefile",
"C++"
] | 8 | C++ | walter1999/sample_midterm_p3 | 2a522c4dce97f091c9da289d5cf44abd24ea9f47 | 3b51d00ff1abc194fe9663df371bc22b07f18798 |
refs/heads/master | <file_sep>mkdir ~/.vim
cp ./vimfiles/autoload ~/.vim/autoload -r
cp ./vimfiles/plugged ~/.vim/plugged -r
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
cp ./_vimrc ~/.vimrc
cd ~
vim .vimrc
| da4666cde1050e97f0ec337e75fcaec6c35c7a05 | [
"Shell"
] | 1 | Shell | EduardoPersoft/meuvim | 599526f921ae3c6d0a27602265ec11a0aefdae4b | 64e93ef8e306147cb98fa73e43bb56cfa5d8d5ae |
refs/heads/master | <repo_name>butshuti/bluetoothvpn<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/data/view_models/ServiceStatusViewModel.java
package edu.unt.nslab.butshuti.bluetoothvpn.data.view_models;
import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.LiveData;
import android.support.annotation.NonNull;
import edu.unt.nslab.butshuti.bluetoothvpn.data.objects.ServiceStatusWrapper;
public class ServiceStatusViewModel extends AndroidViewModel{
public ServiceStatusViewModel(@NonNull Application application) {
super(application);
}
public LiveData<ServiceStatusWrapper> getServiceStatus(){
return Repository.instance().getServiceStatus();
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/iptools/sdquery/SDGracefulScheduler.java
package edu.unt.nslab.butshuti.bluetoothvpn.iptools.sdquery;
/**
* Created by butshuti on 9/10/18.
*
* This class implements a graceful scheduler for service discovery tasks.
* It adjusts the number of probes and timeout parameters taking into account the nature of observed failures.
* Considered conditions include network status and the frequency of discovery attempts.
*/
public class SDGracefulScheduler {
/**
* Connection states.
* This wrapper specifies transition recommendations for state validation.
* The actual state transitions are dictated by callbacks received from clients.
*/
public enum ConnState {
CONN_COMPLETE(Integer.MAX_VALUE, "Network connected"), CONN_START(-5, "Configuring network"),
CONN_WAIT(10, "Waiting for network info"), CONN_EXPIRED(-1, "Network request expired");
private int maxAge;
private String expl;
ConnState(int maxAge, String expl){
this.maxAge = maxAge;
this.expl = expl;
}
ConnState incr(){
if(--maxAge > 0){
return this;
}
return CONN_EXPIRED;
}
public String expl(){
return expl;
}
public ConnState debug(String msg){
expl = msg;
return this;
}
}
private static final int INITIAL_BACKOFF_REDUCTION = 10;
private static final int MIN_PROBES = 5;
private int configuredSoTimeoutMs, curSoTimeoutMs;
private int configuredMaxProbes, maxProbes;
private float lastSuccessRate;
private ConnState connState;
private boolean incrTimeout = false, incrNumProbes = false;
/**
* Construct an initial state for the scheduler.
* @param soTimeout the default configured timeout, or a negative value if none
* @param numProbes the default configured MAX number of probes, or a negative value if none
* @param connState the current connection state
*/
public SDGracefulScheduler(int soTimeout, int numProbes, ConnState connState){
configuredMaxProbes = maxProbes = numProbes;
configuredSoTimeoutMs = curSoTimeoutMs = soTimeout;
lastSuccessRate = 0;
this.connState = connState;
}
/**
* Get the last recorded connection state
* @return the internal state
*/
public ConnState getLastConnState(){
return connState;
}
/**
* Update the connection state. This method is typically called when a state change is observed from a client.
* @param connState
*/
private void setConnState(ConnState connState){
this.connState = connState;
}
/**
* Update the connection state. This method is typically called when a state change is observed from a client.
* @param connState
* @param debugMsg A debug message for the connection state
*/
public void setConnState(ConnState connState, String debugMsg){
setConnState(connState.debug(debugMsg));
}
/**
* Re-validate the internal connection status.
* Invalid statuses transition to the expired state. This has the effect of cancelling subsequent probe requests.
* @return an update to the current state
*/
private ConnState incr(){
if(incrNumProbes && incrTimeout){
incrNumProbes = false;
incrTimeout = false;
connState = connState.incr();
}
return connState;
}
/**
* Validate timeout re-adjustments in the current state
* @return an update to the current state
*/
private ConnState incrTimeout(){
incrTimeout = true;
return incr();
}
/**
* Validate re-adjustments of the number of probes in the current state
* @return an update to the current state
*/
private ConnState incrNumProbes(){
incrNumProbes = true;
return incr();
}
/**
* Get the configured/reference SO_TIMEOUT value
* @return the configured timeout value
*/
public int getConfiguredSoTimeoutMs(){
return configuredSoTimeoutMs;
}
/**
* Get the current SO_TIMEOUT value.
* This value is continuously re-adjusted internally for graceful retries.
* @return the timeout value in milliseconds
*/
public int getCurSoTimeoutMs(){
if(curSoTimeoutMs > 0){
if(connState.equals(ConnState.CONN_EXPIRED)){
return 0;
}else if(!connState.equals(ConnState.CONN_COMPLETE)){
curSoTimeoutMs = Math.max(MIN_PROBES, configuredSoTimeoutMs / INITIAL_BACKOFF_REDUCTION);
}else{
incrTimeout();
curSoTimeoutMs = (curSoTimeoutMs + INITIAL_BACKOFF_REDUCTION) % configuredSoTimeoutMs;
}
}
return curSoTimeoutMs;
}
/**
* (Re-)set the reference SO_TIMEOUT value
* @param timeoutMs
*/
public void setConfiguredSoTimeoutMs(int timeoutMs){
configuredSoTimeoutMs = curSoTimeoutMs = timeoutMs;
}
/**
* Get the number of probes for the next retry.
* This value is continuously re-adjusted internally for graceful retries.
* @return the number of probes for the next retry, or 0 if no more retries should be attempted.
*/
public int getNumProbes(){
if(connState.equals(ConnState.CONN_EXPIRED)){
return 0;
}else if(!connState.equals(ConnState.CONN_COMPLETE)){
maxProbes = Math.max(MIN_PROBES, configuredMaxProbes / INITIAL_BACKOFF_REDUCTION);
}else{
incrNumProbes();
maxProbes = (maxProbes + INITIAL_BACKOFF_REDUCTION) % configuredMaxProbes;
}
return maxProbes;
}
/**
* (Re-)set the reference MAX value for the number of probes
* @param numProbes
*/
public void setConfiguredMaxProbes(int numProbes){
configuredMaxProbes = maxProbes = numProbes;
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/utils/net_protocols/AddressConversions.java
package edu.unt.nslab.butshuti.bluetoothvpn.utils.net_protocols;
import java.util.Arrays;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.NumberUtils;
/**
* Created by butshuti on 5/21/18.
*/
public class AddressConversions {
public static final short BD_ADDR_SIZE = 6;
public static class InvalidBluetoothAdddressException extends Exception{
public InvalidBluetoothAdddressException(String msg){
super(msg);
}
public InvalidBluetoothAdddressException(Exception e){
super(e);
}
}
public static byte[] stringToBDAddr(String addr) throws InvalidBluetoothAdddressException{
byte[] ret;
String toks[];
if(addr == null){
throw new InvalidBluetoothAdddressException("Malformed BD_ADDR: " + addr);
}
toks = addr.split(":");
if(toks.length != BD_ADDR_SIZE){
throw new InvalidBluetoothAdddressException("Malformed BD_ADDR: " + addr);
}
ret = new byte[BD_ADDR_SIZE];
for(int offs = 0; offs < BD_ADDR_SIZE; offs++){
try{
short val = (short)Math.abs(Short.valueOf(toks[offs], 16));
ret[offs] = (byte)(val & 0x0FF);
}catch (NumberFormatException e){
throw new InvalidBluetoothAdddressException(e);
}
}
return ret;
}
public static String BDAddrToStr(byte addr[]) throws InvalidBluetoothAdddressException{
if(addr == null || addr.length != BD_ADDR_SIZE){
throw new InvalidBluetoothAdddressException("Invalid BDAddr: " + addr == null ? "NULL" : Arrays.toString(addr));
}
StringBuilder sb = new StringBuilder(NumberUtils.byteToHexStr(addr[0]));
for(int i=1; i<BD_ADDR_SIZE; i++){
sb.append(":");
sb.append(NumberUtils.byteToHexStr(addr[i]));
}
return sb.toString();
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/custom_views/TwoColumnsTaggedTextView.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.Nullable;
import android.support.v4.content.res.ResourcesCompat;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
/**
* Created by butshuti on 9/15/18.
*/
public class TwoColumnsTaggedTextView extends LinearLayout {
private TextView titleTextView, contentTextView;
public TwoColumnsTaggedTextView(Context context) {
super(context);
}
public TwoColumnsTaggedTextView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
applyCustomAttributes(context,attrs);
}
public TwoColumnsTaggedTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
applyCustomAttributes(context,attrs);
}
public TwoColumnsTaggedTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
applyCustomAttributes(context,attrs);
}
private void applyCustomAttributes(Context context, AttributeSet attrs) {
titleTextView = new TextView(context);
contentTextView = new TextView(context);
TypedArray a = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.TwoColumnsTaggedTextView,
0, 0);
try {
String title = a.getString(R.styleable.TwoColumnsTaggedTextView_column_title);
String content = a.getString(R.styleable.TwoColumnsTaggedTextView_column_content);
titleTextView.setText(title);
contentTextView.setText(content);
titleTextView.setTextSize(10);
titleTextView.setPadding(0, 0, 2, 0);
setOrientation(HORIZONTAL);
//setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.app_gradient_background, null));
addView(titleTextView);
addView(contentTextView);
} finally {
a.recycle();
}
}
public void setText(String txt){
if(contentTextView != null){
contentTextView.setText(txt);
}
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/templates/ToolbarFrameActivity.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui.templates;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
import edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views.CustomSearchView;
public abstract class ToolbarFrameActivity extends AppCompatActivity {
private QuerySaver querySaver = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.default_screen);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportFragmentManager().beginTransaction().replace(R.id.frame, getMainFragment()).commit();
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
protected void enableSearchInterface(CustomSearchView.SearchViewListener searchViewListener){
CustomSearchView searchView = findViewById(R.id.search_view);
FloatingActionButton refreshFab = findViewById(R.id.refresh_fab);
searchView.setVisibility(View.VISIBLE);
refreshFab.setVisibility(View.VISIBLE);
searchView.registerSearchHandler(searchViewListener);
refreshFab.setOnClickListener(view -> searchViewListener.refreshLastQuery());
querySaver = query -> searchView.setQueryText(query);
}
protected void saveQuery(String query){
if(query != null && querySaver != null){
querySaver.saveQuery(query);
}
}
public abstract Fragment getMainFragment();
private interface QuerySaver{
void saveQuery(String query);
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/fragments/SettingsFragment.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui.fragments;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.support.v7.preference.PreferenceManager;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
public final class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
private SharedPreferences settings;
public SettingsFragment(){
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.settings);
settings = PreferenceManager.getDefaultSharedPreferences(getContext());
}
@Override
public void onResume() {
super.onResume();
getPreferenceScreen().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onPause() {
super.onPause();
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
SharedPreferences.Editor editor = settings.edit();
if(key.equals(getString(R.string.pref_key_enable_passive_mode))){
editor = editBoolean(editor, sharedPreferences, key);
}else if(key.equals(getString(R.string.pref_key_enable_client_mode))){
editor = editBoolean(editor, sharedPreferences, key);
}else if(key.equals(getString(R.string.pref_key_num_active_connections))){
editor = editString(editor, sharedPreferences, key, "-1");
}else if(key.equals(getString(R.string.pref_key_install_default_routes))){
editor = editBoolean(editor, sharedPreferences, key);
}else if(key.equals(getString(R.string.pref_key_routing_mode))){
editor = editString(editor, sharedPreferences, key, "UNKNOWN");
}
editor.apply();
}
private SharedPreferences.Editor editBoolean(SharedPreferences.Editor editor, SharedPreferences pref, String key){
Boolean prefValue = pref.getBoolean(key, false);
return editor.putBoolean(key, prefValue);
}
private SharedPreferences.Editor editInt(SharedPreferences.Editor editor, SharedPreferences pref, String key, int defaultValue){
int prefValue = pref.getInt(key, defaultValue);
return editor.putInt(key, prefValue);
}
private SharedPreferences.Editor editString(SharedPreferences.Editor editor, SharedPreferences pref, String key, String defaultValue){
String prefValue = pref.getString(key, defaultValue);
return editor.putString(key, prefValue);
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/tunnel/VPNFDController.java
package edu.unt.nslab.butshuti.bluetoothvpn.tunnel;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.Logger;
/**
* Created by butshuti on 5/17/18.
*/
public class VPNFDController {
private ParcelFileDescriptor fd;
private InterfaceController interfaceController;
private int mtu;
private final Queue<byte[]> inputQueue;
private final Lock inputQueueLock = new ReentrantLock();
private boolean active = false;
private long in = 0, out = 0, loopCounter = 0, startTs;
private Thread readerThread, writerThread;
public VPNFDController(ParcelFileDescriptor fd, InterfaceController interfaceController, int mtu){
this.fd = fd;
this.interfaceController = interfaceController;
this.mtu = mtu;
inputQueue = new LinkedList<>();
readerThread = createReader(new FileInputStream(fd.getFileDescriptor()));
readerThread.setDaemon(true);
readerThread.setName("VPN_fd_thread::reader");
readerThread.setPriority(Thread.MAX_PRIORITY);
writerThread = createWriter(new FileOutputStream(fd.getFileDescriptor()));
writerThread.setDaemon(true);
writerThread.setName("VPN_fd_thread::writer");
writerThread.setPriority(Thread.MAX_PRIORITY);
startTs = SystemClock.uptimeMillis();
}
public boolean isActive(){
return active
&& readerThread.isAlive() && !readerThread.isInterrupted()
&& writerThread.isAlive() && !writerThread.isInterrupted();
}
public void start(){
readerThread.start();
writerThread.start();
}
public boolean deliver(byte pkt[]){
if(pkt == null){
return false;
}
boolean ret = false;
try {
if(inputQueueLock.tryLock(300, TimeUnit.MILLISECONDS)){
ret = inputQueue.offer(pkt);
inputQueueLock.unlock();
}
} catch (InterruptedException e) {
Logger.logE(e.getMessage());
}
return ret;
}
public void terminate(){
interfaceController.deactivate();
readerThread.interrupt();
writerThread.interrupt();
if(fd != null){
try {
fd.close();
fd = null;
} catch (IOException e) {
Logger.logE(e.getMessage());
}
}
active = false;
}
private Thread createWriter(FileOutputStream fos){
return new Thread(){
@Override
public void run(){
byte buf[] = new byte[mtu];
Logger.logI("VPN_fd_thread starting... interface active()?/"+interfaceController.isActive());
while (interfaceController.isActive()){
active = true;
loopCounter++;
if( (in + out) % 5000 <= 2){
//printStats();
}
byte pkt[] = null;
if(inputQueueLock.tryLock()) {
if (inputQueue.peek() != null) {
pkt = inputQueue.poll();
}
inputQueueLock.unlock();
}
if(pkt != null){
try {
fos.write(pkt);
fos.flush();
in++;
} catch (IOException e) {
Logger.logE(e.getMessage());
break;
}
}
}
active = false;
Logger.logI("VPN_fd_thread terminating... ");
}
};
}
private Thread createReader(FileInputStream fis){
return new Thread(){
@Override
public void run(){
byte buf[] = new byte[mtu];
Logger.logI("VPN_fd_thread: reader starting... interface active()?/"+interfaceController.isActive());
while (interfaceController.isActive()){
active = true;
loopCounter++;
if( (in + out) % 5000 <= 2){
//printStats();
}
try {
int len = fis.read(buf);
if(len > 0){
byte data[] = new byte[len];
System.arraycopy(buf, 0, data, 0, len);
interfaceController.send(data, false);
out++;
}
} catch (IOException e) {
Logger.logE(e.getMessage());
terminate();
}
}
active = false;
Logger.logI("VPN_fd_thread: reader terminating... ");
}
};
}
private void printStats(){
long tsDiff = (SystemClock.uptimeMillis() - startTs)/1000;
if(tsDiff == 0){
return;
}
Logger.logE(String.format("freq: %d/s, IN: %d pkts/s, OUT: %d pkts/s, inQueueSize: %d", loopCounter/tsDiff, in/tsDiff, out/tsDiff, inputQueue.size()));
}
public boolean isAlive() {
return readerThread.isAlive() && writerThread.isAlive();
}
public void join() throws InterruptedException {
readerThread.join();
writerThread.join();
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/datagram/WireInterface.java
package edu.unt.nslab.butshuti.bluetoothvpn.datagram;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.Logger;
import static edu.unt.nslab.butshuti.bluetoothvpn.utils.net_protocols.AddressConversions.BD_ADDR_SIZE;
/**
* Created by butshuti on 1/3/18.
*/
public abstract class WireInterface {
/**
* Preamble format:
* ______________________________________
* | | | | |
* |----------------------------------
* 0 | Protocl | TTL | pkt_size |
* |----------------------------------
* 4 | Source BD_ADDR |
* < -----------------
* 8 | | |
* |------------------ >
* 12 | Destination BD_ADDR |
* |----------------------------------
* 16 | Preamble XOR |
* -- |---------------------------------|
*/
public final static int PREAMBLE_SIZE = 20;
private final byte staticPreambleByteArr[] = new byte[PREAMBLE_SIZE];
private byte savedPreamble[] = null;
protected abstract int read(byte buffer[], int max) throws IOException;
public final synchronized Packet readMultipartNext() throws IOException {
int size;
byte preamble[];
if(savedPreamble != null){
preamble = savedPreamble;
size = preamble.length;
}else{
preamble = staticPreambleByteArr;
size = read(preamble, PREAMBLE_SIZE);
}
if(size == PREAMBLE_SIZE){
ByteBuffer byteBuffer = ByteBuffer.wrap(preamble);
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
byte protocol = byteBuffer.get();
byte ttl = byteBuffer.get();
short pktSize = byteBuffer.getShort();
byte srcBDAddr[] = new byte[BD_ADDR_SIZE];
byte dstBDAddr[] = new byte[BD_ADDR_SIZE];
byteBuffer.get(srcBDAddr, 0, BD_ADDR_SIZE);
byteBuffer.get(dstBDAddr, 0, BD_ADDR_SIZE);
short preambleXor = byteBuffer.getShort();
short dataXor = byteBuffer.getShort();
if (pktSize <= 0 || preambleXor != calcPktPreambleXor(preamble)) {
IOException e = new IOException(String.format("Invalid or corrupted preamble: expected %d, got %d; sz=%d / [%s]", preambleXor, calcPktPreambleXor(preamble), pktSize, Arrays.toString(preamble)));
Logger.logE(e.getMessage());
throw e;
}
byte data[] = new byte[pktSize];
int embeddedSize = read(data, pktSize);
if(embeddedSize == pktSize && dataXor == calcBufXor(data, pktSize)){
savedPreamble = null;
return new Packet(protocol, ttl, srcBDAddr, dstBDAddr, data);
}else if(embeddedSize == 0){
//Not enough data available, save preamble for next read.
savedPreamble = preamble;
}else{
Logger.logE("Read packet does not match preamble");
}
}
return null;
}
public final static byte[] toBytes(Packet pkt){
if(pkt != null){
byte ret[] = new byte[pkt.getData().length + PREAMBLE_SIZE];
ByteBuffer byteBuffer = ByteBuffer.wrap(ret);
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
byteBuffer.put(pkt.getProtocol());
byteBuffer.put(pkt.getTtl());
byteBuffer.putShort((short)pkt.getData().length);
byteBuffer.put(pkt.getSrcBDAddr(), 0, BD_ADDR_SIZE);
byteBuffer.put(pkt.getDstBDAddr(), 0, BD_ADDR_SIZE);
short preXor = calcPktPreambleXor(ret);
short dataXor = calcBufXor(pkt.getData(), pkt.getData().length);
byteBuffer.putShort(preXor);
byteBuffer.putShort(dataXor);
byteBuffer.put(pkt.getData(), 0, pkt.getData().length);
return ret;
}
return new byte[]{};
}
private final static short calcPktPreambleXor(byte buf[]){
return calcBufXor(buf, PREAMBLE_SIZE - 4);
}
private final static short calcBufXor(byte buf[], int size){
if(buf == null || buf.length < size){
return -1;
}
short ret = 0;
int offs;
for(offs = 0; offs < size/4; offs++){
int cur = offs * 4;
ret ^= ((byte) (buf[cur] & 0xFF)) ^ ((byte) (buf[cur+1] & 0xFF))
^ ((byte) (buf[cur+2] & 0xFF)) ^ ((byte) (buf[cur+3] & 0xFF));
}
for(int cur = offs * 4; cur < size; cur++){
ret ^= ((byte) (buf[cur] & 0xFF));
}
return ret;
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/data/objects/ReachabilityTestResult.java
package edu.unt.nslab.butshuti.bluetoothvpn.data.objects;
import com.google.common.net.InetAddresses;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.Logger;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.measurement.CDF;
import static edu.unt.nslab.butshuti.bluetoothvpn.data.objects.ReachabilityTestResult.DiscoveryMode.UNSPECIFIED;
/**
* ReachabilityTestResult is a container for service discovery results.
*
* @author butshuti
*/
public class ReachabilityTestResult {
private static final String PARAM_SERVICE_ADDR = "svc_addr";
private static final String PARAM_RTT = "rtt";
private static final String PARAM_CONFIGURED_TIMEOUT = "cfg_timeout";
private static final String PARAM_FAILURE_REASON = "failure_reason";
private static final String PARAM_SESS_ID = "sess_id";
private static final String PARAM_NUM_PROBES = "num_probes";
private static final String PARAM_PROBE_RTTS = "probeRTTs";
private static final String PARAM_NUM_ATTEMPTS = "num_attemps";
private static final String PARAM_DURATION_SECONDS = "duration_seconds";
private static final String PARAM_NUM_REQUESTED_PROBES = "num_requested_probes";
private static final String PARAM_DISCOVERY_MODE = "probe_protocol";
private static final String PARAM_NUM_HOPS = "num_hops";
private static final String PARAM_PKT_SIZE = "pkt_size";
private InetAddress serviceAddr, localAddr, broadcastAddr;
private long sessId;
private long sdStart;
private int configuredTimeout;
private int numHops;
private int packet_size;
private int numRequestedProbes, numAttempts, durationSeconds;
private long cumulRTT;
private DiscoveryMode discoveryMode;
private List<Integer> probeRTTs;
private String[] route;
private Status status = Status.NONE;
private static InetAddress NULL_ADDR = InetAddress.getLoopbackAddress();
public final static ReachabilityTestResult EMPTY_SD = emptySD();
public enum Status {
NONE("Operation not started"),
PENDING("Operation in progress"),
SUCCESSFUL("Operation successful"),
FAILED("Operation failed"),
CANCELLED("Operation cancelled");
private String expl;
Status(String expl){
this.expl = expl;
}
public String getExpl(){return expl;}
}
public enum DiscoveryMode{
ECHO, ICMP, UNSPECIFIED
}
public boolean isEmpty(){
return sessId == 0 || NULL_ADDR.equals(serviceAddr) || NULL_ADDR.equals(broadcastAddr);
}
/**
* Return an empty/uninitialized SD
* @return
*/
public static ReachabilityTestResult emptySD (){
return new ReachabilityTestResult(0, NULL_ADDR, NULL_ADDR, NULL_ADDR, 0, -1);
}
/**
* Record the last known status as 'cancelled'
* @return the target instance
*/
public ReachabilityTestResult setCancelled(DiscoveryMode discoveryMode){
status = Status.CANCELLED;
this.discoveryMode = discoveryMode;
return this;
}
/**
* Record the last known status as 'failed'
* @return the target instance
*/
public ReachabilityTestResult setFailed(DiscoveryMode discoveryMode, int packetSize, int numHops){
status = Status.FAILED;
this.discoveryMode = discoveryMode;
this.packet_size = packetSize;
this.numHops = numHops;
return this;
}
/**
* Record the last known status as 'completed'
* @return the target instance
*/
public ReachabilityTestResult setCompleted(DiscoveryMode discoveryMode, int packetSize, int numHops){
status = Status.SUCCESSFUL;
this.discoveryMode = discoveryMode;
this.packet_size = packetSize;
this.numHops = numHops;
return this;
}
public void recordTimeOut(){
recordRTT(configuredTimeout);
}
/**
* Record the RTT for the current probe
* @param rtt
*/
private void recordRTT(int rtt){
if(probeRTTs.size() < numRequestedProbes) {
probeRTTs.add(rtt);
cumulRTT += rtt;
}
}
/**
* Record the SD task duration
* @param numAttempts duration in number of attempts
* @param durationSeconds duration in number of seconds elapsed
*/
public void recordElapsedTime(int numAttempts, int durationSeconds){
this.numAttempts = numAttempts;
this.durationSeconds = durationSeconds;
}
public ReachabilityTestResult recordRoute(List<String> route){
if(route != null){
numHops = ((1 + route.size()) / 2) - 1;
this.route = new String[route.size()];
route.toArray(this.route);
}
return this;
}
public boolean isCancelled(){return status.equals(Status.CANCELLED);}
public String getDiscoveryMode(){
return discoveryMode.name();
}
public int getNumHops(){
return (route != null && route.length > 0) ? ((route.length + 1)/2) - 1 : numHops;
}
public String[] getRoute(){
return route;
}
public Status getStatus(){return status;}
/**
* @return the number of probes done for the discovery.
*/
public int getNumProbes() {
return probeRTTs.size();
}
/**
* Return the configured so_timeout
* @return
*/
public long getConfiguredTimeout(){
return configuredTimeout;
}
/**
* Return the number of requested probes
* @return
*/
public int getNumRequestedProbes(){
return numRequestedProbes;
}
/**
*
* @return The current session ID
*/
public long getSessId() {
return sessId;
}
/**
*
* @return The broadcast address for the service
*/
public InetAddress getBroadcastAddr() {
return broadcastAddr;
}
/**
*
* @return The local address used in the probes
*/
public InetAddress getLocalAddr() {
return localAddr;
}
/**
*
* @return The discovered service address
*/
public InetAddress getServiceAddr() {
return serviceAddr;
}
/**
* Initializes parameters for a new session discovery.
* @param sess_id The session ID
* @param local_addr The local address
* @param service_addr The service address
* @param broadcast_addr The broadcast address
*/
public ReachabilityTestResult(long sess_id, InetAddress local_addr, InetAddress service_addr, InetAddress broadcast_addr, int configuredTimeout, int numRequestedProbes){
sessId = sess_id;
localAddr = local_addr;
serviceAddr = service_addr;
broadcastAddr = broadcast_addr;
this.numRequestedProbes = numRequestedProbes;
this.probeRTTs = new ArrayList<>();
cumulRTT = 0;
this.configuredTimeout = configuredTimeout;
durationSeconds = 0;
numAttempts = 0;
sdStart = -1;
numHops = -1;
packet_size = -1;
discoveryMode = UNSPECIFIED;
}
/**
*
* @return The average RTT of all probes in the discovery
*/
public float getAvgRTT(){
int numProbes = getNumProbes();
if(numProbes == 0){
return -1;
}
return Math.round(100*cumulRTT/numProbes)/100.0f;
}
public int getPacketSize(){
return packet_size;
}
/**
* Get the recorded SD task duration in number of attempts
* @return the number of attempts/retries
*/
public int getNumAttempts(){
return numAttempts;
}
/**
* Get the recorded SD task duration in seconds
* @return the number of seconds since the first attempt
*/
public int getDurationSeconds(){
return durationSeconds;
}
/**
* Return a CDFDiagram of the recorded probe RTTs.
* @return
*/
public CDF getCDF(float resolution){
float values[] = new float[probeRTTs.size()];
for(int i=0; i<probeRTTs.size(); i++){
values[i] = probeRTTs.get(i).floatValue();
}
return new CDF(values, resolution);
}
/**
* Updates an {@link ReachabilityTestResult instance} with new parameters.
* @param arg The instance to update
* @param sessID The new session ID
* @param rtt The new RTT
* @param serviceAddr The new Service address
* @return An updated version of the argument
*/
public static ReachabilityTestResult update(ReachabilityTestResult arg, long sessID, int rtt, InetAddress serviceAddr){
if(sessID != arg.sessId || !serviceAddr.equals(arg.serviceAddr)){
return emptySD();
}
long curTimeSeconds = System.nanoTime() / 1000000000;
if(arg.sdStart < 0){
arg.sdStart = curTimeSeconds;
}
arg.durationSeconds = (int)(curTimeSeconds - arg.sdStart);
arg.recordRTT(rtt);
arg.status = Status.PENDING;
return arg;
}
/**
* Deserialize a ReachabilityTestResult object from a json-formatted string
* @param s a json-formatted string
* @return the parsed object, or NULL_SD if unsuccessful
*/
public static ReachabilityTestResult fromString(String s){
try {
JSONObject obj = new JSONObject(s);
long sessID = obj.getLong(PARAM_SESS_ID);
int configuredTimeout = Float.valueOf(obj.getString(PARAM_CONFIGURED_TIMEOUT)).intValue();
String svcAddressStr = obj.getString(PARAM_SERVICE_ADDR);
int numProbes = Integer.valueOf(obj.getInt(PARAM_NUM_PROBES));
JSONArray probeRTTArr = obj.getJSONArray(PARAM_PROBE_RTTS);
List<Integer> probeRTTs = new ArrayList<>();
if(numProbes == probeRTTArr.length()){
for(int i=0; i<numProbes; i++){
probeRTTs.add(Float.valueOf(String.valueOf(probeRTTArr.get(i))).intValue());
}
}
int numAttempts = Integer.valueOf(obj.getInt(PARAM_NUM_ATTEMPTS));
int durationSeconds = Integer.valueOf(obj.getInt(PARAM_DURATION_SECONDS));
int numRequestedProbes = Integer.valueOf(obj.getInt(PARAM_NUM_REQUESTED_PROBES));
int numHops = Integer.valueOf(obj.getInt(PARAM_NUM_HOPS));
int pktSize = Integer.valueOf(obj.getInt(PARAM_PKT_SIZE));
String discoveryMode = obj.getString(PARAM_DISCOVERY_MODE);
Status status = Status.valueOf(obj.getString(PARAM_FAILURE_REASON));
InetAddress svcAddress = NULL_ADDR;
try{
svcAddress = InetAddresses.forString(svcAddressStr);
}catch (IllegalArgumentException e){
Logger.logE(e.getLocalizedMessage());
}
ReachabilityTestResult ret = new ReachabilityTestResult(sessID, NULL_ADDR, svcAddress, NULL_ADDR, configuredTimeout, numRequestedProbes);
for(int i=0; i<probeRTTs.size(); i++){
ret.recordRTT(probeRTTs.get(i));
}
ret.status = status;
ret.numAttempts = numAttempts;
ret.durationSeconds = durationSeconds;
ret.numHops = numHops;
ret.packet_size = pktSize;
try{
ret.discoveryMode = DiscoveryMode.valueOf(discoveryMode);
}catch (IllegalArgumentException e){
}
return ret;
} catch (JSONException | IllegalArgumentException e) {
Logger.logE(e.getLocalizedMessage());
}
return emptySD();
}
/**
* Serialize to a json-formatted string
* @return a json-formatted string
*/
public String toJSONString(){
JSONObject ret = new JSONObject();
try {
ret.put(PARAM_NUM_PROBES, getNumProbes());
ret.put(PARAM_PROBE_RTTS, new JSONArray(probeRTTs));
ret.put(PARAM_NUM_ATTEMPTS, getNumAttempts());
ret.put(PARAM_DURATION_SECONDS, getDurationSeconds());
ret.put(PARAM_NUM_REQUESTED_PROBES, getNumRequestedProbes());
ret.put(PARAM_SERVICE_ADDR, String.valueOf(serviceAddr == null ? NULL_ADDR.getHostAddress() : serviceAddr.getHostAddress()));
ret.put(PARAM_CONFIGURED_TIMEOUT, String.valueOf(configuredTimeout));
ret.put(PARAM_FAILURE_REASON, status.name());
ret.put(PARAM_SESS_ID, getSessId());
ret.put(PARAM_DISCOVERY_MODE, getDiscoveryMode());
ret.put(PARAM_NUM_HOPS, getNumHops());
ret.put(PARAM_PKT_SIZE, getPacketSize());
} catch (JSONException | IllegalArgumentException e) {
Logger.logE(e.getLocalizedMessage());
}
return ret.toString();
}
}<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/fragments/NetworkStatusFragment.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui.fragments;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.Collection;
import java.util.List;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
import edu.unt.nslab.butshuti.bluetoothvpn.data.objects.Peer;
import edu.unt.nslab.butshuti.bluetoothvpn.data.objects.ServiceStatusWrapper;
import edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views.NodeStatusCardView;
import edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views.ServiceStatusCardView;
import edu.unt.nslab.butshuti.bluetoothvpn.data.view_models.PeersListViewModel;
import edu.unt.nslab.butshuti.bluetoothvpn.data.view_models.ServiceStatusViewModel;
public class NetworkStatusFragment extends Fragment implements Observer{
private ServiceStatusCardView localNodeStatusView;
public NetworkStatusFragment() {
// Required empty public constructor
}
public static NetworkStatusFragment newInstance() {
NetworkStatusFragment fragment = new NetworkStatusFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.network_status_fragment, container, false);
localNodeStatusView = view.findViewById(R.id.local_node_status_view);
return view;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
PeersListViewModel peersListViewModel = ViewModelProviders.of(getActivity()).get(PeersListViewModel.class);
ServiceStatusViewModel serviceStatusViewModel = ViewModelProviders.of(getActivity()).get(ServiceStatusViewModel.class);
peersListViewModel.getPeers().observe(this, this);
serviceStatusViewModel.getServiceStatus().observe(this, this);
}
@Override
public void onDetach() {
super.onDetach();
}
private void updatePeers(@NonNull List<Peer> peers) {
GridLayout gridLayout = getView().findViewById(R.id.grid);
gridLayout.removeAllViews();
for(Peer peer : peers){
NodeStatusCardView cardView = (NodeStatusCardView) getLayoutInflater().inflate(R.layout.peer_node_status_view, gridLayout, false);
cardView.update(peer);
gridLayout.addView(cardView);
}
localNodeStatusView.setPeerCount(peers.size());
}
private void updateLocalNodeStatus(@NonNull ServiceStatusWrapper statusDescription){
List<Peer> peers = statusDescription.getClients();
localNodeStatusView.update(statusDescription.describe());
localNodeStatusView.setPeerCount(peers.size());
localNodeStatusView.setPktCount((int)statusDescription.getPktCount());
}
@Override
public void onChanged(@Nullable Object o) {
if(o == null){
return;
}
if(o instanceof Collection && !((List)o).isEmpty() && ((List)o).get(0) instanceof Peer){
updatePeers((List)o);
}else if(o instanceof ServiceStatusWrapper){
updateLocalNodeStatus((ServiceStatusWrapper)o);
}
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/data/objects/ServiceStatusWrapper.java
package edu.unt.nslab.butshuti.bluetoothvpn.data.objects;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public final class ServiceStatusWrapper {
private long pktCount;
private long uptime;
private String interfaceAddress;
private String hostName;
private boolean serviceActive;
private Set<Peer> servers;
private Set<Peer> clients;
private Peer.Status status;
public ServiceStatusWrapper(){
servers = new HashSet<>();
clients = new HashSet<>();
pktCount = 0;
uptime = 0;
interfaceAddress = InetAddress.getLoopbackAddress().getHostAddress();
hostName = InetAddress.getLoopbackAddress().getHostName();
status = Peer.Status.DISCONNECTED;
serviceActive = false;
}
public void setStatus(Peer.Status st){
status = st;
}
public Peer describe(){
return new Peer(hostName, interfaceAddress != null ? interfaceAddress : "Not available", status);
}
public List<Peer> getClients(){
List<Peer> ret = new ArrayList<>();
ret.addAll(clients);
return ret;
}
public List<Peer> getServers(){
List<Peer> ret = new ArrayList<>();
ret.addAll(servers);
return ret;
}
public List<Peer> getPeers(){
List<Peer> ret = new ArrayList<>();
ret.addAll(clients);
ret.addAll(servers);
return ret;
}
public long getPktCount(){
return pktCount;
}
public ServiceStatusWrapper setServiceActive(boolean active){
serviceActive = active;
return this;
}
public void setPktCount(long pktCount) {
this.pktCount = pktCount;
}
public void setUptime(long uptime) {
this.uptime = uptime;
}
public void setInterfaceAddress(String interfaceAddress) {
this.interfaceAddress = interfaceAddress;
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
public void setServers(Set<Peer> servers) {
this.servers = servers;
}
public void setClients(Set<Peer> clients) {
if(this.clients != null){
this.clients.addAll(clients);
}else{
this.clients = clients;
}
}
}
<file_sep>/settings.gradle
include ':bluetooth_vpn'
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/discovery/SDConfig.java
package edu.unt.nslab.butshuti.bluetoothvpn.discovery;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.SharedPreferences;
import org.json.JSONException;
import org.json.JSONObject;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.Logger;
import static android.preference.PreferenceManager.getDefaultSharedPreferences;
/**
* Created by butshuti on 9/8/18.
*/
public class SDConfig {
public static final String CONFIGURED_PEER_SSID = "CONFIGURED_PEER_SSID";
public static final String CONFIGURED_PEER_SHARED_KEY = "CONFIGURED_PEER_SHARED_KEY";
public static final String CONFIGURED_PEER_NAME = "NAME";
public static final String SELF_BT_SSID = "LOCAL_BT_ADDR";
public String getDefaultRoutingMode() {
return defaultRoutingMode;
}
private boolean clientModeEnabled, serverModeEnabled, defaultRoutesEnabled;
private int maxNumServers;
private String defaultRoutingMode;
Context ctx;
public SDConfig(Context applicationCtx){
ctx = applicationCtx;
refreshNetConfing();
}
public boolean isClientModeEnabled() {
return clientModeEnabled;
}
public boolean isServerModeEnabled() {
return serverModeEnabled;
}
public boolean isDefaultRoutesEnabled() {
return defaultRoutesEnabled;
}
public int getMaxNumServers() {
return maxNumServers;
}
public String getFriendlyName(BluetoothDevice device){
if(device != null){
if(device.getAddress().equals(getConfiguredPeerSSID())){
return getConfiguredPeerName();
}
return device.getName() != null ? device.getName() : device.getAddress();
}
return "Unnamed device";
}
public String getConfiguredPeerSSID() {
SharedPreferences sharedPref = getDefaultSharedPreferences(ctx);
return sharedPref.getString(CONFIGURED_PEER_SSID, "");
}
public String getConfiguredPeerName() {
SharedPreferences sharedPref = getDefaultSharedPreferences(ctx);
return sharedPref.getString(CONFIGURED_PEER_NAME, getConfiguredPeerSSID());
}
public void resetConfiguredPeer(){
SharedPreferences sharedPref = getDefaultSharedPreferences(ctx);
sharedPref.edit().remove(CONFIGURED_PEER_SSID).commit();
}
public String getConfiguredLocalNetDevID() {
SharedPreferences sharedPref = getDefaultSharedPreferences(ctx);
return sharedPref.getString(SELF_BT_SSID, null);
}
public void setConfiguredLocalNetDevID(String localBDAddr) {
SharedPreferences sharedPref = getDefaultSharedPreferences(ctx);
sharedPref.edit().putString(SELF_BT_SSID, localBDAddr).commit();
}
public void applyConfig(JSONObject config) {
Logger.logI("new_config: " + config);
String devAddress = null, devName = null;
try {
devAddress = config.getString(CONFIGURED_PEER_SSID);
devName = config.getString(CONFIGURED_PEER_NAME);
} catch (JSONException e) {
Logger.logE(e.getMessage());
}
SharedPreferences.Editor editor = getDefaultSharedPreferences(ctx).edit();
if(devAddress != null){
editor.putString(CONFIGURED_PEER_SSID, devAddress);
}
if(devName != null){
editor.putString(CONFIGURED_PEER_NAME, devName);
}
editor.commit();
}
public boolean verifyConfiguredNetDevID(String address, String name) {
return address != null && address.equals(getConfiguredPeerSSID());
}
public static JSONObject bundleDescr(String devName, String devAddress){
try {
JSONObject obj = new JSONObject();
obj.put(CONFIGURED_PEER_SSID, devAddress);
obj.put(CONFIGURED_PEER_NAME, devName != null ? devName : devAddress);
obj.put(CONFIGURED_PEER_SHARED_KEY, "");
return obj;
} catch (Exception e) {
return null;
}
}
public void refreshNetConfing(){
SharedPreferences sharedPref = getDefaultSharedPreferences(ctx);
try{
clientModeEnabled = sharedPref.getBoolean(ctx.getString(R.string.pref_key_enable_client_mode), false);
serverModeEnabled = sharedPref.getBoolean(ctx.getString(R.string.pref_key_enable_passive_mode), false);
defaultRoutesEnabled = sharedPref.getBoolean(ctx.getString(R.string.pref_key_install_default_routes), false);
defaultRoutingMode = sharedPref.getString(ctx.getString(R.string.pref_key_routing_mode), "----");
maxNumServers = Integer.valueOf(sharedPref.getString(ctx.getString(R.string.pref_key_num_active_connections), "-1"));
}catch (RuntimeException e){
Logger.logE(e.getMessage());
}
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/sockets/ClientBluetoothSocketAdaptor.java
package edu.unt.nslab.butshuti.bluetoothvpn.sockets;
import android.bluetooth.BluetoothSocket;
import java.io.IOException;
import java.net.InetAddress;
import edu.unt.nslab.butshuti.bluetoothvpn.tunnel.InterfaceController;
import edu.unt.nslab.butshuti.bluetoothvpn.tunnel.LocalInterfaceBridge;
import edu.unt.nslab.butshuti.bluetoothvpn.tunnel.RemoteInterfaceAdaptor;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.Logger;
/**
* Created by butshuti on 5/17/18.
*
* A client implementation of the {@link RemoteInterfaceAdaptor}.
* Client adaptors are basic in the fact that they maintain a connection to exactly one server at a time.
* That means exactly one socket, one local bridge.
*/
public class ClientBluetoothSocketAdaptor extends RemoteInterfaceAdaptor{
private BluetoothSocketWrappers.ClientSocket clientSocket;
private Connection connectionPipe;
public ClientBluetoothSocketAdaptor(BluetoothSocketWrappers.ClientSocket socket, InterfaceController interfaceController){
super(interfaceController);
clientSocket = socket;
}
@Override
public void startAdaptor() throws RemoteInterfaceException {
BluetoothSocket btSocket;
clearLastException();
try{
{
btSocket = clientSocket.newConnectedSocket();
}
try {
if(!LocalInterfaceBridge.isInitialized()) {
LocalInterfaceBridge.reset();
LocalInterfaceBridge.initialize(InetAddress.getByName(getInterfaceController().getLocalInterfaceAddress()));
}
} catch (IOException e) {
throw new RemoteInterfaceException(e);
}
try{
reportNewConnection(clientSocket.getRemoteDevice().getAddress());
connectionPipe = new Connection(btSocket, this);
LocalInterfaceBridge.addGateway(btSocket.getRemoteDevice().getAddress());
connectionPipe.start();
}catch (Exception e) {
setLastException(new Exception(String.format("Failed to connect to %s: %s", clientSocket.getRemoteDevice(), e.getMessage())));
LocalInterfaceBridge.deleteGateway(btSocket.getRemoteDevice().getAddress());
Logger.logE(e.getMessage());
if(btSocket != null){
try {
btSocket.close();
} catch (IOException e1) {
Logger.logE(e.getMessage());
}
}
throw new RemoteInterfaceException(e.getMessage());
}
}catch (IOException e) {
Exception customException = new Exception("Failed to connect to " + clientSocket.getRemoteDevice() + ": " + e.getMessage());
Logger.logE(customException.getMessage());
setLastException(customException);
notifySocketException(clientSocket.getRemoteDevice().getAddress());
}
}
/**
* Start the adaptor.
*/
@Override
public void stopAdaptor() {
try {
clientSocket.close();
} catch (IOException e) {
}
if(connectionPipe != null){
connectionPipe.interrupt();
}
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/custom_views/CustomSearchView.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views;
import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.LinearLayoutCompat;
import android.util.AttributeSet;
import android.widget.Button;
import android.widget.EditText;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
import static android.view.KeyEvent.KEYCODE_ENTER;
public class CustomSearchView extends LinearLayoutCompat {
public CustomSearchView(Context context) {
super(context);
}
public CustomSearchView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomSearchView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void registerSearchHandler(SearchViewListener listener){
Button button = findViewById(R.id.search_button);
EditText searchText = findViewById(R.id.search_text);
if(button != null && searchText != null){
SearchqueryValidator handler = new SearchqueryValidator() {
@Override
public void handleSearchQuery() {
String query = searchText.getText().toString();
if(!listener.onQuerySubmitted(query)){
searchText.setTextColor(Color.RED);
}
}
};
int textColor = searchText.getCurrentTextColor();
searchText.setOnKeyListener((v, keyCode, event) -> {
searchText.setTextColor(textColor);
return false;
});
searchText.setImeActionLabel("SUBMIT", KEYCODE_ENTER);
searchText.setOnEditorActionListener((v, actionId, event) -> {
if(event != null){
handler.handleSearchQuery();
return true;
}
return false;
});
button.setOnClickListener(v -> {
handler.handleSearchQuery();
});
}
}
public void setQueryText(String text){
EditText searchText = findViewById(R.id.search_text);
if(searchText != null){
searchText.setText(text);
}
}
public interface SearchViewListener{
boolean onQuerySubmitted(String query);
void refreshLastQuery();
}
private interface SearchqueryValidator{
void handleSearchQuery();
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/iptools/sdquery/EchoDataParcel.java
package edu.unt.nslab.butshuti.bluetoothvpn.iptools.sdquery;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.Logger;
/**
* Created by butshuti on 9/10/18.
*
*/
final class EchoDataParcel {
static final int MAX_SIZE = 256;
long cookie;
String dataStr;
EchoDataParcel(long cookie, String dataStr) {
this.cookie = cookie;
String cookieStr = String.valueOf(cookie);
this.dataStr = dataStr.substring(0, Math.min(dataStr.length(), MAX_SIZE - cookieStr.length()));
}
long getSessionCookie() {
return cookie;
}
String getDataStr() {
return dataStr;
}
byte[] toBytes() {
return (String.valueOf(cookie) + ";" + (dataStr == null ? "-" : dataStr)).getBytes();
}
static EchoDataParcel fromBytes(byte[] arg, int len) {
if (arg != null) {
String toks[] = new String(arg, 0, len).split(";");
if (toks.length == 2) {
try {
return new EchoDataParcel(Long.valueOf(toks[0]), toks[1]);
} catch (NumberFormatException e) {
Logger.logE(e.getMessage());
}
}
}
return new EchoDataParcel(0, "");
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/vpn/BTVpnService.java
package edu.unt.nslab.butshuti.bluetoothvpn.vpn;
import android.content.Intent;
import android.net.VpnService;
import edu.unt.nslab.butshuti.bluetoothvpn.tunnel.VPNFDController;
public class BTVpnService extends VpnService {
public static BTVpnService instance = null;
private VPNFDController vpnfdController;
@Override
public void onCreate() {
super.onCreate();
instance =this;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId){
prepare();
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
super.onDestroy();
}
private void prepare(){
vpnfdController = ((BTVPNApplication)getApplication()).prepare(new Builder());
}
public static BTVpnService getInstance(){
return instance;
}
public boolean isActive(){
return vpnfdController != null;
}
@Override
public void onRevoke(){
if(vpnfdController != null){
vpnfdController.terminate();
}
stopSelf();
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/custom_views/NodeStatusCardView.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.util.AttributeSet;
import android.widget.TextView;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
import edu.unt.nslab.butshuti.bluetoothvpn.data.objects.Peer;
public class NodeStatusCardView extends CardView implements ClickableView{
public NodeStatusCardView(Context context) {
super(context);
}
public NodeStatusCardView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NodeStatusCardView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void update(@NonNull Peer peer){
((TextView)findViewById(R.id.node_name_textview)).setText(peer.getHostName());
((TextView)findViewById(R.id.node_ip_textview)).setText(peer.getHostAddress());
if(peer.getStatus().equals(Peer.Status.CONNECTED)){
findViewById(R.id.node_icon).setBackgroundResource(R.drawable.oval_success_background);
}else if(peer.getStatus().equals(Peer.Status.CONNECTING)){
findViewById(R.id.node_icon).setBackgroundResource(R.drawable.oval_background);
}else {
findViewById(R.id.node_icon).setBackgroundResource(R.drawable.oval_error_background);
}
}
@Override
public String getSelectedText(){
return String.valueOf(((TextView)findViewById(R.id.node_ip_textview)).getText());
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/utils/net_protocols/InternetLayerHeaders.java
package edu.unt.nslab.butshuti.bluetoothvpn.utils.net_protocols;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* Created by butshuti on 5/21/18.
*/
public class InternetLayerHeaders {
public static final int MIN_IP_PACKET_SIZE = 20;
public static class InvalidDatagramException extends Exception{
public InvalidDatagramException(String msg){
super(msg);
}
public InvalidDatagramException(Exception e){
super(e);
}
}
public static class AddressHeaders{
InetAddress from, to;
public InetAddress getFrom() {
return from;
}
public InetAddress getTo() {
return to;
}
private AddressHeaders(InetAddress from, InetAddress to){
this.from = from;
this.to = to;
}
}
public static AddressHeaders parseInetAddr(byte buf[]) throws InvalidDatagramException {
if(buf.length > MIN_IP_PACKET_SIZE){
try{
InetAddress from = InetAddress.getByAddress(new byte[]{buf[12], buf[13], buf[14], buf[15]});
InetAddress to = InetAddress.getByAddress(new byte[]{buf[16], buf[17], buf[18], buf[19]});
return new AddressHeaders(from, to);
}catch (UnknownHostException e){
throw new InvalidDatagramException(e);
}
}
throw new InvalidDatagramException("Invalid IP pkt: length: " + buf.length);
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/BluetoothVPNActivity.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import edu.unt.nslab.butshuti.bluetoothvpn.R;
import edu.unt.nslab.butshuti.bluetoothvpn.data.view_models.Repository;
import edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views.ClickableView;
import edu.unt.nslab.butshuti.bluetoothvpn.ui.fragments.ConnectivityGraphFragment;
import edu.unt.nslab.butshuti.bluetoothvpn.ui.fragments.NetworkStatusFragment;
import edu.unt.nslab.butshuti.bluetoothvpn.utils.Logger;
import edu.unt.nslab.butshuti.bluetoothvpn.vpn.BTVPNApplication;
import edu.unt.nslab.butshuti.bluetoothvpn.vpn.BTVpnService;
import static edu.unt.nslab.butshuti.bluetoothvpn.ui.PingTestActivity.ACTION_PING_TEST;
import static edu.unt.nslab.butshuti.bluetoothvpn.ui.PingTestActivity.EXTRA_KEY_HOSTNAME;
import static edu.unt.nslab.butshuti.bluetoothvpn.vpn.BTVPNApplication.BT_VPN_SERVICE_STARTED;
/**
* Created by butshuti on 5/17/18.
*/
public class BluetoothVPNActivity extends AppCompatActivity{
public static final int CONFIGURE_PEERS_REQUEST_CODE = 0x77;
public static final int CONFIGURE_NETWORK = 0x55;
public static final int VPN_START_REQUEST_CODE = 0x88;
private BTVpnService vpnService = null;
private FloatingActionButton configFab, activateVpnFab;
private ViewPager viewPager;
private TabLayout tabs;
private TabPageAdapter pagerAdapter;
private DrawerLayout drawerLayout;
private NavigationView navigationView;
private BroadcastReceiver broadcastReceiver;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.network_diagnostics_screen);
broadcastReceiver = createServiceStatusListener();
viewPager = findViewById(R.id.pager);
tabs = findViewById(R.id.tabs);
pagerAdapter = new TabPageAdapter(getSupportFragmentManager(), viewPager);
navigationView = findViewById(R.id.diagnostics_screen_navigation_view);
drawerLayout = findViewById(R.id.drawer_layout);
viewPager.setAdapter(pagerAdapter);
tabs.setupWithViewPager(viewPager);
configFab = findViewById(R.id.config_fab);
activateVpnFab = findViewById(R.id.activate_vpn_fab);
prepareToolbar();
registerViewClickHandlers();
}
@Override
public void onResume(){
super.onResume();
}
@Override
protected void onStart() {
super.onStart();
registerReceiver(broadcastReceiver, new IntentFilter(BT_VPN_SERVICE_STARTED));
startVPNService();
}
@Override
protected void onStop() {
super.onStop();
if(vpnService != null){
Repository.instance().removeDataSource(((BTVPNApplication)getApplication()).getServiceStatusWrapper());
}
unregisterReceiver(broadcastReceiver);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent){
if(requestCode == VPN_START_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
startService(new Intent(this, BTVpnService.class));
activateVpnFab.setVisibility(View.INVISIBLE);
}else{
stopService(new Intent(this, BTVpnService.class));
activateVpnFab.setVisibility(View.VISIBLE);
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == android.R.id.home){
drawerLayout.openDrawer(GravityCompat.START);
return true;
}
return super.onOptionsItemSelected(item);
}
private boolean startVPNService(){
Intent prepareIntent = BTVpnService.prepare(this);
if(prepareIntent != null){
startActivityForResult(prepareIntent, VPN_START_REQUEST_CODE);
}else{
startService(new Intent(this, BTVpnService.class));
}
vpnService = BTVpnService.getInstance();
return vpnService != null;
}
private void prepareToolbar(){
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionbar = getSupportActionBar();
actionbar.setDisplayHomeAsUpEnabled(true);
actionbar.setHomeAsUpIndicator(R.drawable.ic_menu);
}
public void onNodeViewClick(View view){
if(view instanceof ClickableView) {
String hostAddress = ((ClickableView) view).getSelectedText();
if(hostAddress != null){
runReachabilityTest(hostAddress);
}
}
}
private void registerViewClickHandlers(){
navigationView.setNavigationItemSelectedListener(item -> {
switch (item.getItemId()){
case R.id.nav_menu_item_ping_test:
runReachabilityTest(null);
break;
case R.id.nav_menu_item_traceroute:
runTraceroute();
break;
case R.id.nav_menu_item_routing_peers:
configurePeers();
break;
case R.id.nav_menu_item_configure_network:
launchNetworkConfiguration();
break;
}
drawerLayout.closeDrawers();
return true;
});
configFab.setOnClickListener(v -> launchNetworkConfiguration());
activateVpnFab.setOnClickListener(v -> startVPNService());
activateVpnFab.setVisibility(View.INVISIBLE);
}
private void configurePeers(){
Intent intent = new Intent();
intent.setAction(getString(R.string.action_bt_service_locator));
intent.setType("text/json");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, CONFIGURE_PEERS_REQUEST_CODE);
}
private void launchNetworkConfiguration(){
Intent intent = new Intent();
intent.setAction(getString(R.string.action_bt_service_settings));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, CONFIGURE_NETWORK);
}
private void runReachabilityTest(String hostAddress) {
Intent request = new Intent(this, PingTestActivity.class);
if(hostAddress != null){
request.setAction(ACTION_PING_TEST);
request.putExtra(EXTRA_KEY_HOSTNAME, hostAddress);
}
startActivity(request);
}
private void runTraceroute(){
}
@Override
public void onPointerCaptureChanged(boolean hasCapture) {
}
public BroadcastReceiver createServiceStatusListener() {
return new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(BT_VPN_SERVICE_STARTED.equals(action)){
vpnService = BTVpnService.getInstance();
if(vpnService != null){
Repository.instance().addDataSource(((BTVPNApplication)getApplication()).getServiceStatusWrapper());
}
}
}
};
}
private final class TabPageAdapter extends FragmentStatePagerAdapter {
private final class Tab{
Fragment fragment;
int title;
int icon;
Tab(Fragment fragment, int title, int icon){
this.fragment = fragment;
this.title = title;
this.icon = icon;
}
}
private Tab tabs[] = new Tab[]{
new Tab(NetworkStatusFragment.newInstance(), R.string.tab_name_service_status, R.drawable.network),
new Tab(ConnectivityGraphFragment.newInstance(), R.string.tab_name_connectivity_graph, R.drawable.graph)
};
public TabPageAdapter(FragmentManager supportFragmentManager, ViewPager viewPager) {
super(supportFragmentManager);
viewPager.setAdapter(this);
}
@Override
public Fragment getItem(int position) {
return tabs[position%tabs.length].fragment;
}
@Override
public int getCount() {
return tabs.length;
}
@Override
public CharSequence getPageTitle(int position) {
return getString(tabs[position].title);
}
public int getPageIcon(int position) {
return tabs[position].icon;
}
}
}<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/utils/MovingAverage.java
package edu.unt.nslab.butshuti.bluetoothvpn.utils;
/**
* Created by butshuti on 1/18/18.
*/
public class MovingAverage {
private static final int DEFAULT_WINDOW_SIZE = 10;
public final int windowSize;
private float[] values;
private double sum;
private int currentIndex;
public MovingAverage(int historyLength, float staticResetVal){
if(historyLength == 0){
historyLength = DEFAULT_WINDOW_SIZE;
}
windowSize = historyLength;
values = new float[historyLength];
resetTo(staticResetVal);
}
public MovingAverage(int historyLength) {
this(historyLength, 0);
}
private void resetTo(float val){
for (int i = 0; i < windowSize; i++) {
values[i] = val;
}
sum = val * windowSize;
currentIndex = 0;
}
public MovingAverage pushValue(float value) {
sum -= values[currentIndex];
values[currentIndex] = value;
sum += values[currentIndex];
currentIndex = (currentIndex + 1) % windowSize;
if (currentIndex == 0) {
sum = 0;
for (int i = 0; i < windowSize; i++) {
sum += values[i];
}
}
return this;
}
public float getAverage() {
return (float)(sum / windowSize);
}
}
<file_sep>/README.md
# Summary
A Bluetooth-based VPN application for Android.
BluetoothVPN allows multi-hop connectivity between Android devices using P2P routing.
It can be used for group messaging and sensor data collection when the deployment scenario requires capabilities
that a simple piconet cannot support: an arbitrary number of inter-connected peers in the network
(up to 20 devices in transitive proximity), and a wider range (when peers are scattered as relays over a large coverage area).


# How to Use
## Prerequisites
1. Dowload sources and build with `Gradle`
2. Install the `BluetoothVPN` APK on devices to connect
## Run and Connect
1. Go to Bluetooth settings to scan and pair Bluetooth peers
2. Launch the BluetoothVPN app
3. Configure device's peering mode (2 modes are available: listening and connecting mode)
4. Grant VPN permissions at the system prompt
5. For each device, configure at least one gateway
1. Select `Routing Peers` in the main menu
2. Click on a discovered peer to open a peering connection (the selected device must be configured to accept peering connections)
3. (Note that some devices can accept more than one connection)
6. Devices should reconnect to their configured peers on start from now on
7. Note the network address namespace created by the VPN (`192.168.3.11/16`): traffic to IP addresses in that range will be routed through the VPN.
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/data/objects/Peer.java
package edu.unt.nslab.butshuti.bluetoothvpn.data.objects;
public final class Peer {
public enum Status {
DISCONNECTED, CONNECTING, CONNECTED
}
private String hostName, hostAddress;
private Status status;
public Peer(String hostName, String hostAddress, Status status){
this.hostName = hostName;
this.hostAddress = hostAddress;
this.status = status;
}
public String getHostName(){
return hostName != null ? hostName : "Name not available";
}
public String getHostAddress(){
return hostAddress != null ? hostAddress : "N/A";
}
public Status getStatus(){
return status;
}
public boolean isConnected(){
return status.equals(Status.CONNECTED);
}
@Override
public boolean equals(Object other){
if(other instanceof Peer){
Peer otherPeer = (Peer)other;
if(hostName !=null && hostAddress != null){
return hostName.equals(otherPeer.hostName) && hostAddress.equals(otherPeer.hostAddress);
}else{
return hostName == otherPeer.hostName && hostAddress == otherPeer.hostAddress;
}
}
return false;
}
}
<file_sep>/bluetooth_vpn/src/main/java/edu/unt/nslab/butshuti/bluetoothvpn/ui/custom_views/ClickableView.java
package edu.unt.nslab.butshuti.bluetoothvpn.ui.custom_views;
public interface ClickableView {
String getSelectedText();
}
| 9e9e614d7f017059b327d8d8c65289eed3a4b175 | [
"Markdown",
"Java",
"Gradle"
] | 24 | Java | butshuti/bluetoothvpn | 17bfc990584710c6e0c5ddcb1ed1448fcf6a9660 | 426e645c9f146587318d8868e809a21ed0bd16fe |
refs/heads/master | <file_sep>var express = require('express');
var router = express.Router();
var path = require('path');
var request = require('request');
var cheerio = require('cheerio');
var Comment = require('../models/Comment.js');
var Article = require('../models/Article.js');
router.get('/', function(req, res) {
res.redirect('/articles');
});
router.get('/scrape', function(req, res) {
// request html
request('http://www.sneakernews.com', function(error, response, html) {
// load into cheerio
var $ = cheerio.load(html);
var titlesArray = [];
// loop though each article
$('.header-title').each(function(i, element) {
var result = {};
result.title = $(this).children('a').text();
result.link = $(this).children('a').attr('href');
//no empty titles or links
if(result.title !== "" && result.link !== ""){
//check for duplicates
if(titlesArray.indexOf(result.title) == -1){
titlesArray.push(result.title);
// only add the article if is not already there
Article.count({ title: result.title}, function (err, test){
//if the test is 0, the entry is unique and good to save
if(test == 0){
//create new Article
var entry = new Article (result);
//save entry to mongodb
entry.save(function(err, doc) {
if (err) {
console.log(err);
} else {
console.log(doc);
}
});
}
});
}
else{
console.log('Article already exists.')
}
}
else{
console.log('Not saved to DB, missing data')
}
});
// after scrape, redirects to index
res.redirect('/');
});
});
//get every article for DOM
router.get('/articles', function(req, res) {
//sort by newest
Article.find().sort({_id: -1})
//send to handlebars
.exec(function(err, doc) {
if(err){
console.log(err);
} else{
var artcl = {article: doc};
res.render('index', artcl);
}
});
});
// To json
router.get('/articles-json', function(req, res) {
Article.find({}, function(err, doc) {
if (err) {
console.log(err);
} else {
res.json(doc);
}
});
});
router.get('/remove', function(req, res) {
Article.remove({}, function(err, doc) {
if (err) {
console.log(err);
} else {
console.log('removed all articles');
}
});
res.redirect('/articles-json');
});
router.get('/readArticle/:id', function(req, res){
var articleId = req.params.id;
var hbsObj = {
article: [],
body: []
};
Article.findOne({ _id: articleId })
.populate('comment')
.exec(function(err, doc){
if(err){
console.log('Error: ' + err);
} else {
hbsObj.article = doc;
var link = doc.link;
request(link, function(error, response, html) {
var $ = cheerio.load(html);
$('#internal-pagination-data').each(function(i, element){
hbsObj.body = $(this).children('.pagination-content').children('p').eq(1).text();
//send article body and comments to article.handlebars through hbObj
console.log(hbsObj);
res.render('article', hbsObj);
//prevents loop through so it doesn't return an empty hbsObj.body
return false;
});
});
}
});
});
// Create new comment
router.post('/comment/:id', function(req, res) {
var user = req.body.name;
var content = req.body.comment;
var articleId = req.params.id;
var commentObj = {
name: user,
body: content
};
//create new Comment model
var newComment = new Comment(commentObj);
newComment.save(function(err, doc) {
if (err) {
console.log(err);
} else {
console.log(doc._id)
console.log(articleId)
Article.findOneAndUpdate({ "_id": req.params.id }, {$push: {'comment':doc._id}}, {new: true})
//execute everything
.exec(function(err, doc) {
if (err) {
console.log(err);
} else {
res.redirect('/readArticle/' + articleId);
}
});
}
});
});
module.exports = router; | 1001f608fd3fff4be8dac06fd1a7ae96182ebf0f | [
"JavaScript"
] | 1 | JavaScript | MatthewANguyen/News-Scrape | ad8b1a45881ff976b175a5b24600817973d9e9e3 | fbbe8339941bc0371968d0c85e33dfb279510024 |
refs/heads/master | <file_sep>var data = {
attrs: {
class: 'item enabled'
},
year: [
{value: 1900, text: '1900年' },
{value: 1901, text: '1901年' },
{value: 1902, text: '1902年' },
{value: 1903, text: '1903年' },
{value: 1904, text: '1904年' },
{value: 1905, text: '1905年' },
{value: 1906, text: '1906年' },
{value: 1907, text: '1907年' },
{value: 1908, text: '1908年' },
{value: 1909, text: '1909年' },
{value: 1910, text: '1910年' },
{value: 1911, text: '1911年' },
{value: 1912, text: '1912年' },
{value: 1913, text: '1913年' },
{value: 1914, text: '1914年' },
{value: 1915, text: '1915年' },
{value: 1916, text: '1916年' },
{value: 1917, text: '1917年' },
{value: 1918, text: '1918年' },
{value: 1919, text: '1919年' },
{value: 1920, text: '1920年' },
{value: 1921, text: '1921年' },
{value: 1922, text: '1922年' },
{value: 1923, text: '1923年' },
{value: 1924, text: '1924年' },
{value: 1925, text: '1925年' },
{value: 1926, text: '1926年' },
{value: 1927, text: '1927年' },
{value: 1928, text: '1928年' },
{value: 1929, text: '1929年' },
{value: 1930, text: '1930年' },
{value: 1931, text: '1931年' },
{value: 1932, text: '1932年' },
{value: 1933, text: '1933年' },
{value: 1934, text: '1934年' },
{value: 1935, text: '1935年' },
{value: 1936, text: '1936年' },
{value: 1937, text: '1937年' },
{value: 1938, text: '1938年' },
{value: 1939, text: '1939年' },
{value: 1940, text: '1940年' },
{value: 1941, text: '1941年' },
{value: 1942, text: '1942年' },
{value: 1943, text: '1943年' },
{value: 1944, text: '1944年' },
{value: 1945, text: '1945年' },
{value: 1946, text: '1946年' },
{value: 1947, text: '1947年' },
{value: 1948, text: '1948年' },
{value: 1949, text: '1949年' },
{value: 1950, text: '1950年' },
{value: 1951, text: '1951年' },
{value: 1952, text: '1952年' },
{value: 1953, text: '1953年' },
{value: 1954, text: '1954年' },
{value: 1955, text: '1955年' },
{value: 1956, text: '1956年' },
{value: 1957, text: '1957年' },
{value: 1958, text: '1958年' },
{value: 1959, text: '1959年' },
{value: 1960, text: '1960年' },
{value: 1961, text: '1961年' },
{value: 1962, text: '1962年' },
{value: 1963, text: '1963年' },
{value: 1964, text: '1964年' },
{value: 1965, text: '1965年' },
{value: 1966, text: '1966年' },
{value: 1967, text: '1967年' },
{value: 1968, text: '1968年' },
{value: 1969, text: '1969年' },
{value: 1970, text: '1970年' },
{value: 1971, text: '1971年' },
{value: 1972, text: '1972年' },
{value: 1973, text: '1973年' },
{value: 1974, text: '1974年' },
{value: 1975, text: '1975年' },
{value: 1976, text: '1976年' },
{value: 1977, text: '1977年' },
{value: 1978, text: '1978年' },
{value: 1979, text: '1979年' },
{value: 1980, text: '1980年' },
{value: 1981, text: '1981年' },
{value: 1982, text: '1982年' },
{value: 1983, text: '1983年' },
{value: 1984, text: '1984年' },
{value: 1985, text: '1985年' },
{value: 1986, text: '1986年' },
{value: 1987, text: '1987年' },
{value: 1988, text: '1988年' },
{value: 1989, text: '1989年' },
{value: 1990, text: '1990年' },
{value: 1991, text: '1991年' },
{value: 1992, text: '1992年' },
{value: 1993, text: '1993年' },
{value: 1994, text: '1994年' },
{value: 1995, text: '1995年' },
{value: 1996, text: '1996年' },
{value: 1997, text: '1997年' },
{value: 1998, text: '1998年' },
{value: 1999, text: '1999年' },
{value: 2000, text: '2000年' },
{value: 2001, text: '2001年' },
{value: 2002, text: '2002年' },
{value: 2003, text: '2003年' },
{value: 2004, text: '2004年' },
{value: 2005, text: '2005年' },
{value: 2006, text: '2006年' },
{value: 2007, text: '2007年' },
{value: 2008, text: '2008年' },
{value: 2009, text: '2009年' },
{value: 2010, text: '2010年' },
{value: 2011, text: '2011年' },
{value: 2012, text: '2012年' },
{value: 2013, text: '2013年' },
{value: 2014, text: '2014年' },
{value: 2015, text: '2015年' },
{value: 2016, text: '2016年' },
{value: 2017, text: '2017年' },
{value: 2018, text: '2018年' },
{value: 2019, text: '2019年' },
{value: 2020, text: '2020年' },
{value: 2021, text: '2021年' },
{value: 2022, text: '2022年' },
{value: 2023, text: '2023年' },
{value: 2024, text: '2024年' },
{value: 2025, text: '2025年' },
{value: 2026, text: '2026年' },
{value: 2027, text: '2027年' },
{value: 2028, text: '2028年' },
{value: 2029, text: '2029年' },
{value: 2030, text: '2030年' },
{value: 2031, text: '2031年' },
{value: 2032, text: '2032年' },
{value: 2033, text: '2033年' },
{value: 2034, text: '2034年' },
{value: 2035, text: '2035年' },
{value: 2036, text: '2036年' },
{value: 2037, text: '2037年' },
{value: 2038, text: '2038年' },
{value: 2039, text: '2039年' },
{value: 2040, text: '2040年' },
{value: 2041, text: '2041年' },
{value: 2042, text: '2042年' },
{value: 2043, text: '2043年' },
{value: 2044, text: '2044年' },
{value: 2045, text: '2045年' },
{value: 2046, text: '2046年' },
{value: 2047, text: '2047年' },
{value: 2048, text: '2048年' },
{value: 2049, text: '2049年' },
{value: 2050, text: '2050年' }
],
month: [
{value: 1, text: '1月' },
{value: 2, text: '2月' },
{value: 3, text: '3月' },
{value: 4, text: '4月' },
{value: 5, text: '5月' },
{value: 6, text: '6月' },
{value: 7, text: '7月' },
{value: 8, text: '8月' },
{value: 9, text: '9月' },
{value: 10, text: '10月' },
{value: 11, text: '11月' },
{value: 12, text: '12月' }
],
day: [
{value: 1, text: '1日' },
{value: 2, text: '2日' },
{value: 3, text: '3日' },
{value: 4, text: '4日' },
{value: 5, text: '5日' },
{value: 6, text: '6日' },
{value: 7, text: '7日' },
{value: 8, text: '8日' },
{value: 9, text: '9日' },
{value: 10, text: '10日' },
{value: 11, text: '11日' },
{value: 12, text: '12日' },
{value: 13, text: '13日' },
{value: 14, text: '14日' },
{value: 15, text: '15日' },
{value: 16, text: '16日' },
{value: 17, text: '17日' },
{value: 18, text: '18日' },
{value: 19, text: '19日' },
{value: 20, text: '20日' },
{value: 21, text: '21日' },
{value: 22, text: '22日' },
{value: 23, text: '23日' },
{value: 24, text: '24日' },
{value: 25, text: '25日' },
{value: 26, text: '26日' },
{value: 27, text: '27日' },
{value: 28, text: '28日' },
{value: 29, text: '29日' },
{value: 30, text: '30日' },
{value: 31, text: '31日' }
],
week: [
{'data-value': 1,text: '星期一<br>Mon.'},
{'data-value': 2,text: '星期二<br>Tues.'},
{'data-value': 3,text: '星期三<br>Wed.'},
{'data-value': 4,text: '星期四<br>Thur.'},
{'data-value': 5,text: '星期五<br>Fri.'},
{'data-value': 6,text: '星期六<br>Sat.'},
{'data-value': 7,text: '星期日<br>Sun.'}
],
days: [
{'data-value': 1, text: 1 },
{'data-value': 2, text: 2 },
{'data-value': 3, text: 3 },
{'data-value': 4, text: 4 },
{'data-value': 5, text: 5 },
{'data-value': 6, text: 6 },
{'data-value': 7, text: 7 },
{'data-value': 8, text: 8 },
{'data-value': 9, text: 9 },
{'data-value': 10, text: 10 },
{'data-value': 11, text: 11 },
{'data-value': 12, text: 12 },
{'data-value': 13, text: 13 },
{'data-value': 14, text: 14 },
{'data-value': 15, text: 15 },
{'data-value': 16, text: 16 },
{'data-value': 17, text: 17 },
{'data-value': 18, text: 18 },
{'data-value': 19, text: 19 },
{'data-value': 20, text: 20 },
{'data-value': 21, text: 21 },
{'data-value': 22, text: 22 },
{'data-value': 23, text: 23 },
{'data-value': 24, text: 24 },
{'data-value': 25, text: 25 },
{'data-value': 26, text: 26 },
{'data-value': 27, text: 27 },
{'data-value': 28, text: 28 },
{'data-value': 29, text: 29 },
{'data-value': 30, text: 30 },
{'data-value': 31, text: 31 }
]
} | e47c27d4cc7390b19be3fe84c945cbae561214c2 | [
"JavaScript"
] | 1 | JavaScript | snjylin/calendar | 09f0bee2e26664597a46ea4b27f1d4412073806b | 6abe6d0fbdc3d596b2e4f7bdf778e5cc72cb5e0d |
refs/heads/master | <file_sep>//
// AlwaysPopupSegue.swift
// One Day
//
// Created by <NAME> on 2020-01-06.
// Copyright © 2020 <NAME>. All rights reserved.
//
import UIKit
class AlwaysPopupSegue : UIStoryboardSegue, UIAdaptivePresentationControllerDelegate
{
override init(identifier: String?, source: UIViewController, destination: UIViewController)
{
super.init(identifier: identifier, source: source, destination: destination)
destination.modalPresentationStyle = UIModalPresentationStyle.pageSheet
destination.presentationController!.delegate = self
}
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.none
}
}
<file_sep>//
// PopUpViewController.swift
// One Day
//
// Created by <NAME> on 2020-01-06.
// Copyright © 2020 <NAME>. All rights reserved.
//
import Foundation
import UIKit
import CoreData
class PopUpViewController: UIViewController{
@IBOutlet weak var startTimePicker: UIDatePicker!
@IBOutlet weak var endTimePicker: UIDatePicker!
@IBOutlet weak var AddEventTitle: UILabel!
@IBOutlet weak var nameTxtField: UITextField!
@IBOutlet weak var redBtn: UIButton!
@IBOutlet weak var orangeBtn: UIButton!
@IBOutlet weak var yellowBtn: UIButton!
@IBOutlet weak var greenBtn: UIButton!
@IBOutlet weak var tealBtn: UIButton!
@IBOutlet weak var blueBtn: UIButton!
@IBOutlet weak var indigoBtn: UIButton!
@IBOutlet weak var purpleBtn: UIButton!
var startTimeHr: Int16?
var startTimeMin: Int16?
var endTimeHr: Int16?
var endTimeMin: Int16?
var eventName: String = ""
var pieColor: UIColor = UIColor.red
var delegate: ModalDelegate?
var scheduleDelegate: ScheduleDelegate?
override func viewDidLoad() {
super.viewDidLoad()
startTimePicker.datePickerMode = UIDatePicker.Mode.time
endTimePicker.datePickerMode = UIDatePicker.Mode.time
startTimePicker.addTarget(self, action: #selector(dismissKeyboard), for: .allEvents)
//startTimePicker.addTarget(self, action: #selector(dateChangedStartTime), for: .allEvents)
endTimePicker.addTarget(self, action: #selector(dismissKeyboard), for: .allEvents)
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
view.addGestureRecognizer(tap)
nameTxtField.text = delegate?.eventnamePassbyDelegate
if delegate!.isEditPopup{
AddEventTitle.text = "Edit Event"
let dateFormatter = DateFormatter() // set locale to reliable US_POSIX
dateFormatter.dateFormat = "HH:mm"
let startDate = dateFormatter.date(from:(delegate?.selectedEventStartTime)!)
let endDate = dateFormatter.date(from:(delegate?.selectedEventEndTime)!)
startTimePicker.setDate(startDate!, animated: false)
endTimePicker.setDate(endDate!, animated: false)
}
//nameTxtField.addTarget(self, action: #selector(textFieldEditingDidChange(_:)), for: UIControl.Event.editingChanged)
}
@IBAction func saveBtn(_ sender: Any) {
readCurrentTIme()
eventName = nameTxtField.text!
// Create the dialog
if (nameTxtField.text == ""){
let alert = UIAlertController(title: "Invalid Input", message: "Please enter a name for event.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
else if (startTimeHr == endTimeHr) && (startTimeMin == endTimeMin){
let alert = UIAlertController(title: "Invalid Input", message: "Please enter valid time.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
else{
if delegate!.isEditPopup{
delegate!.deleteEventByDeletage()
}
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext = appDelegate.persistentContainer.viewContext
let entity = NSEntityDescription.entity(forEntityName: "Event", in: managedContext)!
let newEvent = NSManagedObject(entity: entity, insertInto: managedContext)
newEvent.setValue(eventName, forKey: "name")
newEvent.setValue(startTimeHr, forKey: "startTimeHr")
newEvent.setValue(startTimeMin, forKey: "startTimeMin")
newEvent.setValue(endTimeHr, forKey: "endTimeHr")
newEvent.setValue(endTimeMin, forKey: "endTimeMin")
newEvent.setValue(pieColor.redValue, forKey: "pieColorR")
newEvent.setValue(pieColor.greenValue, forKey: "pieColorG")
newEvent.setValue(pieColor.blueValue, forKey: "pieColorB")
newEvent.setValue(scheduleDelegate?.parentTitle, forKey: "parentScheduleTitle")
newEvent.setValue(scheduleDelegate?.parentDate, forKey: "parentScheduleDate")
do {
try managedContext.save()
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
dismiss(animated: true){
if let delegate = self.delegate {
delegate.load()
}
}
}
}
@IBAction func cancelBtn(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
@IBAction func redBtnPressed(_ sender: UIButton) {
dismissKeyboard()
resetBtnColors()
sender.tintColor = UIColor.systemRed.mixDarker()
pieColor = UIColor.systemRed
}
@IBAction func orangeBtnPressed(_ sender: UIButton) {
dismissKeyboard()
resetBtnColors()
sender.tintColor = UIColor.systemOrange.mixDarker()
pieColor = UIColor.systemOrange
}
@IBAction func yellowBtnPressed(_ sender: UIButton) {
dismissKeyboard()
resetBtnColors()
sender.tintColor = UIColor.systemYellow.mixDarker()
pieColor = UIColor.systemYellow
}
@IBAction func greenBtnPressed(_ sender: UIButton) {
dismissKeyboard()
resetBtnColors()
sender.tintColor = UIColor.systemGreen.mixDarker()
pieColor = UIColor.systemGreen
}
@IBAction func tealBtnPressed(_ sender: UIButton) {
resetBtnColors()
sender.tintColor = UIColor.systemTeal.mixDarker()
pieColor = UIColor.systemTeal
}
@IBAction func blueBtnPressed(_ sender: UIButton) {
resetBtnColors()
sender.tintColor = UIColor.systemBlue.mixDarker()
pieColor = UIColor.systemBlue
}
@IBAction func indigoBtnPressed(_ sender: UIButton) {
resetBtnColors()
sender.tintColor = UIColor.systemIndigo.mixDarker()
pieColor = UIColor.systemIndigo
}
@IBAction func purpleBtnPressed(_ sender: UIButton) {
resetBtnColors()
sender.tintColor = UIColor.systemPurple.mixDarker()
pieColor = UIColor.systemPurple
}
func resetBtnColors(){
redBtn.tintColor = UIColor.systemRed
orangeBtn.tintColor = UIColor.systemOrange
yellowBtn.tintColor = UIColor.systemYellow
greenBtn.tintColor = UIColor.systemGreen
tealBtn.tintColor = UIColor.systemTeal
blueBtn.tintColor = UIColor.systemBlue
indigoBtn.tintColor = UIColor.systemIndigo
purpleBtn.tintColor = UIColor.systemPurple
}
func readCurrentTIme(){
let userCalendar = Calendar.current
let requestedComponents: Set<Calendar.Component> = [.hour, .minute,]
let startTime = userCalendar.dateComponents(requestedComponents, from: startTimePicker.date)
let endTime = userCalendar.dateComponents(requestedComponents, from: endTimePicker.date)
startTimeHr = Int16(startTime.hour!)
startTimeMin = Int16(startTime.minute!)
endTimeHr = Int16(endTime.hour!)
endTimeMin = Int16(endTime.minute!)
}
@objc func dateChangedStartTime(_ sender: UIDatePicker) {
// let userCalendar = Calendar.current
// let requestedComponents: Set<Calendar.Component> = [.hour, .minute,]
// let dateTimeComponents = userCalendar.dateComponents(requestedComponents, from: sender.date)
//
// startTimeHr = Int16(dateTimeComponents.hour!)
// startTimeMin = Int16(dateTimeComponents.minute!)
//endTimePicker.minimumDate = sender.date
}
// @objc func dateChangedEndTime(_ sender: UIDatePicker) {
//
// let userCalendar = Calendar.current
// let requestedComponents: Set<Calendar.Component> = [.hour, .minute,]
// let dateTimeComponents = userCalendar.dateComponents(requestedComponents, from: sender.date)
//
// endTimeHr = Int16(dateTimeComponents.hour!)
// endTimeMin = Int16(dateTimeComponents.minute!)
// }
@objc func textFieldEditingDidChange(_ sender: UITextField) {
eventName = sender.text!
}
@objc func dismissKeyboard() {
eventName = nameTxtField.text!
view.endEditing(true)
}
}
extension UIColor {
var redValue: CGFloat{ return CIColor(color: self).red }
var greenValue: CGFloat{ return CIColor(color: self).green }
var blueValue: CGFloat{ return CIColor(color: self).blue }
var alphaValue: CGFloat{ return CIColor(color: self).alpha }
func mixLighter (amount: CGFloat = 0.4) -> UIColor {
return mixWithColor(UIColor.white, amount:amount)
}
func mixDarker (amount: CGFloat = 0.4) -> UIColor {
return mixWithColor(UIColor.black, amount:amount)
}
func mixWithColor(_ color: UIColor, amount: CGFloat = 0.25) -> UIColor {
var r1 : CGFloat = 0
var g1 : CGFloat = 0
var b1 : CGFloat = 0
var alpha1 : CGFloat = 0
var r2 : CGFloat = 0
var g2 : CGFloat = 0
var b2 : CGFloat = 0
var alpha2 : CGFloat = 0
self.getRed (&r1, green: &g1, blue: &b1, alpha: &alpha1)
color.getRed(&r2, green: &g2, blue: &b2, alpha: &alpha2)
return UIColor( red:r1*(1.0-amount)+r2*amount,
green:g1*(1.0-amount)+g2*amount,
blue:b1*(1.0-amount)+b2*amount,
alpha: alpha1 )
}
}
<file_sep>//
// AddItemsView.swift
// One Day
//
// Created by <NAME> on 2020-01-04.
// Copyright © 2020 <NAME>. All rights reserved.
//
import Foundation
import UIKit
class AddItemsView: UIView {
@IBOutlet var contentView: UIView!
@IBOutlet weak var hideBar: UIView!
@IBOutlet weak var collapseBtn: UIButton!
@IBOutlet weak var addBtn: UIButton!
@IBOutlet weak var expandBtn: UIButton!
@IBOutlet weak var eventsTable: UITableView!
let originalViewWidth:CGFloat = 350
let originalViewHeight:CGFloat = 240
let collapsedViewHeight:CGFloat = 40
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initSubviews()
}
override init(frame: CGRect) {
super.init(frame: frame)
initSubviews()
}
func initSubviews() {
// standard initialization logic
let nib = UINib(nibName: "AddItemsView", bundle: nil)
nib.instantiate(withOwner: self, options: nil)
contentView.frame = bounds
addSubview(contentView)
contentView.layer.cornerRadius = 15
}
@IBAction func CollapseBtn(_ sender: Any) {
UIView.animate(withDuration: 0.5) {
self.contentView.frame = CGRect( x: self.contentView.frame.origin.x, y: self.contentView.frame.origin.y - self.originalViewHeight + self.collapsedViewHeight, width: self.originalViewWidth, height: self.originalViewHeight)
}
collapseBtn.isHidden = false
addBtn.isHidden = false
expandBtn.isHidden = true
}
@IBAction func CloseBtn(_ sender: Any) {
UIView.animate(withDuration: 0.5) {
self.contentView.frame = CGRect( x: self.contentView.frame.origin.x, y: self.contentView.frame.origin.y + self.contentView.frame.height, width: self.originalViewWidth, height: -self.collapsedViewHeight)
}
collapseBtn.isHidden = true
addBtn.isHidden = true
expandBtn.isHidden = false
}
@IBAction func addNewEvent(_ sender: Any) {
}
}
//extension UIView{
// func roundCorners(_ corners: UIRectCorner, radius: CGFloat) {
// let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
// let mask = CAShapeLayer()
// mask.path = path.cgPath
// self.layer.mask = mask
// }
//}
<file_sep>//
// Pie.swift
// One Day
//
// Created by <NAME> on 2020-01-05.
// Copyright © 2020 <NAME>. All rights reserved.
//
import Foundation
import UIKit
class Pie: UIView{
var startTimeHr: Int16?
var radius: CGFloat?
var startAngle: CGFloat?
var endAngle: CGFloat?
var centerPoint: CGPoint?
var color: UIColor?
var name: String?
var nameLabel: UILabel?
init(frameSuper: CGRect, startTimeHr:Int16, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, centerPoint: CGPoint, color: UIColor, name: String) {
super.init(frame: frameSuper)
self.startTimeHr = startTimeHr
self.radius = radius
self.startAngle = startAngle
self.endAngle = endAngle
self.centerPoint = centerPoint
self.color = color
self.name = name
var midAngle:CGFloat = 0.0
if(endAngle < startAngle){
midAngle = ((startAngle - 360.0) + endAngle)/2.0
}
else{
midAngle = startAngle + (endAngle - startAngle)/2.0}
let labelAnglePosition = 90.0 - midAngle + 360.0
// print(name)
// print(self.frame.width)
// print(self.frame.height)
let lablePositionX = centerPoint.x + (radius*2.0/3.0) * cos(labelAnglePosition.degreesToRadians)
let lablePositionY = centerPoint.y - (radius*2.0/3.0) * sin(labelAnglePosition.degreesToRadians)
let nameLabel = UILabel(frame: CGRect(x: lablePositionX - frameSuper.width/4.0, y: lablePositionY - frameSuper.height/10.0, width: frameSuper.width/2.0, height: frameSuper.height/5.0))
nameLabel.text = name
nameLabel.textAlignment = .center
nameLabel.textColor = UIColor.white
nameLabel.font = UIFont(name: "DIN Alternate", size: 24)
self.addSubview(nameLabel)
self.backgroundColor = UIColor.clear
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func draw(_ rect: CGRect) {
color?.setFill()
let midPath = UIBezierPath()
midPath.move(to: centerPoint!)
midPath.addArc(withCenter: centerPoint!, radius: radius!, startAngle: (startAngle! - 90).degreesToRadians, endAngle: (endAngle! - 90).degreesToRadians, clockwise: true)
midPath.close()
midPath.fill()
}
}
extension CGFloat {
var degreesToRadians: Self { return self * .pi / 180.0 }
var radiansToDegrees: Self { return self * 180.0 / .pi }
}
<file_sep>//
// ListViewController.swift
// One Day
//
// Created by <NAME> on 2020-01-03.
// Copyright © 2020 <NAME>. All rights reserved.
//
import UIKit
import Foundation
import CoreData
protocol ScheduleDelegate{
var parentTitle: String?{
get
}
var parentDate: String?{
get
}
}
class DayListViewController: UITableViewController, ScheduleDelegate{
var parentTitle: String?
var parentDate: String?
var schedules: [NSManagedObject] = []
var events: [[NSManagedObject]] = [[]]
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.leftBarButtonItem! = editButtonItem
tableView.register(UINib(nibName: "MainMenuCell", bundle: nil), forCellReuseIdentifier: "MainMenuCell")
load()
if schedules.count == 0 { createNewData(title: "MY DAY") }
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
load()
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MainMenuCell") as! MainMenuCell
cell.title.text = schedules[indexPath.row].value(forKey: "title") as? String
cell.date.text = schedules[indexPath.row].value(forKey: "dateCreated") as? String
//=======
cell.thumbnail.reset()
for eventNSObj in events[indexPath.row]{
cell.thumbnail.addNewSchedule(startTimeHrParam: 0,
startTime: nsObjectToParameter(eventFromCoredata: eventNSObj).0,
endTime: nsObjectToParameter(eventFromCoredata:eventNSObj).1,
pieColor: nsObjectToParameter(eventFromCoredata: eventNSObj).2, name: "")
}
//=======
return cell
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return schedules.count
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
parentTitle = schedules[indexPath.row].value(forKey: "title") as? String
parentDate = schedules[indexPath.row].value(forKey: "dateCreated") as? String
performSegue(withIdentifier: "goToSchedule", sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let destinationVC = segue.destination as! CreateScheduleViewController
destinationVC.delegate = self
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 130
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
let scheduleToDelete = schedules[indexPath.row]
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let context: NSManagedObjectContext = appDelegate.persistentContainer.viewContext
let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "Schedule")
fetchRequest.predicate = NSPredicate(format:"(dateCreated == %@) AND (title == %@)",
scheduleToDelete.value(forKey: "dateCreated") as! String,
scheduleToDelete.value(forKey: "title") as! String
)
let fetchRequest2 = NSFetchRequest<NSManagedObject>(entityName: "Event")
fetchRequest2.predicate = NSPredicate(format:"(parentScheduleDate == %@) AND (parentScheduleTitle == %@)", scheduleToDelete.value(forKey: "dateCreated") as! String, scheduleToDelete.value(forKey: "title") as! String)
let result = try? context.fetch(fetchRequest)
let resultData = result as! [NSManagedObject]
let resultEvent = try? context.fetch(fetchRequest2)
let resultEventData = resultEvent!
for object in resultData {
context.delete(object)
}
for object in resultEventData {
context.delete(object)
}
do {
try context.save()
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
load()
// =====================================
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
@IBAction func AddBtnPressed(_ sender: UIBarButtonItem) {
let alert = UIAlertController(title: "New Schedule", message: "Enter a name for your schedule:", preferredStyle: .alert)
alert.addTextField(configurationHandler: nil)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: {alertinput -> Void in
let newTitle = alert.textFields![0].text!
if newTitle != ""{
self.createNewData(title: newTitle)
self.load()
self.tableView.reloadData()
}
}))
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
func createNewData(title: String){
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext = appDelegate.persistentContainer.viewContext
let scheduleEntity = NSEntityDescription.entity(forEntityName: "Schedule", in: managedContext)!
let defaultSchedule = NSManagedObject(entity: scheduleEntity, insertInto: managedContext)
let eventEntity = NSEntityDescription.entity(forEntityName: "Event", in: managedContext)!
let defaultEvent = NSManagedObject(entity: eventEntity, insertInto: managedContext)
defaultEvent.setValue("sleep", forKey: "name")
defaultEvent.setValue(21, forKey: "startTimeHr")
defaultEvent.setValue(30, forKey: "startTimeMin")
defaultEvent.setValue(6, forKey: "endTimeHr")
defaultEvent.setValue(30, forKey: "endTimeMin")
defaultEvent.setValue(0.0, forKey: "pieColorR")
defaultEvent.setValue(122.0/255.0, forKey: "pieColorG")
defaultEvent.setValue(1.0, forKey: "pieColorB")
defaultEvent.setValue(title, forKey: "parentScheduleTitle")
defaultSchedule.setValue(title, forKey: "title")
defaultSchedule.setValue(false, forKey: "isAlarmTurnedOn")
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "yyyy/MM/dd HH:mm"
let searchKeyword = formatter.string(from: date)
defaultSchedule.setValue(searchKeyword, forKey: "dateCreated")
defaultEvent.setValue(searchKeyword, forKey: "parentScheduleDate")
do {
try managedContext.save()
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
}
func load(){
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
events.removeAll()
let managedContext = appDelegate.persistentContainer.viewContext
let fetchRequest = NSFetchRequest<NSManagedObject>(entityName: "Schedule")
do {
schedules = try managedContext.fetch(fetchRequest)
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
let fetchRequest2 = NSFetchRequest<NSFetchRequestResult>(entityName: "Event")
for index in 0..<schedules.count {
let dateloaded = schedules[index].value(forKey: "dateCreated") as! String
let title = schedules[index].value(forKey: "title") as! String
fetchRequest2.predicate = NSPredicate(format:"(parentScheduleDate == %@) AND (parentScheduleTitle == %@)", dateloaded, title)
do {
try events.append(managedContext.fetch(fetchRequest2) as! [NSManagedObject])
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
}
tableView.reloadData()
}
func nsObjectToUsableVariable(event: NSManagedObject) -> EventData{
return EventData(name: event.value(forKey: "name") as! String,
startTimeHr: event.value(forKey: "startTimeHr") as! Int16,
startTimeMin: event.value(forKey: "startTimeMin") as! Int16,
endTimeHr: event.value(forKey: "endTimeHr") as! Int16,
endTimeMin: event.value(forKey: "endTimeMin") as! Int16,
pieColor: UIColor(
red: CGFloat(event.value(forKey: "pieColorR") as! Float),
green: CGFloat(event.value(forKey: "pieColorG") as! Float),
blue: CGFloat(event.value(forKey: "pieColorB") as! Float),
alpha: 1.0)
)
}
func nsObjectToParameter(eventFromCoredata: NSManagedObject) -> (Float, Float, UIColor){
let startTimeInFloat = Float(eventFromCoredata.value(forKey: "startTimeHr") as! Int) + Float(eventFromCoredata.value(forKey: "startTimeMin") as! Int)/60.0
let endTimeInFloat = Float(eventFromCoredata.value(forKey: "endTimeHr") as! Int) + Float(eventFromCoredata.value(forKey: "endTimeMin") as! Int)/60.0
let color = UIColor(
red: CGFloat(eventFromCoredata.value(forKey: "pieColorR") as! Float),
green: CGFloat(eventFromCoredata.value(forKey: "pieColorG") as! Float),
blue: CGFloat(eventFromCoredata.value(forKey: "pieColorB") as! Float),
alpha: 1.0)
return(startTimeInFloat, endTimeInFloat, color)
}
}
<file_sep>//
// CirclePieView.swift
// One Day
//
// Created by <NAME> on 2020-01-05.
// Copyright © 2020 <NAME>. All rights reserved.
//
import Foundation
import UIKit
class CirclePieView: UIView{
var events: [Pie] = []
var initialframe: CGRect?
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initSubviews()
}
override init(frame: CGRect) {
super.init(frame: frame)
initSubviews()
}
func initSubviews() {
// standard initialization logic
// let nib = UINib(nibName: "CirclePieView", bundle: nil)
// nib.instantiate(withOwner: self, options: nil)
initialframe = CGRect(x: 0, y: 0, width: self.frame.height, height: self.frame.height)
self.frame = initialframe!
}
func addNewSchedule(startTimeHrParam: Int16, startTime: Float, endTime: Float, pieColor: UIColor, name: String){
//self.frame = CGRect(x: 0, y: 0, width: self.frame.height, height: self.frame.height)
let newSchedule = Pie(frameSuper: initialframe!, startTimeHr: startTimeHrParam, radius: initialframe!.width/2.0, startAngle: CGFloat(360.0*startTime/24.0), endAngle: CGFloat(360.0*endTime/24.0), centerPoint: CGPoint(x: initialframe!.width/2.0, y: initialframe!.height/2.0), color: pieColor, name: name)
events.append(newSchedule)
self.addSubview(newSchedule)
}
func reset(){
events.removeAll()
for subview in subviews {
subview.removeFromSuperview()
}
}
func changeWidth(newWidth: Int){
initialframe = CGRect(x: 0, y: 0, width: newWidth, height: newWidth)
}
override func draw(_ rect: CGRect) {
let path = UIBezierPath(ovalIn: initialframe!)
UIColor(red: 246.0/255.0, green: 114.0/255.0, blue: 128.0/255.0, alpha: 1.0).setFill()
path.fill()
}
}
<file_sep>//
// CreateScheduleViewController.swift
// One Day
//
// Created by <NAME> on 2020-01-03.
// Copyright © 2020 <NAME>. All rights reserved.
//
import Foundation
import UIKit
import CoreData
protocol ModalDelegate{
func load()
func deleteEventByDeletage()
var eventnamePassbyDelegate: String? {
get
}
var isEditPopup: Bool {
get
}
var selectedEventStartTime: String? {
get
}
var selectedEventEndTime: String? {
get
}
}
class CreateScheduleViewController: UIViewController, ModalDelegate{
var delegate: ScheduleDelegate?
var eventnamePassbyDelegate: String? = ""
@IBOutlet weak var scheduleList: UIView!
@IBOutlet weak var scheduleListInner: UIView!
@IBOutlet weak var eventList: UITableView!
@IBOutlet weak var addBtn: UIButton!
@IBOutlet weak var expandBtn: UIButton!
@IBOutlet weak var collapseBtn: UIButton!
@IBOutlet weak var removeItemBtn: UIButton!
@IBOutlet weak var editBtn: UIButton!
@IBOutlet weak var titletextfield: UITextField!
@IBOutlet weak var circleView: CirclePieView!
@IBOutlet weak var clockView: UIView!
@IBOutlet weak var readings: UIImageView!
@IBOutlet weak var eventsTable: UITableView!
//constraints
@IBOutlet weak var clockviewtop: NSLayoutConstraint!
//============
var titleText:String?
var events: [NSManagedObject] = []
var eventsData: [EventData] = []
var isEditPopup = false
var currentCellFocus = 999
var colorBeforeClicked:UIColor? = nil
var isPieClicked = false
var selectedEventStartTime: String?
var selectedEventEndTime: String?
var isAlarmTurnedOn = false
@IBOutlet weak var alarmBtn: UIBarButtonItem!
var originalscheduleListHeight:CGFloat?
let collapsedscheduleListHeight:CGFloat = 40.0
override func viewDidLoad() {
super.viewDidLoad()
originalscheduleListHeight = scheduleListInner.frame.height
scheduleListInner.layer.cornerRadius = 15
eventList.delegate = self
eventList.dataSource = self
eventList.register(UINib(nibName: "eventItemCell", bundle: nil), forCellReuseIdentifier: "eventItemCell")
circleView.changeWidth(newWidth: Int(UIScreen.main.bounds.width-90.0))
eventsTable.frame = CGRect(x: eventsTable.frame.origin.x, y: eventsTable.frame.origin.y, width: UIScreen.main.bounds.width-64.0, height: eventsTable.frame.height)
load()
titleText = delegate?.parentTitle
titletextfield.addTarget(self, action: #selector(textFieldEditingDidChange(_:)), for: UIControl.Event.editingChanged)
titletextfield.addTarget(self, action: #selector(textFieldEditingDidEnd(_:)), for: UIControl.Event.editingDidEnd)
titletextfield.text = titleText
let dismisskeyboardTap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
dismisskeyboardTap.cancelsTouchesInView = false
view.addGestureRecognizer(dismisskeyboardTap)
self.circleView.addGestureRecognizer(dismisskeyboardTap)
if isAlarmTurnedOn == true{
alarmBtn.image = UIImage(systemName: "bell.slash")
}
else {
alarmBtn.image = UIImage(systemName: "bell")
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
eventsTable.frame = CGRect(x: eventsTable.frame.origin.x, y: eventsTable.frame.origin.y, width: UIScreen.main.bounds.width-64.0, height: eventsTable.frame.height)
load()
}
// MARK: button action methods
@IBAction func collapseBtnPressed(_ sender: Any) {
//clockviewtop.isActive = false
//schedulelisttop.isActive = false
//clockviewtop.isActive = false
clockView.translatesAutoresizingMaskIntoConstraints = true
scheduleListInner.translatesAutoresizingMaskIntoConstraints = true
scheduleList.translatesAutoresizingMaskIntoConstraints = true
UIView.animate(withDuration: 0.5) {
self.clockView.frame = CGRect(x: self.clockView.frame.origin.x, y: self.clockView.frame.origin.y + 80, width: self.clockView.frame.width, height: self.clockView.frame.height)
self.scheduleListInner.frame = CGRect( x: self.scheduleListInner.frame.origin.x, y: self.scheduleListInner.frame.origin.y + self.scheduleListInner.frame.height, width: self.scheduleListInner.frame.width, height: -self.collapsedscheduleListHeight)
}
collapseBtn.isHidden = true
addBtn.isHidden = true
expandBtn.isHidden = false
removeItemBtn.isHidden = true
editBtn.isHidden = true
disselectCell()
}
@IBAction func ExpandBtnPressed(_ sender: Any) {
UIView.animate(withDuration: 0.5) {
self.clockView.frame = CGRect(x: self.clockView.frame.origin.x, y: self.clockView.frame.origin.y - 80, width: self.clockView.frame.width, height: self.clockView.frame.height)
self.scheduleListInner.frame = CGRect( x: self.scheduleListInner.frame.origin.x, y: self.scheduleListInner.frame.origin.y - self.originalscheduleListHeight! + self.collapsedscheduleListHeight, width: self.scheduleListInner.frame.width, height: self.originalscheduleListHeight!)
}
collapseBtn.isHidden = false
addBtn.isHidden = false
expandBtn.isHidden = true
clockView.translatesAutoresizingMaskIntoConstraints = false
scheduleListInner.translatesAutoresizingMaskIntoConstraints = false
scheduleList.translatesAutoresizingMaskIntoConstraints = false
}
//shows popup and let user enter new event data
@IBAction func saveBtnPressed(_ sender: Any) {
let alert = UIAlertController(title: "Saved!", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: {(alert: UIAlertAction!) in self.navigationController?.popViewController(animated: true)}))
self.present(alert, animated: true, completion: nil)
}
@IBAction func alarmBtnPressed(_ sender: UIBarButtonItem) {
let center = UNUserNotificationCenter.current()
if isAlarmTurnedOn == false {
center.requestAuthorization(options: [.alert, .badge, .sound], completionHandler: { (granted, error) in
if granted {
} else {
print("Notification permissions not granted")
}
})
for event in eventsData{
let components = DateComponents(hour: Int(event.startTimeHr!), minute: Int(event.startTimeMin!)) // Set the date here when you want Notification
let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true)
let content = UNMutableNotificationContent()
content.title = titleText!
content.body = event.eventName!
content.sound = UNNotificationSound.default
let request = UNNotificationRequest(
identifier: UUID().uuidString,
content: content,
trigger: trigger
)
UNUserNotificationCenter.current().add(request) { (error : Error?) in
if let theError = error {
print(theError.localizedDescription)
}
}
}
sender.image = UIImage(systemName: "bell.slash")
let alert = UIAlertController(title: "Alarm turned on", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
isAlarmTurnedOn = true
}
else {
center.removeAllDeliveredNotifications()
center.removeAllPendingNotificationRequests()
sender.image = UIImage(systemName: "bell")
let alert = UIAlertController(title: "Alarm turned off", message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
isAlarmTurnedOn = false
}
// ===========================
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext = appDelegate.persistentContainer.viewContext
let fetchRequest = NSFetchRequest<NSManagedObject>(entityName: "Schedule")
fetchRequest.predicate = NSPredicate(format:"(dateCreated == %@) AND (title == %@)", (delegate?.parentDate)!, (delegate?.parentTitle)!)
do {
let fetchedData = try managedContext.fetch(fetchRequest)
fetchedData[0].setValue(isAlarmTurnedOn, forKey: "isAlarmTurnedOn")
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
// ===========================
}
@IBAction func AddBtnPressed(_ sender: Any) {
disselectCell()
eventnamePassbyDelegate = ""
isEditPopup = false
performSegue(withIdentifier: "addNewItem", sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let destinationVC = segue.destination as! PopUpViewController
destinationVC.delegate = self
destinationVC.scheduleDelegate = delegate
if isEditPopup{
eventnamePassbyDelegate = eventsData[currentCellFocus].eventName
}
if currentCellFocus != 999{
self.selectedEventStartTime = String(format:"%d:%d", eventsData[currentCellFocus].startTimeHr!, eventsData[currentCellFocus].startTimeMin!)
self.selectedEventEndTime = String(format:"%d:%d", eventsData[currentCellFocus].endTimeHr!, eventsData[currentCellFocus].endTimeMin!)
}
}
@IBAction func removeBtnPressed(_ sender: Any) {
if currentCellFocus != 999{
deleteEvent(eventsToDelete: eventsData[currentCellFocus])
eventsData.remove(at: currentCellFocus)
load()
}
currentCellFocus = 999
}
func deleteEventByDeletage() {
if currentCellFocus != 999{
deleteEvent(eventsToDelete: eventsData[currentCellFocus])
eventsData.remove(at: currentCellFocus)
load()
}
currentCellFocus = 999
}
@IBAction func editBtnPressed(_ sender: Any) {
disselectCell()
removeItemBtn.isHidden = true
editBtn.isHidden = true
isEditPopup = true
performSegue(withIdentifier: "addNewItem", sender: self)
}
// MARK: Coredata Methods
func load(){
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext = appDelegate.persistentContainer.viewContext
let fetchRequest = NSFetchRequest<NSManagedObject>(entityName: "Event")
fetchRequest.predicate = NSPredicate(format:"(parentScheduleDate == %@) AND (parentScheduleTitle == %@)", (delegate?.parentDate)!, (delegate?.parentTitle)!)
let fetchRequest2 = NSFetchRequest<NSManagedObject>(entityName: "Schedule")
fetchRequest2.predicate = NSPredicate(format:"(dateCreated == %@) AND (title == %@)", (delegate?.parentDate)!, (delegate?.parentTitle)!)
do {
events = try managedContext.fetch(fetchRequest)
let fetchedData = try managedContext.fetch(fetchRequest2)
isAlarmTurnedOn = fetchedData[0].value(forKey: "isAlarmTurnedOn") as? Bool ?? false
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
eventList.reloadData()
if events.count != circleView.events.count{
circleView.reset()
eventsData.removeAll()
for event in events{
let newEvent = nsObjectToUsableVariable(event: event)
eventsData.append(newEvent)
circleView.addNewSchedule(startTimeHrParam: newEvent.startTimeHr!,
startTime: nsObjectToParameter(eventFromCoredata: event).0,
endTime: nsObjectToParameter(eventFromCoredata: event).1,
pieColor: nsObjectToParameter(eventFromCoredata: event).2, name: newEvent.eventName!)
}
//sorts events in ascending order
eventsData = eventsData.sorted(by: {$0.startTimeHr! < $1.startTimeHr!})
}
//print(circleView.bounds.width)
}
func deleteEvent(eventsToDelete: EventData){
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let context: NSManagedObjectContext = appDelegate.persistentContainer.viewContext
let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "Event")
fetchRequest.predicate = NSPredicate(format:"(startTimeHr == %d) AND (startTimeMin == %d) AND (endTimeHr == %d) AND (endTimeMin == %d) AND (parentScheduleDate == %@) AND (parentScheduleTitle == %@)", eventsToDelete.startTimeHr!, eventsToDelete.startTimeMin!, eventsToDelete.endTimeHr!, eventsToDelete.endTimeMin! , (delegate?.parentDate)!, (delegate?.parentTitle)!)
let result = try? context.fetch(fetchRequest)
let resultData = result as! [NSManagedObject]
for object in resultData {
context.delete(object)
}
do {
try context.save()
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
}
}
// MARK: tableview delegate methods
extension CreateScheduleViewController: UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let event = eventsData[indexPath.row]
let cell = self.eventList.dequeueReusableCell(withIdentifier: "eventItemCell") as! EventItemCell
cell.fillContents(
piecolor: event.pieColor!,
startTimeHr: Int(event.startTimeHr!),
startTimeMin: Int(event.startTimeMin!),
endTimeHr: Int(event.endTimeHr!),
endTimeMin: Int(event.endTimeMin!),
eventName: event.eventName!)
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return events.count
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
removeItemBtn.isHidden = false
editBtn.isHidden = false
currentCellFocus = indexPath.row
if (isPieClicked == false){
for pie in circleView.events{
if (pie.startTimeHr == eventsData[currentCellFocus].startTimeHr) && (pie.name == eventsData[currentCellFocus].eventName){
colorBeforeClicked = pie.color
pie.color = pie.color?.mixDarker()
pie.setNeedsDisplay()
break
}
}
isPieClicked = true
}
}
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
//tableView.deselectRow(at: indexPath, animated: true)
for pie in circleView.events{
if (pie.startTimeHr == eventsData[currentCellFocus].startTimeHr) && (pie.name == eventsData[currentCellFocus].eventName){
pie.color = colorBeforeClicked
pie.setNeedsDisplay()
break
}
}
isPieClicked = false
}
// MARK: Outlet action methods
@objc func textFieldEditingDidChange(_ sender: UITextField) {
titleText = sender.text!
}
@objc func textFieldEditingDidEnd(_ sender: UITextField){
titleText = sender.text!
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext = appDelegate.persistentContainer.viewContext
let fetchRequest = NSFetchRequest<NSManagedObject>(entityName: "Schedule")
fetchRequest.predicate = NSPredicate(format:"(dateCreated == %@) AND (title == %@)", (delegate?.parentDate)!, (delegate?.parentTitle)!)
let fetchRequest2 = NSFetchRequest<NSManagedObject>(entityName: "Event")
fetchRequest2.predicate = NSPredicate(format:"(parentScheduleDate == %@) AND (parentScheduleTitle == %@)", (delegate?.parentDate)!, (delegate?.parentTitle)!)
do {
let fetchedData = try managedContext.fetch(fetchRequest)
fetchedData[0].setValue(titleText, forKey: "title")
let fetchedData2 = try managedContext.fetch(fetchRequest2)
for index in 0..<fetchedData2.count{
fetchedData2[index].setValue(titleText, forKey: "parentScheduleTitle")
}
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
}
@objc func dismissKeyboard() {
titleText = titletextfield.text!
view.endEditing(true)
disselectCell()
}
// MARK: helper methods
func disselectCell(){
if (currentCellFocus != 999){
eventList.deselectRow(at: [0,currentCellFocus], animated: true)
for pie in circleView.events{
if (pie.startTimeHr == eventsData[currentCellFocus].startTimeHr) && (pie.name == eventsData[currentCellFocus].eventName){
pie.color = colorBeforeClicked
pie.setNeedsDisplay()
break
}
}}
isPieClicked = false
}
func nsObjectToUsableVariable(event: NSManagedObject) -> EventData{
return EventData(name: event.value(forKey: "name") as! String,
startTimeHr: event.value(forKey: "startTimeHr") as! Int16,
startTimeMin: event.value(forKey: "startTimeMin") as! Int16,
endTimeHr: event.value(forKey: "endTimeHr") as! Int16,
endTimeMin: event.value(forKey: "endTimeMin") as! Int16,
pieColor: UIColor(
red: CGFloat(event.value(forKey: "pieColorR") as! Float),
green: CGFloat(event.value(forKey: "pieColorG") as! Float),
blue: CGFloat(event.value(forKey: "pieColorB") as! Float),
alpha: 1.0)
)
}
func nsObjectToParameter(eventFromCoredata: NSManagedObject) -> (Float, Float, UIColor){
let startTimeInFloat = Float(eventFromCoredata.value(forKey: "startTimeHr") as! Int) + Float(eventFromCoredata.value(forKey: "startTimeMin") as! Int)/60.0
let endTimeInFloat = Float(eventFromCoredata.value(forKey: "endTimeHr") as! Int) + Float(eventFromCoredata.value(forKey: "endTimeMin") as! Int)/60.0
let color = UIColor(
red: CGFloat(eventFromCoredata.value(forKey: "pieColorR") as! Float),
green: CGFloat(eventFromCoredata.value(forKey: "pieColorG") as! Float),
blue: CGFloat(eventFromCoredata.value(forKey: "pieColorB") as! Float),
alpha: 1.0)
return(startTimeInFloat, endTimeInFloat, color)
}
}
<file_sep>//
// ScheduleData.swift
// One Day
//
// Created by <NAME> on 2020-01-05.
// Copyright © 2020 <NAME>. All rights reserved.
//
import Foundation
import UIKit
class EventData {
var eventName: String?
var startTimeHr: Int16?
var startTimeMin: Int16?
var endTimeHr: Int16?
var endTimeMin: Int16?
var pieColor: UIColor?
init(name: String, startTimeHr: Int16, startTimeMin: Int16, endTimeHr: Int16, endTimeMin: Int16, pieColor: UIColor){
self.eventName = name
self.startTimeHr = startTimeHr
self.startTimeMin = startTimeMin
self.endTimeHr = endTimeHr
self.endTimeMin = endTimeMin
self.pieColor = pieColor
}
}
<file_sep># Pie planner
<div>
<img src="https://github.com/08jhs05/Pie-Planner/blob/master/piePlanner.png" width="250">
<img src="https://github.com/08jhs05/Pie-Planner/blob/master/main.png" width="250">
<img src="https://github.com/08jhs05/Pie-Planner/blob/master/Edit.png" width="250">
</div>
Pie planner is a schedule planner app with an intuitive pie chart. Users can easily add, edit, delete events on the pie chart to plan a day.
available on Apple Appstore! https://apps.apple.com/gb/app/pie-planner/id1495555553
more info:
https://sites.google.com/view/pieplanner/%ED%99%88
<file_sep>//
// MainMenuCell.swift
// One Day
//
// Created by <NAME> on 2020-01-11.
// Copyright © 2020 <NAME>. All rights reserved.
//
import Foundation
import UIKit
class MainMenuCell: UITableViewCell{
@IBOutlet weak var thumbnail: CirclePieView!
@IBOutlet weak var title: UILabel!
@IBOutlet weak var date: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}
<file_sep>//
// eventItemCell.swift
// One Day
//
// Created by <NAME> on 2020-01-06.
// Copyright © 2020 <NAME>. All rights reserved.
//
import UIKit
class EventItemCell: UITableViewCell{
@IBOutlet weak var colorBox: UIView!
@IBOutlet weak var startTime: UILabel!
@IBOutlet weak var eventName: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
func fillContents(piecolor: UIColor, startTimeHr:Int, startTimeMin:Int, endTimeHr:Int, endTimeMin:Int, eventName: String){
var timeTxt = ""
if startTimeHr<10{
timeTxt = timeTxt + "0" + String(startTimeHr)
} else {timeTxt = timeTxt + String(startTimeHr)}
if startTimeMin<10{
timeTxt = timeTxt + ":0" + String(startTimeMin)
} else {timeTxt = timeTxt + ":" + String(startTimeMin)}
timeTxt = timeTxt + " - "
if endTimeHr<10{
timeTxt = timeTxt + "0" + String(endTimeHr)
} else {timeTxt = timeTxt + String(endTimeHr)}
if endTimeMin<10{
timeTxt = timeTxt + ":0" + String(endTimeMin)
} else {timeTxt = timeTxt + ":" + String(endTimeMin)}
self.startTime.text = timeTxt
self.eventName.text = eventName
self.colorBox.backgroundColor = piecolor
}
}
| 1b240c8a12d7c9e37390bbf9559c81330a305f62 | [
"Swift",
"Markdown"
] | 11 | Swift | 99jhs05/Pie-Planner | 81670f862abb7bbc3c9ec1142bf3253096869b63 | 1257940bb44eb904e6102de13b3580424b6c4a2d |
refs/heads/master | <file_sep>#!/bin/bash
########################################################################
#
# bash(1) run commands.
#
#######################################################################
#
# bash(1) completion -- stored in different places
# <dir> bash_completion - basic script
# <dir> bash_completion.d/* - scripts for each command
# xterm(1) titles
# respect bash-doc supplementary files
# .bash_aliases
# .bash_vars(?)
# .bash_(underscore is the standard)
# .bashrc.d
# standardize color prompts (see bashrc.debian)
# parameterize aliases with --color=auto where possible
#
#
# If not running interactively, don't do anything.
#
case $- in
*i*) ;; # interactive flag set
*) return;;
esac
#
# Source global definitions
#
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
#-----------------------------------------------------------------------
#
# History
#
#-----------------------------------------------------------------------
HISTCONTROL=ignoreboth
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s histappend
#-----------------------------------------------------------------------
#
# Environment
#
#-----------------------------------------------------------------------
#
# Include system administration and user programs in path. Even
# though they are typically meant only for superuser use, some
# programs work fine and are helpful in in normal user space.
#
export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:$HOME/bin
#
# Individual program variables.
#
# Less(1) draws its input through an input filter that adds syntax
# coloring.
#
export LESS="-x4"
if [ -d "/usr/share/source-highlight" ]; then
LESS="$LESS -R"
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
fi
# Local machine development support.
export TARGET_LIBDIR=$HOME/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_LIB
# For Emacs.
export REALNAME="<NAME>"
# export COPYRIGHT="" must be defined to keep Emacs happy but
# should be defined locally.
# Identify preferred applications
export BROWSER="firefox:x-www-browser"
# Add local defintions.
[ -e ~/.bash_vars ] && source ~/.bash_vars
#-----------------------------------------------------------------------
#
# Cosmetic behavior
#
#-----------------------------------------------------------------------
#
# Read the dircolors database for the ls(1) command.
#
# This requires cpp(1) to be installed on the host, which is not often
# there (especially on production public-facing servers). So process
# the source file if it exists, but consult a statically-compiled one
# as a fallback.
#
dir_static=~/.dircolors-static
if [ -x /lib/cpp ]; then
dir_output=/tmp/dircolors.$$
/lib/cpp -E ~/.dircolors > $dir_output
eval `dircolors "$dir_output"`
cp $dir_output $dir_static
rm -f $dir_output
else
[ -e "$dir_static" ] && eval `dircolors ~/.dircolors-static`
fi
#
# Prompt strings - functions and settings
#
#-----------------------------------------------------------------------
# If the exit code of the last command is non-zero, return the exit code
# in square brackets, else return nothing. Used in the prompt string to
# conditionally print the exit code.
#
function bad_exit {
local rc=$?
if [ $rc != "0" ]; then
echo \[$rc\]
fi
}
#-----------------------------------------------------------------------
# if any of the chroot(1) environment variables are set, return the name
# of the chroot.
#
function chroot_name {
if [ -n "$SCHROOT_CHROOT_NAME" ]; then
echo -n -e " \xE2\x96\xBA"$SCHROOT_CHROOT_NAME
fi
}
#-----------------------------------------------------------------------
# Return "~" if the CWD is a subdirectory of $HOME.
#
function cwd_prefix
{
if [ $(echo ${PWD} | cut -b -${#HOME}) == "$HOME" ]; then
echo '~'
fi
}
#-----------------------------------------------------------------------
# Return the relative pathname of the current working directory,
# relative to home, or the absolute pathname of the current working
# directory if it is not $HOME-relative.
#
function cwd_strip_home
{
echo ${PWD} | sed -e "s_${HOME}__"
}
#-----------------------------------------------------------------------
# Return an ellipsis character if the CWD pathname is longer than
# $maxlen.
#
function cwd_abbr
{
local maxlen=$1
local path=$(cwd_strip_home)
if [ ${#path} -gt $maxlen ]; then
echo -n -e "/\xE2\x80\xA6" # Unicode ellipsis
fi
}
#-----------------------------------------------------------------------
# Return the rightmost ${1}-or-less characters of the CWD path after
# replacing $HOME prefix with "~", if appropriate. If the rightmost
# single path element is longer than $maxlen, return it regardless of
# length.
#
function cwd_tail
{
local maxlen=$1
local path=$(cwd_strip_home)
# if the remainder is longer than $maxlen, shorten it.
if [ ${#path} -gt $maxlen ]; then
# Tail is either $HOME-relative or absolute, but either way
# starts with "/".
#
local tail=${path}
# Strip leading path elements until the tail is either short
# enough or gone altogether.
#
while [ \( ${#tail} -gt 0 \) -a \( ${#tail} -gt $maxlen \) ]; do
tail=$(echo $tail | sed -re s_^/[^/]+__)
done
# If now gone altogether, restore the last path element no
# matter how long.
#
if [ ${#tail} -eq 0 ]; then
tail=/$(basename "$path")
fi
echo $tail
else
echo $path
fi
}
# Escape sequences for color
#
# Quick key:
# ESC is \033
# reset attributes ESC [0m
# bold ESC [1m
# italic ESC [3m
# underline ESC [4m
# ANSI color ESC [30...37m
# theme color ESC [38;5;Xm X = [0,255]
# RGB color ESC [38;2;R;G;Bm R,G,B = [0,255]
# " for bg 48
#
# TODO put these in a color scheme specific file.
col_reset="\033[1m" # reset all attributes
col_exit="\033[1m\033[38;2;255;0;0m" # nonzero exit status
col_user="\033[0m\033[38;5;30m" # 'user@host'
col_chroot="\033[1m" # name of schroot
col_path_prefix="\033[0;37m" # path prefix, e.g., ~
col_path_abbr="\033[38;2;220;240;0m" # optional abbreviation
col_path_tail="\033[38;5;243m" # path tail
col_path_prompt="$col_user" # prompt character
path_tail_len=15 # length of path tail.
#
# Here is the complexity of PS1, and of bash(1) prompt strings in general.
# The value embeds some built-in control characters, but then also
# accepts escaped terminal control sequences. These must all be
# carefully quoted and escaped.
#
# The pattern of single and double quotes is intentional and subtley
# vital. Single quotes preserve the callouts via $() so that they are
# executed at each prompt, not simply once when PS1's value is set
# below. However, enclosing the whole thing in single quotes causes the
# escape sequences that set color to be included in the string length of
# PS1's value that bash(1) uses to know when to wrap the line and do
# other line-editing tasks.
#
# PS1 begins with the prosaic user@host. If the exit status of the last
# command was non-zero, it is displayed first in brackets. If a chroot
# is in effect, the name of the chroot appears in parentheses. Then the
# CWD is presented with HOME abbreviated ~ as is customary; the tail of
# the path only is presented, and where abbreviated an ellipsis takes
# the place of omitted leading path elements. Then the
# bash(1)-determined prompt string, $ for ordinary permissions and # for
# root.
#
PS1=\
"\[${col_exit}\]"'$(bad_exit)'"\[${col_reset}\]\[${col_user}\]\u@\h"\
"\[${col_chroot}\]"'$(chroot_name)'"\[${col_reset}\]"\
"\[${col_path_prefix}\]:"'$(cwd_prefix)'\
"\[${col_path_abbr}\]"'$(cwd_abbr $path_tail_len)'\
"\[${col_path_tail}\]"'$(cwd_tail $path_tail_len)'\
"\[${col_path_prompt}\]\$\[\033[00m\] "
PS2="$(echo -e -n "\xE2\x8A\xA6") "
# Force LINES and COLUMNS reset upon window resize.
shopt -s checkwinsize
#-----------------------------------------------------------------------
#
# Aliases
#
#-----------------------------------------------------------------------
alias ls='ls -L -h --color=auto'
alias la='/bin/ls -A -h -F --color=none'
alias ll='/bin/ls -l -h -F --color=auto'
# Add any local aliases.
[ -e ~/.bash_aliases ] && source ~/.bash_aliases
# Add any final local scripts.
if [ -d ~/.bashrc.d ]; then
for f in ~/.bashrc.d/*; do
. $f
done
fi
<file_sep>#!/bin/bash
HERE=${PWD}
# Follow user's predetermined method of backups.
export VERSION_CONTROL=existing
function make_link {
ln -f -s -b "$1" "$2"
}
# Shell / Bash
echo -n "Setting up Bash and shell..."
make_link $HERE/bash/bashrc $HOME/.bashrc
make_link $HERE/bash/dircolors $HOME/.dircolors
echo "done"
# Fonts
echo -n "Setting up fonts..."
mkdir -p $HOME/.fonts
echo -n "deferring font population..."
echo "done"
# Emacs
echo -n "Setting up Emacs..."
emacs_dir=$HOME/.emacs.d
mkdir -p $emacs_dir
make_link $HERE/emacs/init.el $emacs_dir/init.el
make_link $HERE/emacs/jay $emacs_dir/jay
echo "done"
exit 0
<file_sep>#!/bin/bash
export DESKTOP_COLOR_SCHEME="dark"
<file_sep>SRC := $(wildcard ./*.el)
OBJ := $(SRC:%.el=%.elc)
.PHONY: all
all: $(OBJ)
.el.elc:
emacs --batch --eval "(byte-compile-file \"$<\")"
clean:
rm -f *.elc *~
<file_sep>#!/bin/bash
################################################
# <NAME>
# rev. 2 <NAME>
# 2013-05-02
# Based on manual instructions
# https://code.google.com/p/googlefontdirectory/
#################################################
gfdir=~/.googlefontdirectory # temporary for Google fonts
fdir=~/.fonts # X server convention for user font library
# Set up directories if they do not exist and clone the Google font
# directory locally.
#
mkdir -p $fdir
if [ ! -d $gfdir ]; then # bootstrap Mercurial
mkdir -p $gfdir
hg clone https://googlefontdirectory.googlecode.com/hg/ $gfdir > /dev/null
fi
cd "$gfdir"
hg pull $gfdir > /dev/null # Mercurial synch
# Copy into per-user font directory.
find . -iname "*.otf" -o -iname "*.ttf" -exec cp {} $fdir \;
| ac7701e9e47b899da32836a2d5eafb609019fe99 | [
"Makefile",
"Shell"
] | 5 | Shell | jaypwindley/Environment | 194cd2177cb47a96d13efc2207e0a6292dd5a56b | 33290d9e717ba79e86cc6ce3a3285fa282333d4b |
refs/heads/main | <file_sep><?php
session_start();
include 'config/koneksi.php';
$user = @$_POST['username'];
$pass = md5(@$_POST['password']);
$query=mysqli_query($conn,"select * from user where usernames='$user' and passwords='$pass'");
$jumlahdata =mysqli_num_rows($query);
if ($jumlahdata == 0 ) {
echo "<script>alert('username dan password tidak sesuai !');
window.location.href='login.php';</script>";
} else{
$data= mysqli_fetch_array($query);
// cek jika user login sebagai admin
if($data['level']=="1"){
// buat session login dan username
$_SESSION['username'] = $data['nama_user'];
$_SESSION['level'] = "Manager";
// alihkan ke halaman dashboard admin
echo "<script>alert('Login Success !');
</script>";
header("location:index.php");
// check if user is student
}else if($data['level']=="2"){
// buat session login dan username
$_SESSION['username'] = $data['nama_user'];
$_SESSION['level'] = "Student";
// alihkan ke halaman dashboard student
echo "<script>alert('Login Success !');
</script>";
header("location:index.php");
}
else if($data['level']=="3"){
// buat session login dan username
$_SESSION['username'] = $data['nama_user'];
$_SESSION['level'] = "Admin";
// alihkan ke halaman dashboard Owner
echo "<script>alert('Login Succes !');
</script>";
header("location:index.php");
}
}
?>
<meta http-equiv="refresh" content="3,URL=index.php"><file_sep><?php
date_default_timezone_set('Asia/Jakarta');
$conn = mysqli_connect
(
"localhost",
"root",
"",
"accomodation"
);
if (mysqli_connect_errno())
{
echo "Koneksi Gagal"
.mysqli_connect_error();
}
$base_url="http://localhost/accomodation/";
?><file_sep>-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 04, 2020 at 09:47 AM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.2.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
CREATE TABLE `aplikasi` (
`id_aplikasi` int(100) NOT NULL,
`full_name` varchar(100) NOT NULL,
`ic_no` varchar(100) NOT NULL,
`faculty` varchar(100) NOT NULL,
`college` varchar(100) NOT NULL,
`block` varchar(100) NOT NULL,
`rm_type` varchar(100) NOT NULL,
`status` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
INSERT INTO `aplikasi` (`id_aplikasi`, `full_name`, `ic_no`, `faculty`, `college`, `block`, `rm_type`, `status`) VALUES
(1, '<NAME>', '111222333', 'School of Engineering', '<NAME>', 'M17', 'Double', '' );
--
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id_user` int(11) NOT NULL,
`nama_user` varchar(50) NOT NULL,
`usernames` varchar(50) NOT NULL,
`passwords` varchar(50) NOT NULL,
`level` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id_user`, `nama_user`, `usernames`, `passwords`, `level`) VALUES
(9, 'manager', 'manager', 'manager', 1 ),
(10, 'admin', 'admin', 'admin', 3);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `akun`
--
--
-- Indexes for table `aplikasi`
--
ALTER TABLE `aplikasi`
ADD PRIMARY KEY (`id_aplikasi`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id_user`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `aplikasi`
--
ALTER TABLE `aplikasi`
MODIFY `id_aplikasi` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<file_sep><?php
include "config/koneksi.php";
if(isset($_GET['username'])){
$query = mysqli_query ($conn,"Select * FROM user where username='$_GET[username]'") or die (mysql_error());
$result_edit = mysqli_fetch_array($query);
}
?>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 style="color: #87B1FD" class="m-0 font-weight-bold">STUDENT ACCOMODATION APPLICATION FORM</h6>
</div>
<div class="card-body">
<div style="padding-bottom: 20px; text-align: right">
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal">Fill Form</button>
</div>
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th data-field="no" data-editable="true">No</th>
<th data-field="full_name" data-editable="true">Name</th>
<th data-field="ic_no" data-editable="true">I/C NO</th>
<th data-field="faculty" data-editable="true">Faculty</th>
<th data-field="college" data-editable="true">College</th>
<th data-field="block" data-editable="true">Block</th>
<th data-field="rm_type" data-editable="true">Room Type</th>
<th data-field="status" data-editable="true">Status</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$query = mysqli_query($conn,"SELECT * FROM aplikasi");
while ($hasil = mysqli_fetch_array($query))
{ ?>
<tr>
<td><?php echo $no++; ?></td>
<td><?php echo $hasil['full_name'];?></td>
<td><?php echo $hasil['ic_no'];?></td>
<td><?php echo $hasil['faculty'];?></td>
<td><?php echo $hasil['college'];?></td>
<td><?php echo $hasil['block'];?></td>
<td><?php echo $hasil['rm_type'];?></td>
<td><?php echo $hasil['status'];?></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Static Table Start -->
<div class="data-table-area mg-b-15">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="sparkline13-list">
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Fill Form</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form action="index.php?pages=crud&aksi=tambah-aplikasi" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label class="control-label" for="">Full Name</label>
<input type="text" name="full_name" class="form-control" id="" required>
</div>
<div class="form-group">
<label class="control-label" for="">I/C NO</label>
<input type="text" name="ic_no" class="form-control" id="" required>
</div>
<div class="form-group">
<label class="control-label" for="">Faculty</label>
<input type="text" name="faculty" class="form-control" id="" required>
</div>
<div class="form-group">
<label class="control-label" for="">College</label>
<select class="form-control"id="college" name="college" >
<option value="">Choose</option>
<option value="KRP">Kolej Rahman Putra</option>
<option value="KTF">Kolej Tun Fatimah</option>
<option value="KTR">Kolej Tun Razak</option>
<option value="KTHO">Kolej Tun Hussein Onn</option>
<option value="KTDI">Kolej Tun DR Ismail</option>
<option value="KTC">Kolej Tunku Canselor</option>
<option value="KP">Kolej Perdana</option>
<option value="K9/10">Kolej 9/10</option>
<option value="KTDI">Kolej Datin Seri Endon</option>
<option value="KDOJ">Kolej Dato Onn Jaafar</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="">Block</label>
<input type="text" name="block" class="form-control" id="" required>
</div>
<div class="form-group">
<label class="control-label" for="">Room Type</label>
<select class="form-control"id="rm_type" name="rm_type" >
<option value="">Choose</option>
<option value="Single">Single</option>
<option value="Double">Double</option>
</select>
</div>
<div class="form-group">
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-success" name="tambah">submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<file_sep><?php
include "config/koneksi.php";
$status = @$_POST['status'];
$user = @$_POST['txtuser'];
$pass = md5(@$_POST['txtpass']);
$nama = @$_POST['txtnama'];
$level = @$_POST['txtlevel'];
switch($status) {
case 'add':
$tambah = mysqli_query ($conn,"INSERT INTO user VALUES ('','$nama','$user','$pass','$level','')")or die (mysqli_error());
if ($tambah=true){
echo"<script>alert('Add Data Successful');</script>";
}else {
echo"<script>alert('Failed to Add Data');</script>";
}
break;
case 'edit':
$edit = "UPDATE admin SET usernames='$user',passwords='<PASSWORD>', nama_user='$nama', level='$level'";
$edit .="WHERE usernames='$user'";
$edit = mysqli_query($conn,$edit) or die (mysqli_error());
if ($edit=true){
echo"<script>alert('Update Data Successful');</script>";
}else {
echo"<script>alert('Failed to Update Data');</script>";
}
break;
default:
$id = @$_GET['usernames'];
$tambah = mysqli_query ($conn,"DELETE FROM user WHERE usernames ='$id'")or die (mysql_error());
if ($tambah=true){
echo"<script>alert('Delete Data Successful');</script>";
}else {
echo"<script>alert('Failed to Delete Data');</script>";
}
break;
}
?>
<meta http-equiv="refresh" content="0; url=index.php?pages=managemen-user"><file_sep><?Php if(@$_SESSION['level']=="Manager"){ ?>
<!-- Sidebar - Brand -->
<a class="text-dark sidebar-brand d-flex align-items-center justify-content-center">
<!--bikin div img logo disini-->
<div class="sidebar-brand-text mx-3" style="padding-top: 30px;">
<img src="resources/home.png" width="130px;">
</div>
</a>
<!-- Divider -->
<div style="padding-bottom: 40px;"></div>
<!-- Nav Item - Dashboard -->
<li class="nav-item active">
<a style="color: white; text-align: center; padding-right: 30px;" class="nav-link" href="index.php?pages=home-manager">
<span><strong>Main Page</strong></span>
</a>
</li>
<!-- Divider -->
<hr style="border-color: white" class="sidebar-divider my-0">
<!-- Heading -->
<li class="nav-item active">
<a style="color: white; text-align: center;" class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseUtilities" aria-expanded="true" aria-controls="collapseUtilities">
<span><strong>Transaksi</strong></span>
</a>
<div id="collapseUtilities" class="collapse" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item" href="index.php?pages=pemasukan">Pemasukan</a>
<a class="collapse-item" href="index.php?pages=pengeluaran">Pengeluaran</a>
<a class="collapse-item" href="index.php?pages=beban">Beban</a>
<a class="collapse-item" href="index.php?pages=prive">Prive</a>
<a class="collapse-item" href="index.php?pages=modal">Modal</a>
</div>
</div>
</li>
<hr style="border-color: white" class="sidebar-divider my-0">
<!-- Heading -->
<li class="nav-item active">
<a style="color: white; text-align: center;" class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#perekapan" aria-expanded="true" aria-controls="perekapan">
<span><strong>Pembukuan</strong></span>
</a>
<div id="perekapan" class="collapse" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item" href="index.php?pages=jurnalumum">Jurnal Umum</a>
<a class="collapse-item" href="index.php?pages=bukubesar">Buku Besar</a>
<a class="collapse-item" href="index.php?pages=neracasaldo">Neraca Saldo</a>
</div>
</div>
</li>
<hr style="border-color: white" class="sidebar-divider my-0">
<!-- Heading -->
<li class="nav-item active">
<a style="color: white; text-align: center;" class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsePages" aria-expanded="true" aria-controls="collapsePages">
<span><strong>Laporan</strong></span>
</a>
<div id="collapsePages" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item" href="index.php?pages=laporan-labarugi">Laba Rugi</a>
<a class="collapse-item" href="index.php?pages=laporan-neraca">Neraca</a>
<a class="collapse-item" href="index.php?pages=laporan-perubmodal">Perubahan Modal</a>
</div>
</div>
</li>
<!-- Divider -->
<hr style="border-color: white" class="sidebar-divider my-0">
<li class="nav-item active">
<a class="nav-link" style="cursor:pointer; color: white; text-align: center; padding-right: 30px;" onclick="if(confirm('Are you sure you want to log out ?')){window.location.href='login.php'}">
<span><strong>Logout</strong></span></a>
</li>
<?Php } else if (@$_SESSION['level']=="Admin"){?>
<a class="text-dark sidebar-brand d-flex align-items-center justify-content-center">
<!--bikin div img logo disini-->
<div class="sidebar-brand-text mx-3" style="padding-top: 30px;">
<img src="resources/home.png" width="130px;">
</div>
</a>
<!-- Divider -->
<div style="padding-bottom: 40px;"></div>
<!-- Nav Item - Dashboard -->
<li class="nav-item active">
<a style="color: white; text-align: center; padding-right: 30px;" class="nav-link" href="index.php?pages=home-admin">
<span><strong>Main Page</strong></span>
</a>
</li>
<!-- Divider -->
<hr style="border-color: white" class="sidebar-divider my-0">
<!-- Heading -->
<li class="nav-item active">
<a style="color: white; text-align: center;" class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#perekapan" aria-expanded="true" aria-controls="perekapan">
<span><strong>Pembukuan</strong></span>
</a>
<div id="perekapan" class="collapse" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item" href="index.php?pages=jurnalumum">Jurnal Umum</a>
<a class="collapse-item" href="index.php?pages=bukubesar">Buku Besar</a>
<a class="collapse-item" href="index.php?pages=neracasaldo">Neraca Saldo</a>
</div>
</div>
</li>
<hr style="border-color: white" class="sidebar-divider my-0">
<!-- Heading -->
<li class="nav-item active">
<a style="color: white; text-align: center;" class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsePages" aria-expanded="true" aria-controls="collapsePages">
<span><strong>Laporan</strong></span>
</a>
<div id="collapsePages" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item" href="index.php?pages=laporan-labarugi">Laba Rugi</a>
<a class="collapse-item" href="index.php?pages=laporan-neraca">Neraca</a>
<a class="collapse-item" href="index.php?pages=laporan-perubmodal">Perubahan Modal</a>
</div>
</div>
</li>
<hr style="border-color: white" class="sidebar-divider my-0">
<!-- Heading -->
<li class="nav-item active">
<a style="color: white; text-align: center;" class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
<span><strong>Data Master</strong></span>
</a>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item" href="index.php?pages=akun">Data Akun</a>
<a class="collapse-item" href="index.php?pages=managemen-user">Data User</a>
</div>
</div>
</li>
<!-- Divider -->
<hr style="border-color: white" class="sidebar-divider my-0">
<li class="nav-item active">
<a class="nav-link" style="cursor:pointer; color: white; text-align: center; padding-right: 30px;" onclick="if(confirm('Are you sure you want to log out ?')){window.location.href='login.php'}">
<span><strong>Logout</strong></span></a>
</li>
<?Php } if(@$_SESSION['level']=="Student"){ ?>
<!-- Sidebar - Brand -->
<a class="text-dark sidebar-brand d-flex align-items-center justify-content-center">
<!--bikin div img logo disini-->
<div class="sidebar-brand-text mx-3" style="padding-top: 30px;">
<img src="resources/home.png" width="130px;">
</div>
</a>
<!-- Divider -->
<div style="padding-bottom: 40px;"></div>
<!-- Nav Item - Dashboard -->
<li class="nav-item active">
<a style="color: white; text-align: center; padding-right: 30px;" class="nav-link" href="index.php?pages=home-student">
<span><strong>Main Page</strong></span>
</a>
</li>
<!-- Divider -->
<hr style="border-color: white" class="sidebar-divider my-0">
<hr style="border-color: white" class="sidebar-divider my-0">
<li class="nav-item active">
<a class="nav-link" style="cursor:pointer; color: white; text-align: center; padding-right: 30px;" href="index.php?pages=app">
<span><strong>Application</strong></span></a>
</li>
<hr style="border-color: white" class="sidebar-divider my-0">
<!-- Divider -->
<hr style="border-color: white" class="sidebar-divider my-0">
<li class="nav-item active">
<a class="nav-link" style="cursor:pointer; color: white; text-align: center; padding-right: 30px;" onclick="if(confirm('Are you sure you want to log out ?')){window.location.href='login.php'}">
<span><strong>Logout</strong></span></a>
</li>
<?php } ?><file_sep> <?php
include "config/koneksi.php";
if(isset($_GET['username'])){
$query = mysqli_query ($conn,"Select * FROM user where username='$_GET[username]'") or die (mysql_error());
$result_edit = mysqli_fetch_array($query);
}
?>
<!-- Static Table Start -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 style="color: #87B1FD" class="m-0 font-weight-bold text-primary">DATA USER</h6>
</div>
<div class="card-body">
<div style="padding-bottom: 20px; text-align: right">
<a href="index.php?pages=managemen-user-tambah" class="btn btn-success" role="button">Add Data</a>
</div>
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead align="center">
<tr>
<th>No</th>
<th>Full Name</th>
<th>Username</th>
<th>Level</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$query = mysqli_query($conn,"SELECT * FROM user");
while ($hasil = mysqli_fetch_array($query))
{ ?>
<tr>
<td><?php echo $no++; ?></td>
<td><?php echo $hasil['nama_user'];?></td>
<td><?php echo $hasil['usernames'];?></td>
<td><?php if($hasil['level']=="1"){
echo "Manager";
}else if($hasil['level']=="2"){
echo "Student";
} else{
echo "Admin";
}
?>
</td>
<td align="center">
<a class='btn btn-primary' href="index.php?pages=managemen-user-tambah&status=edit&usernames=<?php echo $hasil['usernames'];?>">Edit</a>
<a href='#' style='color:#fff;' class='btn btn-danger' onclick="if(confirm('Are You Sure You Want to Delete this Data ?')){window.location.href='index.php?pages=managemen-user-proses&status=delete&usernames=<?php echo $hasil['usernames'];?>'}">Delete</a>
</td>
</tr>
</tbody>
<?php }?>
</table>
</div>
</div>
</div>
<file_sep><?php
include "config/koneksi.php";
if(@$_GET['pages']) {
include $_GET['pages'].".php";
}else {
include "home.php";
}
?><file_sep><?php
$ambil=$_GET['aksi'];
if($ambil=="tambah-user")
{
$status = @$_POST['status'];
$user = @$_POST['txtuser'];
$email = @$_POST['txtemail'];
$pass = @$_POST['txtpass'];
$nama = @$_POST['txtnama'];
$level = @$_POST['txtlevel'];
$tambah = mysqli_query ($conn,"INSERT INTO user VALUES ('$nama','$email','$user','$pass','$level')")or die (mysqli_error());
if ($tambah=true){
echo"<script>alert('Add Data Successful');</script>";
echo '<meta http-equiv="Refresh" content="0; url=index.php?pages=data-user"/>';
}else {
echo"<script>alert('Failed to Add Data');</script>";
}
}
else if($ambil=="edit-user")
{
$status = @$_POST['status'];
$user = @$_POST['txtuser'];
$email = @$_POST['txtemail'];
$pass = @$_POST['txtpass'];
$nama = @$_POST['txtnama'];
$level = @$_POST['txtlevel'];
$edit = "UPDATE user SET Username='$user',Password='<PASSWORD>',Email='$email', Nama='$nama',Level='$level'";
$edit .="WHERE Username='$user'";
$edit = mysqli_query($conn,$edit) or die (mysqli_error());
if ($edit=true){
echo"<script>alert('Update Data Successful');</script>";
echo '<meta http-equiv="Refresh" content="0; url=index.php?pages=data-user"/>';
}else {
echo"<script>alert('Failed to Add Data');</script>";
}
}
else if($ambil=="hapus-user")
{
$status = @$_POST['status'];
$user = @$_POST['txtuser'];
$email = @$_POST['txtemail'];
$pass = @$_POST['txtpass'];
$nama = @$_POST['txtnama'];
$level = @$_POST['txtlevel'];
$id =$_GET['username'];
$tambah = mysqli_query ($conn,"DELETE FROM user WHERE Username ='$id'")or die (mysql_error());
if ($tambah=true){
echo"<script>alert('Delete Data Successful');</script>";
echo '<meta http-equiv="Refresh" content="0; url=index.php?pages=data-user"/>';
}else {
echo"<script>alert('Failed to Delete Data');</script>";
}
}
} else if($ambil=="tambah-aplikasi") //DONE
{
$full_name=@$_POST['full_name'];
$ic_no =@$_POST['ic_no'];
$faculty =@$_POST['faculty'];
$college =@$_POST['college'];
$block =@$_POST['block'];
$rm_type =@$_POST['rm_type'];
$status =@$_POST['status'];
$tambah = mysqli_query($conn,"INSERT INTO aplikasi VALUES ('','$full_name','$ic_no','$faculty','$college','$block','$rm_type','$status')") ;
// $tambah1=mysqli_query ($conn,"INSERT INTO jurnal-aplikasi VALUES ('','$kodeakun','11','Pendapatan Jasa Pengiriman','$keterangan','$tanggal','$total','0')")or die (mysqli_error());
// $tambah2=mysqli_query ($conn,"INSERT INTO jurnal-aplikasi VALUES ('','$kodeakun','41','Pendapatan Jasa Pengiriman','$keterangan','$tanggal','0','$total')")or die (mysqli_error());
if ($tambah=true){
echo"<script>alert('Successfully submit data');</script>";
echo '<meta http-equiv="Refresh" content="0; url=index.php?pages=app"/>';
}else {
echo"<script>alert('Failed to submit');</script>";
}
}
<file_sep><?php
include "modules/index.php";
?><file_sep><nav class="navbar navbar-expand navbar-dark topbar mb-4 static-top shadow" style="background: #87B1FD; no-repeat; padding-top: 10px; height: 100px;">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<div style="color: white" class="sidebar-brand d-flex align-items-center justify-content-center">
<div class="sidebar-brand-text mx-0"><h2><strong>STUDENTS’ COLLEGE ACCOMMODATION SYSTEM </strong></h2>
<h4><strong>TEAM WEBBER</strong></h4>
</div>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<!-- Nav Item - User Information -->
<li class="nav-item active">
<a class="nav-link href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-black-600 medium"><?php echo $_SESSION['username'];?></span>
<img class="img-profile rounded-circle" src="<?php echo $base_url;?>resources/icon.png">
</a>
</li>
</ul>
</nav><file_sep>
<!-- Page Heading -->
<div style="text-align: center; padding-top: 20px;" class="mb-4">
<h1 class="h3 mb-0 text-gray-800">WELCOME STUDENT !</h1>
</div>
<!-- Pending Requests Card Example -->
<div style="text-align: center;">
<?php echo "<img src='resources/picture.png' height='721' width='610'/> ";
?>
</div><file_sep><?php
include "config/koneksi.php";
if(isset($_GET['usernames'])){
$query = mysqli_query ($conn,"Select * FROM user where usernames='$_GET[usernames]'") or die (mysqli_error());
$result_edit = mysqli_fetch_array($query);
}
?>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 style="color: #87B1FD" class="m-0 font-weight-bold text-primary"></h6>
</div>
<div class="card-body">
<div class="tambah">
<form action="index.php?pages=managemen-user-proses" method="POST" enctype="multipart/form-data">
<?php
if(isset($_GET['usernames'])){
echo "<input type='hidden' name='status' value='edit'>";
}else {
echo "<input type='hidden' name='status' value='add'>";
}
?>
<h2 align="center" style="padding-bottom: 20px;"><?php if(isset($_GET['usernames'])){ echo"Edit Data User";} else {echo"Add Data User";} ?></h2>
<table align="center">
<tr>
<td><label>Full Name</label></td>
<td style="padding-left: 10px;">:</td>
<td><input style="margin-left: 20px" type="text" class="form-control" name="txtnama" placeholder="nama" value="<?php if(isset($result_edit['nama_user'])) echo $result_edit['nama_user'] ?>"></td>
</tr>
<tr>
<td><label>Username</label></td>
<td style="padding-left: 10px;">:</td>
<td><input style="margin-left: 20px" type="text" class="form-control" name="txtuser" placeholder="username" value="<?php if(isset($result_edit['usernames'])) echo $result_edit['usernames'] ?>" required></td>
</tr>
<tr>
<td><label>Password</label></td>
<td style="padding-left: 10px;">:</td>
<td><input style="margin-left: 20px" type="password" class="form-control" name="txtpass" placeholder="******" value="<?php if(isset($result_edit['passwords'])) echo $result_edit['passwords'] ?>" <?php if(isset($result_edit['passwords'])) echo "disabled"?>></td>
</tr>
<tr>
<td><label>Level</label></td>
<td style="padding-left: 10px;">:</td>
<td ><input style="margin-left: 20px;" type="radio" name="txtlevel" value="1" checked>Manager
<input style="margin-left: 20px;" type="radio" name="txtlevel" value="2" checked>Student
<input style="margin-left: 20px;"type="radio" name="txtlevel" value="3" <?php if(@$result_edit['level'] == '3') echo "checked"; ?>>Admin
</td>
</tr>
<tr>
<td><br></td>
</tr>
<tr align="center">
<td colspan="2"><button class="btn btn-success"><?php if(isset($_GET['usernames'])){ echo"Edit ";} else {echo"Add";} ?></button></td>
<td><a class="btn btn-success" href="index.php?pages=managemen-user">Back</button></td>
</tr>
</table>
</form>
</div>
</div>
</div><file_sep><?php
session_start();
include "config/koneksi.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Student Accomodation Application</title>
<!-- Custom fonts for this template-->
<link href="<?php echo $base_url;?>includes/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="<?php echo $base_url;?>includes/css/sb-admin-2.min.css" rel="stylesheet">
<link href="<?php echo $base_url;?>includes/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<?php if(@$_SESSION['username']){
?>
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul style="background: #87B1FD; no-repeat;" class="navbar-nav sidebar sidebar-dark accordion" id="accordionSidebar">
<?php include "menu.php"; ?>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<?php include "topbar.php"; ?>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<?Php if(@$_SESSION['level']=="Manager"){ ?>
<?php if(@$_GET['pages']){
include "konten.php";
}else {
include "home-manager.php";
}
?>
<?Php } else if (@$_SESSION['level']=="Admin"){?>
<?php if(@$_GET['pages']){
include "konten.php";
}else {
include "home-admin.php";
}
?>
<?Php } else if (@$_SESSION['level']=="Student"){?>
<?php if(@$_GET['pages']){
include "konten.php";
}else {
include "home-student.php";
}
?>
<?php } ?>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>© SI 2018</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<?php } else { header('location:login.php');}
?>
</body>
<!-- Bootstrap core JavaScript-->
<script src="<?php echo $base_url;?>includes/vendor/jquery/jquery.min.js"></script>
<script src="<?php echo $base_url;?>includes/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="<?php echo $base_url;?>includes/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="<?php echo $base_url;?>includes/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="<?php echo $base_url;?>includes/vendor/chart.js/Chart.min.js"></script>
<!-- Page level custom scripts -->
<script src="<?php echo $base_url;?>includes/js/demo/chart-area-demo.js"></script>
<script src="<?php echo $base_url;?>includes/js/demo/chart-pie-demo.js"></script>
<!-- Page level plugins -->
<script src="<?php echo $base_url;?>includes/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo $base_url;?>includes/vendor/datatables/dataTables.bootstrap4.min.js"></script>
<!-- Page level custom scripts -->
<script src="<?php echo $base_url;?>includes/js/demo/datatables-demo.js"></script>
</html>
| 463e9fb3518c884a6f0c0df37210542773e88f0f | [
"SQL",
"PHP"
] | 14 | PHP | zahraAfa/studentAccomodation_webApp | da28dfcaa2248e91c968748d9992698750c67f37 | c982dc12b126fa69f14d75170291c798d03734df |
refs/heads/master | <file_sep>import { messaging } from 'firebase-admin';
export const send = (tokens, payload) => {
return messaging().sendToDevice(tokens, { notification: payload });
}<file_sep>import { firestore } from 'firebase-admin';
import { Activity } from './../model';
export const addActivity = (activity: Activity, projectId: string) => {
return firestore()
.collection('Projects')
.doc(projectId)
.collection('Activities')
.add(activity);
};
<file_sep>import {
Component,
OnInit,
OnChanges,
Input,
ViewChild,
ElementRef
} from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { ChatService } from './../../../../services/chat.service';
import { AuthenticationService } from './../../../../services/authentication.service';
@Component({
selector: 'app-chat',
templateUrl: './chat.component.html',
styleUrls: ['./chat.component.scss']
})
export class ChatComponent implements OnInit, OnChanges {
@Input()
public chatId: string;
public myId: string;
public otherUserId: string;
public isLoading: Boolean = true;
public showEmoji: Boolean = false;
public newChat: Boolean;
public sendMessageForm: FormGroup;
public messages: Array<any> = [];
@ViewChild('chatContainer')
chatContainer: ElementRef;
constructor(
private fb: FormBuilder,
private chatService: ChatService,
private auth: AuthenticationService
) {}
ngOnInit() {
this.sendMessageForm = this.fb.group({
message: [null, Validators.minLength]
});
this.myId = this.auth.user.uid;
this.otherUserId = this.getOtherUser();
}
ngOnChanges() {
this.otherUserId = this.getOtherUser();
this.getMessages();
}
getOtherUser() {
const users = this.chatId.split('_');
const us = users.filter(userId => userId != this.myId);
return us[0];
}
getMessages() {
this.isLoading = true;
this.chatService.getMessages(this.chatId).subscribe(
messages => {
this.isLoading = false;
if (messages.length == 0) {
this.newChat = true;
}
this.messages = messages;
setTimeout(() => {
this.chatContainer.nativeElement.scrollTop = this.chatContainer.nativeElement.scrollHeight;
}, 50);
},
error => {}
);
}
public sendMessage(form) {
const { message } = form.value;
this.chatService.insertChat(this.chatId, message, this.newChat);
form.resetForm();
}
public emojiSelected(event) {
const currentValue = this.sendMessageForm.controls['message'].value;
const newValue = currentValue
? currentValue + event.emoji.native
: event.emoji.native;
this.sendMessageForm.controls['message'].setValue(newValue);
this.showEmoji = false;
}
}
<file_sep>import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(array: any, property?: any, term?: any): any {
if (!term) return array;
term = term.toLowerCase();
return array.filter(item => item[property].toLowerCase().indexOf(term) !== -1);
}
}
<file_sep>import { Directive, ElementRef, Input, OnInit } from '@angular/core';
import { ProjectService } from './../services/project.service';
@Directive({
selector: '[appProjectName]'
})
export class ProjectNameDirective implements OnInit {
@Input('appProjectName')
projectId: string;
constructor(private el: ElementRef, private project: ProjectService) {
el.nativeElement.innerHTML = 'fetching...';
}
ngOnInit() {
this.project.get(this.projectId).subscribe(project => {
if (!project) {
this.el.nativeElement.innerHTML = `Unknown Project`;
} else {
this.el.nativeElement.innerHTML = `${project['title']}`;
}
});
}
}
<file_sep>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CalendarModule as AngularCalendarModule } from 'angular-calendar';
import { SharedModule } from './../shared/shared.module';
import { IndexComponent } from './pages/index/index.component';
import { RouterModule, Routes } from '@angular/router';
import { MainComponent } from './components/main/main.component';
const routes: Routes = [
{
path: '',
component: MainComponent
},
{
path: '**',
pathMatch: 'exact',
redirectTo: ''
}
];
@NgModule({
declarations: [IndexComponent, MainComponent],
imports: [
CommonModule,
AngularCalendarModule,
RouterModule.forChild(routes),
SharedModule
]
})
export class CalendarModule {}
<file_sep>import { Injectable } from '@angular/core';
import { AngularFireAuth } from 'angularfire2/auth';
import {
AngularFirestore,
AngularFirestoreCollection
} from 'angularfire2/firestore';
import * as firebase from 'firebase';
import { Observable } from 'rxjs';
// Models
import { Message } from './../message.model';
@Injectable({
providedIn: 'root'
})
export class MessageService {
private messagesCollection: AngularFirestoreCollection<Message>;
constructor(private afAuth: AngularFireAuth, private afs: AngularFirestore) {
this.messagesCollection = afs.collection<Message>('Messages');
}
/**
* Insert Messages send by currenlty logged in uder into firestore
* @param message
*/
public sendMessage(message: Message) {
this.messagesCollection.add(message);
}
public getMessages() {
return this.afs
.collection<Message>('Messages', ref => ref.orderBy('createdAt', 'desc').limit(30))
.valueChanges();
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { AngularFireAuth } from 'angularfire2/auth';
import { AuthenticationService } from './../../../../services/authentication.service';
import { UserService } from './../../../../services/user.service';
import { ChatService } from './../../../../services/chat.service';
@Component({
selector: 'app-my-chat',
templateUrl: './my-chat.component.html',
styleUrls: ['./my-chat.component.scss']
})
export class MyChatComponent implements OnInit {
public myId: string;
// public userId: string;
public users: Array<any> = [];
public chats: Array<any> = [];
public chatId: string;
public activeView = 'chats';
constructor(
private auth: AuthenticationService,
// private afAuth: AngularFireAuth,
private userService: UserService,
private chatService: ChatService
) {}
ngOnInit() {
this.myId = this.auth.user.uid;
this.chatService.getMyChats().subscribe(chats => {
this.chats = chats;
this.chats = chats.map(chat => {
for (let key in chat) {
if (chat[key] == 'user') {
if (key != this.myId) {
chat['userId'] = key;
}
delete chat[key];
}
}
return chat;
});
});
this.userService.list().subscribe(users => {
this.users = users.filter(user => user['uId'] != this.myId);
});
}
public getChat(userId) {
let user1 = this.myId;
let user2 = userId;
this.chatId = user1 < user2 ? user1 + '_' + user2 : user2 + '_' + user1;
// this.chatId = roomName;
}
public checkFriend() {}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { UserService } from './../../../../services/user.service';
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-project-settings',
templateUrl: './project-settings.component.html',
styleUrls: ['./project-settings.component.scss']
})
export class ProjectSettingsComponent implements OnInit {
public projectId: string;
public existingProjectPeople: Array<object>;
public projectPeople: Array<object>;
public firstListen = true;
public isSavingPeople = false;
public existingPeople: Array<object> = [];
public people: Array<object> = [];
public showAddOrRemovePeopleDiv: Boolean = false;
public project;
public userRole: string;
public projectStatus: string;
public projectUpdateForm: FormGroup;
public isProjectUpdating: Boolean = false;
constructor(
private route: ActivatedRoute,
private projectService: ProjectService,
private userService: UserService,
private alertService: AlertService,
private fb: FormBuilder,
private router: Router
) {
this.projectUpdateForm = this.fb.group({
title: [null, Validators.required],
caption: [null, Validators.required],
description: [null]
});
}
ngOnInit() {
this.getUser();
this.route.parent.params.subscribe(
params => {
this.projectId = params.projectId;
this.getProject();
// this.getProjectPeople();
this.getUsers();
this.projectService.get(this.projectId).subscribe(user => {
Object.keys(user).forEach(key => {
if (this.projectUpdateForm.controls[key]) {
this.projectUpdateForm.controls[key].setValue(user[key]);
}
});
});
},
error => {
this.alertService.showError(error.message);
}
);
}
public async updateProjectDetail(form: FormGroup) {
try {
this.isProjectUpdating = true;
this.validateForm(form);
await this.projectService.updateProject(form.value, this.projectId);
this.isProjectUpdating = false;
} catch (error) {}
}
getUsers() {
this.userService.list().subscribe(users => {
// this.people = users.filter(user => user.role !== 'Administrator');
this.firstListen = true;
this.people = users;
this.getProjectPeople();
});
}
getProjectPeople() {
this.projectService.getPeople(this.projectId).subscribe(projectPeople => {
let allUsers = this.people;
console.log('all', allUsers, projectPeople);
if (this.firstListen === true) {
this.firstListen = false;
// Administrators
// const administrators = allUsers.filter(
// (user: any) => user.role === 'Administrator'
// );
// Project people after filtering administrators
this.projectPeople = projectPeople
// .filter(
// (user: any) =>
// administrators.findIndex(
// (admin: any) => admin.uId === user.userId
// ) === -1
// );
// Filtering non administrator users
allUsers = allUsers
// .filter((user: any) => user.role !== 'Administrator')
.map((user: any) => ({ userId: user.uId }));
}
// people = people.filter(user => user.userId !== 'Pch5ip6VisQDGXzEqg43btO2E3d2');
this.people = allUsers.filter(
(user: any) =>
this.projectPeople.findIndex((p: any) => p.userId === user.userId) ===
-1
);
this.existingPeople = [...this.people];
this.existingProjectPeople = [...this.projectPeople];
});
}
public hideAddOrRemoveSection() {
this.projectPeople = [...this.existingProjectPeople];
this.people = [...this.existingPeople];
this.showAddOrRemovePeopleDiv = false;
}
public async savePeoples() {
try {
this.isSavingPeople = true;
const existingPeople = [...this.people];
await this.projectService.updateProjectPeople(
this.projectPeople,
existingPeople,
this.projectId
);
this.showAddOrRemovePeopleDiv = false;
this.isSavingPeople = false;
} catch (error) {
this.isSavingPeople = false;
console.log(error.message);
}
}
public addOrRemovePeople(userId) {
if (this.showAddOrRemovePeopleDiv) {
const allUsers = this.people;
const existingPeoples = this.projectPeople || [];
const indexAtUsers = allUsers.findIndex(
(user: any) => user.userId === userId
);
const indexAtExistingPeople = existingPeoples.findIndex(
(user: any) => user.userId === userId
);
if (indexAtExistingPeople > -1) {
existingPeoples.splice(indexAtExistingPeople, 1);
allUsers.push({ userId });
} else {
existingPeoples.push({ userId });
allUsers.splice(indexAtUsers, 1);
}
this.projectPeople = existingPeoples;
this.people = allUsers;
}
}
private getUser() {
this.userService.getCurrentUser().subscribe(user => {
if (user) {
this.userRole = user['role'];
}
});
}
public getProject() {
this.projectService.get(this.projectId).subscribe(project => {
this.project = project;
this.projectStatus = project.status;
});
}
// public showAddOrRemovePeopleDiv() {
// }
public deleteProject() {
this.projectService.deleteProject(this.projectId);
this.alertService.showSuccess('Project queued for deletion');
this.router.navigate(['dashboard']);
}
public archiveProject() {
let newStatus;
if (this.projectStatus == 'active') {
newStatus = 'archived';
} else {
newStatus = 'active';
}
this.projectService.updateProjectStatus(this.projectId, newStatus);
}
public selectImage() {
document.getElementById('fileInput').click();
}
public uploadProjectImage(files) {
const file = files[0];
this.alertService.showSuccess('Updating Avatar...');
this.projectService.updateProjectImage(file, this.projectId).subscribe(
res => {},
error => {
this.alertService.showError(error.message);
}
);
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error('Oh! Oh! Please fill all the fields');
}
}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
//Services
import { BillingService } from './../../../../services/billing.service';
import { AlertService } from './../../../../services/alert.service';
import { ProjectService } from './../../../../services/project.service';
@Component({
selector: 'app-view-invoice',
templateUrl: './view-invoice.component.html',
styleUrls: ['./view-invoice.component.scss']
})
export class ViewInvoiceComponent implements OnInit {
public logs = [];
public subTotal;
constructor(
@Inject(MAT_DIALOG_DATA) public data,
private billing: BillingService,
private alertService: AlertService,
private project: ProjectService) { }
ngOnInit() {
console.log(this.data);
this.InvoiceDetail();
}
public InvoiceDetail() {
this.billing.getInvoiceDetail(this.data.projectId, this.data.invoiceId).subscribe(
logs => {
this.logs = logs;
this.getTotalTime(this.logs);
},
error => {
this.alertService.showError(error.message);
}
);
}
getTotalTime(logs) {
this.subTotal = this.project.calculateTimelogs(logs);
}
}
<file_sep># POD : Project Management software
## Purpose
Tired of monthly user subscriptions ? Well, POD is an open source software that lets your colleagues collaborate on multiple projects. Product is currently in initial phase.

## Demo
[View Demo](https://pod.zweck.io/)
Link broken? Please [inform us](https://pod.zweck.io/)
## Contributing
We are planning to incorporate more features, feel free to ping if you would like to contribute
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
## Authors
* **Zweck Infotech Pvt Ltd.** - *Funding* - [Visit Website](http://zweck.io/)
* **<NAME>** - *Architecture and Cloud Functions* - [View Profile](https://github.com/sharan-zweck)
* **<NAME>** - *Angular Development* - [View Profile](https://github.com/harsha-zweck)
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
* Hat tip to anyone whose code was used
* Inspiration
* etc
<file_sep>import { Injectable } from '@angular/core';
import {
AngularFirestore,
AngularFirestoreCollection
} from 'angularfire2/firestore';
import * as firebaseApp from 'firebase/app';
import { AngularFireStorage } from 'angularfire2/storage';
import { AuthenticationService } from './authentication.service';
import { UserService } from './user.service';
import { Project, Notebook, Time, Invoice } from './../app.model';
import { Observable } from 'rxjs';
import { map, finalize } from 'rxjs/operators';
import * as moment from 'moment';
@Injectable({
providedIn: 'root'
})
export class ProjectService {
private collection: AngularFirestoreCollection<Project>;
constructor(
private afs: AngularFirestore,
private auth: AuthenticationService,
private storage: AngularFireStorage,
private user: UserService
) {
this.collection = this.afs.collection<Project>('Projects');
}
/**
* Add a new project into Project collection
* @param project
* @author Harsha
*/
public async add(project: Project) {
const projectId = this.afs.createId();
project.status = 'active';
project.createdAt = firebaseApp.firestore.FieldValue.serverTimestamp();
project.lastUpdated = firebaseApp.firestore.FieldValue.serverTimestamp();
project.id = projectId;
// Strip People from Array
const people = project.people;
delete project.people;
await this.collection.doc(projectId).set(project);
// Add into the subcollection
for (let userId of people) {
this.collection
.doc(projectId)
.collection('People')
.doc(userId)
.set({
userId: userId,
createdAt: firebaseApp.firestore.FieldValue.serverTimestamp()
});
this.user.addProject(projectId, userId);
}
}
/**
* Update Project details
* @param project
* @author Harsha
*/
public updateProject(project: Project, projectId) {
return this.afs
.collection('Projects')
.doc(projectId)
.update({
caption: project.caption,
title: project.title,
description: project.description
});
}
public async updateProjectPeople(
newPeople: Array<any>,
oldPeople: Array<any>,
projectId
) {
console.log('In updateProjectPeople');
let promises = [];
const peopleCollectionRef = this.afs
.collection('Projects')
.doc(projectId)
.collection('People');
promises = oldPeople.map(async user => {
const people = await peopleCollectionRef.doc(user.userId).ref.get();
if (people.exists) {
return peopleCollectionRef.doc(user.userId).delete();
} else {
return Promise.resolve();
}
});
await Promise.all(promises); // Removing people from people collection
promises = [];
const peoples = await peopleCollectionRef.ref.get();
if (peoples.empty) {
// If project people is empty
newPeople.forEach(p => {
promises.push(
peopleCollectionRef.doc(p.userId).set({
userId: p.userId,
createdAt: firebaseApp.firestore.FieldValue.serverTimestamp()
})
);
});
} else {
// Not empty
promises = newPeople.map(async p => {
const peopleDoc = await peopleCollectionRef.doc(p.userId).ref.get();
if (!peopleDoc.exists) {
return peopleCollectionRef.doc(p.userId).set({
userId: p.userId,
createdAt: firebaseApp.firestore.FieldValue.serverTimestamp()
});
}
});
}
return Promise.all(promises);
}
/**
* delete project collection : Permission limited to admin
* @param projectId
*/
public deleteProject(projectId) {
console.log(projectId);
this.collection.doc(projectId).delete();
}
public updateProjectStatus(projectId, currentStatus) {
return this.collection.doc(projectId).set(
{
status: currentStatus
},
{
merge: true
}
);
}
/**
* List all the projects from databse collection - Project
*/
public list(status) {
return this.afs
.collection<Project>('Projects', ref => ref.where('status', '==', status))
.valueChanges();
}
/**
* Get the Details of a project
* @param id
*/
public get(id): Observable<Project> {
return this.collection.doc<Project>(id).valueChanges();
}
/**
* Add a new NoteBook
* @param noteBook
*/
public saveNoteBook(notebook: Notebook) {
let notebookId;
if (notebook.id == null) {
notebookId = this.afs.createId();
notebook.id = notebookId;
notebook.userId = this.auth.user.uid;
notebook.createdAt = new Date();
}
notebookId = notebook.id;
notebook.lastUpdatedAt = new Date();
const notebookCollection = this.afs.collection<Notebook>(
`Projects/${notebook.projectId}/Notebooks`
);
return notebookCollection.doc(notebookId).set(notebook);
}
/**
* Get all the Norebooks added in a project
* @param projectId
*/
public getNotebooks(projectId) {
const NotebookCollection = this.afs.collection<Notebook>(
`Projects/${projectId}/Notebooks`
);
return NotebookCollection.valueChanges();
}
/**
* Get a notebook with id = notebookId
* @param projectId
* @param notebookid
*/
public getNotebook(projectId, notebookid) {
const notebook = this.afs.doc(
`Projects/${projectId}/Notebooks/${notebookid}`
);
return notebook.valueChanges();
}
/**
* Insert the message into collection ProjectChat
* @param chat
*/
public addChat(chat) {
const chatId = this.afs.createId();
chat.userId = this.auth.user.uid;
chat.id = chatId;
chat.createdAt = new Date();
chat.lastUpdatedAt = new Date();
const commentCollection = this.afs.collection<Comment>(
`Projects/${chat.projectId}/Messages`
);
return commentCollection.doc(chatId).set(chat);
}
/**
* Get the chat messages of Project
* @param projectId string
*/
public getChat(projectId) {
const commentCollection = this.afs.collection<Comment>(
`Projects/${projectId}/Messages`,
ref => ref.orderBy('createdAt', 'asc')
);
return commentCollection.valueChanges();
}
/**
* MOVE THIS TO TASK SERVICE
* Get the Time logs for a Project
* @param projectId string
*/
public getTimeLogs(projectId) {
const timeLogCollection = this.afs.collection<Time>(
`Projects/${projectId}/Time`,
ref => ref.orderBy('createdAt', 'desc')
);
return timeLogCollection.valueChanges();
}
/**
* MOVE THIS TO TASK SERVICE
* Toggle the Billable and Non Billable status
* for a time log
* @param timelogId string
* @param projectId string
*/
public updateBillableStatus(timelogId, projectId, status) {
return this.afs
.collection('Projects')
.doc(projectId)
.collection('Time')
.doc(timelogId)
.update({
isBillable: status
});
}
/**
* Get Activities
* @param projectId string
*/
public getActivites(projectId) {
return this.afs
.collection('Projects')
.doc(projectId)
.collection('Activities', ref =>
ref.orderBy('createdAt', 'desc').limit(10)
)
.valueChanges();
}
/**
* Add a file to the Project
* @param projectId string
*/
public addFile = (projectId: string, file, taskId?: string) => {
const filePath = `projects/${projectId}/${file.lastModified + file.name}`;
const task = this.storage.upload(filePath, file);
return task.snapshotChanges().pipe(
finalize(() => {
return this.afs
.collection('Projects')
.doc(projectId)
.collection('Files')
.add({
name: file.name,
userId: this.auth.user.uid,
taskId: taskId || null,
ref: filePath,
createdAt: firebaseApp.firestore.FieldValue.serverTimestamp(),
lastUpdatedAt: firebaseApp.firestore.FieldValue.serverTimestamp()
});
})
);
};
/**
* Get the files in a Project
* @param projectId string
*/
public getFiles = (projectId: string) => {
return this.afs
.collection('Projects')
.doc(projectId)
.collection('Files')
.valueChanges()
.pipe(
map(files => {
files.forEach(file => {
file.downloadURL = this.storage.ref(file.ref).getDownloadURL();
});
return files;
})
);
};
/**
* Get the files uploaded inside a task
* @param projectId
* @param taskId
*/
public getTaskFiles(projectId, taskId) {
return this.afs
.collection('Projects')
.doc(projectId)
.collection('Files', ref =>
ref.orderBy('createdAt', 'desc').where('taskId', '==', taskId)
)
.valueChanges()
.pipe(
map(files => {
files.forEach(file => {
file.downloadURL = this.storage.ref(file.ref).getDownloadURL();
});
return files;
})
);
}
/**
* Get all the people in a project
* @param projectId
*/
public getPeople(projectId) {
return this.afs
.collection('Projects')
.doc(projectId)
.collection('People', ref => ref.orderBy('createdAt', 'desc'))
.valueChanges();
}
public calculateTimelogs(timeLogs) {
let billableTime = 0;
let nonBillabletime = 0;
for (let i = 0; i < timeLogs.length; i++) {
const difference = this.calculateTimeDifference(
timeLogs[i].from,
timeLogs[i].to
);
timeLogs[i].time = difference;
if (timeLogs[i].isBillable == true) {
billableTime = billableTime + difference;
} else {
nonBillabletime = nonBillabletime + difference;
}
}
const totalTime = billableTime + nonBillabletime;
return {
billableTime: billableTime.toFixed(2),
nonBillabletime: nonBillabletime.toFixed(2),
totalTime: totalTime.toFixed(2)
};
}
/**
* Calculate the difference between 2 time entrys of the format 1:00 pm
* @param startDate
* @param endDate
*/
public calculateTimeDifference(startDate, endDate) {
let start_date = moment(startDate, 'HH:mm A');
let end_date = moment(endDate, 'HH:mm A');
let duration = moment.duration(end_date.diff(start_date));
let time = duration.asHours();
return time;
}
/**
* Get the Timelogs of a project based on conditions
* @author Harsha
* @param conditions
* @param projectId
*/
public filterTimeLogs(conditions, projectId) {
return this.afs
.collection('Projects')
.doc(projectId)
.collection('Time', ref => {
let query:
| firebaseApp.firestore.CollectionReference
| firebaseApp.firestore.Query = ref;
if (conditions.startDate) {
query = query.where('createdAt', '>=', conditions.startDate);
}
if (conditions.endDate) {
query = query.where('createdAt', '<=', conditions.endDate);
}
if (typeof conditions.billableOrNot === 'boolean') {
query = query.where('isBillable', '==', conditions.billableOrNot);
}
query.orderBy('createdAt', 'desc');
return query;
})
.valueChanges();
}
/**
* Add a file to the Project
* @param projectId string
*/
public updateProjectImage = (file, projectId) => {
const filePath = `projectIcons/${file.name}`;
const task = this.storage.upload(filePath, file);
return task.snapshotChanges().pipe(
finalize(async () => {
const url = await this.storage
.ref(filePath)
.getDownloadURL()
.toPromise();
return this.afs
.collection('Projects')
.doc(projectId)
.set(
{
projectImage: url,
lastUpdatedAt: new Date()
},
{ merge: true }
);
})
);
};
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { MatDialog } from '@angular/material/dialog';
// Components
import { AddTaskComponent } from './../../components/add-task/add-task.component';
import { SaveTaskListComponent } from './../../components/save-task-list/save-task-list.component';
// Services
import { TaskService } from './../../../../services/task.service';
import { UserService } from './../../../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-project-tasks',
templateUrl: './project-tasks.component.html',
styleUrls: ['./project-tasks.component.scss']
})
export class ProjectTasksComponent implements OnInit {
public user;
public activeRoles = ['Administrator', 'Project Manager'];
public view = 'list';
public isAddTaskList: Boolean = false;
public isLoadingTask: Boolean = false;
public projectId: string;
public tasks = [];
public activeTaskLists = [];
public completedTaskLists = [];
public activeTaskList;
constructor(
private route: ActivatedRoute,
private taskService: TaskService,
private userService: UserService,
private alertService: AlertService,
private dialog: MatDialog
) {}
ngOnInit() {
const view = window.localStorage.getItem('taskView');
if (view) this.view = view;
this.userService.getCurrentUser().subscribe(user => {
this.user = user;
});
this.route.parent.params.subscribe(params => {
this.projectId = params.projectId;
this.taskService.project = this.projectId;
this.listTaskList();
});
}
public list(taskListId) {
this.taskService.list(taskListId).subscribe(tasks => {
this.isLoadingTask = false;
this.tasks = tasks;
});
}
/**
* Close the Task List Component
* @param status Boolean
*/
public closeTaskListComponent(status) {
this.isAddTaskList = status;
}
public addTask() {
if (this.activeTaskList.isCompleted === true) {
this.alertService.showError(
'Yikes! You cant add a task to one completed task list'
);
return;
}
const addDialog = this.dialog.open(AddTaskComponent, {
width: '700px',
data: { projectId: this.projectId, taskListId: this.activeTaskList.id }
});
}
public addTaskList() {
this.dialog.open(SaveTaskListComponent, {
width: '400px',
data: { projectId: this.projectId }
});
}
public editTaskList() {
this.dialog.open(SaveTaskListComponent, {
width: '400px',
data: { projectId: this.projectId, taskList: this.activeTaskList }
});
}
public listTaskList() {
this.taskService.getTaskLists().subscribe(taskLists => {
this.completedTaskLists = [];
this.activeTaskLists = [];
taskLists.forEach(taskList => {
if (taskList.isCompleted === true) {
this.completedTaskLists.push(taskList);
} else {
this.activeTaskLists.push(taskList);
}
});
if (this.activeTaskLists.length > 0) {
this.selectTaskList(this.activeTaskLists[0]);
} else {
this.isLoadingTask = false;
}
});
}
/**
* @description Select and set the task list
* @author Sharan (Zweck)
* @param taskListId string
*/
public selectTaskList(taskList) {
this.activeTaskList = taskList;
this.isLoadingTask = true;
this.list(this.activeTaskList.id);
}
/**
* @description Toggle the Finished status
* of a task list
* @author Sharan (Zweck)
*/
public async toggleFinished() {
try {
await this.taskService.toggleFinished(this.activeTaskList);
} catch (error) {
this.alertService.showError(error.message);
}
}
public setView(view) {
this.view = view;
window.localStorage.setItem('taskView', view);
}
}
<file_sep>import { NotebookNameDirective } from './notebook-name.directive';
describe('NotebookNameDirective', () => {
it('should create an instance', () => {
const directive = new NotebookNameDirective();
expect(directive).toBeTruthy();
});
});
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
// Services
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
import { UserService } from './../../../../services/user.service';
@Component({
selector: 'app-project-notebooks',
templateUrl: './project-notebooks.component.html',
styleUrls: ['./project-notebooks.component.scss']
})
export class ProjectNotebooksComponent implements OnInit {
public projectId;
public notebooks = [];
constructor(
private route: ActivatedRoute,
private projectService: ProjectService,
private alertService: AlertService,
private userService: UserService
) {}
ngOnInit() {
this.route.parent.params.subscribe(params => {
this.projectId = params.projectId;
this.getNotebooks();
});
}
public getNotebooks() {
this.projectService.getNotebooks(this.projectId).subscribe(
notebooks => {
const user = this.userService.user;
if (user.role != 'administrator') {
this.notebooks = notebooks.filter(notebook => {
if (notebook.userId === user.uId) {
return true;
} else if (notebook.people) {
return notebook.people.includes(user.uId);
} else {
return false;
}
});
} else {
this.notebooks = notebooks;
}
},
error => {
this.alertService.showError(error.message);
}
);
}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
//Services
import { AlertService } from './../../../../services/alert.service';
import { ProjectService } from './../../../../services/project.service';
import { TaskService } from './../../../../services/task.service';
@Component({
selector: 'app-upsert-comment',
templateUrl: './upsert-comment.component.html',
styleUrls: ['./upsert-comment.component.scss']
})
export class UpsertCommentComponent implements OnInit {
public commentForm: FormGroup;
public people = [];
constructor(
private alertService: AlertService,
private taskService: TaskService,
private fb: FormBuilder,
private project: ProjectService,
public dialogRef: MatDialogRef<UpsertCommentComponent>,
@Inject(MAT_DIALOG_DATA) public data,
) { }
ngOnInit() {
this.commentForm = this.fb.group({
description: [null, Validators.required]
});
console.log(this.data);
this.getProject();
}
/**
* Posts the Comment
* @param form FormDirective
*/
public async postComment(form: FormGroup) {
try {
if (form.invalid) {
return false;
// throw new Error(`You shouldn't leave the comment field like that`);
}
const commentData = form.value;
commentData.taskId = this.data.taskId;
commentData.projectId = this.data.projectId;
this.taskService.addComment(commentData);
this.alertService.showSuccess('Comment added');
this.dialogRef.close();
} catch (error) {
this.alertService.showError(error.message);
}
}
public getProject() {
this.project.getPeople(this.data.projectId).subscribe(people => {
this.people = people;
});
}
closeDialog(): void {
this.dialogRef.close();
}
}
<file_sep>import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
// Services
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-project-chat',
templateUrl: './project-chat.component.html',
styleUrls: ['./project-chat.component.scss']
})
export class ProjectChatComponent implements OnInit {
public chatForm: FormGroup;
private projectId: string;
public showEmoji: Boolean = false;
public messages: Array<any> = [];
@ViewChild('chatContainer')
chatContainer: ElementRef;
constructor(
private route: ActivatedRoute,
private fb: FormBuilder,
private projectService: ProjectService,
private alertService: AlertService
) {}
ngOnInit() {
this.chatForm = this.fb.group({
message: [null, Validators.required]
});
this.route.parent.params.subscribe(params => {
this.projectId = params.projectId;
this.getChat(this.projectId);
});
}
public sendMessage(form) {
try {
if (form.invalid) {
throw new Error(`You shouldn't leave the comment field like that`);
}
const chat = form.value;
chat.projectId = this.projectId;
this.projectService.addChat(chat);
form.resetForm();
} catch (error) {
this.alertService.showError(error.message);
}
}
public getChat(projectId) {
this.projectService.getChat(projectId).subscribe(
chat => {
this.messages = chat;
// Scroll the container to bottom
setTimeout(() => {
this.chatContainer.nativeElement.scrollTop = this.chatContainer.nativeElement.scrollHeight;
}, 50);
},
error => {
this.alertService.showError(error.message);
}
);
}
public emojiSelected(event) {
const currentValue = this.chatForm.controls['message'].value;
const newValue = currentValue
? currentValue + event.emoji.native
: event.emoji.native;
this.chatForm.controls['message'].setValue(newValue);
this.showEmoji = false;
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { MatBottomSheet, MatBottomSheetRef } from '@angular/material';
import { AuthenticationService } from './../../../../services/authentication.service';
import { UserService } from './../../../../services/user.service';
import { MenuComponent } from './../menu/menu.component';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {
public userId;
constructor(
private auth: AuthenticationService,
private bottomSheet: MatBottomSheet,
private userService: UserService
) { }
ngOnInit() {
this.userId = this.auth.user.uid;
}
openBottomSheet(): void {
this.bottomSheet.open(MenuComponent);
}
public signOut() {
this.auth.signOut();
window.location.href = '/auth/login';
}
}
<file_sep>import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'app-activity-item',
templateUrl: './activity-item.component.html',
styleUrls: ['./activity-item.component.scss']
})
export class ActivityItemComponent implements OnInit {
@Input() public activity;
@Input() public projectId;
constructor() {}
ngOnInit() {}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
// Services
import { TaskService } from './../../../../services/task.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-save-task-list',
templateUrl: './save-task-list.component.html',
styleUrls: ['./save-task-list.component.scss']
})
export class SaveTaskListComponent implements OnInit {
public saveTaskListForm: FormGroup;
public projectId;
public taskList;
constructor(
private fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data,
private dialogRef: MatDialogRef<SaveTaskListComponent>,
private taskService: TaskService,
private alertService: AlertService
) {}
ngOnInit() {
this.saveTaskListForm = this.fb.group({
id: [null],
title: [null, Validators.required],
notes: [null, Validators.required]
});
this.projectId = this.data.projectId;
if (this.data.taskList) {
this.taskList = this.data.taskList;
this.saveTaskListForm.patchValue(this.taskList);
}
}
/**
* Save the Task List
* @param form FormGroup
*/
public async saveTaskList(form) {
try {
const taskList = form.value;
taskList.projectId = this.projectId;
if (form.invalid) {
return false;
}
await this.taskService.saveTaskList(taskList);
this.alertService.showSuccess('Task list added');
this.dialogRef.close();
} catch (error) {
this.alertService.showError(error.message);
}
}
}
<file_sep>import { Component, Inject } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
@Component({
selector: 'app-prompt',
templateUrl: './prompt.component.html',
styleUrls: ['./prompt.component.scss']
})
export class PromptComponent {
constructor(
public dialogRef: MatDialogRef<PromptComponent>,
@Inject(MAT_DIALOG_DATA) public data
) {}
}
<file_sep>import { UserNameDirective } from './user-name.directive';
describe('UserNameDirective', () => {
it('should create an instance', () => {
const directive = new UserNameDirective();
expect(directive).toBeTruthy();
});
});
<file_sep>import { Injectable } from '@angular/core';
import { AngularFirestore } from 'angularfire2/firestore';
import * as firebaseApp from 'firebase/app';
import {
map,
mergeAll,
skipUntil,
switchMap,
concat,
filter,
withLatestFrom
} from 'rxjs/operators';
import { AuthenticationService } from './authentication.service';
// import { Observable } from 'rxjs';
interface Chat {
user1?: string;
user2?: string;
lastMessage?: string;
lastUpdated: any;
}
@Injectable({
providedIn: 'root'
})
export class ChatService {
constructor(
private auth: AuthenticationService,
private afs: AngularFirestore
) {}
public insertChat(chatId, message, newChat) {
const chatRoomRef = this.afs.collection('Chats').doc(chatId);
let updateData: Chat = {
lastUpdated: firebaseApp.firestore.FieldValue.serverTimestamp(),
lastMessage: message
};
if (newChat === true) {
const { user1, user2 } = this.getChatUserIDs(chatId);
updateData[user1] = 'user';
updateData[user2] = 'user';
}
chatRoomRef.set(updateData, {
merge: true
});
return chatRoomRef.collection('messages').add({
message: message,
userId: this.auth.user.uid,
createdAt: firebaseApp.firestore.FieldValue.serverTimestamp()
});
}
public getMessages(chatId) {
return this.afs
.collection('Chats')
.doc(chatId)
.collection('messages', ref => ref.orderBy('createdAt', 'asc'))
.valueChanges();
}
/**
* Return the personal Chats of the Logged
* in user
*/
public getMyChats() {
const userId = this.auth.user.uid;
return this.afs
.collection('Chats', ref => ref.where(userId, '==', 'user'))
.valueChanges();
}
/**
* Return the user Id's
* Expects a lexicographically sorted string
* @param chatId string | Combination of userId;s
*/
private getChatUserIDs(chatId) {
const [user1, user2] = chatId.split('_');
return { user1, user2 };
}
// return this.collection.doc(userId).collection('Projects').doc(projectId).set({
// projectId: projectId,
// createdAt: firebaseApp.firestore.FieldValue.serverTimestamp()
}
<file_sep>import { Directive, Input, ElementRef } from '@angular/core';
import { TaskService } from './../services/task.service';
@Directive({
selector: '[appTaskName]'
})
export class TaskNameDirective {
@Input()
projectId: string;
@Input()
taskId: string;
constructor(private el: ElementRef, private task: TaskService) {}
ngOnInit() {
this.task.getTaskDetail(this.projectId, this.taskId).subscribe(task => {
if (!task) {
this.el.nativeElement.innerHTML = `Expired Task`;
} else if (task) {
this.el.nativeElement.innerHTML = `${task['title']}`;
} else {
this.el.nativeElement.innerHTML = `Expired Task`;
}
});
}
}
<file_sep>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
// Modules
import { SharedModule } from './../shared/shared.module';
// Material
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatSelectModule } from '@angular/material/select';
// Components
import { ListComponent } from './pages/list/list.component';
import { PeopleMainComponent } from './components/people-main/people-main.component';
import { PeopleItemComponent } from './components/people-item/people-item.component';
import { AddComponent } from './pages/add/add.component';
import { ProfileComponent } from './pages/profile/profile.component';
const routes: Routes = [
{
path: '',
component: PeopleMainComponent,
children: [
{ path: 'list', component: ListComponent },
{ path: 'add', component: AddComponent },
{ path: 'profile/:uId', component:ProfileComponent },
// { path: 'add', component: AddComponent },
{ path: '**', pathMatch: 'full', redirectTo: 'list' }
]
}
];
@NgModule({
imports: [
MatFormFieldModule,
MatInputModule,
MatCheckboxModule,
MatDatepickerModule,
MatSelectModule,
CommonModule,
ReactiveFormsModule,
FormsModule,
SharedModule,
RouterModule.forChild(routes)
],
declarations: [ListComponent, PeopleMainComponent, PeopleItemComponent, AddComponent, ProfileComponent]
})
export class PeopleModule {}
<file_sep>import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
// Services
import { TaskService } from './../../../../services/task.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-add-task-list',
templateUrl: './add-task-list.component.html',
styleUrls: ['./add-task-list.component.scss']
})
export class AddTaskListComponent implements OnInit {
@Input()
projectId: string;
@Output()
public closeTaskListComponent = new EventEmitter();
public addTaskListForm: FormGroup;
public isAdding: Boolean = false;
constructor(
private taskService: TaskService,
private fb: FormBuilder,
private alertService: AlertService
) {}
ngOnInit() {
this.addTaskListForm = this.fb.group({
title: [null, Validators.required]
});
}
public addTaskList(form) {
try {
const taskList = form.value;
taskList.projectId = this.projectId;
this.isAdding = true;
this.validateForm(form);
// this.taskService.addTaskList(taskList);
this.isAdding = false;
form.resetForm();
} catch (error) {
this.alertService.showError(error.message);
}
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error('Please Enter valid input');
}
}
public cancel() {
this.closeTaskListComponent.emit(false);
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { map } from 'rxjs/operators';
// Services
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
import { UserService } from './../../../../services/user.service';
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.scss']
})
export class ListComponent implements OnInit {
public projects: Array<any> = [];
public view = window.localStorage.getItem('projectView') || 'list';
public status: 'active' | 'archived';
public loading: Boolean = true;
public sort = 'lastUpdated';
public orderDesc = true;
public term: string;
constructor(
private projectService: ProjectService,
private alertService: AlertService,
private userService: UserService,
private route: ActivatedRoute
) {}
ngOnInit() {
this.route.params.subscribe(
params => {
this.status = params.status;
this.getProjects();
},
error => {
this.alertService.showError(error.message);
}
);
}
public setView(view) {
this.view = view;
window.localStorage.setItem('projectView', this.view);
}
/**
* Get the User's Project
* Map and filter out any which doesn't
* include him
*/
public getProjects() {
this.userService
.getMyProjects()
.pipe(
map(projects => {
let myProjects = [];
projects.forEach(project => {
myProjects.push(project.projectId);
});
return myProjects;
})
)
.subscribe(
myProjects => {
this.projectService.list(this.status).subscribe(
projects => {
this.projects = projects.filter(project =>
myProjects.includes(project.id)
);
this.loading = false;
},
error => {
this.alertService.showError(error.message);
}
);
},
error => {
this.alertService.showError(error.message);
}
);
}
}
<file_sep>import { firestore } from 'firebase-admin';
import { firestore as firestoreTools } from 'firebase-tools';
import * as functions from 'firebase-functions';
import { send } from './../models/notification';
import { addActivity } from './../models/activity';
import { Activity } from './../model';
const setLastUpdated = projectId => {
return firestore()
.collection('Projects')
.doc(projectId)
.set(
{
lastActivityAt: firestore.FieldValue.serverTimestamp()
},
{
merge: true
}
);
};
export const projectRemoved = async (snap, context) => {
const projectId = context.params.projectId;
const path = `Projects/${projectId}`;
return firestoreTools
.delete(path, {
project: process.env.GCLOUD_PROJECT,
recursive: true,
yes: true,
token: functions.config().fb.token
})
.then(() => {
return {
path: path
};
});
};
export const messageAdded = async (snap, context) => {
const message = snap.data();
// Get the Project using Project ID
const project = await firestore()
.collection('Projects')
.doc(message.projectId)
.get();
const users = await firestore()
.collection('Projects')
.doc(message.projectId)
.collection('People')
.get();
const tokens = [];
let sender;
for (const userRef of users.docs) {
const user = await firestore()
.collection('Users')
.doc(userRef.id)
.get();
if (message.userId === userRef.id) {
sender = user;
} else {
if (user.get('pushToken')) {
tokens.push(user.get('pushToken'));
}
}
}
return send(tokens, {
title: `${project.get('title')} : New message from ${sender.get(
'firstName'
)}`,
body: message.message,
icon: sender.get('avatar')
});
};
/**
* Task Added
* @param snap object
* @param context object
*/
export const taskAdded = async (change, context) => {
const task = change.after.data();
const projectId = task.projectId;
await setLastUpdated(projectId);
const activity: Activity = {
action: 'added',
model: 'Task',
modelId: task.id,
userId: task.userId,
createdAt: firestore.FieldValue.serverTimestamp()
};
if (change.before.exists === true) {
activity.action = 'edited';
}
await addActivity(activity, projectId);
const taskListRef = firestore()
.collection('Projects')
.doc(projectId)
.collection('TaskLists')
.doc(task.taskListId);
// TO DO - Update task counter
return firestore().runTransaction(t => {
return t.get(taskListRef).then(doc => {
const tasksCount = doc.data().tasksCount ? doc.data().tasksCount + 1 : 1;
t.update(taskListRef, { tasksCount: tasksCount });
});
});
};
/**
* Task Added
* @param snap object
* @param context object
*/
export const fileAdded = async (snap, context) => {
const file = snap.data();
const projectId = context.params.projectId;
await setLastUpdated(projectId);
return addActivity(
{
action: 'added',
model: 'File',
modelId: context.params.fileId,
userId: file.userId,
createdAt: firestore.FieldValue.serverTimestamp()
},
projectId
);
};
/**
* Task Added
* @param snap object
* @param context object
*/
export const commentAdded = async (snap, context) => {
const comment = snap.data();
const projectId = comment.projectId;
await setLastUpdated(projectId);
return addActivity(
{
action: 'added',
model: 'Comment',
modelId: comment.taskId,
userId: comment.userId,
createdAt: firestore.FieldValue.serverTimestamp()
},
projectId
);
};
/**
* Notebook Added
* @param snap object
* @param context object
*/
export const notebookAdded = async (change, context) => {
const notebook = change.after.data();
const projectId = notebook.projectId;
await setLastUpdated(projectId);
const activity: Activity = {
action: 'added',
model: 'Notebook',
modelId: notebook.id,
userId: notebook.userId,
createdAt: firestore.FieldValue.serverTimestamp()
};
if (change.before.exists === true) {
activity.action = 'edited';
}
return addActivity(activity, projectId);
};
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
// Services
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
import { Project } from './../../../../app.model';
@Component({
selector: 'app-project-overview',
templateUrl: './project-overview.component.html',
styleUrls: ['./project-overview.component.scss']
})
export class ProjectOverviewComponent implements OnInit {
public projectId: string;
public project: Project;
public activites = [];
public people: Array<object>;
constructor(
private route: ActivatedRoute,
private projectSer: ProjectService,
private alert: AlertService
) {}
ngOnInit() {
this.route.parent.params.subscribe(
params => {
this.projectId = params.projectId;
this.getProject();
this.getActivites();
this.getProjectPeople();
},
error => {
this.alert.showError(error.message);
}
);
}
public getProject() {
this.projectSer.get(this.projectId).subscribe(
project => {
this.project = project;
},
error => {
this.alert.showError(error.message);
}
);
}
public getActivites() {
this.projectSer.getActivites(this.projectId).subscribe(
activities => {
this.activites = activities;
},
error => {
this.alert.showError(error.message);
}
);
}
getProjectPeople() {
this.projectSer.getPeople(this.projectId).subscribe(people => {
this.people = people;
});
}
}
<file_sep>import {
trigger,
transition,
animate,
style,
state,
group
} from '@angular/animations';
export const SlideInOutAnimation = trigger('slideInOut', [
state('in', style({ height: '*', opacity: 0 })),
transition(':leave', [
style({ height: '*', opacity: 1 }),
group([
animate(300, style({ height: 0 })),
animate('200ms ease-in-out', style({ opacity: '0' }))
])
]),
transition(':enter', [
style({ height: '0', opacity: 0 }),
group([
animate(300, style({ height: '*' })),
animate('400ms ease-in-out', style({ opacity: '1' }))
])
])
]);
<file_sep>import { auth, firestore } from 'firebase-admin';
/**
* Function to add user
* @param request
* @param response
*/
export const add = async (request, response) => {
try {
if (!request.headers.authorization) { // check if the request has a token
throw new Error("No Auth token in Header");
}
if (!request.body.firstName ||
!request.body.surName ||
!request.body.role ||
!request.body.email ||
!request.body.password) { // check if request has all required fields
throw new Error("Include 'firstName', 'surName', 'role', 'email', 'password' in Body");
}
const idToken = request.headers.authorization;
const decodedToken = await auth().verifyIdToken(idToken);
const ownerId = decodedToken.uid;
const ownerData = await firestore().collection('Users').doc(ownerId).get();
if (ownerData.get('role') !== 'Administrator') { // checking user record if it contain role Administrator
throw new Error("You are not authorized to create a User. Only administrator can do the same");
}
const credentials = { email: request.body.email, password: <PASSWORD> };
// Creating the user with email and password
const userRecord = await auth().createUser(credentials);
// // Creating user record
await firestore().collection("Users").doc(userRecord.uid).set({
uId: userRecord.uid,
firstName: request.body.firstName,
surName: request.body.surName,
designation: request.body.designation || '',
role: request.body.role,
email: request.body.email,
phone: request.body.phone || '',
companyId: request.body.companyId,
createdAt: firestore.FieldValue.serverTimestamp(),
lastUpdatedAt: firestore.FieldValue.serverTimestamp()
});
return response.status(200).json({
userId: userRecord.uid,
message: 'User created'
});
} catch (error) {
return response.status(500).json({
message: error.message
});
}
}<file_sep>export interface Activity {
action: 'added' | 'edited' | 'deleted';
model: 'Task' | 'File' | 'Comment' | 'Notebook';
modelId: string;
userId: string;
createdAt: any;
}
<file_sep>import { Component, OnInit, Input, Inject } from '@angular/core';
import { MatDialog } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
import {
MatBottomSheet,
MatBottomSheetRef,
MAT_BOTTOM_SHEET_DATA
} from '@angular/material';
//Services
import { BillingService } from './../../../../services/billing.service';
import { ProjectService } from './../../../../services/project.service';
import { TaskService } from './../../../../services/task.service';
//Components
import { UpsertInvoiceComponent } from './../../components/upsert-invoice/upsert-invoice.component';
import { UpsertExpenseComponent } from './../../components/upsert-expense/upsert-expense.component';
import { ViewInvoiceComponent } from './../../components/view-invoice/view-invoice.component';
@Component({
selector: 'app-billing',
templateUrl: './billing.component.html',
styleUrls: ['./billing.component.scss']
})
export class BillingComponent implements OnInit {
@Input()
projectId: string;
public invoices = [];
public expenses = [];
public logs = [];
public total;
public activeView: 'time' | 'expense' = 'time';
constructor(
private dialog: MatDialog,
private route: ActivatedRoute,
private billing: BillingService,
private projectService: ProjectService,
private taskService: TaskService,
private bottomSheet: MatBottomSheet
) {}
ngOnInit() {
this.route.parent.params.subscribe(params => {
this.projectId = params.projectId;
});
this.getInvoices();
this.listExpenses();
this.listTimelogs();
}
moveToInvoice(): void {
// console.log(this.logs)
const selectedLogs = this.logs.filter(log => log.selected == true);
console.log(selectedLogs);
const bottomSheetRef = this.bottomSheet.open(BottomSheetInvoice, {
data: { projectId: this.projectId, logs: selectedLogs }
});
}
public addInvoice() {
const addDialog = this.dialog.open(UpsertInvoiceComponent, {
width: '500px',
// height: '800px',
data: { projectId: this.projectId }
});
}
public getInvoices() {
this.billing.getInvoices(this.projectId).subscribe(invoices => {
this.invoices = invoices;
});
}
public addExpense() {
const addDialog = this.dialog.open(UpsertExpenseComponent, {
width: '500px',
// height: '800px',
data: { projectId: this.projectId }
});
}
public listExpenses() {
this.billing.getexpenses(this.projectId).subscribe(expenses => {
this.expenses = expenses;
});
}
public listTimelogs() {
this.billing.getUnbilledTimelogs(this.projectId).subscribe(logs => {
this.logs = logs;
});
}
public getTotalTime(from, to) {
return this.projectService.calculateTimeDifference(from, to).toFixed(2);
}
public openInvoice(invoiceId){
const addDialog = this.dialog.open(ViewInvoiceComponent, {
width: '80%',
height: '90%',
data: { projectId: this.projectId, invoiceId: invoiceId }
});
}
}
/**
* @title Bottom Sheet Overview
*/
@Component({
selector: 'bottom-sheet-invoice',
templateUrl: './bottom-sheet-invoice.html'
})
export class BottomSheetInvoice {
public invoices = [];
constructor(
private bottomSheetRef: MatBottomSheetRef<BottomSheetInvoice>,
@Inject(MAT_BOTTOM_SHEET_DATA) public data,
private billingService: BillingService,
private taskService: TaskService
) {
this.getInvoices(this.data.projectId);
}
public createInvoice(event: MouseEvent): void {
console.log('harshga', this.data);
// this.bottomSheetRef.dismiss();
// event.preventDefault();
}
public getInvoices(projectId) {
this.billingService.getInvoices(projectId).subscribe(invoices => {
this.invoices = invoices;
});
}
public moveToInvoice(invoice) {
let selectedLogs = this.data.logs;
for (let index = 0; index < selectedLogs.length; index++) {
selectedLogs[index].invoiceId = invoice.invoiceId;
this.updateTimeLog(selectedLogs[index]);
}
this.bottomSheetRef.dismiss();
}
async updateTimeLog(time) {
await this.taskService.addTimeLog(time);
}
}
<file_sep>import { Directive, Input, ElementRef, OnInit } from '@angular/core';
import { ProjectService } from './../services/project.service';
@Directive({
selector: '[appNotebookName]'
})
export class NotebookNameDirective {
@Input()
projectId: string;
@Input()
taskId: string;
constructor(private el: ElementRef, private project: ProjectService) {}
ngOnInit() {
this.project.getNotebook(this.projectId, this.taskId).subscribe(notebook => {
if (!notebook) {
this.el.nativeElement.innerHTML = `Expired Notebook`;
} else if (notebook) {
this.el.nativeElement.innerHTML = `${notebook['title']}`;
} else {
this.el.nativeElement.innerHTML = `Expired Notebook`;
}
});
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { MatBottomSheet, MatBottomSheetRef } from '@angular/material';
import { AuthenticationService } from './../../../../services/authentication.service';
@Component({
selector: 'app-menu',
templateUrl: './menu.component.html',
styleUrls: ['./menu.component.scss']
})
export class MenuComponent implements OnInit {
constructor(
private auth: AuthenticationService,
// private router: Router,
private bottomSheetRef: MatBottomSheetRef<MenuComponent>
) { }
ngOnInit() {
}
openLink(link) {
console.log(link);
this.bottomSheetRef.dismiss();
// this.router.navigateByUrl(link)
}
public signOut() {
this.auth.signOut();
window.location.href = '/auth/login';
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { MatDialog } from '@angular/material';
import { ProjectService } from './../../../../services/project.service';
import { AddFileComponent } from './../../components/add-file/add-file.component';
@Component({
selector: 'app-project-files',
templateUrl: './project-files.component.html',
styleUrls: ['./project-files.component.scss']
})
export class ProjectFilesComponent implements OnInit {
public isAddFile: Boolean = false;
private projectId: string;
// public files = [];
public projectFiles = [];
constructor(
private project: ProjectService,
private route: ActivatedRoute,
private dialog: MatDialog
) {}
ngOnInit() {
this.route.parent.params.subscribe(params => {
this.projectId = params.projectId;
this.getFiles();
});
}
getFiles() {
this.project.getFiles(this.projectId).subscribe(files => {
this.projectFiles = files;
});
}
addFile(){
const dialogRef = this.dialog.open(AddFileComponent, {
height: '420px',
width: '700px',
data: { projectId: this.projectId, taskId: null }
});
}
// selectFiles(event) {
// this.files = Array.from(event.target.files);
// }
// /**
// * @description Upload Files
// */
// uploadFiles() {
// this.files.forEach((file, index) => {
// const task = this.project.addFile(this.projectId, file);
// task.subscribe(progress => {
// file.percent = this.getPercentage(
// progress.bytesTransferred,
// progress.totalBytes
// );
// if (file.percent == 100) {
// this.files.splice(index, 1);
// }
// });
// });
// }
// /**
// * Returns the Percentage
// * @param transferred Number
// * @param total Number
// */
// getPercentage(transferred, total) {
// if (transferred > 0) {
// return ((transferred / total) * 100).toFixed(2);
// } else {
// return 0;
// }
// }
// download(file) {
// return this.storage.ref(file.ref).getDownloadURL();
// }
}
<file_sep>import { Component, OnInit, Input } from '@angular/core';
import { MatDialog } from '@angular/material';
import { take } from 'rxjs/operators';
// Services
import { AlertService } from './../../../../services/alert.service';
import { ProjectService } from './../../../../services/project.service';
import { AuthenticationService } from './../../../../services/authentication.service';
import { UserService } from './../../../../services/user.service';
import { TimeLogComponent } from './../../components/time-log/time-log.component';
@Component({
selector: '[app-time-log-item]',
templateUrl: './time-log-item.component.html',
styleUrls: ['./time-log-item.component.scss']
})
export class TimeLogItemComponent implements OnInit {
@Input()
public log;
public total;
constructor(
private alert: AlertService,
private projectService: ProjectService,
private userService: UserService,
private auth: AuthenticationService,
private dialog: MatDialog
) {}
ngOnInit() {
this.total = this.projectService.calculateTimeDifference(
this.log.from,
this.log.to
);
this.total = this.total.toFixed(2);
}
/**
* Toggle the time as Billable
*/
public async toggleBillable() {
try {
const user = this.auth.user;
const userProfile = await this.userService
.getCurrentUser()
.pipe(take(1))
.toPromise();
if (userProfile['role'] == 'Administrator') {
} else if (user.uid !== this.log.userId) {
throw new Error(`You don't have the privilege to toggle this`);
}
this.log.isBillable = !this.log.isBillable;
await this.projectService.updateBillableStatus(
this.log.id,
this.log.projectId,
this.log.isBillable
);
this.alert.showSuccess(
`Time marked as ${
this.log.isBillable === true ? 'billable' : 'non billable'
}`
);
} catch (error) {
this.alert.showError(error.message);
}
}
public editTime() {
// this.dialog.open(TimeLogComponent)
this.dialog.open(TimeLogComponent, {
height: '420px',
width: '700px',
data: {
projectId: this.log.projectId,
taskId: this.log.taskId,
log: this.log
}
});
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { MatDialog } from '@angular/material';
import { AddTaskComponent } from './../../components/add-task/add-task.component';
import { TaskList, Task } from './../../../../app.model';
import { TimeLogComponent } from './../../components/time-log/time-log.component';
import { AddFileComponent } from './../../components/add-file/add-file.component';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { TaskService } from './../../../../services/task.service';
import { AlertService } from './../../../../services/alert.service';
import { ProjectService } from './../../../../services/project.service';
@Component({
selector: 'app-project-task',
templateUrl: './project-task.component.html',
styleUrls: ['./project-task.component.scss']
})
export class ProjectTaskComponent implements OnInit {
public isAddFile: Boolean = false;
public files = [];
public taskFiles = [];
public commentForm: FormGroup;
public projectId: string;
public timeLogs: Array<any> = [];
public comments: Array<any> = [];
public taskList: TaskList;
public task: Task;
public taskId: string;
public time;
constructor(
public dialog: MatDialog,
private route: ActivatedRoute,
private taskService: TaskService,
private alertService: AlertService,
private projectService: ProjectService,
private fb: FormBuilder
) {}
ngOnInit() {
this.commentForm = this.fb.group({
description: [null, Validators.required]
});
this.route.params.subscribe(params => {
this.taskId = params.taskId;
this.route.parent.params.subscribe(parentParams => {
this.projectId = parentParams.projectId;
this.getTask();
this.getTime();
this.getComment();
this.getFiles();
});
});
}
public logTime() {
this.dialog.open(TimeLogComponent, {
height: '420px',
width: '700px',
data: { projectId: this.projectId, taskId: this.taskId }
});
}
public startTimer() {
try {
this.taskService.startTimer(this.projectId, this.taskId);
} catch (error) {
alert(error.message);
}
// this.dialog.open(TimerComponent, {
// closeOnNavigation: false,
// disableClose: true,
// hasBackdrop: false,
// position: { bottom: '25px', left: '25px' },
// data: { projectId: this.projectId, taskId: this.taskId }
// });
}
selectFiles(event) {
this.files = Array.from(event.target.files);
}
/**
* @description Upload Files
*/
uploadFiles() {
this.dialog.open(AddFileComponent, {
height: '420px',
width: '700px',
data: { projectId: this.projectId, taskId: this.taskId }
});
}
/**
* Get the Time logs
*/
public getTime() {
this.taskService.getTaskTimeLogs(this.projectId, this.taskId).subscribe(
timeLogs => {
this.timeLogs = timeLogs;
this.time = this.calculateTimelogs(this.timeLogs);
},
error => {
this.alertService.showError(error.message);
}
);
}
public editTask() {
// const editDialog = this.dialog.open(,)
console.log('editTask', this.taskList, this.task, this.taskId);
const addDialog = this.dialog.open(AddTaskComponent, {
width: '700px',
data: {
projectId: this.projectId,
taskListId: this.taskList.id,
task: this.task
}
});
}
public calculateTimelogs(timeLogs) {
let billableTime = 0;
let nonBillabletime = 0;
for (let i = 0; i < timeLogs.length; i++) {
if (timeLogs[i].isBillable == true) {
const difference = this.projectService.calculateTimeDifference(
timeLogs[i].from,
timeLogs[i].to
);
billableTime = billableTime + difference;
} else {
const difference = this.projectService.calculateTimeDifference(
timeLogs[i].from,
timeLogs[i].to
);
nonBillabletime = nonBillabletime + difference;
}
}
const totalTime = billableTime + nonBillabletime;
return {
billableTime: billableTime.toFixed(2),
nonBillabletime: nonBillabletime.toFixed(2),
totalTime: totalTime.toFixed(2)
};
}
/**
* Posts the Comment
* @param form FormDirective
*/
public async postComment(form) {
try {
if (form.invalid) {
return false;
// throw new Error(`You shouldn't leave the comment field like that`);
}
const data = form.value;
data.taskId = this.taskId;
data.projectId = this.projectId;
this.taskService.addComment(data);
form.resetForm();
} catch (error) {
this.alertService.showError(error.message);
}
}
public getComment() {
this.taskService.getComments(this.projectId, this.taskId).subscribe(
comments => {
this.comments = comments;
},
error => {
this.alertService.showError(error.message);
}
);
}
public getTask() {
this.taskService.getTaskDetail(this.projectId, this.taskId).subscribe(
task => {
this.task = task;
this.getTaskList(this.task.taskListId);
},
error => {
this.alertService.showError(error.message);
}
);
}
public getTaskList(taskListId) {
this.taskService.getTaskListDetail(this.projectId, taskListId).subscribe(
taskList => {
this.taskList = taskList;
},
error => {
this.alertService.showError(error.message);
}
);
}
private getFiles() {
this.projectService.getTaskFiles(this.projectId, this.taskId).subscribe(
files => {
this.taskFiles = files;
},
error => {
this.alertService.showError(error.message);
}
);
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
// Services
import { UserService } from './../../../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.scss']
})
export class ListComponent implements OnInit {
public sort: string = 'firstName';
public people: Array<any> = [];
public isLoading: Boolean = true;
public orderDesc = true;
public term: string;
constructor(
private userService: UserService,
private route: ActivatedRoute,
private alertService: AlertService
) {}
ngOnInit() {
this.listPeople();
}
private listPeople() {
this.userService.list().subscribe(
users => {
this.people = users;
this.isLoading = false;
},
error => {
this.alertService.showError(error.message);
}
);
}
}
<file_sep>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { MomentModule } from 'ngx-moment';
// Modules
import { SharedModule } from './../shared/shared.module';
// Components
import { MainComponent } from './components/main/main.component';
import { ActivityComponent } from './pages/activity/activity.component';
import { MyChatComponent } from './pages/my-chat/my-chat.component';
import { ChatComponent } from './components/chat/chat.component';
const routes: Routes = [
{
path: '',
component: MainComponent,
children: [
{ path: 'activity', component: ActivityComponent },
{ path: 'chat', component: MyChatComponent },
// { path: 'add', component: AddComponent },
{ path: '**', pathMatch: 'full', redirectTo: 'activity' }
]
}
];
@NgModule({
imports: [
CommonModule,
ReactiveFormsModule,
FormsModule,
SharedModule,
MomentModule,
RouterModule.forChild(routes)
],
declarations: [
ActivityComponent,
MainComponent,
MyChatComponent,
ChatComponent
]
})
export class DashboardModule {}
<file_sep>import { Injectable } from '@angular/core';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFirestore } from 'angularfire2/firestore';
import { AlertService } from './alert.service';
@Injectable({
providedIn: 'root'
})
export class AuthenticationService {
private _user;
constructor(
private afAuth: AngularFireAuth,
private alert: AlertService,
private afs: AngularFirestore
) {
const user = this.afAuth.auth.currentUser;
this.user = user;
this.afAuth.user.subscribe(async user => {
// this.user = user;
try {
const token = await this.alert.getPermission();
this.alert.getPushMessage();
this.updatePushToken(token);
} catch (error) {
}
});
}
public set user(user) {
this._user = user;
}
public get user() {
return this._user;
}
public signOut() {
this.afAuth.auth.signOut();
}
/**
* Funtion will return current user token
*/
public getCurrentUserToken() {
return this.afAuth.auth.currentUser.getIdToken();
}
/**
* Update the User's push token
* @param token string
*/
public updatePushToken(token) {
const user = this.afs.doc(`Users/${this.user.uid}`);
user.set(
{
pushToken: token
},
{
merge: true
}
);
}
}
<file_sep>import { Component, OnInit, OnDestroy } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { AuthService } from './../../services/auth.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-reset-password',
templateUrl: './reset-password.component.html',
styleUrls: ['./reset-password.component.scss']
})
export class ResetPasswordComponent implements OnInit, OnDestroy {
public resetPasswordForm: FormGroup;
public isResetPasswordProgress: Boolean = false;
constructor(
private auth: AuthService,
private fb: FormBuilder,
private alert: AlertService
) {
this.resetPasswordForm = this.fb.group({
email: [null, [Validators.required, Validators.email]]
});
}
ngOnInit() {
document.body.style.marginBottom = '0';
}
ngOnDestroy() {
document.body.style.marginBottom = '60px';
}
/**
* Handles the Reset Password Form
* @param form FormGroup
*/
public async changePassword(form: FormGroup) {
try {
if (form.invalid) {
return false;
}
this.isResetPasswordProgress = true;
this.validateForm(form);
await this.auth.resetPassword(form.value.email);
this.alert.showSuccess('An email has been sent to your address');
this.isResetPasswordProgress = false;
} catch (error) {
this.isResetPasswordProgress = false;
this.alert.showError(error.message);
}
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.value.password !== form.value.confirmPassword) {
throw new Error('Password do not match');
}
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { Time } from './../../../../app.model';
import { ActivatedRoute } from '@angular/router';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
//Services
import { ProjectService } from './../../../../services/project.service';
import { ReportService } from './../../../../services/report.service';
@Component({
selector: 'app-project-time',
templateUrl: './project-time.component.html',
styleUrls: ['./project-time.component.scss']
})
export class ProjectTimeComponent implements OnInit {
public sortTimeForm: FormGroup;
public timeLogs: Array<Object> = [];
public time;
public projectId: string;
public users = [];
public projectUsers: Array<any> = [];
public nonBillabletime;
constructor(
private projectService: ProjectService,
private reportService: ReportService,
private route: ActivatedRoute,
private fb: FormBuilder
) {}
ngOnInit() {
this.sortTimeForm = this.fb.group({
billableOrNot: ['both'],
startDate: [null],
endDate: [null]
});
this.route.parent.params.subscribe(params => {
this.projectId = params.projectId;
this.getTime();
this.getProjectUsers();
});
}
public createPDF() {
this.reportService.generatePDF(this.timeLogs, this.projectId, this.sortTimeForm.value);
}
public getTime() {
this.projectService
.filterTimeLogs(this.sortTimeForm.value, this.projectId)
.subscribe(logs => {
console.log('test', this.users);
if (this.users.length > 0) {
logs = logs.filter(log => this.users.includes(log.userId));
}
this.timeLogs = logs;
this.time = this.projectService.calculateTimelogs(this.timeLogs);
});
}
public clearForm(form) {
this.users = [];
form.reset();
this.sortTimeForm.controls['billableOrNot'].setValue('both');
this.getTime();
}
public getProjectUsers() {
this.projectService.getPeople(this.projectId).subscribe(people => {
this.projectUsers = people;
});
}
}
<file_sep>export interface Message {
text: string;
creatorUID: string;
createdAt: any;
}<file_sep>import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'projectSort'
})
export class ProjectSortPipe implements PipeTransform {
transform(array: any, field?: any, orderDesc?: any): any {
array.sort((a: any, b: any) => {
if (a[field] > b[field]) {
return orderDesc ? -1 : 1;
} else if (a[field] < b[field]) {
return orderDesc ? 1 : -1;
} else {
return 0;
}
});
return array;
}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import * as moment from 'moment';
// Services
import { TaskService } from './../../../../services/task.service';
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
import { UserService } from './../../../../services/user.service';
@Component({
selector: 'app-time-log',
templateUrl: './time-log.component.html',
styleUrls: ['./time-log.component.scss']
})
export class TimeLogComponent implements OnInit {
public timeLogForm: FormGroup;
public isAdding: Boolean = false;
public projectUsers: Array<any> = [];
public isAdmin: Boolean = false;
constructor(
public dialogRef: MatDialogRef<TimeLogComponent>,
@Inject(MAT_DIALOG_DATA) public data,
private fb: FormBuilder,
private taskService: TaskService,
private alertService: AlertService,
private projectService: ProjectService,
private userService: UserService
) {}
ngOnInit() {
this.timeLogForm = this.fb.group({
id: [null],
date: [new Date(), Validators.required],
from: [null, Validators.required],
to: [null, Validators.required],
isBillable: [true],
description: [null],
userId: [null]
});
if (this.data.log) {
this.populateTimeLog(this.data.log);
}
this.getProjectUsers();
this.getUser();
}
private getUser() {
this.userService.getCurrentUser().subscribe(user => {
if (user) {
console.log('user', user);
this.isAdmin = user['role'] === 'Administrator';
if (this.isAdmin) {
this.dialogRef.updateSize('700px', '475px');
} else {
this.dialogRef.updateSize('700px', '420px');
}
}
});
}
public populateTimeLog(log) {
const timeLog = { ...log };
if (typeof timeLog.date.getMonth !== 'function') {
timeLog.date = moment.unix(timeLog.date.seconds).toDate();
}
this.timeLogForm.patchValue(timeLog);
}
public getProjectUsers = () => {
this.projectService
.getPeople(this.data.projectId)
.subscribe(people => (this.projectUsers = people));
};
public async addTimeLog(form: FormGroup) {
try {
if (this.timeLogForm.invalid) {
throw new Error('Please fill the required fields');
}
this.isAdding = true;
const diff = this.projectService.calculateTimeDifference(
this.timeLogForm.controls.from.value,
this.timeLogForm.controls.to.value
);
if (diff <= 0) {
throw new Error('End time should be greater than Start time');
}
const time = this.timeLogForm.value;
time.projectId = this.data.projectId;
time.taskId = this.data.taskId;
await this.taskService.addTimeLog(time);
this.isAdding = false;
this.alertService.showSuccess('Time log saved');
this.dialogRef.close();
} catch (error) {
this.isAdding = false;
this.alertService.showError(error.message);
}
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Project } from './../../../../app.model';
// Services
import { ProjectService } from './../../../../services/project.service';
import { UserService } from './../../../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-manage',
templateUrl: './manage.component.html',
styleUrls: ['./manage.component.scss']
})
export class ManageComponent implements OnInit {
public projectId: string;
public userRole: string;
public project: Project;
constructor(
private route: ActivatedRoute,
private projectService: ProjectService,
private userService: UserService,
private alertService: AlertService
) {}
ngOnInit() {
this.getUser();
this.route.params.subscribe(
params => {
this.projectId = params.projectId;
this.getProject(this.projectId);
},
error => {
this.alertService.showError(error.message);
}
);
}
public getProject(projectId) {
this.projectService.get(projectId).subscribe(
project => {
this.project = project;
},
error => {
this.alertService.showError(error.message);
}
);
}
private getUser() {
this.userService.getCurrentUser().subscribe(user => {
if (user) {
this.userRole = user['role'];
}
});
}
onActivate(event) {
const scrollToTop = window.setInterval(() => {
const pos = window.pageYOffset;
if (pos > 0) {
window.scrollTo(0, pos - 20); // how far to scroll on each step
} else {
window.clearInterval(scrollToTop);
}
}, 16);
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UserService } from './../../../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.scss']
})
export class ProfileComponent implements OnInit {
public person;
private userId;
constructor(private route: ActivatedRoute, private userService: UserService, private alertService: AlertService) { }
ngOnInit() {
this.route.params.subscribe(params => {
this.userId= params.uId;
this.getuserDetails();
});
}
private getuserDetails(){
this.userService.get(this.userId).subscribe(person => {
this.person = person;
}, error => {
this.alertService.showError(error.message);
})
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { Router } from '@angular/router';
// Services
import { ProjectService } from './../../../../services/project.service';
import { UserService } from './../../../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-add',
templateUrl: './add.component.html',
styleUrls: ['./add.component.scss']
})
export class AddComponent implements OnInit {
public addProjectForm: FormGroup;
public isAddingProject: Boolean = false;
public userFilter: string;
public administrators = [];
public managers = [];
public associates = [];
public employees = [];
public tagName: string = '';
constructor(
private fb: FormBuilder,
private user: UserService,
private projectService: ProjectService,
private alertService: AlertService,
private router: Router
) {}
ngOnInit() {
const featuresFormGroup = this.fb.group({
tasks: [false],
messaging: [false],
files: [false],
comments: [false],
billing: [false]
});
this.addProjectForm = this.fb.group({
title: [null, Validators.required],
caption: [null, Validators.required],
description: [null],
people: [[]],
tags: [[]],
startDate: [null],
endDate: [null]
});
this.user.list().subscribe(users => {
this.administrators = [];
this.employees = [];
users.forEach(user => {
switch (user.role) {
case 'Administrator':
this.administrators.push(user);
break;
default:
this.employees.push(user);
break;
}
});
});
}
public async createProject(form: FormGroup) {
try {
this.isAddingProject = true;
this.validateForm(form);
const project = form.value;
project.people = project.people.concat(
this.administrators.map(administrator => {
return administrator.uId;
})
);
await this.projectService.add(project);
this.isAddingProject = false;
this.alertService.showSuccess('Added Project Successfully');
this.router.navigateByUrl('/project');
} catch (error) {
this.alertService.showError(error.message);
}
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error('Complete the form before submitting');
}
}
public addPerson(personId) {
const existingPeoples = this.addProjectForm.get('people').value || [];
const index = existingPeoples.findIndex(id => id === personId);
if (index > -1) {
existingPeoples.splice(index, 1);
} else {
existingPeoples.push(personId);
}
this.addProjectForm.get('people').setValue(existingPeoples);
}
public addTags() {
if (this.tagName) {
const existingTags = this.addProjectForm.get('tags').value || [];
const index = existingTags.findIndex(id => id === this.tagName);
if (index === -1) {
existingTags.push(this.tagName);
}
this.tagName = '';
this.addProjectForm.get('tags').setValue(existingTags);
}
}
public removeTag(tagName) {
const existingTags = this.addProjectForm.get('tags').value || [];
const index = existingTags.findIndex(id => id === tagName);
if (index > -1) {
existingTags.splice(index, 1);
}
this.addProjectForm.get('tags').setValue(existingTags);
}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import * as moment from 'moment';
import { Project } from './../../../../app.model';
// Services
import { ProjectService } from './../../../../services/project.service';
import { TaskService } from './../../../../services/task.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-add-task',
templateUrl: './add-task.component.html',
styleUrls: ['./add-task.component.scss']
})
export class AddTaskComponent implements OnInit {
// @Input()
projectId: string;
// @Input()
taskListId: string;
public project: Project;
firstFormGroup: FormGroup;
secondFormGroup: FormGroup;
thirdFormGroup: FormGroup;
isAdding: Boolean = false;
public members = [];
constructor(
public dialogRef: MatDialogRef<AddTaskComponent>,
@Inject(MAT_DIALOG_DATA) public data,
private _formBuilder: FormBuilder,
private taskService: TaskService,
private alertService: AlertService,
private projectService: ProjectService
) {}
ngOnInit() {
this.projectId = this.data.projectId;
this.taskListId = this.data.taskListId;
this.projectService.get(this.projectId).subscribe(project => {
this.project = project;
});
this.firstFormGroup = this._formBuilder.group({
title: ['', Validators.required],
description: ['']
});
this.secondFormGroup = this._formBuilder.group({
people: [null, Validators.required]
});
this.thirdFormGroup = this._formBuilder.group({
startDate: [null],
deadline: [null]
});
if (this.data.task) {
this.populateForm(this.data.task);
}
this.getMembers();
}
/**
* Populate the Form with
* task data
* @param task Task
*/
private populateForm(task) {
this.firstFormGroup.controls.title.setValue(task.title);
this.firstFormGroup.controls.description.setValue(task.description);
this.secondFormGroup.controls.people.setValue(task.people);
if (task.deadline) {
this.thirdFormGroup.controls.deadline.setValue(
moment.unix(task.deadline.seconds).toDate()
);
}
if (task.startDate) {
this.thirdFormGroup.controls.startDate.setValue(
moment.unix(task.startDate.seconds).toDate()
);
}
}
public getMembers() {
this.projectService.getPeople(this.projectId).subscribe(
people => {
this.members = people;
},
error => {
this.alertService.showError(error.message);
}
);
}
public addTask() {
if (
this.firstFormGroup.invalid ||
this.secondFormGroup.invalid ||
this.thirdFormGroup.invalid
) {
return false;
}
const data = {
...this.firstFormGroup.value,
...this.secondFormGroup.value,
...this.thirdFormGroup.value
};
data.projectId = this.projectId;
data.taskListId = this.taskListId;
if (this.data.parentTaskId) {
data.parentTaskId = this.data.parentTaskId;
}
if (this.data.task) {
data.id = this.data.task.id;
} else {
data.status = 'todo';
}
try {
if (data.startDate && data.deadline) {
if (moment(data.deadline).diff(moment(data.startDate)) < 0) {
throw new Error(
'Deadline should be greater than or equal to start date'
);
}
}
this.isAdding = true;
this.validateForm(data);
this.taskService.add(data);
this.isAdding = false;
this.alertService.showSuccess('Task saved');
this.dialogRef.close();
} catch (error) {
this.alertService.showError(error.message);
}
}
public addPerson(personId) {
const existingPeoples = this.secondFormGroup.get('people').value || [];
const index = existingPeoples.findIndex(id => id === personId);
if (index > -1) {
existingPeoples.splice(index, 1);
} else {
existingPeoples.push(personId);
}
this.secondFormGroup.get('people').setValue(existingPeoples);
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error('Oh! Oh! Please fill the fields');
}
}
close() {
this.dialogRef.close();
}
}
<file_sep>import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/operators';
// Environment
import { environment } from '../../environments/environment';
import {
AngularFirestore,
AngularFirestoreCollection
} from 'angularfire2/firestore';
import * as firebaseApp from 'firebase/app';
import { User } from './../app.model';
import { AuthenticationService } from './authentication.service';
@Injectable({
providedIn: 'root'
})
export class UserService {
private collection: AngularFirestoreCollection<User>;
private _user;
constructor(
private auth: AuthenticationService,
private afs: AngularFirestore,
private http: HttpClient
) {
this.collection = this.afs.collection<User>('Users');
this.getCurrentUser().subscribe(user => {
this.user = user;
});
}
public set user(user) {
this._user = user;
}
public get user() {
return this._user;
}
public getCurrentUser() {
const user = this.auth.user;
return this.collection.doc(user.uid).valueChanges();
}
/**
* Adds a User
* @param user User
* TODO : Check whether current user is admin
*/
public async add(user: User) {
const token = await this.auth.getCurrentUserToken();
return this.http
.post(environment.cloud.apiUrl + '/addUser', user, {
headers: { Authorization: token }
})
.toPromise();
}
/**
* List the Collections
*/
public list() {
return this.collection.valueChanges();
}
/**
* Get the User
* @param userId string
*/
public get(userId: string) {
return this.collection.doc(userId).valueChanges();
}
public addProject(projectId, userId) {
const user = this.auth.user;
return this.collection
.doc(userId)
.collection('Projects')
.doc(projectId)
.set(
{
projectId: projectId,
createdAt: firebaseApp.firestore.FieldValue.serverTimestamp()
},
{ merge: true }
);
}
/**
* Returns the array of projectId's for a user
* @param userId string
*/
public getMyProjects() {
const userId = this.auth.user.uid;
return this.collection
.doc(userId)
.collection('Projects')
.valueChanges()
.pipe(
map(projects => {
// const projects = [];
// if (user['projects']) {
projects.forEach(project => {
project.activities = [];
// projects.push({
// id: project,
// activities: []
// });
});
// }
return projects;
})
);
}
/**
* Add a company
* @param company object
*/
public async addCompany(company) {
const companyId = this.afs.createId();
company.id = companyId;
company.createdAt = new Date();
company.lastUpdatedAt = new Date();
await this.afs.doc(`Companies/${companyId}`).set(company);
return companyId;
}
public getCompanies() {
return this.afs.collection('Companies').valueChanges();
}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
//Services
import { AlertService } from './../../../../services/alert.service';
import { BillingService } from './../../../../services/billing.service';
@Component({
selector: 'app-upsert-expense',
templateUrl: './upsert-expense.component.html',
styleUrls: ['./upsert-expense.component.scss']
})
export class UpsertExpenseComponent implements OnInit {
public expenseForm: FormGroup;
constructor(
private alertService: AlertService,
private fb: FormBuilder,
private billing: BillingService,
public dialogRef: MatDialogRef<UpsertExpenseComponent>,
@Inject(MAT_DIALOG_DATA) public data,
) { }
ngOnInit() {
this.expenseForm = this.fb.group({
expense: [null, Validators.required],
cost: [null, Validators.required],
date: [null, Validators.required],
description: [null]
});
}
public create(form: FormGroup) {
try {
if (form.invalid) {
return false;
// throw new Error(`You shouldn't leave the comment field like that`);
}
const expenseData = form.value;
expenseData.projectId = this.data.projectId;
this.billing.upsertExpense(expenseData);
this.alertService.showSuccess('Created Invoice');
this.dialogRef.close();
} catch (error) {
this.alertService.showError(error.message);
}
}
closeDialog(): void {
this.dialogRef.close();
}
}
<file_sep>import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Router } from '@angular/router';
import { UserService } from './../services/user.service';
import { AlertService } from './../services/alert.service';
@Injectable({
providedIn: 'root'
})
export class RoleGuard implements CanActivate {
constructor(
private user: UserService,
private router: Router,
private alert: AlertService
) {
}
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
let roles = next.data["roles"] as Array<string>;
let redirectPath = next.data['redirectPath'];
return this.user.getCurrentUser().pipe(
map((user: any) => {
if (roles.includes(user.role)) {
return true;
} else {
this.alert.showError('You are not authorized to access that resource');
this.router.navigate([redirectPath]);
}
})
);
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialog } from '@angular/material';
import { PromptComponent } from './../../../shared/components/prompt/prompt.component';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
// Services
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-project-add-notebook',
templateUrl: './project-add-notebook.component.html',
styleUrls: ['./project-add-notebook.component.scss']
})
export class ProjectAddNotebookComponent implements OnInit {
public projectId;
private notebookId;
public notebook;
public users: Array<any> = [];
public projectPeople = [];
public notebookForm: FormGroup;
constructor(
private route: ActivatedRoute,
private projectService: ProjectService,
private alertService: AlertService,
private fb: FormBuilder,
private router: Router,
private dialog: MatDialog
) {}
ngOnInit() {
this.notebookForm = this.fb.group({
id: [null],
title: [null, Validators.required],
description: [null, Validators.required],
people: [null]
});
this.route.parent.params.subscribe(params => {
this.projectId = params.projectId;
this.route.params.subscribe(params => {
this.notebookId = params.notebookId;
if (this.notebookId) {
this.editNotebook();
}
});
this.getMembers();
});
}
public async addnoteBook(form: FormGroup) {
try {
const data = form.value;
if (form.invalid) {
return false;
}
data.projectId = this.projectId;
await this.projectService.saveNoteBook(data);
this.alertService.showSuccess('Notebook saved');
this.router.navigate(['project/manage/', this.projectId, 'diaries']);
} catch (error) {
this.alertService.showError(error.message);
}
}
public getProject() {
this.projectService.get(this.projectId).subscribe(
project => {
this.users = project.people;
},
error => {
this.alertService.showError(error.message);
}
);
}
public getMembers() {
this.projectService.getPeople(this.projectId).subscribe(
people => {
this.users = people;
},
error => {
this.alertService.showError(error.message);
}
);
}
/**
* Add or Remove a Person
* @param personId string
*/
public addOrRemovePerson(personId) {
const projectPeople = this.notebookForm.controls['people'].value || [];
const index = projectPeople.findIndex(id => id === personId);
if (index > -1) {
projectPeople.splice(index, 1);
} else {
projectPeople.push(personId);
}
this.notebookForm.controls['people'].setValue(projectPeople);
}
public navigateToNotebooks() {
this.dialog
.open(PromptComponent, {
width: '250px'
})
.afterClosed()
.subscribe(choice => {
if (choice) {
this.router.navigate(['project/manage', this.projectId, 'diaries']);
} else {
}
});
}
public editNotebook() {
this.projectService.getNotebook(this.projectId, this.notebookId).subscribe(
notebook => {
this.notebook = notebook;
this.notebookForm.patchValue(notebook);
},
error => {
this.alertService.showError(error.message);
}
);
}
}
<file_sep>import { Directive, ElementRef, Input, OnInit } from '@angular/core';
import { UserService } from './../services/user.service';
@Directive({
selector: '[appUserAvatar]'
})
export class UserAvatarDirective implements OnInit {
@Input('appUserAvatar')
userId: string;
constructor(private el: ElementRef, private user: UserService) {
el.nativeElement.src = '/assets/spinner.gif';
}
ngOnInit() {
if (!this.userId) {
this.el.nativeElement.src = `/assets/user.png`;
return false;
}
this.user.get(this.userId).subscribe(user => {
if (!user) {
this.el.nativeElement.src = `/assets/user.png`;
} else if (user['avatar']) {
this.el.nativeElement.src = user['avatar'];
this.el.nativeElement.title = user['role'];
} else {
this.el.nativeElement.title = user['role'];
this.el.nativeElement.src = `/assets/user.png`;
}
});
}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { ProjectService } from './../../../../services/project.service';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
@Component({
selector: 'app-add-file',
templateUrl: './add-file.component.html',
styleUrls: ['./add-file.component.scss']
})
export class AddFileComponent implements OnInit {
public files = [];
constructor(
private project: ProjectService,
public dialogRef: MatDialogRef<AddFileComponent>,
@Inject(MAT_DIALOG_DATA) public data
) {}
ngOnInit() {
}
selectFiles(event) {
this.files = this.files.concat(Array.from(event.target.files));
}
/**
* @description Upload Files
*/
uploadFiles() {
this.files.forEach((file, index) => {
const task = this.project.addFile(this.data.projectId, file, this.data.taskId);
task.subscribe(progress => {
file.percent = this.getPercentage(
progress.bytesTransferred,
progress.totalBytes
);
// if (file.percent == 100) {
// this.files.splice(index, 1);
// }
});
});
}
/**
* Returns the Percentage
* @param transferred Number
* @param total Number
*/
getPercentage(transferred, total) {
if (transferred > 0) {
return ((transferred / total) * 100).toFixed(2);
} else {
return 0;
}
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { UserService } from './../../../../services/user.service';
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
import { SlideInOutAnimation } from './../../../../app.animations';
@Component({
selector: 'app-activity',
templateUrl: './activity.component.html',
styleUrls: ['./activity.component.scss'],
animations: [SlideInOutAnimation]
})
export class ActivityComponent implements OnInit {
public projects = [];
constructor(
private user: UserService,
private project: ProjectService,
private alert: AlertService
) {}
ngOnInit() {
this.user.getMyProjects().subscribe(
projects => {
this.projects = projects;
this.getProjectActivities();
},
error => {
this.alert.showError(error.message);
}
);
}
/**
* Get the Project Activities
* @param projects Array<projectId>
*/
getProjectActivities() {
for (let project of this.projects) {
this.project.getActivites(project.projectId).subscribe(
activities => {
project.activities = activities;
project.lastActivityAt = Math.max.apply(
Math,
activities.map(function(o) {
return o.createdAt.seconds;
})
);
this.projects = this.projects.sort((a: any, b: any) => {
return b.lastActivityAt - a.lastActivityAt;
});
if (this.projects.length > 0) {
this.projects[0].expanded = true;
for (let i = 1; i < this.projects.length; i++) {
this.projects[i].expanded = false;
}
}
},
error => {
this.alert.showError(error.message);
}
);
}
}
}
<file_sep>import { ProjectNameDirective } from './project-name.directive';
describe('ProjectNameDirective', () => {
it('should create an instance', () => {
const directive = new ProjectNameDirective();
expect(directive).toBeTruthy();
});
});
<file_sep>import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { messaging } from 'firebase';
@Injectable({
providedIn: 'root'
})
export class AlertService {
public messaging;
constructor(private snackBar: MatSnackBar) {
try {
this.messaging = messaging();
} catch (error) {
this.showError('Push notifications is not supported in this browser');
}
}
showError(message) {
this.snackBar.open(message, 'Close', {
verticalPosition: 'bottom',
horizontalPosition: 'right',
duration: 3000
});
}
showSuccess(message) {
this.snackBar.open(message, 'Close', {
verticalPosition: 'bottom',
horizontalPosition: 'right',
duration: 5000
});
}
/**
* Get Permission for Push and store
* the user
*/
getPermission() {
return this.messaging.requestPermission().then(() => {
return this.messaging.getToken();
});
}
getPushMessage() {
this.messaging.onMessage(payload => {
this.showSuccess(
`${payload.notification.title} : ${payload.notification.body}`
);
// this.currentMessage.next(payload)
});
}
}
<file_sep>import { FileNameDirective } from './file-name.directive';
describe('FileNameDirective', () => {
it('should create an instance', () => {
const directive = new FileNameDirective();
expect(directive).toBeTruthy();
});
});
<file_sep>import { Component, OnInit } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { Router } from '@angular/router';
import {
MatSnackBar,
MatDialog,
MatDialogRef,
MAT_DIALOG_DATA
} from '@angular/material';
// Components
import { AddCompanyComponent } from './../../../shared/components/add-company/add-company.component';
// Services
import { UserService } from './../../../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-add',
templateUrl: './add.component.html',
styleUrls: ['./add.component.scss']
})
export class AddComponent implements OnInit {
public companies;
public addUserForm: FormGroup;
public isAddingUser: Boolean = false;
constructor(
public dialog: MatDialog,
private userService: UserService,
private fb: FormBuilder,
private alert: AlertService,
private router: Router
) {}
ngOnInit() {
this.addUserForm = this.fb.group({
firstName: [null, Validators.required],
surName: [null, Validators.required],
designation: [null],
role: [null],
companyId: [null],
companyName: [null],
email: [null, [Validators.required, Validators.email]],
password: [null, Validators.required],
phone: [null]
});
this.companies = this.userService.getCompanies();
}
public async createUser(form) {
try {
this.isAddingUser = true;
if (form.invalid) {
this.isAddingUser = false;
return false;
}
const user = form.value;
if (user.role == true) {
user.role = 'Administrator';
} else {
user.role = 'Employee';
}
await this.userService.add(form.value);
this.alert.showSuccess('Created User Succcessfully');
this.isAddingUser = false;
this.router.navigateByUrl('/dashboard');
} catch (error) {
this.isAddingUser = false;
this.alert.showError(error.message);
}
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error('Please fill all the fields');
}
}
public addCompany() {
const dialogRef = this.dialog.open(AddCompanyComponent, {
height: '420px',
width: '700px'
// data: { projectId: this.projectId, taskId: this.taskId }
});
}
}
<file_sep>import { Directive, ElementRef, Input, OnInit, OnChanges } from '@angular/core';
import { UserService } from './../services/user.service';
@Directive({
selector: '[appUserName]'
})
export class UserNameDirective implements OnChanges {
@Input('appUserName')
userId: string;
constructor(private el: ElementRef, private user: UserService) {
el.nativeElement.innerHTML = 'fetching...';
}
// ngOnInit() {
// if (!this.userId) {
// this.el.nativeElement.innerHTML = `User retired`;
// return false;
// }
// this.user.get(this.userId).subscribe(user => {
// if (!user) {
// this.el.nativeElement.innerHTML = `User retired`;
// } else {
// this.el.nativeElement.innerHTML = `${user['firstName']}`;
// }
// });
// }
ngOnChanges(){
if (!this.userId) {
this.el.nativeElement.innerHTML = `User retired`;
return false;
}
this.user.get(this.userId).subscribe(user => {
if (!user) {
this.el.nativeElement.innerHTML = `User retired`;
} else {
this.el.nativeElement.innerHTML = `${user['firstName']}`;
}
});
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { TaskService } from './../../services/task.service';
@Component({
selector: 'app-authenticated',
templateUrl: './authenticated.component.html',
styleUrls: ['./authenticated.component.scss']
})
export class AuthenticatedComponent implements OnInit {
public timers = [];
constructor(private taskService: TaskService) {}
ngOnInit() {
this.taskService.activeTimers.subscribe(timers => {
console.log(timers);
this.timers = timers;
});
}
}
<file_sep>import { Injectable } from '@angular/core';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFirestore } from 'angularfire2/firestore';
import { AuthenticationModule } from './../authentication.module';
@Injectable({
providedIn: 'root'
})
export class AuthService {
constructor(private afAuth: AngularFireAuth, private afs: AngularFirestore) {}
/**
* Function will authenticate user with email and password
* @param {string} email
* @param {string} password
*/
public signIn(email: string, password: string) {
return this.afAuth.auth.signInWithEmailAndPassword(email, password);
}
/**
* Creates a new user email, full name and password
* @param {string} email
* @param {string} password
* @param {string} fullName
*/
public signUp(email: string, password: string, fullName: string) {
return this.afAuth.auth.createUserWithEmailAndPassword(email, password);
}
/**
* Function sends an email to provided mailId with a link to reset password
* @param {string} email
*/
public resetPassword(email: string) {
return this.afAuth.auth.sendPasswordResetEmail(email);
}
}
<file_sep>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MomentModule } from 'ngx-moment';
import { HeaderComponent } from './components/header/header.component';
import { RouterModule } from '@angular/router';
import { PickerModule } from '@ctrl/ngx-emoji-mart';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatMenuModule } from '@angular/material/menu';
import { MatDialogModule } from '@angular/material/dialog';
import { MatListModule } from '@angular/material/list';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { FooterComponent } from './components/footer/footer.component';
import { LoadingComponent } from './components/loading/loading.component';
import { ProfileBadgeComponent } from './components/profile-badge/profile-badge.component';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { UserNameDirective } from './../../directives/user-name.directive';
import { UserAvatarDirective } from './../../directives/user-avatar.directive';
import { TaskNameDirective } from './../../directives/task-name.directive';
import { NotebookNameDirective } from './../../directives/notebook-name.directive';
import { ProjectNameDirective } from './../../directives/project-name.directive';
import { ActivityItemComponent } from './components/activity-item/activity-item.component';
import { AddCompanyComponent } from './components/add-company/add-company.component';
import { PromptComponent } from './components/prompt/prompt.component';
import { TimerComponent } from './components/timer/timer.component';
// Pipes
import { FilterPipe } from './../../pipes/filter.pipe';
import { ProjectSortPipe } from './../../pipes/project-sort.pipe';
import { MenuComponent } from './components/menu/menu.component';
const materialModules = [
MatBottomSheetModule,
MatToolbarModule,
MatMenuModule,
MatDialogModule,
MatListModule,
MatSnackBarModule,
MatTooltipModule,
MatAutocompleteModule,
MatSlideToggleModule,
MatCheckboxModule
];
const necessaryModules = [ReactiveFormsModule, FormsModule, MomentModule];
@NgModule({
imports: [
CommonModule,
MomentModule,
...materialModules,
...necessaryModules,
RouterModule,
PickerModule
],
declarations: [
HeaderComponent,
FooterComponent,
LoadingComponent,
ProfileBadgeComponent,
UserNameDirective,
UserAvatarDirective,
TaskNameDirective,
NotebookNameDirective,
ProjectNameDirective,
ActivityItemComponent,
AddCompanyComponent,
PromptComponent,
FilterPipe,
ProjectSortPipe,
MenuComponent,
TimerComponent
],
exports: [
HeaderComponent,
FooterComponent,
LoadingComponent,
ProfileBadgeComponent,
ActivityItemComponent,
UserNameDirective,
UserAvatarDirective,
TaskNameDirective,
NotebookNameDirective,
ProjectNameDirective,
FilterPipe,
ProjectSortPipe,
...materialModules,
...necessaryModules,
PickerModule
],
entryComponents: [AddCompanyComponent, PromptComponent, MenuComponent]
})
export class SharedModule {}
<file_sep>import { Component, OnInit } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { AuthService } from './../../services/auth.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.scss']
})
export class RegisterComponent implements OnInit {
public registerForm: FormGroup;
public isRegisterProgress: Boolean = false;
constructor(
private auth: AuthService,
private fb: FormBuilder,
private alert: AlertService
) {
this.registerForm = this.fb.group({
email: [null, [Validators.required, Validators.email]],
fullName: [null, Validators.required],
password: [null, Validators.required],
confirmPassword: [null, Validators.required]
});
}
ngOnInit() {}
/**
* Handles the Register submission
* @param form FormGroup
*/
public async submitRegister(form: FormGroup) {
try {
this.isRegisterProgress = true;
this.validateForm(form);
await this.auth.signUp(
form.value.email,
form.value.password,
form.value.fullName
);
this.alert.showSuccess('Registered Successfully');
this.isRegisterProgress = false;
} catch (error) {
this.isRegisterProgress = false;
this.alert.showError(error.message);
}
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error('Please Enter valid input');
}
if (form.value.password !== form.value.confirmPassword) {
throw new Error('Password do not match');
}
}
}
<file_sep>import { Component, OnInit, Inject } from '@angular/core';
// import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { timer } from 'rxjs';
import * as moment from 'moment';
@Component({
selector: 'app-timer',
templateUrl: './timer.component.html',
styleUrls: ['./timer.component.scss']
})
export class TimerComponent implements OnInit {
public startTime = moment().utc();
public duration = moment.duration();
private source = timer(1000, 1000);
public timer;
public isPaused: boolean = false;
public isCollapsed: boolean = false;
constructor(
// public dialogRef: MatDialogRef<TimerComponent>,
// @Inject(MAT_DIALOG_DATA) public data
) {}
ngOnInit() {
// this.dialogRef.updatePosition({ bottom: '25px', left: '25px' });
this.source.subscribe(val => {
if (this.isPaused === false) {
this.duration.add(1, 'second');
}
this.timer = moment
.utc(this.duration.as('milliseconds'))
.format('HH:mm:ss');
});
}
toggleTimer() {
this.isPaused = !this.isPaused;
}
markStart() {
// const data = {
// projectId : this.data.projectId,
// taskId : this.data.taskId,
// startTime : this.startTime,
// duration : this.duration,
// };
}
}
<file_sep>import { UserAvatarDirective } from './user-avatar.directive';
describe('UserAvatarDirective', () => {
it('should create an instance', () => {
const directive = new UserAvatarDirective();
expect(directive).toBeTruthy();
});
});
<file_sep>import { Injectable } from '@angular/core';
import {
AngularFirestore,
AngularFirestoreCollection
} from 'angularfire2/firestore';
import { AuthenticationService } from './authentication.service';
import { Task, TaskList, Time, Comment } from './../app.model';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class TaskService {
public activeTimers: BehaviorSubject<Array<any>> = new BehaviorSubject([]);
private _projectId: string;
private collection: AngularFirestoreCollection<Task>;
private taskListCollection: AngularFirestoreCollection<TaskList>;
// private timeLogCollection: AngularFirestoreCollection<Time>;
// private commentCollection: AngularFirestoreCollection<Comment>;
constructor(
private afs: AngularFirestore,
private auth: AuthenticationService
) {}
/**
* Set the Project ID
*/
set project(projectId: string) {
this.collection = this.afs.collection<Task>(
`Projects/${projectId}/Tasks`,
ref => ref.orderBy('createdAt', 'desc')
);
this.taskListCollection = this.afs.collection<TaskList>(
`Projects/${projectId}/TaskLists`,
ref => ref.orderBy('createdAt', 'desc')
);
this._projectId = projectId;
}
/**
* Add or update a task
* @param task Task
*/
public add(task: Task) {
let taskId;
if (task.id) {
taskId = task.id;
} else {
taskId = this.afs.createId();
task.createdAt = new Date();
task.userId = this.auth.user.uid;
}
task.lastUpdatedAt = new Date();
task.id = taskId;
return this.afs
.collection('Projects')
.doc(task.projectId)
.collection('Tasks')
.doc(taskId)
.set(task, { merge: true });
}
/**
* Return the Task list
*/
public list(taskListId) {
const collection = this.afs.collection<Task>(
`Projects/${this._projectId}/Tasks`,
ref =>
ref.orderBy('createdAt', 'desc').where('taskListId', '==', taskListId)
);
return collection.valueChanges();
}
/**
* Update the Task status
* @param taskId string
* @param status string
*/
public updateStatus(taskId, status) {
this.afs
.collection(`Projects/${this._projectId}/Tasks`)
.doc(taskId)
.update({
status
});
}
/**
* Add / Update a Task List
* @param taskList TaskList
* @author Sharan (Zweck)
*/
public saveTaskList(taskList: TaskList) {
const taskListId = taskList.id ? taskList.id : this.afs.createId();
if (!taskList.id) {
taskList.createdAt = new Date();
taskList.userId = this.auth.user.uid;
taskList.id = taskListId;
}
taskList.lastUpdatedAt = new Date();
return this.taskListCollection
.doc(taskListId)
.set(taskList, { merge: true });
}
public getTaskLists() {
return this.taskListCollection.valueChanges();
}
/**
* Update the Finished status for
* a tasklist
* @param taskList TaskList
*/
public toggleFinished(taskList) {
return this.taskListCollection.doc(taskList.id).update({
isCompleted: taskList.isCompleted ? !taskList.isCompleted : true
});
}
/**
* @description Saves a Time Logs
* @param time Time
* @param userId String (Optional)
*/
public addTimeLog(time: Time) {
let timeId;
if (!time.id) {
timeId = this.afs.createId();
time.createdAt = new Date();
time.id = timeId;
time.invoiceId = null;
} else {
timeId = time.id;
}
if (!time.userId) {
time.userId = this.auth.user.uid;
}
time.lastUpdatedAt = new Date();
const timeLogCollection = this.afs.collection<Time>(
`Projects/${time.projectId}/Time`
);
return timeLogCollection.doc(timeId).set(time, { merge: true });
}
public getTaskTimeLogs(projectId, taskId) {
const timeLogCollection = this.afs.collection<Time>(
`Projects/${projectId}/Time`,
ref => ref.orderBy('createdAt', 'desc').where('taskId', '==', taskId)
);
return timeLogCollection.valueChanges();
}
/**
* Adds a comment object
* @param comment Comment
*/
public addComment(comment: Comment) {
const commentId = this.afs.createId();
comment.userId = this.auth.user.uid;
comment.id = commentId;
comment.createdAt = new Date();
comment.lastUpdatedAt = new Date();
const commentCollection = this.afs.collection<Comment>(
`Projects/${comment.projectId}/Tasks/${comment.taskId}/Comments`
);
return commentCollection.doc(commentId).set(comment);
}
/**
* Get Comments for a Task
* @param projectId string
* @param taskId string
*/
public getComments(projectId, taskId) {
const commentCollection = this.afs.collection<Comment>(
`Projects/${projectId}/Tasks/${taskId}/Comments`,
ref => ref.orderBy('createdAt', 'asc')
);
return commentCollection.valueChanges();
}
/**
* Return the details of a task list
* @param projectId
* @param taskListId
*/
public getTaskListDetail(projectId, taskListId) {
const collection = this.afs.doc<TaskList>(
`Projects/${projectId}/TaskLists/${taskListId}`
);
return collection.valueChanges();
}
/**
* Return the details of a task
* @param projectId
* @param taskId
*/
public getTaskDetail(projectId, taskId) {
const collection = this.afs.doc<Task>(
`Projects/${projectId}/Tasks/${taskId}`
);
return collection.valueChanges();
}
public updateProgress(data) {}
public startTimer(projectId, taskId) {
const currentTimers = this.activeTimers.value;
// if (currentTimers.length >= 3) {
// throw new Error('You cannot have more than 3 active timers');
// }
// TODO check for duplication
// projectId: this.projectId, taskId: this.taskId
this.activeTimers.next([
...currentTimers,
{
projectId,
taskId
}
]);
}
}
<file_sep>import { Component, OnInit, OnDestroy } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { Router } from '@angular/router';
import { AuthService } from './../../services/auth.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit, OnDestroy {
public loginForm: FormGroup;
public isLoginInProgress: Boolean = false;
constructor(
private auth: AuthService,
private fb: FormBuilder,
private alert: AlertService,
private router: Router
) {
this.loginForm = this.fb.group({
email: [null, [Validators.required, Validators.email]],
password: [null, Validators.required]
});
}
ngOnInit() {
document.body.style.marginBottom = '0';
}
ngOnDestroy() {
document.body.style.marginBottom = '60px';
}
/**
* Handles the Login submission
* @param form FormGroup
*/
public async submitLogin(form: FormGroup) {
try {
if (form.invalid) {
return false;
}
this.isLoginInProgress = true;
// Login with Email and Password
await this.auth.signIn(form.value.email, form.value.password);
this.alert.showSuccess('Welcome Back');
this.router.navigateByUrl('/dashboard');
this.isLoginInProgress = false;
} catch (error) {
this.isLoginInProgress = false;
this.alert.showError(error.message);
}
}
}
<file_sep>export interface Project {
id: String;
title: String;
caption: String;
description: String;
people: Array<string>;
features: {
tasks: Boolean;
messaging: Boolean;
files: Boolean;
comments: Boolean;
reports: Boolean;
};
tags: Array<string>;
status: 'active' | 'archived';
startDate: any;
endDate: any;
createdAt: any;
lastUpdated: any;
}
export interface User {
firstName: string;
surName: string;
designation?: string;
role: 'Administrator' | 'Manager' | 'Associate';
email: string;
password: string;
phone?: number;
updatedAt: any;
createdAt?: Date;
lastUpdatedAt?: Date;
}
export interface TaskList {
id: string;
userId: String;
title: string;
projectId: string;
createdAt: Date;
lastUpdatedAt: Date;
isCompleted: Boolean;
}
export interface Task {
id: string;
userId: String;
projectId: string;
taskListId: string;
parentTaskId: string;
title: string;
description?: string;
people: Array<string>;
deadline?: Date;
status: 'todo' | 'doing' | 'completed';
createdAt: Date;
lastUpdatedAt: Date;
}
export interface Time {
id: String;
taskId: string;
projectId: String;
taskListId: string;
userId: string;
invoiceId: string | null;
from: String;
to: String;
date: Date;
description: string;
isBillable: Boolean;
isAlreadyBilled: Boolean;
createdAt: Date;
lastUpdatedAt: Date;
}
export interface Comment {
id: String;
userId: String;
description: String;
createdAt: Date;
projectId: String;
taskId: String;
lastUpdatedAt: Date;
}
export interface Notebook {
id: String;
userId: String;
projectId: String;
title: String;
description: String;
people?: Array<string>;
createdAt: Date;
lastUpdatedAt: Date;
}
export interface ProjectChat {
id: String;
userId: String;
projectId: String;
message: String;
createdAt: Date;
lastUpdatedAt: Date;
}
export interface Activity {
action: 'added' | 'edited' | 'deleted';
model: 'Task' | 'File' | 'Comment' | 'Notebook';
modelId: string;
userId: string;
createdAt: any;
}
export interface Invoice {
invoiceId: string;
projectId: string;
date: Date;
currency: string;
Pricing: string;
finalPrice?: string;
createdAt: Date;
lastUpdatedAt: Date;
}
export interface Expense {
expense: string;
userId: String;
expenseId: string;
projectId: string;
cost: string;
date: Date;
description?: String;
createdAt: Date;
lastUpdatedAt: Date;
}
export const logoData = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWMAAACxCAYAAAARQ9xxAAAACXBIWX
MAAAsTAAALEwEAmpwYAAAgAElEQVR42u19CVwUR9p+eyuKKIq3EMQDDwxRwSMaVkWNGzWJVzwSl9
W/q5uNR7JRYz6zyZe4SdT97Xrs5xGzamI81uARj3iA94U3niCnHKKADALxAtF/Pc0UlmX3MAPdzQ
zU8/uNM4MzPd1VXU8971tvvW+Fp0+fSgICAgICpYuKogkEBAQEBBkLCAgICAgyFhAQEBBkLCAgIC
<KEY>IH
nrWqFCBenJkydQxPIz3uMB3jQrZROehw0btmL+/PmfCjI<KEY>
<KEY>`;
<file_sep>import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { AngularFireAuth } from 'angularfire2/auth';
// Services
import { MessageService } from './../../services/message.service';
// Models
import { Message } from '../../message.model';
interface ShoutBox {
loading: boolean;
empty: boolean;
}
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
public messages: Array<Message> = [];
public userId: string;
public sendMessageForm: FormGroup;
public shoutBox: ShoutBox;
@ViewChild('messageContainer')
messageContainer: ElementRef;
constructor(
private fb: FormBuilder,
private afAuth: AngularFireAuth,
private messageService: MessageService
) {
this.sendMessageForm = this.fb.group({
message: [null, Validators.minLength]
});
}
ngOnInit() {
this.shoutBox = {
loading: true,
empty: false
};
this.afAuth.user.subscribe(user => {
this.userId = user.uid;
});
this.messageService.getMessages().subscribe(messages => {
this.messages = messages.reverse();
this.shoutBox.loading = false;
this.shoutBox.empty = this.messages.length === 0;
// Scroll the container to bottom
setTimeout(() => {
this.messageContainer.nativeElement.scrollTop = this.messageContainer.nativeElement.scrollHeight;
}, 100);
});
}
public async insertIntoMessage() {
try {
this.validateMessage(this.sendMessageForm);
const message: Message = {
text: this.sendMessageForm.controls.message.value,
creatorUID: this.userId,
createdAt: Date.now()
};
await this.messageService.sendMessage(message);
this.sendMessageForm.reset();
} catch (error) {}
}
private validateMessage(form) {
if (form.invalid) {
throw new Error('Oh!Oh! Please fill the Field');
}
}
}
<file_sep>import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
const serviceAccount = require('./../keys/crew-9d52d-firebase-adminsdk-bzxqg-b52c8d57e1.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'https://crew-9d52d.firebaseio.com'
});
const cors = require('cors')({ origin: true });
// Functions
import { add } from './controllers/user';
import { peopleAdded, peopleRemoved } from './controllers/people';
import {
messageAdded,
commentAdded,
taskAdded,
fileAdded,
notebookAdded,
projectRemoved
} from './controllers/project';
export const addUser = functions.https.onRequest((request, response) => {
cors(request, response, () => {
return add(request, response);
});
});
// Project Triggers
export const projectMessageAdded = functions.firestore
.document('Projects/{projectId}/Messages/{messageId}')
.onCreate(messageAdded);
export const projectTaskAdded = functions.firestore
.document('Projects/{projectId}/Tasks/{taskId}')
.onWrite(taskAdded);
export const projectFileAdded = functions.firestore
.document('Projects/{projectId}/Files/{fileId}')
.onCreate(fileAdded);
export const projectNotebookAdded = functions.firestore
.document('Projects/{projectId}/Notebooks/{notebookId}')
.onWrite(notebookAdded);
export const projectCommentAdded = functions.firestore
.document('Projects/{projectId}/Tasks/{taskId}/Comments/{commentId}')
.onCreate(commentAdded);
export const projectPeopleAdded = functions.firestore
.document('Projects/{projectId}/People/{userId}')
.onCreate(peopleAdded);
export const projectPeopleRemoved = functions.firestore
.document('Projects/{projectId}/People/{userId}')
.onDelete(peopleRemoved);
export const projectDeleted = functions.firestore
.document(`Projects/{projectId}`)
.onDelete(projectRemoved);
<file_sep>import { PeopleModule } from './people.module';
describe('PeopleModule', () => {
let peopleModule: PeopleModule;
beforeEach(() => {
peopleModule = new PeopleModule();
});
it('should create an instance', () => {
expect(peopleModule).toBeTruthy();
});
});
<file_sep>import { Component, OnInit, Input } from '@angular/core';
import { timer } from 'rxjs';
import * as moment from 'moment';
type ContainerState = 'expanded' | 'condensed';
@Component({
selector: 'app-timer',
templateUrl: './timer.component.html',
styleUrls: ['./timer.component.scss']
})
export class TimerComponent implements OnInit {
@Input() index;
public startTime = moment().utc();
public duration = moment.duration();
private source = timer(1000, 1000);
public timer;
public isPaused: boolean = false;
public state: ContainerState = 'condensed';
constructor() // public dialogRef: MatDialogRef<TimerComponent>,
// @Inject(MAT_DIALOG_DATA) public data
{}
// TODO remove timer
ngOnInit() {
// this.dialogRef.updatePosition({ bottom: '25px', left: '25px' });
this.source.subscribe(val => {
if (this.isPaused === false) {
this.duration.add(1, 'second');
}
this.timer = moment
.utc(this.duration.as('milliseconds'))
.format('HH:mm:ss');
});
}
toggleTimer() {
this.isPaused = !this.isPaused;
}
markStart() {
// const data = {
// projectId : this.data.projectId,
// taskId : this.data.taskId,
// startTime : this.startTime,
// duration : this.duration,
// };
}
}
<file_sep>import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-profile-badge',
templateUrl: './profile-badge.component.html',
styleUrls: ['./profile-badge.component.scss']
})
export class ProfileBadgeComponent implements OnInit {
@Input() public masrkAsSelected: Boolean = false;
@Input() public userKey: String = null;
constructor() { }
ngOnInit() {
}
}
<file_sep>
import { firestore } from 'firebase-admin';
export const peopleAdded = (snap, context) => {
const projectId = context.params.projectId;
const userId = context.params.userId;
// Adding projects to the users collection
return firestore()
.collection('Users')
.doc(userId)
.collection('Projects')
.doc(projectId)
.set({
projectId: projectId,
createdAt: firestore.FieldValue.serverTimestamp()
});
};
export const peopleRemoved = (snap, context) => {
const projectId = context.params.projectId;
const userId = context.params.userId;
// Removing projects to the users collection
return firestore()
.collection('Users')
.doc(userId)
.collection('Projects')
.doc(projectId)
.delete();
};<file_sep><div class="row mt-4">
<div class="col-6">
<h3 class="underlined">Diaries</h3>
</div>
<div class="col-6">
<a [routerLink]="['/project/manage', projectId, 'diaries', 'add']" class="btn btn-sm btn-primary float-right">
Add Note
</a>
</div>
</div>
<ul class="list-group list-group-flush">
<li *ngFor="let notebook of notebooks" class="list-group-item d-flex justify-content-between align-items-center">
<div>
<a [routerLink]="['/project/manage', projectId, 'diaries', notebook.id]">
<i class="fas fa-book mr-2"></i> <span>{{ notebook.title }}</span>
</a>
<section>
<small>Last updated
{{ notebook.lastUpdatedAt.seconds | amFromUnix | amTimeAgo }}</small>
</section>
</div>
<div>
<a [routerLink]="[
'/project/manage',
projectId,
'diaries',
'edit',
notebook.id
]">
<i class="fas fa-edit" title="Edit this note"></i>
</a>
</div>
</li>
</ul>
<div class="empty-wrapper" *ngIf="notebooks.length == 0">
<h4>
<i class="fas fa-book-open"></i>
</h4>
<p class="text-center">No Notebooks yet. Add diaries as a way to store notes and important project information.</p>
</div><file_sep>import { Component, OnInit, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { Observable, from } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
//Services
import { AlertService } from './../../../../services/alert.service';
import { BillingService } from './../../../../services/billing.service';
@Component({
selector: 'app-upsert-invoice',
templateUrl: './upsert-invoice.component.html',
styleUrls: ['./upsert-invoice.component.scss']
})
export class UpsertInvoiceComponent implements OnInit {
myControl = new FormControl();
currency: string[] = ['USD- US dollar', 'EUR- Euro', 'CAD- Canadian dollar'];
// pricing: string[] = ['Invoice has a fixed price']
filteredOptions: Observable<string[]>;
public invoiceForm: FormGroup;
constructor(
private alertService: AlertService,
private fb: FormBuilder,
private invoice: BillingService,
public dialogRef: MatDialogRef<UpsertInvoiceComponent>,
@Inject(MAT_DIALOG_DATA) public data,
) { }
ngOnInit() {
this.filteredOptions = this.myControl.valueChanges
.pipe(
startWith(''),
map(value => this._filter(value))
);
this.invoiceForm = this.fb.group({
invoiceId: [null, Validators.required],
issueDate: [null, Validators.required],
currency: [null, Validators.required],
pricing: [null, Validators.required],
finalPrice: [null]
});
}
private _filter(value: string): string[] {
const filterValue = value.toLowerCase();
return this.currency.filter(option => option.toLowerCase().includes(filterValue));
}
public create(form: FormGroup) {
try {
if (form.invalid) {
return false;
// throw new Error(`You shouldn't leave the comment field like that`);
}
const invoiceData = form.value;
invoiceData.projectId = this.data.projectId;
this.invoice.upsertInvoice(invoiceData);
this.alertService.showSuccess('Created Invoice');
this.dialogRef.close();
} catch (error) {
this.alertService.showError(error.message);
}
}
closeDialog(): void {
this.dialogRef.close();
}
}
<file_sep>import { Component, OnInit, Input, OnChanges } from '@angular/core';
import { MatDialog } from '@angular/material';
// Components
import { TimeLogComponent } from './../../components/time-log/time-log.component';
import { UpsertCommentComponent } from './../../components/upsert-comment/upsert-comment.component';
import { AddFileComponent } from './../../components/add-file/add-file.component';
import { AddTaskComponent } from './../../components/add-task/add-task.component';
// Services
import { TaskService } from './../../../../services/task.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-tasks-list',
templateUrl: './tasks-list.component.html',
styleUrls: ['./tasks-list.component.scss']
})
export class TasksListComponent implements OnInit, OnChanges {
@Input()
taskListId: string;
@Input()
projectId: string;
public tasks = [];
public projectTaskLists = [];
constructor(
private task: TaskService,
private alertService: AlertService,
private dialog: MatDialog
) {}
ngOnInit() {}
ngOnChanges() {
this.getTasks();
}
public getTasks() {
this.task.list(this.taskListId).subscribe(
tasks => {
this.tasks = this.getNestedChildren(tasks, null);
console.log(this.tasks);
},
error => {
this.alertService.showError(error.message);
}
);
}
public logTime(taskId) {
this.dialog.open(TimeLogComponent, {
height: '420px',
width: '700px',
data: { projectId: this.projectId, taskId: taskId }
});
}
public addComment(taskId) {
this.dialog.open(UpsertCommentComponent, {
height: '311px',
width: '700px',
data: { projectId: this.projectId, taskId: taskId }
});
}
public editTask(task) {
// console.log('editTask', this.taskList, this.task, this.taskId);
const addDialog = this.dialog.open(AddTaskComponent, {
width: '700px',
data: {
projectId: this.projectId,
taskListId: task.taskListId,
task: task
}
});
}
/**
* @uses update the status of a task
* @param task
*/
public updateProgress(task) {
delete task.showProgress;
this.task.add(task);
}
/**
* @uses mark a task as completed or not completed
* @param task
*/
public toggleCompleted(task) {
if (task.isCompleted) {
task.isCompleted = !task.isCompleted;
} else {
task.isCompleted = true;
}
delete task.showProgress;
this.task.add(task);
}
/**
* @description Upload Files
*/
public uploadFiles(taskId) {
this.dialog.open(AddFileComponent, {
height: '420px',
width: '700px',
data: { projectId: this.projectId, taskId }
});
}
public dateRange(taskId) {
console.log('hey there');
}
/**
* @author Sharan
* @param taskList TaskList
* @param task Task
*/
public async moveTask(taskList, task) {
try {
task.taskListId = taskList.id;
await this.task.add(task);
this.alertService.showSuccess(`Task moved to list : ${taskList.title}`);
} catch (error) {
this.alertService.showError(error.message);
}
}
/**
* @event MenuOpen
* @author Sharan
* @param event Event
*/
public menuOpened(event) {
this.task.getTaskLists().subscribe(taskLists => {
this.projectTaskLists = taskLists;
});
}
/**
* Adds a subtask
* @param task Task
*/
public addSubtask(task) {
const addDialog = this.dialog.open(AddTaskComponent, {
width: '700px',
data: {
projectId: task.projectId,
taskListId: task.taskListId,
parentTaskId: task.id
}
});
}
/**
* @description Converts list to hierarchy
* @param arr [Task]
* @param parentTaskId
*/
private getNestedChildren(arr, parentTaskId) {
var out = [];
for (var i in arr) {
if (arr[i].parentTaskId == parentTaskId) {
var children = this.getNestedChildren(arr, arr[i].id);
if (children.length) {
arr[i].children = children;
}
out.push(arr[i]);
}
}
return out;
}
}
<file_sep>import { Component, OnInit, Input, OnChanges } from '@angular/core';
// Services
import { TaskService } from './../../../../services/task.service';
@Component({
selector: 'app-tasks',
templateUrl: './tasks.component.html',
styleUrls: ['./tasks.component.scss']
})
export class TasksComponent implements OnInit, OnChanges {
@Input()
taskListId: string;
@Input()
projectId: string;
public todo = [];
public doing = [];
public completed = [];
public todoQuery: string;
public doingQuery: string;
public completedQuery: string;
constructor(private task: TaskService) {}
ngOnInit() {}
ngOnChanges() {
this.getTasks();
}
public getTasks() {
this.task.list(this.taskListId).subscribe(tasks => {
this.todo = [];
this.doing = [];
this.completed = [];
this.sortTasks(tasks);
});
}
private sortTasks(tasks) {
tasks.forEach(task => {
switch (task.status) {
case 'todo':
this.todo.push(task);
break;
case 'doing':
this.doing.push(task);
break;
case 'completed':
this.completed.push(task);
break;
default:
break;
}
});
}
/**
* Task Dropped on todo Lane
* @param task Task
*/
public droppedOnToDo({ dropData }): void {
this.processDrop(dropData, 'todo');
}
/**
* Task Dropped on doing Lane
* @param task Task
*/
public droppedOnDoing({ dropData }): void {
this.processDrop(dropData, 'doing');
}
/**
* Task Dropped on completed Lane
* @param task Task
*/
public droppedOnCompleted({ dropData }): void {
this.processDrop(dropData, 'completed');
}
/**
* Check if the task already exists in the lane
* @param task object
* @param lane string
*/
private processDrop(droppedTask, lane) {
if (droppedTask.status !== lane) {
const currentLane = droppedTask.status;
const tasks = this[currentLane];
const index = tasks.findIndex(task => {
return droppedTask.id === task.id;
});
this[currentLane].splice(index, 1);
droppedTask.status = lane;
this[lane].push(droppedTask);
this.task.updateStatus(droppedTask.id, lane);
}
}
}
<file_sep>import { Injectable } from '@angular/core';
import {
AngularFirestore,
AngularFirestoreCollection
} from 'angularfire2/firestore';
import * as firebaseApp from 'firebase/app';
import { AngularFireStorage } from 'angularfire2/storage';
import { Invoice, Expense, Time } from './../app.model';
import { AuthenticationService } from './authentication.service';
@Injectable({
providedIn: 'root'
})
export class BillingService {
private collection: AngularFirestoreCollection<Invoice>;
constructor(
private afs: AngularFirestore,
private storage: AngularFireStorage,
private auth: AuthenticationService
) {
// this.collection = this.afs.collection<Invoice>('Invoices');
}
private getCollection(projectId) {
return this.afs.collection('Projects').doc(projectId).collection<Invoice>('Invoices');
}
public upsertInvoice(invoice: Invoice) {
const invoiceId = invoice.invoiceId;
invoice.createdAt = new Date();
invoice.lastUpdatedAt = new Date();
return this.getCollection(invoice.projectId).doc(invoiceId).set(invoice);
}
/**
* @uses Get all the invoices under a project
* @param projectId
*/
public getInvoices(projectId) {
return this.getCollection(projectId).valueChanges();
}
/**
* @uses Get all the Expenses inside a project
* @param expense
*/
public upsertExpense(expense: Expense) {
const expenseId = this.afs.createId();
expense.createdAt = new Date();
expense.lastUpdatedAt = new Date();
expense.userId = this.auth.user.uid;
const expenseCollection = this.afs.collection<Expense>(
`Projects/${expense.projectId}/Expenses`
);
return expenseCollection.doc(expenseId).set(expense);
}
/**
* List all the expenses under a project
* @param projectId
*/
public getexpenses(projectId) {
const expenseCollection = this.afs.collection<Expense>(
`Projects/${projectId}/Expenses`
);
return expenseCollection.valueChanges();
}
public getUnbilledTimelogs(projectId) {
return this.afs
.collection<Time>(`Projects/${projectId}/Time`, ref => ref.where('invoiceId', '==', null).where('isBillable', '==', 'true'))
.valueChanges();
}
public getInvoiceDetail(projectId, invoiceId){
return this.afs
.collection<Invoice>(`Projects/${projectId}/Time/`, ref => ref.where('invoiceId', '==', invoiceId))
.valueChanges();
}
}
<file_sep>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { MomentModule } from 'ngx-moment';
import { QuillModule } from 'ngx-quill';
// Modules
import { SharedModule } from './../shared/shared.module';
// Guards
import { RoleGuard } from './../../guards/role.guard';
// Material
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatStepperModule } from '@angular/material/stepper';
import { MatDialogModule } from '@angular/material/dialog';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
import { DragAndDropModule } from 'angular-draggable-droppable';
import { MatMenuModule } from '@angular/material/menu';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatSliderModule } from '@angular/material/slider';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatSelectModule } from '@angular/material/select'
// Components
import { AddComponent } from './pages/add/add.component';
import { ListComponent } from './pages/list/list.component';
import { ProjectMainComponent } from './components/project-main/project-main.component';
import { ProjectItemComponent } from './components/project-item/project-item.component';
import { ManageComponent } from './pages/manage/manage.component';
import { ProjectOverviewComponent } from './pages/project-overview/project-overview.component';
import { ProjectTasksComponent } from './pages/project-tasks/project-tasks.component';
import { AddTaskComponent } from './components/add-task/add-task.component';
import { ProjectTaskComponent } from './pages/project-task/project-task.component';
import { TimeLogComponent } from './components/time-log/time-log.component';
import { ProjectChatComponent } from './pages/project-chat/project-chat.component';
import { ProjectNotebooksComponent } from './pages/project-notebooks/project-notebooks.component';
import { ProjectTimeComponent } from './pages/project-time/project-time.component';
import { AddTaskListComponent } from './components/add-task-list/add-task-list.component';
import { ProjectAddNotebookComponent } from './pages/project-add-notebook/project-add-notebook.component';
import { ProjectFilesComponent } from './pages/project-files/project-files.component';
import { ProjectSettingsComponent } from './pages/project-settings/project-settings.component';
import { ProjectReportsComponent } from './pages/project-reports/project-reports.component';
import { TasksComponent } from './components/tasks/tasks.component';
import { ProjectNotebookDetailComponent } from './pages/project-notebook-detail/project-notebook-detail.component';
import { TimeLogItemComponent } from './components/time-log-item/time-log-item.component';
import { AddFileComponent } from './components/add-file/add-file.component';
import { ProjectGridItemComponent } from './components/project-grid-item/project-grid-item.component';
import { SaveTaskListComponent } from './components/save-task-list/save-task-list.component';
import { TasksListComponent } from './components/tasks-list/tasks-list.component';
import { UpsertCommentComponent } from './components/upsert-comment/upsert-comment.component';
import { BillingComponent } from './pages/billing/billing.component';
import { BottomSheetInvoice } from './pages/billing/billing.component';
import { UpsertInvoiceComponent } from './components/upsert-invoice/upsert-invoice.component';
import { UpsertExpenseComponent } from './components/upsert-expense/upsert-expense.component';
import { ViewInvoiceComponent } from './components/view-invoice/view-invoice.component';
const routes: Routes = [
{
path: '',
component: ProjectMainComponent,
children: [
{ path: 'list/:status', component: ListComponent },
{ path: 'add', component: AddComponent },
{
path: 'manage/:projectId',
component: ManageComponent,
children: [
{ path: 'overview', component: ProjectOverviewComponent },
{ path: 'tasks', component: ProjectTasksComponent },
{ path: 'tasks/:taskId', component: ProjectTaskComponent },
{ path: 'chat', component: ProjectChatComponent },
{ path: 'billing', component: BillingComponent },
{ path: 'files', component: ProjectFilesComponent },
{ path: 'diaries', component: ProjectNotebooksComponent },
{ path: 'diaries/add', component: ProjectAddNotebookComponent },
{
path: 'diaries/edit/:notebookId',
component: ProjectAddNotebookComponent
},
{
path: 'diaries/:notebookId',
component: ProjectNotebookDetailComponent
},
{ path: 'time', component: ProjectTimeComponent },
{ path: 'reports', component: ProjectReportsComponent },
{
path: 'settings',
component: ProjectSettingsComponent,
canActivate: [RoleGuard],
data: {
roles: ['Administrator', 'Manager'],
redirectPath: 'dashboard/activity'
}
},
{ path: '**', pathMatch: 'full', redirectTo: 'overview' }
]
},
{ path: '**', pathMatch: 'full', redirectTo: 'list/active' }
]
}
];
@NgModule({
imports: [
CommonModule,
SharedModule,
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatTooltipModule,
MatCheckboxModule,
MatStepperModule,
MatDialogModule,
MatSlideToggleModule,
MatSliderModule,
MatBottomSheetModule,
MatSelectModule,
NgxMaterialTimepickerModule.forRoot(),
MomentModule,
MatMenuModule,
ReactiveFormsModule,
QuillModule,
FormsModule,
RouterModule.forChild(routes),
DragAndDropModule
],
declarations: [
ListComponent,
ProjectMainComponent,
ProjectItemComponent,
AddComponent,
ManageComponent,
ProjectOverviewComponent,
ProjectTasksComponent,
AddTaskComponent,
ProjectTaskComponent,
TimeLogComponent,
ProjectChatComponent,
ProjectNotebooksComponent,
ProjectTimeComponent,
AddTaskListComponent,
ProjectAddNotebookComponent,
ProjectFilesComponent,
ProjectSettingsComponent,
ProjectReportsComponent,
TasksComponent,
ProjectNotebookDetailComponent,
TimeLogItemComponent,
AddFileComponent,
ProjectGridItemComponent,
SaveTaskListComponent,
TasksListComponent,
UpsertCommentComponent,
BillingComponent,
BottomSheetInvoice,
UpsertInvoiceComponent,
UpsertExpenseComponent,
ViewInvoiceComponent,
],
entryComponents: [
TimeLogComponent,
AddFileComponent,
AddTaskComponent,
SaveTaskListComponent,
UpsertCommentComponent,
UpsertInvoiceComponent,
UpsertExpenseComponent,
ViewInvoiceComponent,
BottomSheetInvoice
]
})
export class ProjectModule { }
<file_sep>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectGridItemComponent } from './project-grid-item.component';
describe('ProjectGridItemComponent', () => {
let component: ProjectGridItemComponent;
let fixture: ComponentFixture<ProjectGridItemComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProjectGridItemComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ProjectGridItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
<file_sep>import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
// Components
import { TimerComponent } from './components/timer/timer.component';
// Vendor Modules
import { AngularFireModule } from 'angularfire2';
import { AngularFirestoreModule } from 'angularfire2/firestore';
import { AngularFireStorageModule } from 'angularfire2/storage';
import { AngularFireAuthModule } from 'angularfire2/auth';
// Guards
import { AuthGuard } from './guards/auth.guard';
// Material Imports
import { MatInputModule } from '@angular/material';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatSelectModule } from '@angular/material/select';
// Pipes
import { FilterPipe } from './pipes/filter.pipe';
import { ProjectSortPipe } from './pipes/project-sort.pipe';
import { FileNameDirective } from './directives/file-name.directive';
import { CalendarModule, DateAdapter } from 'angular-calendar';
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
import { AuthenticatedComponent } from './components/authenticated/authenticated.component';
// Routes Definition
const routes: Routes = [
{
path: 'auth',
loadChildren:
'./modules/authentication/authentication.module#AuthenticationModule'
},
{
path: '',
component: AuthenticatedComponent,
canActivate: [AuthGuard],
children: [
{
path: 'settings',
loadChildren: './modules/settings/settings.module#SettingsModule',
canActivate: [AuthGuard]
},
{
path: 'message',
loadChildren: './modules/message/message.module#MessageModule',
canActivate: [AuthGuard]
},
{
path: 'dashboard',
loadChildren: './modules/dashboard/dashboard.module#DashboardModule',
canActivate: [AuthGuard]
},
{
path: 'calendar',
loadChildren: './modules/calendar/calendar.module#CalendarModule',
canActivate: [AuthGuard]
},
{
path: 'project',
loadChildren: './modules/project/project.module#ProjectModule',
canActivate: [AuthGuard]
},
{
path: 'people',
loadChildren: './modules/people/people.module#PeopleModule',
canActivate: [AuthGuard]
},
{
path: '**',
redirectTo: 'dashboard'
}
]
}
];
@NgModule({
declarations: [
AppComponent,
TimerComponent,
FileNameDirective,
AuthenticatedComponent
],
imports: [
BrowserModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireAuthModule,
AngularFireStorageModule,
RouterModule.forRoot(routes),
BrowserAnimationsModule,
HttpClientModule,
MatInputModule,
FormsModule,
ReactiveFormsModule,
MatProgressSpinnerModule,
MatButtonModule,
MatCardModule,
MatFormFieldModule,
MatSnackBarModule,
MatDatepickerModule,
MatNativeDateModule,
MatBottomSheetModule,
MatSelectModule,
CalendarModule.forRoot({
provide: DateAdapter,
useFactory: adapterFactory
})
],
providers: [AuthGuard],
bootstrap: [AppComponent]
})
export class AppModule {}
<file_sep>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
// Services
import { ProjectService } from './../../../../services/project.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-project-notebook-detail',
templateUrl: './project-notebook-detail.component.html',
styleUrls: ['./project-notebook-detail.component.scss']
})
export class ProjectNotebookDetailComponent implements OnInit {
public notebook = {};
private notebookId;
public projectId;
constructor(
private route: ActivatedRoute,
private projectService: ProjectService,
private alertService: AlertService
) {}
ngOnInit() {
this.route.params.subscribe(params => {
this.notebookId = params.notebookId;
this.route.parent.params.subscribe(parentParams => {
this.projectId = parentParams.projectId;
this.getNotebook();
});
});
}
public getNotebook() {
this.projectService.getNotebook(this.projectId, this.notebookId).subscribe(
notebook => {
this.notebook = notebook;
},
error => {
this.alertService.showError(error.message);
}
);
}
}
<file_sep>import { Injectable } from '@angular/core';
import * as jsPDF from 'jspdf';
import * as moment from 'moment';
import { take } from 'rxjs/operators';
import { logoData } from './../app.model';
import { ProjectService } from './../services/project.service';
@Injectable({
providedIn: 'root'
})
export class ReportService {
constructor(private projectService: ProjectService) {}
public async generatePDF(data, projectId, filterOptions = null) {
const project = await this.projectService
.get(projectId)
.pipe(take(1))
.toPromise();
const time = this.projectService.calculateTimelogs(data);
const doc = new Report(data, time, project, filterOptions);
doc.save(`${project.title}-time-report.pdf`);
}
}
/**
* @author Sharan (Zweck)
* @description Create a report using jsPdf
*/
class Report {
private report;
private page = 1;
private rowPosition = 65;
private isFirstPage: Boolean = true;
private calculatedTime;
private filterOptions;
private project;
constructor(data, calculatedTime, project, filterOptions) {
this.report = new jsPDF();
this.calculatedTime = calculatedTime;
this.filterOptions = filterOptions;
this.project = project;
this.generate(data);
}
/**
* Save the Report using the filename provided
* @param filename string
*/
public save(filename) {
return this.report.save(filename);
}
/**
* Generate the data
* @param data Array of Time
*/
private generate(data) {
this.drawTable();
data.forEach(log => {
if (this.rowPosition >= 285) {
this.addPage();
}
this.report.setFontType('thin');
this.rowPosition += 5;
const description = log.description
? log.description.replace(/[^a-zA-Z ]/g, '')
: 'N/A';
this.report.text(
10,
this.rowPosition,
log.date ? moment.unix(log.date.seconds).format('ll') : 'N/A'
);
this.report.text(158, this.rowPosition, log.isBillable ? 'Yes' : 'No');
this.report.text(
180,
this.rowPosition,
log.time ? log.time.toFixed(2) + ' Hours' : 'N/A'
);
this.splitDescription(description, 80).forEach(string => {
this.report.text(40, this.rowPosition, string);
this.rowPosition += 3;
});
});
}
/**
* @author Sharan (Zweck)
* @description Generates the table Border.
* Checks if the page is cover / not
*/
private drawTable() {
let textPosition = 19;
let topLinePosition = 15;
this.report.line(5, 290, 205, 290);
this.report.line(5, 290, 205, 290);
if (this.isFirstPage == true) {
topLinePosition += 40;
textPosition += 40;
this.report.text(15, 25, `Timesheet - ${this.project.title}`);
if (this.filterOptions) {
this.report.setFontSize(9);
this.report.text(
15,
33,
`Start Date : ${
this.filterOptions.startDate
? moment(this.filterOptions.startDate).format('ll')
: '-'
}`
);
this.report.text(
15,
38,
`End Date : ${
this.filterOptions.endDate
? moment(this.filterOptions.endDate).format('ll')
: '-'
}`
);
}
this.report.addImage(logoData, 'PNG', 155, 22, 38, 20);
// doc.addImage("https://promo.bradbrownmagic.com/pdf-flyer/flyers/poster-dark-cmyk.jpg","JPEG",0,0);
this.report.setFontSize(9);
this.report.setFontType('bold');
this.report.text(
140,
50,
`Billable : ${this.calculatedTime.billableTime} Hrs | Non Billable : ${
this.calculatedTime.nonBillabletime
} Hrs`
);
this.report.setFontType('thin');
this.addFooter();
}
this.report.line(5, topLinePosition, 205, topLinePosition);
this.report.line(5, topLinePosition + 7, 205, topLinePosition + 7);
// Vertical lines
this.report.line(35, topLinePosition, 35, 290);
this.report.line(150, topLinePosition, 150, 290);
this.report.line(172, topLinePosition, 172, 290);
this.report.line(5, topLinePosition, 5, 290);
this.report.line(205, topLinePosition, 205, 290);
this.report.setFontType('bold');
this.report.setFontSize(9);
this.report.text(15, textPosition, 'DATE');
this.report.text(85, textPosition, 'DESCRIPTION');
this.report.text(153, textPosition, 'BILLABLE');
this.report.text(183, textPosition, 'TIME');
}
/**
* Add a new page
*/
private addPage() {
this.page++;
this.isFirstPage = false;
this.report.addPage();
this.drawTable();
this.rowPosition = 24;
this.addFooter();
}
/**
* Add the page footer
*/
private addFooter() {
this.report.setFontType('thin');
this.report.text(195, 10, `Page ${this.page}`);
this.report.text(
140,
294,
`Powered by POD | http://zweck.io/downloads/pod/`
);
this.report.text(7, 294, `Project : ${this.project.title}`);
}
/**
* Split the description into an array
* of string based on string length
* @author <NAME>
* @param description string
*/
private splitDescription(description, length) {
const strings = [];
if (!description) {
return strings;
}
let l = length;
while (description.length > l) {
let pos = description.substring(0, l).lastIndexOf(' ');
pos = pos <= 0 ? l : pos;
strings.push(description.substring(0, pos));
let i = description.indexOf(' ', pos) + 1;
if (i < pos || i > pos + l) {
i = pos;
}
description = description.substring(i);
l = length;
}
strings.push(description);
return strings;
}
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
// Services
import { UserService } from './../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
@Component({
selector: 'app-change-password',
templateUrl: './change-password.component.html',
styleUrls: ['./change-password.component.scss']
})
export class ChangePasswordComponent implements OnInit {
public changePasswordForm: FormGroup;
public isPasswordChangeProgress: Boolean = false;
constructor(
private auth: UserService,
private fb: FormBuilder,
private alert: AlertService
) {
this.changePasswordForm = this.fb.group({
newPassword: [null, Validators.required],
confirmPassword: [null, Validators.required]
});
}
ngOnInit() {}
/**
* Handles the form to change password
* @param form FormGroup
*/
public async CreateNewPassword(form: FormGroup) {
try {
this.isPasswordChangeProgress = true;
this.validateForm(form);
await this.auth.updatePassword(
this.changePasswordForm.controls.newPassword.value
);
this.alert.showSuccess('Changed Password Successfully');
this.isPasswordChangeProgress = false;
form.reset();
} catch (error) {
this.isPasswordChangeProgress = false;
this.alert.showError(error.message);
}
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error(`Ah ah! That's not a valid input`);
}
if (form.value.newPassword !== form.value.confirmPassword) {
throw new Error('Password do not match');
}
}
}
<file_sep>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { MomentModule } from 'ngx-moment';
// Material
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatCardModule } from '@angular/material/card';
import { MatInputModule } from '@angular/material';
import { MatButtonModule } from '@angular/material/button';
// Modules
import { SharedModule } from './../shared/shared.module';
import { HomeComponent } from './pages/home/home.component';
const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: '**', pathMatch: 'full', redirectTo: 'home' }
];
@NgModule({
imports: [
CommonModule,
SharedModule,
RouterModule.forChild(routes),
MatFormFieldModule,
MatCardModule,
MatInputModule,
MatButtonModule,
MomentModule,
ReactiveFormsModule,
FormsModule
],
declarations: [HomeComponent]
})
export class MessageModule {}
<file_sep>import { Injectable } from '@angular/core';
import { AngularFireAuth } from 'angularfire2/auth';
import {
AngularFirestore,
AngularFirestoreCollection
} from 'angularfire2/firestore';
import { AngularFireStorage } from 'angularfire2/storage';
import { finalize } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class UserService {
constructor(private afAuth: AngularFireAuth, private afs: AngularFirestore, private storage: AngularFireStorage
) {}
public getCurrentUserId() {
const user = this.afAuth.auth.currentUser;
return user.uid;
}
public getUser() {
const user = this.afAuth.auth.currentUser;
return this.afs
.collection('Users')
.doc(user.uid)
.valueChanges();
}
/**
* Update the Profile data of currently logged in user
* @param data
*/
public updateProfile(data) {
const user = this.afAuth.auth.currentUser;
return this.afs
.collection('Users')
.doc(user.uid)
.set(data, { merge: true });
}
/**
* Change password of currently logged in user
* @param password
*/
public updatePassword(password) {
const user = this.afAuth.auth.currentUser;
return user.updatePassword(password);
}
/**
* Add a file to the Project
* @param projectId string
*/
public updateAvatar = file => {
const user = this.afAuth.auth.currentUser;
const filePath = `avatars/${user.uid}-${file.lastModified}-${file.name}`;
const task = this.storage.upload(filePath, file);
return task.snapshotChanges().pipe(
finalize(async () => {
const url = await this.storage
.ref(filePath)
.getDownloadURL()
.toPromise();
return this.afs
.collection('Users')
.doc(user.uid)
.set(
{
avatar: url,
lastUpdatedAt: new Date()
},
{ merge: true }
);
})
);
};
}
<file_sep>import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
import { UserService } from './../../services/user.service';
import { AlertService } from './../../../../services/alert.service';
interface User {
fullName: string;
salutation: string;
gender: 'm' | 'f';
mobile: string;
}
@Component({
selector: 'app-update-profile',
templateUrl: './update-profile.component.html',
styleUrls: ['./update-profile.component.scss']
})
export class UpdateProfileComponent implements OnInit {
public userId: string;
public profileUpdateForm: FormGroup;
public isProfileUpdating: Boolean = false;
constructor(
private userService: UserService,
private fb: FormBuilder,
private alert: AlertService
) {
this.profileUpdateForm = this.fb.group({
firstName: [null],
lastName: [null],
salutation: [null],
gender: [null],
mobile: [null],
designation: [null]
});
}
ngOnInit() {
this.userId = this.userService.getCurrentUserId();
this.userService.getUser().subscribe(user => {
Object.keys(user).forEach(key => {
if (this.profileUpdateForm.controls[key]) {
this.profileUpdateForm.controls[key].setValue(user[key]);
}
});
});
}
/**
* Function Handles Profile Update Form
* @param form
*/
public async submitProfileForm(form: FormGroup) {
try {
this.isProfileUpdating = true;
this.validateForm(form);
await this.userService.updateProfile(form.value);
this.alert.showSuccess('Profile Updated Successfully');
this.isProfileUpdating = false;
} catch (error) {
this.isProfileUpdating = false;
this.alert.showError(error.message);
}
}
public selectAvatar() {
document.getElementById('fileInput').click();
}
public uploadAvatar(files) {
const file = files[0];
this.alert.showSuccess('Updating Avatar...');
this.userService.updateAvatar(file).subscribe(
res => {
},
error => {
this.alert.showError(error.message);
}
);
}
/**
* Validate the form
* @param form FormGroup
*/
private validateForm(form) {
if (form.invalid) {
throw new Error('Oh! Oh! Please fill all the fields');
}
}
}
| 0eec15018e140d256a754f334c5c10923174003c | [
"Markdown",
"TypeScript",
"HTML"
] | 91 | TypeScript | rafemu/pod | 5e4e291221ded0bf2f6bdb3dd3f7005ae6b74f82 | 47f971489aac6dfff5a44ac00743dd446c0f6fb3 |
refs/heads/master | <repo_name>udakumar/testrepo<file_sep>/mylog.py
import logging
logging.basicConfig(level=logging.INFO, filename='div.log', filemode='a',\
format='%(asctime)s- %(lineno)d-%(levelname)s-%(message)s-%(funcName)s')
logger = logging.getLogger()<file_sep>/creatinglog.py
from mylog import logger
#INFO
#WARNING
#DEBUG
#CRITICA'
#Error
def div(x, y):
try:
c = x / y
print("value of :", c)
except Exception as e:
logger.info(e)
div(3, 0)
| 3fe8a4c969707a4455d45aa25484a11cedff414b | [
"Python"
] | 2 | Python | udakumar/testrepo | 9065fbe4203ab780985d2a47006cd9d3380a32f8 | a0909577a74e8bbf35a01474198a9c7b0056a655 |
refs/heads/master | <file_sep>package cz.milanhlinak.hellospringbootangular.server.service;
import cz.milanhlinak.hellospringbootangular.server.dto.Greeting;
/**
* Greeting service.
*
* @author <NAME>
*/
public interface GreetingService {
/**
* Creates greeting for given name.
*
* @param name name
* @return greeting for given name
*/
Greeting greet(String name);
}
<file_sep># hello-spring-boot-angular
This is a sample project with Spring Boot and Angular.
* **Spring Boot** project was generated with [Spring Initializr](https://start.spring.io/)
* **Angular** project was generated with [Angular CLI](https://cli.angular.io/)
**How to build and run:**
1. Build
```
mvn package
```
2. Run
```
java -jar hello-spring-boot-angular-server-1.0-SNAPSHOT.jar
```
3. Open your browser on http://localhost:8080/
<file_sep>import { Component, OnInit } from '@angular/core';
import { GreetingService } from './shared/greeting.service';
import { Greeting } from './shared/greeting.model';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
username: string = 'user123';
greeting: Greeting;
loading = false;
constructor(private greetingService: GreetingService) { }
ngOnInit() {
}
onGreet() {
this.loading = true;
this.greetingService.greet(this.username).subscribe(
response => {
this.greeting = response;
this.loading = false;
},
error => {
this.loading = false;
}
)
}
}
| 765667de0270e25cd6f357a8f78d488e1c643213 | [
"Markdown",
"Java",
"TypeScript"
] | 3 | Java | milanhlinak/hello-spring-boot-angular | 5429e36226110bf9e9d5109f40d72889c6c031f0 | 9104a9ac756a8071a53b9eb37fbd00349ce91e06 |
refs/heads/master | <repo_name>hamidrezarezaei/insurance<file_sep>/Insurance/ViewComponent/ReminderViewComponent.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace insurance_new
{
public class ReminderViewComponent : ViewComponent
{
#region Construcotr
private readonly repository repository;
public ReminderViewComponent(repository repository)
{
this.repository = repository;
}
#endregion
#region Invoke
public async Task<IViewComponentResult> InvokeAsync(string template = "Default",
string componentName = "reminder",
string fullNameClass = "col-12 col-md-6",
string mobileClass = "col-12 col-md-6",
string dayClass = "col-12 col-md-6",
string monthClass = "col-12 col-md-6",
string emailClass = "col-12 col-md-6",
string insuranceTypeClass = "col-12 col-md-6",
string commentClass = "col-12",
string submitText = "ثبت",
string submitClass = "col-12 col-md-2 float-left btn-success"
)
{
ViewData["componentName"] = componentName;
ViewData["fullNameClass"] = fullNameClass;
ViewData["mobileClass"] = mobileClass;
ViewData["dayClass"] = dayClass;
ViewData["monthClass"] = monthClass;
ViewData["emailClass"] = emailClass;
ViewData["insuranceTypeClass"] = insuranceTypeClass;
ViewData["commentClass"] = commentClass;
ViewData["submitText"] = submitText;
ViewData["submitClass"] = submitClass;
return View(template, new reminder());
}
#endregion
}
}
<file_sep>/Insurance/ClientApp/app/app.shared.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { DpDatePickerModule } from 'ng2-jalali-date-picker';
import { NgSelect2Module } from 'ng-select2';
import { frenchDecimalPipe } from "./pipe/frenchDecimal.pipe";
import { AppComponent } from './components/app/app.component';
import { insuranceComponent } from './components/insurance/insurance.component';
import { tabComponent } from './components/insurance/tab/tab.component';
import { stepNavigationComponent } from './components/insurance/stepNavigation/stepNavigation.component';
import { aInsuranceComponent } from './components/insurance/aInsurance/aInsurance.component';
import { stepComponent } from './components/insurance/step/step.component';
import { fieldSetComponent } from './components/insurance/fieldSet/fieldSet.component';
import { fieldComponent } from './components/insurance/field/field.component';
import { loginComponent } from './components/login/login.component';
import { loginFormComponent } from './components/login/loginForm/loginForm.component';
import { registerFormComponent } from './components/login/registerForm/registerForm.component';
@NgModule({
declarations: [
frenchDecimalPipe,
AppComponent,
insuranceComponent,
tabComponent,
stepNavigationComponent,
aInsuranceComponent,
stepComponent,
fieldSetComponent,
fieldComponent,
loginComponent,
loginFormComponent,
registerFormComponent,
],
imports: [
DpDatePickerModule,
NgSelect2Module,
CommonModule,
HttpModule,
FormsModule,
RouterModule.forRoot([
{ path: '', redirectTo: 'insurance', pathMatch: 'full' },
{ path: '**', redirectTo: 'home' }
])
]
})
export class AppModuleShared {
}
<file_sep>/Insurance/Areas/Admin/Controllers/BoxCategoryController.cs
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class BoxCategoryController : Controller
{
#region Constructor
private readonly repository repository;
public BoxCategoryController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var boxCategories = this.repository.GetBoxCategories_hierarchy(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(boxCategories);
}
public IActionResult Details(int? id, int pageNumber, string searchString)
{
if (id == null)
{
return NotFound();
}
var boxCategory = this.repository.GetBoxCategory(id);
if (boxCategory == null)
{
return NotFound();
}
ViewBag.boxes = this.repository.GetBoxesOfBoxCategory(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(boxCategory);
}
public IActionResult Create(string returnUrl = null)
{
ViewBag.boxCategories = new SelectList(this.repository.GetBoxCategories(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(new boxCategory());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(boxCategory boxCategory, IFormFile image, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(boxCategory, image);
return RedirectToLocal(returnUrl);
}
ViewBag.boxCategories = new SelectList(this.repository.GetBoxCategories(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(boxCategory);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var boxCategory = this.repository.GetBoxCategory(id);
if (boxCategory == null)
{
return NotFound();
}
ViewBag.boxCategories = new SelectList(this.repository.GetBoxCategories(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(boxCategory);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, boxCategory boxCategory, IFormFile image, string returnUrl = null)
{
if (id != boxCategory.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(boxCategory, image);
return RedirectToLocal(returnUrl);
}
ViewBag.boxCategories = new SelectList(this.repository.GetBoxCategories(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(boxCategory);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var boxCategory = this.repository.GetBoxCategory(id);
if (boxCategory == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(boxCategory);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var boxCategory = this.repository.GetBoxCategory(id);
this.repository.DeleteEntity(boxCategory);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/fieldSetController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Controllers
{
[Area("Admin")]
[Authorize]
public class FieldSetController : Controller
{
#region Constructor
private readonly repository repository;
public FieldSetController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Details(int? id, int pageNumber, string searchString)
{
if (id == null)
{
return NotFound();
}
var fieldSet = this.repository.GetFieldSet(id);
if (fieldSet == null)
{
return NotFound();
}
ViewBag.fields = this.repository.GetFieldsOfFieldSet(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(fieldSet);
}
public IActionResult Create(int stepId, string returnUrl = null)
{
ViewData["ParentId"] = stepId;
ViewData["ReturnUrl"] = returnUrl;
return View(new fieldSet());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(fieldSet fieldSet, string returnUrl = null)
{
if (ModelState.IsValid)
{
this.repository.AddEntity(fieldSet);
return RedirectToLocal(returnUrl);
}
ViewData["ParentId"] = fieldSet.stepId;
ViewData["ReturnUrl"] = returnUrl;
return View(fieldSet);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var fieldSet = this.repository.GetFieldSet(id);
if (fieldSet == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(fieldSet);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, fieldSet fieldSet, string returnUrl = null)
{
if (id != fieldSet.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(fieldSet);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(fieldSet);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var fieldSet = this.repository.GetFieldSet(id);
if (fieldSet == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(fieldSet);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var fieldSet = this.repository.GetFieldSet(id);
this.repository.DeleteEntity(fieldSet);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/ClientApp/app/components/insurance/aInsurance/aInsurance.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { stepComponent } from '../step/step.component';
@Component({
selector: 'aInsurance',
templateUrl: './aInsurance.component.html',
styleUrls: ['./aInsurance.component.css']
})
export class aInsuranceComponent {
@Input() insurance: any;
@Output() fieldValueChanged = new EventEmitter<any>();
@Output() stepChanged = new EventEmitter<any>();
fieldValueChange(field: any) {
this.fieldValueChanged.emit(field);
}
stepChange(insurance: any) {
this.stepChanged.emit(insurance);
}
}
<file_sep>/Insurance/ClientApp/app/pipe/frenchDecimal.pipe.ts
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({
name: 'frenchDecimal'
})
export class frenchDecimalPipe implements PipeTransform {
transform(value: number | string, locale?: string): string {
try {
let x = value.toString().replace(/,/g, "");
return new Intl.NumberFormat(locale, {}).format(Number(x));
}
catch (e){ return ""; }
}
}<file_sep>/ThirdParty/Mellat.cs
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace ThirdParty
{
public class Mellat
{
#region Constructor
//private readonly IHttpContextAccessor httpContextAccessor;
//private readonly repository repository;
public Int64 terminalId;
public string userName = "";
public string password = "";
//public Mellat(IHttpContextAccessor httpContextAccessor, repository repository)
//{
// this.httpContextAccessor = httpContextAccessor;
// this.repository = repository;
// terminalId = Int64.Parse(this.repository.GetSetting("mellatTerminalId"));
// userName = this.repository.GetSetting("mellatUserName");
// password = this.repository.GetSetting("mellatPassword");
//}
#endregion
static void BypassCertificateError()
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate (
Object sender1,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
};
}
public string PayRequest(int orderId,int orderPrice, string CallBackUrl)
{
try
{
BypassCertificateError();
MellatWebService.PaymentGatewayClient bp = new MellatWebService.PaymentGatewayClient();
var result = bp.bpPayRequestAsync(
this.terminalId,
this.userName,
this.password,
orderId,
//order.id,
orderPrice,
//order.price * 10,
DateTime.Now.ToString("yyyyMMdd"),
DateTime.Now.ToString("HHMMSS"),
"",
CallBackUrl,
0).Result;
;
string[] res = result.Body.@return.Split(',');
if (res[0] == "0")
{
//refid
return res[1];
}
else
{
return "-1";
//return "nok" + res[0];
}
}
catch (Exception ex)
{
return ex.Message;
}
}
public void VerifyResult(int orderId, string SaleReferenceId)
{
try
{
BypassCertificateError();
MellatWebService.PaymentGatewayClient bp = new MellatWebService.PaymentGatewayClient();
var result = bp.bpVerifyRequestAsync(
this.terminalId,
this.userName,
this.password,
orderId,
orderId,
long.Parse(SaleReferenceId)).Result;
string VerifyResult = result.Body.@return;
if (VerifyResult != "0")
throw new Exception(TranslateMessage(VerifyResult));
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
public void SettleRequest(int orderId,string orderBankReference)
{
try
{
MellatWebService.PaymentGatewayClient bp = new MellatWebService.PaymentGatewayClient();
var result = bp.bpSettleRequestAsync(
this.terminalId,
this.userName,
this.password,
orderId,
orderId,
long.Parse(orderBankReference)).Result;
string SettleResult = result.Body.@return;
if (SettleResult != "0")
throw new Exception(TranslateMessage(SettleResult));
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
public static string TranslateMessage(string WebServiceResult)
{
switch (WebServiceResult)
{
case "11":
return "شماره کارت نا معتبر است.";
case "12":
return "موجودی کافی نیست.";
case "13":
return "رمز نادرست است.";
case "14":
return "تعداد دفعات وارد کردن رمز بیش از حد مجاز است.";
case "15":
return "کارت نا معتبر است.";
case "16":
return "دفعات برداشت وجه بیش از حد مجاز است.";
case "17":
return "انصراف از پرداخت.";
case "18":
return "تاریخ انقضای کارت گذشته است.";
case "19":
return "مبلغ برداشت وجه بيش از حد مجاز است.";
case "111":
return "صادر كننده كارت نامعتبر است.";
case "112":
return "خطاي سوييچ صادر كننده كارت.";
case "113":
return "پاسخي از صادر كننده كارت دريافت نشد.";
case "114":
return "دارنده كارت مجاز به انجام اين تراكنش نيست.";
case "21":
return "پذيرنده نامعتبر است.";
case "23":
return "خطاي امنيتي رخ داده است.";
case "24":
return "اطلاعات كاربري پذيرنده نامعتبر است.";
case "25":
return "مبلغ نامعتبر است.";
case "31":
return "پاسخ نامعتبر است.";
case "32":
return "فرمت اطلاعات وارد شده صحيح نمي باشد.";
case "33":
return "حساب نامعتبر است.";
case "34":
return "خطاي سيستمي.";
case "35":
return "تاريخ نامعتبر است.";
case "41":
return "شماره درخواست تكراري است.";
case "42":
return "تراكنش Sale يافت نشد.";
case "43":
return "قبلا درخواست Verify داده شده است.";
case "44":
return "درخواست Verfiy يافت نشد.";
case "45":
return "تراكنش Settle شده است.";
case "46":
return "تراكنش Settle نشده است.";
case "47":
return "تراكنش Settle يافت نشد.";
case "48":
return "تراكنش Reverse شده است.";
case "49":
return "تراكنش Refund يافت نشد.";
case "412":
return "شناسه قبض نادرست استيافت نشد.";
case "413":
return "شناسه پرداخت نادرست است.";
case "414":
return "سازمان صادر كننده قبض نامعتبر است.";
case "415":
return "زمان مجاز برای پرداخت به پايان رسيده است.";
case "416":
return "خطا در ثبت اطلاعات.";
case "417":
return "شناسه پرداخت كننده نامعتبر است.";
case "418":
return "اشكال در تعريف اطلاعات مشتري.";
case "419":
return "تعداد دفعات ورود اطلاعات بیشتر از حد مجاز است.";
case "421":
return "Pنامعتبر است.";
case "51":
return "تراكنش تكراري است.";
case "54":
return "تراكنش مرجع موجود نيست.";
case "55":
return "تراكنش نامعتبر است.";
case "61":
return "خطا در واريز.";
default:
return "خطای " + WebServiceResult + "در ارتباط با بانک.";
}
}
}
}
<file_sep>/ThirdParty/Email.cs
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;
using System.Text;
namespace ThirdParty
{
public class Email
{
public string EmailFromAddress;
public string EmailFromPassword;
public string EmailSmtpAddress;
public int EmailSmtpPort;
public bool EmailEnableSsl;
public bool Send(string to,string subject,string body)
{
MailMessage msg = new MailMessage();
msg.From = new MailAddress(EmailFromAddress);
msg.To.Add(to);
msg.Subject = subject;
msg.Body = body;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = true;
client.Host = EmailSmtpAddress;
client.Port = EmailSmtpPort;
client.EnableSsl = EmailEnableSsl;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential(EmailFromAddress, EmailFromPassword);
client.Timeout = 20000;
try
{
client.Send(msg);
msg.Dispose();
return true;
}
catch (Exception ex)
{
msg.Dispose();
return false;
}
}
}
}
<file_sep>/Insurance/ClientApp/app/services/auth.service.ts
import { Injectable, Inject } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
@Injectable()
export class authService {
baseUrl: string;
public user: any;
public isWaiting = false;
constructor(private http: Http, @Inject('BASE_URL') baseUrl: string) {
this.baseUrl = baseUrl;
this.fetchUser();
}
//-----------------------------------------------------------------------------
fetchUser() {
this.isWaiting = true;
this.http.get(this.baseUrl + 'api/User/GetUser').subscribe(result => {
this.user = result.json();
//console.log(this.user)
this.isWaiting = false;
}, error => console.error(error));
}
//-----------------------------------------------------------------------------
login(actualUserName: string, passWord: string) {
this.user.actualUserName = actualUserName;
this.user.passWord = <PASSWORD>;
//console.log(this.user);
this.isWaiting = true;
let formData: FormData = new FormData();
const headers = new Headers({ 'Content-type': 'application/json' });
this.http.post(this.baseUrl + "api/User/Login/", this.user, new RequestOptions({ headers: headers }))
.subscribe(result => {
this.user = result.json();
//console.log(this.user)
this.isWaiting = false;
});
}
//-----------------------------------------------------------------------------
Register(firstName: string,
lastName: string,
phoneNumber: string,
nationalCode: string,
email: string,
actualUserName: string,
passWord: string,
passWord2: string) {
if (passWord != passWord2) {
this.user.clientMessage = "تفاوت در نام کاربری و تکرار آن.";
return;
}
this.user.firstName = firstName;
this.user.lastName = lastName;
this.user.phoneNumber = phoneNumber;
this.user.nationalCode = nationalCode;
this.user.email = email;
this.user.actualUserName = actualUserName;
this.user.passWord = <PASSWORD>;
//console.log(this.user);
let formData: FormData = new FormData();
const headers = new Headers({ 'Content-type': 'application/json' });
this.isWaiting = true;
this.http.post(this.baseUrl + "api/User/Register/", this.user, new RequestOptions({ headers: headers }))
.subscribe(result => {
this.user = result.json();
//console.log(this.user)
this.isWaiting = false;
});
}
}<file_sep>/Insurance/Startup.cs
using AutoMapper;
using ThirdParty;
using DAL;
using Entities;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Insurance.Services;
using Microsoft.AspNetCore.Rewrite;
namespace insurance_new
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddDbContext<context>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDbContext<identityContext>(options => options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection")));
services.AddIdentity<user, role>(
config =>
{
config.Password.RequireDigit = false;
config.Password.RequiredLength = 3;
config.Password.RequireNonAlphanumeric = false;
config.Password.RequireUppercase = false;
config.Password.RequiredUniqueChars = 0;
config.Password.RequireLowercase = false;
config.User.RequireUniqueEmail = false;
}
).
AddEntityFrameworkStores<identityContext>().
AddDefaultTokenProviders();
services.AddSingleton(d =>
{
return new MapperConfiguration(c =>
{
c.CreateMap<insurance, insurance_client>();
c.CreateMap<step, step_client>();
c.CreateMap<fieldSet, fieldSet_client>();
c.CreateMap<field, field_client>();
c.CreateMap<dataValue, dataValue_client>().ForMember(dest => dest.text, opt => opt.MapFrom(src => src.title));
c.CreateMap<dataValue_category, dataValue_category_client>();
c.CreateMap<category, category_client>();
c.CreateMap<attribute, attribute_client>();
c.CreateMap<user, user_express>().ForMember(dest => dest.actualUserName, opt => opt.MapFrom(src => src.actualUserName));
c.CreateMap<paymentType, paymentType_client>();
}
);
});
services.AddScoped<repository>();
services.AddScoped<MellatService>();
services.AddScoped<SmsSender>();
services.AddScoped<EmailSender>();
services.AddScoped<HookManager>();
services.ConfigureApplicationCookie(c =>
{
c.LoginPath = "/Admin/Account/Login";
});
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
});
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseRewriter(new RewriteOptions()
.AddRedirectToWww()
//.AddRedirectToHttps()
);
app.UseAuthentication();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "post",
template: "{action=Post}/{id}/{title}/{controller=Home}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
}
}
}
<file_sep>/Insurance/ViewComponent/BoxCategoryViewComponent.cs
using DAL;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace insurance_new
{
public class BoxCategoryViewComponent : ViewComponent
{
#region Constructor
private readonly repository repository;
public BoxCategoryViewComponent(repository repository)
{
this.repository = repository;
}
#endregion
#region Invoke
public async Task<IViewComponentResult> InvokeAsync(
int id,
string template = "Default",
string componentName = "box-group-category",
bool isShowCategoryTitle = true,
bool isShowTitle = true,
bool isShowImage = true,
bool isShowContent = true,
int interval = 5000
)
{
ViewData["componentName"] = componentName;
ViewData["isShowCategoryTitle"] = isShowCategoryTitle;
ViewData["categoryTitle"] = this.repository.GetBoxCategoryTitle(id);
ViewData["isShowTitle"] = isShowTitle;
ViewData["isShowImage"] = isShowImage;
ViewData["isShowContent"] = isShowContent;
ViewData["interval"] = interval;
var items = await repository.GetActiveBoxesOfCategory_Async(id);
return View(template, items);
}
#endregion
}
}
<file_sep>/Insurance/Services/HookManager.cs
using DAL;
using Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Insurance.Services
{
public class HookManager
{
#region Constructor
private readonly repository repository;
private readonly SmsSender smsSender;
private readonly EmailSender emailSender;
public HookManager(repository repository, SmsSender smsSender, EmailSender emailSender)
{
this.repository = repository;
this.smsSender = smsSender;
this.emailSender = emailSender;
}
#endregion
private string replacePatterns(string input, user user, order order = null)
{
string output = input;
Regex r = new Regex(@"\[(.+?)\]", RegexOptions.IgnoreCase);
Match m = r.Match(input);
while (m.Success)
{
try
{
string pat = m.Groups[1].Value;
string newVal = $"[{pat}]";
var arr = pat.Split('.');
if (arr[0] == "user")
{
newVal = user.GetType().GetProperty(arr[1]).GetValue(user, null).ToString();
}
else if (arr[0] == "order")
{
newVal = order.GetType().GetProperty(arr[1]).GetValue(order, null).ToString();
}
output = output.Replace($"[{pat}]", newVal);
}
catch { }
m = m.NextMatch();
}
return output;
}
private string replacePatterns(string input, reminder reminder)
{
string output = input;
Regex r = new Regex(@"\[(.+?)\]", RegexOptions.IgnoreCase);
Match m = r.Match(input);
while (m.Success)
{
try
{
string pat = m.Groups[1].Value;
string newVal = $"[{pat}]";
var arr = pat.Split('.');
if (arr[0] == "reminder")
{
newVal = reminder.GetType().GetProperty(arr[1]).GetValue(reminder, null).ToString();
}
output = output.Replace($"[{pat}]", newVal);
}
catch { }
m = m.NextMatch();
}
return output;
}
public async void HookFired(string hookName, user user, order order = null)
{
var smses = this.repository.GetActiveSmses(hookName);
foreach (var sms in smses)
{
sms.text = this.replacePatterns(sms.text, user, order);
if (sms.mobile != null && sms.mobile.Trim() != "")
{
this.smsSender.SendSms(sms.mobile, sms.text);
}
else
{
this.smsSender.SendSms(user.PhoneNumber, sms.text);
}
}
var emails = this.repository.GetActiveEmails(hookName);
foreach (var email in emails)
{
email.subject = this.replacePatterns(email.subject, user, order);
email.body = this.replacePatterns(email.body, user, order);
if (email.emailAddress != null && email.emailAddress.Trim() != "")
{
this.emailSender.SendEmail(email.emailAddress, email.subject, email.body);
}
else if (user.Email != null && user.Email.Trim() != "")
{
this.emailSender.SendEmail(user.Email, email.subject, email.body);
}
}
}
public async void HookFired(string hookName, List<reminder> reminders)
{
var smses = this.repository.GetActiveSmses(hookName);
foreach (var reminder in reminders)
{
foreach (var sms in smses)
{
sms.text = this.replacePatterns(sms.text, reminder);
if (sms.mobile != null && sms.mobile.Trim() != "")
{
this.smsSender.SendSms(sms.mobile, sms.text);
}
else
{
this.smsSender.SendSms(reminder.mobile, sms.text);
}
}
}
var emails = this.repository.GetActiveEmails(hookName);
foreach (var reminder in reminders)
{
foreach (var email in emails)
{
email.subject = this.replacePatterns(email.subject, reminder);
email.body = this.replacePatterns(email.body, reminder);
if (email.emailAddress != null && email.emailAddress.Trim() != "")
{
this.emailSender.SendEmail(email.emailAddress, email.subject, email.body);
}
else if (reminder.email != null && reminder.email.Trim() != "")
{
this.emailSender.SendEmail(reminder.email, email.subject, email.body);
}
}
}
}
}
}
<file_sep>/Insurance/ClientApp/app/components/login/registerForm/registerForm.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
//import { fieldSetComponent } from '../fieldSet/fieldSet.component';
import { authService } from '../../../services/auth.service';
import { NgForm } from "@angular/forms";
@Component({
selector: 'registerForm',
templateUrl: './registerForm.component.html',
styleUrls: ['./registerForm.component.css']
})
export class registerFormComponent {
_authService: authService
@Output() previousStepClicked = new EventEmitter();
constructor(authService: authService) {
this._authService = authService;
}
Register(form: NgForm): void {
this._authService.Register(form.value.firstName, form.value.lastName,
form.value.phoneNumber, form.value.nationalCode, form.value.email,
form.value.actualUserName, form.value.passWord, form.value.pass<PASSWORD>);
}
previousStepClick() {
this.previousStepClicked.emit();
}
}
<file_sep>/Entities/insurnce/step.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class step : baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
[Display(Name = "شماره مرحله")]
public int number { get; set; }
[NotMapped]
[Display(Name = "تصویر")]
public string image
{
get
{
if (this.site != null)
{
var name = this.site.name;
var type = "step";
string phisicalAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + name + "\\image\\" + type + "\\" + this.id.ToString() + ".jpg";
if (System.IO.File.Exists(phisicalAddress))
{
string webAddress = "/" + name + "/image/" + type + "/" + this.id.ToString() + ".jpg";
return webAddress;
}
}
return "";
}
}
[Display(Name = "بیمه")]
public int insuranceId { get; set; }
[Display(Name = "سی اس اس ناوبری")]
public string navigationCssClass { get; set; }
[Display(Name = "فیلدست")]
public List<fieldSet> fieldSets { get; set; }
[Display(Name = "متن دکمه مرحله بعد")]
public string nextStepText { get; set; }
[Display(Name = "سی اس اس دکمه مرحله بعد")]
public string nextStepCssClass { get; set; }
[Display(Name = "متن دکمه مرحله قبل")]
public string previousStepText { get; set; }
[Display(Name = "سی اس اس دکمه مرحله قبل")]
public string previousStepCssClass { get; set; }
[Display(Name = "سی اس اس قبل از دکمه مراحل")]
public string beforStepButtonsCssClass { get; set; }
[Display(Name = "سی اس اس قیمت")]
public string priceCssClass { get; set; }
}
public class step_client : baseClient
{
public step_client()
{
this.isValidAllRequired = false;
}
public string name { get; set; }
public string title { get; set; }
public int number { get; set; }
public int insuranceId { get; set; }
public List<fieldSet_client> fieldSets { get; set; }
public string nextStepText { get; set; }
public string nextStepCssClass { get; set; }
public string previousStepText { get; set; }
public string previousStepCssClass { get; set; }
public string beforStepButtonsCssClass { get; set; }
public string priceCssClass { get; set; }
public int orderIndex { get; set; }
public bool isValidAllRequired { get; set; }
}
public class step_navigation
{
public string title { get; set; }
public int number { get; set; }
public string image { get; set; }
}
}
<file_sep>/Insurance/ClientApp/app/components/app/app.component.ts
import { Component } from '@angular/core';
import { authService } from '../../services/auth.service';
import { insuranceService } from '../../services/insurance.service';
@Component({
selector: 'app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [authService, insuranceService]
})
export class AppComponent {
_authService: authService;
_insuranceService: insuranceService;
constructor(authService: authService, insuranceService: insuranceService) {
this._authService = authService;
this._insuranceService = insuranceService;
}
}
<file_sep>/Insurance/Controllers/ReminderController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace Insurance.Controllers
{
[Route("api/[controller]")]
public class ReminderController : Controller
{
//context ctx;
repository repository;
private readonly HookManager hookManager;
public ReminderController(repository repository,HookManager hookManager)
{
//this.ctx = ctx;
this.repository = repository;
this.hookManager = hookManager;
}
[HttpPost("[action]")]
public bool AddReminder([FromBody]reminder reminder)
{
try
{
this.repository.AddEntity(reminder);
return true;
}
catch
{
return false;
}
}
}
}
<file_sep>/DAL/identityContext.cs
using Entities;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
namespace DAL
{
public class identityContext : IdentityDbContext<user,role,int>
{
public identityContext(DbContextOptions options) : base(options)
{
}
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/CategoryController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class CategoryController : Controller
{
#region Constructor
private readonly repository repository;
public CategoryController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Details(int? id, int pageNumber, string searchString)
{
if (id == null)
{
return NotFound();
}
var category = this.repository.GetCategory(id); ;
if (category == null)
{
return NotFound();
}
ViewBag.attributes = this.repository.GetAttributesOfCategory(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(category);
}
public IActionResult Create(int termId, string returnUrl = null)
{
ViewData["ParentId"] = termId;
ViewData["ReturnUrl"] = returnUrl;
return View(new category());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(category category, string returnUrl = null)
{
if (ModelState.IsValid)
{
category = (category)this.repository.AddEntity(category);
return RedirectToLocal(returnUrl);
}
ViewData["ParentId"] = category.termId;
ViewData["ReturnUrl"] = returnUrl;
return View(category);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var category = this.repository.GetCategory(id);
if (category == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(category);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, category category, string returnUrl = null)
{
if (id != category.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(category);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(category);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var category = this.repository.GetCategory(id);
if (category == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(category);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var category = this.repository.GetCategory(id);
this.repository.DeleteEntity(category);
return RedirectToLocal(returnUrl);
//return RedirectToAction("Details", this.ParentControllerName, new { Area = this.AreaName, id = category.termId });
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/OrderController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class OrderController : Controller
{
#region Constructor
private readonly repository repository;
public OrderController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int? id, int pageNumber, string searchString)
{
ViewBag.orderStatuses = this.repository.GetActiveOrderStatuses();
if (id == null)
id = (int)orderStatuses.payed;
ViewBag.orderStatusId = id;
var orders = this.repository.GetOrdersInStatus_ThisSite(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(orders);
}
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var order = this.repository.GetOrder(id);
if (order == null)
{
return NotFound();
}
return View(order);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Entities/sms_email/sms.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Entities
{
public class sms:baseEntity
{
[Display(Name = "متن")]
public string text { get; set; }
[Display(Name = "شماره موبایل")]
public string mobile { get; set; }
public int hookId { get; set; }
public hook hook { get; set; }
}
}
<file_sep>/Insurance/ClientApp/app/components/login/loginForm/loginForm.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { authService } from '../../../services/auth.service';
import { NgForm } from "@angular/forms";
//import { fieldSetComponent } from '../fieldSet/fieldSet.component';
@Component({
selector: 'loginForm',
templateUrl: './loginForm.component.html',
styleUrls: ['./loginForm.component.css']
})
export class loginFormComponent {
_authService: authService;
@Output() previousStepClicked = new EventEmitter();
constructor(authService: authService) {
this._authService = authService;
}
Login(form: NgForm): void {
//console.log(form.value.passWord);
this._authService.login(form.value.actualUserName, form.value.passWord);
}
previousStepClick() {
this.previousStepClicked.emit();
}
}
<file_sep>/Entities/blog/post_postCategory.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Entities
{
public class post_postCategory:baseClass
{
public post post { get; set; }
public postCategory postCategory { get; set; }
}
}
<file_sep>/Insurance/Controllers/OrderController.cs
using System;
using System.Collections.Generic;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using ThirdParty;
namespace Insurance.Controllers
{
[Route("api/Order")]
public class OrderController : Controller
{
#region Constructor
private readonly IHostingEnvironment env;
//context ctx;
repository repository;
private readonly HookManager hookManager;
public OrderController(repository repository, HookManager hookManager, IHostingEnvironment env)
{
//this.ctx = ctx;
this.repository = repository;
this.hookManager = hookManager;
this.env = env;
}
#endregion
[HttpPost("ProcessOrder")]
public int ProcessOrder([FromBody]insurance_client insurance)
{
//اگر قبلا رکورد این سفارش ثبت شده همان را بردار
if (insurance.orderId > 0)
{
order order = this.repository.GetOrder(insurance.orderId);
this.repository.MapInsuranceToOrder(order,insurance);
return order.id;
}
//اگر سفارش جدید است برای آن رکورد جدید ایجاد کن
//باید چک شود که لاگین هستیم یا نه
//else if (this.repository.GetUserId() > 0)
else
{
int orderId = repository.AddOrder(insurance);
return orderId;
}
//از اینجا به بعد مال قبله
//int orderId = repository.AddOrder(insurance);
////چون یوزر را میخواهیم مجبوریم این کار را بکنیم
//order order = this.repository.GetOrder(orderId);
//this.hookManager.HookFired("orderAdded", order.user, order);
//return orderId;
return 0;
}
[HttpPost("AddOrder")]
public int AddOrder([FromBody]insurance_client insurance)
{
int orderId = repository.AddOrder(insurance);
//چون یوزر را میخواهیم مجبوریم این کار را بکنیم
order order = this.repository.GetOrder(orderId);
this.hookManager.HookFired("orderAdded", order.user, order);
return orderId;
}
[HttpPost("uploadOrderFiles")]
public int uploadOrderFiles()
{
try
{
var files = Request.Form.Files;
var orderId = this.repository.ProccessOrderImage(files);
return orderId;
}
catch (Exception ex)
{
return -1;
//return ex.Message;
}
}
[HttpGet("[action]")]
public List<paymentType_client> GetPaymentTypes()
{
return repository.GetAcitvePaymentTypesOfCurrentUser_Client();
}
}
}<file_sep>/Insurance/Areas/Admin/TagHelper/AdminButton.cs
using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Insurance.Areas.Admin
{
[HtmlTargetElement(tag: "a", Attributes = "btntype")]
[HtmlTargetElement(tag: "input", Attributes = "btntype")]
public class AdminButton:TagHelper
{
public string btntype { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
switch (btntype.ToLower())
{
case "create":
output.Attributes.Add(new TagHelperAttribute("class", "btn btn-success btn-rounded"));
output.PostContent.AppendHtml(" <i class=\"fa fa-plus-circle\"></i>");
break;
case "edit":
output.Attributes.Add(new TagHelperAttribute("class", "btn btn-primary btn-rounded"));
output.PostContent.AppendHtml(" <i class=\"far fa-edit\"></i>");
break;
case "delete":
output.Attributes.Add(new TagHelperAttribute("class", "btn btn-danger btn-rounded"));
output.PostContent.AppendHtml(" <i class=\"far fa-trash-alt\"></i>");
break;
case "back":
output.Attributes.Add(new TagHelperAttribute("class", "btn btn-cancel btn-rounded"));
output.PostContent.AppendHtml(" <i class=\"fas fa-arrow-up\"></i>");
break;
case "save":
output.Attributes.Add(new TagHelperAttribute("class", "btn btn-success btn-rounded"));
output.PostContent.AppendHtml(" <i class=\"far fa-save\"></i>");
break;
case "cancel":
output.Attributes.Add(new TagHelperAttribute("class", "btn btn-cancel btn-rounded"));
break;
case "submitdelete":
output.Attributes.Add(new TagHelperAttribute("class", "btn btn-danger btn-rounded"));
output.PostContent.AppendHtml(" <i class=\"far fa-trash-alt\"></i>");
break;
default:
break;
}
base.Process(context, output);
}
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/InsuranceController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class InsuranceController : Controller
{
#region Constructor
private readonly repository repository;
public InsuranceController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var insurances = this.repository.GetInsurances(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(insurances);
}
public IActionResult Details(int? id , int pageNumber, string searchString)
{
if (id == null)
{
return NotFound();
}
var insurance = this.repository.GetInsurance(id);
if (insurance == null)
{
return NotFound();
}
ViewBag.steps = this.repository.GetStepsOfInsurance(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(insurance);
}
public IActionResult Create(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View(new insurance());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(insurance insurance, IFormFile image, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(insurance, image);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(insurance);
}
// GET: insurances/Edit/5
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var insurance = this.repository.GetInsurance(id);
if (insurance == null)
{
return NotFound();
}
//ViewBag.steps = this.repository.GetStepsOfInsurance(id,);
ViewData["ReturnUrl"] = returnUrl;
return View(insurance);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, insurance insurance, IFormFile image, string returnUrl = null)
{
if (id != insurance.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(insurance, image);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(insurance);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var insurance = this.repository.GetInsurance(id);
if (insurance == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(insurance);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var insurance = this.repository.GetInsurance(id);
this.repository.DeleteEntity(insurance);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/ViewComponent/BoxViewComponent.cs
using DAL;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace insurance_new
{
public class BoxViewComponent : ViewComponent
{
#region Constructor
private readonly repository repository;
public BoxViewComponent(repository repository)
{
this.repository = repository;
}
#endregion
#region Invoke
public async Task<IViewComponentResult> InvokeAsync(int id,
string template = "Default",
string componentName = "box-container",
bool isShowTitle = true)
{
ViewData["componentName"] = componentName;
ViewData["isShowTitle"] = isShowTitle;
var items = this.repository.GetBox(id);
return View(template, items);
}
#endregion
}
}
<file_sep>/Entities/order/order.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Entities
{
public class order : baseEntity
{
public order()
{
this.fields = new List<orderField>();
}
public int insuranceId { get; set; }
public int userId { get; set; }
[Display(Name = "تاریخ سفارش")]
public DateTime dateTime { get; set; }
[NotMapped]
public string persianDate
{
get
{
return PersianDate(this.dateTime);
}
}
[NotMapped]
public string persianTime
{
get
{
return PersianTime(this.dateTime);
}
}
public insurance insurance { get; set; }
[Display(Name = "مبلغ")]
public int price { get; set; }
public int? paymentTypeId { get; set; }
[Display(Name = "نوع پرداخت")]
public paymentType paymentType { get; set; }
public int orderStatusId { get; set; }
[Display(Name = "وضعیت سفارش")]
public orderStatus orderStatus { get; set; }
public List<orderField> fields { get; set; }
[Display(Name = "شناسه ارجاع بانک")]
public string bankReference { get; set; }
public string log { get; set; }
[NotMapped]
[Display(Name = "کدرهگیری")]
public string trackingCode
{
get
{
string siteId = this.siteId.ToString();
string id = this.id.ToString();
return id + siteId;
}
}
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/MenuController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class MenuController : Controller
{
#region Constructor
private readonly repository repository;
public MenuController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index()
{
var menus = this.repository.GetMenus_hierarchy();
return View(menus);
}
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var menu = this.repository.GetMenu(id);
if (menu == null)
{
return NotFound();
}
return View(menu);
}
public IActionResult Create(string returnUrl = null)
{
ViewBag.menus = new SelectList(this.repository.GetMenus(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(new menu());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(menu menu, IFormFile image, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(menu, image);
return RedirectToLocal(returnUrl);
}
ViewBag.menus = new SelectList(this.repository.GetMenus(), "id", "title", menu.fatherId);
ViewData["ReturnUrl"] = returnUrl;
return View(menu);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var menu = this.repository.GetMenu(id);
ViewBag.menus = new SelectList(this.repository.GetMenus(), "id", "title", menu.fatherId);
if (menu == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(menu);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, menu menu, IFormFile image, string returnUrl = null)
{
if (id != menu.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(menu, image);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(menu);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var menu = this.repository.GetMenu(id);
if (menu == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(menu);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var menu = this.repository.GetMenu(id);
this.repository.DeleteEntity(menu);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/DataTypeController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class DataTypeController : Controller
{
#region Constructor
private readonly repository repository;
public DataTypeController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var dataTypes = this.repository.GetDataTypes(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(dataTypes);
}
public IActionResult Details(int? id, int pageNumber, string searchString)
{
if (id == null)
{
return NotFound();
}
var dataType = this.repository.GetDataType(id);
if (dataType == null)
{
return NotFound();
}
ViewBag.dataValues = this.repository.GetDataValuesOfDataType(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(dataType);
}
public IActionResult Create(string returnUrl = null)
{
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(new dataType());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(dataType dataType, string returnUrl = null)
{
if (ModelState.IsValid)
{
dataType = (dataType)repository.AddEntity(dataType);
return RedirectToLocal(returnUrl);
}
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(dataType);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var dataType = this.repository.GetDataType(id);
if (dataType == null)
{
return NotFound();
}
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(dataType);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, dataType dataType, string returnUrl = null)
{
if (id != dataType.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
dataType = (dataType)this.repository.UpdateEntity(dataType);
return RedirectToLocal(returnUrl);
}
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(dataType);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var dataType = this.repository.GetDataType(id);
if (dataType == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(dataType);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var dataType = this.repository.GetDataType(id);
this.repository.DeleteEntity(dataType);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Entities/insurnce/term.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class term : baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
public List<category> categories { get; set; }
[Display(Name = "نوع داده")]
public int? dataTypeId { get; set; }
[Display(Name = "نوع داده")]
public dataType dataType { get; set; }
}
public class term_client : baseClient
{
public string name { get; set; }
public List<category> categories { get; set; }
}
}
<file_sep>/Entities/order/orderField.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Text;
namespace Entities
{
public class orderField : baseEntity
{
public string type { get; set; }
public string name { get; set; }
public string value { get; set; }
public int orderId { get; set; }
public order order { get; set; }
[NotMapped]
[Display(Name = "آیکن")]
public string image
{
get
{
if (this.site != null)
{
var name = this.site.name;
var type = "orderField";
string phisicalAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + name + "\\image\\" + type + "\\" + this.id.ToString() + ".jpg";
if (System.IO.File.Exists(phisicalAddress))
{
string webAddress = "/" + name + "/image/" + type + "/" + this.id.ToString() + ".jpg";
return webAddress;
}
}
return "";
}
}
public string persianDateFormat
{
get
{
return this.PersianDate(DateTime.Parse(this.value));
}
}
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/PostCategoryController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class PostCategoryController : Controller
{
#region Constructor
private readonly repository repository;
public PostCategoryController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index()
{
var postCategories = this.repository.GetPostCategories();
return View(postCategories);
}
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var postCategory = this.repository.GetPostCategory(id);
if (postCategory == null)
{
return NotFound();
}
return View(postCategory);
}
public IActionResult Create(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View(new postCategory());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(postCategory postCategory, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(postCategory);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(postCategory);
}
// GET: insurances/Edit/5
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var postCategory = this.repository.GetPostCategory(id);
if (postCategory == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(postCategory);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, postCategory postCategory, string returnUrl = null)
{
if (id != postCategory.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(postCategory);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(postCategory);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var postCategory = this.repository.GetPostCategory(id);
if (postCategory == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(postCategory);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var postCategory = this.repository.GetPostCategory(id);
this.repository.DeleteEntity(postCategory);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/StepController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class StepController : Controller
{
#region Constructor
private readonly repository repository;
public StepController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Details(int? id, int pageNumber, string searchString)
{
if (id == null)
{
return NotFound();
}
var step = this.repository.GetStep(id); ;
if (step == null)
{
return NotFound();
}
ViewBag.fieldSets = this.repository.GetFieldSetsOfStep(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(step);
}
public IActionResult Create(int insuranceId, string returnUrl = null)
{
ViewData["ParentId"] = insuranceId;
ViewData["ReturnUrl"] = returnUrl;
return View(new step());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(step step, IFormFile image, string returnUrl = null)
{
if (ModelState.IsValid)
{
this.repository.AddEntity(step, image);
return RedirectToLocal(returnUrl);
}
ViewData["ParentId"] = step.insuranceId;
ViewData["ReturnUrl"] = returnUrl;
return View(step);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var step = this.repository.GetStep(id);
if (step == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(step);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, step step, IFormFile image, string returnUrl = null)
{
if (id != step.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(step, image);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(step);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var step = this.repository.GetStep(id);
if (step == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(step);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var step = this.repository.GetStep(id);
this.repository.DeleteEntity(step);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/EmailController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class EmailController : Controller
{
#region Constructor
private readonly repository repository;
public EmailController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Create(int hookId, string returnUrl = null)
{
ViewData["ParentId"] = hookId;
ViewData["ReturnUrl"] = returnUrl;
return View(new email());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(email email, string returnUrl = null)
{
if (ModelState.IsValid)
{
this.repository.AddEntity(email);
return RedirectToLocal(returnUrl);
}
ViewData["ParentId"] = email.hookId;
ViewData["ReturnUrl"] = returnUrl;
return View(email);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var email = this.repository.GetEmail(id);
if (email == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(email);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, email email, string returnUrl = null)
{
if (id != email.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(email);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(email);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var email = this.repository.GetEmail(id);
if (email == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(email);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var email = this.repository.GetEmail(id);
this.repository.DeleteEntity(email);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Entities/baseEntity.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Globalization;
using System.Text;
namespace Entities
{
public class baseEntity : baseClass
{
public baseEntity()
{
this.active = true;
}
[Display(Name = "عنوان")]
public string title { get; set; }
[Display(Name = "ترتیب نمایش")]
public int orderIndex { get; set; }
[Display(Name = "فعال")]
public bool active { get; set; }
//برای جاهایی مثل سفارش که میخواهیم بگوییم این سفارش مال فلان کاربر است
[NotMapped]
public user user { get; set; }
}
}
<file_sep>/Entities/insurnce/field.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class field : baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
[Display(Name = "مقدار پیشفرض")]
public string value { get; set; }
[Display(Name = "والد")]
public int? fatherid { get; set; }
[Display(Name = "والد")]
public field father { get; set; }
//برای انگولار ارور دارد
//public List<field> childs { get; set; }
[Display(Name = "نوع")]
public string type { get; set; }
[Display(Name = "مقادیر")]
public int? dataTypeid { get; set; }
[Display(Name = "مقادیر")]
public dataType dataType { get; set; }
[Display(Name = "اجباری")]
public bool isRequire { get; set; }
[Display(Name = "عدم نمایش عنوان")]
public bool isHideLabel { get; set; }
[Display(Name = "سی اس اس فیلد")]
public string fieldCssClass { get; set; }
[Display(Name = "سی اس اس عنوان")]
public string labelCssClass { get; set; }
[Display(Name = "سی اس اس المان")]
public string elementCssClass { get; set; }
[Display(Name = "سی اس اس قبل از فیلد")]
public string beforeCssClass { get; set; }
[Display(Name = "سی اس اس بعد از فیلد")]
public string afterCssClass { get; set; }
[Display(Name = "پلیس هولدر")]
public string placeHolder { get; set; }
[NotMapped]
[Display(Name = "آیکن")]
public string image
{
get
{
if (this.site != null)
{
var name = this.site.name;
var type = "field";
string phisicalAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + name + "\\image\\" + type + "\\" + this.id.ToString() + ".jpg";
if (System.IO.File.Exists(phisicalAddress))
{
string webAddress = "/" + name + "/image/" + type + "/" + this.id.ToString() + ".jpg";
return webAddress;
}
}
return "";
}
}
[Display(Name = "راهنما")]
[DataType(DataType.MultilineText)]
public string tooltip { get; set; }
[Display(Name = "فیلدست")]
public int fieldSetId { get; set; }
[Display(Name = "فیلدست")]
public fieldSet fieldSet { get; set; }
[NotMapped]
public string titleAndType
{
get
{
return $"{this.title} ({this.type})";
}
}
[Display(Name = "شرط نمایش")]
public string showIf { get; set; }
[Display(Name = "فرمول")]
public string formula { get; set; }
}
public class field_client : baseClient
{
public field_client()
{
this.isShowField = true;
}
public string name { get; set; }
public string title { get; set; }
public string value { get; set; }
public int? fatherid { get; set; }
public string type { get; set; }
public int? dataTypeid { get; set; }
public List<dataValue_client> dataValues { get; set; }
public bool isRequire { get; set; }
public bool isHideLabel { get; set; }
public string fieldCssClass { get; set; }
public string labelCssClass { get; set; }
public string elementCssClass { get; set; }
public string beforeCssClass { get; set; }
public string afterCssClass { get; set; }
public string placeHolder { get; set; }
public string image { get; set; }
public bool isShowLoading { get; set; }
public int orderIndex { get; set; }
public string showIf { get; set; }
public bool isShowField { get; set; }
public string formula { get; set; }
public string tooltip { get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/BoxController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class BoxController : Controller
{
#region Constructor
private readonly repository repository;
public BoxController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var box = this.repository.GetBox(id); ;
if (box == null)
{
return NotFound();
}
return View(box);
}
public IActionResult Create(int boxCategoryId, string returnUrl = null)
{
ViewData["ParentId"] = boxCategoryId;
ViewData["ReturnUrl"] = returnUrl;
return View(new box());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(box box, IFormFile image, string returnUrl = null)
{
if (ModelState.IsValid)
{
this.repository.AddEntity(box, image);
return RedirectToLocal(returnUrl);
}
ViewData["ParentId"] = box.boxCategoryId;
ViewData["ReturnUrl"] = returnUrl;
return View(box);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var box = this.repository.GetBox(id);
if (box == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(box);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, box box, IFormFile image, string returnUrl = null)
{
if (id != box.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
box = (box)this.repository.UpdateEntity(box, image);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(box);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var box = this.repository.GetBox(id);
if (box == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(box);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var box = this.repository.GetBox(id);
this.repository.DeleteEntity(box);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Entities/site.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Entities
{
public class site
{
public int id { get; set; }
public string host { get; set; }
public string name { get; set; }
public DateTime lastAccess { get; set; }
}
}
<file_sep>/Insurance/ClientApp/app/components/login/login.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { authService } from '../../services/auth.service';
//import { fieldSetComponent } from '../fieldSet/fieldSet.component';
@Component({
selector: 'login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class loginComponent {
_authService: authService;
@Output() previousStepClicked = new EventEmitter();
constructor(authService: authService) {
this._authService = authService;
}
currentTab = 1;
changeTab(tab: number) {
this.currentTab = tab;
this._authService.user.clientMessage = "";
}
previousStepClick() {
this.previousStepClicked.emit();
}
}
<file_sep>/Insurance/Areas/Admin/TagHelper/ImageFieldTagHelper.cs
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Insurance.Areas.Admin
{
[HtmlTargetElement(tag: "img", Attributes = "rowid")]
public class ImageFieldTagHelper : TagHelper
{
public string rowid { get; set; }
public string imagesrc { get; set; }
public bool hideinput { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.Attributes.Add(new TagHelperAttribute("id", $"img_{rowid}"));
output.Attributes.Add(new TagHelperAttribute("class", "image-field"));
output.Attributes.Add(new TagHelperAttribute("onclick", $"$('#modal_{rowid}').show();"));
var input = new TagBuilder("input");
input.Attributes.Add("type", "file");
input.Attributes.Add("name", "image");
input.Attributes.Add("id", "image");
input.Attributes.Add("onchange", "readURL(this);");
var tagModal = new TagBuilder("div");
tagModal.Attributes.Add("id", $"modal_{rowid}");
tagModal.Attributes.Add("class", "modal");
var span = new TagBuilder("span");
tagModal.InnerHtml.AppendHtml($"<span class='close' onclick=\"$('#modal_{rowid}').hide(); \">×</span>");
tagModal.InnerHtml.AppendHtml($"<img class='modal-content' src='{imagesrc}'>");
if (!this.hideinput)
output.PreElement.AppendHtml(input);
output.PostElement.AppendHtml(tagModal);
base.Process(context, output);
}
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/SmsController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class SmsController : Controller
{
#region Constructor
private readonly repository repository;
public SmsController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Create(int hookId, string returnUrl = null)
{
ViewData["ParentId"] = hookId;
ViewData["ReturnUrl"] = returnUrl;
return View(new sms());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(sms sms, string returnUrl = null)
{
if (ModelState.IsValid)
{
this.repository.AddEntity(sms);
return RedirectToLocal(returnUrl);
}
ViewData["ParentId"] = sms.hookId;
ViewData["ReturnUrl"] = returnUrl;
return View(sms);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var sms = this.repository.GetSms(id);
if (sms == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(sms);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, sms sms, string returnUrl = null)
{
if (id != sms.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(sms);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(sms);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var sms = this.repository.GetSms(id);
if (sms == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(sms);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var sms = this.repository.GetSms(id);
this.repository.DeleteEntity(sms);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/ViewComponent/BoxGroupCategoryViewComponent.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace insurance_new
{
public class BoxGroupCategoryViewComponent : ViewComponent
{
#region Constructor
private readonly repository repository;
public BoxGroupCategoryViewComponent(repository repository)
{
this.repository = repository;
}
#endregion
#region Invoke
public async Task<IViewComponentResult> InvokeAsync(int id,
string template = "Default",
string componentName = "box-category",
bool isShowCategoryTitle = true,
bool isShowImage = false)
{
ViewData["componentName"] = componentName;
ViewData["isShowCategoryTitle"] = isShowCategoryTitle;
ViewData["categoryTitle"] = this.repository.GetBoxCategoryTitle(id);
ViewData["isShowImage"] = isShowImage;
var items = this.repository.GetActiveBoxCategories_Async(id);
return View(template, items);
}
#endregion
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/PaymentTypeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class PaymentTypeController : Controller
{
#region Constructor
private readonly repository repository;
public PaymentTypeController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var paymentTypes = this.repository.GetPaymentTypes(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(paymentTypes);
}
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var paymentType = this.repository.GetPaymentType(id);
if (paymentType == null)
{
return NotFound();
}
return View(paymentType);
}
public IActionResult Create(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View(new paymentType());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(paymentType paymentType, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(paymentType);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(paymentType);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var paymentType = this.repository.GetPaymentType(id);
if (paymentType == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(paymentType);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, paymentType paymentType, string returnUrl = null)
{
if (id != paymentType.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(paymentType);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(paymentType);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var paymentType = this.repository.GetPaymentType(id);
if (paymentType == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(paymentType);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var paymentType = this.repository.GetPaymentType(id);
this.repository.DeleteEntity(paymentType);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/DataValueController.cs
using DAL;
using Entities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Linq;
using System.Collections.Generic;
using Insurance.Services;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class DataValueController : Controller
{
#region Constructor
private readonly repository repository;
public DataValueController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Create(int dataTypeId, string returnUrl = null)
{
dataValue_vm dataValue_vm = new dataValue_vm
{
dataValue = new dataValue(),
terms = this.repository.GetTermsIncludeCategory(dataTypeId),
selectedCategories = new List<int>()
};
ViewBag.dataValues = new SelectList(this.repository.GetDataValuesOfFatherDataType(dataTypeId).OrderBy(dv => dv.title), "id", "title");
ViewData["ParentId"] = dataTypeId;
ViewData["ReturnUrl"] = returnUrl;
return View(dataValue_vm);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(dataValue_vm dataValue_vm, string returnUrl = null)
{
if (ModelState.IsValid)
{
var dv = this.repository.AddEntity(dataValue_vm.dataValue);
this.repository.SetCategoriesForDataValue(dv.id, dataValue_vm.selectedCategories);
return RedirectToLocal(returnUrl);
}
ViewBag.dataValues = new SelectList(this.repository.GetDataValuesOfFatherDataType(dataValue_vm.dataValue.dataTypeId).OrderBy(dv => dv.title), "id", "title");
ViewData["ParentId"] = dataValue_vm.dataValue.dataTypeId;
ViewData["ReturnUrl"] = returnUrl;
return View(dataValue_vm);
}
public IActionResult Edit(int? id,string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var dataValue = this.repository.GetDataValue(id);
if (dataValue == null)
{
return NotFound();
}
dataValue_vm dataValue_vm = new dataValue_vm
{
dataValue = dataValue,
terms = this.repository.GetTermsIncludeCategory(dataValue.dataTypeId),
selectedCategories = this.repository.GetAcitveCategories(id).Select(c => c.id).ToList()
};
ViewBag.dataValues = new SelectList(this.repository.GetDataValuesOfFatherDataType(dataValue.dataTypeId).OrderBy(dv => dv.title), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(dataValue_vm);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, dataValue_vm dataValue_vm, string returnUrl = null)
{
if (id != dataValue_vm.dataValue.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(dataValue_vm.dataValue);
this.repository.SetCategoriesForDataValue(id, dataValue_vm.selectedCategories);
return RedirectToLocal(returnUrl);
}
ViewBag.dataValues = new SelectList(this.repository.GetDataValuesOfFatherDataType(dataValue_vm.dataValue.dataTypeId).OrderBy(dv => dv.title), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(dataValue_vm);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var dataValue = this.repository.GetDataValue(id);
if (dataValue == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(dataValue);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var dataValue = this.repository.GetDataValue(id);
this.repository.DeleteEntity(dataValue);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Profile/Controllers/PaymentController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Entities;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using DAL;
using ThirdParty;
using Insurance.Services;
namespace Insurance.Areas.Profile.Controllers
{
[Area("Profile")]
public class PaymentController : Controller
{
#region Constructor
private readonly repository repository;
private readonly MellatService mellatService;
private readonly HookManager hookManager;
public PaymentController(repository repository, MellatService mellatService,HookManager hookManager)
{
this.repository = repository;
this.mellatService = mellatService;
this.hookManager = hookManager;
}
#endregion
public IActionResult Index(int id)
{
var order = this.repository.GetOrder(id);
if (order.paymentType.name == "online")
{
switch (this.repository.GetSetting("bank") )
{
case "mellat":
default:
var res = this.mellatService.PayRequest(order);
return RedirectToAction("MellatRequest", "Payment", new { refId = res });
}
}
else
{
//پرداخت نشده
this.repository.ChangeOrderStatus(order,(int)orderStatuses.noPayment);
this.hookManager.HookFired("orderCompleted", order.user, order);
return View("Completed", order);
}
}
public IActionResult MellatRequest(string refId)
{
ViewBag.jscode = "postRefId('" + refId + "')";
return View();
}
[HttpPost]
public IActionResult MellatResponse(string RefId="", string ResCode="", string SaleOrderId="", string SaleReferenceId="")
{
try
{
order order = this.repository.GetOrder(Int32.Parse(SaleOrderId));
//repository.AddLogToOrder(order, "MellatResponse rescode=" + ResCode + "&saleorderid=" + SaleOrderId + "&SaleReferenceId=" + SaleReferenceId);
if (ResCode != "0")
throw new Exception(Mellat.TranslateMessage(ResCode));
this.mellatService.VerifyResult(order, SaleReferenceId);
this.repository.SetOrderBankReference(order, SaleReferenceId);
this.repository.ChangeOrderStatus(order, (int)orderStatuses.payed);
//try
//{
// this.mellatService.SettleRequest(order);
//}
//catch (Exception ex)
//{
// //AddMessage(ex.Message, "Info");
//}
this.hookManager.HookFired("orderCompleted", order.user, order);
this.hookManager.HookFired("paymentCompleted", order.user, order);
return View("Completed",order);
}
catch(Exception ex)
{
return View("error",ex.Message);
}
}
}
}<file_sep>/DAL/Migrations/20180726052512_refactor_sms2.cs
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace DAL.Migrations
{
public partial class refactor_sms2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "sms_emails");
migrationBuilder.CreateTable(
name: "smses",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
updateUserId = table.Column<int>(nullable: false),
updateDateTime = table.Column<DateTime>(nullable: false),
siteId = table.Column<int>(nullable: false),
isDeleted = table.Column<bool>(nullable: false),
title = table.Column<string>(nullable: true),
orderIndex = table.Column<int>(nullable: false),
active = table.Column<bool>(nullable: false),
text = table.Column<string>(nullable: true),
mobile = table.Column<string>(nullable: true),
hookid = table.Column<int>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_smses", x => x.id);
table.ForeignKey(
name: "FK_smses_hooks_hookid",
column: x => x.hookid,
principalTable: "hooks",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_smses_sites_siteId",
column: x => x.siteId,
principalTable: "sites",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_smses_hookid",
table: "smses",
column: "hookid");
migrationBuilder.CreateIndex(
name: "IX_smses_siteId",
table: "smses",
column: "siteId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "smses");
migrationBuilder.CreateTable(
name: "sms_emails",
columns: table => new
{
id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
active = table.Column<bool>(nullable: false),
hookId = table.Column<int>(nullable: false),
isDeleted = table.Column<bool>(nullable: false),
mobile = table.Column<string>(nullable: true),
orderIndex = table.Column<int>(nullable: false),
siteId = table.Column<int>(nullable: false),
text = table.Column<string>(nullable: true),
title = table.Column<string>(nullable: true),
type = table.Column<string>(nullable: true),
updateDateTime = table.Column<DateTime>(nullable: false),
updateUserId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sms_emails", x => x.id);
table.ForeignKey(
name: "FK_sms_emails_hooks_hookId",
column: x => x.hookId,
principalTable: "hooks",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_sms_emails_sites_siteId",
column: x => x.siteId,
principalTable: "sites",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_sms_emails_hookId",
table: "sms_emails",
column: "hookId");
migrationBuilder.CreateIndex(
name: "IX_sms_emails_siteId",
table: "sms_emails",
column: "siteId");
}
}
}
<file_sep>/Insurance/ClientApp/app/components/insurance/field/field.component.ts
import { Component, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';
import * as moment from 'jalali-moment';
import { DatePickerDirective, DpDatePickerModule, CalendarValue } from 'ng2-jalali-date-picker';
import { Console } from '@angular/core/src/console';
import { NgForm } from "@angular/forms";
import { insuranceService } from '../../../services/insurance.service';
import { authService } from '../../../services/auth.service';
@Component({
selector: 'field',
templateUrl: './field.component.html',
styleUrls: ['./field.component.css']
})
export class fieldComponent {
@Input() insurance: any;
@Input() step: any;
@Input() fieldSet: any;
@Input() field: any;
// options: any;
_insuranceService: insuranceService;
_authService: authService;
@Output() valueChanged = new EventEmitter<any>();
constructor(insuranceService: insuranceService, authService: authService) {
this.initYears();
this._insuranceService = insuranceService;
this._authService = authService;
}
ngOnInit() {
if (this.field.isRequire)
this.field.labelCssClass += " require";
if (this.field && this.field.type == "image")
this.showImage();
//console.log("oninit");
//console.log(this.field.dataValues);
if (this.field && this.field.type == "date") {
this.field.value = moment();
}
if (this.field && this.field.type == "comboBox" && !this.field.dataValues && !this.field.fatherid)
this._insuranceService.fetchDataValues(this.field);
else if (this.field && this.field.type == "paymentType" && !this.field.dataValues)
this._insuranceService.fetchPaymentTypes(this.field);
else {
this.replacePatterns();
}
this._insuranceService.resetChild(this.step, this.field);
// this.options = [{ id: 1, title: 'mohammad' }, { id: 2, text: 'hamid' }];
}
@ViewChild('imageCanvas') imageCanvas: ElementRef;
valueChange(event: any) {
if (this.field.type == 'image' || this.field.type == 'inputImage') {
let fi = event.target;
if (fi.files && fi.files[0]) {
this.processImage(fi.files[0]);
}
}
else if (this.field.type == 'number' && isNaN(parseInt(event.data))) {
this.field.value = this.field.value.replace(event.data, "");
//console.log(event);
}
else if (this.field.type == 'comboBox' || this.field.type == 'year')
this.field.value = event.value;
//console.log("field " + this.field.name + " change to -> " + this.field.value);
this._insuranceService.resetChild(this.step, this.field);
this._insuranceService.refreshFields(this.insurance);
this._insuranceService.ValidateAllRequired(this.step);
if (this.step.number == 1)
this._insuranceService.calcPrice(this.insurance);
this.valueChanged.emit(this.field);
}
//-----------------------------------------------------------------------------
processImage(file: any) {
//is file an image
var filename = file.name;
var index = filename.lastIndexOf(".");
var strsubstring = filename.substring(index, filename.length);
strsubstring = strsubstring.toLowerCase();
if (!(strsubstring == '.png' || strsubstring == '.jpeg' || strsubstring == '.jpg')) {
alert("لطفا فقط تصویر انتخاب کنید.");
this.field.value = false;
return;
}
if (file < 200000) {
this._insuranceService.addFile(this.insurance.name, this.field.name, file);
this.field.value = true;
return;
}
//compress image
let cnv = document.createElement('canvas');
var reader = new FileReader();
let thisPointer = this;
reader.onload = (event: any) => {
let img = new Image();
img.onload = function () {
var MAX_WIDTH = 800;
var MAX_HEIGHT = 600;
var width = img.width;
var height = img.height;
if (width > height) {
if (width > MAX_WIDTH) {
height *= MAX_WIDTH / width;
width = MAX_WIDTH;
}
} else {
if (height > MAX_HEIGHT) {
width *= MAX_HEIGHT / height;
height = MAX_HEIGHT;
}
}
cnv.width = width;
cnv.height = height;
var ctx = cnv.getContext("2d");
if (ctx)
ctx.drawImage(img, 0, 0, width, height);
var dataurl = cnv.toDataURL("image/jpeg",0.95);
var blobBin = atob(dataurl.split(',')[1]);
var array = [];
for (var i = 0; i < blobBin.length; i++) {
array.push(blobBin.charCodeAt(i));
}
//get compressed file
var createdFile = new Blob([new Uint8Array(array)], { type: 'image/jpeg' });
//set compressed file into files array
thisPointer._insuranceService.addFile(thisPointer.insurance.name, thisPointer.field.name, createdFile);
//show image
if (thisPointer.field.type == 'image') {
thisPointer.showImage();
}
}
img.src = event.target.result;
}
reader.readAsDataURL(file);
this.field.value = true;
}
//-----------------------------------------------------------------------------
imageFile = "/common/image/uploadfile.jpg";
showImage() {
let file = this._insuranceService.getFile(this.insurance.name, this.field.name);
if (!file)
return;
var reader = new FileReader();
reader.onload = (event: any) => {
this.imageFile = event.target.result;
}
reader.readAsDataURL(file);
}
//-----------------------------------------------------------------------------
datePickerConfig = {
format: 'YYYY/MM/DD'
}
//-----------------------------------------------------------------------------
years: option[] = [];
initYears() {
let jalaliYear: any;
let gregorianYear: any;
jalaliYear = moment().locale('fa').format('YYYY')
gregorianYear = moment().locale('en').format('YYYY')
for (var i = 0; i <= 25; i++) {
let year = new option();
year.id = jalaliYear;
year.text = jalaliYear + " - " + gregorianYear;
this.years.push(year);
jalaliYear--;
gregorianYear--;
}
}
//-----------------------------------------------------------------------------
@ViewChild('fileInput') fileInput: ElementRef;
public openFileDialog(): void {
let event = new MouseEvent('click', { bubbles: false });
this.fileInput.nativeElement.dispatchEvent(event);
}
//-----------------------------------------------------------------------------
replacePatterns() {
while (true) {
let Patterns = /\[.*\]/i.exec(this.field.value);
if (Patterns == null) {
break;
}
let fakeValue = Patterns[0].replace(/^\[+|\]+$/g, '');
let actualValue = "";
if (fakeValue.startsWith("user.")) {
fakeValue = fakeValue.replace("user.", "");
actualValue = this._authService.user[fakeValue];
}
else {
actualValue = this._insuranceService.textByName(this.insurance.name, fakeValue);
}
if (actualValue == null)
actualValue = "";
this.field.value = this.field.value.replace(Patterns, actualValue)
}
}
}
class option {
id: number;
text: string;
}
<file_sep>/Entities/insurnce/fieldSet.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class fieldSet : baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
[Display(Name = "سی اس اس")]
public string cssClass { get; set; }
[Display(Name = "مرحله")]
public int stepId { get; set; }
[Display(Name = "مرحله")]
public step step { get; set; }
public List<field> fields { get; set; }
}
public class fieldSet_client : baseClient
{
public string name { get; set; }
public string title { get; set; }
public string cssClass { get; set; }
public List<field_client> fields { get; set; }
public int orderIndex { get; set; }
}
}
<file_sep>/Entities/reminder/reminder.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class reminder:baseEntity
{
[Display(Name = "نام و نام خانوادگی")]
public string fullName { get; set; }
[Display(Name = "شماره موبایل")]
public string mobile { get; set; }
[Display(Name = "روز اتمام بیمه")]
public int day{ get; set; }
[Display(Name = "ماه اتمام بیمه")]
public int month { get; set; }
[Display(Name = "ایمیل")]
public string email { get; set; }
[Display(Name = "نوع بیمه نامه")]
public string insuranceType { get; set; }
[Display(Name = "توضیح ضمیمه")]
public string comment { get; set; }
}
}
<file_sep>/Entities/order/orderStatus.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Entities
{
//1 ناتمام
//2 پرداخت نشده
//3 پرداخت شده
public enum orderStatuses
{
inCompleted = 1, noPayment = 2, payed = 3
}
public class orderStatus: baseEntity
{
[Display(Name = "رنگ")]
public string color { get; set; }
}
}
<file_sep>/Entities/baseClass.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Globalization;
using System.Text;
namespace Entities
{
public class baseClass
{
[Display(Name = "شناسه")]
public int id { get; set; }
public int updateUserId { get; set; }
public DateTime updateDateTime { get; set; }
public int siteId { get; set; }
public site site { get; set; }
public bool isDeleted { get; set; }
[NotMapped]
public string persianUpdateDate
{
get
{
return PersianDate(this.updateDateTime);
}
}
[NotMapped]
public string persianUpdateTime
{
get
{
return PersianTime(this.updateDateTime);
}
}
protected string PersianDate(DateTime dateTime)
{
try
{
PersianCalendar pc = new PersianCalendar();
int y = pc.GetYear(dateTime);
int m = pc.GetMonth(dateTime);
int d = pc.GetDayOfMonth(dateTime);
var dow = pc.GetDayOfWeek(dateTime);
string res = "";
switch (dow)
{
case DayOfWeek.Friday:
res = "جمعه";
break;
case DayOfWeek.Monday:
res = "دوشنبه";
break;
case DayOfWeek.Saturday:
res = "شنبه";
break;
case DayOfWeek.Sunday:
res = "یکشنبه";
break;
case DayOfWeek.Thursday:
res = "پنجشنبه";
break;
case DayOfWeek.Tuesday:
res = "سه شنبه";
break;
case DayOfWeek.Wednesday:
res = "چهارشنبه";
break;
}
res += " " + d.ToString() + " ";
switch (m)
{
case 1:
res += "فروردین";
break;
case 2:
res += "اردیبهشت";
break;
case 3:
res += "خرداد";
break;
case 4:
res += "تیر";
break;
case 5:
res += "مرداد";
break;
case 6:
res += "شهریور";
break;
case 7:
res += "مهر";
break;
case 8:
res += "آبان";
break;
case 9:
res += "آذر";
break;
case 10:
res += "دی";
break;
case 11:
res += "بهمن";
break;
case 12:
res += "اسفند";
break;
}
res += " " + y.ToString();
return res;
}
catch
{
return "";
}
}
protected string PersianTime(DateTime dateTime)
{
try
{
PersianCalendar pc = new PersianCalendar();
int h = pc.GetHour(dateTime);
int m = pc.GetMinute(dateTime);
string res = "ساعت";
res += " " + h.ToString().PadLeft(2, '0') + ":" + m.ToString().PadLeft(2, '0');
return res;
}
catch
{
return "";
}
}
}
public class baseClient
{
public int id { get; set; }
}
}
<file_sep>/Entities/setting/setting.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class setting:baseEntity
{
[Display(Name = "نام خاصیت")]
public string key { get; set; }
[Display(Name = "مقدار")]
public string value { get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/AccountController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
//[Authorize]
public class AccountController : Controller
{
private readonly repository repository;
public AccountController(repository repository)
{
this.repository = repository;
}
public IActionResult Login(string returnUrl = null)
{
this.repository.LogOut();
ViewData["ReturnUrl"] = returnUrl;
return View();
}
[HttpPost]
public IActionResult Login(user_express user, string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
if (ModelState.IsValid)
{
var result = repository.Login(user.actualUserName, user.password, user.rememberMe);
if (result.Succeeded)
return RedirectToLocal(returnUrl);
}
return View(user);
}
[HttpGet]
public IActionResult Register(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Register(user_express user, string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
if (ModelState.IsValid)
{
var result = this.repository.AddUser(user);
if (result.Succeeded)
{
this.repository.Login(user.actualUserName, user.password, true);
return RedirectToLocal(returnUrl);
}
}
return View(user);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Logout()
{
this.repository.LogOut();
return RedirectToAction(nameof(HomeController.Index), "Home");
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/SettingController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class SettingController : Controller
{
#region Constructor
private readonly repository repository;
public SettingController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var settings = this.repository.GetSettings(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(settings);
}
public IActionResult Create(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View(new setting());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(setting setting, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(setting);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(setting);
}
// GET: insurances/Edit/5
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var setting = this.repository.GetSetting(id);
if (setting == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(setting);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, setting setting, string returnUrl = null)
{
if (id != setting.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(setting);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(setting);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var setting = this.repository.GetSetting(id);
if (setting == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(setting);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var setting = this.repository.GetSetting(id);
this.repository.DeleteEntity(setting);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Services/EmailSender.cs
using DAL;
using System;
using System.Collections.Generic;
using System.Text;
using ThirdParty;
namespace Insurance.Services
{
public class EmailSender
{
#region Constructor
private readonly repository repository;
public EmailSender(repository repository)
{
this.repository = repository;
}
#endregion
public bool SendEmail(string to, string subject,string body)
{
Email email = new Email
{
EmailFromAddress = this.repository.GetSetting("EmailFromAddress"),
EmailFromPassword = this.repository.GetSetting("EmailFromPassword"),
EmailSmtpAddress = this.repository.GetSetting("EmailSmtpAddress"),
EmailSmtpPort = Int32.Parse(this.repository.GetSetting("EmailSmtpPort")),
EmailEnableSsl = bool.Parse(this.repository.GetSetting("EmailEnableSsl"))
};
return email.Send(to, subject,body);
}
}
}
<file_sep>/DAL/Migrations/20180812052909_term_dataType.cs
using Microsoft.EntityFrameworkCore.Migrations;
namespace DAL.Migrations
{
public partial class term_dataType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_categories_dataTypes_dataTypeId",
table: "categories");
migrationBuilder.DropIndex(
name: "IX_categories_dataTypeId",
table: "categories");
migrationBuilder.DropColumn(
name: "dataTypeId",
table: "categories");
migrationBuilder.AddColumn<int>(
name: "dataTypeId",
table: "terms",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_terms_dataTypeId",
table: "terms",
column: "dataTypeId");
migrationBuilder.AddForeignKey(
name: "FK_terms_dataTypes_dataTypeId",
table: "terms",
column: "dataTypeId",
principalTable: "dataTypes",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_terms_dataTypes_dataTypeId",
table: "terms");
migrationBuilder.DropIndex(
name: "IX_terms_dataTypeId",
table: "terms");
migrationBuilder.DropColumn(
name: "dataTypeId",
table: "terms");
migrationBuilder.AddColumn<int>(
name: "dataTypeId",
table: "categories",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_categories_dataTypeId",
table: "categories",
column: "dataTypeId");
migrationBuilder.AddForeignKey(
name: "FK_categories_dataTypes_dataTypeId",
table: "categories",
column: "dataTypeId",
principalTable: "dataTypes",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}
<file_sep>/Insurance/ViewComponent/MenuViewComponent.cs
using DAL;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace insurance_new
{
public class MenuViewComponent : ViewComponent
{
#region Construcotr
private readonly repository repository;
public MenuViewComponent(repository repository)
{
this.repository = repository;
}
#endregion
#region Invoke
public async Task<IViewComponentResult> InvokeAsync(int id,
string template = "Default",
string componentName = "top-menu")
{
var items = this.repository.GeActiveChildMenus_Async(id);
ViewData["componentName"] = componentName;
return View(template, items);
}
#endregion
}
}
<file_sep>/Insurance/Areas/Admin/Utility/paging.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Insurance
{
public class pagedResult<T> where T : new()
{
public List<T> items { get; set; } = new List<T>();
public PagingData pagingData { get; set; } = new PagingData();
}
public class PagingData
{
public int totalItems { get; set; }
public int itemsPerPage { get; set; }
public int currentPage { get; set; }
public int totalPages => (int)Math.Ceiling((decimal)totalItems / itemsPerPage);
}
}
<file_sep>/Insurance/Areas/Profile/Controllers/HomeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Profile.Controllers
{
[Area("Profile")]
[Authorize]
public class HomeController : Controller
{
#region Constructor
private readonly string AreaName = "Admin";
private readonly string ControllerName = "Insurance";
private readonly repository repository;
public HomeController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index()
{
var orders = this.repository.GetOrdersOfCurrentUser_ThisSite();
var x = this.repository.GetSetting("bank");
return View(orders);
}
}
}<file_sep>/Entities/insurnce/dataValue_category.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class dataValue_category : baseClass
{
public int dataValueId { get; set; }
public dataValue dataValue { get; set; }
public int categoryId { get; set; }
public category category { get; set; }
}
public class dataValue_category_client : baseClient
{
//public dataValue dataValue { get; set; }
public category_client category { get; set; }
}
}
<file_sep>/Insurance/Services/MellatService.cs
using Entities;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ThirdParty;
namespace Insurance.Services
{
public class MellatService
{
#region Constructor
private readonly repository repository;
private readonly IHttpContextAccessor httpContextAccessor;
Mellat Mellat;
public MellatService(repository repository, IHttpContextAccessor httpContextAccessor)
{
this.repository = repository;
this.httpContextAccessor = httpContextAccessor;
Mellat = new Mellat
{
terminalId = Int64.Parse(this.repository.GetSetting("mellatTerminalId")),
userName = this.repository.GetSetting("mellatUserName"),
password = this.repository.GetSetting("mellatPassword")
};
}
#endregion
public string PayRequest(order order)
{
try
{
var request = httpContextAccessor.HttpContext.Request;
UriBuilder uriBuilder = new UriBuilder();
uriBuilder.Scheme = request.Scheme;
uriBuilder.Host = request.Host.Host;
uriBuilder.Path = "/Profile/Payment/MellatResponse";
string CallBackUrl = uriBuilder.Uri.ToString();
string res = this.Mellat.PayRequest(order.id, order.price * 10, CallBackUrl);
return res;
}
catch (Exception ex)
{
return ex.Message;
}
}
public void VerifyResult(order order, string SaleReferenceId)
{
try
{
repository.AddLogToOrder(order, "VerifyResult salereferenceid=" + SaleReferenceId);
this.Mellat.VerifyResult(order.id,SaleReferenceId);
}
catch (Exception ex)
{
repository.AddLogToOrder(order, "VerifyResult result=" + ex.Message);
throw new Exception(ex.Message);
}
}
public void SettleRequest(order order)
{
try
{
this.Mellat.SettleRequest(order.id, order.bankReference);
}
catch (Exception ex)
{
repository.AddLogToOrder(order, "SettleRequest result=" + ex.Message);
throw new Exception(ex.Message);
}
}
}
}
<file_sep>/Entities/order/paymentType.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Entities
{
public class paymentType : baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
[Display(Name = "نمایش برای همه")]
public bool showForAll { get; set; }
public List<user_paymentType> user_paymentType { get; set; }
}
public class paymentType_client : baseClient
{
public string title { get; set; }
}
}
<file_sep>/Entities/insurnce/dataType.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class dataType:baseEntity
{
public List<dataValue> dataValues { get; set; }
[Display(Name = "والد")]
public int? fatherId { get; set; }
[Display(Name = "والد")]
public dataType father { get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/UserController.cs
using System.Linq;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class UserController : Controller
{
#region Constructor
private readonly repository repository;
public UserController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var users = this.repository.GetUsers_ThisSite(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(users);
}
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var user = this.repository.GetUser_Express(id);
if (user == null)
{
return NotFound();
}
return View(user);
}
[HttpGet]
public IActionResult Create()
{
return View(new user());
}
[HttpPost]
public IActionResult Create(user_express user)
{
if (ModelState.IsValid)
{
var result = repository.AddUser(user);
}
return RedirectToAction("Index");
}
public IActionResult PaymentTypes(int id, string returnUrl = null)
{
var user = this.repository.GetUser_Express(id);
if (user == null)
{
return NotFound();
}
user_vm user_vm = new user_vm
{
user = user,
paymentTypes = this.repository.GetPaymentTypes().Where(pt => !pt.showForAll).ToList(),
selectedPaymentTypes = this.repository.GetAcitvePaymentTypes(id).Select(pt => pt.id).ToList()
};
ViewData["ReturnUrl"] = returnUrl;
return View(user_vm);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult PaymentTypes(int id, int[] paymentTypes, string returnUrl = null)
{
var user = this.repository.GetUser(id);
if (user == null)
{
return NotFound();
}
this.repository.SetPaymentTypesForUser(id, paymentTypes);
return RedirectToLocal(returnUrl);
}
public IActionResult Role(int id, string returnUrl = null)
{
var user = this.repository.GetUser_Express(id);
if (user == null)
{
return NotFound();
}
user_vm user_vm = new user_vm
{
user = user,
roles = new SelectList(this.repository.GetAllRoles_ThisSite(), "Name", "actualName"),
selectedRole = this.repository.GetRole(id)
};
ViewData["ReturnUrl"] = returnUrl;
return View(user_vm);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Role(int id, string selectedRole, string returnUrl = null)
{
repository.AssignRoleToUser(id, selectedRole);
return RedirectToLocal(returnUrl);
}
public IActionResult Delete(int? id)
{
if (id == null)
{
return NotFound();
}
var user = this.repository.GetUser_Express(id);
if (user == null)
{
return NotFound();
}
return View(user);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id)
{
repository.DeleteUser(id);
return RedirectToAction("Index");
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Entities/auth/role.cs
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Entities
{
public class role:IdentityRole<int>
{
[NotMapped]
public string actualName
{
get
{
try
{
var arr = this.Name.Split('_');
string res = "";
for (int i = 0; i < arr.Length - 1; i++)
{
res += arr[i] + "_";
}
res = res.TrimEnd('_');
return res;
}
catch
{
return "";
}
}
set
{
this.Name = value + "_" + this.siteId;
}
}
public int siteId { get; set; }
public int updateUserId { get; set; }
public DateTime updateDateTime { get; set; }
public bool isDeleted { get; set; }
}
}
<file_sep>/Entities/auth/adminMenu.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Entities
{
public class adminMenu:baseEntity
{
public string area { get; set; }
public string controller { get; set; }
public bool showInMenu { get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/RoleController.cs
using DAL;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class RoleController : Controller
{
#region Constructor
private readonly repository repository;
public RoleController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var roles = this.repository.GetAllRoles_ThisSite(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(roles);
}
public IActionResult Create( string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View();
}
[HttpPost]
public IActionResult Create(string name, string returnUrl = null)
{
var result = this.repository.AddRole(name);
ViewData["ReturnUrl"] = returnUrl;
return RedirectToAction("Index");
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/PostController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class PostController : Controller
{
#region Constructor
private readonly repository repository;
public PostController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber,string searchString)
{
var posts = this.repository.GetPosts(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(posts);
}
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var post = this.repository.GetPost(id);
if (post == null)
{
return NotFound();
}
return View(post);
}
public IActionResult Create(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View(new post());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(post post, IFormFile image, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(post, image);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(post);
}
// GET: insurances/Edit/5
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var post = this.repository.GetPost(id);
if (post == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(post);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, post post, IFormFile image, string returnUrl = null)
{
if (id != post.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(post, image);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(post);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var post = this.repository.GetPost(id);
if (post == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(post);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var post = this.repository.GetPost(id);
this.repository.DeleteEntity(post);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Entities/insurnce/insurance.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class insurance:baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
[NotMapped]
[Display(Name = "تصویر")]
public string image
{
get
{
if (this.site != null)
{
var name = this.site.name;
var type = "insurance";
string phisicalAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + name + "\\image\\" + type + "\\" + this.id.ToString() + ".jpg";
if (System.IO.File.Exists(phisicalAddress))
{
string webAddress = "/" + name + "/image/" + type + "/" + this.id.ToString() + ".jpg";
return webAddress;
}
}
return "";
}
}
[Display(Name = "فرمول")]
public string formula { get; set; }
[Display(Name = "سی اس اس")]
public string cssClass { get; set; }
[Display(Name = "مراحل")]
public List<step> steps { get; set; }
[Display(Name = "تعداد مراحل")]
public int stepCount { get; set; }
[Display(Name = "موقعیت تب ها")]
public string tabLocation { get; set; }
public List<order> orders { get; set; }
[Display(Name = "جاوااسکریپت")]
public string onClientClick { get; set; }
[Display(Name = "بیمه پیشفرض")]
public bool isDefault { get; set; }
}
public class insurance_client : baseClient
{
public insurance_client()
{
this.price = 0;
this.currentStep = 1;
}
public int orderId { get; set; }
public string name { get; set; }
public string title { get; set; }
public string formula { get; set; }
public string cssClass { get; set; }
public int price { get; set; }
public List<step_client> steps { get; set; }
public int currentStep { get; set; }
public int stepCount { get; set; }
public string image { get; set; }
public List<step_navigation> step_navigations { get; set; }
public string tabLocation { get; set; }
public string onClientClick { get; set; }
public bool isDefault { get; set; }
}
}
<file_sep>/Insurance/Controllers/InsuranceController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace Insurance.Controllers
{
[Route("api/[controller]")]
public class InsuranceController : Controller
{
//context ctx;
repository repository;
private readonly HookManager hookManager;
public InsuranceController(repository repository,HookManager hookManager)
{
//this.ctx = ctx;
this.repository = repository;
this.hookManager = hookManager;
}
[HttpGet("[action]")]
public IEnumerable<insurance_client> GetInsurances()
{
return repository.GetActiveInsurances_Client();
}
[HttpGet("[action]")]
public step_client GetStep(int insuranceId, int stepNumber)
{
return repository.GetStep_client(insuranceId, stepNumber);
}
[HttpGet("[action]")]
public List<dataValue_client> GetDataValues(int dataTypeId)
{
return repository.GetAcitveDataValues_Client(dataTypeId);
}
[HttpGet("[action]")]
public List<dataValue_client> GetChildDataValues(int dataTypeId, int fatherId)
{
return repository.GetActiveChildDataValues_Client(dataTypeId, fatherId);
}
[HttpPost("[action]")]
public int CalcPrice([FromBody]step step)
{
//var json = JsonConvert.SerializeObject(step);
//var price = ctx.price.FromSql("calc1 @step={0}", json).FirstOrDefault();
//return price.value;
return 100;
}
}
}
<file_sep>/ThirdParty/PayamResan.cs
using System.Collections.Generic;
using System.Net.Http;
namespace ThirdParty
{
public class PayamResan
{
#region Constructor
public string Username;
public string Password;
public string From;
public PayamResan()
{
}
#endregion
public bool SendSmsByUrl(string to,string text)
{
HttpClient client = new HttpClient();
var values = new Dictionary<string, string>
{
{ "Username", this.Username },
{ "Password", <PASSWORD> },
{ "From", this.From},
{ "To", to },
{ "Text", text }
};
var content = new FormUrlEncodedContent(values);
var response = client.PostAsync("http://www.payam-resan.com/APISend.aspx", content);
return true;
}
}
}
<file_sep>/Entities/blog/post.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Text;
namespace Entities
{
public class post : baseEntity
{
[Display(Name = "عنوان دوم")]
public string title2 { get; set; }
[Display(Name = "متا دیسکریپشن")]
public string metaDescription { get; set; }
[Display(Name = "متا کیورد")]
public string metaKeywords { get; set; }
[Display(Name = "متن")]
[DataType(DataType.MultilineText)]
public string content { get; set; }
[Display(Name = "خلاصه")]
[DataType(DataType.MultilineText)]
public string brief { get; set; }
[NotMapped]
[Display(Name = "تصویر")]
public string image
{
get
{
if (this.site != null)
{
var name = this.site.name;
var type = "post";
string phisicalAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + name + "\\image\\" + type + "\\" + this.id.ToString() + ".jpg";
if (System.IO.File.Exists(phisicalAddress))
{
string webAddress = "/" + name + "/image/" + type + "/" + this.id.ToString() + ".jpg";
return webAddress;
}
}
return "";
}
}
[Display(Name = "سی اس اس")]
public string cssClass { get; set; }
public List<post_postCategory> categories { get; set; }
[NotMapped]
public string SeoTitle {
get {
return this.title.Replace(" ", "-");
}
}
}
}
<file_sep>/Entities/blog/menu.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class menu : baseEntity
{
[NotMapped]
[Display(Name = "تصویر")]
public string image
{
get
{
if (this.site != null)
{
var name = this.site.name;
var type = "menu";
string phisicalAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + name + "\\image\\" + type + "\\" + this.id.ToString() + ".jpg";
if (System.IO.File.Exists(phisicalAddress))
{
string webAddress = "/" + name + "/image/" + type + "/" + this.id.ToString() + ".jpg";
return webAddress;
}
}
return "";
}
}
[Display(Name = "لینک")]
public string link { get; set; }
public List<menu> childs { get; set; }
[Display(Name = "والد")]
public int? fatherId { get; set; }
[Display(Name = "والد")]
public menu father { get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/TestController.cs
using System;
using System.Net;
using System.Net.Mail;
using DAL;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class TestController : Controller
{
private readonly repository repository;
private readonly SmsSender smsSender;
private readonly EmailSender emailSender;
public TestController(repository repository, SmsSender SmsSender,EmailSender emailSender)
{
this.repository = repository;
smsSender = SmsSender;
this.emailSender = emailSender;
}
public IActionResult Index()
{
return View();
}
public IActionResult Email()
{
var b = this.emailSender.SendEmail("<EMAIL>", "test" + DateTime.Now.ToString(),"this email is test");
return View(b);
}
public IActionResult SmsUrl()
{
smsSender.SendSms("09132057232,09120155182", "test" + DateTime.Now.ToString());
return View();
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/FieldController.cs
using Entities;
using DAL;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Insurance.Services;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class FieldController : Controller
{
#region Constructor
private readonly repository repository;
public FieldController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Create(int fieldSetId, string returnUrl = null)
{
var fieldSet = this.repository.GetFieldSet(fieldSetId);
var step = this.repository.GetStep(fieldSet.stepId);
ViewBag.fields = new SelectList(this.repository.GetFieldsOfInsurance(step.insuranceId), "id", "titleAndType");
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes().OrderBy(f => f.title).ToList(), "id", "title");
ViewData["ParentId"] = fieldSetId;
ViewData["ReturnUrl"] = returnUrl;
return View(new field());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(field field, IFormFile image, string returnUrl = null)
{
if (ModelState.IsValid)
{
this.repository.AddEntity(field, image);
return RedirectToLocal(returnUrl);
}
var fieldSet = this.repository.GetFieldSet(field.fieldSetId);
var step = this.repository.GetStep(fieldSet.stepId);
ViewBag.fields = new SelectList(this.repository.GetFieldsOfInsurance(step.insuranceId), "id", "titleAndType");
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes().OrderBy(f => f.title).ToList(), "id", "title");
ViewData["ParentId"] = field.fieldSetId;
ViewData["ReturnUrl"] = returnUrl;
return View(field);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var field = this.repository.GetField(id);
var fieldSet = this.repository.GetFieldSet(field.fieldSetId);
var step = this.repository.GetStep(fieldSet.stepId);
ViewBag.fields = new SelectList(this.repository.GetFieldsOfInsurance(step.insuranceId), "id", "titleAndType");
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes().OrderBy(f => f.title).ToList(), "id", "title");
if (field == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(field);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, field field, IFormFile image, string returnUrl = null)
{
if (id != field.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(field, image);
return RedirectToLocal(returnUrl);
}
var fieldSet = this.repository.GetFieldSet(field.fieldSetId);
var step = this.repository.GetStep(fieldSet.stepId);
ViewBag.fields = new SelectList(this.repository.GetFieldsOfInsurance(step.insuranceId), "id", "titleAndType");
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes().OrderBy(f => f.title).ToList(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(field);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var field = this.repository.GetField(id);
if (field == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(field);
}
// POST: fields/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var field = this.repository.GetField(id);
this.repository.DeleteEntity(field);
return RedirectToLocal(returnUrl);
}
public IActionResult Duplicate(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var field = this.repository.GetField(id);
if (field == null)
{
return NotFound();
}
this.repository.DuplicateEntity(field,new field());
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/ClientApp/app/components/insurance/fieldSet/fieldSet.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { fieldComponent } from '../field/field.component';
@Component({
selector: 'fieldSet',
templateUrl: './fieldSet.component.html',
styleUrls: ['./fieldSet.component.css']
})
export class fieldSetComponent {
@Input() fieldSet: any;
@Input() insurance: any;
@Input() step: any;
@Output() fieldValueChanged = new EventEmitter<any>();
fieldValueChange(field: any) {
//console.log('field set:value of ' + field.name + ' change to => ' + field.value);
this.fieldValueChanged.emit(field);
}
}
<file_sep>/Insurance/ClientApp/app/components/insurance/tab/tab.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { insuranceComponent } from '../insurance.component';
@Component({
selector: 'tab',
templateUrl: './tab.component.html',
styleUrls: ['./tab.component.css']
})
export class tabComponent {
@Input() insurances: any;
@Input() currentInsurance: any;
@Output() tabChanged = new EventEmitter<any>();
tabChange(insurance: any) {
//this.currentInsurance = insurance;
let f = new Function(insurance.onClientClick);
f();
this.tabChanged.emit(insurance);
}
}
<file_sep>/Insurance/Controllers/HomeController.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Insurance.Services;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Controllers
{
public class HomeController : Controller
{
//context ctx;
private readonly repository repository;
private readonly HookManager hookManager;
public HomeController(repository repository, HookManager hookManager)
{
this.repository = repository;
this.hookManager = hookManager;
}
public IActionResult Index()
{
this.ManageRemindersAsync();
ViewData["Title"] = this.repository.GetSetting("siteTitle");
ViewData["MetaDescription"] = this.repository.GetSetting("MetaDescription");
ViewData["MetaKeywords"] = this.repository.GetSetting("MetaKeywords");
ViewData["GoogleAnalytics"] = this.repository.GetSetting("GoogleAnalytics");
return View(this.viewAddress("Index"));
}
public IActionResult Post(int id, string title)
{
if(title.Contains(" "))
{
return RedirectToAction("post", new { id=id, title = title.Replace(' ','-') });
}
var post = this.repository.GetPost(id);
ViewData["Title"] = post.title;
ViewData["MetaDescription"] = post.metaDescription;
ViewData["MetaKeywords"] = post.metaKeywords;
ViewData["GoogleAnalytics"] = this.repository.GetSetting("GoogleAnalytics");
return View(this.viewAddress("Post"), post);
}
public IActionResult PostCategory(int id, string title)
{
return View(this.viewAddress("PostCategory"));
}
public IActionResult Error()
{
ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
return View();
}
#region Private
private string viewAddress(string type)
{
string viewName = repository.GetSiteName();
ViewData["viewName"] = viewName;
switch (type)
{
case "Index":
return "~/Views/" + viewName + "/Index.cshtml";
case "Post":
return "~/Views/" + viewName + "/Post.cshtml";
case "PostCategory":
return "~/Views/" + viewName + "/PostCategory.cshtml";
}
return "";
}
private async Task ManageRemindersAsync()
{
//اولین نفری که در هر روز به سایت وارد شد باعث می شود که تمام یاد آوری های مال اون روز ارسال شوند
if (this.repository.GetLastAccess().Day == DateTime.Now.Day)
return;
PersianCalendar pc = new PersianCalendar();
if (pc.GetHour(DateTime.Now) < 7)
return;
this.repository.UpdateLastAccess();
var reminders = this.repository.GetReminders(7).ToList();
this.hookManager.HookFired("reminder7", reminders);
reminders = this.repository.GetReminders(3).ToList();
this.hookManager.HookFired("reminder3", reminders);
reminders = this.repository.GetReminders(1).ToList();
this.hookManager.HookFired("reminder1", reminders);
}
#endregion
}
}
<file_sep>/Entities/utilityFunctions/entityRelations.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Entities
{
public class entityRelations
{
public static Type parentType(baseEntity entity)
{
var et = entity.GetType();
switch (et.FullName)
{
case "Entities.insurance":
return null;
case "Entities.step":
return typeof(insurance);
case "Entities.fieldSet":
return typeof(step);
case "Entities.field":
return typeof(fieldSet);
case "Entities.boxCategory":
return null;
case "Entities.box":
return typeof(boxCategory);
case "Entities.menu":
return null;
case "Entities.post":
return null;
case "Entities.postCategory":
return null;
case "Entities.term":
return null;
case "Entities.category":
return typeof(term);
case "Entities.attribute":
return typeof(category);
case "Entities.dataType":
return null;
case "Entities.dataValue":
return typeof(dataType);
}
return null;
}
public static int parentId(baseEntity entity)
{
var et = entity.GetType();
switch (et.FullName)
{
case "Entities.insurance":
return 0;
case "Entities.step":
return (entity as step).insuranceId;
case "Entities.fieldSet":
return (entity as fieldSet).stepId;
case "Entities.field":
return (entity as field).fieldSetId;
case "Entities.boxCategory":
return 0;
case "Entities.box":
return (entity as box).boxCategoryId;
case "Entities.menu":
return 0;
case "Entities.post":
return 0;
case "Entities.postCategory":
return 0;
case "Entities.term":
return 0;
case "Entities.category":
return (entity as category).termId;
case "Entities.attribute":
return (entity as attribute).categoryId;
case "Entities.dataType":
return 0;
case "Entities.dataValue":
return (entity as dataValue).dataTypeId;
}
return 0;
}
public static string parentName(baseEntity entity)
{
var et = parentType(entity);
if (et == null)
return "";
return et.FullName.Replace("Entities.", "");
}
}
}
<file_sep>/Insurance/Services/SmsSender.cs
using DAL;
using System;
using System.Collections.Generic;
using System.Text;
using ThirdParty;
namespace Insurance.Services
{
public class SmsSender
{
#region Constructor
private readonly repository repository;
public SmsSender(repository repository)
{
this.repository = repository;
}
#endregion
public bool SendSms(string To, string Text)
{
if (this.repository.GetSetting("smsSender") == "payamResan")
{
PayamResan payamResan = new PayamResan
{
Username = this.repository.GetSetting("payamResanUsername"),
Password = this.repository.GetSetting("payamResanPassword"),
From = this.repository.GetSetting("payamResanNumber")
};
payamResan.SendSmsByUrl(To, Text);
}
return true;
}
}
}
<file_sep>/Insurance/ClientApp/app/components/insurance/insurance.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { insuranceService } from '../../services/insurance.service';
import { tabComponent } from './tab/tab.component';
import { aInsuranceComponent } from './aInsurance/aInsurance.component';
import { authService } from '../../services/auth.service';
@Component({
selector: 'insurance',
templateUrl: './insurance.component.html',
styleUrls: ['./insurance.component.css'],
providers: [/*insuranceService*/]
})
export class insuranceComponent {
@Input() insurances: any;
@Input() currentInsurance: any;
_authService: authService;
_insuranceService: insuranceService;
constructor(authService: authService,insuranceService: insuranceService) {
this._authService = authService;
this._insuranceService = insuranceService;
}
tabChange(insurance: any) {
this._insuranceService.insuranceChange(insurance);
}
stepChange(insurance: any) {
this._insuranceService.stepChange(insurance);
}
}
<file_sep>/Insurance/ClientApp/app/components/insurance/step/step.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { insuranceService } from '../../../services/insurance.service';
import { fieldSetComponent } from '../fieldSet/fieldSet.component';
import { authService } from '../../../services/auth.service';
@Component({
selector: 'step',
templateUrl: './step.component.html',
styleUrls: ['./step.component.css']
})
export class stepComponent {
@Input() step: any;
@Input() insurance: any;
@Output() fieldValueChanged = new EventEmitter<any>();
@Output() stepChanged = new EventEmitter<any>();
_authService: authService;
_insuranceService: insuranceService;
constructor(authService: authService, insuranceService: insuranceService) {
this._authService = authService;
this._insuranceService = insuranceService;
}
ngOnInit() {
this._insuranceService.refreshFields(this.insurance);
}
nextStepClick() {
this.insurance.currentStep++;
this.stepChanged.emit(this.insurance);
}
previousStepClick() {
this.insurance.currentStep--;
this.stepChanged.emit(this.insurance);
}
fieldValueChange(field: any) {
this.fieldValueChanged.emit(field);
}
}
<file_sep>/Entities/blog/postCategory.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Entities
{
public class postCategory:baseEntity
{
[Display(Name = "تصویر")]
public string image { get; set; }
[Display(Name = "سی اس اس")]
public string cssClass { get; set; }
public int? fatherId { get; set; }
[Display(Name = "والد")]
public postCategory father { get; set; }
public List<postCategory> childs { get; set; }
public List<post_postCategory> posts { get; set; }
}
}
<file_sep>/Entities/insurnce/attribute.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class attribute : baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
[Display(Name = "مقدار")]
public string value { get; set; }
public int categoryId { get; set; }
[Display(Name = "دسته")]
public category category { get; set; }
}
public class attribute_client : baseClient
{
public string name { get; set; }
public string value { get; set; }
}
}
<file_sep>/DAL/context.cs
using Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace DAL
{
public class context : DbContext
{
public context(DbContextOptions<context> options) : base(options)
{
}
public context()
{
}
public DbSet<site> sites { get; set; }
public DbSet<insurance> insurances{ get; set; }
public DbSet<step> steps{ get; set; }
public DbSet<fieldSet> fieldSets { get; set; }
public DbSet<field> fields { get; set; }
public DbSet<dataType> dataTypes { get; set; }
public DbSet<dataValue> dataValues { get; set; }
public DbSet<dataValue_category> dataValue_category { get; set; }
public DbSet<term> terms { get; set; }
public DbSet<category> categories { get; set; }
public DbSet<attribute> attributes { get; set; }
public DbSet<setting>settings{ get; set; }
//public DbSet<user> users { get; set; }
public DbSet<menu> menus { get; set; }
public DbSet<boxCategory> boxCategories { get; set; }
public DbSet<box> boxes { get; set; }
public DbSet<postCategory> postCategories { get; set; }
public DbSet<post> posts { get; set; }
public DbSet<post_postCategory> post_postCategory { get; set; }
public DbSet<price> price { get; set; }
public DbSet<order> orders{ get; set; }
public DbSet<orderField> orderFields{ get; set; }
public DbSet<paymentType> paymentTypes{ get; set; }
public DbSet<orderStatus> orderStatuses{ get; set; }
public DbSet<user_paymentType> user_paymentType { get; set; }
public DbSet<adminMenu> adminMenus { get; set; }
public DbSet<role_adminMenu> role_adminMenu { get; set; }
public DbSet<hook> hooks{ get; set; }
public DbSet<sms> smses{ get; set; }
public DbSet<email> emails { get; set; }
public DbSet<reminder> reminders { get; set; }
}
}
<file_sep>/Entities/insurnce/dataValue.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class dataValue:baseEntity
{
[Display(Name = "والد")]
public int? fatherId { get; set; }
//دیتا زیاد لود می کرد سمت کلاینت
//public dataValue father { get; set; }
public List<dataValue_category> categories{ get; set; }
public int dataTypeId { get; set; }
public dataType dataType { get; set; }
}
public class dataValue_client : baseClient
{
public string text { get; set; }
public int? fatherid { get; set; }
public List<dataValue_category_client> categories { get; set; }
}
public class dataValue_vm
{
public dataValue dataValue { get; set; }
public List<term> terms { get; set; }
public List<int> selectedCategories { get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/TermController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class TermController : Controller
{
#region Constructor
private readonly repository repository;
public TermController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var terms = this.repository.GetTerms(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(terms);
}
public IActionResult Details(int? id, int pageNumber, string searchString)
{
if (id == null)
{
return NotFound();
}
var term = this.repository.GetTerm(id);
if (term == null)
{
return NotFound();
}
ViewBag.categories = this.repository.GetCategoriesOfTerm(id, pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(term);
}
public IActionResult Create(string returnUrl = null)
{
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(new term());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(term term, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(term);
return RedirectToLocal(returnUrl);
}
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(term);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var term = this.repository.GetTerm(id);
if (term == null)
{
return NotFound();
}
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(term);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, term term, string returnUrl = null)
{
if (id != term.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(term);
return RedirectToLocal(returnUrl);
}
ViewBag.dataTypes = new SelectList(this.repository.GetDataTypes(), "id", "title");
ViewData["ReturnUrl"] = returnUrl;
return View(term);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var term = this.repository.GetTerm(id);
if (term == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(term);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var term = this.repository.GetTerm(id);
this.repository.DeleteEntity(term);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Areas/Admin/Controllers/HookController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class HookController : Controller
{
#region Constructor
private readonly repository repository;
public HookController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Index(int pageNumber, string searchString)
{
var hooks = this.repository.GetHooks(pageNumber, searchString);
ViewData["searchString"] = searchString;
return View(hooks);
}
public IActionResult Details(int? id)
{
if (id == null)
{
return NotFound();
}
var hook = this.repository.GetHook(id);
if (hook == null)
{
return NotFound();
}
ViewBag.smses = this.repository.GetSmsesOfHook(id);
ViewBag.emails = this.repository.GetEmailsOfHook(id);
return View(hook);
}
public IActionResult Create(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View(new hook());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(hook hook, string returnUrl = null)
{
if (ModelState.IsValid)
{
repository.AddEntity(hook);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(hook);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var hook = this.repository.GetHook(id);
if (hook == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(hook);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, hook hook, string returnUrl = null)
{
if (id != hook.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(hook);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(hook);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var hook = this.repository.GetHook(id);
if (hook == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(hook);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var hook= this.repository.GetHook(id);
this.repository.DeleteEntity(hook);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Insurance/Controllers/UserController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Text.RegularExpressions;
using Entities;
using DAL;
using Insurance.Services;
namespace Insurance.Controllers
{
[Produces("application/json")]
[Route("api/User")]
public class UserController : Controller
{
private readonly repository repository;
private readonly HookManager hookManager;
public UserController(repository repository, HookManager hookManager)
{
this.repository = repository;
this.hookManager = hookManager;
}
[HttpGet("[action]")]
public user_express GetUser()
{
user_express newUser = new user_express();
return newUser;
}
[HttpPost("Login")]
public user_express Login([FromBody]user_express tempUser)
{
try
{
var result = repository.Login(tempUser.actualUserName, tempUser.password);
if (result.Succeeded)
{
return repository.GetUser_Express(tempUser.actualUserName);
}
throw new Exception();
}
catch
{
user_express tmp = new user_express();
tmp.clientMessage = "نام کاربری و یا کلمه عبور اشتباه است.";
return tmp;
}
}
[HttpPost("Register")]
public user_express Register([FromBody]user_express newUser)
{
try
{
var result = repository.AddUser(newUser);
if (result.Succeeded)
{
this.hookManager.HookFired("register", this.repository.GetUser(newUser.actualUserName));
var res = repository.Login(newUser.actualUserName, newUser.password);
if (res.Succeeded)
{
return repository.GetUser_Express(newUser.actualUserName);
}
}
throw new Exception();
}
catch
{
user_express tmp = new user_express();
tmp.clientMessage = "خطایی در ثبت کاربر بوجود آمده است.";
return tmp;
}
}
}
}<file_sep>/Entities/sms_email/hook.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Entities
{
public class hook:baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
public List<sms> smses{ get; set; }
public List<email> emails{ get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/Controllers/AttributeController.cs
using DAL;
using Entities;
using Insurance.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Insurance.Areas.Admin.Controllers
{
[Area("Admin")]
[Authorize]
public class AttributeController : Controller
{
#region Constructor
private readonly repository repository;
public AttributeController(repository repository)
{
this.repository = repository;
}
#endregion
public IActionResult Create(int categoryId, string returnUrl = null)
{
ViewData["ParentId"] = categoryId;
ViewData["ReturnUrl"] = returnUrl;
return View(new attribute());
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(attribute attribute, string returnUrl = null)
{
if (ModelState.IsValid)
{
this.repository.AddEntity(attribute);
return RedirectToLocal(returnUrl);
}
ViewData["ParentId"] = attribute.categoryId;
ViewData["ReturnUrl"] = returnUrl;
return View(attribute);
}
public IActionResult Edit(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var attribute = this.repository.GetAttribute(id);
if (attribute == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(attribute);
}
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(int id, attribute attribute, string returnUrl = null)
{
if (id != attribute.id)
{
return NotFound();
}
if (ModelState.IsValid)
{
this.repository.UpdateEntity(attribute);
return RedirectToLocal(returnUrl);
}
ViewData["ReturnUrl"] = returnUrl;
return View(attribute);
}
public IActionResult Delete(int? id, string returnUrl = null)
{
if (id == null)
{
return NotFound();
}
var attribute = this.repository.GetAttribute(id);
if (attribute == null)
{
return NotFound();
}
ViewData["ReturnUrl"] = returnUrl;
return View(attribute);
}
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(int id, string returnUrl = null)
{
var attribute = this.repository.GetAttribute(id);
this.repository.DeleteEntity(attribute);
return RedirectToLocal(returnUrl);
}
private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction(nameof(HomeController.Index), "Home");
}
}
}
}<file_sep>/Entities/auth/role_adminMenu.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Entities
{
public class role_adminMenu : baseClass
{
public string roleName { get; set; }
public adminMenu adminMenu { get; set; }
}
}
<file_sep>/Insurance/ClientApp/app/components/insurance/stepNavigation/stepNavigation.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'stepNavigation',
templateUrl: './stepNavigation.component.html',
styleUrls: ['./stepNavigation.component.css']
})
export class stepNavigationComponent {
@Input() insurance: any;
@Output() stepChanged = new EventEmitter<any>();
stepChange(number: number) {
//this.currentInsurance = insurance;
this.insurance.currentStep = number;
this.stepChanged.emit(this.insurance);
}
}
<file_sep>/Insurance/Areas/Admin/TagHelper/PagerTagHelper.cs
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Insurance.Areas.Admin
{
[HtmlTargetElement("nav", Attributes = "page-model")]
public class PagerTagHelper : TagHelper
{
private IUrlHelperFactory urlHelperFactory;
public PagerTagHelper(IUrlHelperFactory helperFactory)
{
urlHelperFactory = helperFactory;
}
[ViewContext]
[HtmlAttributeNotBound]
public ViewContext ViewContext { get; set; }
public PagingData PageModel { get; set; }
public string PageAction { get; set; }
public string PageContoller { get; set; }
public string ItemId { get; set; }
public string searchString { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
IUrlHelper urlHelper = urlHelperFactory.GetUrlHelper(ViewContext);
TagBuilder result = new TagBuilder("ul");
result.Attributes["class"] = "pagination";
if (PageModel.totalPages == 1)
return;
for (int i = 1; i <= PageModel.totalPages; i++)
{
TagBuilder litag = new TagBuilder("li");
TagBuilder tag = new TagBuilder("a");
litag.Attributes["class"] = "page-item";
tag.Attributes["class"] = "page-link";
tag.Attributes["href"] = urlHelper.Action(PageAction, PageContoller, new { id = ItemId, pageNumber = i, searchString = searchString });
tag.InnerHtml.Append(i.ToString());
litag.InnerHtml.AppendHtml(tag);
result.InnerHtml.AppendHtml(litag);
}
output.Content.AppendHtml(result);
}
}
}
<file_sep>/Entities/blog/box.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class box : baseEntity
{
[NotMapped]
[Display(Name = "تصویر")]
public string image
{
get
{
if (this.site != null)
{
var name = this.site.name;
var type = "box";
string phisicalAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + name + "\\image\\" + type + "\\" + this.id.ToString() + ".jpg";
if (System.IO.File.Exists(phisicalAddress))
{
string webAddress = "/" + name + "/image/" + type + "/" + this.id.ToString() + ".jpg";
return webAddress;
}
}
return "";
}
}
[DataType(DataType.MultilineText)]
[Display(Name = "محتوا")]
public string content { get; set; }
[Display(Name = "لینک")]
public string link { get; set; }
[Display(Name = "سی اس اس")]
public string cssClass { get; set; }
public int boxCategoryId { get; set; }
public boxCategory boxCategory { get; set; }
}
}
<file_sep>/Entities/auth/user.cs
using Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Entities
{
public class user : IdentityUser<int>
{
[NotMapped]
public string actualUserName
{
get
{
var arr = this.UserName.Split('_');
string res = "";
for (int i = 0; i < arr.Length - 1; i++)
{
res += arr[i] + "_";
}
res = res.TrimEnd('_');
return res;
}
set
{
this.UserName = value + "_" + this.siteId;
}
}
public int siteId { get; set; }
[Display(Name = "نام")]
public string firstName { get; set; }
[Display(Name = "نام خانوادگی")]
public string lastName { get; set; }
[Display(Name = "کد ملی")]
public string nationalCode { get; set; }
[Display(Name = "آخرین تغییر دهنده")]
public int updateUserId { get; set; }
[Display(Name = "زمان آخرین تغییر")]
public DateTime updateDateTime { get; set; }
public bool isDeleted { get; set; }
[NotMapped]
[Display(Name = "نام کاربر")]
public string fullName
{
get
{
return this.firstName + " " + this.lastName;
}
}
//for view
[NotMapped]
public string role { get; set; }
[NotMapped]
public string actualRole
{
get
{
try
{
var arr = this.role.Split('_');
string res = "";
for (int i = 0; i < arr.Length - 1; i++)
{
res += arr[i] + "_";
}
res = res.TrimEnd('_');
return res;
}
catch
{
return "";
}
}
set
{
this.role = value + "_" + this.siteId;
}
}
}
public class user_express
{
public int id { get; set; }
[Required]
[Display(Name = "نام کاربری")]
public string actualUserName { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "کلمه عبور")]
public string password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "تکرار کلمه عبور")]
//[Compare("password", ErrorMessage = "The password and confirmation password do not match.")]
public string confirmPassword { get; set; }
[Display(Name = "نام")]
public string firstName { get; set; }
[Display(Name = "نام خانوادگی")]
public string lastName { get; set; }
[Display(Name = "نام کاربر")]
public string fullName
{
get
{
return this.firstName + " " + this.lastName;
}
}
[Display(Name = "ایمیل")]
public string email { get; set; }
[Display(Name = "موبایل")]
public string phoneNumber { get; set; }
[Display(Name = "کد ملی")]
public string nationalCode { get; set; }
public bool clientIsValid { get; set; }
public string clientMessage { get; set; }
[Display(Name = "مرا به خاطر بسپار")]
public bool rememberMe { get; set; }
}
public class user_vm
{
public user_express user { get; set; }
public List<paymentType> paymentTypes { get; set; }
public List<int> selectedPaymentTypes { get; set; }
public SelectList roles { get; set; }
public string selectedRole { get; set; }
}
}
<file_sep>/Insurance/Areas/Admin/ViewComponent/adminMenuViewComponent.cs
using DAL;
using Insurance.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Insurance.Areas.Admin
{
public class AdminMenuViewComponent : ViewComponent
{
#region Constructor
private readonly repository repository;
private readonly IHttpContextAccessor httpContextAccessor;
public AdminMenuViewComponent(
repository repository,
IHttpContextAccessor httpContextAccessor)
{
this.repository = repository;
this.httpContextAccessor = httpContextAccessor;
}
#endregion
#region Invoke
public async Task<IViewComponentResult> InvokeAsync()
{
var role = repository.GetRoleOfCurrentUser();
var items = repository.GetAdminMenusOfRole(role).OrderBy(am=>am.orderIndex).ToList();
var currentController = this.httpContextAccessor.HttpContext.Request;
return View("Default", items);
}
#endregion
}
}
<file_sep>/Insurance/ClientApp/app/services/insurance.service.ts
import { Injectable, Inject } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import * as moment from 'jalali-moment';
import { forEach } from '@angular/router/src/utils/collection';
@Injectable()
export class insuranceService {
public insurances: any;
public currentInsurance: any;
public isWaiting = false;
baseUrl: string;
constructor(private http: Http, @Inject('BASE_URL') baseUrl: string) {
this.baseUrl = baseUrl;
//console.log('insuranceserviceconstructor');
this.fetchInsurances();
}
//-----------------------------------------------------------------------------
//not used
//addOrder(insurance: any) {
// //console.log("addOrder start");
// const headers = new Headers({ 'Content-type': 'application/json' });
// this.isWaiting = true;
// let minInsurance = this.minifyInsurance(insurance);
// this.http.post(this.baseUrl + "api/Order/AddOrder/", minInsurance, new RequestOptions({ headers: headers }))
// .subscribe(result => {
// let orderId = +result.text();
// if (orderId == -1) {
// console.log("خطا در ثبت سفارش");
// }
// else if (this.fileCount(insurance.name) > 0) {
// this.uploadOrderFiles(orderId, insurance.name);
// }
// else {
// window.location.href = '/profile/Payment/Index/' + orderId;
// }
// });
//}
//-----------------------------------------------------------------------------
processOrder(insurance: any) {
console.log("processOrder start");
const headers = new Headers({ 'Content-type': 'application/json' });
this.isWaiting = true;
let minInsurance = this.minifyInsurance(insurance);
console.log("minified");
this.http.post(this.baseUrl + "api/Order/ProcessOrder/", minInsurance, new RequestOptions({ headers: headers }))
.subscribe(result => {
let orderId = +result.text();
insurance.orderId = orderId;
console.log("order - send recive - orderid > " + orderId);
if (orderId == -1) {
console.log("خطا در ثبت سفارش");
}
else if (insurance.currentStep > insurance.stepCount) {
window.location.href = '/profile/Payment/Index/' + orderId;
return;
}
this.isWaiting = false;
});
}
//-----------------------------------------------------------------------------
//not used
//uploadOrderFiles(orderId: number, insuranceName: string) {
// let formData: FormData = new FormData();
// //console.log(insuranceName);
// this.isWaiting = true;
// for (let i = 0; i < this.files.length; i++) {
// if (this.files[i].insuranceName == insuranceName)
// formData.append(orderId + "@" + this.files[i].fieldName, this.files[i].file);
// }
// this.http.post(this.baseUrl + "api/Order/uploadOrderFiles/", formData)
// .subscribe(result => {
// let orderId = +result.text();
// if (orderId == -1) {
// this.isWaiting = false;
// console.log("خطا در آپلود فایل");
// }
// else {
// console.log("سفارش با موفقیت ثبت شد کد پرداخت");
// window.location.href = '/profile/Payment/Index/' + orderId;
// }
// });
//}
//-----------------------------------------------------------------------------
uploadOrderFile(insuranceName: string, fieldName: string, file: any) {
let formData: FormData = new FormData();
this.isWaiting = true;
let insurance = this.findInsurance(insuranceName);
let orderId = insurance.orderId;
console.log("uploadFile orderId > " + orderId);
formData.append(orderId + "@" + fieldName, file);
this.http.post(this.baseUrl + "api/Order/uploadOrderFiles/", formData)
.subscribe(result => {
let orderId = +result.text();
if (orderId == -1) {
this.isWaiting = false;
console.log("خطا در آپلود فایل");
}
else {
this.isWaiting = false;
}
});
}
//-----------------------------------------------------------------------------
files: fileClass[] = [];
// اگر فایل بود آن را آپدیت کن در غیر اینصورت فایل را اضافه می کند
addFile(insuranceName: string, fieldName: string, file: any) {
//ارسال برای سرور
this.uploadOrderFile(insuranceName, fieldName, file);
if (this.isFileExist(insuranceName, fieldName)) {
this.updateFile(insuranceName, fieldName, file);
}
else {
this.pushFile(insuranceName, fieldName, file);
}
}
//فایل را به آرایه اضافه می کند
pushFile(insuranceName: string, fieldName: string, file: any) {
let f = new fileClass();
f.insuranceName = insuranceName;
f.fieldName = fieldName;
f.file = file;
this.files.push(f);
}
//فایل موجود در آرایه را آپدیت می کند
updateFile(insuranceName: string, fieldName: string, file: any) {
for (let i = 0; i < this.files.length; i++) {
let f = this.files[i];
if (f.insuranceName == insuranceName && f.fieldName == fieldName) {
f.file = file;
}
}
}
getFile(insuranceName: string, fieldName: string) {
for (let i = 0; i < this.files.length; i++) {
let f = this.files[i];
if (f.insuranceName == insuranceName && f.fieldName == fieldName) {
return f.file;
}
}
return null
}
isFileExist(insuranceName: string, fieldName: string) {
for (let i = 0; i < this.files.length; i++) {
let f = this.files[i];
if (f.insuranceName == insuranceName && f.fieldName == fieldName) {
return true;
}
}
return false;
}
fileCount(insuranceName: string) {
let c = 0;
for (let i = 0; i < this.files.length; i++) {
let f = this.files[i];
if (f.insuranceName == insuranceName) {
c++;
}
}
return c;
}
//-----------------------------------------------------------------------------
insuranceChange(insurance: any) {
//اگر استپ اول از بیمه ای که میخواهیم نیست آن را لود می کنیم
insurance.currentStep = 1;
this.currentInsurance = insurance;
//console.log('hrr1');
//console.log(insurance.steps);
if (insurance.steps.length < 1) {
console.log('hrr2');
this.fetchStep(insurance, 1);
}
}
//-----------------------------------------------------------------------------
fetchInsurances() {
//console.log('fetchInsurances');
this.isWaiting = true;
this.http.get(this.baseUrl + 'api/Insurance/GetInsurances').subscribe(result => {
this.insurances = result.json();
for (var i = 0; i < this.insurances.length; i++) {
if (this.insurances[i].isDefault) {
this.currentInsurance = this.insurances[i];
}
}
//this.currentInsurance = this.insurances[0];
this.fetchStep(this.currentInsurance, 1);
this.isWaiting = false;
}, error => console.error(error));
}
//-----------------------------------------------------------------------------
stepChange(insurance: any) {
//اگر مرحله آخر بوده است
if (insurance.currentStep > insurance.stepCount)
this.processOrder(insurance);
//اگر استپی که میخواهیم نیست آن را لود می کنیم
for (let i = 0; i < insurance.steps.length; i++) {
let step = insurance.steps[i];
if (step.number == insurance.currentStep) {
//با هر تغییر در مراحل یک بار اطلاعات به سرور فرستاده می شود
this.processOrder(insurance);
return;
}
}
this.fetchStep(insurance, insurance.currentStep);
}
//-----------------------------------------------------------------------------
fetchStep(insurance: any, stepNumber: number) {
//console.log('fetchStep');
let params = "insuranceId=" + insurance.id + "&stepNumber=" + stepNumber;
this.isWaiting = true;
this.http.get(this.baseUrl + 'api/Insurance/GetStep?' + params).subscribe(result => {
let step = result.json();
//اگر استپ دارد باید استپ خوانده شده به آنها اضافه شود و در غیر اینصورت آرایه ایجاد شود
if (!insurance.steps)
insurance.steps = new Array(step);
else
insurance.steps.push(step);
//console.log(step)
this.isWaiting = false;
//اطلاعات به سرور فرستاده شود
if (stepNumber > 1)
this.processOrder(insurance);
}, error => console.error(error));
}
//-----------------------------------------------------------------------------
//for show or hide
refreshFields(insurance: any) {
for (var i = 0; i < insurance.steps.length; i++) {
let step = insurance.steps[i];
for (var k = 0; k < step.fieldSets.length; k++) {
let fieldSet = step.fieldSets[k];
for (let j = 0; j < fieldSet.fields.length; j++) {
let field = fieldSet.fields[j];
if (field.showIf && field.showIf != "") {
field.isShowField = this.execJavascript(field.showIf);
console.log(field.isShowField);
}
if (field.type == "calc") {
let res = this.execJavascript(field.formula);
field.value = Math.ceil(res);
}
else if (field.type == "price") {
field.value = insurance.price;
}
}
}
}
}
//-----------------------------------------------------------------------------
updatePriceField(insurance: any) {
for (var i = 0; i < insurance.steps.length; i++) {
let step = insurance.steps[i];
for (var k = 0; k < step.fieldSets.length; k++) {
let fieldSet = step.fieldSets[k];
for (let j = 0; j < fieldSet.fields.length; j++) {
let field = fieldSet.fields[j];
if (field.type == "price") {
field.value = insurance.price;
}
}
}
}
}
//-----------------------------------------------------------------------------
resetChild(step: any, field: any) {
for (var k = 0; k < step.fieldSets.length; k++) {
let fieldSet = step.fieldSets[k];
for (let j = 0; j < fieldSet.fields.length; j++) {
let tempField = fieldSet.fields[j];
if (tempField.fatherid && tempField.fatherid == field.id) {
this.fetchChildDataValues(tempField, field.value);
tempField.value = null;
}
}
}
}
//-----------------------------------------------------------------------------
fetchDataValues(field: any) {
field.isShowLoading = true;
//console.log(field);
let params = "dataTypeId=" + field.dataTypeid;
this.http.get(this.baseUrl + 'api/Insurance/GetDataValues?' + params).subscribe(result => {
let dataValues = result.json();
field.dataValues = dataValues;
field.isShowLoading = false;
//console.log(dataType)
}, error => console.error(error));
}
//-----------------------------------------------------------------------------
fetchChildDataValues(field: any, fatherValue: number) {
//console.log('fetchChildDataValues >fathervalue = ' + fatherValue);
field.isShowLoading = true;
field.dataValues = null;
let params = "dataTypeId=" + field.dataTypeid + "&fatherId=" + fatherValue;
this.http.get(this.baseUrl + 'api/Insurance/GetChildDataValues?' + params).subscribe(result => {
let dataValues = result.json();
if (dataValues.length == 1) {
field.value = dataValues[0].id;
}
field.dataValues = dataValues;
field.isShowLoading = false;
}, error => console.error(error));
}
//-----------------------------------------------------------------------------
fetchPaymentTypes(field: any) {
field.isShowLoading = true;
//console.log(field);
//let params = "dataTypeId=" + field.dataTypeid;
this.http.get(this.baseUrl + 'api/Order/GetPaymentTypes').subscribe(result => {
let dataValues = result.json();
field.dataValues = dataValues;
field.isShowLoading = false;
//console.log(dataType)
}, error => console.error(error));
}
//-----------------------------------------------------------------------------
ValidateAllRequired(step: any) {
//console.log('ValidateAllRequired');
for (var k = 0; k < step.fieldSets.length; k++) {
let fieldSet = step.fieldSets[k];
for (let j = 0; j < fieldSet.fields.length; j++) {
var field = fieldSet.fields[j];
if (field.type == "label" || field.type == "html")
continue;
if (field.type == "acceptCheckBox" && !field.value) {
step.isValidAllRequired = false;
return false;
}
if (field.isRequire && !field.value) {
step.isValidAllRequired = false;
return false;
}
}
}
//console.log('ValidateAllRequired return true');
step.isValidAllRequired = true;
return true;
}
//-----------------------------------------------------------------------------
calcPrice_server(insurance: any) {
if (this.ValidateAllRequired(insurance.steps[0])) {
//console.log("calcPrice");
const headers = new Headers({ 'Content-type': 'application/json' });
this.http.post(this.baseUrl + "api/insurance/CalcPrice/", insurance.steps[0], new RequestOptions({ headers: headers }))
.subscribe(result => {
let res = +result.text();
if (res == -1)
console.log("خطا در محاسبه");
else {
insurance.price = Math.ceil(res);
}
});
}
else {
insurance.price = null;
}
}
//-----------------------------------------------------------------------------
execJavascript(code: string) {
let f = new Function("field", code);
let res = f(this);
return res;
}
//-----------------------------------------------------------------------------
calcPrice(insurance: any) {
//console.log('calcPrice');
if (insurance.steps[0].isValidAllRequired) {
//پارامتر کل کلاس است برای اینکه موقع نوشتن فرمول قابل فهم تر باشد نام فیلد گذاشتیم
// let f = new Function("field", insurance.formula);
//let res = f(this);
let res = this.execJavascript(insurance.formula);
insurance.price = Math.ceil(res);
this.updatePriceField(insurance);
}
else {
insurance.price = null;
}
}
//-----------------------------------------------------------------------------
yearCount(insuranceName: string, fieldName: string) {
let x = this.value(insuranceName, fieldName);
let jalaliYear = moment().locale('fa').format('YYYY');
return +jalaliYear - x;
}
//-----------------------------------------------------------------------------
attribute(insuranceName: string, fieldName: string, attributeName: string) {
//console.log('attribute');
let attribute = this.findAttribute(insuranceName, fieldName, attributeName);
if (attribute)
return parseFloat(attribute.value);
//return parseInt(attribute.value);
return null;
}
//-----------------------------------------------------------------------------
findAttribute(insuranceName: string, fieldName: string, attributeName: string) {
let dataValue = this.findSelectedDataValue(insuranceName, fieldName);
if (!dataValue)
return null;
//console.log(dataValue);
for (var i = 0; i < dataValue.categories.length; i++) {
let cat = dataValue.categories[i].category;
for (var j = 0; j < cat.attributes.length; j++) {
let attr = cat.attributes[j];
if (attr.name == attributeName)
return attr;
}
}
return null;
}
//-----------------------------------------------------------------------------
findSelectedDataValue(insuranceName: string, fieldName: string) {
let field = this.findField(insuranceName, fieldName);
for (var i = 0; i < field.dataValues.length; i++) {
let dv = field.dataValues[i];
if (dv.id == field.value)
return dv;
}
return null;
}
//-----------------------------------------------------------------------------
delayDays(insuranceName: string, fieldName: string) {
let field = this.findField(insuranceName, fieldName);
if (!field)
return null;
let val = moment(field.value).toDate();
let now = moment().toDate();
var timeDiff = val.getTime() - now.getTime();
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
if (diffDays > -1)
return 0;
return Math.abs(diffDays);
}
//-----------------------------------------------------------------------------
textByName(insuranceName: string, fieldName: string) {
let field = this.findField(insuranceName, fieldName);
return this.textById(insuranceName, field.id)
}
//-----------------------------------------------------------------------------
textById(insuranceName: string, fieldId: number) {
let field = this.findFieldById(insuranceName, fieldId);
switch (field.type) {
case "textBox":
case "textArea":
return field.value;
case "comboBox":
case "radio":
case "radioButton":
return this.findSelectedDataValue(insuranceName, field.name).text;
case "checkBox":
return field.value ? "بله" : "خیر";
case "year":
return field.value;
case "date":
let MomentDate = moment(field.value);
return MomentDate.locale('fa').format("YYYY/M/D")
}
return 'www';
}
//-----------------------------------------------------------------------------
value(insuranceName: string, fieldName: string) {
let field = this.findField(insuranceName, fieldName);
if (field) {
if (field.type == "date") {
let MomentDate = moment(field.value);
return MomentDate.locale('fa').format("YYYY/M/D");
}
if (field.type == "number") {
return field.value.replace(/,/g, "");
}
return field.value;
}
return null;
}
//-----------------------------------------------------------------------------
findField(insuranceName: string, fieldName: string) {
let insurance = this.findInsurance(insuranceName);
for (let i = 0; i < insurance.steps.length; i++) {
let step = insurance.steps[i];
for (var k = 0; k < step.fieldSets.length; k++) {
let fieldSet = step.fieldSets[k];
for (let j = 0; j < fieldSet.fields.length; j++) {
if (fieldSet.fields[j].name == fieldName) {
return fieldSet.fields[j];
}
}
}
}
return null;
}
//-----------------------------------------------------------------------------
findFieldById(insuranceName: string, fieldId: number) {
let insurance = this.findInsurance(insuranceName);
for (let i = 0; i < insurance.steps.length; i++) {
let step = insurance.steps[i];
for (var k = 0; k < step.fieldSets.length; k++) {
let fieldSet = step.fieldSets[k];
for (let j = 0; j < fieldSet.fields.length; j++) {
if (fieldSet.fields[j].id == fieldId) {
return fieldSet.fields[j];
}
}
}
}
return null;
}
//-----------------------------------------------------------------------------
findInsurance(insuranceName: string) {
for (let i = 0; i < this.insurances.length; i++) {
if (this.insurances[i].name == insuranceName) {
return this.insurances[i];
}
}
return null;
}
//-----------------------------------------------------------------------------
minifyInsurance(insurance: any) {
var resInsurance = {
id: insurance.id,
orderId: insurance.orderId,
//orderIndex: insurance.orderIndex,
price: insurance.price,
//stepCount: insurance.stepCount,
//currentStep: insurance.currentStep,
steps: Array()
};
for (let i = 0; i < insurance.steps.length; i++) {
let step = insurance.steps[i];
let resStep = {
orderIndex: step.orderIndex,
fieldSets: Array()
};
for (var k = 0; k < step.fieldSets.length; k++) {
let fieldSet = step.fieldSets[k];
let resFieldSet = {
orderIndex: fieldSet.orderIndex,
fields: Array()
}
for (let j = 0; j < fieldSet.fields.length; j++) {
let field = fieldSet.fields[j];
if (field.type == "label" || field.type == "html")
continue;
let resField = {
name: field.name,
title: field.title,
value: field.value,
type: field.type,
orderIndex: field.orderIndex
};
resFieldSet.fields.push(resField);
//field.dataValues = null;
}
resStep.fieldSets.push(resFieldSet);
}
resInsurance.steps.push(resStep);
}
return resInsurance;
}
}
class fileClass {
insuranceName: string;
fieldName: string;
file: any;
}<file_sep>/Entities/sms_email/email.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Entities
{
public class email:baseEntity
{
[Display(Name = "عنوان ایمیل")]
public string subject { get; set; }
[Display(Name = "بدنه ایمیل")]
public string body { get; set; }
[Display(Name = "آدرس ایمیل")]
public string emailAddress { get; set; }
public int hookId { get; set; }
public hook hook { get; set; }
}
}
<file_sep>/Insurance/Services/Repository.cs
using AutoMapper;
using DAL;
using Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Insurance.Services
{
public class repository
{
#region Constructor
private readonly context context;
private readonly MapperConfiguration mapperConfiguration;
private readonly IHttpContextAccessor httpContextAccessor;
private readonly identityContext identityContext;
private readonly UserManager<user> userManager;
private readonly SignInManager<user> signInManager;
private readonly RoleManager<role> roleManager;
private int siteId = 0;
private readonly int allSiteId = 1;
private int userId = 0;
private int pageSize = 10;
public repository(
context context,
MapperConfiguration mapperConfiguration,
IHttpContextAccessor httpContextAccessor,
identityContext identityContext,
UserManager<user> userManager,
SignInManager<user> signInManager,
RoleManager<role> roleManager
)
{
this.identityContext = identityContext;
this.context = context;
this.mapperConfiguration = mapperConfiguration;
this.httpContextAccessor = httpContextAccessor;
this.userManager = userManager;
this.signInManager = signInManager;
this.roleManager = roleManager;
this.siteId = this.GetSiteId();
this.userId = this.GetUserId();
//اگر https است باید ریدایرکت شود
if (GetSetting("isHttps") == "true" && !this.httpContextAccessor.HttpContext.Request.IsHttps && !this.httpContextAccessor.HttpContext.Request.Host.ToString().Contains("localhost"))
{
this.httpContextAccessor.HttpContext.Response.Redirect("https://" + this.httpContextAccessor.HttpContext.Request.Host + this.httpContextAccessor.HttpContext.Request.Path, true);
}
if (!string.IsNullOrEmpty(GetSetting("pageSize")))
this.pageSize = Int32.Parse(GetSetting("pageSize"));
}
#endregion
#region Common Functions
public int GetSiteId()
{
string host = this.httpContextAccessor.HttpContext.Request.Host.ToString();
if (host.Contains("localhost"))
host = "www.danainsurance.co";
//host = "www.bimebaz.com";
return context.sites.FirstOrDefault(s => s.host.ToLower() == host.ToLower()).id;
}
public int GetUserId()
{
try
{
var uId = httpContextAccessor.HttpContext.User.Claims.FirstOrDefault(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value;
return Int32.Parse(uId);
}
catch
{
return 0;
}
}
public DateTime GetLastAccess()
{
var site = context.sites.FirstOrDefault(s => s.id == this.siteId);
return site.lastAccess;
}
public void UpdateLastAccess()
{
var site = context.sites.FirstOrDefault(s => s.id == this.siteId);
site.lastAccess = DateTime.Now;
context.SaveChanges();
}
public void Labeling(baseClass entity)
{
entity.siteId = this.siteId;
entity.updateUserId = this.userId;
entity.updateDateTime = DateTime.Now;
}
public baseClass UpdateEntity(baseClass entity)
{
if (entity.siteId != 0 && entity.siteId != this.siteId)
throw new Exception("شما مجوز تغییر این قسمت را ندارید.");
this.Labeling(entity);
this.context.Update(entity);
this.context.SaveChanges();
return entity;
}
public baseClass UpdateEntity(baseClass entity, IFormFile image)
{
this.UpdateEntity(entity);
this.SaveFile1(entity, image);
return entity;
}
public void DeleteEntity(baseClass entity)
{
entity.isDeleted = true;
this.UpdateEntity(entity);
//this.context.SaveChanges();
}
public baseClass AddEntity(baseClass entity)
{
this.Labeling(entity);
this.context.Add(entity);
this.context.SaveChanges();
return entity;
}
public baseClass DuplicateEntity(baseClass entity, baseClass newEntity)
{
var values = context.Entry(entity).CurrentValues.Clone();
values["id"] = 0;
this.context.Add(newEntity);
context.Entry(newEntity).CurrentValues.SetValues(values);
this.Labeling(newEntity);
this.context.SaveChanges();
return entity;
}
public baseClass AddEntity(baseClass entity, IFormFile image)
{
this.AddEntity(entity);
this.SaveFile1(entity, image);
return entity;
}
private bool SaveFile1(baseClass entity, IFormFile file, string extention = ".jpg")
{
var t = entity.GetType();
var type = t.FullName.Replace("Entities.", "");
if (file == null || file.Length == 0)
return false;
var hame = GetSiteName();
string directoryAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + hame + "\\image\\" + type;
bool exists = System.IO.Directory.Exists(directoryAddress);
if (!exists)
Directory.CreateDirectory(directoryAddress);
var path = Path.Combine(directoryAddress, (entity as baseClass).id.ToString() + extention);
using (var stream = new FileStream(path, FileMode.Create))
{
file.CopyTo(stream);
}
return true;
}
private bool SaveFile<T>(IFormFile file, T item, string extention = ".jpg")
{
var type = typeof(T);
if (file == null || file.Length == 0)
return false;
var hame = GetSiteName();
string directoryAddress = Directory.GetCurrentDirectory() + "\\wwwroot\\" + hame + "\\image\\" + type.Name;
bool exists = System.IO.Directory.Exists(directoryAddress);
if (!exists)
Directory.CreateDirectory(directoryAddress);
var path = Path.Combine(directoryAddress, (item as baseClass).id.ToString() + extention);
using (var stream = new FileStream(path, FileMode.Create))
{
file.CopyTo(stream);
}
return true;
}
#endregion
#region Reminder
public IEnumerable<reminder> GetReminders()
{
var reminders = context.reminders.Where(r => (r.siteId == this.allSiteId || r.siteId == this.siteId) && !r.isDeleted).
OrderBy(r => r.title).
ToList();
return reminders;
}
public IEnumerable<reminder> GetReminders(int remindDays)
{
PersianCalendar pc = new PersianCalendar();
var dt = pc.AddDays(DateTime.Now, remindDays);
int dayOfMonth = pc.GetDayOfMonth(dt);
int month = pc.GetMonth(dt);
var reminders = context.reminders.Where(r => r.day == dayOfMonth && r.month == month &&
(r.siteId == this.allSiteId || r.siteId == this.siteId) && !r.isDeleted).
OrderBy(r => r.title).
ToList();
return reminders;
}
public reminder GetReminder(int? id)
{
var reminder = context.reminders.SingleOrDefault(r => r.id == id &&
(r.siteId == this.allSiteId || r.siteId == this.siteId) && !r.isDeleted);
return reminder;
}
#endregion
#region User
public pagedResult<user> GetUsers_ThisSite(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<user> query;
if (!String.IsNullOrEmpty(searchString))
query = userManager.Users.Where(u =>
u.siteId == this.siteId && !u.isDeleted);
else
query = userManager.Users.Where(u =>
u.siteId == this.siteId && !u.isDeleted);
pagedResult<user> result = new pagedResult<user>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderByDescending(p => p.Id).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
foreach (var user in result.items)
{
user.role = this.GetRole(user);
}
return result;
}
public user GetUser(string userName)
{
user user = userManager.Users.FirstOrDefault(u =>
u.actualUserName == userName &&
(u.siteId == u.siteId) && !u.isDeleted);
var roles = userManager.GetRolesAsync(user).Result;
user.role = this.GetRole(user);
return user;
}
public user GetUser(int? id)
{
user user = userManager.Users.FirstOrDefault(u => u.Id == id &&
(u.siteId == u.siteId || u.siteId == allSiteId) && !u.isDeleted);
if (user == null)
return null;
var roles = userManager.GetRolesAsync(user).Result;
user.role = this.GetRole(user);
return user;
}
public user_express GetUser_Express(string userName)
{
user user = GetUser(userName);
var res = mapperConfiguration.CreateMapper().Map<user_express>(user);
res.clientIsValid = true;
return res;
}
public user_express GetUser_Express(int? id)
{
user user = GetUser(id);
var res = mapperConfiguration.CreateMapper().Map<user_express>(user);
res.clientIsValid = true;
return res;
}
public IdentityResult AddUser(user_express user)
{
var result = userManager.CreateAsync(new user
{
siteId = this.siteId,
actualUserName = user.actualUserName,
firstName = user.firstName,
lastName = user.lastName,
Email = user.email ?? "<EMAIL>",
nationalCode = user.nationalCode,
PhoneNumber = user.phoneNumber,
updateUserId = this.userId,
updateDateTime = DateTime.Now
}, user.password
).Result;
return result;
}
public IdentityResult DeleteUser(int id)
{
var user = this.GetUser(id);
user.isDeleted = true;
user.updateUserId = this.userId;
user.updateDateTime = DateTime.Now;
var result = userManager.UpdateAsync(user).Result;
return result;
}
public IdentityResult AssignRoleToUser(int userId, string role)
{
var user = this.GetUser(userId);
var roles = userManager.GetRolesAsync(user).Result;
var t = userManager.RemoveFromRolesAsync(user, roles).Result;
var result = userManager.AddToRoleAsync(user, role).Result;
return result;
}
#endregion
#region Role
public List<role> GetAllRoles_ThisSite()
{
var roles = roleManager.Roles.Where(r =>
r.siteId == this.siteId && !r.isDeleted).ToList();
return roles;
}
public pagedResult<role> GetAllRoles_ThisSite(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<role> query;
if (!String.IsNullOrEmpty(searchString))
query = roleManager.Roles.Where(r => r.Name.Contains(searchString) &&
r.siteId == this.siteId && !r.isDeleted);
else
query = roleManager.Roles.Where(r =>
r.siteId == this.siteId && !r.isDeleted);
pagedResult<role> result = new pagedResult<role>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.Name).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public string GetRole(user user)
{
var roles = userManager.GetRolesAsync(user).Result;
if (roles.Count() == 0)
return "";
else
return roles[0];
}
public string GetRole(int userId)
{
var user = this.GetUser(userId);
return this.GetRole(user);
}
public string GetRoleOfCurrentUser()
{
try
{
return this.GetRole(this.userId);
}
catch
{
return "";
}
}
public IdentityResult AddRole(string roleName)
{
var result = roleManager.CreateAsync(new role
{
siteId = this.siteId,
actualName = roleName,
updateUserId = this.userId,
updateDateTime = DateTime.Now
}).Result;
return result;
}
#endregion
#region Login
public SignInResult Login(string userName, string password, bool isPersistent = false)
{
var user = GetUser(userName);
signInManager.SignOutAsync();
if (user != null)
{
var result = signInManager.PasswordSignInAsync(user, password, isPersistent, false).Result;
return result;
}
return SignInResult.Failed;
}
public void LogOut()
{
signInManager.SignOutAsync();
}
#endregion
#region AdminMenu
//جدول اکشن که اضافه شد باید این تابع به روز بشه
public bool HavePermision(string roleName, string area, string controller, string action)
{
var count = this.context.role_adminMenu.Include(ra => ra.adminMenu).
Where(ra => ra.roleName == roleName && ra.adminMenu.area == area && ra.adminMenu.controller == controller &&
ra.adminMenu.showInMenu &&
(ra.siteId == this.allSiteId || ra.siteId == this.siteId) && !ra.isDeleted &&
(ra.adminMenu.siteId == this.allSiteId || ra.adminMenu.siteId == this.siteId) && !ra.adminMenu.isDeleted).
Count();
if (count > 0)
return true;
return false;
}
//جدول اکشن که اضافه شد باید این تابع به روز بشه
public List<adminMenu> GetAdminMenusOfRole(string role)
{
var adminMenus = this.context.role_adminMenu.Include(ra => ra.adminMenu).
Where(ra => ra.roleName == role && ra.adminMenu.showInMenu &&
(ra.siteId == this.allSiteId || ra.siteId == this.siteId) && !ra.isDeleted &&
(ra.adminMenu.siteId == this.allSiteId || ra.adminMenu.siteId == this.siteId) && !ra.adminMenu.isDeleted).
Select(ra => ra.adminMenu).
ToList();
return adminMenus;
}
#endregion
#region Order
public int AddOrder(insurance_client insurance)
{
order order = new order
{
userId = this.userId,
dateTime = DateTime.Now,
//ناتمام
orderStatusId = (int)orderStatuses.inCompleted,
insuranceId = insurance.id,
price = insurance.price
};
//this.Labeling(order);
//this.context.Add(order);
//this.context.SaveChanges();
this.AddEntity(order);
AppendOrderField(order, insurance);
this.context.SaveChanges();
return order.id;
}
public int MapInsuranceToOrder(order order, insurance_client insurance)
{
order.userId = this.userId;
order.insuranceId = insurance.id;
order.price = insurance.price;
//from
foreach (var step in insurance.steps)
{
foreach (var fieldSet in step.fieldSets)
{
foreach (var field in fieldSet.fields)
{
if (field.type == "label" || field.type == "html" ||
field.type == "acceptCheckBox" || field.type == "price")
continue;
else if (field.type == "paymentType")
{
order.paymentTypeId = Convert.ToInt32(field.value);
continue;
}
orderField orderField;
orderField = order.fields.FirstOrDefault(of => of.name == field.name);
if (orderField == null)
{
orderField = new orderField
{
name = field.name,
type = field.type,
title = field.title
};
this.Labeling(orderField as baseClass);
orderField.orderIndex = step.orderIndex * 10000 + fieldSet.orderIndex * 100 + field.orderIndex;
order.fields.Add(orderField);
}
if (field.type == "comboBox")
{
try
{
int? id = Int32.Parse(field.value);
orderField.value = this.GetDataValue(id).title;
}
catch { }
}
else
{
orderField.value = field.value;
}
}
}
}
//to
this.context.SaveChanges();
return order.id;
}
public order GetOrder(int? id)
{
var order = this.context.orders.Where(o => o.id == id &&
(o.siteId == this.allSiteId || o.siteId == this.siteId) && !o.isDeleted).
Include(o => o.insurance).
Include(o => o.fields).
Include(o => o.paymentType).
Include(o => o.orderStatus).
First();
order.fields = order.fields.OrderBy(of => of.orderIndex).ToList();
order.user = this.GetUser(order.userId);
return order;
}
public int ProccessOrderImage(IFormFileCollection images)
{
int orderId = 0;
foreach (var image in images)
{
var arr = image.Name.Split('@');
var orderField = this.GetOrderField(Int32.Parse(arr[0]), arr[1]);
orderId = orderField.orderId;
this.SaveFile<orderField>(image, orderField);
}
return orderId;
}
public List<order> GetOrdersOfCurrentUser_ThisSite()
{
var orders = this.context.orders.Where(o => o.userId == this.userId &&
(o.siteId == this.siteId) && !o.isDeleted).
Include(o => o.fields).
Include(o => o.insurance).
ToList();
return orders;
}
public pagedResult<order> GetOrdersInStatus_ThisSite(int? statusId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<order> query;
if (!String.IsNullOrEmpty(searchString))
query = context.orders.Where(o => o.orderStatusId == statusId && o.userId != 0 &&
(o.siteId == this.siteId) && !o.isDeleted).
Include(o => o.insurance).
Include(o => o.orderStatus).
OrderByDescending(o => o.dateTime);
else
query = context.orders.Where(o => o.orderStatusId == statusId &&
(o.siteId == this.siteId) && !o.isDeleted).
Include(o => o.insurance).
Include(o => o.orderStatus).
OrderByDescending(o => o.dateTime);
pagedResult<order> result = new pagedResult<order>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
foreach (var order in result.items)
{
order.user = this.GetUser(order.userId);
}
return result;
}
public bool SetOrderBankReference(order order, string bankReference)
{
try
{
order.bankReference = bankReference;
this.UpdateEntity(order);
//this.context.SaveChanges();
return true;
}
catch
{
return false;
}
}
public void AddLogToOrder(order order, string log)
{
order.log += "#" + log;
this.context.SaveChanges();
}
public void ChangeOrderStatus(order order, int statusId)
{
order.orderStatusId = statusId;
this.context.SaveChanges();
}
#endregion
#region OrderField
private void AppendOrderField(order order, insurance_client insurance)
{
foreach (var step in insurance.steps)
{
foreach (var fieldSet in step.fieldSets)
{
foreach (var field in fieldSet.fields)
{
if (field.type == "label" || field.type == "html" ||
field.type == "acceptCheckBox" || field.type == "price")
continue;
else if (field.type == "paymentType")
{
order.paymentTypeId = Convert.ToInt32(field.value);
continue;
}
orderField orderField = new orderField
{
name = field.name,
type = field.type,
title = field.title
};
this.Labeling(orderField as baseClass);
if (field.type == "comboBox")
{
try
{
int? id = Int32.Parse(field.value);
orderField.value = this.GetDataValue(id).title;
}
catch { }
}
else
{
orderField.value = field.value;
}
orderField.orderIndex = step.orderIndex * 10000 + fieldSet.orderIndex * 100 + field.orderIndex;
order.fields.Add(orderField);
}
}
}
}
public orderField GetOrderField(int orderId, string fieldName)
{
var orderField = context.orderFields.FirstOrDefault(of => of.orderId == orderId &&
of.name == fieldName &&
(of.siteId == this.siteId) && !of.isDeleted);
return orderField;
}
#endregion
#region OrderStatus
public IEnumerable<orderStatus> GetActiveOrderStatuses()
{
var orderStatuses = context.orderStatuses.Where(os => (os.siteId == this.allSiteId || os.siteId == this.siteId) && os.active && !os.isDeleted).
OrderBy(os => os.orderIndex).
ToList();
return orderStatuses;
}
public pagedResult<orderStatus> GetOrderStatuses(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<orderStatus> query;
if (!String.IsNullOrEmpty(searchString))
query = context.orderStatuses.Where(os => os.title.Contains(searchString) &&
(os.siteId == this.allSiteId || os.siteId == this.siteId) && !os.isDeleted);
else
query = context.orderStatuses.Where(os => (os.siteId == this.allSiteId || os.siteId == this.siteId) && !os.isDeleted);
pagedResult<orderStatus> result = new pagedResult<orderStatus>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public orderStatus GetOrderStatus(int? id)
{
var orderStatus = context.orderStatuses.SingleOrDefault(os => os.id == id &&
(os.siteId == this.allSiteId || os.siteId == this.siteId) && !os.isDeleted);
return orderStatus;
}
//public orderStatus AddOrderStatus(orderStatus orderStatus)
//{
// this.UpdateEntity(orderStatus as baseClass);
// this.context.Add(orderStatus);
// this.context.SaveChanges();
// return orderStatus;
//}
//public orderStatus UpdateOrderStatus(orderStatus orderStatus)
//{
// this.UpdateEntity(orderStatus as baseClass);
// this.context.Update(orderStatus);
// this.context.SaveChanges();
// return orderStatus;
//}
//public void DeleteOrderStatus(orderStatus orderStatus)
//{
// this.DeleteEntity(orderStatus as baseClass);
//}
#endregion
#region Setting
public string GetSiteName()
{
return this.context.sites.FirstOrDefault(s => (s.id == this.siteId)).name;
}
public string GetSetting(string key)
{
try
{
return this.context.settings.FirstOrDefault(s => s.key == key &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && s.active && !s.isDeleted).
value;
}
catch
{
return "";
}
}
public pagedResult<setting> GetSettings(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<setting> query;
if (!String.IsNullOrEmpty(searchString))
query = context.settings.Where(s => (s.title.Contains(searchString) || s.key.Contains(searchString)) &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted);
else
query = context.settings.Where(s => (s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted);
pagedResult<setting> result = new pagedResult<setting>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public setting GetSetting(int? id)
{
var setting = context.settings.SingleOrDefault(s => s.id == id &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted);
return setting;
}
#endregion
#region Insurance
public IEnumerable<insurance> GetActiveInsurances()
{
var insurances = context.insurances.Where(i => (i.siteId == this.allSiteId || i.siteId == this.siteId) && i.active && !i.isDeleted).
OrderBy(insurance => insurance.orderIndex).
ToList();
return insurances;
}
public IEnumerable<insurance_client> GetActiveInsurances_Client()
{
var insurances = GetActiveInsurances();
var res = mapperConfiguration.CreateMapper().Map<List<insurance_client>>(insurances);
foreach (var insurance in res)
{
insurance.step_navigations = new List<step_navigation>();
var steps = this.context.steps.Where(s => s.insuranceId == insurance.id &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && s.active && !s.isDeleted).
OrderBy(s => s.number).ToList();
foreach (var step in steps)
{
insurance.step_navigations.Add(new step_navigation { title = step.title, number = step.number, image = step.image });
}
}
return res;
}
public pagedResult<insurance> GetInsurances(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<insurance> query;
if (!String.IsNullOrEmpty(searchString))
query = context.insurances.Where(i => i.title.Contains(searchString) &&
(i.siteId == this.allSiteId || i.siteId == this.siteId) && !i.isDeleted);
else
query = context.insurances.Where(i => (i.siteId == this.allSiteId || i.siteId == this.siteId) && !i.isDeleted);
pagedResult<insurance> result = new pagedResult<insurance>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public insurance GetInsurance(int? id)
{
var insurance = context.insurances.SingleOrDefault(i => i.id == id &&
(i.siteId == this.allSiteId || i.siteId == this.siteId) && !i.isDeleted);
return insurance;
}
#endregion
#region Step
public pagedResult<step> GetStepsOfInsurance(int? insuranceId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<step> query;
if (!String.IsNullOrEmpty(searchString))
query = context.steps.Where(s => s.insuranceId == insuranceId && s.title.Contains(searchString) &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted);
else
query = context.steps.Where(s => s.insuranceId == insuranceId &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted);
pagedResult<step> result = new pagedResult<step>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(s => s.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public step GetStep(int? id)
{
var step = context.steps.SingleOrDefault(s => s.id == id &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted);
return step;
}
public step GetActiveStep(int insuranceId, int stepNumber)
{
try
{
var step = context.steps.Where(s => s.number == stepNumber &&
s.insuranceId == insuranceId &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && s.active && !s.isDeleted).
Include(s => s.fieldSets).
ThenInclude(fieldSet => fieldSet.fields).
First();
step.fieldSets = step.fieldSets.Where(fs => (fs.siteId == this.allSiteId || fs.siteId == this.siteId) && fs.active && !fs.isDeleted).
OrderBy(fs => fs.orderIndex).
ToList();
foreach (var fieldSet in step.fieldSets)
{
fieldSet.fields = fieldSet.fields.Where(f => (f.siteId == this.allSiteId || f.siteId == this.siteId) && f.active && !f.isDeleted).
OrderBy(f => f.orderIndex).
ToList();
}
return step;
}
catch
{
return null;
}
}
public step_client GetStep_client(int insuranceId, int stepNumber)
{
var step = GetActiveStep(insuranceId, stepNumber);
var res = mapperConfiguration.CreateMapper().Map<step_client>(step);
return res;
}
#endregion
#region FieldSet
public pagedResult<fieldSet> GetFieldSetsOfStep(int? stepId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<fieldSet> query;
if (!String.IsNullOrEmpty(searchString))
query = context.fieldSets.Where(fs => fs.stepId == stepId && fs.title.Contains(searchString) &&
(fs.siteId == this.allSiteId || fs.siteId == this.siteId) && !fs.isDeleted).
Include(fs => fs.step);
else
query = context.fieldSets.Where(fs => fs.stepId == stepId &&
(fs.siteId == this.allSiteId || fs.siteId == this.siteId) && !fs.isDeleted).
Include(fs => fs.step);
pagedResult<fieldSet> result = new pagedResult<fieldSet>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(s => s.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public fieldSet GetFieldSet(int? id)
{
var fieldSet = context.fieldSets.FirstOrDefault(fs => fs.id == id &&
(fs.siteId == this.allSiteId || fs.siteId == this.siteId) && !fs.isDeleted);
return fieldSet;
}
#endregion
#region Field
public pagedResult<field> GetFieldsOfFieldSet(int? fieldSetId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<field> query;
if (!String.IsNullOrEmpty(searchString))
query = context.fields.Where(f => f.fieldSetId == fieldSetId && f.title.Contains(searchString) &&
(f.siteId == this.allSiteId || f.siteId == this.siteId) && !f.isDeleted).
Include(f => f.fieldSet);
else
query = context.fields.Where(f => f.fieldSetId == fieldSetId &&
(f.siteId == this.allSiteId || f.siteId == this.siteId) && !f.isDeleted).
Include(f => f.fieldSet);
pagedResult<field> result = new pagedResult<field>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(s => s.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public List<field> GetFieldsOfInsurance(int? insuranceId)
{
var fields = context.fields.Where(f => f.fieldSet.step.insuranceId == insuranceId &&
(f.siteId == this.allSiteId || f.siteId == this.siteId) && !f.isDeleted).
OrderBy(f => f.title).
ToList();
return fields;
}
public field GetField(int? id)
{
var field = context.fields.Include(f => f.fieldSet).
Include(f => f.father).
SingleOrDefault(f => f.id == id &&
(f.siteId == this.allSiteId || f.siteId == this.siteId) && !f.isDeleted);
return field;
}
#endregion
#region DataType
public IEnumerable<dataType> GetDataTypes()
{
var dataTypes = context.dataTypes.Where(i => (i.siteId == this.allSiteId || i.siteId == this.siteId) && !i.isDeleted).
OrderBy(dt => dt.orderIndex).
ToList();
return dataTypes;
}
public pagedResult<dataType> GetDataTypes(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<dataType> query;
if (!String.IsNullOrEmpty(searchString))
query = context.dataTypes.Where(i => i.title.Contains(searchString) &&
(i.siteId == this.allSiteId || i.siteId == this.siteId) && !i.isDeleted);
else
query = context.dataTypes.Where(i => (i.siteId == this.allSiteId || i.siteId == this.siteId) && !i.isDeleted);
pagedResult<dataType> result = new pagedResult<dataType>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public dataType GetDataType(int? id)
{
var dataType = context.dataTypes.Include(bc => bc.father).
SingleOrDefault(dt => dt.id == id &&
(dt.siteId == this.allSiteId || dt.siteId == this.siteId) && !dt.isDeleted);
return dataType;
}
//public dataType AddDataType(dataType dataType)
//{
// this.UpdateEntity(dataType as baseClass);
// this.context.Add(dataType);
// this.context.SaveChanges();
// return dataType;
//}
//public dataType UpdateDataType(dataType dataType)
//{
// this.UpdateEntity(dataType as baseClass);
// this.context.Update(dataType);
// this.context.SaveChanges();
// return dataType;
//}
//public void DeleteDataType(dataType dataType)
//{
// this.DeleteEntity(dataType as baseClass);
//}
#endregion
#region DataValue
public pagedResult<dataValue> GetDataValuesOfDataType(int? dataTypeId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<dataValue> query;
if (!String.IsNullOrEmpty(searchString))
query = context.dataValues.Where(dv => dv.dataTypeId == dataTypeId && dv.title.Contains(searchString) &&
(dv.siteId == this.allSiteId || dv.siteId == this.siteId) && !dv.isDeleted);
else
query = context.dataValues.Where(dv => dv.dataTypeId == dataTypeId &&
(dv.siteId == this.allSiteId || dv.siteId == this.siteId) && !dv.isDeleted);
pagedResult<dataValue> result = new pagedResult<dataValue>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(s => s.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public List<dataValue> GetDataValuesOfFatherDataType(int? dataTypeId)
{
var dataType = this.GetDataType(dataTypeId);
var dataValues = context.dataValues.Where(dv => dv.dataTypeId == dataType.fatherId &&
(dv.siteId == this.allSiteId || dv.siteId == this.siteId) && !dv.isDeleted).ToList();
return dataValues;
}
public dataValue GetDataValue(int? id)
{
var dataValue = context.dataValues.SingleOrDefault(dv => dv.id == id &&
(dv.siteId == this.allSiteId || dv.siteId == this.siteId) && !dv.isDeleted);
return dataValue;
}
public List<dataValue_client> GetAcitveDataValues_Client(int dataTypeId)
{
var dataValues = context.dataValues.Where(dv => dv.dataTypeId == dataTypeId &&
(dv.siteId == this.allSiteId || dv.siteId == this.siteId) && dv.active && !dv.isDeleted).
//اینها باید حذف شوند
Include(dataValue => dataValue.categories).
ThenInclude(dataValue_category => dataValue_category.category).
ThenInclude(category => category.attributes).
OrderBy(dv => dv.orderIndex).ToList();
foreach (var dataValue in dataValues)
{
dataValue.categories = dataValue.categories.Where(dv => !dv.isDeleted).ToList();
foreach (var category in dataValue.categories)
{
category.category.attributes = category.category.attributes.Where(a => !a.isDeleted && a.active).ToList();
}
}
//var dataValues = this.GetActiveDataTypeIncludeValues(dataTypeId).dataValues;
var res = mapperConfiguration.CreateMapper().Map<List<dataValue_client>>(dataValues);
return res;
}
public List<dataValue_client> GetActiveChildDataValues_Client(int dataTypeId, int fatherId)
{
var dataValues = context.dataValues.Where(dv => dv.dataTypeId == dataTypeId && dv.fatherId == fatherId &&
(dv.siteId == this.allSiteId || dv.siteId == this.siteId) && dv.active && !dv.isDeleted).
//اینها باید حذف شوند انشاالله
Include(dataValue => dataValue.categories).
ThenInclude(dataValue_category => dataValue_category.category).
ThenInclude(category => category.attributes).
OrderBy(dv => dv.orderIndex).
ToList();
foreach (var dataValue in dataValues)
{
dataValue.categories = dataValue.categories.Where(dv => !dv.isDeleted).ToList();
foreach (var category in dataValue.categories)
{
category.category.attributes = category.category.attributes.Where(a => !a.isDeleted && a.active).ToList();
}
}
var res = mapperConfiguration.CreateMapper().Map<List<dataValue_client>>(dataValues);
return res;
}
#endregion
#region Term
public pagedResult<term> GetTerms(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<term> query;
if (!String.IsNullOrEmpty(searchString))
query = context.terms.Where(t => t.title.Contains(searchString) &&
(t.siteId == this.allSiteId || t.siteId == this.siteId) && !t.isDeleted);
else
query = context.terms.Where(t => (t.siteId == this.allSiteId || t.siteId == this.siteId) && !t.isDeleted);
pagedResult<term> result = new pagedResult<term>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public List<term> GetTermsIncludeCategory(int dataTypeId)
{
var terms = context.terms.Include(t => t.categories).
Where(t => t.dataTypeId == dataTypeId &&
(t.siteId == this.allSiteId || t.siteId == this.siteId) && !t.isDeleted).
OrderBy(t => t.orderIndex).
ToList();
foreach (var term in terms)
{
term.categories = term.categories.Where(c => c.active).ToList();
}
return terms;
}
public List<category> GetAcitveCategories(int? dataValueId)
{
var categories = this.context.dataValue_category.Include(dvc => dvc.category).
Where(dvc => dvc.dataValueId == dataValueId && !dvc.category.isDeleted && dvc.category.active &&
(dvc.siteId == this.allSiteId || dvc.siteId == this.siteId) && !dvc.isDeleted).
Select(dvc => dvc.category).
OrderBy(dvc => dvc.orderIndex).
ToList();
return categories;
}
public void SetCategoriesForDataValue(int datavalueId, List<int> categories)
{
var currentCategories = this.context.dataValue_category.Where(dvc => dvc.dataValueId == datavalueId &&
(dvc.siteId == this.allSiteId || dvc.siteId == this.siteId) && !dvc.isDeleted).
ToList();
foreach (var cupt in currentCategories)
{
if (categories != null && categories.Contains(cupt.categoryId))
continue;
this.DeleteEntity(cupt);
}
if (categories == null)
return;
foreach (var ctg in categories)
{
if (currentCategories.Select(cuc => cuc.categoryId).Contains(ctg))
continue;
dataValue_category dvc = new dataValue_category { dataValueId = datavalueId, categoryId = ctg };
this.AddEntity(dvc);
//this.Labeling(dvc as baseClass);
//this.context.Add(dvc);
//this.context.SaveChanges();
}
}
public term GetTerm(int? id)
{
var term = context.terms.SingleOrDefault(t => t.id == id &&
(t.siteId == this.allSiteId || t.siteId == this.siteId) && !t.isDeleted);
return term;
}
//public term AddTerm(term term)
//{
// this.UpdateEntity(term as baseClass);
// this.context.Add(term);
// this.context.SaveChanges();
// return term;
//}
//public term UpdateTerm(term term)
//{
// this.UpdateEntity(term as baseClass);
// this.context.Update(term);
// this.context.SaveChanges();
// return term;
//}
//public void DeleteTerm(term term)
//{
// this.DeleteEntity(term as baseClass);
//}
#endregion
#region Category
public pagedResult<category> GetCategoriesOfTerm(int? termId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<category> query;
if (!String.IsNullOrEmpty(searchString))
query = context.categories.Where(c => c.termId == termId && c.title.Contains(searchString) &&
(c.siteId == this.allSiteId || c.siteId == this.siteId) && !c.isDeleted);
else
query = context.categories.Where(c => c.termId == termId &&
(c.siteId == this.allSiteId || c.siteId == this.siteId) && !c.isDeleted);
pagedResult<category> result = new pagedResult<category>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(s => s.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public category GetCategory(int? id)
{
var category = context.categories.SingleOrDefault(c => c.id == id &&
(c.siteId == this.allSiteId || c.siteId == this.siteId) && !c.isDeleted);
return category;
}
#endregion
#region Attribute
public pagedResult<attribute> GetAttributesOfCategory(int? categoryId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<attribute> query;
if (!String.IsNullOrEmpty(searchString))
query = context.attributes.Where(a => a.categoryId == categoryId && (a.title.Contains(searchString) || a.name.Contains(searchString)) &&
(a.siteId == this.allSiteId || a.siteId == this.siteId) && !a.isDeleted).
Include(a => a.category);
else
query = context.attributes.Where(a => a.categoryId == categoryId &&
(a.siteId == this.allSiteId || a.siteId == this.siteId) && !a.isDeleted).
Include(a => a.category);
pagedResult<attribute> result = new pagedResult<attribute>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(s => s.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public attribute GetAttribute(int? id)
{
var attribute = context.attributes.SingleOrDefault(a => a.id == id &&
(a.siteId == this.allSiteId || a.siteId == this.siteId) && !a.isDeleted);
return attribute;
}
#endregion
#region Box
public pagedResult<box> GetBoxesOfBoxCategory(int? boxCategoryId, int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<box> query;
if (!String.IsNullOrEmpty(searchString))
query = context.boxes.Where(b => b.boxCategoryId == boxCategoryId && b.title.Contains(searchString) &&
(b.siteId == this.allSiteId || b.siteId == this.siteId) && !b.isDeleted);
else
query = context.boxes.Where(b => b.boxCategoryId == boxCategoryId &&
(b.siteId == this.allSiteId || b.siteId == this.siteId) && !b.isDeleted);
pagedResult<box> result = new pagedResult<box>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(s => s.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public box GetBox(int? id)
{
var box = context.boxes.SingleOrDefault(b => b.id == id &&
(b.siteId == this.allSiteId || b.siteId == this.siteId) && !b.isDeleted);
return box;
}
//public box AddBox(box box, IFormFile image)
//{
// this.UpdateEntity(box as baseClass);
// this.context.Add(box);
// this.context.SaveChanges();
// this.SaveFile<box>(image, box);
// return box;
//}
//public box UpdateBox(box box, IFormFile image)
//{
// this.UpdateEntity(box as baseClass);
// this.context.Update(box);
// this.context.SaveChanges();
// this.SaveFile<box>(image, box);
// return box;
//}
//public void DeleteBox(box box)
//{
// this.DeleteEntity(box as baseClass);
//}
public Task<List<box>> GetActiveBoxesOfCategory_Async(int categoryId)
{
return context.boxes.Where(b => b.boxCategory.id == categoryId &&
(b.siteId == this.allSiteId || b.siteId == this.siteId) && b.active && !b.isDeleted).
OrderBy(b => b.orderIndex).
ToListAsync();
}
#endregion
#region BoxCategory
public IEnumerable<boxCategory> GetBoxCategories()
{
var boxCategories = context.boxCategories.Where(bc => (bc.siteId == this.allSiteId || bc.siteId == this.siteId) && !bc.isDeleted).
OrderBy(bc => bc.title).
ToList();
return boxCategories;
}
public pagedResult<boxCategory> GetBoxCategories_hierarchy(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<boxCategory> query;
if (!String.IsNullOrEmpty(searchString))
query = context.boxCategories.Where(bc => bc.father == null && bc.title.Contains(searchString) &&
(bc.siteId == this.allSiteId || bc.siteId == this.siteId) && !bc.isDeleted).
Include(bc => bc.childs).
ThenInclude(bc => bc.childs).
ThenInclude(bc => bc.childs);
else
query = context.boxCategories.Where(bc => bc.father == null &&
(bc.siteId == this.allSiteId || bc.siteId == this.siteId) && !bc.isDeleted).
Include(bc => bc.childs).
ThenInclude(bc => bc.childs).
ThenInclude(bc => bc.childs);
pagedResult<boxCategory> result = new pagedResult<boxCategory>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
foreach (var level1 in result.items)
{
if (level1.childs != null && level1.childs.Count > 0)
{
level1.childs = level1.childs.Where(m => !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
foreach (var level2 in level1.childs)
{
if (level2.childs != null && level2.childs.Count > 0)
{
level2.childs = level2.childs.Where(m => !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
foreach (var level3 in level2.childs)
{
if (level3.childs != null && level3.childs.Count > 0)
{
level3.childs = level3.childs.Where(m => !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
}
}
}
}
}
}
return result;
}
public boxCategory GetBoxCategory(int? id)
{
var boxCategory = context.boxCategories.Include(bc => bc.father).
SingleOrDefault(bc => bc.id == id &&
(bc.siteId == this.allSiteId || bc.siteId == this.siteId) && !bc.isDeleted);
return boxCategory;
}
//public boxCategory AddBoxCategory(boxCategory boxCategory, IFormFile image)
//{
// this.UpdateEntity(boxCategory as baseClass);
// this.context.Add(boxCategory);
// this.context.SaveChanges();
// this.SaveFile<boxCategory>(image, boxCategory);
// return boxCategory;
//}
//public boxCategory UpdateBoxCategory(boxCategory boxCategory, IFormFile image)
//{
// this.UpdateEntity(boxCategory as baseClass);
// this.context.Update(boxCategory);
// this.context.SaveChanges();
// this.SaveFile<boxCategory>(image, boxCategory);
// return boxCategory;
//}
//public void DeleteBoxCategory(boxCategory boxCategory)
//{
// this.DeleteEntity(boxCategory as baseClass);
//}
public string GetBoxCategoryTitle(int id)
{
return context.boxCategories.SingleOrDefault(bc => bc.id == id &&
(bc.siteId == this.allSiteId || bc.siteId == this.siteId) && !bc.isDeleted).
title;
}
public List<boxCategory> GetActiveBoxCategories_Async(int fatherId)
{
List<boxCategory> boxCategories =
context.boxCategories.Where(bc => bc.father.id == fatherId &&
(bc.siteId == this.allSiteId || bc.siteId == this.siteId) && bc.active && !bc.isDeleted).
Include(bc => bc.boxes).
OrderBy(bc => bc.orderIndex).ToList();
foreach (var boxCategory in boxCategories)
boxCategory.boxes = boxCategory.boxes.Where(b => b.active && !b.isDeleted).OrderBy(b => b.orderIndex).ToList();
return boxCategories;
}
#endregion
#region Menu
public IEnumerable<menu> GetMenus()
{
var menus = context.menus.Where(m => (m.siteId == this.allSiteId || m.siteId == this.siteId) && !m.isDeleted).
OrderBy(m => m.title).
ToList();
return menus;
}
public IEnumerable<menu> GetMenus_hierarchy()
{
var menus = context.menus.Where(m => m.father == null &&
(m.siteId == this.allSiteId || m.siteId == this.siteId) && !m.isDeleted).
Include(m => m.childs).
ThenInclude(m => m.childs).
ThenInclude(m => m.childs).
OrderBy(m => m.orderIndex).
ToList();
foreach (var level1 in menus)
{
if (level1.childs != null && level1.childs.Count > 0)
{
level1.childs = level1.childs.Where(m => !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
foreach (var level2 in level1.childs)
{
if (level2.childs != null && level2.childs.Count > 0)
{
level2.childs = level2.childs.Where(m => !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
foreach (var level3 in level2.childs)
{
if (level3.childs != null && level3.childs.Count > 0)
{
level3.childs = level3.childs.Where(m => !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
}
}
}
}
}
}
return menus;
}
public menu GetMenu(int? id)
{
var menu = context.menus.Include(m => m.father).
SingleOrDefault(m => m.id == id &&
(m.siteId == this.allSiteId || m.siteId == this.siteId) && !m.isDeleted);
return menu;
}
//public menu AddMenu(menu menu, IFormFile image)
//{
// this.UpdateEntity(menu as baseClass);
// this.context.Add(menu);
// this.context.SaveChanges();
// this.SaveFile<menu>(image, menu);
// return menu;
//}
//public menu UpdateMenu(menu menu, IFormFile image)
//{
// this.UpdateEntity(menu as baseClass);
// this.context.Update(menu);
// this.context.SaveChanges();
// this.SaveFile<menu>(image, menu);
// return menu;
//}
//public void DeleteMenu(menu menu)
//{
// this.DeleteEntity(menu as baseClass);
//}
public List<menu> GeActiveChildMenus_Async(int fatherId)
{
var menus = context.menus.Where(m => m.father.id == fatherId &&
(m.siteId == this.allSiteId || m.siteId == this.siteId) && m.active && !m.isDeleted).
Include(m => m.childs).
ThenInclude(m => m.childs).
OrderBy(m => m.orderIndex).ToList();
foreach (var level1 in menus)
{
if (level1.childs != null && level1.childs.Count > 0)
{
level1.childs = level1.childs.Where(m => m.active && !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
foreach (var level2 in level1.childs)
{
if (level2.childs != null && level2.childs.Count > 0)
{
level2.childs = level2.childs.Where(m => m.active && !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
foreach (var level3 in level2.childs)
{
if (level3.childs != null && level3.childs.Count > 0)
{
level3.childs = level3.childs.Where(m => m.active && !m.isDeleted).OrderBy(m => m.orderIndex).ToList();
}
}
}
}
}
}
return menus;
}
#endregion
#region PostCategory
public IEnumerable<postCategory> GetPostCategories()
{
var postCategories = context.postCategories.Where(pc => (pc.siteId == this.allSiteId || pc.siteId == this.siteId) && !pc.isDeleted).
OrderBy(p => p.orderIndex).
ToList();
return postCategories;
}
public postCategory GetPostCategory(int? id)
{
var postCategory = context.postCategories.SingleOrDefault(pc => pc.id == id &&
(pc.siteId == this.allSiteId || pc.siteId == this.siteId) && !pc.isDeleted);
return postCategory;
}
//public postCategory AddPostCategory(postCategory postCategory)
//{
// this.UpdateEntity(postCategory as baseClass);
// this.context.Add(postCategory);
// this.context.SaveChanges();
// return postCategory;
//}
//public postCategory UpdatePostCategory(postCategory postCategory)
//{
// this.UpdateEntity(postCategory as baseClass);
// this.context.Update(postCategory);
// this.context.SaveChanges();
// return postCategory;
//}
//public void DeletePostCategory(postCategory postCategory)
//{
// this.DeleteEntity(postCategory as baseClass);
//}
#endregion
#region Post
public pagedResult<post> GetPosts(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<post> query;
if (!String.IsNullOrEmpty(searchString))
query = context.posts.Where(p => p.title.Contains(searchString) &&
(p.siteId == this.allSiteId || p.siteId == this.siteId) && !p.isDeleted);
else
query = context.posts.Where(p => (p.siteId == this.allSiteId || p.siteId == this.siteId) && !p.isDeleted);
pagedResult<post> result = new pagedResult<post>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public post GetPost(int? id)
{
var post = context.posts.SingleOrDefault(p => p.id == id &&
(p.siteId == this.allSiteId || p.siteId == this.siteId) && !p.isDeleted);
return post;
}
#endregion
#region PaymentType
public List<paymentType> GetPaymentTypes()
{
var paymentTypes = this.context.paymentTypes.Where(pt => (pt.siteId == this.allSiteId || pt.siteId == this.siteId) && !pt.isDeleted).
OrderBy(pt => pt.orderIndex).ToList();
return paymentTypes;
}
public pagedResult<paymentType> GetPaymentTypes(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<paymentType> query;
if (!String.IsNullOrEmpty(searchString))
query = context.paymentTypes.Where(pt => pt.title.Contains(searchString) &&
(pt.siteId == this.allSiteId || pt.siteId == this.siteId) && !pt.isDeleted);
else
query = context.paymentTypes.Where(pt => (pt.siteId == this.allSiteId || pt.siteId == this.siteId) && !pt.isDeleted);
pagedResult<paymentType> result = new pagedResult<paymentType>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public List<paymentType> GetAcitvePaymentTypes(int? uId)
{
var paymentTypes = this.context.user_paymentType.Include(upt => upt.paymentType).
Where(upt => upt.userId == uId && !upt.paymentType.showForAll && !upt.paymentType.isDeleted && upt.paymentType.active &&
(upt.siteId == this.allSiteId || upt.siteId == this.siteId) && !upt.isDeleted).
Select(upt => upt.paymentType);
var showForAll = this.context.paymentTypes.Where(pt => pt.showForAll && pt.active &&
(pt.siteId == this.allSiteId || pt.siteId == this.siteId) && !pt.isDeleted);
return paymentTypes.Union(showForAll).
OrderBy(pt => pt.orderIndex).
ToList();
}
public List<paymentType_client> GetAcitvePaymentTypesOfCurrentUser_Client()
{
var paymentTypes = GetAcitvePaymentTypes(this.userId);
var res = mapperConfiguration.CreateMapper().Map<List<paymentType_client>>(paymentTypes);
return res;
}
public void SetPaymentTypesForUser(int uId, int[] paymentTypes)
{
var currentPaymentTypes = this.context.user_paymentType.Where(upt => upt.userId == uId &&
(upt.siteId == this.allSiteId || upt.siteId == this.siteId) && !upt.isDeleted).
ToList();
foreach (var cupt in currentPaymentTypes)
{
if (paymentTypes != null && paymentTypes.Contains(cupt.paymentTypeId))
continue;
this.DeleteEntity(cupt as baseClass);
}
if (paymentTypes == null)
return;
foreach (var pt in paymentTypes)
{
if (currentPaymentTypes.Select(cupt => cupt.paymentTypeId).Contains(pt))
continue;
user_paymentType upt = new user_paymentType { userId = uId, paymentTypeId = pt };
this.AddEntity(upt);
}
}
public paymentType GetPaymentType(int? id)
{
var paymentType = context.paymentTypes.SingleOrDefault(pt => pt.id == id &&
(pt.siteId == this.allSiteId || pt.siteId == this.siteId) && !pt.isDeleted);
return paymentType;
}
#endregion
#region Term
public pagedResult<hook> GetHooks(int pageNumber, string searchString = "")
{
if (pageNumber == 0)
pageNumber = 1;
IQueryable<hook> query;
if (!String.IsNullOrEmpty(searchString))
query = context.hooks.Where(h => h.title.Contains(searchString) &&
(h.siteId == this.allSiteId || h.siteId == this.siteId) && !h.isDeleted);
else
query = context.hooks.Where(h => (h.siteId == this.allSiteId || h.siteId == this.siteId) && !h.isDeleted);
pagedResult<hook> result = new pagedResult<hook>();
result.pagingData.currentPage = pageNumber;
result.pagingData.itemsPerPage = pageSize;
result.pagingData.totalItems = query.Count();
result.items = query.OrderBy(p => p.orderIndex).
Skip((pageNumber - 1) * pageSize).Take(pageSize).
ToList();
return result;
}
public List<sms> GetActiveSmses(string hookName)
{
var smses = this.context.smses.Where(s => s.hook.name == hookName &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted && s.active).
OrderBy(s => s.orderIndex).
ToList();
return smses;
}
public List<email> GetActiveEmails(string hookName)
{
var emails = this.context.emails.Where(e => e.hook.name == hookName &&
(e.siteId == this.allSiteId || e.siteId == this.siteId) && !e.isDeleted && e.active).
OrderBy(e => e.orderIndex).
ToList();
return emails;
}
public hook GetHook(int? id)
{
var hook = context.hooks.SingleOrDefault(h => h.id == id &&
(h.siteId == this.allSiteId || h.siteId == this.siteId) && !h.isDeleted);
return hook;
}
#endregion
#region Sms
public List<sms> GetSmsesOfHook(int? hookId)
{
var smses = context.smses.Where(s => s.hookId == hookId &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted).ToList();
return smses;
}
public sms GetSms(int? id)
{
var sms = context.smses.SingleOrDefault(s => s.id == id &&
(s.siteId == this.allSiteId || s.siteId == this.siteId) && !s.isDeleted);
return sms;
}
#endregion
#region Email
public List<email> GetEmailsOfHook(int? hookId)
{
var emails = context.emails.Where(e => e.hookId == hookId &&
(e.siteId == this.allSiteId || e.siteId == this.siteId) && !e.isDeleted).ToList();
return emails;
}
public email GetEmail(int? id)
{
var email = context.emails.SingleOrDefault(e => e.id == id &&
(e.siteId == this.allSiteId || e.siteId == this.siteId) && !e.isDeleted);
return email;
}
#endregion
}
}
<file_sep>/Entities/order/user_paymentType.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Entities
{
public class user_paymentType : baseClass
{
public int userId { get; set; }
public int paymentTypeId { get; set; }
public paymentType paymentType { get; set; }
}
}
<file_sep>/Entities/insurnce/category.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Entities
{
public class category:baseEntity
{
[Display(Name = "نام")]
public string name { get; set; }
[Display(Name = "دسته")]
public int termId { get; set; }
[Display(Name = "دسته")]
public term term { get; set; }
public List<attribute> attributes{ get; set; }
}
public class category_client : baseClient
{
[Display(Name = "نام")]
public string name { get; set; }
public List<attribute_client> attributes { get; set; }
}
}
| 1f0f77f656b64ec3e27b2603c7cd399c6e6a5096 | [
"C#",
"TypeScript"
] | 102 | C# | hamidrezarezaei/insurance | 85ae43616f8b6e246e41a3bf708af637e86dac2c | b3ee9ca8c31f9520c07b4fb8de5d7298d25657a6 |
refs/heads/master | <repo_name>software-handbook/howto<file_sep>/README.md
# howto
Question and answer
<file_sep>/deploy-sakai/scripts/tomcat
#!/bin/sh
#
# Startup script for Tomcat Servlet Engine
#
# chkconfig: 1235 99 1
# description: Tomcat Servlet Engine
# processname: tomcat
# pidfile: $TOMCAT_HOME/bin/tomcat.pid
#
# User under which tomcat will run
TOMCAT_USER=tomcat
TOMCAT_HOME=/opt/tomcat
RETVAL=0
# start, debug, stop, and status functions
start() {
# Start tomcat in normal mode
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
if [ $SHUTDOWN_PORT -ne 0 ]; then
echo "tomcat already started"
else
echo "Starting tomcat..."
chown -R $TOMCAT_USER:$TOMCAT_USER $TOMCAT_HOME
echo "Invoke script to start tomcat"
su -l $TOMCAT_USER -c $TOMCAT_HOME/bin/startup.sh
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
while [ $SHUTDOWN_PORT -eq 0 ]; do
sleep 1
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
done
RETVAL=$?
echo "tomcat started in normal mode"
[ $RETVAL=0 ] && touch /var/lock/subsys/tomcat
fi
}
debug() {
# Start tomcat in debug mode
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
if [ $SHUTDOWN_PORT -ne 0 ]; then
echo "tomcat already started"
else
echo "Starting tomcat in debug mode..."
chown -R $TOMCAT_USER:$TOMCAT_USER $TOMCAT_HOME
chown -R $TOMCAT_USER:$TOMCAT_USER /home/tomcat
su -l $TOMCAT_USER -c $TOMCAT_HOME/bin/catalina.sh jpda start
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
while [ $SHUTDOWN_PORT -eq 0 ]; do
sleep 1
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
done
RETVAL=$?
echo "tomcat started in debug mode"
[ $RETVAL=0 ] && touch /var/lock/subsys/tomcat
fi
}
stop() {
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
# SHUTDOWN_PORT=`ps aux | grep tomcat | grep tomcat | wc -l`
if [ $SHUTDOWN_PORT -eq 0 ]; then
echo "tomcat already stopped"
else
chown -R $TOMCAT_USER:$TOMCAT_USER $TOMCAT_HOME
echo "Stopping tomcat..."
su -l $TOMCAT_USER -c $TOMCAT_HOME/bin/shutdown.sh
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
while [ $SHUTDOWN_PORT -ne 0 ]; do
sleep 1
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
done
RETVAL=$?
echo "tomcat stopped"
[ $RETVAL=0 ] && rm -f /var/lock/subsys/tomcat $TOMCAT_HOME/bin/tomcat.pid
fi
}
status() {
SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
if [ $SHUTDOWN_PORT -eq 0 ]; then
echo "tomcat stopped"
else
MODE="normal"
JPDA_PORT=`netstat -vatn|grep LISTEN|grep 8080|wc -l`
if [ $JPDA_PORT -ne 0 ]; then
MODE="debug"
fi
echo "tomcat running in $MODE mode"
fi
}
case "$1" in
start)
start
;;
debug)
debug
;;
stop)
stop
;;
restart)
stop
start
;;
redebug)
stop
debug
;;
status)
status
;;
*)
echo "Usage: $0 {start|debug|stop|restart|redebug|status}"
exit 1
esac
exit $RETVAL | fdbbb765705b9ff25b214ccbe0a2cf4cf692e06b | [
"Markdown",
"Shell"
] | 2 | Markdown | software-handbook/howto | 96023b3e1178409a69c7e7e2d611f16cafb2a2bf | 773c6035f8acfb2a75a561852e5ed84e7d8678d9 |
refs/heads/master | <repo_name>sachinpasi/aid-v1<file_sep>/src/Components/PagesComponents/PartnerWithUs/WhoCanApply.js
import React from "react";
const WhoCanApply = ({ Hindi }) => {
return (
<section>
<div className="w-80vw" style={{ margin: "3rem auto" }}>
{Hindi ? (
<div className="w-full flex justify-center items-center flex-col">
<h1
style={{
fontFamily: "Uniform Bold",
color: "#373435",
}}
className="text-5xl tracking-wide capitalize"
>
कौन आवेदन कर सकता है
</h1>
<h5
style={{
color: "#373435",
fontSize: "25px",
}}
className=" capitalize py-4 text-center"
>
यदि आपके पास नीचे के किसी भी क्षेत्र में अनुभव है <br /> तो आप
आवेदन कर सकते हैं और हमारी टीम आपके पास वापस आएगी
</h5>
</div>
) : (
<div className="w-full flex justify-center items-center flex-col">
<h1
style={{
fontFamily: "Uniform Bold",
color: "#373435",
}}
className="text-5xl tracking-wide capitalize"
>
Who Can Apply
</h1>
<h5
style={{
color: "#373435",
}}
className=" text-3xl capitalize py-4 text-center"
>
If you have experience in any of the below field You Can apply{" "}
<br /> and our team will get back to you
</h5>
</div>
)}
{Hindi ? (
<div
style={{
width: "80%",
}}
className="mx-auto my-8 flex justify-evenly flex-wrap"
>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
{" "}
एसी सर्विस
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
फ्रिज सर्विस
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
वॉशिंग मशीन सर्विस
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
माइक्रोवेव ओवन सर्विस
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
एलईडी टीवी सर्विस
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
एलईडी टीवी इंस्टालेशन
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
गीजर सर्विस
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
आरओई सर्विस
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-xl px-4 font-medium my-2 "
>
आईटी मरम्मत सर्विस
</div>
</div>
) : (
<div
style={{
width: "80%",
}}
className="mx-auto my-8 flex justify-evenly flex-wrap"
>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2 "
>
AC Service
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
Refrigerator Repair
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
Washing Machine Repair
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
Microwave Oven Repair
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
Microwave Oven Repair
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
LED TV Repair
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
LED TV Installation
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
GEYSER Service
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
>
RO Service
</div>
<div
style={{
width: "28%",
borderColor: "#ffa9a9",
}}
className=" h-10 border-4 flex justify-start items-center text-2xl px-4 font-medium my-2"
my-2
>
IT Repair Service
</div>
</div>
)}
</div>
</section>
);
};
export default WhoCanApply;
<file_sep>/src/Pages/Packages.js
import React from "react";
import Banner from "../Components/PagesComponents/Packages/Banner";
import Form from "../Components/PagesComponents/Packages/Form";
import KeyFeatures from "../Components/PagesComponents/Packages/KeyFeatures";
import MaintenancePackages from "../Components/PagesComponents/Packages/MaintenancePackages";
import MainWrapper from "../Components/Wrapper/MainWrapper";
const Packages = () => {
return (
<MainWrapper>
<Banner />
<KeyFeatures />
<MaintenancePackages />
<Form />
</MainWrapper>
);
};
export default Packages;
<file_sep>/src/Components/PagesComponents/PartnerWithUs/JoinNow.js
import React from "react";
const JoinNow = ({ Hindi }) => {
return (
<section className="w-full h-full">
<div className="w-80vw mx-auto">
<div className="w-full h-60 rounded-xl bg-darkblue m-0 relative -mt-4">
<div className="relative w-64 h-20 mx-auto">
<div
style={{
width: "25px",
height: "16px",
backgroundColor: "#0f0f94",
borderRadius: "50% 50% 0 0",
position: "absolute",
zIndex: "0",
left: " -8px",
top: "-16px",
}}
/>
<div
style={{
background: "linear-gradient(#793893, #af3092)",
transform: "translate(-50%, -50%)",
borderRadius: " 0 0 30px 30px",
}}
className="w-64 h-20 absolute top-6 left-2/4 right-2/4 z-50 flex justify-center items-center "
>
{Hindi ? (
<h2 className="text-white" style={{ fontSize: "25px" }}>
जुड़िये हमरे साथ
</h2>
) : (
<h2 className="text-white text-5xl">JOIN NOW</h2>
)}
</div>
<div
style={{
width: "25px",
height: "16px",
backgroundColor: "#0f0f94",
borderRadius: "50% 50% 0 0",
position: "absolute",
zIndex: "0",
right: " -8px",
top: "-16px",
}}
/>
</div>
<div className="w-11/12 mx-auto my-4 flex justify-between items-center">
<div className="w-5/6 h-12 flex justify-between">
<input
style={{
background: "#A7C4D2",
color: "#3f3e40",
}}
className=" w-max h-full border-2 border-solid border-white rounded-lg px-4 text-2xl "
type="text"
placeholder={Hindi ? `नाम` : `Name`}
/>
<input
style={{
background: "#A7C4D2",
color: "#3f3e40",
}}
className="w-max h-full border-2 border-solid border-white rounded-lg px-4 text-2xl "
type="text"
placeholder={Hindi ? `फ़ोन नंबर ` : `Your Phone Number`}
/>
<input
style={{
background: "#A7C4D2",
color: "#3f3e40",
}}
className="w-max h-full border-2 border-solid border-white rounded-lg px-4 text-2xl "
type="text"
placeholder={Hindi ? `ईमेल` : `Email`}
/>
<input
style={{
background: "#A7C4D2",
color: "#3f3e40",
}}
className="w-max h-full border-2 border-solid border-white rounded-lg px-4 text-2xl "
type="text"
placeholder={Hindi ? `आप क्या करते हो ?` : `What Do You Do ?`}
/>
</div>
<div
style={{
width: "13%",
}}
className="h-12 mx-auto"
>
{Hindi ? (
<button
style={{
backgroundColor: "#ffcc29",
fontFamily: "Uniform Bold",
color: "#3f3e40",
}}
className="w-full h-full mx-auto border-2 rounded-lg "
>
प्रस्तुत
</button>
) : (
<button
style={{
backgroundColor: "#ffcc29",
fontFamily: "Uniform Bold",
color: "#3f3e40",
}}
className="w-full h-full mx-auto border-2 rounded-lg "
>
SUBMIT
</button>
)}
</div>
</div>
{Hindi ? (
<p className="text-center text-white text-xl py-8">
कृपया सभी विवरण प्रदान करें
</p>
) : (
<p className="text-center text-white text-xl py-8">
Please Provide All Details
</p>
)}
</div>
<div className="w-full my-12 flex justify-evenly items-center">
<div className="w-2/4 flex justify-evenly items-center">
<div className="w-2/5 h-full">
<img
className="w-full h-full object-contain"
src="assets/images/partner/money.png"
alt=""
/>
</div>{" "}
<div className="w-full">
{Hindi ? (
<h2
style={{
color: "#4a66aa",
fontFamily: "Uniform Bold",
}}
className="text-4xl uppercase text-left m-0 w-full ml-8"
>
सबसे अच्छा <br />
मंच बेहतर कमाई <br />
के लिए{" "}
</h2>
) : (
<h2
style={{
color: "#4a66aa",
fontFamily: "Uniform Bold",
}}
className="text-5xl uppercase text-left m-0 w-full"
>
BEST PLATEFORM FOR <br /> BETTER EARNING
</h2>
)}
</div>
</div>
<div className="w-2/4 flex justify-evenly items-center">
<div className="w-2/5 h-full">
<img src="assets/images/partner/men.png" alt="" />
</div>
<div>
{Hindi ? (
<h3
style={{
color: "#5a386f",
fontFamily: "Uniform Bold",
}}
className="text-4xl w-full uppercase"
>
अधिक सम्मान
</h3>
) : (
<h3
style={{
color: "#5a386f",
fontFamily: "Uniform Bold",
}}
className="text-5xl w-full uppercase"
>
More <br /> RESPECT
</h3>
)}
</div>
</div>
</div>
</div>
</section>
);
};
export default JoinNow;
<file_sep>/src/Components/PagesComponents/Technicians/Features.js
import React from "react";
const Features = () => {
return (
<section className="w-full h-full">
<div className="w-80vw mx-auto">
<div className="flex justify-between py-4">
<ul className="w-1/3 list-disc px-4">
<Item Data="All are background-checked." />
<Item Data="All work as per Covid appropriate behaviour." />
<Item Data="We'll email a picture of your technician before he arrives." />
<Item Data="Your technician will be in a clean uniform and have an ID badge" />
</ul>
<div className="w-2/3 px-4">
<Item Data="All technicians recevie 150+ hours of mandatory ongoing classroom tranning each year in our state-of-the-art training facility." />
<Item Data="Your technician will leave his work area cleaner then he found it and will always respect your property ,including wearning shoes covers inside your home" />
</div>
</div>
</div>
</section>
);
};
export default Features;
const Item = ({ Data }) => <li className="text-xl py-1">{Data}</li>;
<file_sep>/src/Components/PagesComponents/Amc/Form.js
import React from "react";
import { useForm } from "react-hook-form";
const Form = () => {
const {
register,
handleSubmit,
formState: { errors },
} = useForm();
const onSubmit = (data) => console.log(data);
return (
<section className="w-full h-full">
<div className="w-80vw h-full mx-auto my-8">
<div className="w-full flex flex-col justify-center items-start">
<h5 className="w-4/5 text-left tracking-wide text-3xl leading-9 py-2 font-medium">
Choose as per your requirement and get the benefit of Customized AMC
plans by talking to our dedicated AMC Team:
</h5>
<p className="py-4 text-xl">
Just fill the below AMC form and our dedicated AMC Team will get in
touch with you within 24 working hours :
</p>
<form
className="w-full lg:w-10/12 flex flex-col justify-between items-start my-1"
onSubmit={handleSubmit(onSubmit)}
>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="w-1/5 h-auto flex justify-start items-center">
<label>Your Name*</label>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="<NAME>"
{...register("firstName", { required: true })}
></input>
{errors.firstName && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="<NAME>"
{...register("lastName", { required: true })}
></input>
{errors.lastName && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
</div>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="w-1/5 h-auto flex justify-start items-center">
<label>Requirement *</label>
</div>
<div className="w-full h-auto flex justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<select
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
{...register("package", {})}
>
<option className="w-full h-10" value="">
Household AMC
</option>
<option value=""> Corporate AMC </option>
</select>
</div>
</div>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="lg:w-1/5 h-auto flex justify-start items-center">
<label>Your Address*</label>
</div>
<div className="w-full h-auto flex flex-wrap justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="House No"
{...register("HouseNo", { required: true })}
></input>
{errors.HouseNo && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="City"
{...register("City", { required: true })}
></input>
{errors.City && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="State"
{...register("State", { required: true })}
></input>
{errors.State && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="Pincode"
{...register("Pincode", { required: true })}
></input>
{errors.Pincode && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
</div>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="w-1/5 h-auto flex justify-start items-center">
<label>Contact*</label>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="+91"
{...register("PhoneMobile", { required: true })}
></input>
{errors.PhoneMobile && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<button
className="w-full h-full min-h-full px-4 border-2 border-solid text-white bg-darkblue border-darkblue "
type="submit"
>
SUBMIT
</button>
</div>
</div>
</div>
</form>
<div className="flex flex-col lg:flex-row justify-between lg:w-11/12 items-center my-8">
<p className="lg:w-3/5 tracking-wider text-lg py-4 lg:border-r-2 border-darkblue ">
Alternatively, you can give us a call to our dedicated specialists
for any Package related enquiry:{" "}
</p>
<h3 className="lg:w-2/5 tracking-wider text-3xl lg:text-4xl py-1">
<a className="text-black" href="tel:+9999-9999-99">
Call : 9999-9999-99
</a>
</h3>
</div>
</div>
</div>
</section>
);
};
export default Form;
<file_sep>/src/Components/PagesComponents/Homepage/SelectServices.js
import React from "react";
const SelectServices = () => {
return (
<section className="lg:h-20 bg-cover bg-no-repeat bg-darkblue">
<div className="w-4/5 py-7 lg:py-0 mx-auto h-full flex-col lg:flex-row flex justify-between items-center ">
<div className=" w-full lg:w-4/6 flex-col lg:flex-row lg flex justify-between items-center">
<div
style={{ border: "1px solid " }}
className=" w-full lg:w-3/4 h-10 flex justify-between items-center border-white rounded-md bg-white rounded-l-md "
>
<select
className="appearance-none w-full h-full rounded-md text-xl px-2 bannerformtextcolor"
name=""
id=""
>
<option value="" disabled="" hidden="">
Select Service
</option>
<option value="">Electration</option>
</select>
<div className="w-10 h-full flex justify-center items-center bg-gray-800 rounded-r-md">
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 512 512"
className="text-white text-2xl"
height="1em"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M128 192l128 128 128-128z"></path>
</svg>
</div>
</div>
<div
style={{ border: "1px solid " }}
className=" my-3 lg:my-0 lg:ml-5 w-full lg:w-1/4 h-10 flex justify-between items-center border-white rounded-md bg-white rounded-l-md "
>
<input
className="w-full h-full rounded-md text-xl px-2 bannerformtextcolor"
type="text"
placeholder="Location"
></input>
<div className="w-10 h-full flex justify-center items-center bg-gray-800 rounded-r-md">
<svg
stroke="currentColor"
fill="currentColor"
strokeWidth="0"
viewBox="0 0 512 512"
className="text-white text-2xl"
height="1em"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M128 192l128 128 128-128z"></path>
</svg>
</div>
</div>
</div>
<div className=" w-2/3 lg:w-2/6 flex justify-center lg:justify-end items-center ">
<button className="uppercase h-full rounded-md text-xl font-semibold py-2 px-8 bg-darkyellow ">
get quotes
</button>
</div>
</div>
</section>
);
};
export default SelectServices;
<file_sep>/src/Components/Footer/Footer.js
import React from "react";
import { FaHandshake, FaBlog, FaPhoneAlt } from "react-icons/fa";
import { FaFacebook, FaTwitter, FaInstagram, FaYoutube } from "react-icons/fa";
import { AiFillDownCircle, AiFillUpCircle } from "react-icons/ai";
import { Link } from "react-router-dom";
import FooterLink from "./FooterLink";
import SocialIcon from "../Navbar/SocialIcon";
import ServicesLink from "./ServicesLink";
import { useState } from "react";
const Footer = () => {
const [ShowAllServices, setShowAllServices] = useState(false);
const HandleToggle = () => setShowAllServices(!ShowAllServices);
return (
<footer
style={{
background: "url(/assets/images/footer/bg.jpg) rgb(8, 48, 79)",
backgroundBlendMode: "multiply",
backgroundPosition: "0% 0%",
backgroundSize: "cover",
}}
className="w-full "
>
<div className="w-11/12 h-auto lg:h-64 mx-auto flex-col lg:flex-row flex justify-between items-start relative text-white pb-2">
<div className="w-full lg:w-1/6 my-8 lg:mt-4 flex justify-center items-center">
<div className="flex w-3/4 lg:w-auto justify-center items-center flex-col h-full ">
<img
className="w-52 lg:w-11/12 h-28 object-contain py-2 px-4 bg-white border-4 border-yellow-400"
src="/assets/images/Logo.png"
alt=""
></img>
<div
style={{
background: "url(assets/images/footer/messagebox.png)",
}}
className="hidden absolute bottom-10 w-48 lg:flex justify-center items-center flex-col bg-contain h-16 bg-no-repeat"
>
<h2
style={{
marginTop: "-20px",
}}
className="text-lg text-center text-darkblue font-semibold py-1"
>
Home Maintenanece
</h2>
<h1
style={{
marginTop: "-10px",
}}
className="text-xl text-darkyellow text-center font-semibold"
>
Easy Hai..!!
</h1>
</div>
</div>
</div>
<div
style={{ height: "95%" }}
className="w-11/12 lg:w-36 flex flex-col justify-between items-start "
>
<h2 className="text-white w-full font-semibold text-xl lg:text-2xl uppercase py-4 text-left">
About Us
</h2>
<div className="flex justify-center items-center flex-col h-full">
<p className="text-lg text-white font-thin text-left py-1 leading-5 ">
We Are Aid 24x7 We Provide Quality Service On Demand and Customer
Satisfaction Is Our Moto !!!
</p>
</div>
</div>
<div className="w-full lg:w-auto h-full flex justify-between">
<div className="w-56 h-auto flex flex-col justify-between items-start ">
<h2 className="w-full text-left text-white text-xl lg:text-2xl font-semibold uppercase py-4">
information link
</h2>
<div className="flex flex-col justify-between h-full">
<div className="flex flex-col">
<FooterLink Name="ABOUT" URL="/about" />
<FooterLink Name="Contact us" URL="/contact" />
<FooterLink Name="Packages" URL="/packages" />
<FooterLink Name="Carrer" URL="/carrer" />
</div>
<div className="py-8 lg:py-0 flex justify-between">
<a
className="flex justify-center items-center py-2 px-3 w-36 lg:w-40 bg-darkyellow text-darkblue font-semibold text-base lg:text-xl whitespace-nowrap rounded-md"
href="/"
>
<FaHandshake className="text-darkblue text-2xl pr-1" />
Partner with Us
</a>
</div>
</div>
</div>
<div className="w-52 h-auto flex flex-col justify-between items-start ">
<h2 className="text-left text-white font-semibold text-xl lg:text-2xl uppercase py-4 ">
SERVICE LINK
</h2>
<div className="flex flex-col justify-between h-full">
<div className="flex flex-col">
<FooterLink Name="Feedback" URL="/" />
<FooterLink Name="Track Ticket" URL="/" />
<FooterLink Name="Privacy Policy" URL="/" />
<FooterLink Name="Terms of services" URL="/" />
</div>
<div className="py-8 lg:py-0 flex justify-between">
<a
className="flex justify-center items-center py-2 px-4 w-36 lg:w-40 bg-darkyellow text-darkblue font-semibold text-base lg:text-xl rounded-md"
href="/"
>
<FaBlog className="text-darkblue text-2xl pr-1" />
Blogs
</a>
</div>
</div>
</div>
</div>
<div className="flex flex-col justify-start h-full">
<h2 className="text-white w-full font-semibold text-xl lg:text-2xl uppercase py-4 text-left">
DOWNLOAD MOBILE APP
</h2>
<div className="flex justify-between h-auto">
<Link className="text-white text-xl py-0.5 px-1 uppercase" to="/">
<img
className="w-32"
src="assets/images/footer/appstore.png"
alt=""
></img>
</Link>{" "}
<Link className="text-white text-xl py-0.5 px-1 uppercase" to="/">
<img
className="w-32"
src="assets/images/footer/playstore.png"
alt=""
></img>
</Link>
</div>
<h2 className=" py-4 lg:py-2 text-white font-semibold text-xl lg:text-2xl uppercase">
Follow us
</h2>
<div className="w-4/5 flex justify-between items-center">
<SocialIcon To="/" Color="#4267B2" Icon={FaFacebook} />
<SocialIcon To="/" Color="#1DA1F2" Icon={FaTwitter} />
<SocialIcon To="/" Color="#e1306c" Icon={FaInstagram} />
<SocialIcon To="/" Color="#FF0000" Icon={FaYoutube} />
</div>
<div className="pt-6 pl-1">
<a
className="text-2xl uppercase text-white flex items-center "
href="tel:1800 150 150"
>
<FaPhoneAlt className="text-2xl border-2 border-green-500 rounded-full w-9 h-9 p-1 text-green-500 mr-4 -mt-1" />
1800 150 150
</a>
</div>
</div>
</div>
<span className="w-screen border-b-2 border-gray-300"></span>
<div className="hidden w-11/12 h-auto lg:h-48 mx-auto lg:flex flex-col lg:flex-row justify-between items-start relative text-white pb-2">
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="Ac Service" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Washing Machine Repair" To="/" />
<ServicesLink Name="Microwave owen repair" To="/" />
</div>
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="LED TV Repair" To="/" />
<ServicesLink Name="LED TV Installation" To="/" />
<ServicesLink Name="Geyser Service" To="/" />
<ServicesLink Name="RO Service" To="/" />
</div>
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="IT Repair Service" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Washing Machine Repair" To="/" />
</div>
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="Ac Service" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Washing Machine Repair" To="/" />
<ServicesLink Name="Microwave owen repair" To="/" />
</div>
</div>
<div className="visible lg:hidden w-11/12 h-auto lg:h-48 mx-auto flex flex-col lg:flex-row justify-between items-start relative text-white pb-2">
{ShowAllServices ? (
""
) : (
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="Ac Service" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Washing Machine Repair" To="/" />
<ServicesLink Name="Microwave owen repair" To="/" />
</div>
)}
<div className="w-full" onClick={HandleToggle}>
{ShowAllServices ? (
<h2 className=" flex items-center justify-center py-4 lg:py-2 w-full text-center text-white font-semibold text-xl lg:text-2xl uppercase">
SHOW LESS <AiFillUpCircle className="ml-4 -mt-1" />
</h2>
) : (
<h2 className=" flex items-center justify-center py-4 lg:py-2 w-full text-center text-white font-semibold text-xl lg:text-2xl uppercase">
SHOW ALL SERVICES
<AiFillDownCircle className="ml-4 -mt-1" />
</h2>
)}
{ShowAllServices && (
<>
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="Ac Service" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Washing Machine Repair" To="/" />
<ServicesLink Name="Microwave owen repair" To="/" />
</div>
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="LED TV Repair" To="/" />
<ServicesLink Name="LED TV Installation" To="/" />
<ServicesLink Name="Geyser Service" To="/" />
<ServicesLink Name="RO Service" To="/" />
</div>
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="IT Repair Service" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Washing Machine Repair" To="/" />
</div>
<div className="my-4 border-t-2 border-white w-full lg:w-1/4 flex flex-col items-start py-4 mb-0 lg:mb-4 lg:py-8 px-4">
<ServicesLink Name="Ac Service" To="/" />
<ServicesLink Name="Refrigerator Repair" To="/" />
<ServicesLink Name="Washing Machine Repair" To="/" />
<ServicesLink Name="Microwave owen repair" To="/" />
</div>
</>
)}
</div>
</div>
<hr className="h-0.3 bg-white" />
<div className="w-full flex justify-center items-center py-4 ">
<p
style={{
fontFamily: "Uniform Light",
}}
className="text-center text-white"
>
Copyright © 2021, All Rights Reserved AID 24x7
</p>
</div>
</footer>
);
};
export default Footer;
<file_sep>/src/Components/PagesComponents/Contact/Banner.js
import React from "react";
const Banner = () => {
return (
<section
style={{
background: "url(assets/images/contact/banner.jfif)",
height: "60vh",
}}
className="w-full bg-cover bg-no-repeat"
></section>
);
};
export default Banner;
<file_sep>/src/Components/PagesComponents/Services/Banner.js
import React, { useState } from "react";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import {
selectShowWidget,
REMOVE_SHOW_WIDGET,
} from "../../../Redux/_features/_showBookingWidgetSlice";
import BookingWidget from "../../Common/BookingWidget";
const Banner = ({ Data }) => {
console.log(Data);
const { showWidget } = useSelector(selectShowWidget);
console.log(showWidget);
const [isBookButtonPressed, setisBookButtonPressed] = useState(false);
const dispatch = useDispatch();
const HandleHideWidget = () => {
console.log("clickdd");
dispatch(REMOVE_SHOW_WIDGET());
setisBookButtonPressed(false);
};
useEffect(() => {
setisBookButtonPressed(showWidget);
}, [showWidget]);
return (
<section
style={{
background: `url(https://codeiator.com/aidassets/${Data?.banner})`,
backgroundRepeat: "no-repeat",
height: "540px",
}}
className=" w-full bg-contain relative overflow-x-hidden bg-no-repeat "
>
<div className="w-80vw h-full mx-auto flex justify-between items-center ">
{/* <img
style={{
width: "35%",
}}
className=""
src="/assets/images/services/banner/text.png"
alt=""
/> */}
<div className="w-full h-full mt-0 flex justify-end items-center relative">
<div className="w-full flex justify-end items-center h-auto relative">
<div
style={{
transition: "all 0.2s ease",
}}
className={`absolute ${
isBookButtonPressed
? "right-0 opacity-100"
: "-right-full opacity-0"
} `}
>
<div className="flex justify-end items-centerw-full -mr-8 ">
<p
className="text-3xl cursor-pointer bg-white w-9 flex justify-center items-center rounded-full "
onClick={HandleHideWidget}
>
x
</p>
</div>
<BookingWidget />
</div>
</div>
<div
className={`flex justify-end items-start absolute h-full pt-10 ${
isBookButtonPressed ? "hidden" : "visible"
}`}
>
<button
onClick={() => setisBookButtonPressed(true)}
className="bg-darkblue py-2 px-10 text-2xl rounded-xl text-white border-2 border-green-200"
>
Book Online
</button>
</div>
</div>
</div>
</section>
);
};
export default Banner;
<file_sep>/src/Components/PagesComponents/Amc/WhyAmc.js
import React from "react";
const WhyAmc = () => {
return (
<section className="w-full h-full">
<div className="w-80vw mx-auto">
<div className="w-full my-4 flex flex-col justify-center items-start">
<h2 className="text-3xl text-left text-darkblue py-1 tracking-wider">
WHY AMC IS MOST BENEFICIAL FOR YOU ?
</h2>
<p>
AMC not only ensures peace of mind but also allows you to focus on
your life goals:{" "}
</p>
</div>
<div className="flex w-full h-full flex-col justify-evenly items-center my-8">
<WhyItem
Image="assets/images/amc/04.png"
Title="Peace of Mind"
Data="The annual investment gives our client a tension-free experience"
/>
<WhyItem
Title="Customized Plans"
Image="assets/images/amc/05.png"
Data="Either choose the best plan or create a customized Protection for your appliances that can ensure a completely hassle-free experience."
/>
<WhyItem
Title="Genuine Parts"
Image="assets/images/amc/06.png"
Data="You are assured of genuine spare parts"
/>
<WhyItem
Title="Best Customer Service"
Image="assets/images/amc/07.png"
Data="You can simply give us a call or email us and get in touch with our office or technician"
/>
<WhyItem
Title="Risk Cover"
Image="assets/images/amc/08.png"
Data="This contract covers repair and replacement of expensive components, thus reducing risk. Preventive Checks: All the packages under this contract offer periodic maintenance checks which help in identifying problems early, preventing costly downtimes."
/>
</div>
<div className="flex justify-center items-start flex-col my-8 w-full">
<h2 className="text-4xl text-darkblue py-1 tracking-wide text-left">
AID24x7 DIFFERENCE
</h2>
<p className="text-lg py-4 text-left w-full leading-5">
We have engaged ourselves in providing the highest quality services
in maintaining and repairing appliances and other household services
to our clients. This is only possible with our skilled professionals
who utilize the latest technology for all appliances. The service
provided is currently high in demand for its time management
capability and reliability. We provide the best deal at the most
reasonable rate.{" "}
</p>
</div>
<div className="flex justify-center items-start flex-col my-8 w-full">
<h2 className="text-4xl text-darkblue py-1 tracking-wide text-left">
WE HAVE AMC BOTH FOR :
</h2>
<div className="flex flex-col lg:flex-row justify-between items-center w-full lg:w-11/12 my-4">
<div className="w-full flex flex-col lg:flex-row items-center my-4 lg:my-0 lg:h-52">
<div className="w-3/4 lg:w-2/5 h-full">
<img
className="w-full h-full object-cover"
src="assets/images/amc/09.png"
alt=""
></img>
</div>
<div className=" lg:pl-12 text-peatch flex flex-col justify-center items-center">
<h3 className="text-3xl font-normal text-center tracking-wider py-0 text-peatch">
HOUSEHOLDS
</h3>
<h2 className="text-4xl font-black text-center tracking-wider text-peatch">
AMC
</h2>
</div>
</div>
<div className="w-full flex flex-col lg:flex-row items-center my-4 lg:my-0 lg:h-52">
<div className="w-3/4 lg:w-2/5 h-full">
<img
className="w-full h-full object-cover"
src="assets/images/amc/10.png"
alt=""
></img>
</div>
<div className=" lg:pl-12 text-lightVoilet flex flex-col justify-center items-center">
<h3 className="text-3xl font-normal text-center tracking-wider py-0 text-lightVoilet">
CORPORATE
</h3>
<h2 className="text-4xl font-black text-center tracking-wider text-lightVoilet">
AMC
</h2>
</div>
</div>
</div>
</div>
</div>
</section>
);
};
export default WhyAmc;
const WhyItem = ({ Image, Title, Data }) => {
return (
<div className="w-full lg:h-24 flex flex-col lg:flex-row justify-start lg:items-center border-b-2">
<div className="w-28 h-full flex flex-col lg:flex-row justify-center items-center">
<img className="w-full h-16 object-contain" src={Image} alt=""></img>
</div>
<div className="lg:w-3/4 h-full text-center flex flex-col lg:flex-row items-center lg:ml-10">
<h3 className="text-2xl tracking-wider py-0 w-full lg:w-80 text-left font-semibold text-darkblue">
{Title}
</h3>
<p className="tracking-wider text-base leading-5 py-1 w-full lg:w-4/5 text-left">
{Data}
</p>
</div>
</div>
);
};
<file_sep>/src/Pages/Amc.js
import React from "react";
import MainWrapper from "../Components/Wrapper/MainWrapper";
import Banner from "../Components/PagesComponents/Amc/Banner";
import Form from "../Components/PagesComponents/Amc/Form";
import WhyAmc from "../Components/PagesComponents/Amc/WhyAmc";
const Amc = () => {
return (
<MainWrapper>
<Banner />
<Form />
<WhyAmc />
</MainWrapper>
);
};
export default Amc;
<file_sep>/src/Pages/Homepage.js
import React from "react";
import Banner from "../Components/PagesComponents/Homepage/Banner";
import MainWrapper from "../Components/Wrapper/MainWrapper";
import ServicesCarowsel from "../Components/PagesComponents/Homepage/ServicesCarosal/ServicesCarowsel";
import SelectServices from "../Components/PagesComponents/Homepage/SelectServices";
import OurServices from "../Components/PagesComponents/Homepage/OurServices/OurServices";
import WhyChooseUs from "../Components/PagesComponents/Homepage/WhyChooseUs/WhyChooseUs";
import Packages from "../Components/PagesComponents/Homepage/Packages/Packages";
import Discount from "../Components/PagesComponents/Homepage/Discount/Discount";
import DownloadApp from "../Components/PagesComponents/Homepage/DownloadApp/DownloadApp";
import Tesitimonials from "../Components/PagesComponents/Homepage/Testimonials/Tesitimonials";
const Homepage = () => {
return (
<MainWrapper>
<Banner />
<ServicesCarowsel />
<SelectServices />
<OurServices />
<WhyChooseUs />
<Packages />
<Discount />
<DownloadApp />
<Tesitimonials />
</MainWrapper>
);
};
export default Homepage;
<file_sep>/src/Components/PagesComponents/Services/Steps.js
import axios from "axios";
import React, { useState } from "react";
import { useEffect } from "react";
import { ImQuotesLeft, ImQuotesRight } from "react-icons/im";
import { useDispatch } from "react-redux";
import { Link } from "react-router-dom";
import { API } from "../../../API";
import { SHOW_WIDGET } from "../../../Redux/_features/_showBookingWidgetSlice";
const Steps = ({ Data }) => {
const [Services, setServices] = useState([]);
const dispatch = useDispatch();
const FetchAllServices = async () => {
const res = await axios.get(`${API}/parent-service/show`);
if (res.status === 200) {
setServices(res.data.data);
}
};
const HandleBookService = () => {
dispatch(
SHOW_WIDGET({
showWidget: true,
})
);
window.scrollTo(0, 0);
};
useEffect(() => {
FetchAllServices();
}, []);
return (
<section className="w-full h-full">
<div className="w-80vw mx-auto h-full ">
<p className="text-center text-5xl uppercase font-semibold my-4 ">
{Data?.title}
</p>
<div className="w-11/12 mx-auto my-8 ">
<ImQuotesLeft className="text-4xl w-9 " />
{console.log(Data)}
<p className="text-2xl text-justify w-11/12 mx-auto">
{Data?.description}
</p>
<ImQuotesRight className="text-4xl float-right" />
</div>
<div className="flex justify-between items-start py-8 w-full ">
<div className="flex justify-center items-start flex-col py-8 mx-auto w-full">
<p className="text-3xl font-semibold text-darkblue uppercase">
BOOK YOUR {Data?.title} IN 4 EASY STEPS :
</p>
<div className="flex justify-startitems-start flex-wrap w-full my-4">
<div className="flex justify-start items-center w-46percent my-4">
<div>
<div className="w-12 h-12 flex justify-center items-center bg-blue-400 rounded-md mr-4 ">
<p className="text-3xl font-semibold 8">1</p>
</div>
</div>
<div className="border-b-2 h-12 flex justify-center items-center">
<p className="uppercase font-medium text-2xl tracking-wide px-8 ">
Choose Type Of Service
</p>
</div>
</div>
<div className="flex justify-start items-center w-46percent my-4">
<div>
<div className="w-12 h-12 flex justify-center items-center bg-green-400 rounded-md mr-4 ">
<p className="text-3xl font-semibold 8">2</p>
</div>
</div>
<div className="border-b-2 h-12 flex justify-center items-center tracking-wide px-8">
<p className="uppercase font-medium text-2xl ">
Select the service you need
</p>
</div>
</div>
<div className="flex justify-start items-center w-46percent my-4">
<div>
<div className="w-12 h-12 flex justify-center items-center bg-yellow-400 rounded-md mr-4 ">
<p className="text-3xl font-semibold 8">3</p>
</div>
</div>
<div className="border-b-2 h-12 flex justify-center items-center tracking-wide px-8">
<p className="uppercase font-medium text-2xl ">
select your time slot
</p>
</div>
</div>
<div className="flex justify-start items-center w-46percent my-4">
<div>
<div className="w-12 h-12 flex justify-center items-center bg-red-400 rounded-md mr-4 ">
<p className="text-3xl font-semibold 8">4</p>
</div>
</div>
<div className="border-b-2 h-12 flex justify-center items-center tracking-wide px-8">
<p className="uppercase font-medium text-2xl ">
get confirmation in seconds
</p>
</div>
</div>
</div>
<div className="flex justify-start items-center w-full my-4">
<button
onClick={HandleBookService}
className="px-8 py-2 bg-darkblue rounded-lg text-white text-2xl uppercase"
>
Book Your {Data?.title}
</button>
</div>
<div className="flex justify-start items-center flex-wrap">
<Link
to={`/services/${Data?.id}/technicians`}
className=" my-4 flex flex-col justify-center items-center"
>
<img
className="w-2/4 object-contain"
src="/assets/images/services/bottom/1.png"
alt=""
/>
<p className="text-2xl w-52 my-4 text-center bg-darkblue text-white px-6 py-1 rounded-md border-2 border-gray-400">
TECHNICIANS
</p>
</Link>
<div className=" my-4 flex flex-col justify-center items-center">
<img
className="w-2/4 object-contain"
src="/assets/images/services/bottom/2.png"
alt=""
/>
<p className="text-2xl w-52 my-4 text-center bg-darkblue text-white px-6 py-1 rounded-md border-2 border-gray-400">
REVIEWS
</p>
</div>
<div className=" my-4 flex flex-col justify-center items-center">
<img
className="w-2/4 object-contain"
src="/assets/images/services/bottom/3.png"
alt=""
/>
<p className="text-2xl w-52 my-4 text-center bg-darkblue text-white px-6 py-1 rounded-md border-2 border-gray-400">
BLOGS
</p>
</div>
<div className=" my-4 flex flex-col justify-center items-center">
<img
className="w-2/4 object-contain"
src="/assets/images/services/bottom/4.png"
alt=""
/>
<p className="text-2xl my-4 w-52 text-center bg-darkblue text-white px-6 py-1 rounded-md border-2 border-gray-400">
DISCOUNT COUPONS
</p>
</div>
<div className=" my-4 flex flex-col justify-center items-center">
<img
className="w-2/4 object-contain"
src="/assets/images/services/bottom/5.png"
alt=""
/>
<p className="text-2xl my-4 w-52 text-center bg-darkblue text-white px-6 py-1 rounded-md border-2 border-gray-400">
PACKAGE DEAL
</p>
</div>
</div>
</div>
<div className="w-5/12">
<div className=" border-b-2 border-2 px-2 ">
<p className="text-2xl font-medium text-left border-b-2 py-2 uppercase">
Other {Data?.title}
</p>
{console.log(Data)}
<div className="flex justify-between items-center flex-col my-4 mb-0">
{Data?.child.map((item) => (
<div
key={item.id}
className="flex justify-between items-center w-full border-b-2 py-3"
>
<div className="w-20 h-16 ">
<img
className="w-full h-full object-cover"
src={`https://codeiator.com/aidassets/${item?.icon_path}`}
alt=""
/>
</div>
<div className="w-8/12">
<p className="text-xl">{item?.title}</p>
</div>
</div>
))}
</div>
</div>
<div className="border-2 my-4 px-2 ">
<p className="text-2xl font-medium text-center border-b-2 py-2 uppercase">
Other Appliances Services
</p>
<div className="w-full flex justify-start items-center flex-col">
{Services?.map((item, index) => (
<OtherAppliance
key={index}
Icon={`https://codeiator.com/aidassets/${item?.icon_path}`}
Name={item.title}
To={`/services/${item.id}`}
/>
))}{" "}
</div>
</div>
</div>
</div>
<div className="flex justify-between items-start py-8">
{/* <div className="w-full flex justify-start items-center flex-wrap my-8">
<div className="w-1/4 my-8">
<img
className="w-full h-full object-contain"
src="/assets/images/services/common/08.png"
alt=""
/>
</div>
<div className="w-1/4 mx-4 my-8">
<img
className="w-full h-full object-contain"
src="/assets/images/services/common/09.png"
alt=""
/>
</div>
<div className="w-1/4 mx-4 my-8">
<img
className="w-full h-full object-contain"
src="/assets/images/services/common/10.png"
alt=""
/>
</div>
<div className="w-1/4 mx-4 my-8">
<img
className="w-full h-full object-contain"
src="/assets/images/services/common/11.png"
alt=""
/>
</div>
<div className="w-1/4 mx-4 my-8">
<img
className="w-full h-full object-contain"
src="/assets/images/services/common/12.png"
alt=""
/>
</div>
</div> */}
</div>
</div>
</section>
);
};
export default Steps;
const OtherAppliance = ({ Name, Icon, To }) => (
<Link
to={To}
className="w-full flex justify-start items-center border-b-2 py-2 px-4"
>
<div
style={{
width: "10%",
}}
className=" h-16"
>
<img className="w-full h-full object-contain" src={Icon} alt="" />
</div>
<div className="ml-5 flex justify-center items-center">
<p className="text-xl font-medium text-gray-800">{Name}</p>
</div>
</Link>
);
<file_sep>/src/Components/PagesComponents/Packages/Banner.js
import React from "react";
const Banner = () => {
return (
<section className="w-full h-full">
<img className="w-full" src="assets/images/packages/banner.png" alt="" />
</section>
);
};
export default Banner;
<file_sep>/src/Components/PagesComponents/Packages/KeyFeatureItem.js
import React from "react";
const KeyFeatureItem = ({ Name }) => {
return (
<div
style={{
background: "url(assets/images/packages/bgcircle.png)",
}}
className=" w-32 h-32 lg:w-52 lg:h-52 bg-cover bg-center mx-4 my-4 bg-no-repeat flex justify-center items-center"
>
<h5 className="text-pink uppercase text-center font-semibold tracking-wider feature-text">
{Name}
</h5>
</div>
);
};
export default KeyFeatureItem;
<file_sep>/src/Components/Footer/FooterLink.js
import React from "react";
import { Link } from "react-router-dom";
const FooterLink = ({ Name, URL }) => {
return (
<Link
to={URL}
className="text-white font-light lg:font-normal text-xl py-0.5 px-0.2 uppercase"
>
{Name}
</Link>
);
};
export default FooterLink;
<file_sep>/src/Redux/_reducers/_index.js
import { combineReducers } from "redux";
import userReducer from "../_features/_userSlice";
import serviceBookingReducer from "../_features/_serviceBookingSlice";
import showWidgetReducer from "../_features/_showBookingWidgetSlice";
const reducers = combineReducers({
userReducer,
serviceBookingReducer,
showWidgetReducer,
});
export default reducers;
<file_sep>/src/Components/Footer/ServicesLink.js
import React from "react";
import { Link } from "react-router-dom";
import { MdFiberManualRecord } from "react-icons/md";
const ServicesLink = ({ Name, To }) => {
return (
<Link
to={To}
className="text-white text-lg py-1 uppercase flex justify-center items-center h-7"
>
<MdFiberManualRecord className="text-white text-xl py-0.5 px-0.5" />
{Name}
</Link>
);
};
export default ServicesLink;
<file_sep>/src/Components/PagesComponents/Contact/CardSection.js
import React from "react";
import { FaWhatsapp, FaPhoneAlt } from "react-icons/fa";
const CardSection = () => {
return (
<section className="w-full h-auto">
<div className="w-80vw h-full mx-auto">
<div className="w-3/4 h-auto my-8 -mt-1 mx-auto grid grid-cols-2 gap-4">
<Card
Name="CUSTOMER RELATED QUERY"
Image="assets/images/contact/1.svg"
/>
<Card Name="BUSINESS QUERY" Image="assets/images/contact/2.svg" />{" "}
<Card
Name="SUGGESTION GENERAL ENQUIRY"
Image="assets/images/contact/3.svg"
/>{" "}
<Card Name="TECH SUPPORT" Image="assets/images/contact/4.svg" />
</div>
</div>
</section>
);
};
export default CardSection;
const Card = ({ Name, Image }) => (
<div className=" h-auto bg-white py-4 my-2 shadow-lg flex flex-col items-center justify-between">
<img
className="w-24 h-24 object-cover my-2 bg-gray-200 p-0.5 rounded-full"
src={Image}
alt=""
></img>
<h2 className="text-3xl text-gray-700 text-center py-2">{Name}</h2>
<div className="w-5/6 my-2 mx-auto flex justify-center items-center">
<FaPhoneAlt className="text-4xl bg-green-400 text-white p-2 rounded-full cursor-pointer mx-2" />
<FaWhatsapp className="text-4xl bg-green-600 text-white p-2 rounded-full cursor-pointer mx-2" />
</div>
</div>
);
<file_sep>/src/Components/PagesComponents/Profile/Sidebar.js
import React from "react";
import { Link, useLocation } from "react-router-dom";
import { FaUserCircle, FaAddressCard } from "react-icons/fa";
import { FiPackage } from "react-icons/fi";
import { MdHistory, MdChatBubble } from "react-icons/md";
import { RiLogoutCircleRLine } from "react-icons/ri";
import { useDispatch } from "react-redux";
import { SIGNOUT } from "../../../Redux/_features/_userSlice";
const Sidebar = () => {
const location = useLocation();
const dispatch = useDispatch();
const HandleSignOut = () => {
dispatch(SIGNOUT());
};
return (
<div
style={{ background: "#052138" }}
className="w-1/6 flex flex-col justify-between px-4 py-24"
>
<div className="flex flex-col justify-center items-start">
<SidebarItem
To="profile/bookings"
Active={location.pathname === "/profile/bookings" ? "true" : ""}
Name="My Bookings"
Icon={FiPackage}
/>
<SidebarItem
Name="Profile Information"
Active={location.pathname === "/profile" ? "true" : ""}
To="profile"
Icon={FaUserCircle}
/>
<SidebarItem Name="Account Setting" Icon={FiPackage} />
<SidebarItem Name="Manage Address" Icon={FaAddressCard} />
<SidebarItem Name="Payment History" Icon={MdHistory} />
<SidebarItem Name="My Chats" Icon={MdChatBubble} />
<div
onClick={HandleSignOut}
className="flex justify-start items-center px-4 py-2 cursor-pointer mt-40 "
>
<RiLogoutCircleRLine className="text-2xl flex justify-center items-center text-white mr-3 my-8" />
<p className="text-xl text-white tracking-wide leading-5 ">Log Out</p>
</div>
</div>
</div>
);
};
export default Sidebar;
const SidebarItem = ({ Active, To, Name, Icon }) => (
<Link
to={`/${To}`}
className={`my-1 flex justify-start items-center px-4 py-2 ${
Active ? "bg-darkYellow font-medium rounded-md" : ""
} `}
>
{Icon && (
<Icon className="text-2xl flex justify-center items-center text-white mr-3 " />
)}
<p className="text-xl text-white tracking-wide leading-5 ">{Name}</p>
</Link>
);
<file_sep>/src/Components/PagesComponents/Homepage/ServicesCarosal/Item.js
import React from "react";
import { Link } from "react-router-dom";
const Item = ({ ImageURL, Name, To }) => {
return (
<Link
to={To}
className="w-36 mt-3 mb-2 mx-auto flex justify-center items-center flex-col cursor-pointer"
>
<img className="w-16" src={ImageURL} alt="" />
<p className="text-lg text-darkblue text-center capitalize leading-5">
{Name}
</p>
</Link>
);
};
export default Item;
<file_sep>/src/Components/PagesComponents/Homepage/WhyChooseUs/HowItWorksItem.js
import React from "react";
const HowItWorksItem = ({ No, Width, Title, Data }) => {
return (
<div
style={{ width: Width }}
className="w-full my-4 lg:my-0 h-full flex justify-evenly items-start"
>
<div
style={{
borderBottom: "4rem solid rgb(254,178,47)",
borderRight: "25px solid transparent",
height: " 0px",
width: " 4.5rem",
marginRight: " 15px",
position: " relative",
}}
>
<div
style={{
marginRight: "1rem",
borderBottom: " 4rem solid #052138",
borderRight: "25px solid transparent",
width: "4rem",
height: "4rem",
position: "absolute",
}}
>
<h1 className="flex justify-center items-center w-12 h-16 text-white absolute text-5xl">
{No}
</h1>
</div>
</div>
<div
style={{
width: "70%",
}}
className=""
>
<h2 className="text-2xl font-semibold pb-1">{Title}</h2>
<h5 className="text-xl text-gray-600">{Data}</h5>
</div>
</div>
);
};
export default HowItWorksItem;
<file_sep>/tailwind.config.js
module.exports = {
important: true,
purge: ["./src/**/*.{js,jsx,ts,tsx}", "./public/index.html"],
darkMode: false, // or 'media' or 'class'
theme: {
screen: {
lg: "1100px",
},
color: {
darkblue: "#052138",
},
extend: {
width: {
"12/25": "48%",
"80vw": "80vw",
"8/25": "32%",
"46percent": "46%",
},
height: {
"448px": "448px",
},
colors: {
darkblue: "#052138",
peatch: "rgb(250, 110, 97)",
lightVoilet: "rgb(142, 119, 236)",
sidenavactive: "#2B4F60",
darkYellow: "rgb(251, 178, 47)",
},
borderRadius: {
"4xl": "2rem",
},
},
},
variants: {
extend: {},
},
plugins: [],
};
<file_sep>/src/Pages/Services/ServicesDetails.js
import React, { useEffect, useState } from "react";
import MainWrapper from "../../Components/Wrapper/MainWrapper";
import Banner from "../../Components/PagesComponents/Services/Banner";
import Steps from "../../Components/PagesComponents/Services/Steps";
import { useParams } from "react-router-dom";
import axios from "axios";
import { API } from "../../API";
import { useDispatch } from "react-redux";
import { REMOVE_SHOW_WIDGET } from "../../Redux/_features/_showBookingWidgetSlice";
const ServicesDetails = () => {
const [Data, setData] = useState();
const { id } = useParams();
const dispatch = useDispatch();
const HandleServices = async () => {
if (id !== undefined) {
const res = await axios.get(`${API}/parent-service/get/${id}`);
if (res.status === 200) {
setData(res.data.data);
}
}
};
useEffect(() => {
HandleServices();
window.scrollTo(0, 0);
dispatch(REMOVE_SHOW_WIDGET());
}, [id]);
return (
<MainWrapper>
<Banner Data={Data} />
<Steps Data={Data} />
</MainWrapper>
);
};
export default ServicesDetails;
<file_sep>/src/Pages/Contact.js
import React from "react";
import Banner from "../Components/PagesComponents/Contact/Banner";
import CardSection from "../Components/PagesComponents/Contact/CardSection";
import MainWrapper from "../Components/Wrapper/MainWrapper";
import Form from "../Components/PagesComponents/Contact/Form";
const Contact = () => {
return (
<MainWrapper>
<Banner />
<CardSection />
<Form />
</MainWrapper>
);
};
export default Contact;
<file_sep>/src/Components/PagesComponents/Amc/Banner.js
import React from "react";
const Banner = () => {
return (
<section
style={{
background: "url(assets/images/amc/banner.jpg)",
height: "90vh",
}}
className="w-full bg-cover bg-center"
></section>
);
};
export default Banner;
<file_sep>/src/Components/PagesComponents/Homepage/Packages/Packages.js
import React from "react";
const Packages = () => {
return (
<section className="w-full h-auto">
<div className="w-full flex-col lg:w-11/12 h-full mx-auto flex justify-center items-center py-20">
<div className=" flex-col flex justify-center items-center">
<h1 className=" text-center text-5xl w-5/6 lg:w-full pr-1 uppercase text-darkblue font-black ">
Maintenance Packages
</h1>
<h3 className="text-center w-5/6 text-2xl lg:text-3xl text-gray-700 font-medium py-4">
Choose One of our Maintenance Package, forget about call out fees
and let us take care of all your household needs.
</h3>
</div>
<div className="w-11/12 h-full grid grid-cols-1 lg:grid-cols-3 gap-10 mb-8">
<Card
Name="GREEN"
Visit="999/20 VISITS"
Points={[
"Service delivery within 120 minutes",
"Service call attendance on priorty",
"Cover all Service & Repair Charges",
]}
/>
<Card
Name="GREEN+"
Visit="2999/20 VISITS"
Points={[
"Service delivery within 120 minutes",
"Service call attendance on priorty",
"Cover all Service & Repair Charges",
]}
ServiceCovered="AC,LED TV,Washing Machine,It,Electrical,Plumber,Gyser"
/>
<Card
Name="GREEN++"
Visit="3999/12 VISITS"
Points={[
"Service delivery within 120 minutes",
"Service call attendance on priorty",
"Cover all Service & Repair Charges",
]}
ServiceCovered="AC,LED TV,Washing Machine,It,Electrical,Plumber,Gyser"
/>
</div>
</div>
</section>
);
};
export default Packages;
//
const Card = ({ Name, Visit, ServiceCovered, Points }) => (
<div className=" w-full h-auto ">
<div className="flex justify-end">
<div
style={{
background: "#47c289",
}}
className="w-2/5 h-7 lg:h-9 rounded-t-4xl rounded-l-4xl "
></div>
</div>
<div
style={{
height: "360px",
}}
className="w-full flex "
>
<div className="w-6 h-full flex flex-col justify-end">
<div
style={{
background: "#47c289",
}}
className="w-6 h-24 rounded-t-4xl "
></div>
</div>
<div
style={{
background: "#e1ffe3",
borderRadius: " 32px 0 32px 0",
}}
className="w-full h-full flex flex-col justify-center items-center text-darkblue "
>
<p className="text-3xl lg:text-5xl font-semibold">{Name}</p>
<p className="text-2xl font-semibold">₹ {Visit}</p>
<p
style={{
fontFamily: "Uniform Bold",
}}
className=" text-5xl lg:text-7xl font-black"
>
CALL NOW !
</p>
<p className=" text-base lg:text-xl w-11/12 text-center font-medium leading-5 ">
{ServiceCovered ? (
<>
{" "}
Service Covered : <br></br>{" "}
<span
style={{ fontSize: "18px", lineHeight: "10px" }}
className=" text-center font-thin w-full "
>
{ServiceCovered}
</span>
</>
) : (
"Get Flat 20% Discount on all services upto Rs. 1000 / Order"
)}{" "}
</p>
<ul
style={{ listStyleType: "circle" }}
className="bg-darkblue py-1 px-7 my-2 rounded-xl "
>
{Points?.map((item) => (
<li className="text-white leading-5">{item}</li>
))}
</ul>
<div className="flex my-1 justify-between items-center w-10/12 lg:w-3/5">
<button className="bg-white text-darkblue font-semibold text-lg tracking-wide px-5 rounded-lg border-4 border-darkblue w-24">
DETAILS
</button>
<button className="bg-white text-darkblue font-semibold text-lg tracking-wide px-5 rounded-lg border-4 border-darkblue w-24">
BUY
</button>
</div>
</div>
<div>
<div
style={{
background: "#47c289",
}}
className=" w-7 lg:w-9 h-28 rounded-b-4xl "
></div>
</div>
</div>
<div className="flex justify-start">
<div
style={{
background: "#47c289",
}}
className="w-2/6 h-6 rounded-b-4xl rounded-r-4xl "
></div>
</div>
</div>
);
<file_sep>/src/Routes/Routes.js
import React from "react";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import PrivateRoute from "./PrivateRoute";
import Homepage from "../Pages/Homepage";
import Packages from "../Pages/Packages";
import Amc from "../Pages/Amc";
import Contact from "../Pages/Contact";
import Login from "../Pages/Login";
import ServicesDetails from "../Pages/Services/ServicesDetails";
import Profile from "../Pages/Profile/Profile";
import Bookings from "../Pages/Profile/Bookings";
import BookingDetails from "../Pages/Profile/BookingDetails";
import PartnerWithUs from "../Pages/PartnerWithUs";
import Technician from "../Pages/Services/Technician";
const Routes = () => {
return (
<Router>
<Switch>
<Route path="/" exact component={Homepage} />
<Route path="/login" exact component={Login} />
<Route path="/services/:id" exact component={ServicesDetails} />
<Route path="/services/:id/technicians" exact component={Technician} />
<Route path="/packages" exact component={Packages} />
<Route path="/partner-with-us" exact component={PartnerWithUs} />
<Route path="/contact" exact component={Contact} />
<Route path="/amc" exact component={Amc} />
<PrivateRoute path="/profile" exact component={Profile} />
<PrivateRoute path="/profile/bookings" exact component={Bookings} />
<PrivateRoute
path="/profile/booking/:id"
exact
component={BookingDetails}
/>
</Switch>
</Router>
);
};
export default Routes;
<file_sep>/src/Components/PagesComponents/Profile/Main.js
import React, { useState } from "react";
import Sidebar from "./Sidebar";
import { MdEdit } from "react-icons/md";
import { useSelector } from "react-redux";
import { selectUser } from "../../../Redux/_features/_userSlice";
import axios from "axios";
import { API } from "../../../API";
import { useEffect } from "react";
import { toast } from "react-toastify";
const Main = () => {
const user = useSelector(selectUser);
const [UserData, setUserData] = useState();
const [UpdatingData, setUpdatingData] = useState({});
const [Name, setName] = useState();
const [Email, setEmail] = useState();
const [Mobile, setMobile] = useState();
const [Otp, setOtp] = useState();
const [IsOtpSent, setIsOtpSent] = useState(false);
const FetchUserData = async () => {
const res = await axios.get(`${API}/profile/show`, {
headers: { Authorization: `Bearer ${user.token}` },
});
console.log(res.data);
if (res.status === 200) {
setUserData(res.data.data);
}
};
const HandleUpdatingData = () => {
if (UserData?.name !== Name) {
setUpdatingData({
name: Name,
});
}
if (UserData?.email !== Email) {
setUpdatingData({
email: Email,
});
}
if (UserData?.mobile !== Mobile && Mobile.length === 10) {
setUpdatingData({
mobile: Mobile,
});
}
if (UserData?.name !== Name && UserData?.email !== Email) {
setUpdatingData({
name: Name,
email: Email,
});
}
if (
UserData?.name !== Name &&
UserData?.email !== Email &&
UserData?.mobile &&
Mobile.length === 10
) {
setUpdatingData({
name: Name,
email: Email,
mobile: Mobile,
});
}
};
console.log(UpdatingData);
const UpdateUserData = async () => {
const res = await axios.post(`${API}/profile/edit`, UpdatingData, {
headers: { Authorization: `Bearer ${user.token}` },
});
console.log(res.data.data);
if (res.status === 200) {
if (!res.data.data.otp) {
toast.success("Profile Updated Sucessfully");
}
}
if (res.data.data.otp) {
setIsOtpSent(true);
}
};
const VerfiyOtp = async () => {
const res = await axios.post(
`${API}/profile/update-verify`,
{
mobile: Mobile,
otp: Otp,
},
{
headers: { Authorization: `Bearer ${user.token}` },
}
);
console.log(res.data);
if (res.status === 200) {
toast.success("Mobile Number Changed Sucessfully");
window.location.reload();
}
};
useEffect(() => {
FetchUserData();
}, []);
useEffect(() => {
if (UserData?.name === null) {
setName("Not Updated");
} else {
setName(UserData?.name);
}
if (UserData?.email === null) {
setEmail("Not Updated");
} else {
setEmail(UserData?.email);
}
setMobile(UserData?.mobile);
}, [UserData]);
useEffect(() => {
HandleUpdatingData();
}, [Name, Email, Mobile]);
return (
<main className="w-full h-screen flex">
<Sidebar />
<div className="w-4/5 ml-6 relative">
<div className="my-8">
<p className="text-3xl font-semibold">Edit Profile</p>
<div className="w-2/4 flex flex-col justify-center items-start">
<div className="flex flex-col justify-center items-center w-full">
<div className="w-48 h-48 rounded-full bg-gray-400 flex justify-end items-end">
<div className="w-8 h-8 rounded-full bg-darkblue flex justify-center items-center mb-4 mr-4 cursor-pointer">
<MdEdit
className="text-white text-xl
"
/>
</div>
</div>
<p className="text-lg my-2">Profile Picture</p>
</div>
<div className="flex flex-col justify-center items-center w-full my-4">
<div className="flex w-full justify-between my-2 ">
<div className=" flex w-full flex-col ">
<p className="text-lg"> Name</p>
<input
type="text"
className="w-full h-11 border-2 border-solid border-gray-300 my-2 px-4"
value={Name}
onChange={(e) => setName(e.target.value)}
/>
</div>
{/* <div className=" flex w-12/25 flex-col ">
<p className="text-lg">Last Name</p>
<input
type="text"
className="w-full h-11 border-2 border-solid border-gray-300 my-2 px-4"
/>
</div> */}
</div>
<div className="flex w-full justify-between my-2 ">
<div className=" flex w-full flex-col ">
<p className="text-lg">Email</p>
<input
type="email"
className="w-full h-11 border-2 border-solid border-gray-300 my-2 px-4"
value={Email}
onChange={(e) => setEmail(e.target.value)}
/>
</div>
</div>
<div className="flex w-full justify-between my-2 ">
<div className=" flex w-full flex-col ">
<p className="text-lg">Contact Number</p>
<input
type="tel"
className="w-full h-11 border-2 border-solid border-gray-300 my-2 px-4"
value={Mobile}
onChange={(e) => setMobile(e.target.value)}
/>
</div>
{IsOtpSent && (
<div className=" flex w-full flex-col ml-4 ">
<p className="text-lg">Otp</p>
<input
type="text"
className="w-full h-11 border-2 border-solid border-gray-300 my-2 px-4"
value={Otp}
onChange={(e) => setOtp(e.target.value)}
/>
</div>
)}
</div>
<div className="flex justify-end items-center w-full my-4">
{IsOtpSent ? (
<button
onClick={VerfiyOtp}
className="py-2 px-8 bg-darkblue text-white text-xl"
>
Verify Otp
</button>
) : (
<button
onClick={UpdateUserData}
className="py-2 px-8 bg-darkblue text-white text-xl"
>
Save Changes
</button>
)}
</div>
</div>
</div>
</div>
</div>
</main>
);
};
export default Main;
<file_sep>/src/Components/PagesComponents/Homepage/WhyChooseUs/WhyChooseUsItem.js
import React from "react";
const WhyChooseUsItem = ({ Data, Image }) => {
return (
<div className=" w-11/12 lg:w-72 flex justify-between items-center h-36 border-b-2 border-gray-300 mx-2">
<div
style={{ width: "44%", height: "88%" }}
className="flex justify-center items-center"
>
<img
className=" w-11/12 h-3/4 mx-auto lg:w-full lg:h-full object-contain"
src={Image}
alt=""
></img>
</div>
<div style={{ width: "55%", textAlign: "justify" }}>
<p className="-mt-1 text-sm font-normal leading-4 text-gray-500 ml-2">
{Data}
</p>
</div>
</div>
);
};
export default WhyChooseUsItem;
<file_sep>/src/Components/PagesComponents/Packages/PackagesCard.js
import React from "react";
import { FaRegHandPointRight } from "react-icons/fa";
const PackagesCard = ({
Color,
Title,
Visit,
Li1,
Li2,
Li3,
ServiceCoverd,
Tagline,
}) => {
return (
<div
style={{
background: "#bd6390",
}}
className=" PackageCardHeightandWidth rounded-2xl my-4"
>
<img
style={{
paddingLeft: "19%",
transform: "rotate(280deg)",
}}
className="w-16 absolute z-20 top-24"
src=""
alt=""
/>
<div
style={{
backgroundColor: "#fcddec",
height: "98%",
}}
className=" w-full rounded-2xl overflow-hidden relative "
>
<div
style={{
width: "4%",
borderLeft: "450px solid transparent",
borderRight: "450px solid transparent",
borderTop: `210px solid ${Color}`,
left: "-83.5%",
}}
className=" absolute"
></div>
<div className="absolute w-full pt-2 ">
<h1 className="text-white text-center text-6xl tracking-wider font-bolder">
{Title}
</h1>
<h5 className="text-center text-4xl text-white font-medium">
₹{Visit}
</h5>
</div>
<div
style={{
transform: "translate(-50%, -50%)",
borderColor: "#bd6390",
}}
className="w-32 h-32 bg-white absolute top-44 left-2/4 right-2/4 rounded-full border-2 "
>
<div className="flex flex-col items-center justify-center h-full">
<img src="" className="w-12" alt="" />
<h5
style={{ color: "#bd6390", lineHeight: "45px" }}
className="uppercase text-5xl text-center "
>
CALL NOW !
</h5>
</div>
</div>
<div className="absolute w-full h-full">
<div className="w-full h-full flex flex-col justify-end items-center">
<h4
style={{
color: "#4d4d4d",
maxWidth: "290px",
}}
className="text-2xl text-center p-4 px-2 pb-3 leading-7 "
>
{ServiceCoverd ? (
<>
{" "}
Service Covered : <br></br>{" "}
<span
style={{ fontSize: "18px", lineHeight: "10px" }}
className=" text-center w-auto font-thin "
>
{ServiceCoverd}
</span>
</>
) : (
"Get Flat 20% Discount on all services upto Rs. 1000 / Order"
)}{" "}
</h4>
<ul className="flex flex-col justify-center items-center">
<li
style={{
color: "#606062",
}}
className="text-lg flex items-center font-light "
>
<FaRegHandPointRight
style={{ color: "bd6390" }}
className="mr-2"
/>
{Li1}
</li>{" "}
<li
style={{
color: " #606062",
}}
className="text-lg flex items-center font-light "
>
<FaRegHandPointRight
style={{ color: "bd6390" }}
className="mr-2"
/>
{Li2}
</li>{" "}
<li
style={{
color: " #606062",
}}
className="text-lg flex items-center font-light "
>
<FaRegHandPointRight
style={{ color: "bd6390" }}
className="mr-2"
/>
{Li3}
</li>
</ul>
<div
style={{ color: "#bd6390" }}
className="py-4 w-full flex justify-evenly "
>
<button className="flex justify-center items-center bg-white p-0.5 w-28 lg:w-32 h-9 text-2xl font-bold rounded-xl">
DETAILS
</button>
<button
style={{ background: "#bd6390" }}
className="flex justify-center items-center text-white p-0.5 w-28 lg:w-32 h-9 text-2xl font-bold rounded-xl"
>
BUY
</button>
</div>
</div>
</div>
</div>
</div>
);
};
export default PackagesCard;
<file_sep>/src/Redux/_features/_showBookingWidgetSlice.js
import { createSlice } from "@reduxjs/toolkit";
const showBookingWidgetSlice = createSlice({
name: "showBookingWidget",
initialState: {
showBookingWidget: {
showWidget: false,
},
},
reducers: {
SHOW_WIDGET: (state, action) => {
state.showBookingWidget = action.payload;
console.log(state.showBookingWidget);
},
REMOVE_SHOW_WIDGET: (state) => {
state.showBookingWidget = {
showWidget: false,
};
},
},
});
export const { SHOW_WIDGET, REMOVE_SHOW_WIDGET } =
showBookingWidgetSlice.actions;
export const selectShowWidget = (state) =>
state.showWidgetReducer.showBookingWidget;
export default showBookingWidgetSlice.reducer;
<file_sep>/src/Pages/Services/Technician.js
import React from "react";
import Banner from "../../Components/PagesComponents/Technicians/Banner";
import TechnicianProfile from "../../Components/PagesComponents/Technicians/TechnicianProfile";
import MainWrapper from "../../Components/Wrapper/MainWrapper";
import Features from "../../Components/PagesComponents/Technicians/Features";
const Technician = () => {
return (
<MainWrapper>
<Banner />
<Features />
<TechnicianProfile />
</MainWrapper>
);
};
export default Technician;
<file_sep>/src/Components/PagesComponents/Homepage/ServicesCarosal/ServicesCarowsel.js
import React, { useEffect, useState } from "react";
import axios from "axios";
import OwlCarousel from "react-owl-carousel";
import "owl.carousel/dist/assets/owl.carousel.css";
import "owl.carousel/dist/assets/owl.theme.default.css";
import "./ServicesCarowsel.css";
import Item from "./Item";
import { API } from "../../../../API";
const ServicesCarowsel = () => {
const [Services, setServices] = useState([]);
const FetchAllServices = async () => {
const res = await axios.get(`${API}/parent-service/show`);
if (res.status === 200) {
setServices(res.data.data);
}
};
useEffect(() => {
FetchAllServices();
}, []);
return (
<section className=" lg:h-28 bg-cover bg-no-repeat">
<div className="hidden lg:flex w-11/12 lg:h-full mx-auto justify-center items-center lg:justify-between ">
{Services.length !== 0 && (
<OwlCarousel items={8} loop nav={true}>
{Services?.map((item, index) => (
<Item
key={index}
To={`/services/${item?.id}`}
ImageURL={`https://codeiator.com/aidassets/${item?.icon}`}
Name={item?.title}
/>
))}
</OwlCarousel>
)}
</div>
<div className="lg:hidden w-11/12 lg:h-full mx-auto flex justify-center items-center lg:justify-between ">
{Services.length !== 0 && (
<OwlCarousel items={2} loop nav={true}>
{Services?.map((item, index) => (
<Item
key={index}
To={`/services/${item?.id}`}
ImageURL={`https://codeiator.com/aidassets/${item?.icon}`}
Name={item?.title}
/>
))}
</OwlCarousel>
)}
</div>
</section>
);
};
export default ServicesCarowsel;
<file_sep>/src/Components/PagesComponents/Packages/MaintenancePackages.js
import React from "react";
import PackagesCard from "./PackagesCard";
const MaintenancePackages = () => {
return (
<section className="w-full h-full">
<div className="w-11/12 h-full mx-auto flex flex-col justify-center items-center py-12">
<h1>Maintenance Packages</h1>
<h3>
Choose the service package that suits you the best as AID24x7 not only
provides you flexibility but also ensures your convenience.
</h3>
<div
style={{
height: "570px",
}}
className="flex flex-col lg:flex-row justify-between items-center h-auto w-11/12 lg:w-5/6 lg:py-8"
>
<PackagesCard
Color="#dc94b8"
Title="GREEN"
Visit="999 / 20 VISITS"
Li1="Service delivery within 120 minutes"
Li2="Service call attendance on priorty"
Li3="Cover all Service & Repair Charges"
/>
<PackagesCard
Color="#cf7ca6"
Title="GREEN+"
Visit="2999 / 12 VISITS"
ServiceCoverd="AC,LED TV,Washing Machine,It,Electrical,Plumber,Carpenter,Gyser "
Li1="Service delivery within 120 minutes"
Li2="Service call attendance on priorty"
Li3="Cover all Service & Repair Charges"
/>
<PackagesCard
Color="#bd6390"
Title="GREEN++"
Visit="3999 / 15 VISITS"
ServiceCoverd="AC,LED TV,Washing Machine,It,Electrical,Plumber,Carpenter,Gyser "
Li1="Service delivery within 120 minutes"
Li2="Service call attendance on priorty"
Li3="Cover all Service & Repair Charges"
/>
</div>
</div>
</section>
);
};
export default MaintenancePackages;
<file_sep>/src/Components/PagesComponents/Technicians/Banner.js
import React from "react";
const Banner = () => {
return (
<section className="w-full ">
<img src="/assets/images/technicians/bg.png" alt="" />
<img
className="object-contain w-3/4 mx-auto -mt-7 mb-4"
src="/assets/images/technicians/tag.png"
alt=""
/>
</section>
);
};
export default Banner;
<file_sep>/src/Components/Navbar/Navitem.js
import React from "react";
import { Link } from "react-router-dom";
const Navitem = ({
Name,
To,
Icon,
Color,
MobHidden,
DesktopHidden,
Active,
}) => {
return (
<li
className={`my-1.5 ${MobHidden ? `hidden lg:block` : ``} ${
DesktopHidden ? `lg:hidden` : ``
}`}
>
<Link
to={To}
style={Color ? { color: Color } : { color: "white" }}
className={`${
Active ? `NavActive` : ``
} h-12 mobilenavitembg w-full justify-start text-left lg:text-center text-2xl lg:text-xl uppercase px-5 flex lg:justify-center items-center`}
>
{Icon && <Icon className="mr-2 mb-0.5 text-2xl" />}
{Name}
</Link>
</li>
);
};
export default Navitem;
export const AuthNavItem = ({
Name,
To,
Icon,
Color,
MobHidden,
DesktopHidden,
}) => {
return (
<li
className={`my-1 ${MobHidden ? `hidden lg:block` : ``} ${
DesktopHidden ? `lg:hidden` : ``
}`}
>
<Link
to={To}
style={{
color: Color,
}}
className="h-12 mobileAuthItemBg w-full justify-center text-left lg:text-center text-2xl lg:text-xl text-white uppercase px-5 flex lg:justify-center items-center"
>
{Icon && <Icon className="mr-2 mb-0.5 text-2xl" />}
{Name}
</Link>
</li>
);
};
<file_sep>/src/Pages/Profile/Bookings.js
import React from "react";
import BookingSection from "../../Components/PagesComponents/Profile/Bookings/BookingSection";
import MainWrapper from "../../Components/Wrapper/MainWrapper";
const Bookings = () => {
return (
<MainWrapper>
<BookingSection />
</MainWrapper>
);
};
export default Bookings;
<file_sep>/src/Components/PagesComponents/Homepage/Testimonials/TestimonialItem.js
import React from "react";
import { FaQuoteLeft, FaQuoteRight } from "react-icons/fa";
const TestimonialItem = ({ Msg, Name, Image }) => {
return (
<div className="flex flex-col lg:flex-row justify-evenly items-center w-full lg:w-5/12 ">
<div className="w-full lg:w-5/12 h-full m-4 relative overflow-hidden">
<img
className="w-3/6 h-3/6 mx-auto lg:w-full lg:h-full rounded-full lg:rounded-none object-cover"
src={Image}
alt=""
/>
<h2 className="testimonialName relative w-2/4 mx-auto lg:w-full mt-4 lg:mt-0 lg:absolute">
{Name}
</h2>
</div>
<div className="w-11/12 lg:w-7/12 italic leading-6 text-gray-500 text-lg ">
<FaQuoteLeft className="text-gray-600 pr-2 text-4xl" />
{Msg}
<FaQuoteRight className="text-gray-600 pr-2 text-4xl" />
</div>
</div>
);
};
export default TestimonialItem;
<file_sep>/src/Components/PagesComponents/Packages/Form.js
import React from "react";
import { useForm } from "react-hook-form";
const Form = () => {
const {
register,
handleSubmit,
formState: { errors },
} = useForm();
const onSubmit = (data) => console.log(data);
return (
<section className="w-full h-full">
<div className="w-11/12 h-full mx-auto">
<div className="w-full flex flex-col justify-center items-center">
<h5 className="w-4/5 text-center tracking-wide text-4xl leading-9 py-2 font-medium">
Choose as per your requirement and get the benefit of Customized
Packages by talking to our dedicated Team:
</h5>
<p className="py-4 text-2xl">
Just fill the below Package form and our dedicated Team will get in
touch with you within 24 working
</p>
<form
className="w-full lg:w-10/12 flex flex-col justify-between items-start my-1"
onSubmit={handleSubmit(onSubmit)}
>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="w-1/5 h-auto flex justify-start items-center">
<label>Your Name*</label>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="<NAME>"
{...register("firstName", { required: true })}
></input>
{errors.firstName && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="<NAME>"
{...register("lastName", { required: true })}
></input>
{errors.lastName && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
</div>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="w-1/5 h-auto flex justify-start items-center">
<label>Package *</label>
</div>
<div className="w-full h-auto flex justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<select
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
{...register("package", {})}
>
<option value="">GREEN</option>
<option value="">GREEN+</option>
<option value="">GREEN++</option>
</select>
</div>
</div>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="lg:w-1/5 h-auto flex justify-start items-center">
<label>Your Address*</label>
</div>
<div className="w-full h-auto flex flex-wrap justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="House No"
{...register("HouseNo", { required: true })}
></input>
{errors.HouseNo && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="City"
{...register("City", { required: true })}
></input>
{errors.City && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="State"
{...register("State", { required: true })}
></input>
{errors.State && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full min-h-full h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="Pincode"
{...register("Pincode", { required: true })}
></input>
{errors.Pincode && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
</div>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-baseline">
<div className="w-1/5 h-auto flex justify-start items-center">
<label>Contact*</label>
</div>
<div className="w-full h-auto flex flex-col lg:flex-row justify-between items-center">
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<input
className="w-full h-full min-h-full px-4 border-2 bg-gray-100 border-solid border-gray-200 "
type="text"
placeholder="+91"
{...register("PhoneMobile", { required: true })}
></input>
{errors.PhoneMobile && (
<span className="ml-4 py-1 text-red-500">
* This field is required
</span>
)}
</div>
<div className="w-full lg:w-12/25 h-10 flex flex-col items-start justify-start my-3">
<button
style={{
background: "rgb(189, 99, 144)",
borderColor: "rgb(189, 99, 144)",
}}
className="w-full h-full min-h-full px-4 border-2 border-solid text-white "
type="submit"
>
SUBMIT
</button>
</div>
</div>
</div>
</form>
<div className="flex flex-col justify-start items-center pb-8">
<p className="w-full tracking-wider text-xl py-4">
Alternatively, you can give us a call to our dedicated specialists
for any Package related enquiry:{" "}
</p>
<h3 className="w-full tracking-wider text-4xl py-1">
<a className="text-black" href="tel:+9999-9999-99">
Call : 9999-9999-99
</a>
</h3>
</div>
</div>
</div>
</section>
);
};
export default Form;
<file_sep>/src/Components/PagesComponents/Homepage/Discount/DiscountCard.js
import React from "react";
const DiscountCard = ({ Code, Percent, line, Bg, TagBg, BorderColor }) => {
return (
<div
style={{
background: Bg,
}}
className=" w-11/12 h-72 mx-auto md:w-72 md:h-72 lg:w-80 lg:h-80 my-4 flex flex-col"
>
<div
style={{
borderColor: BorderColor,
}}
className="border-2 border-dashed h-full m-3"
>
<div className="flex justify-center items-center mx-auto">
<div
style={{
width: " 0px",
height: "0px",
borderBottom: "25px solid rgb(55, 52, 53)",
borderLeft: "15px solid transparent",
marginTop: "-28.5%",
}}
></div>
<div
style={{
background: TagBg,
width: " 65%",
height: "72px",
marginTop: "-13%",
borderRadius: "0px 0px 20px 20px",
}}
>
<h2 className="text-2xl text-white font-medium py-0.2 text-center">
PROMO CODE
</h2>
<h1 className="text-4xl text-white font-black text-center">
{Code}
</h1>
</div>
<div
style={{
width: " 0px",
height: "0px",
borderBottom: "25px solid rgb(55, 52, 53)",
borderRight: "15px solid transparent",
marginTop: "-28.5%",
}}
></div>
</div>
<div className="h-4/5 text-center flex justify-center items-center flex-col mx-auto">
<h5 className="text-4xl py-0.3 tracking-wide">FLAT</h5>
<h3 className="text-5xl py-0.3">{Percent} OFF</h3>
<p
className="text-xl font-normal py-1 w-8/12
"
>
{line}
</p>
</div>
</div>
</div>
);
};
export default DiscountCard;
<file_sep>/src/Components/PagesComponents/Homepage/Discount/Discount.js
import React from "react";
import DiscountCard from "./DiscountCard";
import OwlCarousel from "react-owl-carousel";
import "owl.carousel/dist/assets/owl.carousel.css";
import "owl.carousel/dist/assets/owl.theme.default.css";
import "./Discount.css";
const Discount = () => {
return (
<section className="w-full h-auto">
<div className="w-11/12 flex-col lg:w-11/12 h-full mx-auto flex justify-center items-center py-4">
<div className=" flex-col flex justify-center items-center">
<h1 className=" text-center text-5xl w-5/6 lg:w-full pr-1 uppercase text-darkblue font-black ">
DISCOUNT COUPONS
</h1>
<h3 className="text-center w-5/6 text-2xl lg:text-3xl text-gray-700 font-medium py-4">
Make Your Experience more enjoyable with these Special Discount
Offers
</h3>
</div>
<div className="hidden md:grid py-4 md:grid-cols-2 lg:grid-cols-4 gap-8">
<DiscountCard
Code="LED 25"
Percent="25%"
line="on LED TV Repairs on Visiting Charges"
Bg="rgb(159, 238, 245)"
TagBg="rgb(30, 134, 143)"
BorderColor="rgb(153, 255, 255)"
/>{" "}
<DiscountCard
Code="WMR 25"
Percent="25%"
line="on Washing Machine Repairs on Visiting Charges"
Bg="rgb(255, 242, 173)"
TagBg="rgb(178, 165, 65)"
BorderColor="rgb(181, 199, 139)"
/>{" "}
<DiscountCard
Code="GR 25"
Percent="25%"
line="on GEYSER Repairs on Visiting Charges"
Bg="rgb(228, 224, 252)"
TagBg="rgb(97, 87, 189)"
BorderColor="rgb(208, 164, 255)"
/>{" "}
<DiscountCard
Code="LED 25"
Percent="25%"
line="on Airconditioner Repairs on Visiting Charges"
Bg="rgb(247, 212, 198)"
TagBg="rgb(191, 91, 48)"
BorderColor="rgb(223, 159, 132)"
/>
</div>
<OwlCarousel
items={1}
loop
nav={true}
className=" w-11/12 md:hidden lg:hidden"
>
<DiscountCard
Code="LED 25"
Percent="25%"
line="on LED TV Repairs on Visiting Charges"
Bg="rgb(159, 238, 245)"
TagBg="rgb(30, 134, 143)"
BorderColor="rgb(153, 255, 255)"
/>{" "}
<DiscountCard
Code="WMR 25"
Percent="25%"
line="on Washing Machine Repairs on Visiting Charges"
Bg="rgb(255, 242, 173)"
TagBg="rgb(178, 165, 65)"
BorderColor="rgb(181, 199, 139)"
/>{" "}
<DiscountCard
Code="GR 25"
Percent="25%"
line="on GEYSER Repairs on Visiting Charges"
Bg="rgb(228, 224, 252)"
TagBg="rgb(97, 87, 189)"
BorderColor="rgb(208, 164, 255)"
/>{" "}
<DiscountCard
Code="LED 25"
Percent="25%"
line="on Airconditioner Repairs on Visiting Charges"
Bg="rgb(247, 212, 198)"
TagBg="rgb(191, 91, 48)"
BorderColor="rgb(223, 159, 132)"
/>
</OwlCarousel>
</div>
</section>
);
};
export default Discount;
| 0542d92433664710360d7ddc5157d13c45719943 | [
"JavaScript"
] | 42 | JavaScript | sachinpasi/aid-v1 | 9cddc2368c1332da71e0bb77defddec457df9be9 | 410375fb039e9ca9d7abd55dde99ba429d36e08e |
refs/heads/master | <file_sep><?php
if (isset($_POST) && !empty($_POST)) {
$errors = [];
if (empty($_POST['lastName']) OR strlen($_POST['lastName']) < 2) {
$errors['lastName'] = "The name must be greater than 1 character!";
}
if (empty($_POST['firstName']) OR strlen($_POST['firstName']) < 2) {
$errors['firstName'] = "The first name must be greater than 1 character!";
}
if (!preg_match("/^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/", $_POST['phoneNumber'])) {
$errors['phoneNumber'] = "The phone number must be in French format";
}
if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
$errors['email'] = "L'adresse e-mail n'est pas valide !";
}
if (empty($_POST['select'])) {
$errors['select'] = "You must to choose something!";
}
if (empty($_POST['message'])) {
$errors['message'] = "No empty message allowed sorry";
}
if (!$errors) {
header("location: data.php");
exit();
}
}
?>
<!<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
<title>Document</title>
</head>
<body>
<div class="container">
<form method="POST" action="form.php" >
<div class="form-group">
<label for="lastName">Last Name</label>
<input type="text" class="form-control" id="lastName" name="lastName"
value="<?= $_POST['lastName'] ?? "" ?>">
<small class="text-danger font-weight-bold"><?= $errors['lastName'] ?? "" ?></small>
</div>
<div class="form-group">
<label for="firstName">First Name</label>
<input type="text" class="form-control" id="firstName" name="firstName"
value="<?= $_POST['firstName'] ?? "" ?>">
<small class="text-danger font-weight-bold"><?= $errors['firstName'] ?? "" ?></small>
</div>
<div class="form-group">
<label for="phoneNumber">Phone Number</label>
<input type="tel" class="form-control" id="phoneNumber" name="phoneNumber"
value="<?= $_POST['phoneNumber'] ?? "" ?>">
<small class="text-danger font-weight-bold"><?= $errors['phoneNumber'] ?? "" ?></small>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email"
value="<?= $_POST['email'] ?? "" ?>">
<small class="text-danger font-weight-bold"><?= $errors['email'] ?? "" ?></small>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend" >
<label class="input-group-text" for="inputGroupSelect01">Options</label>
</div>
<select class="custom-select" id="inputGroupSelect01" name="select">
<option value="" selected>Quel est ton animal préféré ?</option>
<option value="1">Renard (Meilleur choix honnêtement)</option>
<option value="2">Shiba Inu (Totalement acceptable)</option>
<option value="3">Roucool (Pas ouf)</option>
</select>
<small class="text-danger font-weight-bold"><?= $errors['select'] ?? "" ?></small>
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1">Your message</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" name="message" ></textarea>
<small class="text-danger font-weight-bold"><?= $errors['message'] ?? "" ?></small>
</div>
<button type="submit" class="btn btn-primary">Envoyer</button>
</form>
</div>
</body>
</html>
| 1a61e0c12995f8eae42a5721188323c5d91dff4e | [
"PHP"
] | 1 | PHP | Shishifoxy/form | 5dd26f51a968570470a4142b3653580b486c6be2 | b8aa5dcca906048bfecf5a1d284e0713fee5ea94 |
refs/heads/main | <file_sep>using System;
using System.Collections.Generic;
using System.Data.Entity.Core.Metadata.Edm;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVC_Proje.Models;
namespace MVC_Proje.Controllers
{
public class MüşteriController : Controller
{
StokTakipVeritabanıEntities entities = new StokTakipVeritabanıEntities();
public ActionResult MüşteriListele()
{
var customers = entities.MUSTERITABLOSU.ToList();
return View(customers);
}
[HttpGet]
public ActionResult MüşteriEkle()
{
return View();
}
[HttpPost]
public ActionResult MüşteriEkle(MUSTERITABLOSU tempMüşteri)
{
entities.MUSTERITABLOSU.Add(tempMüşteri);
entities.SaveChanges();
Response.Redirect("Listele");
return View();
}
public ActionResult MüşteriSil(int id)
{
var customer = entities.MUSTERITABLOSU.Find(id);
entities.MUSTERITABLOSU.Remove(customer);
entities.SaveChanges();
return RedirectToAction("MüşteriListele");
}
public ActionResult MListByID(int id)
{
var customer = entities.MUSTERITABLOSU.Find(id);
return View("MListByID", customer);
}
public ActionResult MüşteriGüncelle(MUSTERITABLOSU tempCustomer)
{
var cstmr = entities.MUSTERITABLOSU.Find(tempCustomer.MUSTERIID);
cstmr.MUSTERIAD = tempCustomer.MUSTERIAD;
cstmr.MUSTERISOYAD = tempCustomer.MUSTERISOYAD;
entities.SaveChanges();
return RedirectToAction("MüşteriListele");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Stok_Takip_Sitesi.Models.Entity;
using PagedList;
namespace Mvc_Stok_Takip_Sitesi.Controllers
{
public class ÜrünlerController : Controller
{
StokTakipVeritabanıEntities1 ent = new StokTakipVeritabanıEntities1();
public ActionResult ÜrünListele(int urun=1)
{
var ürünler = ent.URUNTABLOSU.ToList().ToPagedList(urun,3);
return View(ürünler);
}
[HttpGet]
public ActionResult ÜrünEkle()
{
List<SelectListItem> ktgr = (from i in ent.KATEGORITABLOSU.ToList() select new SelectListItem { Text = i.KATEGORIAD, Value = i.KATEGORIID.ToString() }).ToList();
ViewBag.Kategoriler = ktgr;
return View();
}
[HttpPost]
public ActionResult ÜrünEkle(URUNTABLOSU p)
{
var ktgr = ent.KATEGORITABLOSU.Where(m => m.KATEGORIID == p.KATEGORITABLOSU.KATEGORIID).FirstOrDefault();
p.KATEGORITABLOSU =ktgr;
ent.URUNTABLOSU.Add(p);
ent.SaveChanges();
return RedirectToAction("ÜrünListele");
}
public ActionResult ÜrünSil(int id)
{
var urun = ent.URUNTABLOSU.Find(id);
ent.URUNTABLOSU.Remove(urun);
ent.SaveChanges();
return RedirectToAction("ÜrünListele");
}
public ActionResult ÜrünGüncelleAç(int id)
{
var urun = ent.URUNTABLOSU.Find(id);
List<SelectListItem> ktgr = (from i in ent.KATEGORITABLOSU.ToList() select new SelectListItem { Text = i.KATEGORIAD, Value = i.KATEGORIID.ToString() }).ToList();
ViewBag.Kategoriler = ktgr;
return View("ÜrünGüncelleAç", urun);
}
public ActionResult ÜrünGüncelle(URUNTABLOSU p)
{
var urun = ent.URUNTABLOSU.Find(p.URUNID);
urun.URUNAD = p.URUNAD;
var ktgr = ent.KATEGORITABLOSU.Where(m => m.KATEGORIID == p.KATEGORITABLOSU.KATEGORIID).FirstOrDefault();
urun.KATEGORIID = ktgr.KATEGORIID;
urun.URUNFIYAT = p.URUNFIYAT;
urun.URUNSTOK = p.URUNSTOK;
ent.SaveChanges();
return RedirectToAction("ÜrünListele");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Deneme_ArabaSitesi.Models;
namespace Mvc_Deneme_ArabaSitesi.Controllers
{
public class CommentsController : Controller
{
ArabaYoutubeEntities1 db = new ArabaYoutubeEntities1();
[HttpGet]
public ActionResult AddComment()
{
return View();
}
[HttpPost]
public ActionResult AddComment(TableContact message)
{
db.TableContact.Add(message);
db.SaveChanges();
return RedirectToAction("ListAllCars","Cars");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Car_Selling_Template.Models;
namespace Mvc_Car_Selling_Template.Controllers
{
public class CarController : Controller
{
CarSellingEntities1 db = new CarSellingEntities1();
public ActionResult ListAllCars()
{
var carsList = db.Cars.Where(m=>m.Confirmation == true).ToList();
return View(carsList);
}
public ActionResult DetailedCarByID(int id)
{
var car = db.Cars.Find(id);
var photo = car.CarPhoto;
ViewBag.carphoto = photo;
return View(car);
}
[HttpGet]
public ActionResult SendCar()
{
var brandList = db.Brands.ToList();
List<SelectListItem> list =(from i in brandList select new SelectListItem { Text = i.BrandName, Value = i.BrandID.ToString() }).ToList();
ViewBag.marka = list;
return View();
}
[HttpPost]
public ActionResult SendCar(Cars car)
{
db.Cars.Add(car);
db.SaveChanges();
return RedirectToAction("ListAllCars");
}
[HttpGet]
public ActionResult ApproveCar()
{
var carsToApprove = db.Cars.Where(i=>i.Confirmation==false).ToList();
return View(carsToApprove);
}
public ActionResult DeleteCarApprove(int id)
{
var deletingCar = db.Cars.Find(id);
db.Cars.Remove(deletingCar);
db.SaveChanges();
return RedirectToAction("ListAllCars");
}
public ActionResult SubmitCarApprove(int id)
{
var editingCar = db.Cars.Find(id);
editingCar.Confirmation = true;
db.SaveChanges();
return RedirectToAction("ListAllCars");
}
public ActionResult ListCarsAdmin()
{
var listCars = db.Cars.Where(i=>i.Confirmation==true).ToList();
return View(listCars);
}
public ActionResult DeleteCarAdmin(int id)
{
var deletingCar = db.Cars.Find(id);
db.Cars.Remove(deletingCar);
db.SaveChanges();
return RedirectToAction("ListCarsAdmin");
}
[HttpGet]
public ActionResult EditCarAdmin(int id)
{
var brandList = db.Brands.ToList();
List<SelectListItem> list = (from i in brandList select new SelectListItem { Text = i.BrandName, Value = i.BrandID.ToString() }).ToList();
ViewBag.marka = list;
var car = db.Cars.Find(id);
return View(car);
}
[HttpPost]
public ActionResult EditCarAdmin(Cars car)
{
var editingCar = db.Cars.Find(car.CarID);
editingCar.CarBrandID = car.CarBrandID;
editingCar.CarContact = car.CarContact;
editingCar.CarDescription = car.CarDescription;
editingCar.CarFuelType = car.CarFuelType;
editingCar.CarModel = car.CarModel;
editingCar.CarPhoto = car.CarPhoto;
editingCar.CarPrice = car.CarPrice;
editingCar.CarSeller = car.CarSeller;
db.SaveChanges();
return RedirectToAction("ListCarsAdmin");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Stok_Takip_Sitesi.Models.Entity;
using PagedList;
namespace Mvc_Stok_Takip_Sitesi.Controllers
{
public class KategoriController : Controller
{
StokTakipVeritabanıEntities1 ent = new StokTakipVeritabanıEntities1();
public ActionResult KategoriListele(string ps,int kategori=1)
{
var kategoriler = from d in ent.KATEGORITABLOSU select d;
if (!string.IsNullOrEmpty(ps))
{
kategoriler = kategoriler.Where(m => m.KATEGORIAD.Contains(ps));
}
return View(kategoriler.ToList().ToPagedList(kategori, 3));
}
[HttpGet]
public ActionResult KategoriEkle()
{
return View();
}
[HttpPost]
public ActionResult KategoriEkle(KATEGORITABLOSU p)
{
ent.KATEGORITABLOSU.Add(p);
ent.SaveChanges();
Response.Redirect("/Kategori/KategoriListele");
return View();
}
public ActionResult KategoriSil(int id)
{
var ktgr = ent.KATEGORITABLOSU.Find(id);
ent.KATEGORITABLOSU.Remove(ktgr);
ent.SaveChanges();
return RedirectToAction("KategoriListele");
}
public ActionResult KategoriGüncelleAç(int id)
{
var ktgr = ent.KATEGORITABLOSU.Find(id);
return View("KategoriGüncelleAç", ktgr);
}
public ActionResult KategoriGüncelle(KATEGORITABLOSU p1)
{
var ktgr = ent.KATEGORITABLOSU.Find(p1.KATEGORIID);
ktgr.KATEGORIAD = p1.KATEGORIAD;
ent.SaveChanges();
return RedirectToAction("KategoriListele");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Deneme_ArabaSitesi.Models;
namespace Mvc_Deneme_ArabaSitesi.Controllers
{
public class AdminController : Controller
{
ArabaYoutubeEntities1 db = new ArabaYoutubeEntities1();
public ActionResult AdminMainPage()
{
return View();
}
[HttpGet]
public ActionResult AdminApproveCars()
{
var cars = db.TableCar.Where(i => i.CarConfirmation == false).ToList();
return View(cars);
}
public ActionResult AdminApproveCar(int id)
{
var selectedCar = db.TableCar.Where(i => i.CarID == id).SingleOrDefault();
selectedCar.CarConfirmation = true;
db.SaveChanges();
Response.Write("<script>alert('Approved the car');</script>");
return View("AdminMainPage");
}
public ActionResult AdminSeeMessages()
{
var messagesList = db.TableContact.ToList();
return View(messagesList);
}
public ActionResult AdminDeleteMessage(int id)
{
var selectedMessage = db.TableContact.Find(id);
db.TableContact.Remove(selectedMessage);
db.SaveChanges();
Response.Write("<script>alert('Message deleted !');</script>");
return RedirectToAction("AdminSeeMessages");
}
public ActionResult AdminListBrands()
{
var brands = db.TableBrand.ToList();
return View(brands);
}
[HttpGet]
public ActionResult AdminAddBrands()
{
return View();
}
[HttpPost]
public ActionResult AdminAddBrands(TableBrand addingBrand)
{
if (ModelState.IsValid)
{
db.TableBrand.Add(addingBrand);
db.SaveChanges();
Response.Write("<script>alert('Brand added !');</script>");
return RedirectToAction("AdminListBrands");
}
else
{
Response.Write("<script>alert('An error occured while adding Brand !');</script>");
return View();
}
}
public ActionResult AdminDeleteBrand(int id)
{
var selectedBrand = db.TableBrand.Find(id);
db.TableBrand.Remove(selectedBrand);
db.SaveChanges();
return RedirectToAction("AdminListBrands");
}
[HttpGet]
public ActionResult AdminAddCar()
{
List<SelectListItem> brands = (from i in db.TableBrand.ToList() select new SelectListItem { Text = i.BrandName, Value = i.BrandID.ToString() }).ToList();
ViewBag.lstBrands = brands;
return View();
}
[HttpPost]
public ActionResult AdminAddCar(TableCar addingCar)
{
List<SelectListItem> brands = (from i in db.TableBrand.ToList() select new SelectListItem { Text = i.BrandName, Value = i.BrandID.ToString() }).ToList();
ViewBag.lstBrands = brands;
db.TableCar.Add(addingCar);
db.SaveChanges();
return View();
}
public ActionResult AdminDeleteCar(int id)
{
var selectedCar = db.TableCar.Find(id);
db.TableCar.Remove(selectedCar);
db.SaveChanges();
return RedirectToAction("AdminApproveCars");
}
public ActionResult Logout()
{
return RedirectToAction("ListAllCars", "Cars");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVC_Proje.Models;
namespace MVC_Proje.Controllers
{
public class ÜrünController : Controller
{
StokTakipVeritabanıEntities entities = new StokTakipVeritabanıEntities();
public ActionResult ÜrünListele()
{
var products = entities.URUNTABLOSU.ToList();
return View(products);
}
[HttpGet]
public ActionResult ÜrünEkle()
{
List<SelectListItem> kategoriler = (from i in entities.KATEGORITABLOSU.ToList() select new SelectListItem { Text = i.KATEGORIAD, Value = i.KATEGORIID.ToString() }).ToList();
ViewBag.ktgr = kategoriler;
return View();
}
[HttpPost]
public ActionResult ÜrünEkle(URUNTABLOSU tempUrun)
{
var ktgr = entities.KATEGORITABLOSU.Where(k => k.KATEGORIID == tempUrun.KATEGORITABLOSU.KATEGORIID).FirstOrDefault();
tempUrun.KATEGORIID = ktgr.KATEGORIID;
entities.URUNTABLOSU.Add(tempUrun);
entities.SaveChanges();
return RedirectToAction("ÜrünListele");
}
public ActionResult ÜrünSil(int id)
{
var product = entities.URUNTABLOSU.Find(id);
entities.URUNTABLOSU.Remove(product);
entities.SaveChanges();
return RedirectToAction("ÜrünListele");
}
[HttpGet]
public ActionResult PListByID(int id)
{
List<SelectListItem> kategoriler = (from i in entities.KATEGORITABLOSU.ToList() select new SelectListItem { Text = i.KATEGORIAD, Value = i.KATEGORIID.ToString() }).ToList();
ViewBag.ktgr = kategoriler;
var product = entities.URUNTABLOSU.Find(id);
return View("PListByID", product);
}
public ActionResult ÜrünGüncelle(URUNTABLOSU tempProduct)
{
var product = entities.URUNTABLOSU.Find(tempProduct.URUNID);
var ktgr = entities.KATEGORITABLOSU.Where(k => k.KATEGORIID == tempProduct.KATEGORIID).FirstOrDefault();
product.KATEGORIID = ktgr.KATEGORIID;
product.URUNAD = tempProduct.URUNAD;
product.URUNFIYAT = tempProduct.URUNFIYAT;
product.URUNSTOK = tempProduct.URUNSTOK;
entities.SaveChanges();
return RedirectToAction("ÜrünListele");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Mvc_Deneme_ArabaSitesi.Models
{
public class TempLoginClass
{
public string EnteredMail { get; set; }
public string EnteredPass { get; set; }
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yaz_Okulu_MVC.Models;
namespace Yaz_Okulu_MVC.Controllers
{
public class LessonController : Controller
{
YazOkuluVeritabanıEntities db = new YazOkuluVeritabanıEntities();
public ActionResult ListLessons()
{
var lessonList = db.DersTablosu.ToList();
return View(lessonList);
}
public ActionResult DeleteLessons(int id)
{
var lesson = db.DersTablosu.Find(id);
db.DersTablosu.Remove(lesson);
db.SaveChanges();
return RedirectToAction("ListLessons");
}
[HttpGet]
public ActionResult AddLessons()
{
return View();
}
[HttpPost]
public ActionResult AddLessons(DersTablosu lesson)
{
db.DersTablosu.Add(lesson);
db.SaveChanges();
return RedirectToAction("ListLessons");
}
[HttpGet]
public ActionResult EditLessons(int id)
{
var lesson = db.DersTablosu.Find(id);
return View("EditLessons", lesson);
}
[HttpPost]
public ActionResult EditLessons(DersTablosu lesson)
{
var editLesson = db.DersTablosu.Find(lesson.DersID);
editLesson.DersAd = lesson.DersAd;
editLesson.MaxKont = lesson.MaxKont;
editLesson.MinKont = lesson.MinKont;
editLesson.OgrSayısı = lesson.OgrSayısı;
db.SaveChanges();
return RedirectToAction("ListLessons");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace Mvc.Models.Classes
{
public class Cars
{
[Key]
public int CarID { get; set; }
public string CarBrand { get; set; }
public string CarModel { get; set; }
public string CarFuelType { get; set; }
public string CarDescription { get; set; }
public string CarContact { get; set; }
public int CarSeller { get; set; }
}
}<file_sep>using Mvc.Models.Classes;
using Mvc.TempClasses;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
namespace Mvc.Controllers
{
public class MainPageController : Controller
{
public static Context con = new Context();
public static List<User> userList = con.Set<User>().ToList();
[HttpGet]
public ActionResult MainPage(User loggedUser)
{
return View(loggedUser);
}
public ActionResult Logout()
{
FormsAuthentication.SignOut();
Session.Abandon();
GlobalVariables.LoggedID = -1;
return RedirectToAction("Login", "User");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yaz_Okulu_MVC.Models;
namespace Yaz_Okulu_MVC.Controllers
{
public class StudentController : Controller
{
YazOkuluVeritabanıEntities db = new YazOkuluVeritabanıEntities();
public ActionResult ListStudents()
{
var studentList = db.ÖğrenciTablosu.ToList();
return View(studentList);
}
[HttpGet]
public ActionResult AddStudents()
{
return View();
}
[HttpPost]
public ActionResult AddStudents(ÖğrenciTablosu student)
{
db.ÖğrenciTablosu.Add(student);
db.SaveChanges();
return RedirectToAction("ListStudents");
}
public ActionResult DeleteStudents(int id)
{
var student = db.ÖğrenciTablosu.Find(id);
db.ÖğrenciTablosu.Remove(student);
db.SaveChanges();
return RedirectToAction("ListStudents");
}
[HttpGet]
public ActionResult EditStudents(int id)
{
var editingStudent = db.ÖğrenciTablosu.Find(id);
return View("EditStudents",editingStudent);
}
[HttpPost]
public ActionResult EditStudents(ÖğrenciTablosu student)
{
var tempStudent = db.ÖğrenciTablosu.Find(student.OgrID);
tempStudent.OgrAd = student.OgrAd;
tempStudent.OgrSoyad = student.OgrSoyad;
tempStudent.OgrMail = student.OgrMail;
tempStudent.OgrSifre = student.OgrSifre;
tempStudent.Bakiye = student.Bakiye;
tempStudent.OgrOkulNo = student.OgrOkulNo;
db.SaveChanges();
return RedirectToAction("ListStudents");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yemek_Sitesi_MVC.Models;
using Yemek_Sitesi_MVC.Models.Classes;
namespace Yemek_Sitesi_MVC.Controllers
{
public class AdminController : Controller
{
Yemek_Sitesi_VeritabanıEntities1 db = new Yemek_Sitesi_VeritabanıEntities1();
public ActionResult AdminListRecipes()
{
var listRecipes = db.YemekTablosu.ToList();
return View(listRecipes);
}
[HttpGet]
public ActionResult UserSettingsForAdmin()
{
var selectedUser = GlobalVariables.loggedUser;
return View(selectedUser);
}
[HttpPost]
public ActionResult UserSettingsForAdmin(YöneticiTablosu tempUser)
{
if (Sha265Converter.ComputeSha256Hash(tempUser.oldPassword) == GlobalVariables.loggedUser.Şifre)
{
var editingUser = db.YöneticiTablosu.Where(i => i.KullanıcıAdı == GlobalVariables.loggedUser.KullanıcıAdı).SingleOrDefault();
editingUser.Şifre = Sha265Converter.ComputeSha256Hash(tempUser.NewPassword);
db.SaveChanges();
return RedirectToAction("MainPageForUsers", "Recipe");
}
else
{
Response.Write("Eski şifre yanlış !");
return RedirectToAction("UserSettings");
}
}
public ActionResult AdminDeleteRecipe(int id)
{
var deletingRecipe = db.YemekTablosu.Find(id);
db.YemekTablosu.Remove(deletingRecipe);
db.SaveChanges();
return RedirectToAction("AdminListRecipes");
}
[HttpGet]
public ActionResult AdminAddRecipe()
{
var list = db.KategoriTablosu.ToList();
ViewBag.clist = list;
return View();
}
[HttpPost]
public ActionResult AdminAddRecipe(YemekTablosu newRecipe)
{
db.YemekTablosu.Add(newRecipe);
newRecipe.EklenmeTarihi = DateTime.Now.Date;
db.SaveChanges();
return RedirectToAction("AdminListRecipes");
}
[HttpGet]
public ActionResult AdminEditRecipe(int id)
{
var list = db.KategoriTablosu.ToList();
ViewBag.clist = list;
var selectedRecipe = db.YemekTablosu.Find(id);
return View(selectedRecipe);
}
[HttpPost]
public ActionResult AdminEditRecipe(YemekTablosu editingRecipe)
{
var selectedRecipe = db.YemekTablosu.Find(editingRecipe.YemekID);
selectedRecipe.YemekAd = editingRecipe.YemekAd;
selectedRecipe.KategoriID = editingRecipe.KategoriID;
selectedRecipe.Malzemeler = editingRecipe.Malzemeler;
selectedRecipe.Resimler = editingRecipe.Resimler;
selectedRecipe.Tarifler = editingRecipe.Tarifler;
selectedRecipe.EklenmeTarihi = DateTime.Now.Date;
db.SaveChanges();
return RedirectToAction("AdminListRecipes");
}
public ActionResult AdminApproveRecipesFromUsers()
{
var listRecipes = db.TarifVermeTablosu.ToList();
return View(listRecipes);
}
public ActionResult AdminConfirmRecipe(int id)
{
var selectedRecipe = db.TarifVermeTablosu.Find(id);
selectedRecipe.TarifOnay = true;
db.SaveChanges();
return RedirectToAction("AdminApproveRecipesFromUsers");
}
public ActionResult AdminUnconfirmRecipe(int id)
{
var selectedRecipe = db.TarifVermeTablosu.Find(id);
selectedRecipe.TarifOnay = false;
db.SaveChanges();
return RedirectToAction("AdminApproveRecipesFromUsers");
}
public ActionResult AdminDeleteRecipeFromUser(int id)
{
var selectedUser = db.TarifVermeTablosu.Find(id);
db.TarifVermeTablosu.Remove(selectedUser);
db.SaveChanges();
return RedirectToAction("AdminApproveRecipesFromUsers");
}
[HttpGet]
public ActionResult AdminAddTodaysRecipe()
{
return View();
}
[HttpPost]
public ActionResult AdminAddTodaysRecipe(GününYemeğiTablosu tdRecipe)
{
tdRecipe.GYemekTarih = DateTime.Now.Date;
db.GününYemeğiTablosu.Add(tdRecipe);
db.SaveChanges();
return RedirectToAction("AdminListRecipes");
}
[HttpGet]
public ActionResult AdminEditAboutUs()
{
var selectedAbout = db.HakkımızdaTablosu.Find(1);
return View(selectedAbout);
}
[HttpPost]
public ActionResult AdminEditAboutUs(HakkımızdaTablosu postedAbout)
{
var editingAbout = db.HakkımızdaTablosu.Find(postedAbout.HakkımızdaID);
editingAbout.Hakkımızda = postedAbout.Hakkımızda;
editingAbout.Resim = postedAbout.Resim;
db.SaveChanges();
return RedirectToAction("AdminListRecipes");
}
[HttpGet]
public ActionResult AdminApproveComments()
{
var listComments = db.YorumlarTablosu.ToList();
return View(listComments);
}
public ActionResult AdminApproveComment(int id)
{
var selectedComment = db.YorumlarTablosu.Find(id);
selectedComment.YorumOnay = 1;
db.SaveChanges();
return RedirectToAction("AdminApproveComments");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yemek_Sitesi_MVC.Models;
using Yemek_Sitesi_MVC.Models.Classes;
namespace Yemek_Sitesi_MVC.Controllers
{
public class RecipeController : Controller
{
Yemek_Sitesi_VeritabanıEntities1 db = new Yemek_Sitesi_VeritabanıEntities1();
public ActionResult ShowRecipesForNonUsers()
{
var listRecipes = db.YemekTablosu.ToList();
return View(listRecipes);
}
public ActionResult ShowRecipesForUsers()
{
var listRecipes = db.YemekTablosu.ToList();
return View(listRecipes);
}
public ActionResult ShowRecipeDetailsForNonUsers(int id)
{
var selectedRecipe = db.YemekTablosu.Find(id);
ViewBag.photo = selectedRecipe.Resimler;
return View(selectedRecipe);
}
public ActionResult ShowRecipeDetailsForUsers(int id)
{
var selectedRecipe = db.YemekTablosu.Find(id);
ViewBag.photo = selectedRecipe.Resimler;
return View(selectedRecipe);
}
public ActionResult TodaysRecipeForNonUser()
{
DateTime todayDate = DateTime.Now.Date;
var selectedRecipe = db.GününYemeğiTablosu.Where(i => i.GYemekTarih == todayDate).SingleOrDefault();
if (selectedRecipe==null)
{
return RedirectToAction("ErrorForNonUsers");
}
else
{
ViewBag.photo = selectedRecipe.GYemekResim;
return View(selectedRecipe);
}
}
public ActionResult TodaysRecipeForUser()
{
DateTime todayDate = DateTime.Now.Date;
var selectedRecipe = db.GününYemeğiTablosu.Where(i => i.GYemekTarih == todayDate).SingleOrDefault();
if (selectedRecipe == null)
{
return RedirectToAction("ErrorForUsers");
}
else
{
ViewBag.photo = selectedRecipe.GYemekResim;
return View(selectedRecipe);
}
}
public ActionResult AboutUsAndContactForNonUser()
{
var about = db.HakkımızdaTablosu.Find(1);
ViewBag.photo = about.Resim;
return View(about);
}
public ActionResult AboutUsAndContactForUser()
{
var about = db.HakkımızdaTablosu.Find(1);
ViewBag.photo = about.Resim;
return View(about);
}
public ActionResult GiveRecipesForNonUsers()
{
return View();
}
[HttpGet]
public ActionResult GiveRecipesForUsers()
{
return View();
}
[HttpPost]
public ActionResult GiveRecipesForUsers(TarifVermeTablosu postedRecipe)
{
postedRecipe.TarifOnay = false;
db.TarifVermeTablosu.Add(postedRecipe);
db.SaveChanges();
return RedirectToAction("MainPageForUsers");
}
public ActionResult ErrorForNonUsers()
{
return View();
}
public ActionResult ErrorForUsers()
{
return View();
}
public ActionResult MainPageForUsers()
{
return View();
}
public ActionResult RecipesFromUsersForNonUsers()
{
var listOfRecipes = db.TarifVermeTablosu.Where(i => i.TarifOnay == true).ToList();
return View(listOfRecipes);
}
public ActionResult RecipesFromUsersForUsers()
{
var listOfRecipes = db.TarifVermeTablosu.Where(i => i.TarifOnay == true).ToList();
return View(listOfRecipes);
}
public ActionResult SendComment(YemekTablosu tempComment)
{
YorumlarTablosu comment = new YorumlarTablosu();
comment.Mail = tempComment.tempCommentMail;
comment.Yorumİçerik = tempComment.tempCommentContent;
comment.Tarih = DateTime.Now.Date;
comment.YorumAd = GlobalVariables.loggedUser.KullanıcıAdı;
comment.YemekID = tempComment.YemekID;
db.YorumlarTablosu.Add(comment);
db.SaveChanges();
return RedirectToAction("MainPageForUsers");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Mvc.TempClasses
{
public class GlobalVariables
{
public static int LoggedID { get; set; }
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace Mvc_Kütüphane.Models
{
public class PasswordControl
{
public static int GetLowerScore(string password)
{
int rawScore = password.Length - Regex.Replace(password, "[a-z]", "").Length;
return rawScore;
}
public static int GetUpperScore(string password)
{
int rawScore = password.Length - Regex.Replace(password, "[A-Z]", "").Length;
return rawScore;
}
public static int GetDigitScore(string password)
{
int rawScore = password.Length - Regex.Replace(password, "[0-9]", "").Length;
return rawScore;
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Yemek_Sitesi_MVC.Models.Classes
{
public class GlobalVariables
{
public static YöneticiTablosu loggedUser { get; set; }
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace Mvc.Models.Classes
{
public class Context: DbContext
{
DbSet<User> Users { get; set; }
DbSet<Cars> Carses { get; set; }
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Data.Entity.Core.Metadata.Edm;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVC_Proje.Models;
namespace MVC_Proje.Controllers
{
public class KategoriController : Controller
{
StokTakipVeritabanıEntities entities = new StokTakipVeritabanıEntities();
public ActionResult KategoriListele()
{
var categories = entities.KATEGORITABLOSU.ToList();
return View(categories);
}
[HttpGet]
public ActionResult KategoriEkle()
{
return View();
}
[HttpPost]
public ActionResult KategoriEkle(KATEGORITABLOSU tempKateg)
{
entities.KATEGORITABLOSU.Add(tempKateg);
entities.SaveChanges();
Response.Redirect("Listele");
return View();
}
public ActionResult KategoriDelete(int id)
{
var ktgr = entities.KATEGORITABLOSU.Find(id);
entities.KATEGORITABLOSU.Remove(ktgr);
entities.SaveChanges();
return RedirectToAction("KategoriListele");
}
public ActionResult ListByID(int id)
{
var ktgr = entities.KATEGORITABLOSU.Find(id);
return View("ListByID", ktgr);
}
public ActionResult Güncelle(KATEGORITABLOSU tempKtgr)
{
var ktgr = entities.KATEGORITABLOSU.Find(tempKtgr.KATEGORIID);
ktgr.KATEGORIAD = tempKtgr.KATEGORIAD;
entities.SaveChanges();
return RedirectToAction("KategoriListele");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Car_Selling_Template.Models;
namespace Mvc_Car_Selling_Template.Controllers
{
public class AboutandContactController : Controller
{
CarSellingEntities1 db = new CarSellingEntities1();
public ActionResult ListAboutUsAndContact()
{
var objects = db.AboutAndContact.Find(1);
return View(objects);
}
public ActionResult AdminMainPage()
{
return View();
}
[HttpGet]
public ActionResult EditAboutUsAndContact(int id)
{
var aboutAndContact= db.AboutAndContact.Find(id);
return View(aboutAndContact);
}
[HttpPost]
public ActionResult EditAboutUsAndContact(AboutAndContact entity)
{
var editingEntity = db.AboutAndContact.Find(entity.AboutID);
editingEntity.AboutDescription = entity.AboutDescription;
editingEntity.ContactMail = entity.ContactMail;
editingEntity.ContactNumber = entity.ContactNumber;
db.SaveChanges();
return RedirectToAction("AdminMainPage");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Deneme_ArabaSitesi.Models;
namespace Mvc_Deneme_ArabaSitesi.Controllers
{
public class CarsController : Controller
{
ArabaYoutubeEntities1 db = new ArabaYoutubeEntities1();
public ActionResult ListCarsForBrands(int id)
{
var selectedCars = db.TableCar.Where(i => i.CarBrandID == id && i.CarConfirmation==true).ToList();
return View(selectedCars);
}
public ActionResult ListAllCars()
{
var selectedCarsAll = db.TableCar.Where(i => i.CarConfirmation == true).ToList();
return View(selectedCarsAll);
}
public ActionResult CarsDetail(int id)
{
var selectedCar = db.TableCar.Where(i => i.CarID == id).SingleOrDefault();
ViewBag.photo = selectedCar.CarPhoto;
return View(selectedCar);
}
[HttpGet]
public ActionResult AddCars()
{
List<SelectListItem> brands = (from i in db.TableBrand.ToList() select new SelectListItem { Text = i.BrandName, Value = i.BrandID.ToString() }).ToList();
ViewBag.lstBrands = brands;
return View();
}
[HttpPost]
public ActionResult AddCars(TableCar addingCar)
{
List<SelectListItem> brands = (from i in db.TableBrand.ToList() select new SelectListItem { Text = i.BrandName, Value = i.BrandID.ToString() }).ToList();
ViewBag.lstBrands = brands;
if (ModelState.IsValid)
{
db.TableCar.Add(addingCar);
db.SaveChanges();
}
return View();
}
}
}<file_sep>using Mvc_Deneme_ArabaSitesi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Mvc_Deneme_ArabaSitesi.Controllers
{
public class UserController : Controller
{
ArabaYoutubeEntities1 db = new ArabaYoutubeEntities1();
[HttpGet]
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Login(TempLoginClass tempLogin)
{
var hashedPass = Sha256Converter.ComputeSha256Hash(tempLogin.EnteredPass);
var selectedUser= db.TableUser.Where(i => i.UserMail == tempLogin.EnteredMail && i.UserPassword == <PASSWORD>).SingleOrDefault();
if (selectedUser==null)
{
Response.Write("Mail or password is wrong");
return View();
}
else
{
Response.Write("Login succesfull");
return RedirectToAction("AdminMainPage","Admin");
}
}
[HttpGet]
public ActionResult Register()
{
return View();
}
[HttpPost]
public ActionResult Register(TableUser newUser)
{
var existingUser = db.TableUser.Where(i => i.UserMail == newUser.UserMail).SingleOrDefault();
if (ModelState.IsValid)
{
if (existingUser!=null)
{
Response.Write("<script>alert('The e-mail is taken , please enter another e-mail adress');</script>");
return View();
}
else
{
var hashedPass = Sha256Converter.ComputeSha256Hash(newUser.UserPassword);
newUser.UserPassword = <PASSWORD>;
db.TableUser.Add(newUser);
db.SaveChanges();
Response.Write("<script>alert('Register Successful');</script>");
return RedirectToAction("Login");
}
}
else
{
return View();
}
}
}
}<file_sep>using Mvc.Models.Classes;
using Mvc.TempClasses;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Mvc.Controllers
{
public class UserController : Controller
{
public static Context con = new Context();
public static List<User> userList = con.Set<User>().ToList();
string validationError = "";
[HttpGet]
public ActionResult Register()
{
return View();
}
[HttpPost]
public ActionResult Register(User tempUser)
{
var addEntity = con.Entry(tempUser);
addEntity.State = EntityState.Added;
con.SaveChanges();
return View();
}
[HttpGet]
public ActionResult Login()
{
ViewBag.VE = validationError;
return View();
}
[HttpPost]
public ActionResult Login(User loggingUser)
{
if (selectUser(loggingUser.UserMail) != null)
{
User tempUser = selectUser(loggingUser.UserMail);
if (tempUser.UserPassword == <PASSWORD>)
{
User loggedUser = tempUser;
tempUser.Logged = true;
GlobalVariables.LoggedID = tempUser.UserID;
return View("~/Views/MainPage/MainPageUser.cshtml",loggedUser);
}
else
{
validationError = "Password is not true !";
ViewBag.VE = validationError;
return View();
}
}
else
{
validationError = "There is no registered account with this mail adress !";
ViewBag.VE = validationError;
return View();
}
}
public User selectUser(string tempMail)
{
return (from k in userList where k.UserMail == tempMail select k).SingleOrDefault();
}
}
}<file_sep>using Microsoft.Ajax.Utilities;
using Mvc.Models.Classes;
using Mvc.TempClasses;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Context = Mvc.Models.Classes.Context;
namespace Mvc.Controllers
{
public class AccountOperationsController : Controller
{
public static Context con = new Context();
public static List<User> userList = con.Set<User>().ToList();
User loggedUser= (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
public ActionResult AccountOperationsDetailed()
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
return View(loggedUser);
}
[HttpGet]
public ActionResult ChangeName()
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
return View(loggedUser);
}
[HttpPost]
public ActionResult ChangeName(User reUser)
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
loggedUser.UserName = reUser.UserName;
var changedEntitiy = con.Entry(loggedUser);
changedEntitiy.State = System.Data.Entity.EntityState.Modified;
con.SaveChanges();
return RedirectToAction("AccountOperationsDetailed",GlobalVariables.LoggedID);
}
[HttpGet]
public ActionResult ChangeSurname()
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
return View(loggedUser);
}
[HttpPost]
public ActionResult ChangeSurname(User reUser)
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
loggedUser.UserSurname = reUser.UserSurname;
var changedEntitiy = con.Entry(loggedUser);
changedEntitiy.State = System.Data.Entity.EntityState.Modified;
con.SaveChanges();
return RedirectToAction("AccountOperationsDetailed", GlobalVariables.LoggedID);
}
[HttpGet]
public ActionResult ChangeMail()
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
return View(loggedUser);
}
[HttpPost]
public ActionResult ChangeMail(User reUser)
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
loggedUser.UserMail = reUser.UserMail;
var changedEntitiy = con.Entry(loggedUser);
changedEntitiy.State = System.Data.Entity.EntityState.Modified;
con.SaveChanges();
return RedirectToAction("AccountOperationsDetailed", GlobalVariables.LoggedID);
}
[HttpGet]
public ActionResult ChangePassword()
{
loggedUser = (from k in userList where k.UserID == GlobalVariables.LoggedID select k).SingleOrDefault();
return View(loggedUser);
}
[HttpPost]
public ActionResult ChangePassword(User reUser)
{
loggedUser.UserPassword = <PASSWORD>;
var changedEntitiy = con.Entry(loggedUser);
changedEntitiy.State = System.Data.Entity.EntityState.Modified;
con.SaveChanges();
return RedirectToAction("AccountOperationsDetailed", GlobalVariables.LoggedID);
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Stok_Takip_Sitesi.Models.Entity;
namespace Mvc_Stok_Takip_Sitesi.Controllers
{
public class SatışController : Controller
{
// GET: Satış
public ActionResult SatışListele()
{
List<SelectListItem> urunler = (from i in ent.URUNTABLOSU.ToList() select new SelectListItem { Text = i.URUNAD, Value = i.URUNID.ToString() }).ToList();
ViewBag.sells = urunler;
List<SelectListItem> musteri = (from i in ent.MUSTERITABLOSU.ToList() select new SelectListItem { Text = i.MUSTERIAD + " " + i.MUSTERISOYAD, Value = i.MUSTERIID.ToString() }).ToList();
ViewBag.mstrler = musteri;
return View();
}
StokTakipVeritabanıEntities1 ent = new StokTakipVeritabanıEntities1();
[HttpGet]
public ActionResult SatışEkle()
{
return View();
}
[HttpPost]
public ActionResult SatışEkle(SATISTABLOSU p)
{
var urun = ent.URUNTABLOSU.Where(m => m.URUNID == p.URUNTABLOSU.URUNID).FirstOrDefault();
var mstr = ent.MUSTERITABLOSU.Where(m => m.MUSTERIID == p.MUSTERITABLOSU.MUSTERIID).FirstOrDefault();
if (urun.URUNSTOK<=0)
{
Response.Write("Stokta seçilen ürün kalmamıştır");
return RedirectToAction("SatışListele");
}
else
{
urun.URUNSTOK = urun.URUNSTOK - 1;
p.URUNTABLOSU = urun;
p.MUSTERITABLOSU = mstr;
ent.SATISTABLOSU.Add(p);
ent.SaveChanges();
return RedirectToAction("SatışListele");
}
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Stok_Takip_Sitesi.Models.Entity;
using PagedList;
namespace Mvc_Stok_Takip_Sitesi.Controllers
{
public class MüşterilerController : Controller
{
StokTakipVeritabanıEntities1 ent = new StokTakipVeritabanıEntities1();
public ActionResult MüşteriListele(int mstr=1)
{
var müşteriler = ent.MUSTERITABLOSU.ToList().ToPagedList(mstr,3);
return View(müşteriler);
}
[HttpGet]
public ActionResult MüşteriEkle()
{
return View();
}
[HttpPost]
public ActionResult MüşteriEkle(MUSTERITABLOSU p)
{
ent.MUSTERITABLOSU.Add(p);
ent.SaveChanges();
Response.Redirect("/Müşteriler/MüşteriListele");
return View();
}
public ActionResult MüşteriSil(int id)
{
var mstr = ent.MUSTERITABLOSU.Find(id);
ent.MUSTERITABLOSU.Remove(mstr);
ent.SaveChanges();
return RedirectToAction("MüşteriListele");
}
public ActionResult MüşteriGüncelleAç(int id)
{
var mstr = ent.MUSTERITABLOSU.Find(id);
return View("MüşteriGüncelleAç", mstr);
}
public ActionResult MüşteriGüncelle(MUSTERITABLOSU p)
{
var mstr = ent.MUSTERITABLOSU.Find(p.MUSTERIID);
mstr.MUSTERIAD = p.MUSTERIAD;
mstr.MUSTERISOYAD = p.MUSTERISOYAD;
ent.SaveChanges();
return RedirectToAction("MüşteriListele");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Mvc_Kütüphane.Models
{
public class LoggedUserInfo
{
public static string Mail = "";
public static string Pass = "";
public static int Rank = -1;
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Kütüphane.Models;
namespace Mvc_Kütüphane.Controllers
{
public class BooksController : Controller
{
KütüphaneProjesiEntities db = new KütüphaneProjesiEntities();
public ActionResult MainPage()
{
return View();
}
public ActionResult ListAllBooks()
{
var allBooks = db.KütüphaneKitapTablosu.ToList();
return View(allBooks);
}
public ActionResult GetBook(int id)
{
var selectedBook = db.KütüphaneKitapTablosu.Find(id);
if (selectedBook.KitapAdeti == 0)
{
Response.Write("<script>alert('Sipariş ettiğiniz kitap stokta bulunmamaktadır ! Sipariş gerçekleştirilemedi !');</script>");
return View();
}
else
{
selectedBook.KitapAdeti -= 1;
AlınanKitapTablosu newTakenBook = new AlınanKitapTablosu();
newTakenBook.AlınanKitapAdı = selectedBook.KitapAdı;
newTakenBook.KitabıAlanKullanıcı = LoggedUserInfo.Mail;
newTakenBook.KitapAlınmaTarihi = DateTime.Now;
db.AlınanKitapTablosu.Add(newTakenBook);
db.SaveChanges();
}
return RedirectToAction("ListAllBooks");
}
public ActionResult ShowBooksOnMe( string userinfo)
{
var list = db.AlınanKitapTablosu.Where(i => i.KitabıAlanKullanıcı == userinfo).ToList();
return View(list);
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace Mvc.Models.Classes
{
public class User
{
[Key]
public int UserID { get; set; }
[Required(ErrorMessage = "Name is required !")]
public string UserName { get; set; }
[Required(ErrorMessage = "Surname is required !")]
public string UserSurname { get; set; }
[Required(ErrorMessage = "Mail is required !")]
public string UserMail { get; set; }
[Required(ErrorMessage ="Password is required !")]
[Compare("ComparePassword",ErrorMessage ="Passwords does not match !")]
public string UserPassword { get; set; }
[Required(ErrorMessage = "Re-entered password is required !")]
public string ComparePassword { get; set; }
public bool Logged { get; set; }
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yaz_Okulu_MVC.Models;
namespace Yaz_Okulu_MVC.Controllers
{
public class TeacherController : Controller
{
YazOkuluVeritabanıEntities db = new YazOkuluVeritabanıEntities();
public ActionResult ListTeachers()
{
var teacherList = db.ÖğretmenTablosu.ToList();
return View(teacherList);
}
[HttpGet]
public ActionResult AddTeachers()
{
List<SelectListItem> dersler = (from i in db.DersTablosu.ToList() select new SelectListItem { Text = i.DersAd, Value = i.DersID.ToString() }).ToList();
ViewBag.urn = dersler;
return View();
}
[HttpPost]
public ActionResult AddTeachers(ÖğretmenTablosu teacher)
{
db.ÖğretmenTablosu.Add(teacher);
db.SaveChanges();
return RedirectToAction("ListTeachers");
}
public ActionResult DeleteTeachers(int id)
{
var teacher = db.ÖğretmenTablosu.Find(id);
db.ÖğretmenTablosu.Remove(teacher);
db.SaveChanges();
return RedirectToAction("ListTeachers");
}
[HttpGet]
public ActionResult EditTeachers(int id)
{
var editingTeacher = db.ÖğretmenTablosu.Find(id);
List<SelectListItem> dersler = (from i in db.DersTablosu.ToList() select new SelectListItem { Text = i.DersAd, Value = i.DersID.ToString() }).ToList();
ViewBag.lessons = dersler;
return View("EditTeachers",editingTeacher);
}
[HttpPost]
public ActionResult EditTeachers(ÖğretmenTablosu teacher)
{
var tempTeacher = db.ÖğretmenTablosu.Find(teacher.OgrtID);
tempTeacher.OgrtAdSoyad = teacher.OgrtAdSoyad;
tempTeacher.OgrtDersID = teacher.OgrtDersID;
db.SaveChanges();
return RedirectToAction("ListTeachers");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Araba_Satış_MVC.Models;
namespace Araba_Satış_MVC.Controllers
{
public class NonUserController : Controller
{
CarsDBEntities db = new CarsDBEntities();
public ActionResult MainPageNonUsers()
{
return View();
}
public ActionResult ShowBrandsNonUser()
{
var myBrandsList = db.Brands.ToList();
return View(myBrandsList);
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using Mvc_Kütüphane.Models;
namespace Mvc_Kütüphane.Controllers
{
public class UserController : Controller
{
KütüphaneProjesiEntities db = new KütüphaneProjesiEntities();
[HttpGet]
public ActionResult Register()
{
return View();
}
[HttpPost]
public ActionResult Register(KütüphaneKullanıcıTablosu2 newUser)
{
if (ModelState.IsValid)
{
var existingUser = db.KütüphaneKullanıcıTablosu2.Where(i => i.GirişBilgisi == newUser.GirişBilgisi).SingleOrDefault();
if (existingUser==null)
{
if (newUser.Şifre.Length<=8)
{
Response.Write("<script> alert('Şifre uzunluğu 8den kısa olamaz !'); </script>");
}
else if (PasswordControl.GetLowerScore(newUser.Şifre)<1)
{
Response.Write("<script> alert('Şifrenizde en az bir adet küçük harf bulunmalıdır !'); </script>");
}
else if (PasswordControl.GetUpperScore(newUser.Şifre) < 1)
{
Response.Write("<script> alert('Şifrenizde en az bir adet büyük harf bulunmalıdır !'); </script>");
}
else if (PasswordControl.GetDigitScore(newUser.Şifre) < 1)
{
Response.Write("<script> alert('Şifrenizde en az bir adet sayı bulunmalıdır !'); </script>");
}
else
{
var newPass = Sha256Converter.ComputeSha256Hash(newUser.Şifre);
newUser.Şifre = newPass;
newUser.Rank = 3;
db.KütüphaneKullanıcıTablosu2.Add(newUser);
db.SaveChanges();
Response.Write("<script> alert('Kayıt Başarılı'); </script>");
}
}
else
{
Response.Write("<script> alert('Girdiğiniz Mail Adresi Kullanılmaktadır !'); </script>");
}
}
else
{
}
return View();
}
[HttpGet]
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Login(KütüphaneKullanıcıTablosu2 loggingUser)
{
var newPass = Sha256Converter.ComputeSha256Hash(loggingUser.Şifre);
var loggedUser = db.KütüphaneKullanıcıTablosu2.Where(i => i.GirişBilgisi == loggingUser.GirişBilgisi && i.Şifre == newPass).SingleOrDefault();
if (loggedUser != null)
{
LoggedUserInfo.Mail = loggedUser.GirişBilgisi;
LoggedUserInfo.Pass = <PASSWORD>;
LoggedUserInfo.Rank = loggedUser.Rank;
return RedirectToAction("CheckUser", "User");
}
else
{
Response.Write("<script> alert('Kullanıcı adı veya şifre hatalı !'); </script>");
}
return View();
}
public ActionResult CheckUser()
{
if (LoggedUserInfo.Rank==3)
{
return RedirectToAction("MainPage", "Books");
}
else if (LoggedUserInfo.Rank==1)
{
return RedirectToAction("AdminMainPage", "Admin");
}
else
{
return RedirectToAction("Login", "User");
}
}
public ActionResult LogOut()
{
FormsAuthentication.SignOut();
Session.Abandon();
LoggedUserInfo.Mail = "";
LoggedUserInfo.Pass = "";
LoggedUserInfo.Rank = -1;
return RedirectToAction("Login", "User");
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Mvc_Deneme_ArabaSitesi.Models;
namespace Mvc_Deneme_ArabaSitesi.Controllers
{
public class BrandController : Controller
{
ArabaYoutubeEntities1 db = new ArabaYoutubeEntities1();
public ActionResult ListBrands()
{
var listBrands = db.TableBrand.ToList();
return View(listBrands);
}
}
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using Yemek_Sitesi_MVC.Models;
using Yemek_Sitesi_MVC.Models.Classes;
namespace Yemek_Sitesi_MVC.Controllers
{
public class UserController : Controller
{
Yemek_Sitesi_VeritabanıEntities1 db = new Yemek_Sitesi_VeritabanıEntities1();
[HttpGet]
public ActionResult SignUp()
{
return View();
}
[HttpPost]
public ActionResult SignUp(YöneticiTablosu tempUser)
{
if (ModelState.IsValid)
{
var shaPass = Sha265Converter.ComputeSha256Hash(tempUser.Şifre);
tempUser.Şifre = shaPass;
db.YöneticiTablosu.Add(tempUser);
db.SaveChanges();
}
return View();
}
[HttpGet]
public ActionResult SignIn()
{
return View();
}
[HttpPost]
public ActionResult SignIn(YöneticiTablosu tempUser)
{
if (ModelState.IsValid)
{
var hashedPas = Sha265Converter.ComputeSha256Hash(tempUser.Şifre);
var loggingUser = db.YöneticiTablosu.Where(i => i.KullanıcıAdı == tempUser.KullanıcıAdı && i.Şifre == hashedPas).SingleOrDefault();
if (loggingUser == null)
{
Response.Write("Username or password is wrong !");
}
else if (loggingUser.KullanıcıAdı=="Admin")
{
Response.Write("Login success");
GlobalVariables.loggedUser = loggingUser;
return RedirectToAction("AdminListRecipes", "Admin");
}
else
{
Response.Write("Login success");
GlobalVariables.loggedUser = loggingUser;
return RedirectToAction("MainPageForUsers", "Recipe");
}
}
return View();
}
public ActionResult LogOut()
{
FormsAuthentication.SignOut();
Session.Abandon();
GlobalVariables.loggedUser = null;
return RedirectToAction("SignIn");
}
[HttpGet]
public ActionResult UserSettings()
{
var selectedUser = GlobalVariables.loggedUser;
return View(selectedUser);
}
[HttpPost]
public ActionResult UserSettings(YöneticiTablosu tempUser)
{
if (Sha265Converter.ComputeSha256Hash( tempUser.oldPassword)==GlobalVariables.loggedUser.Şifre)
{
var editingUser = db.YöneticiTablosu.Where(i => i.KullanıcıAdı == GlobalVariables.loggedUser.KullanıcıAdı).SingleOrDefault();
editingUser.Şifre =Sha265Converter.ComputeSha256Hash( tempUser.NewPassword);
db.SaveChanges();
return RedirectToAction("MainPageForUsers", "Recipe");
}
else
{
Response.Write("Eski şifre yanlış !");
return RedirectToAction("UserSettings");
}
}
}
} | af7575f277bd312bc384d222dac6e864e6168c08 | [
"C#"
] | 34 | C# | emirgorkemozdemir/Mvc-Projects | 6d474c693ac9723d826ea9d0082a073a5514903f | 6e638390a06dabc4164d55af02d86420cb567652 |
refs/heads/master | <file_sep>**无感支付**<file_sep>const fs = require("fs");
const path = require("path");
const moment = require('moment');
const tools = require('../../utils/tools');
module.exports = function (router) {
router.get('/heartbeat', async (ctx) => {
ctx.body = {
code: 200,
date: moment().format("YYYY-MM-DD hh:mm:ss")
};
});
router.post('/tt', async (ctx) => {
console.log(ctx.request.body);
let r = await tools.diff('diff ./data/v001.txt ./data/v002.txt');
console.log('git', r);
ctx.body = r;
});
router.get('/t1', async (ctx) => {
let v1 = fs.readFileSync('./data/v001.txt');
console.log('t1', v1);
ctx.body = v1.toString();
});
router.get('/t2', async (ctx) => {
let file1 = path.join(__dirname, "../../data/v001.txt");
let file2 = path.join(__dirname, "../../data/v002.txt");
let r = await tools.diff(`diff -c ${file1} ${file2}`);
let diffs = r.split('\n');
//console.log(diffs);
let left={},right={}, groups=[], group={p1:-1,p2:-1,p3:-1,p4:-1};
let rowType = 0;
let beginend = {};
for(let line of diffs){
if(line === '***************') {
group={p1:-1,p2:-1,p3:-1,p4:-1};
groups.push(group);
continue;
}
if(line.search(/\*\*\* (\S*) \*\*\*\*/) !== -1){
rowType = 1;
beginend = getBeginEnd(line, /\*\*\* (\S*) \*\*\*\*/);
//console.log('beginend', beginend);
continue;
}
if(line.search(/\-\-\- (\S*) \-\-\-\-/) !== -1){
rowType = 2;
beginend = getBeginEnd(line, /\-\-\- (\S*) \-\-\-\-/);
//console.log('beginend', beginend);
continue;
}
if(rowType === 1){
if(line[0] !== ' '){
left['row_' + beginend.begin.toString()] = {row:beginend.begin,content:line};
if(group.p1 === -1){
group.p1 = beginend.begin;
}else {
group.p4 = beginend.begin;
}
}
beginend.begin++;
}
if(rowType === 2){
if(line[0] !== ' '){
right['row_' + beginend.begin.toString()] = {row:beginend.begin,content:line};
if(group.p2 === -1){
group.p2 = beginend.begin;
}else {
group.p3 = beginend.begin;
}
}
beginend.begin++;
}
}
let v1 = fs.readFileSync(file1);
let v2 = fs.readFileSync(file2);
let lines1 = v1.toString().split('\n');
let lines2 = v2.toString().split('\n');
lines1 = adapter(lines1, left);
lines2 = adapter(lines2, right);
//console.log(lines1);
console.log('left',left);
console.log('right',right);
console.log('groups',groups);
await ctx.render('index', {left:lines1, right:lines2, groups:JSON.stringify(groups)});
});
function adapter(lines, diff){
let result = [];
for(let i=0;i<lines.length;i++){
let line = lines[i];
let d = '';
if(diff.hasOwnProperty('row_' + (i+1))){
d = diff['row_' + (i+1)];
}
result.push({content:line, diff:d});
}
return result;
}
function getBeginEnd(line, rex){
let temp = line.match(rex);
let nums = temp[1].split(',');
return {begin:parseInt(nums[0]) , end: parseInt(nums[1]) };
}
router.get('/t3', async (ctx) => {
let file1 = path.join(__dirname, "../../data/v001.txt");
let file2 = path.join(__dirname, "../../data/v002.txt");
let r = await tools.diff(`diff ${file1} ${file2}`);
let diffs = r.split('\n');
let groups = getGroups(diffs);
for(let group of groups){
let t = getLeftRightRelation(group);
console.log('t', t);
}
console.log('groups', groups);
});
function getGroups(rows){
let groups = [], group = {head:'', rows:[]};
for(let row of rows){
if(row[0] === '<' || row[0] === '>' || row[0] === '-'){
group.rows.push(row);
}else if(row){
// new group
group = { rows:[], head:splitLeftRight(row)};
groups.push(group);
}
}
return groups;
}
function getLeftRightRelation(group){
let leftRows=[],rightRows=[],relations=[];
for(let row of group.rows){
if(row[0] === '<'){
leftRows.push({row:group.head.leftBegin,content: row});
group.head.leftBegin++;
}
if(row[0] === '>'){
rightRows.push({row:group.head.rightBegin,content: row});
group.head.rightBegin++;
}
}
return {leftRows,rightRows,relations};
}
function splitLeftRight(head){
let temps = [];
if(head.indexOf('a')>-1) temps = head.split('a');
if(head.indexOf('c')>-1) temps = head.split('c');
if(head.indexOf('d')>-1) temps = head.split('d');
return {'leftBegin':getBeginRow(temps[0]), 'rightBegin':getBeginRow(temps[1]), content:head};
}
function getBeginRow(str){
let temps = str.split(',');
return parseInt(temps[0]);
}
};
| 4daa1daea1689ec19c425214fadae1d8e959ccf5 | [
"Markdown",
"JavaScript"
] | 2 | Markdown | ycysvler/compare | f671ccc2d0704637d55245b884aa0b16c281b502 | a68b3202711f0975eca8857c503799822e435135 |
refs/heads/master | <repo_name>Hiryu70/WordAddIns<file_sep>/WordAddIns/WordAddIn/Ribbon.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using System.IO;
using Word = Microsoft.Office.Interop.Word;
namespace WordAddIn
{
public partial class Ribbon
{
private void Ribbon_Load(object sender, RibbonUIEventArgs e)
{
}
private void button1_Click(object sender, RibbonControlEventArgs e)
{
string desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string fileName = "QuickExport.pdf";
Globals.ThisAddIn.Application.ActiveDocument.ExportAsFixedFormat(
Path.Combine(desktopFolder, fileName),
Word.WdExportFormat.wdExportFormatPDF,
OpenAfterExport: true);
}
}
}
| c2a9f6cc8e8918a8b8a98578e4c114713950ab73 | [
"C#"
] | 1 | C# | Hiryu70/WordAddIns | 358bbe63420afbddf80b80585c733ae82f9cdde9 | 236281dad03c7a9b251205e1866ec0c6b9cf7c80 |
refs/heads/master | <file_sep>import mechanicalsoup, re
from sys import argv
import os
'''
if 'RDS_HOSTNAME' in os.environ:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ['RDS_DB_NAME'],
'USER': os.environ['RDS_USERNAME'],
'PASSWORD': os.environ['RDS_PASSWORD'],
'HOST': os.environ['RDS_HOSTNAME'],
'PORT': os.environ['RDS_PORT'],
}
}
'''
'''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'ebdb',
'USER': 'farallon',
'PASSWORD': '<PASSWORD>',
'HOST': 'aau22sqmew94ym.csniiwsrgjcu.us-west-2.rds.amazonaws.com',
'PORT': '3306',
}
}
'''
loginInfo = { 'LOGIN':"login",
'PASSWORD':"<PASSWORD>",
'USER_NAME': "username"}
configFile = "login.config.me"
URL = "https://www.midpeninsulawater.org/billpay/"
def readConfigFile():
with open(configFile) as fp:
for line in fp:
entry = line.split(":")
key = entry[0].strip()
val = entry[1].strip()
loginInfo[key] = val
# print("this is logininfo", loginInfo)
def writeFile(content, filename):
with open(filename, 'w') as op:
op.write(content)
op.close()
def getLoginInfo(browser):
login_page = browser.get(URL)
login_form = login_page.soup.find("form", {"class":"ywploginform"})
login_form.find("input", {"name": "login[username]"})["value"]= loginInfo['LOGIN']
login_form.find("input", {"name": "login[password]"})["value"] = loginInfo['PASSWORD']
response = browser.submit(login_form, login_page.url)
return response
def handleWaterLogin():
# create a browser object
browser = mechanicalsoup.Browser()
response = getLoginInfo(browser)
if response:
print("Your're connected as " + loginInfo['USER_NAME'])
# print response
else:
print("Not connected")
return response, browser
def getWaterAccountMain(response):
acctText = ""
acctInfo = response.soup
if acctInfo:
# acctText = acctInfo.get_text() # get text only
acctText = acctInfo
# print ("Got acct info")
# print(acctInfo)
writeFile(str(acctInfo), "wat.html")
return acctText
def getWaterBillHistory(response, browser):
historyPage = ""
for link in response.soup.find_all('a'):
availUrls = str(link.get('href'))
if re.search(r"history", availUrls):
print "link found for history, following...."
print(link.get('href'))
history_page = browser.get(availUrls)
if history_page:
print ("Got history page")
historyPage = history_page.soup.get_text()
return historyPage
def waterProcess():
readConfigFile()
response , browser = handleWaterLogin()
acctInfo = getWaterAccountMain(response)
historyPage = getWaterBillHistory(response, browser)
def main():
waterProcess()
if __name__ == "__main__":
main()
# print " ================================"
<file_sep>#!/usr/bin/python
#config file containing credentials for rds mysql instance
db_username = "farallon"
db_password = "<PASSWORD>"
db_name = "ebdb123"
db_endpoint = "mysqlforlambdatest.csniiwsrgjcu.us-west-2.rds.amazonaws.com"
<file_sep>google-api-python-client==1.5.5
httplib2==0.9.2
oauth2client==4.0.0
pyasn1==0.1.9
pyasn1-modules==0.0.8
rsa==3.4.2
six==1.10.0
uritemplate==3.0.0
requests==2.12.5
beautifulsoup4==4.5.3
MechanicalSoup==0.6.0
MySQL-python==1.2.3
<file_sep>
<h2>Water Bill payment Script To be run on AWS Lambda. </h2>
<h4>Purpose:</h4>
<ul>
<li> to get water bill info
<li> remind to submit online payment (unfortunately there is no auto pay option, old website)
<li> forward bill info to housemates and remind them of what portion is due.
</ul>
<h4>Todo</h4>
<ul>
<li> put the username and password credentials into a file called
login.config.me
<li> reminder to submit payment to my txt message or slack integration
<li> reminder to house mates by email and txt message of actual bill due and their portion.
<li> AWS lambda integration
</ul>
https://github.com/christinasc/farallonWaterBill.git | 99430f942200441d89fbf1f289cb62bad8dbce4f | [
"Markdown",
"Python",
"Text"
] | 4 | Python | christinasc/farallonWaterBill | cf7eab5f0fc9ca8c6bf957fd71b77211c727fa46 | 7bd5f444600cbecc022b2df92b85b965a83ace89 |
refs/heads/master | <repo_name>chuksgpfr/Tweet-Miner<file_sep>/piada/src/app/dash/editapidetails/editapidetails.component.ts
import { Component, OnInit } from '@angular/core';
import { DashService } from 'src/app/services/dash.service';
import { FormBuilder, Validators } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-editapidetails',
templateUrl: './editapidetails.component.html',
styleUrls: ['./editapidetails.component.css']
})
export class EditapidetailsComponent implements OnInit {
constructor(private dashService: DashService, private fb: FormBuilder, private toastr: ToastrService) { }
ngOnInit() {
}
apiForm = this.fb.group({
APIKey:['',Validators.required],
APISecretKey: ['',Validators.required],
AccessToken: ['',Validators.required],
AccessTokenSecret: ['',Validators.required]
});
get apikey(){
return this.apiForm.get('APIKey');
}
get apisecretkey(){
return this.apiForm.get('APISecretKey');
}
get accesstoken(){
return this.apiForm.get('AccessToken');
}
get accesstokensecret(){
return this.apiForm.get('AccessTokenSecret');
}
updateAPI(){
const body = {
APIKey : this.apikey.value,
APISecretKey: this.apisecretkey.value,
AccessToken: this.accesstoken.value,
AccessTokenSecret: this.accesstokensecret.value
}
this.dashService.editapidetails(body).subscribe(
(res:any)=>{
this.toastr.success('API details updated successful');
},
err=>{
if(err.status == 400){
this.toastr.error('All fields are required');
}else{
console.log(err)
}
}
)
}
}
<file_sep>/PiadaAPI/PiadaAPI/ViewModels/EditApiDetailsViewModel.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.ViewModels
{
public class EditApiDetailsViewModel
{
[Required]
public string APIKey { get; set; }
[Required]
public string APISecretKey { get; set; }
[Required]
public string AccessToken { get; set; }
[Required]
public string AccessTokenSecret { get; set; }
}
}
<file_sep>/piada/src/assets/pages/footable.init.js
/*
Template Name: Fadmin - Responsive Bootstrap Admin Dashboard
Author: ThemesBoss
File: Main Js File
*/
$('#footable_exa').footable({
"sorting": {
"enabled": true
}
});<file_sep>/PiadaAPI/PiadaAPI/Data/ApplicationDbContext.cs
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using PiadaAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.Data
{
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
public DbSet<ApplicationUser> ApplicationUsers { get; set; }
public DbSet<APIDetails> APIDetails { get; set; }
public DbSet<PullDetails> PullDetails { get; set; }
}
}
<file_sep>/PiadaAPI/PiadaAPI/ViewModels/JsonViewModel.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.ViewModels
{
public class JsonViewModel
{
public string Tweet { get; set; }
public string Location { get; set; }
public int RetweetCount { get; set; }
}
}
<file_sep>/piada/src/app/app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { RegisterComponent } from './home/register/register.component';
import { LoginComponent } from './home/login/login.component';
import { DashComponent } from './dash/dash.component';
import { AuthGuard } from './auth/auth.guard';
import { PulltweetsComponent } from './dash/pulltweets/pulltweets.component';
import { ApidetailsComponent } from './dash/apidetails/apidetails.component';
import { EditapidetailsComponent } from './dash/editapidetails/editapidetails.component';
import { YourfolderComponent } from './dash/yourfolder/yourfolder.component';
import { TrendsComponent } from './dash/trends/trends.component';
import { VisualComponent } from './dash/visual/visual.component';
import { VisualCircleComponent } from './dash/visual-circle/visual-circle.component';
const routes: Routes = [
{path: '', redirectTo:'/login', pathMatch:'full'},
{path: '', children:[
{path:'register', component: RegisterComponent},
{path:'login', component: LoginComponent},
{path:'dashboard', children:[
{path:'', component: DashComponent},
{path:'minetweet', component:PulltweetsComponent},
{path:'minetweet/:keyword', component:PulltweetsComponent},
{path:'apidetails', component:ApidetailsComponent},
{path:'editapidetails', component:EditapidetailsComponent},
{path: 'yourfolder', component:YourfolderComponent},
{path: 'trends', component:TrendsComponent},
{path: 'visual/:filename', component:VisualComponent},
{path: 'visual-circle/:filename', component:VisualCircleComponent}
], canActivate:[AuthGuard]}
]}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
<file_sep>/PiadaAPI/PiadaAPI/Models/ExcelNodesChild.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.Models
{
public class ExcelNodesChild
{
public string State { get; set; }
public string Country { get; set; }
public bool ShowChildren { get; set; }
public long Total { get; set; }
public List<ExcelJson> Children { get; set; }
}
}
<file_sep>/PiadaAPI/PiadaAPI/Repository/IUserRepo.cs
using Microsoft.AspNetCore.Identity;
using PiadaAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.Repository
{
public interface IUserRepo
{
Task<ApplicationUser> GetUserById(string userid);
}
public class UserRepo : IUserRepo
{
private readonly UserManager<ApplicationUser> _userManager;
public UserRepo(UserManager<ApplicationUser> userManager)
{
_userManager = userManager;
}
public async Task<ApplicationUser> GetUserById(string userid)
{
try
{
return await _userManager.FindByIdAsync(userid);
}
catch (Exception)
{
throw;
}
}
}
}
<file_sep>/README.md
# Tweet-Miner
This is my Bsc project built with ASP.NET Web API 2.2 and Angular 7
<file_sep>/PiadaAPI/PiadaAPI/Models/Countries.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.Models
{
public class Countries
{
//public string Country { get; set; }
public string Country { get; set; }
public string[] States { get; set; }
}
}
<file_sep>/PiadaAPI/PiadaAPI/Models/ExcelJson.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.Models
{
public class ExcelJson
{
public string Tweet { get; set; }
public string Location { get; set; }
public string Amount { get; set; }
}
}
<file_sep>/piada/src/app/dash/trends/trends.component.ts
import { Component, OnInit } from '@angular/core';
import { DashService } from 'src/app/services/dash.service';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-trends',
templateUrl: './trends.component.html',
styleUrls: ['./trends.component.css']
})
export class TrendsComponent implements OnInit {
details:any=[];
location = "";
constructor(private dashService: DashService, private toastr: ToastrService ) { }
ngOnInit() {
const body ={
WoeID: "1"
}
this.dashService.gettrends(body).subscribe(
(res:any)=>{
if(res.status == 200){
this.details = res.trending;
this.location = res.location;
console.log("The data is "+this.details)
}else{
this.details = res.trending;
this.location = res.location;
console.log(this.details)
}
},
err=>{
console.log(err)
}
)
}
getTrends(woeid){
const body ={
WoeID: woeid
}
this.dashService.gettrends(body).subscribe(
(res:any)=>{
if(res.status == 200){
this.details = res;
console.log("The data is "+this.details)
}else{
this.details = res.trending;
this.location = res.location;
console.log(this.details)
}
},
err=>{
console.log(err)
}
)
}
}
<file_sep>/piada/src/app/home/login/login.component.ts
import { Component, OnInit } from '@angular/core';
import { HomeService } from 'src/app/services/home.service';
import { FormBuilder, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
constructor(private homeService: HomeService, private fb: FormBuilder, private router: Router, private toastr: ToastrService) { }
ngOnInit() {
if(localStorage.getItem('piadatoken') != null){
return this.router.navigate(['/dashboard'])
}
}
loginForm = this.fb.group({
Email : ['',[Validators.required, Validators.email]],
Password : ['', Validators.required]
})
get email(){
return this.loginForm.get('Email');
}
get password(){
return this.loginForm.get('Password');
}
login(){
const body = {
Email: this.email.value,
Password: this.password.value
}
this.homeService.loginUser(body).subscribe(
(res:any)=>{
localStorage.setItem('piadatoken', res.token)
this.toastr.success('Login Successful')
this.router.navigateByUrl('/dashboard')
},
err=>{
if(err.status == 400)
this.toastr.error('Incorrect username or password','Authentication error')
else
console.log(err)
}
)
}
}
<file_sep>/piada/src/app/services/home.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class HomeService {
constructor(private http: HttpClient) { }
private readonly baseUrl = "https://localhost:44349/api/home/"
registerUsers(body){
return this.http.post(this.baseUrl+"register", body);
}
loginUser(body){
return this.http.post(this.baseUrl+"login", body);
}
}
<file_sep>/piada/src/app/dash/visual/visual.component.ts
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { DashService } from 'src/app/services/dash.service';
@Component({
selector: 'app-visual',
templateUrl: './visual.component.html',
styleUrls: ['./visual.component.css']
})
export class VisualComponent implements OnInit {
constructor(private currentRoute: ActivatedRoute, private dashService: DashService) { }
fileData:any = [];
check = true;
filename:string='';
ngOnInit() {
this.currentRoute.paramMap.subscribe(
params=>{
let word = params.get('filename')
this.filename = word;
console.log(word)
});
this.dashService.getvisual(this.filename).subscribe(
(data:any)=>{
this.fileData = data;
//console.log(data);
console.log(this.fileData);
},
err=>{
console.log(err)
}
);
}
toggleChildren(node){
//console.log('open')
node.showChildren = !node.showChildren;
}
// youTree = [
// {
// name: 'first elem',
// id: 1234567890,
// childrens: [
// {
// name: 'first child elem',
// id: 0987654321,
// childrens: []
// }
// ]
// },
// ];
node = this.fileData;
nodes = [
{
name: 'Africa',
showChildren: false,
children:[
{
name : 'Algeria',
showChildren: false,
children:[
{
name : 'Algeris',
showChildren: false,
children:[]
},
{
name : 'Algeria child 2',
showChildren: false,
children:[
]
},
]
},
{
name : 'Angola',
showChildren: false,
children:[]
},
{
name : 'Benin',
showChildren: false,
children:[]
},
]
},
{
name: 'Asia',
showChildren: false,
children:[
{
name : 'Afghanistan',
showChildren: false,
children:[
{
name : 'Kabul',
showChildren: false,
children:[]
}
]
},
{
name : 'Armenia',
showChildren: false,
children:[]
},
{
name : 'Azerbaijan',
showChildren: false,
children:[]
},
]
},
{
name: 'Europe',
showChildren: false,
children:[
{
name : 'Romania',
showChildren: false,
children:[
{
name : 'Bucuresti',
showChildren: false,
children:[]
}
]
},
{
name : 'Hungary',
showChildren: false,
children:[]
},
{
name : 'Benin',
showChildren: false,
children:[]
},
]
},
{
name: 'North America',
showChildren: false,
children: []
}
]
}
<file_sep>/piada/src/app/home/register/register.component.ts
import { Component, OnInit } from '@angular/core';
import { HomeService } from 'src/app/services/home.service';
import { FormBuilder, Validators } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
import { Router } from '@angular/router';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {
constructor(private homeService: HomeService, private fb: FormBuilder, private toastr: ToastrService, private router: Router) { }
ngOnInit() {
if(localStorage.getItem('piadatoken') != null){
return this.router.navigate(['/dashboard'])
}
}
regForm = this.fb.group({
Firstname: ['',Validators.required],
Lastname: ['',Validators.required],
Email: ['',[Validators.required, Validators.email]],
Username: ['',Validators.required],
Passwords: this.fb.group({
Password: ['',Validators.required],
ConfirmPassword: ['',Validators.required]
})
});
get firstname(){
return this.regForm.get('Firstname');
}
get lastname(){
return this.regForm.get('Lastname');
}
get email(){
return this.regForm.get('Email');
}
get username(){
return this.regForm.get('Username');
}
get password(){
return this.regForm.get('<PASSWORD>');
}
get confirmPassword(){
return this.regForm.get('<PASSWORD>');
}
register(){
const body = {
Firstname:this.firstname.value,
Lastname: this.lastname.value,
Email: this.email.value,
Username: this.username.value,
Password: this.password.value
}
this.homeService.registerUsers(body).subscribe(
(res:any)=>{
if(res.succeeded){
this.toastr.success('Registration Successful','Log into your dashboard');
this.router.navigateByUrl('/login');
}else{
res.forEach((element:any) => {
this.toastr.error(element.description)
});
}
},
err=>{
console.log(err)
}
);
}
}
<file_sep>/piada/src/app/models/treenode.ts
export interface TreeNode {
country:string;
showChildren: boolean;
children: any[];
state:string;
tweet: string;
location: string;
amount: string;
}<file_sep>/PiadaAPI/PiadaAPI/Models/ExcelNodes.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.Models
{
public class ExcelNodes
{
public string Country { get; set; }
public bool ShowChildren { get; set; }
public List<ExcelNodesChild> Children { get; set; }
}
}
<file_sep>/piada/src/app/dash/yourfolder/yourfolder.component.ts
import { Component, OnInit } from '@angular/core';
import { DashService } from 'src/app/services/dash.service';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-yourfolder',
templateUrl: './yourfolder.component.html',
styleUrls: ['./yourfolder.component.css']
})
export class YourfolderComponent implements OnInit {
details:any=[]
constructor(private dashService: DashService, private toastr: ToastrService) { }
ngOnInit() {
this.dashService.index().subscribe(
(res:any)=>{
this.details = res;
console.log(this.details)
},
err=>{
console.log(err)
}
)
}
download(filename:string){
this.dashService.downloadfile(filename).subscribe(
(data:any)=>{
// if(data.status == 200)
// this.toastr.success('Download in progress...')
//var blob = new Blob([data.blob], {type: '.xlsx'});
saveAs(data,filename+".xlsx")
}
);
}
}
<file_sep>/PiadaAPI/PiadaAPI/ViewModels/PullTweetViewModel.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.ViewModels
{
public class PullTweetViewModel
{
[Required]
public string Keyword { get; set; }
[Required]
public int Quantity { get; set; }
[Required]
public string Title { get; set; }
[Required]
public string From { get; set; }
[Required]
public string To { get; set; }
}
}
<file_sep>/piada/src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
import { NgxTreeDndModule } from 'ngx-tree-dnd';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { RegisterComponent } from './home/register/register.component';
import { LoginComponent } from './home/login/login.component';
import { DashComponent } from './dash/dash.component';
import { PulltweetsComponent } from './dash/pulltweets/pulltweets.component';
import { AuthInterceptor } from './auth/auth.interceptor';
import { ApidetailsComponent } from './dash/apidetails/apidetails.component';
import { EditapidetailsComponent } from './dash/editapidetails/editapidetails.component';
import { YourfolderComponent } from './dash/yourfolder/yourfolder.component';
import { TrendsComponent } from './dash/trends/trends.component';
import { VisualComponent } from './dash/visual/visual.component';
import { TreeComponent } from './dash/tree/tree.component';
import { VisualCircleComponent } from './dash/visual-circle/visual-circle.component';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
HeaderComponent,
FooterComponent,
SidebarComponent,
RegisterComponent,
LoginComponent,
DashComponent,
PulltweetsComponent,
ApidetailsComponent,
EditapidetailsComponent,
YourfolderComponent,
TrendsComponent,
VisualComponent,
TreeComponent,
VisualCircleComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
NgxTreeDndModule,
FormsModule,
ReactiveFormsModule,
BrowserAnimationsModule, // required animations module
ToastrModule.forRoot(
{
progressBar:true
}
) // ToastrModule added
],
providers: [{
provide: HTTP_INTERCEPTORS,
useClass: AuthInterceptor,
multi: true
}],
bootstrap: [AppComponent]
})
export class AppModule { }
<file_sep>/PiadaAPI/PiadaAPI/Migrations/20190512220522_corrected api details table.cs
using Microsoft.EntityFrameworkCore.Migrations;
namespace PiadaAPI.Migrations
{
public partial class correctedapidetailstable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ApiToken",
table: "APIDetails",
newName: "AccessTokenSecret");
migrationBuilder.RenameColumn(
name: "ApiSecretToken",
table: "APIDetails",
newName: "AccessToken");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "AccessTokenSecret",
table: "APIDetails",
newName: "ApiToken");
migrationBuilder.RenameColumn(
name: "AccessToken",
table: "APIDetails",
newName: "ApiSecretToken");
}
}
}
<file_sep>/piada/src/app/services/dash.service.ts
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { catchError } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class DashService {
private readonly baseUrl = "https://localhost:44349/api/dashboard/"
constructor(private http: HttpClient) { }
index(){
//var header = new HttpHeaders({'Authorization':'Bearer '+localStorage.getItem('piadatoken')});
return this.http.get(this.baseUrl+"index")
}
editapidetails(body){
return this.http.post(this.baseUrl+"updateapidetails",body);
}
getapidetails(){
return this.http.get(this.baseUrl+"getapidetails");
}
pulltweet(body){
return this.http.post(this.baseUrl+"pulltweets", body);
}
downloadfile(filename:string) : Observable<Blob>{
//let options = new RequestOptions({responseType: ResponseContentType.Blob})
return this.http.get(this.baseUrl+"Download?fileName="+filename, {responseType: 'blob'});
}
gettrends(body){
return this.http.post(this.baseUrl+"GetCountryTrend",body);
}
getvisual(fileName){
return this.http.get(this.baseUrl+"visualize?filename="+fileName);
}
// createcsv(){
// return this.http.get(this.baseUrl+"createcsv");
// }
}
<file_sep>/PiadaAPI/PiadaAPI/Repository/IContextRepo.cs
using Microsoft.EntityFrameworkCore;
using PiadaAPI.Data;
using PiadaAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PiadaAPI.Repository
{
public interface IContextRepo
{
bool IsDetailsEmpty(ApplicationUser user);
void Create(object details);
void Update(object details);
APIDetails GetAPIDetails(ApplicationUser user);
IEnumerable<PullDetails> GetUserPullDetails(ApplicationUser user);
bool FileNameExist(string fileName);
}
class ContextRepo : IContextRepo
{
private ApplicationDbContext _context;
public ContextRepo(ApplicationDbContext context)
{
_context = context;
}
public void Create(object details)
{
try
{
_context.Add(details);
_context.SaveChanges();
}
catch (Exception)
{
throw;
}
}
public bool FileNameExist(string fileName)
{
try
{
var filename = _context.PullDetails.FirstOrDefault(x=>x.FileName == fileName);
if (filename != null)
{
return true;
}
else
{
return false;
}
}
catch (Exception)
{
throw;
}
}
public APIDetails GetAPIDetails(ApplicationUser user)
{
try
{
return _context.APIDetails.FirstOrDefault(x => x.User == user);
}
catch (Exception)
{
throw;
}
}
public IEnumerable<PullDetails> GetUserPullDetails(ApplicationUser user)
{
try
{
return _context.PullDetails.Where(x => x.User == user);
}
catch (Exception)
{
throw;
}
}
public bool IsDetailsEmpty(ApplicationUser user)
{
try
{
var api = _context.APIDetails.FirstOrDefault(x => x.User == user);
if (api == null)
{
return true;
}
else
{
return false;
}
}
catch (Exception)
{
throw;
}
}
public void Update(object details)
{
try
{
_context.Update(details).State = EntityState.Modified;
_context.SaveChanges();
}
catch (Exception)
{
throw;
}
}
}
}
<file_sep>/PiadaAPI/PiadaAPI/Controllers/DashboardController.cs
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PiadaAPI.Helpers;
using PiadaAPI.Models;
using PiadaAPI.Repository;
using PiadaAPI.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Tweetinvi;
using Tweetinvi.Models;
using Tweetinvi.Parameters;
namespace PiadaAPI.Controllers
{
[Route("api/[controller]/[action]")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class DashboardController : ControllerBase
{
private IUserRepo _userRepo;
private IContextRepo _contextRepo;
private IHelperService _helper;
public DashboardController(IUserRepo userRepo, IContextRepo contextRepo, IHelperService helper)
{
_userRepo = userRepo;
_contextRepo = contextRepo;
_helper = helper;
}
[HttpGet]
public async Task<ActionResult> Index()
{
string userId = User.Claims.First(x => x.Type == "UserID").Value;
ApplicationUser user = await _userRepo.GetUserById(userId);
var apidetailsempty = _contextRepo.IsDetailsEmpty(user);
var pullDetails = _contextRepo.GetUserPullDetails(user);
//calculate daily pull
double days = (DateTime.UtcNow - user.DateUpdated).TotalDays;
double daypull = pullDetails.Count() / days;
return Ok(new
{
user.Firstname,
user.Lastname,
user.Email,
apidetailsempty,
details = pullDetails,
totalpull = pullDetails.Count(),
dailypull = string.Format("{0:F2}", daypull)
});
}
[HttpPost]
public async Task<ActionResult> UpdateApiDetails([FromBody]EditApiDetailsViewModel model)
{
if (ModelState.IsValid)
{
string userId = User.Claims.First(x => x.Type == "UserID").Value;
ApplicationUser user = await _userRepo.GetUserById(userId);
APIDetails details = _contextRepo.GetAPIDetails(user);
if (details == null)
{
var apiDetails = new APIDetails()
{
User = user,
ApiKey = model.APIKey,
ApiSecretKey = model.APISecretKey,
AccessTokenSecret = model.AccessTokenSecret,
AccessToken = model.AccessToken,
DateUpdated = DateTime.UtcNow
};
_contextRepo.Create(apiDetails);
}
else
{
details.ApiKey = model.APIKey;
details.ApiSecretKey = model.APISecretKey;
details.AccessTokenSecret = model.AccessTokenSecret;
details.AccessToken = model.AccessToken;
details.DateUpdated = DateTime.UtcNow;
_contextRepo.Update(details);
}
return Ok();
}
return BadRequest();
}
[HttpGet]
public async Task<ActionResult> GetApiDetails()
{
string userId = User.Claims.First(x => x.Type == "UserID").Value;
ApplicationUser user = await _userRepo.GetUserById(userId);
var apiDetails = _contextRepo.GetAPIDetails(user);
return Ok(new
{
apiDetails.AccessToken,
apiDetails.AccessTokenSecret,
apiDetails.ApiKey,
apiDetails.ApiSecretKey,
apiDetails.DateUpdated
});
}
[HttpPost]
public async Task<ActionResult> PullTweets([FromBody]PullTweetViewModel model)
{
if (ModelState.IsValid)
{
var userId = User.Claims.First(x => x.Type == "UserID").Value;
var user = await _userRepo.GetUserById(userId);
APIDetails details = _contextRepo.GetAPIDetails(user);
var tweet = _helper.GetTweets(model, details);
if (tweet.Any())
{
string filename = model.Title;
bool fileExist = _contextRepo.FileNameExist(model.Title);
if (fileExist)
{
filename = model.Title + "_" + Guid.NewGuid();
}
_helper.CreateCsv(tweet, filename);
var pullDetails = new PullDetails()
{
User = user,
Title = model.Title,
Keyword = model.Keyword,
FileName = filename,
Quantity = model.Quantity,
Date = DateTime.UtcNow
};
_contextRepo.Create(pullDetails);
return Ok();
}
return Ok("tweet is null");
}
return BadRequest();
}
[HttpGet]
public FileResult Download([FromQuery]string filename)
{
var fileName = $"{filename}.xlsx";
var filepath = $"ExcelFiles/{fileName}";
byte[] fileBytes = System.IO.File.ReadAllBytes(filepath);
return File(fileBytes, "application/x-msdownload", fileName);
}
[HttpPost]
public async Task<ActionResult> GetCountryTrend([FromBody]TrendViewModel model)
{
if (ModelState.IsValid)
{
var userId = User.Claims.First(x => x.Type == "UserID").Value;
var user = await _userRepo.GetUserById(userId);
APIDetails details = _contextRepo.GetAPIDetails(user);
long newWoeid = long.Parse(model.WoeID);
var trends = _helper.GetTrendsFromPlace(newWoeid, details);
return Ok(new
{
location=trends.woeIdLocations,
trending = trends.Trends
});
}
return BadRequest("Woe ID is empty");
}
[HttpGet]
public ActionResult Visualize([FromQuery]string filename)
{
var fileName = $"{filename}.xlsx";
var filepath = $"ExcelFiles/{fileName}";
var excelToJson = _helper.GetExcelFile(filepath);
var countryStates = ReadJson();
//the node for showing my tweet and children
List<ExcelNodes> excelNodes = new List<ExcelNodes>();
List<ExcelNodesChild> excelNodeChild = new List<ExcelNodesChild>();
//the json with my tweets
List<ExcelJson> tweetJsons = new List<ExcelJson>();
foreach (var country in countryStates)
{
foreach (var state in country.States)
{
foreach (var tweet in excelToJson)
{
if (tweet.Location.Contains(","))
{
string[] loc = tweet.Location.Split(',');
if (loc[0] == state)
{
var newTweet = new ExcelJson() { Tweet = tweet.Tweet, Location = loc[0], Amount = tweet.Amount };
tweetJsons.Add(newTweet);
}
}
}
var stateTweet = tweetJsons.Where(x => x.Location == state);
int total = 0;
if (stateTweet.Any())
{
foreach (var stt in stateTweet)
{
total += Convert.ToInt32(stt.Amount);
}
var newStateTweet = new ExcelNodesChild() { State = state, Country = country.Country, Total = total, ShowChildren = false, Children = stateTweet.ToList() };
excelNodeChild.Add(newStateTweet);
}
}
var countryTweet = excelNodeChild.Where(x => x.Country == country.Country);
if (countryTweet.Any())
{
var newCountryTweet = new ExcelNodes() { Country = country.Country, Children = countryTweet.ToList(), ShowChildren = false };
excelNodes.Add(newCountryTweet);
}
}
return Ok(excelNodes);
}
public List<Countries> ReadJson()
{
var fileName = "countrystates.json";
var filepath = $"Files/{fileName}";
var file = _helper.ReadJson(filepath);
var tojson = JsonConvert.DeserializeObject<List<Countries>>(file);
return tojson;
}
}
}
<file_sep>/piada/src/app/dash/apidetails/apidetails.component.ts
import { Component, OnInit } from '@angular/core';
import { DashService } from 'src/app/services/dash.service';
@Component({
selector: 'app-apidetails',
templateUrl: './apidetails.component.html',
styleUrls: ['./apidetails.component.css']
})
export class ApidetailsComponent implements OnInit {
apiDetails=[];
constructor(private dashService: DashService) { }
ngOnInit() {
this.dashService.getapidetails().subscribe(
(res:any)=>{
this.apiDetails = res;
},
err=>{
console.log(err)
}
)
}
}
<file_sep>/PiadaAPI/PiadaAPI/Controllers/HomeController.cs
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
using PiadaAPI.Models;
using PiadaAPI.ViewModels;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
namespace PiadaAPI.Controllers
{
[Route("api/[controller]/[action]")]
public class HomeController : ControllerBase
{
private readonly UserManager<ApplicationUser> _userManager;
public IConfiguration _configuration { get; }
public HomeController(UserManager<ApplicationUser> userManager, IConfiguration configuration)
{
_userManager = userManager;
_configuration = configuration;
}
[HttpPost]
public async Task<ActionResult> Register([FromBody]RegisterViewModel model)
{
if (ModelState.IsValid)
{
ApplicationUser newUser = new ApplicationUser()
{
Firstname = model.Firstname,
Lastname = model.Lastname,
Email = model.Email,
UserName = model.Username
};
IdentityResult result = await _userManager.CreateAsync(newUser, model.Password);
if (result.Succeeded)
return Ok(result);
else
return Ok(result.Errors);
}
ModelState.AddModelError("description","All fields are required");
return Ok();
}
[HttpPost]
public async Task<ActionResult> Login([FromBody]LoginViewModel model)
{
if (ModelState.IsValid)
{
ApplicationUser user =await _userManager.FindByEmailAsync(model.Email);
if (user != null && await _userManager.CheckPasswordAsync(user, model.Password))
{
var claims = new[]
{
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(JwtRegisteredClaimNames.UniqueName, user.UserName),
new Claim("UserID", user.Id.ToString()),
new Claim(JwtRegisteredClaimNames.Email, user.Email)
};
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["Jwt:SecretKey"]));
var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
var token = new JwtSecurityToken(
issuer: _configuration["Jwt:Issuer"],
audience: _configuration["Jwt:audience"],
claims: claims,
expires: DateTime.Now.AddDays(14),
signingCredentials: credentials
);
return Ok(new
{
token = new JwtSecurityTokenHandler().WriteToken(token)
});
}
else
return BadRequest(new { description = "Wrong password/email combination" });
}
return BadRequest(new { description = "All fields are required" });
}
}
}
<file_sep>/piada/src/app/dash/pulltweets/pulltweets.component.ts
import { Component, OnInit } from '@angular/core';
import { DashService } from 'src/app/services/dash.service';
import { ToastrService } from 'ngx-toastr';
import { FormBuilder, Validators } from '@angular/forms';
import { ExcelService } from 'src/app/services/excel.service';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-pulltweets',
templateUrl: './pulltweets.component.html',
styleUrls: ['./pulltweets.component.css']
})
export class PulltweetsComponent implements OnInit {
routeKeyword:string='';
pullForm:any;
constructor(private dashService: DashService,private excelService: ExcelService, private toastr: ToastrService, private fb: FormBuilder, private currentRoute: ActivatedRoute) { }
ngOnInit() {
this.currentRoute.paramMap.subscribe(
params=>{
let word = params.get('keyword')
this.routeKeyword = word;
console.log(word)
});
//console.log(this.routeKeyword)
this.pullForm = this.fb.group({
Title: ['',Validators.required],
Keyword: [this.routeKeyword, Validators.required],
Quantity: ['',Validators.required],
From: ['', Validators.required],
To: ['', Validators.required]
})
}
get title(){
return this.pullForm.get('Title');
}
get keyword(){
return this.pullForm.get('Keyword');
}
get quantity(){
return this.pullForm.get('Quantity');
}
get from(){
return this.pullForm.get('From');
}
get to(){
return this.pullForm.get('To');
}
pulltweets(){
const body ={
Title : this.title.value,
Keyword : this.keyword.value,
Quantity : this.quantity.value,
From : this.from.value,
To: this.to.value
}
this.dashService.pulltweet(body).subscribe(
(res:any)=>{
this.toastr.success('Pull Successful', 'You can download and visualize your data...')
},
err=>{
console.log(err)
}
);
}
}
<file_sep>/piada/src/app/dash/visual-circle/visual-circle.component.ts
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { DashService } from 'src/app/services/dash.service';
@Component({
selector: 'app-visual-circle',
templateUrl: './visual-circle.component.html',
styleUrls: ['./visual-circle.component.css']
})
export class VisualCircleComponent implements OnInit {
constructor(private currentRoute: ActivatedRoute, private dashService: DashService) { }
fileData:any = [];
check = true;
filename:string='';
ngOnInit() {
this.currentRoute.paramMap.subscribe(
params=>{
let word = params.get('filename')
this.filename = word;
console.log(word)
});
this.dashService.getvisual(this.filename).subscribe(
(data:any)=>{
this.fileData = data;
//console.log(data);
console.log(this.fileData);
},
err=>{
console.log(err)
}
);
}
}
<file_sep>/PiadaAPI/PiadaAPI/Helpers/IHelperService.cs
using Newtonsoft.Json;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using PiadaAPI.Models;
using PiadaAPI.ViewModels;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using Tweetinvi;
using Tweetinvi.Models;
using Tweetinvi.Parameters;
namespace PiadaAPI.Helpers
{
public interface IHelperService
{
IEnumerable<ITweet> GetTweets(PullTweetViewModel model, APIDetails details);
void CreateCsv(IEnumerable<ITweet> tweets, string title);
IPlaceTrends GetTrendsFromPlace(long woeid, APIDetails details);
List<ExcelJson> GetExcelFile(string filepath);
string ReadJson(string filepath);
}
class HelperService : IHelperService
{
public void CreateCsv(IEnumerable<ITweet> tweets, string title)
{
string folder = "ExcelFiles";
FileInfo file = new FileInfo(Path.Combine(folder,title+".xlsx"));
using(ExcelPackage package = new ExcelPackage(file))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(title);
worksheet.Cells["A1"].Value = "Tweets";
worksheet.Cells["B1"].Value = "Location";
worksheet.Cells["C1"].Value = "Number of retweets";
//worksheet.Cells["A1:B1"].Merge = true;
int i = 2;
foreach (var tweet in tweets)
{
worksheet.Cells["A" + i].Value = tweet.Text;
//worksheet.Cells["A" + i + ":B" + i].Merge = true;
//worksheet.Cells["A" + i + ":B" + i].Style.WrapText = true;
//if (!string.IsNullOrEmpty(tweet.Place.FullName))
// worksheet.Cells["C" + i].Value = tweet.Place.FullName;
//else
// worksheet.Cells["C" + i].Value = "No Location";
if (tweet.Place != null)
{
worksheet.Cells["B" + i].Value = tweet.Place.FullName;
}
else if(tweet.CreatedBy != null)
{
//tweet.CreatedBy.Location
worksheet.Cells["B" + i].Value = tweet.CreatedBy.Location;
}
else
{
worksheet.Cells["B" + i].Value = "No Location";
}
worksheet.Cells["C" + i].Value = tweet.RetweetCount;
i++;
worksheet.Cells.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
worksheet.Cells.AutoFitColumns();
package.Save();
}
}
}
public IPlaceTrends GetTrendsFromPlace(long woeid, APIDetails details)
{
try
{
// Get a AuthenticatedUser from a specific set of credentials
Auth.SetUserCredentials(details.ApiKey, details.ApiSecretKey, details.AccessToken, details.AccessTokenSecret);
var trends = Trends.GetTrendsAt(woeid);
return trends;
}
catch (Exception)
{
throw;
}
}
public IEnumerable<ITweet> GetTweets(PullTweetViewModel model, APIDetails details)
{
try
{
// Get a AuthenticatedUser from a specific set of credentials
Auth.SetUserCredentials(details.ApiKey, details.ApiSecretKey, details.AccessToken, details.AccessTokenSecret);
//var authenticatedUser = User.GetAuthenticatedUser(userCredentials);
var from = Convert.ToDateTime(model.From);
var to = Convert.ToDateTime(model.To);
var searchParameter = new SearchTweetsParameters(model.Keyword)
{
//GeoCode = new GeoCode(9.0820, 8.6753, 1, DistanceMeasure.Miles),
Lang = LanguageFilter.English,
//SearchType = SearchResultType.Popular,
MaximumNumberOfResults = model.Quantity,
//Until = new DateTime(2019, 08, 02),
//Since = from.Date,
//Until = to.Date,
//SinceId = 399616835892781056,
//MaxId = 405001488843284480,
//Filters = TweetSearchFilters.Images | TweetSearchFilters.Verified
};
IEnumerable<ITweet> tweets = Search.SearchTweets(searchParameter);
return tweets;
}
catch (Exception)
{
throw;
}
}
public List<ExcelJson> GetExcelFile(string filepath)
{
try
{
//create a list to hold all the values
List<string> excelData = new List<string>();
List<ExcelJson> newJson = new List<ExcelJson>();
ExcelJson exjs = new ExcelJson();
//read the Excel file as byte array
byte[] bin = File.ReadAllBytes(filepath);
//or if you use asp.net, get the relative path
//byte[] bin = File.ReadAllBytes(Server.MapPath("ExcelDemo.xlsx"));
//create a new Excel package in a memorystream
using (MemoryStream stream = new MemoryStream(bin))
using (ExcelPackage excelPackage = new ExcelPackage(stream))
{
//loop all worksheets
foreach (ExcelWorksheet worksheet in excelPackage.Workbook.Worksheets)
{
//loop all rows
for (int i = worksheet.Dimension.Start.Row + 1; i <= worksheet.Dimension.End.Row; i++)
{
//loop all columns in a row
for (int j = worksheet.Dimension.Start.Column; j <= worksheet.Dimension.End.Column; j++)
{
//add the cell data to the List
//if (worksheet.Cells[i, j].Value != null)
//{
//excelData.Add(worksheet.Cells[i, j].Value.ToString());
newJson.Add(new ExcelJson { Tweet = worksheet.Cells[i, j].Value.ToString(), Location = worksheet.Cells[i, j + 1].Value.ToString(), Amount = worksheet.Cells[i, j+2].Value.ToString() });
j += 2;
//}
}
}
}
}
//var jsonData = JsonConvert.SerializeObject(excelData);
return newJson;
//return jsonData;
//return excelData;
}
catch (Exception)
{
throw;
}
}
public string ReadJson(string filepath)
{
try
{
return File.ReadAllText(filepath);
}
catch (Exception)
{
throw;
}
}
}
}
<file_sep>/piada/src/app/dash/tree/tree.component.ts
import { Component, OnInit, Input } from '@angular/core';
import { TreeNode } from 'src/app/models/treenode';
@Component({
selector: 'app-tree',
templateUrl: './tree.component.html',
styleUrls: ['./tree.component.css']
})
export class TreeComponent implements OnInit {
imageUrl = "assets/icons/plus.png";
constructor() { }
ret = "Num of retweet";
@Input() treeData: TreeNode[];
ngOnInit() {
}
toggleChild(node) {
node.showChildren = !node.showChildren;
if(node.showChildren){
this.imageUrl = "assets/icons/minus.png";
}else{
this.imageUrl = "assets/icons/plus.png";
}
}
}
| 47e13d472185a56d6f053aedd1ac358f6b217cc4 | [
"JavaScript",
"C#",
"TypeScript",
"Markdown"
] | 31 | TypeScript | chuksgpfr/Tweet-Miner | bcaadb5d21994ab479249742550d2b889dd0f7bb | 6ac05d1af745810b1a076f8b2392a93553fa7033 |
refs/heads/master | <repo_name>srmagura/jest-timer-repro<file_sep>/README.md
# jest-timer-repro
Demonstrates a potential bug with Jest fake timers.
Repro steps:
1. `yarn install`
2. `yarn test`
<file_sep>/index.test.ts
import "jest";
beforeEach(() => {
jest.useFakeTimers();
});
function delay(duration: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, duration));
}
// PASS
it("delays", async () => {
const p = delay(100);
jest.runAllTimers();
expect(await p).toBeUndefined();
});
// PASS
it("delays once in a function", async () => {
async function f(): Promise<void> {
await delay(100);
}
const p = f();
jest.runAllTimers();
expect(await p).toBeUndefined();
});
// FAIL: Exceeded timeout of 5000 ms for a test.
it("delays twice in a function", async () => {
async function f(): Promise<void> {
await delay(100);
await delay(100);
}
const p = f();
jest.runAllTimers();
jest.runAllTimers();
jest.runAllTimers();
jest.runAllTimers();
expect(await p).toBeUndefined();
});
// PASS
it("delays twice in a function using real timers", async () => {
jest.useRealTimers();
async function f(): Promise<void> {
await delay(100);
await delay(100);
}
const p = f();
expect(await p).toBeUndefined();
});
| 601d85cd04ea033a989aa870b8cf9e771ee3efd4 | [
"Markdown",
"TypeScript"
] | 2 | Markdown | srmagura/jest-timer-repro | 6d5681426623f38374337e43d183b0918abf5096 | b2229f4c6b84cdc33da63401c11b8d03ff999e4b |
refs/heads/master | <repo_name>huaiwen/C0Compiler<file_sep>/nametable.cpp
#include "nametable.h"
nametable::nametable()
{
//val = -99999999;
adr = -99999999;
name = "";
}
nametable::~nametable(void)
{
}
nametable::nametable(string s1, int a, int b, string s2)
{
name = s1;
//val = a;
level = b;
belongto = s2;
kind = var;
adr = -1;
}
nametable::nametable(string s1, int a, string s2)
{
name = s1;
level = a;
belongto = s2;
kind = procedur;
adr = -1;
size = -1;
}
<file_sep>/main.cpp
#include "Block.h"
using namespace std;
int main()
{
Block bc;
bc.main();
system("pause");
return 0;
}<file_sep>/Lex.cpp
#include "Lex.h"
#include<fstream>
#include <iostream>
using namespace std;
Lex::Lex(void)
{
pos = 0;
//int void main if while return scanf printf
//关键字,字母顺序排序,二分找
word[0] = "else";
word[1] = "if";
word[2] = "int";
word[3] = "main";
word[4] = "printf";
word[5] = "return";
word[6] = "scanf";
word[7] = "void";
word[8] = "while";
wsym[0] = elsesym;
wsym[1] = ifsym;
wsym[2] = intsym;
wsym[3] = mainsym;
wsym[4] = printfsym;
wsym[5] = resym;
wsym[6] = scanfsym;
wsym[7] = voidsym;
wsym[8] = whilesym;
}
Lex::~Lex(void)
{
}
void Lex::getsym()//读一个单词
{
//string str;
str = getstr();
if (str == "")
{
sym = period;
return;
}
int i = 0;
ch = str[i];
if (ch >= 'a' && ch <= 'z')//保留字,自定义符
{
while ((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9'))
{
i++;
ch = str[i];
if (i > 30){ return; }//标识符太长
}
pos = star + i;
if (all[pos] == ' ')pos++;
//id = str.substr(0,i);
id = str.substr(0, pos - star);
i = 0;
int j = 8;
int k;
do //二分查找
{
k = (i + j) / 2;
if (id.compare(word[k]) <= 0)
{
j = k - 1;
}
if (id.compare(word[k]) >= 0)
{
i = k + 1;
}
} while (i <= j);
if (i - 1 > j)
{
sym = wsym[k];
//cout<<word[k]<<endl;
}
else
{
sym = ident;
id = str.substr(0, pos - star);
}
}
else
{
if (ch >= '0' && ch <= '9')//数字
{
while (ch >= '0' && ch <= '9')
{
i++;
ch = str[i];
if (i > 10){ return; }//太长
}
pos = star + i;
sym = number;
str = str.substr(0, i);
num = atoi(str.c_str());
}
else
{
switch (ch)
{
case ',':sym = comma; break;
case ';':sym = semicolon; break;
case '+':sym = plu; break;
case '-':sym = sub; break;
case '*':sym = mul; break;
case '/':sym = dive; break;
case '{':sym = beginsym; break;
case '}':sym = endsym; break;
case '(':sym = leftsym; break;
case ')':sym = rightsym; break;
case '=':sym = eqlsym; break;
case '.':sym = period; return;
default:sym = nul; cout << "未找到此符号" << endl;
break;
}
pos = star + 1;
if (all[pos] == ' ')pos++;
}
}
}
string Lex::getstr()
{
while (all[pos] == ' '||all[pos]=='\t'||all[pos]=='\n')
{
pos++;
}
star = pos;
end = all.find(' ', pos);//返回空格的下标
len = end - star;
pos = end + 1;
string temp = all.substr(star, len);
return temp;
}
int Lex::readfile()//读入c0源码文件
{
fstream in;
string s;
cout << "请输入C0的源程序文件名:" << endl;
cin >> s;
in.open(s, ios::in);//文件名
if (!in)
{
cout <<s<< " 文件不存在!" << endl;
return -1;
}
while (getline(in, s))//跳过回车和换行
{
if (s == "" || s == "\n")continue;
all += s;
all += '\n';
}
in.close();
return 0;
}
<file_sep>/stack.h
#pragma once
#include<iostream>
#include "instructions.h"
using namespace std;
class stack
{
public:
stack(void);
~stack(void);
int push(int x);
int pop();
int gettop();
bool isempty();
bool isfull();
//int p; //栈的自由指针
//private:
int data[500]; //栈主体
int top; //栈顶
};
<file_sep>/nametable.h
#pragma once
#include <string>
using namespace std;
enum object
{
var,
procedur,
intprocedur,
//名字表中类型,变量,程序
};
class nametable
{
public:
nametable();
~nametable(void);
nametable(string, int, int, string);//变量用 名字,值,层次,属于的函数
nametable(string, int, string);//函数用 名字,层次,属于的函数
string name;//名字
enum object kind;//类型
int level;//层次
int adr;//地址
int size;//大小
string belongto;//属于哪个函数
};<file_sep>/Set.cpp
#include "Set.h"
Set::Set(void)
{
}
Set::~Set(void)
{
}
int Set::addset(bool* sr, bool* s1, bool* s2, int n)
{
int i;
for (i = 0; i < n; i++)
{
sr[i] = (s1[i] || s2[i]);
}
return 0;
}
int Set::subset(bool* sr, bool* s1, bool* s2, int n)
{
int i;
for (i = 0; i < n; i++)
{
sr[i] = (s1[i] && (!s2[i]));
}
return 0;
}
int Set::mulset(bool* sr, bool* s1, bool* s2, int n)
{
int i;
for (i = 0; i < n; i++)
{
sr[i] = (s1[i] && s2[i]);
}
return 0;
}<file_sep>/Block.h
#pragma once
#include <string>
#include <iostream>
#include "Lex.h"
#include "instructions.h"
#include "nametable.h"
#include "uncertainadd.h"
#include "interpret.h"
#include<fstream>
using namespace std;
class Block
{
public:
Block(void);
~Block(void);
void main();
void inswriter();
char inspri;
char allstr;
private:
int mainblock(int, bool*);//函数声明处理,从中调用变量声明处理
void init();//初始化
void insprint();//中间代码打印
int uncertain();
int gen(enum fct, int, int);//生成指令
int enter(enum object, int, int *);//登记名字表
int position(string, object);//在名字表中查找标识符
int variable(int, int *);//变量声明处理
int statement(bool*);//语句
int statements(bool*);//语句序列
int expression(bool*);//表达式
int term(bool*);//项
int factor(bool*);//因子
int test(bool*, bool*);//测试
void symprint(symbol);
void symcopy(bool*, bool*);
interpret inter;//解释器
Set ss;//集合
Lex lex;//词法分析
uncertainadd unadd[20];
int pun;
int tx;//名字表指针
bool stabegsys[symnum];//语句开始符集
bool facbegsys[symnum];//因子开始符集
bool delbegsys[symnum];//定义开始符集
bool terbegsys[symnum];//项开始符集
bool expbegsys[symnum];//表达式开始符集
bool varbegsys[symnum];//变量开始符集
bool allfalse[symnum];//全部为false,用来初始化集合
//指令数组
int pcode;//指令指针
string codechar[15];//指令枚举类型对应的字符类型
nametable table[20];//名字表
ins code[200];//中间代码表
fstream error_txt;
};
<file_sep>/Block.cpp
#include "Block.h"
Block::Block(void)
{
}
Block::~Block(void)
{
}
void Block::init()
{
tx = 1;
pcode = 1;
pun = 0;
int i;
table[0].name = "";//当成全局变量
table[0].level = 5;
///////////////////////////
table[1].name = "public";
table[1].level = 0;
//////////////////////////
code[0].f = JMP;//code第一个 jump
code[0].l = 0;
code[0].a = 0;
/////////////////////////
codechar[LIT] = "LIT";//指令枚举类型对应的字符类型
codechar[LOD] = "LOD";
codechar[STO] = "STO";
codechar[CAL] = "CAL";
codechar[INT] = "INT";
codechar[JMP] = "JMP";
codechar[JPC] = "JPC";
codechar[ADD] = "ADD";
codechar[SUB] = "SUB";
codechar[MUL] = "MUL";
codechar[DIV] = "DIV";
codechar[RED] = "RED";
codechar[WRT] = "WRT";
codechar[RET] = "RET";
codechar[NUL] = "NUL";
//////////////////////////
for (i = 0; i < symnum; i++)
{
stabegsys[i] = false;
facbegsys[i] = false;
delbegsys[i] = false;
terbegsys[i] = false;
expbegsys[i] = false;
varbegsys[i] = false;
allfalse[i] = false;
}
/////////////////////////
//声明开始符 int void
delbegsys[intsym] = true;
delbegsys[voidsym] = true;
/////////////////////////
//语句开始符
stabegsys[ifsym] = true;
stabegsys[whilesym] = true;
stabegsys[ident] = true;
stabegsys[resym] = true;
stabegsys[scanfsym] = true;
stabegsys[printfsym] = true;
stabegsys[beginsym] = true;
/////////////////////////
//因子开始符
facbegsys[ident] = true;
facbegsys[leftsym] = true;
facbegsys[number] = true;
//////////////////////////
//项开始符集
terbegsys[ident] = true;
terbegsys[leftsym] = true;
terbegsys[number] = true;
////////////////////////////
//表达式开始符集
expbegsys[plu] = true;
expbegsys[sub] = true;
expbegsys[ident] = true;
expbegsys[leftsym] = true;
expbegsys[number] = true;
//////////////////////////////
//变量开始符集
varbegsys[intsym] = true;
//////////////////////////////
//找不到这个函数,将这个函数存到unadd数组里,最后对这个数组进行处理
for (i = 0; i < 20; i++)
{
unadd[i].codeadr = -1;
unadd[i].name = "";
unadd[i].proc = "";
}
while (lex.readfile())//读c0源文件
{
cout << "请重新输入文件名:" << endl;
}
}
int Block::mainblock(int lev, bool* fsys)//层次,当前状态符号集
{
int dx;//相对地址
int tx0;//保留此程序最开始名字表位置
int pcode0;//保留此程序最开始指令位置
bool nxtlev[symnum];//向下传的符号集
dx = 3;
tx0 = tx;//名字表指针
lex.getsym();//读一个单词
if (lex.sym == period)//遇到结束符则结束
{
return 0;
}
symcopy(fsys, nxtlev);
while (delbegsys[lex.sym])//声明 变量,函数,直至所有声明全部解析
{
if (lex.sym == intsym)//变量或者自定义函数
{
lex.getsym();//是ident
fsys[ident] = true;
fsys[beginsym] = true;
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case ident:
break;//没出错
case beginsym:
{
cout << table[tx0].name;
cout << " 中声明错误" << endl;
error_txt << table[tx0].name << " 中声明错误" << "\n";
lex.getsym();
continue;
break;
}
default:
{
cout << table[tx0].name;
cout << " 中声明错误" << endl;
error_txt << table[tx0].name << " 中声明错误" << "\n";
//lex.getsym();
}
continue;
break;
}
fsys[ident] = false;
fsys[beginsym] = false;
//int x(){ int x,x;
lex.getsym();//可能是( 或者逗号 或者分号 或者等号 不是( 认为不是函数
if (lex.sym == leftsym)//左括号的话 是函数
{
string s1 = lex.id;//存下函数名字
fsys[rightsym] = true;
fsys[beginsym] = true;
lex.getsym();//右括号
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case rightsym:break;//(){ ,x;
case beginsym:
{
cout << table[tx0].name;
cout << " 中函数缺少右括号" << endl;
error_txt << table[tx0].name << " 中函数缺少右括号" << "\n";
lex.getsym();
continue;
break;
}
default:
{
cout << table[tx0].name;
cout << " 中声明错误" << endl;
error_txt << table[tx0].name << " 中声明错误" << "\n";
//lex.getsym();
continue;
break;
}
}
lex.getsym();//左花括号 {
fsys[rightsym] = false;
//fsys[beginsym] = false;
fsys[beginsym] = true;
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case beginsym:break;
default:
{
cout << table[tx0].name;
cout << " 中缺少开始符" << endl;
error_txt << table[tx0].name << " 中缺少开始符" << "\n";
//lex.getsym();
continue;
break;
}
}
fsys[beginsym] = false;
enter(intprocedur, lev, &dx);//函数登陆名字表
table[tx].belongto = table[tx0].name;
table[tx].name = s1;
if (-1 == mainblock(lev + 1, nxtlev))
{
return -1;
}
//正确出来的话肯定是 }
lex.getsym(); //接下来找声明
continue;
}
else//不是左括号,是变量
{
while (1)
{
if (lex.sym == comma)//逗号
{
variable(lev, &dx);//登陆名字表,并再读一个字,tx变了
table[tx].belongto = table[tx0].name;//多个函数可以定义相同名字的变量,但belongto 可以讲他们区别开
//cout<<table[tx].name<<" "<<table[tx].level<<""<<table[tx].belongto<<endl;
lex.getsym();//再读一个字
continue;
}
if (lex.sym == semicolon)
{
variable(lev, &dx);//登陆名字表,并再读一个字,tx变了
table[tx].belongto = table[tx0].name;//多个函数可以定义相同名字的变量,但belongto 可以讲他们区别开
//cout<<table[tx].name<<" "<<table[tx].level<<""<<table[tx].belongto<<endl;
break;
}
if (lex.sym == eqlsym)
{
variable(lev, &dx);
//table[tx].val = lex.num;
table[tx].belongto = table[tx0].name;
expression(fsys);
//cout<<"11"<<endl;
if (gen(STO, 0, dx - 1) == -1)return -1;
{
lex.getsym();//ident
lex.getsym();//逗号或分号
}
if (lex.sym == semicolon)
break;
}
if (lex.sym == ident)//int a b
{
cout << table[tx0].name;
cout << " 中 " << lex.id << " *之前缺少逗号" << endl;
error_txt << table[tx0].name << " 中 " << lex.id << " *之前缺少逗号" << "\n";
variable(lev, &dx);
table[tx].belongto = table[tx0].name;
//lex.getsym();//
}
else
{
cout << table[tx0].name;
cout << " 中 " << lex.id << " *后有非法符号" << endl;
error_txt << table[tx0].name << " 中 " << lex.id << " *后有非法符号" << "\n";
symcopy(allfalse, nxtlev);
//nxtlev[period] = true;
nxtlev[semicolon] = true;
//nxtlev[endsym] = true;
nxtlev[ident] = true;
if (test(delbegsys, nxtlev))
break; //后跟符, . ; } test要有个停止条件
//找声明开始符,找到了则仍进入大循环,找不到就进入其他的
if (lex.sym == intsym || lex.sym == voidsym)
break;
}
}
continue;
}
}
if (lex.sym == voidsym)//自定义函数或者主函数
{
lex.getsym();
if (lex.sym != mainsym && lex.sym != ident)
{
cout << table[tx0].name;
cout << " 中 " << lex.id << "声明错误" << endl;
error_txt << table[tx0].name << " 中 " << lex.id << " 声明错误" << "\n";
fsys[beginsym] = true;
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号"<< "\n";
return -1;
}
fsys[beginsym] = false;
switch (lex.sym)
{
case beginsym:
cout << table[tx0].name;
cout << " 中void函数声明错误" << endl;
error_txt << table[tx0].name << " 中void函数声明错误" << "\n";
continue;
break;
default:
cout << table[tx0].name;
cout << " 中void函数声明错误" << endl;
cout << " 中void函数缺少开始符" << endl;
error_txt << table[tx0].name << " 中void函数声明错误" << "\n";
error_txt << table[tx0].name << " 中void函数缺少开始符" << "\n";
continue;
break;
}
}
if (lex.sym == mainsym)//主函数
{
string s1 = lex.id;
/*if (lex.sym != leftsym)
{
cout<<table[tx0].name;
cout<<" 中缺少左括号"<<endl;
}
symcopy(allfalse,nxtlev);
//symcopy(stabegsys,nxtlev);
ss.addset(nxtlev,delbegsys,stabegsys,symnum);
nxtlev[beginsym] = true;
nxtlev[rightsym] = true;
nxtlev[endsym] = true;
if(test(delbegsys,nxtlev))
{
cout<<table[tx0].name;
cout<<" 中main函数定义错误"<<endl;
return -1;
}//如果找不到声明,语句 { 函数错误,返回
if (lex.sym == intsym || lex.sym == voidsym)
{
cout<<table[tx0].name;
cout<<" 中缺少右括号"<<endl;
cout<<" 中缺少开始括号"<<endl;
continue;
}
if (lex.sym == endsym)
{
cout<<table[tx0].name;
cout<<" 中缺少右括号"<<endl;
cout<<" 中缺少开始括号"<<endl;
if(test(delbegsys,stabegsys))
{
cout<<table[tx0].name;
cout<<" 中main函数定义错误"<<endl;
return -1;
}
}
/*if (lex.sym != beginsym)
{
cout<<table[tx0].name;
cout<<" 中缺少开始括号!"<<endl;
}*/
/*if (lex.sym != rightsym)
{
cout<<table[tx0].name;
cout<<" 中缺少右括号"<<endl;
if (lex.sym != beginsym)
{
cout<<table[tx0].name;
cout<<" 中缺少开始括号"<<endl;
}
}
//lex.getsym();
symcopy(allfalse,nxtlev);
//znxtlev[]f
if(test(delbegsys,stabegsys))
{
cout<<table[tx0].name;
cout<<" 中main函数定义错误"<<endl;
return -1;
}
if (lex.sym != beginsym)
{
cout<<table[tx0].name;
cout<<" 中缺少开始括号"<<endl;
}*/
fsys[leftsym] = true;
fsys[beginsym] = true;
lex.getsym();
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case leftsym:break;//(){ ,x;
case beginsym:
{
cout << table[tx0].name;
cout << " 中main函数缺少左括号" << endl;
error_txt << table[tx0].name << " 中main函数缺少左括号" << "\n";
lex.getsym();
continue;
break;
}
default:
{
cout << table[tx0].name;
cout << " 中声明错误" << endl;
error_txt << table[tx0].name << " 中声明错误" << "\n";
//lex.getsym();
continue;
break;
}
}
lex.getsym();
fsys[leftsym] = false;
//fsys[beginsym] = false;
fsys[rightsym] = true;
fsys[beginsym] = true;
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case rightsym:break;
case beginsym:
{
cout << table[tx0].name;
cout << " 中main函数缺少右括号" << endl;
error_txt << table[tx0].name << " 中main函数缺少右括号" << "\n";
lex.getsym();
continue;
break;
}
default:
{
cout << table[tx0].name;
cout << " 中缺少开始符" << endl;
error_txt << table[tx0].name << " 中缺少开始符" << "\n";
//lex.getsym();
continue;
break;
}
}
fsys[rightsym] = false;
lex.getsym();
fsys[beginsym] = true;
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case beginsym:break;
default:
{
cout << table[tx0].name;
cout << " 中缺少开始符" << endl;
error_txt << table[tx0].name << " 中缺少开始符" << "\n";
//lex.getsym();
continue;
break;
}
}
fsys[beginsym] = false;
//lex.getsym();
enter(procedur, lev, &dx);
table[tx].belongto = table[tx0].name;
table[tx].name = s1;
if (-1 == mainblock(lev + 1, nxtlev))
{
return -1;
}
if (gen(RET, 0, 0) == -1)return -1;
lex.getsym();
}
else//自定义函数
{
string s1 = lex.id;
/*lex.getsym();
if (lex.sym != leftsym)
{
cout<<table[tx0].name;
cout<<" 中缺少左括号"<<endl;
}
symcopy(allfalse,nxtlev);
ss.addset(nxtlev,delbegsys,stabegsys,symnum);
nxtlev[beginsym] = true;
nxtlev[rightsym] = true;
nxtlev[endsym] = true;
if(test(delbegsys,nxtlev))
{
cout<<table[tx0].name;
cout<<" 中函数定义错误!"<<endl;
return -1;
}//如果找不到声明,语句 { 函数错误,返回
if (lex.sym == intsym || lex.sym == voidsym)
continue;
if (lex.sym == endsym)
return 0;
/*if (lex.sym != beginsym)
{
cout<<table[tx0].name;
cout<<" 中缺少开始括号!"<<endl;
}*/
/*if (lex.sym != rightsym)
{
cout<<table[tx0].name;
cout<<" 中缺少右括号"<<endl;
}
if (lex.sym != beginsym)
{
cout<<table[tx0].name;
cout<<" 中缺少开始括号"<<endl;
}*/
/*lex.getsym();
if (lex.sym != rightsym)
{
cout<<"缺少右括号!"<<endl;
return -1;
}
lex.getsym();
if (lex.sym != beginsym)
{
cout<<"缺少开始括号!"<<endl;
return -1;
}*/
fsys[leftsym] = true;
fsys[beginsym] = true;
lex.getsym();
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case leftsym:break;//(){ ,x;
case beginsym:
{
cout << table[tx0].name;
cout << " 中函数缺少左括号" << endl;
error_txt << table[tx0].name << " 中函数缺少左括号" << "\n";
lex.getsym();
continue;
break;
}
default:
{
cout << table[tx0].name;
cout << " 中声明错误" << endl;
error_txt << table[tx0].name << " 中声明错误" << "\n";
//lex.getsym();
continue;
break;
}
}
lex.getsym();
fsys[leftsym] = false;
//fsys[beginsym] = false;
fsys[rightsym] = true;
fsys[beginsym] = true;
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case rightsym:break;
case beginsym:
{
cout << table[tx0].name;
cout << " 中函数缺少右括号" << endl;
error_txt << table[tx0].name << " 中函数缺少右括号" << "\n";
lex.getsym();
continue;
break;
}
default:
{
cout << table[tx0].name;
cout << " 中函数缺少开始符" << endl;
error_txt << table[tx0].name << " 中函数缺少开始符" << "\n";
//lex.getsym();
continue;
break;
}
}
fsys[rightsym] = false;
lex.getsym();
fsys[beginsym] = true;
if (test(fsys, delbegsys))
{
cout << table[tx0].name;
cout << " 中声明开始含非法符号" << endl;
error_txt << table[tx0].name << " 中声明开始含非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case beginsym:break;
default:
{
cout << table[tx0].name;
cout << " 中函数缺少开始符" << endl;
error_txt << table[tx0].name << " 中函数缺少开始符" << "\n";
//lex.getsym();
continue;
break;
}
}
fsys[beginsym] = false;
//lex.getsym();
enter(procedur, lev, &dx);
table[tx].belongto = table[tx0].name;
table[tx].name = s1;
if (-1 == mainblock(lev + 1, nxtlev))
{
return -1;
}
if (gen(RET, 0, 0) == -1)return -1;
lex.getsym();
}
}
}
table[tx0].adr = pcode;//code表指针
table[tx0].size = dx;//函数的大小,里边的变量
pcode0 = pcode;
if (tx0 == 0)
{
return 0;
}
if (gen(INT, 0, dx) == -1)return -1;//初始化,分配栈的变量空间
table[0].adr = tx0;//将这个父过程名字表的下标,存入全局变量里
if (table[tx0].name == "public")
{
code[0].a = pcode - 1;
int i;
i = position("main", procedur);
gen(CAL, 0, table[i].adr);
gen(RET, 0, 0);
return 0;
}
if (table[tx0].kind == intprocedur)
{
table[0].level = 0;//如果是带返回类型的函数,尚不能确定 是否漏写ruturn,设一标志位,为0。
}
if (statements(nxtlev) == -1)return -1;//如果带返回类型函数写了return,则标志位置1
if (lex.sym != endsym)
{
cout << table[tx0].name;
cout << " 中函数缺少结束符" << endl;
error_txt << table[tx0].name << " 中函数缺少结束符" << "\n";
}
if (table[tx0].kind == intprocedur)
{
if (table[0].level == 1)//如果带返回类型函数标志位为0,漏写return
{
table[0].level = 5;
gen(RET, 0, 1);
return 0;
}
else
{
cout << table[tx0].name;
cout << " 中缺少return" << endl;
error_txt << table[tx0].name << " 中缺少return" << "\n";
return -1;
}
}
return 0;
}
int Block::gen(fct x, int y, int z)
{
if (pcode >= 300)
{
cout << "程序太长" << endl;
error_txt << "程序太长" << endl;
return -1;
}
code[pcode].f = x;
code[pcode].l = y;
code[pcode].a = z;
pcode++;
return 0;
}
int Block::enter(enum object k, int lev, int *pdx)
{
tx++;
//endtx++;
table[tx].name = lex.id;
table[tx].kind = k;
//table[tx].level = lev;
switch (k)
{
case var:
table[tx].level = lev;
table[tx].adr = (*pdx);
(*pdx)++;
break;
case procedur:
table[tx].level = lev;
break;
case intprocedur:
table[tx].level = lev;
break;
default:
break;
}
//cout<<table[tx].name<<" "<<table[tx].level<<endl;
return 0;
}
int Block::position(string id, object k)
{//tx名字表尾
int i = tx;
if (k == var)
{
while (i > 0)
{
if (table[i].name == id)
{
if (k == table[i].kind)
{
if (table[i].belongto == "public")
{
return i;
}
if (table[i].belongto == table[table[0].adr].name)
{
return i;
}
}
}
i--;
}
return 0;
}
else
{
while (i > 0)
{
if (table[i].name == id)
{
if (table[i].kind == intprocedur || table[i].kind == procedur)
{
if (table[i].belongto == "public")
{
return i;
}
if (table[i].belongto == table[table[0].adr].name)
{
return i;
}
}
}
i--;
}
//cin>>i;
unadd[pun].codeadr = pcode;
unadd[pun].name = id;
unadd[pun].proc = table[table[0].adr].name;
pun++;
return 0;
}
return -1;
}
int Block::variable(int lev, int *pdx)
{
enter(var, lev, pdx);
lex.getsym();
return 0;
}
int Block::statement(bool* fsys)//一条一条的分析
{
if (lex.sym == semicolon)
{
lex.getsym();
}
bool nxtlev[symnum];
int i;
switch (lex.sym)
{
case ident://使用自定义变量 或者 使用自定义函数
{
i = position(lex.id, var);//当成变量去查,如果查不到的话,不是函数,就是不存在
if (i != 0)//存在这样的变量
{
//// i = position(lex.id, var);//当变量查一查
// if (i == 0)//没查到这样的变量
// {
// cout << table[table[0].adr].name;
// cout << " 中引用了未定义变量" << lex.id << endl;
// lex.getsym();
// fsys[semicolon] = true;
// if (test(fsys, stabegsys))
// {
// cout << table[table[0].adr].name;
// cout << " 中含有非法符号" << endl;
// return -1;
// }
// fsys[semicolon] = false;
// return 1;//走了
// }
lex.getsym();//再读一个
if (lex.sym == eqlsym)//赋值
{
lex.getsym();
ss.addset(fsys, expbegsys, fsys, symnum);
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
ss.subset(fsys, expbegsys, fsys, symnum);
if (expression(nxtlev))//表达式处理,并再往下读一个字
{
cout << table[table[0].adr].name;
cout << " 赋值语句包含无效表达式" << endl;
error_txt << table[table[0].adr].name << " 赋值语句包含无效表达式" << "\n";
}
if (lex.sym != semicolon)
{
lex.getsym();
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中缺少分号" << "\n";
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
}
}
gen(STO, table[table[0].adr].level + 1 - table[i].level, table[i].adr);//算算结果,并赋值
//table[table[0].adr].level +1 - table[i].level
}
else//不是赋值,当成出错
{
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中出现非法符号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return 1;
}
}
}
else//自定义函数
{
fsys[semicolon] = true;
lex.getsym();//读取左括号
switch (lex.sym)
{
case leftsym://是个函数,但不知道是不是定义过的,需要查
break;
case rightsym://是个函数,但不知道是不是定义过的,需要查,输出错误信息
break;
default://未定义变量
cout << "使用了未定义的变量" << endl;
error_txt << "使用了未定义的变量" << "\n";
return -1;
break;
}
if (lex.sym == leftsym)
{
// cout << "自定义函数调用" << endl;
i = position(lex.id,procedur);//再次调用,查查看
// if ( i!=0 )
// {
// if (table[i].kind == procedur)
// {
// cout << table[table[0].adr].name;
// cout << " 中调用了一个无返回值的函数,若参与运算或者赋值,可能会发生错误" << endl;
// }
// }
gen(CAL, table[table[0].adr].level + 1 - table[i].level, table[i].adr);//函数调用
//table[table[0].adr].level +1 - table[i].level
lex.getsym();//右括号
if (lex.sym != rightsym)
{
cout << table[table[0].adr].name;
cout << " 中函数缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中函数缺少右括号" << "\n";
break;
}
lex.getsym();//在读一个
}
else
{
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中函数调用缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中函数调用缺少分号" << "\n";
break;
}
lex.getsym();
}
}
}
break;
case whilesym:
{
lex.getsym();
if (lex.sym != leftsym)//while
{
cout << table[table[0].adr].name;
cout << " 中while缺少左括号" << endl;
error_txt << table[table[0].adr].name << " while缺少左括号" << "\n";
ss.addset(fsys, expbegsys, fsys, symnum);
fsys[beginsym] = true;
fsys[rightsym] = true;
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
switch (lex.sym)
{
case rightsym:
lex.getsym();
break;
case beginsym:
cout << table[table[0].adr].name;
cout << " 中while缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中while缺少右括号" << "\n";
break;
default:
cout << table[table[0].adr].name;
cout << " 中while缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中while缺少右括号" << "\n";
//cout<<table[table[0].adr].name;
//cout<<" 中while缺少右括号"<<endl;
break;
}
if (lex.sym != beginsym)
{
cout << table[table[0].adr].name;
cout << " 中while缺少开始符" << endl;
error_txt << table[table[0].adr].name << " 中while缺少开始符" << "\n";
statements(fsys);
}
else
{
lex.getsym();
statements(fsys);
}
}
else//while(
{
lex.getsym();
if (!facbegsys[lex.sym])
{
cout << table[table[0].adr].name;
cout << " 中while缺少判断表达式" << endl;
error_txt << table[table[0].adr].name << " 中while缺少判断表达式" << "\n";
}
int i = pcode;
expression(fsys);//表达式处理
if (lex.sym != rightsym)
{
cout << table[table[0].adr].name;
cout << " 中while缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中while缺少右括号" << "\n";
fsys[beginsym] = true;
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
else
{
if (lex.sym != beginsym)
{
cout << table[table[0].adr].name;
cout << " 中while缺少开始符" << endl;
error_txt << table[table[0].adr].name << " 中while缺少开始符" << "\n";
statements(fsys);
}
else
{
lex.getsym();
statements(fsys);
}
}
}
else//while(),是右括号
{
int jpc_pcode = pcode;
gen(JPC, 0, 0);
lex.getsym();
if (lex.sym != beginsym)
{
cout << table[table[0].adr].name;
cout << " 中while缺少开始符" << endl;
error_txt << table[table[0].adr].name << " 中while缺少开始符" << "\n";
}
else//是 {
{
lex.getsym();//再读一个字
}
statements(fsys);//看是解析while里的语句
gen(JMP, 0, i);//跳到开始while判断的地方
code[jpc_pcode].a = pcode;
}
}
if (lex.sym != endsym)
{
cout << table[table[0].adr].name;
cout << " 中while缺少结束符" << endl;
error_txt << table[table[0].adr].name << " 中while缺少结束符" << "\n";
}
else
{
lex.getsym();
}
}
break;
case ifsym:
{
lex.getsym();//读左括号
int jpccode;
if (lex.sym != leftsym)
{
cout << table[table[0].adr].name;
cout << " if中缺少左括号" << endl;
error_txt << table[table[0].adr].name << " if中缺少左括号" << "\n";
fsys[beginsym] = true;
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
if (lex.sym != beginsym)
{
cout << table[table[0].adr].name;
cout << " if中缺少开始符" << endl;
error_txt << table[table[0].adr].name << " if中缺少开始符" << "\n";
statements(fsys);
}
else
{
lex.getsym();
statements(fsys);
}
}
else//if(
{
lex.getsym();//再读一个字
expression(fsys);//开始表达式解析
int i = pcode;//code表当前指针
gen(JPC, 0, 0);
if (lex.sym != rightsym)//if(
{
cout << table[table[0].adr].name;
cout << " 中if缺少右括号" << endl;
error_txt << table[table[0].adr].name << " if缺少右括号" << "\n";
fsys[beginsym] = true;
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
if (lex.sym != beginsym)
{
cout << table[table[0].adr].name;
cout << " 中if缺少开始符" << endl;
error_txt << table[table[0].adr].name << " if缺少开始符" << "\n";
statements(fsys);
}
else
{
lex.getsym();
statements(fsys);
}
}
else//if() 解析完if里的表达式
{
lex.getsym();//再读一个
if (lex.sym != beginsym)
{
cout << table[table[0].adr].name;
cout << " 中if缺少开始符" << endl;
error_txt << table[table[0].adr].name << " if缺少开始符" << "\n";
statements(fsys);
}
else
{
lex.getsym();
statements(fsys);
jpccode = i;
code[jpccode].a = pcode;
}
}
}
if (lex.sym != endsym)//if(){
{
cout << table[table[0].adr].name;
cout << " 中if缺少结束符 " << endl;
error_txt << table[table[0].adr].name << " if缺少结束符" << "\n";
}
//if(){}处理完毕
else//if(){}
{
lex.getsym();
}
if (lex.sym == elsesym)
{
lex.getsym();
if (lex.sym != beginsym)//else
{
cout << table[table[0].adr].name;
cout << " 中else缺少开始括号" << endl;
error_txt << table[table[0].adr].name << " else缺少开始括号" << "\n";
}
else//else{
{
lex.getsym();
}
int elsepcode = pcode;
gen(JMP, 0, 0);
code[jpccode].a++;
statements(fsys);
code[elsepcode].a = pcode;
if (lex.sym != endsym)
{
cout << table[table[0].adr].name;
cout << " 中else缺少结束括号" << endl;
error_txt << table[table[0].adr].name << " else缺少结束括号" << "\n";
}
else
{
lex.getsym();
}
}
}
break;
case scanfsym:
{
//fsys[leftsym] = true;
//fsys[rightsym] = true;
///fsys[ident] = true;
fsys[semicolon] = true;
/*if (test(fsys,fsys))
{
cout<<table[table[0].adr].name;
cout<<" scanf中含有非法符号 "<<endl;
if(test(stabegsys,delbegsys))
{
return -1;
}
else
{
if (lex.sym == ident)
{
return 0;
}
}
}
else
{
if (lex.sym != leftsym)
{
cout<<table[table[0].adr].name;
cout<<" scanf中缺少左括号"<<endl;
}
}*/
lex.getsym();
if (lex.sym != leftsym)//直接找到分号或者语句开头,进行下一个语句处理
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少左括号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少左括号" << "\n";
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
else
{
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少分号" << "\n";
break;
}
lex.getsym();
}
}
else//scanf(
{
lex.getsym();
if (lex.sym != ident)//直接找到分号或者语句开头,进行下一个语句处理
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少变量" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少变量" << "\n";
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << "中含有非法符号" << "\n";
return -1;
}
else
{
switch (lex.sym)
{
case rightsym:lex.getsym(); break;
case semicolon:
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少右括号" << "\n";
break;
}
default:
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少右括号" << "\n";
//cout<<table[table[0].adr].name;
//cout<<" 中scanf缺少分号"<<endl;
break;
}
}
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少分号" << "\n";
}
else
{
lex.getsym();
}
}
}
else//scanf(x
{
//生成
int i;
i = position(lex.id, var);
if (i == 0)
{
cout << table[table[0].adr].name;
cout << " 中scanf使用未定义变量" << endl;
error_txt << table[table[0].adr].name << " 中scanf使用未定义变量" << "\n";
}
else
{
gen(RED, 0, 0);
gen(STO, table[table[0].adr].level + 1 - table[i].level, table[i].adr);
//table[table[0].adr].level +1 - table[i].level
}
lex.getsym();
switch (lex.sym)
{
case rightsym:
{
lex.getsym();
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少分号" << "\n";
}
else
{
lex.getsym();
}
break;
}
case semicolon:
{
lex.getsym();
cout << table[table[0].adr].name;
cout << " 中scanf缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少右括号" << "\n";
break;
}
default:
{
cout << table[table[0].adr].name;
cout << " 中scanf缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少右括号" << "\n";
cout << table[table[0].adr].name;
cout << " 中scanf缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中scanf缺少分号" << "\n";
}
break;
}
}
}
}
break;
case printfsym:
{
lex.getsym();
if (lex.sym != leftsym)//直接找到分号或者语句开头,进行下一个语句处理
{
cout << table[table[0].adr].name;
cout << " 中printf缺少左括号" << endl;
error_txt << table[table[0].adr].name << " 中printf缺少左括号" << "\n";
fsys[semicolon] = true;
fsys[endsym] = true;
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
else
{
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中printf缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中printf缺少分号" << "\n";
break;
}
else
lex.getsym();
}
}
else//printf(
{
lex.getsym();
if (!expbegsys[lex.sym])
{
cout << table[table[0].adr].name;
cout << " 中printf缺少表达式" << endl;
error_txt << table[table[0].adr].name << " 中printf缺少表达式" << "\n";
}
expression(fsys);
gen(WRT, 0, 0);
//printf()
switch (lex.sym)
{
case rightsym:
{
lex.getsym();
break;
}
case semicolon:
{
cout << table[table[0].adr].name;
cout << " 中printf缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中printf缺少右括号" << "\n";
break;
}
default:
{
cout << table[table[0].adr].name;
cout << " 中printf缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中printf缺少右括号" << "\n";
//cout<<table[table[0].adr].name;
//cout<<" 中printf缺少分号"<<endl;
}
break;
}
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中printf缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中printf缺少分号" << "\n";
//break;
}
else
lex.getsym();
}
}
break;
case resym:
{
table[0].level = 1;
fsys[semicolon] = true;
fsys[rightsym] = true;
fsys[endsym] = true;
lex.getsym();
if (lex.sym != leftsym) //return 找到分号或者下一个语句开头
{
cout << table[table[0].adr].name;
cout << " 中return缺少左括号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少左括号" << "\n";
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << "中含有非法符号" << "\n";
return -1;
}
else
{
if (!expbegsys[lex.sym])
{
cout << table[table[0].adr].name;
cout << " 中return缺少表达式" << endl;
error_txt << table[table[0].adr].name << " 中return缺少表达式" << "\n";
}
expression(fsys);
switch (lex.sym)
{
case rightsym:lex.getsym(); break;
case semicolon:
{
cout << table[table[0].adr].name;
cout << " 中return缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少右括号" << "\n";
//lex.getsym();
break;
}
default:
{
cout << table[table[0].adr].name;
cout << " 中return缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少右括号" << "\n";
//cout<<table[table[0].adr].name;
//cout<<" 中return缺少分号"<<endl;
break;
}
}
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中return缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少分号" << "\n";
//break;
}
else
lex.getsym();
}
}
else//return(
{
lex.getsym();
expression(fsys);
switch (lex.sym)
{
case rightsym:
{
lex.getsym();
if (lex.sym != semicolon)
{
cout << table[table[0].adr].name;
cout << " 中return缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少分号" << "\n";
}
else
{
lex.getsym();
}
break;
}
case semicolon:
{
lex.getsym();
cout << table[table[0].adr].name;
cout << " 中return缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少右括号" << "\n";
break;
}
default:
{
cout << table[table[0].adr].name;
cout << " 中return缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少右括号" << "\n";
cout << table[table[0].adr].name;
cout << " 中return缺少分号" << endl;
error_txt << table[table[0].adr].name << " 中return缺少分号" << "\n";
}
break;
}
}
}
break;
case period:
{
return 0;
break;
}
case elsesym:
{
cout << table[table[0].adr].name;
cout << " 中出现无匹配的else" << endl;
error_txt << table[table[0].adr].name << " 中出现无匹配的else" << "\n";
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
break;
}
case endsym:
{
//lex.getsym();
break;
}
default:
{
cout << table[table[0].adr].name;
cout << " 中出现非法成分" << endl;
error_txt << table[table[0].adr].name << " 中出现非法成分" << "\n";
test(stabegsys, delbegsys);
return -1;
break;
}
}
return 0;
}
int Block::expression(bool* fsys)
{
symbol addop;
bool nxtlev[symnum];
symcopy(fsys, nxtlev);
ss.addset(nxtlev, terbegsys, nxtlev, symnum);
if (lex.sym == plu || lex.sym == sub)
{
addop = lex.sym;
lex.getsym();
term(nxtlev);
if (addop == sub)
{
gen(LIT, 0, -1);
gen(MUL, 0, 0);
}
}
else
{
term(nxtlev);
}
while (lex.sym == plu || lex.sym == sub)
{
addop = lex.sym;
lex.getsym();
term(nxtlev);
if (addop == plu)
{
gen(ADD, 0, 0);
}
else
{
gen(SUB, 0, 0);
}
}
return 0;
}
int Block::term(bool* fsys)
{
symbol addop;
bool nxtlev[symnum];
symcopy(fsys, nxtlev);
ss.addset(nxtlev, facbegsys, nxtlev, symnum);
factor(nxtlev);
while (lex.sym == dive || lex.sym == mul)
{
addop = lex.sym;
lex.getsym();
factor(nxtlev);
if (addop == dive)
{
gen(DIV, 0, 0);
}
else
{
gen(MUL, 0, 0);
}
}
return 0;
}
int Block::factor(bool* fsys)
{
int i;
bool nxtlev[symnum];
symcopy(fsys, nxtlev);
//fsys[rightsym] = true;
while (facbegsys[lex.sym])
{
switch (lex.sym)
{
case ident:
{
lex.getsym();
if (lex.sym == leftsym)
{
//cout<<"自定义函数调用"<<endl;
i = position(lex.id, procedur);
if (i != 0)
{
if (table[i].kind == procedur)
{
cout << table[table[0].adr].name;
cout << " 中调用了一个无返回值的函数,若参与运算或者赋值,可能会发生错误" << endl;
}
}
gen(CAL, table[table[0].adr].level + 1 - table[i].level, table[i].adr);
lex.getsym();
if (lex.sym != rightsym)
{
cout << table[table[0].adr].name;
cout << " 中函数缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中函数缺少右括号" << "\n";
break;
}
lex.getsym();
}
else
{
//cout<<"变量调用"<<endl;
i = position(lex.id, var);
if (i == 0)
{
cout << table[table[0].adr].name;
cout << " 中使用未定义变量 " << lex.id << endl;
error_txt << table[table[0].adr].name << " 中使用未定义变量" << "\n";
if (test(fsys, facbegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号 " << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
break;
}
else
{
gen(LOD, table[table[0].adr].level + 1 - table[i].level, table[i].adr);
//lex.getsym();
//return 0;
}
}
}
break;
case number:
{
gen(LIT, 0, lex.num);
lex.getsym();
}
break;
case leftsym:
{
lex.getsym();
if (expression(fsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法表达式" << endl;
error_txt << table[table[0].adr].name << " 中含有非法表达式" << "\n";
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中含有非法符号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法符号" << "\n";
return -1;
}
break;
}
if (lex.sym != rightsym)
{
cout << table[table[0].adr].name;
cout << " 中表达式缺少右括号" << endl;
error_txt << table[table[0].adr].name << " 中表达式缺少右括号" << "\n";
break;
//return 1;
}
lex.getsym();
}
break;
case rightsym:
//cout<<"因子中读取到)"<<endl;
//cout<<"自定义函数调用"<<endl;
/*i = position(lex.id,procedur);
if (i==0)
{
cout<<"无此函数"<<endl;
}
gen(CAL,table[i].level - table[table[0].adr].level,table[i].adr);*/
{
cout << table[table[0].adr].name;
cout << " 中含有非法右括号" << endl;
error_txt << table[table[0].adr].name << " 中含有非法右括号" << "\n";
lex.getsym();
return 0;
}
default:
{
/*cout<<table[table[0].adr].name;
cout<<" 中含有非法符号"<<endl;
bool fsys1[symnum];
symcopy(stabegsys,fsys1);//语句开始,分号,. ,},+,-,/,*,
fsys1[semicolon] = true;
fsys1[period] = true;
fsys1[endsym] = true;
fsys1[plus] = true;
fsys1[sub] = true;
fsys1[dive] = true;
fsys1[mul] = true;*/
return 0;
}
break;
}
}
return 0;
}
int Block::statements(bool* fsys)
{
fsys[endsym] = true;
bool nxtlev[symnum];
symcopy(fsys, nxtlev);
if (test(fsys, stabegsys))
{
cout << table[table[0].adr].name;
cout << " 中缺少结束符号" << endl;
error_txt << table[table[0].adr].name << " 中缺少结束符号" << "\n";
return -1;
}
while (1)
{
/*if (lex.sym == intsym || lex.sym == voidsym)
{
return 0;//遇到声明就返回
}*/
switch (lex.sym)
{
case period:return 0;
case intsym:return 0;
case voidsym:return 0;
case endsym:return 0;
case plu:return 0;
case sub:return 0;
case dive:return 0;
case mul:return 0;
case number:return 0;
//case beginsym:lex.getsym();break;
default:
break;
}
statement(nxtlev);
if (test(stabegsys, fsys))
{
cout << table[table[0].adr].name;
cout << " 中缺少结束符号" << endl;
error_txt << table[table[0].adr].name << " 中缺少结束符号" << "\n";
return -1;
}
}
//return 0;
}
void Block::symprint(symbol s)
{
switch (s)
{
case number:cout << "number" << endl;
break;
case plu:cout << "plus" << endl;
break;
case sub:cout << "sub" << endl;
break;
case mul:cout << "mul" << endl;
break;
case dive:cout << "dive" << endl;
break;
// case procsym:cout<<"procsym"<<endl;
break;
case beginsym:cout << "beginsym" << endl;
break;
case endsym:cout << "endsym" << endl;
break;
// case selfprocsym:cout<<"selfprocsym"<<endl;
break;
// case mainprocsym:cout<<"mainprocsym"<<endl;
break;
case varsym:cout << "varsym" << endl;
break;
case intsym:cout << "intsym" << endl;
break;
case ident:cout << "ident" << endl;
break;
case comma:cout << "comma" << endl;
break;
case semicolon:cout << "semicolon" << endl;
break;
// case partprocsym:cout<<"partprocsym"<<endl;
break;
case mainsym:cout << "mainsym" << endl;
break;
case voidsym:cout << "voidsym" << endl;
break;
// case sstasym:cout<<"sstasym"<<endl;
break;
// case stasym:cout<<"stasym"<<endl;
break;
case ifstasym:cout << "ifstasym" << endl;
break;
case whilestasym:cout << "whilestasym" << endl;
break;
// case assstasym:cout<<"assstasym"<<endl;
break;
case restasym:cout << "restasym" << endl;
break;
case readstasym:cout << "readstasym" << endl;
break;
case writestasym:cout << "writestasym" << endl;
break;
// case callselfprocstasym:cout<<"callselfprocstasym"<<endl;
break;
case ifsym:cout << "ifsym" << endl;
break;
// case exprsym:cout<<"exprsym"<<endl;
break;
case elsesym:cout << "elsesym" << endl;
break;
case whilesym:cout << "whilesym" << endl;
break;
// case callselfprocsym:cout<<"callselfprocsym"<<endl;
break;
case eqlsym:cout << "eqlsym" << endl;
break;
case scanfsym:cout << "scanfsym" << endl;
break;
case printfsym:cout << "printfsym" << endl;
break;
//case term:
//break;
//case factor:
//break;
case leftsym:cout << "leftsym" << endl;
break;
case rightsym:cout << "rightsym" << endl;
break;
case nul:cout << "nul" << endl;
break;
case resym:cout << "resym" << endl;
break;
case period:cout << "period" << endl;
break;
default:
break;
}
}
void Block::insprint()
{
int i = 0;
while (i < pcode)
{
cout << i << " ";
switch (code[i].f)
{
case LOD:cout << "LOD" << " "; break;
case STO:cout << "STO" << " "; break;
case CAL:cout << "CAL" << " "; break;
case INT:cout << "INT" << " "; break;
case JMP:cout << "JMP" << " "; break;
case JPC:cout << "JPC" << " "; break;
case ADD:cout << "ADD" << " "; break;
case SUB:cout << "SUB" << " "; break;
case MUL:cout << "MUL" << " "; break;
case DIV:cout << "DIV" << " "; break;
case RED:cout << "RED" << " "; break;
case WRT:cout << "WRT" << " "; break;
case RET:cout << "RET" << " "; break;
case NUL:return;
case LIT:cout << "LIT" << " "; break;
default:
return;
}
cout << code[i].l << " " << code[i].a << endl;
i++;
}
}
void Block::symcopy(bool* s1, bool* s2)
{
int i = 0;
for (i = 0; i < symnum; i++)
{
s2[i] = s1[i];
}
}
void Block::main()
{
cout << "考虑到循环执行的话,如果中间一个程序的编译出问题,剩下的都会受到影响\n所以,没有改成table_(x).txt形式。" << endl;
cout << "本程序,执行后,生成的中间代码在:code.txt中\n运行情况在result.txt, 错误信息在error.txt中" << endl;
cout << "本程序在错误处理方面尚有欠缺,但文档中要求的所有功能都以实现。" << endl;
cout << "欢迎测试C0编译器--张怀文版" << endl;
error_txt.open("error.txt", ios::out);
fstream inte;
inte.open("result.txt", ios::out);
bool b[symnum];//开始符号集
symcopy(allfalse, b);
ss.addset(b, stabegsys, delbegsys, symnum);//语句和声明的集合
b[period] = true;//结束的.
init();//做一些初始化
allstr = 'y';
cout << "是否列出源码? Y/N" << endl;
inte << "是否列出源码? Y/N" <<"\n";
cin >> allstr;
inte << allstr << "\n";
inspri = 'y';
cout << "是否列出指令? Y/N" << endl;
inte << "是否列出指令? Y/N" << "\n";
cin >> inspri;
inte << inspri << "\n";
mainblock(0, b);
//检查有无main函数
//把unsertain 中的东西填上,若填不上,则报错
uncertain();
if (allstr == 'Y' || allstr == 'y')
{
cout << "源码为:" << endl;
for (int i = 0; i < lex.all.length(); i++)
{
cout << lex.all[i];
}
cout << endl << endl;
}
if (inspri == 'Y' || inspri == 'y')
{
insprint();//输出指令
cout << endl;
}
inswriter();//把指令写到codetxt里
inte.close();
inter.start();//从code.txt里读入指令执行
error_txt.close();
}
void Block::inswriter()
{
fstream out;
out.open("code.txt", ios::out);
int i = 0;
while (i < pcode)
{
out << i << " ";
switch (code[i].f)
{
case LIT:out << "LIT "; break;
case LOD:out << "LOD "; break;
case STO:out << "STO "; break;
case CAL:out << "CAL "; break;
case INT:out << "INT "; break;
case JMP:out << "JMP "; break;
case JPC:out << "JPC "; break;
case ADD:out << "ADD "; break;
case SUB:out << "SUB "; break;
case MUL:out << "MUL "; break;
case DIV:out << "DIV "; break;
case RED:out << "RED "; break;
case WRT:out << "WRT "; break;
case RET:out << "RET "; break;
case NUL:out.close(); return;
default:
out.close(); return;
}
//将 l a 写入文件
out << code[i].l << " " << code[i].a << "\n";
i++;
if (i >= 200)
{
cout << "指令过长" << endl;
out.close();
return;
}
}
out.close();
}
int Block::test(bool*s1, bool*s2)
{
if (!s1[lex.sym])
{
while ((!s1[lex.sym]) && (!s2[lex.sym]))
{
lex.getsym();
if (lex.sym == nul || lex.sym == period)
{
return 1;
}
}
}
return 0;
}
int Block::uncertain()
{
int i;
int p,p1;
for (i = 0; i < 20; i++)
{
if (unadd[i].codeadr == -1)
break;
else
{
p = position(unadd[i].name, procedur);
if (p == 0)
{
cout << unadd[i].proc << " 中调用了未定义函数 " << unadd[i].name << endl;
unadd[i+1].codeadr = -1;
}
else
{
// gen(STO, table[table[0].adr].level + 1 - table[i].level, table[i].adr);
p1 = position(unadd[i].proc, procedur);
code[unadd[i].codeadr].a = table[p].adr;
code[unadd[i].codeadr].l = table[p1].level + 1 - table[p].level;
}
}
}
return 0;
}<file_sep>/stack.cpp
#include "stack.h"
stack::stack(void)
{
top = -1;
}
stack::~stack(void)//析构函数
{
}
int stack::push(int x) //入栈函数
{
top++;
if (top >= 500)
{
cout << "栈满啦 !" << endl;
return -99999999;
}
data[top] = x;
return data[top];
}
int stack::pop() //出栈函数
{
top--;
if (top < 0)
{
cout << "栈下溢!" << endl;
return -99999999;
}
return data[top + 1];
}
int stack::gettop()//得到栈顶元素
{
return data[top];
}
bool stack::isempty()//判断是否为空
{
return top == -1 ? true : false;
}
bool stack::isfull()//判断是否已满
{
return top > 500 ? true : false;
}<file_sep>/Lex.h
//常量声明,类型声明,获取源文件内容的一个类
#pragma once
#include<string>
#include "Set.h"
using namespace std;
const int symnum = 42;
enum symbol
{
number, plu, sub, mul, dive, beginsym, endsym, varsym, intsym, ident, comma, semicolon,
//数字,+,-,*,/,{,},自定义函数,主函数,变量定义,整型,自定义符号,逗号,分号
mainsym, voidsym, ifstasym, whilestasym, restasym, readstasym, writestasym,
//分程序,主程序,空类型,语句序列,语句,如果语句,循环语句,赋值语句,返回语句,读语句,写语句,自定义函数调用语句
ifsym, elsesym, whilesym, eqlsym, scanfsym, printfsym, leftsym, rightsym, nul, resym, period,
//if,表达式,else,while,自定义函数调用,=,输入,输出,项,因子,( ,),未知,return,.
};
class Lex
{
public:
Lex(void);
~Lex(void);
void getsym();
int getSYM();
string getstr();
int readfile();
symbol sym; //符号
string id; //自定义符号
int num; //值
string str;
string all; //全部源文
private:
int al;//自定义符号的最大长度
char *a; /* 临时符号 */
Set ss;
fstream *in;
char ch; //单独判断
int pos;//每次查找下一个单词时要起始的位置
string word[9];
symbol wsym[9];
//enum symbol wsym[norw]; /* 保留字对应的符号值 */
enum symbol ssym[256]; /* 单字符的符号值 */
int star;//字符开始
int end;//字符结束
int len;//字符串长度
int currentloc;//当前指向all哪一位置的指针
void getch(int loc=-1);
};
<file_sep>/instructions.h
#pragma once
enum fct
{
LIT,
LOD,
STO,
CAL,
INT,
JMP,
JPC,
ADD,
SUB,
MUL,
DIV,
RED,
WRT,
RET,
NUL
};
class ins
{
public:
ins(void);
ins(enum fct, int, int);
~ins(void);
void set(enum fct, int, int);
public:
enum fct f; //虚拟机代码指令
int l; //引用层与声明层的层次差
int a; //根据f的不同而不同
};
<file_sep>/uncertainadd.h
#pragma once
#include <string>
using namespace std;
class uncertainadd
{
public:
uncertainadd();
~uncertainadd(void);
uncertainadd(int,string s1);
int codeadr;//指令中的地址
string name;//要使用的名字
string proc;//查询改名字的函数名
};
<file_sep>/file.cpp
#include "file.h"
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
file::file(void)
{
}
file::~file(void)
{
}
int file::read(ins code[200])
{
char buffer[80];
fstream out;
out.open("code.txt", ios::in);
//if (out == NULL)
//{
// cout<<"codeÎļþ²»´æÔÚ"<<endl;
// return -1;
//}
int ii = 0;
while (!out.eof())
{
out.getline(buffer, 80, '\n');
char cmd[50], str[50];
int lev;
int val;
int k = 0, m = 0;
int len = strlen(buffer);
buffer[len] = ' ';
buffer[len + 1] = '\0';
for (unsigned int i = 0; i < strlen(buffer); i++)
{
if (buffer[i] == ' ')
{
str[m] = '\0';
switch (k)
{
case 1:
strcpy_s(cmd, str);
break;
case 2:
lev = atoi(str);
break;
case 3:
val = atoi(str);
k = 0;
break;
}
m = 0;
strcpy_s(str, "");
k++;
}
else
str[m++] = buffer[i];
}
if (!strcmp("LIT", cmd))
code[ii].f = LIT;
if (!strcmp("LOD", cmd))
code[ii].f = LOD;
if (!strcmp("STO", cmd))
code[ii].f = STO;
if (!strcmp("CAL", cmd))
code[ii].f = CAL;
if (!strcmp("INT", cmd))
code[ii].f = INT;
if (!strcmp("JMP", cmd))
code[ii].f = JMP;
if (!strcmp("JPC", cmd))
code[ii].f = JPC;
if (!strcmp("JMP", cmd))
code[ii].f = JMP;
if (!strcmp("ADD", cmd))
code[ii].f = ADD;
if (!strcmp("SUB", cmd))
code[ii].f = SUB;
if (!strcmp("MUL", cmd))
code[ii].f = MUL;
if (!strcmp("DIV", cmd))
code[ii].f = DIV;
if (!strcmp("RED", cmd))
code[ii].f = RED;
if (!strcmp("WRT", cmd))
code[ii].f = WRT;
if (!strcmp("RET", cmd))
code[ii].f = RET;
if (!strcmp("NUL", cmd))
code[ii].f = NUL;
code[ii].l = lev;
code[ii].a = val;
ii++;
}
out.close();
return 0;
}<file_sep>/c0/c0/3.c
int sum,count;
int a()
{
int c ;
c=10;
b();
return (c);
}
void b()
{
count = 20;
}
void main()
{
sum = a();
printf(sum);
printf(count);
}<file_sep>/Set.h
#pragma once
class Set
{
public:
Set(void);
~Set(void);
int addset(bool*, bool*, bool*, int);//²¢
int subset(bool*, bool*, bool*, int);//²î
int mulset(bool*, bool*, bool*, int);//½»
};
<file_sep>/file.h
#pragma once
#include "instructions.h"
class file
{
public:
file(void);
~file(void);
int read(ins code[]);
};
<file_sep>/uncertainadd.cpp
#include "uncertainadd.h"
uncertainadd::uncertainadd()
{
codeadr = -1;
name = "";
proc = "";
}
uncertainadd::uncertainadd(int a, string s1)
{
codeadr = a;
name = s1;
}
uncertainadd::~uncertainadd(void)
{
}
<file_sep>/interpret.cpp
#include "interpret.h"
#include<string>
#include<iostream>
using namespace std;
interpret::interpret(void)
{
}
interpret::~interpret(void)
{
}
int interpret::base(int l, stack *s, int b)//层次差,运行栈指针,当前函数数据域基址
{
int bl;
bl = b;
while (l > 0)
{
//bl=s[bl];
bl = s->data[bl];
l--;
}
return bl;
}
void interpret::start()
{
fstream inte;
inte.open("result.txt", ios::out);
ins code[200];//指令数组
file f;
if (f.read(code))
return;
int i = 0;//为code表的指针
stack st;//运行栈
stack *pst;//当前运行栈的指针
pst = &st;
int bas = 0; //基址,当前函数的数据域基地址
int a1, a2;
int temp;
while (i >= 0)//不停的取code的下一个元素
{
if (i >= 200)
{
cout << "指令下标越界!" << endl;
inte << "指令下标越界!" << "\n";
return;
}
switch (code[i].f)
{
default:cout << "指令中出现非法符号!" << endl;
return;
case LIT://将常数值取到栈顶,a为常数值
st.push(code[i].a);
break;
case LOD://将变量值取到栈顶,a为相对地址,t为层数
st.push(st.data[base(code[i].l, pst, bas) + code[i].a]);
break;
case STO://将栈顶内容送入某变量单元中,a为相对地址,t为层数
st.data[base(code[i].l, pst, bas) + code[i].a] = st.pop();
break;
case CAL://调用函数,a为函数地址
{
st.push(base(code[i].l, pst, bas));//静态链,谁定义的
st.push(bas);//动态链,谁调用的
st.push(i + 1);//父过程下一步要执行的code数组指令
bas = st.top - 2;
//st.top += code[i].a;
i = code[i].a;//跳到的code数组地址
i--;//底下写了i++
break;
}
case INT://在运行栈中为被调用的过程开辟a个单元的数据区
{
if (bas == 0)//public的时候
{
temp = code[i].a;
while (temp > 0)
{
st.push(-2);
temp--;
if (st.isfull())return;
}
}
else//函数调用过来的
{
temp = code[i].a - 3;//不用再压三个sl,tl,ra了
while (temp > 0)
{
st.push(-2);
temp--;
if (st.isfull())return;
}
}
break;
}
case JMP://无条件跳转至a地址
i = code[i].a;
i--;
break;
case JPC://条件跳转,当栈顶值为0,则跳转至a地址,否则顺序执行
if (st.gettop() == 0)
{
i = code[i].a;
i--;
}
break;
case ADD://次栈顶与栈顶相加,退两个栈元素,结果值进栈
a1 = st.pop();
a2 = st.pop();
st.push(a2 + a1);
break;
case SUB://次栈顶减去栈顶,退两个栈元素,结果值进栈
a1 = st.pop();
a2 = st.pop();
//cout << " 栈顶的值是"<<a2-a1;
st.push(a2 - a1);
break;
case MUL://次栈顶乘以栈顶,退两个栈元素,结果值进栈
a1 = st.pop();
a2 = st.pop();
st.push(a2*a1);
break;
case DIV://次栈顶除以栈顶,退两个栈元素,结果值进栈
a1 = st.pop();
a2 = st.pop();
st.push(a2 / a1);
break;
case RED://从命令行读入一个输入置于栈顶
inte << "请输入!" << "\n";
cout << "请输入:";
cin >> a1;
inte << a1 << "\n";
st.push(a1);
break;
case WRT://栈顶值输出至屏幕并换行
{
int temp_pop = st.pop();
cout << temp_pop << endl;
inte << temp_pop << "\n";
break;
}
case RET://函数调用结束后,返回调用点并退栈
{
int temp = i;
st.data[bas] = st.gettop();//将st.data(top)赋值给data(bas),把当前函数栈顶的值给 位于 这个函数数据域基址位置上的 单元
st.top = bas;//栈顶指针下移。
i = st.data[st.top + 2];//刚刚,调用的时候,存进去的父函数的即将执行的下一条指令
i--;//抵消i++的
bas = st.data[st.top + 1];//刚刚调用的时候,填入的父函数的bas指针
//
if (code[temp].a == 0)//void
{
st.top--;
}
break;
}
case NUL://cout<<"符号位NULL!"<<endl;
break;
}
if (code[i].f == NUL)
{
break;
}
i++;
}
cout << "执行完毕!" << endl;
inte << "执行完毕!" << "\n";
inte.close();
}<file_sep>/instructions.cpp
#include "instructions.h"
ins::ins(void)
{
f = NUL;
l = -1;
a = -1;
}
ins::~ins(void)
{
}
ins::ins(enum fct ff, int ll, int aa)
{
f = ff;
l = ll;
a = aa;
}
void ins::set(enum fct ff, int ll, int aa)
{
f = ff;
l = ll;
a = aa;
} | 8a30a1fd1b9ba6b4e44ad009e30809b65cbbc9b6 | [
"C",
"C++"
] | 19 | C++ | huaiwen/C0Compiler | 478579ee288ff113757ce9ef7837b94e42356145 | 7a9e3d655d881068d5aaefc1cdb37634c5ff81a2 |
refs/heads/master | <repo_name>LasVegasRubyGroup/rubyweekend<file_sep>/Gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.13'
gem 'haml'
gem 'haml-rails'
gem 'jquery-rails'
gem 'bcrypt-ruby'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'exception_notification'
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
end
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'rspec'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'sextant'
gem 'better_errors'
gem 'binding_of_caller'
end
group :production do
gem 'pg'
end
gem 'figaro'<file_sep>/weekend/apps/address_book/v1.rb
@address_book = []
russ = {
"first_name" => "Russ",
"last_name" => "Smith",
"phone" => "702-321-4912",
"email" => "<EMAIL>"
}
@address_book << russ
@address_book.each do |address|
puts address["first_name"] + " " + address["last_name"]
puts address["phone"]
puts address["email"]
end
<file_sep>/weekend/apps/twitter/v2.rb
require "rubygems"
require "twitter"
urls = Twitter.images("beiber", include_entities: true).collect { |status|
status.media.collect { |media|
media.url.inspect
}
}.flatten
urls.each do |url|
puts url
end
<file_sep>/app/models/registration.rb
class Registration < ActiveRecord::Base
attr_accessor :card_number, :card_cvc, :card_expiry_month, :card_expiry_year,
:agreed_to_refund_policy, :agreed_to_min_requirements
validates_uniqueness_of :email
validates_presence_of :name, :email
# validates_presence_of :agreed_to_refund_policy,
# :agreed_to_min_requirements,:message => "is not checked"
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :on => :create, :message => "is invalid"
attr_accessible :name, :email, :usrlib_membership
attr_accessible :card_number, :card_cvc, :card_expiry_month, :card_expiry_year
scope :ruby_weekend_2, :conditions => { :rw_number => [2] }
scope :ruby_weekend_3, :conditions => { :rw_number => [3] }
scope :ruby_weekend_4, :conditions => { :rw_number => [4] }
def self.full?
#true
self.ruby_weekend_4.count >= 22
end
def self.hidden_full?
true
end
# We do not want to store Stripe Tokens because they are invalid after first use.
def token
"#{rw_number}-#{rw_date.to_i}"
end
end
<file_sep>/weekend/apps/oo_concepts/blackjack/deck.rb
module Deck
CARDS = {
"A" => 11,
"K" => 10,
"Q" => 10,
"J" => 10,
"T" => 10,
"9" => 9,
"8" => 8,
"7" => 7,
"6" => 6,
"5" => 5,
"4" => 4,
"3" => 3,
"2" => 2
}
SUITS = ["H", "S", "C", "D"]
def new_deck
all_cards = []
CARDS.each_key do |card|
SUITS.each do |suit|
all_cards << card + suit
end
end
return all_cards
end
end<file_sep>/db/migrate/20120409213731_add_check_boxes_to_registrations.rb
class AddCheckBoxesToRegistrations < ActiveRecord::Migration
def change
add_column :registrations, :agreed_to_refund_policy, :boolean
add_column :registrations, :agreed_to_min_requirements, :boolean
end
end
<file_sep>/config/initializers/exception_notification.rb
Rubyweekend::Application.config.middleware.use ExceptionNotifier,
email_prefix: '[RubyWeekend Exception] ',
sender_address: %{"notifier" <<EMAIL>>},
exception_recipients: %w{<EMAIL> <EMAIL>}
<file_sep>/weekend/apps/address_book/v6.rb
require "rubygems"
require "json"
@address_book = if File.exists?("addresses.json")
JSON.parse(File.read("addresses.json"))
else
[]
end
def print_address(address)
puts "Name:\t\t" + address["first_name"] + " " + address["last_name"]
puts "Phone Number:\t" + address["phone"]
puts "Email Address:\t" + address["email"]
puts "\n"
end
def list
@address_book.each do |address|
print_address(address)
end
end
def add
first_name = ask("First Name? ")
last_name = ask("Last Name? ")
phone = ask("Phone Number? ")
email = ask("Email Address? ")
@address_book << {
"first_name" => first_name,
"last_name" => last_name,
"phone" => phone,
"email" => email
}
File.write("addresses.json", @address_book.to_json)
end
def search
query = ask("Query? ")
addresses = @address_book.select do |address|
"#{address["first_name"]} #{address["last_name"]}" =~ /#{query}/i
end
addresses.each do |address|
print_address(address)
end
end
puts "What would you like to do? "
puts "1. List Addresses"
puts "2. Add Address"
puts "3. Search Addresses"
print "Type number selection from above: "
case gets.chomp
when "1" then list
when "2" then add
when "3" then search
end
<file_sep>/app/mailers/registration_mailer.rb
class RegistrationMailer < ActionMailer::Base
default from: "<EMAIL>"
def confirmation_email(registration)
@registration = registration
mail(to: registration.email,
bcc: "<EMAIL>",
subject: "Ruby Weekend Registration Confirmation - #{@registration.name}")
end
end
<file_sep>/app/controllers/admin_controller.rb
class AdminController < ApplicationController
if Rails.env == "production"
http_basic_authenticate_with :name => ENV["ADMIN_NAME"],
:password => ENV["<PASSWORD>"]
else
http_basic_authenticate_with :name => 'admin',
:password => '<PASSWORD>'
end
def admin
@registered = Registration.ruby_weekend_4.order('email ASC')
@waitlist = Waitlist.order('email ASC')
end
end
<file_sep>/weekend/apps/address_book/v3.rb
require "rubygems"
@address_book = []
russ = {
"first_name" => "Russ",
"last_name" => "Smith",
"phone" => "702-321-4912",
"email" => "<EMAIL>"
}
@address_book << russ
def list
@address_book.each do |address|
puts "Name:\t\t" + address["first_name"] + " " + address["last_name"]
puts "Phone Number:\t" + address["phone"]
puts "Email Address:\t" + address["email"]
puts "\n"
end
end
def add
first_name = ask("First Name? ")
last_name = ask("Last Name? ")
phone = ask("Phone Number? ")
email = ask("Email Address? ")
@address_book << {
"first_name" => first_name,
"last_name" => last_name,
"phone" => phone,
"email" => email
}
end
choose do |menu|
menu.prompt = "What would you like to do? "
menu.choice(:list) { list }
menu.choice(:add) { add }
end
puts "What would you like to do? "
puts "1. List Addresses"
puts "2. Add Address"
print "Type number selection from above: "
choice = gets.chomp
if choice == "1"
list
else
add
end
<file_sep>/weekend/apps/twitter/reader_v1.rb
require "rubygems"
require "json"
@words = JSON.parse(File.read("words.json"))
@words.each do |k,v|
puts k + " : " + v.to_s
end
<file_sep>/weekend/apps/oo_concepts/blackjack/blackjack.rb
require_relative 'deck'
require_relative 'player'
require_relative 'dealer'
class BlackJack
include Deck
def initialize
@dealer = Dealer.new(self)
@cards = @dealer.shuffle_cards(new_deck)
@players = [@dealer]
end
def dealer
@dealer
end
def players
@players
end
def cards
@cards
end
def add_player
@players << Player.new(self)
end
end
__END__
$: << Dir.pwd
require 'blackjack'
game = BlackJack.new
3.times { game.add_player }
game.dealer.deal
<file_sep>/db/migrate/20130423041122_remove_usrlib_membership_and_token_and_from_registrations.rb
class RemoveUsrlibMembershipAndTokenAndFromRegistrations < ActiveRecord::Migration
def up
remove_column :registrations, :usrlib_membership
remove_column :registrations, :token
end
def down
add_column :registrations, :token, :string
add_column :registrations, :usrlib_membership, :boolean
end
end
<file_sep>/app/controllers/waitlists_controller.rb
class WaitlistsController < ApplicationController
def new
@waitlist = Waitlist.new
end
def create
@waitlist = Waitlist.new(params[:waitlist])
if @waitlist.save
redirect_to waitlist_path(@waitlist)
else
render :new
end
end
def show
@waitlist = Waitlist.find(params[:id])
end
end
<file_sep>/app/models/waitlist.rb
class Waitlist < ActiveRecord::Base
validates_presence_of :name, :email
validates_uniqueness_of :email
def clean_up
registration_emails = Registration.all.map { |r| r.email.downcase }
if registration_emails.include?(self.email.downcase)
self.destroy
end
end
end
<file_sep>/db/migrate/20120409192312_add_rw_details_to_registrations.rb
class AddRwDetailsToRegistrations < ActiveRecord::Migration
def change
add_column :registrations, :rw_number, :integer
add_column :registrations, :rw_date, :datetime
end
end
<file_sep>/config/routes.rb
Rubyweekend::Application.routes.draw do
resources :waitlists
resources :registrations
resources :hidden_registrations
#match '/dylan_registration', :to => 'hidden_registrations#new'
root :to => "pages#index"
match '/downloads', :to => 'pages#downloads'
match '/challenge', :to => 'pages#challenge'
match '/vote', :to => 'pages#vote'
match '/resources', :to => 'pages#resources', :as => :resources
match '/survey', :to => 'pages#survey', :as => :survey
match '/refund_policy', :to => 'pages#refund_policy', :as => :refund_policy
match '/hardware_requirements', :to => 'pages#hardware_requirements', :as => :hardware_requirements
match '/glossary', :to => 'pages#glossary', :as => :glossary
match '/admin', :to => 'admin#admin', :as => :admin
match '/notification_list', :to => 'waitlists#new', :as => :notification_list
end
<file_sep>/weekend/apps/twitter/v4.rb
require "rubygems"
require "tweetstream"
TweetStream.configure do |config|
config.username = "username"
config.password = "<PASSWORD>"
config.auth_method = :basic
end
@words = {}
TweetStream::Client.new.sample do |status|
status.text.split(" ").each do |word|
if @words[word]
@words[word] += 1
else
@words[word] = 1
end
end
puts @words.inspect
end
<file_sep>/spec/models/registration_spec.rb
require 'spec_helper'
describe Registration do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:email) }
end
<file_sep>/weekend/apps/twitter/v3.rb
require "rubygems"
require "tweetstream"
TweetStream.configure do |config|
config.username = "username"
config.password = "<PASSWORD>"
config.auth_method = :basic
end
TweetStream::Client.new.sample do |status|
puts status.text
end
<file_sep>/app/controllers/hidden_registrations_controller.rb
class HiddenRegistrationsController < ApplicationController
def new
render("registrations/full") and return if Registration.hidden_full?
@registration = Registration.new
end
def create
@registration = Registration.new(params[:registration])
token = create_token(@registration)
if @registration.save
@registration = charge_token(token, @registration)
@registration.save
RegistrationMailer.confirmation_email(@registration).deliver
case Rails.env
when "production" then redirect_to(hidden_registration_url(@registration.token, :host => "rubyweekend.heroku.com", :protocol => "http://"))
else redirect_to(hidden_registration_path(@registration.token))
end
else
render(:new)
end
rescue Stripe::InvalidRequestError, Stripe::CardError => e
@registration.errors.add(:base, e.message)
render(:new)
end
def show
@registration = Registration.find_by_token(params[:id])
end
private
def create_token(registration)
Stripe::Token.create(
card: {
number: registration.card_number,
exp_month: registration.card_expiry_month,
exp_year: registration.card_expiry_year,
cvc: registration.card_cvc },
amount: 5000,
currency: "usd")
end
def charge_token(token, registration)
charge = Stripe::Charge.create(
amount: token.amount,
currency: token.currency,
card: token.id,
description: "Registration charge for Ruby Weekend.")
registration.amount = token.amount
registration.token = charge.id
registration.card_last_four = token.card.last4
registration.card_type = token.card.type
registration
end
def kyle
end
end
<file_sep>/db/migrate/20111207015641_add_usr_lib_membership_to_registrations.rb
class AddUsrLibMembershipToRegistrations < ActiveRecord::Migration
def change
add_column :registrations, :usrlib_membership, :boolean
end
end
<file_sep>/app/controllers/pages_controller.rb
class PagesController < ApplicationController
def index
@registration_url = case Rails.env
when "production" then new_registration_url(:host => "rubyweekend.heroku.com", :protocol => "https://")
else new_registration_path
end
end
def resources
end
def survey
end
def refund_policy
@registration_url = case Rails.env
when "production" then new_registration_url(:host => "rubyweekend.heroku.com", :protocol => "https://")
else new_registration_path
end
end
def hardware_requirements
#render :layout => false
end
def glossary
end
def challenge
end
def downloads
end
def vote
end
end
<file_sep>/weekend/apps/twitter/reader_v2.rb
require "rubygems"
require "json"
@words = JSON.parse(File.read("words.json"))
puts "What would you like to see? "
puts "1. All Words"
puts "2. Top 10"
choice = gets.chomp
def print_word(word, count)
puts word + " : " + count.to_s
end
case choice
when "1"
@words.each do |k,v|
print_word(k,v)
end
when "2"
@words.sort { |x,y| x <=> y }[0..10].each do |k,v|
print_word(k,v)
end
end
<file_sep>/app/controllers/registrations_controller.rb
class RegistrationsController < ApplicationController
# Amount is in cents
@@AMOUNT = 10000
def new
render("full") and return if Registration.full?
@registration = Registration.new
end
def create
@registration = Registration.new(params[:registration])
@registration.rw_number = 4
@registration.rw_date = Time.now
if @registration.save
token = create_token(@registration)
customer = create_customer(token, @registration)
create_charge(customer, @registration)
RegistrationMailer.confirmation_email(@registration).deliver
# case Rails.env
# when "production" then redirect_to(registration_url(@registration.token, :host => "rubyweekend.heroku.com", :protocol => "http://"))
# else redirect_to(registration_path(@registration.token))
# end
render(:create)
else
render(:new)
end
rescue Stripe::InvalidRequestError, Stripe::CardError => e
@registration.errors.add(:base, e.message)
render(:new)
end
def show
@registration = Registration.find_by_token(params[:id])
end
private
def create_token(registration)
Stripe::Token.create(
card: {
number: registration.card_number,
exp_month: registration.card_expiry_month,
exp_year: registration.card_expiry_year,
cvc: registration.card_cvc,
})
end
def create_charge(customer, registration)
charge = Stripe::Charge.create(
amount: @@AMOUNT,
currency: "usd",
description: "Registration charge for Ruby Weekend.",
customer: customer.id)
end
def create_customer(token, registration)
customer = Stripe::Customer.create(
card: token.id,
email: registration.email
)
end
end
<file_sep>/config/initializers/better_errors.rb
# Because Sublime Text is the shit
BetterErrors.editor = :sublime if defined? BetterErrors
<file_sep>/weekend/apps/oo_concepts/people/people.rb
class Animal
def walk
end
def run
end
def eat(food)
end
end
class Person < Animal
attr_accessor :sex, :birthday, :name
def initialize(male_or_female, name)
self.sex = male_or_female
self.name = name
self.birthday = Time.now
end
def say(something)
puts something
end
end
module Marriage
def join_in_matramony(person, other_person)
puts "We are gathered here today to witness the marriage of #{person.name} and #{other_person.name}"
end
def take_a_vacation(person, other_person)
puts "#{person.name} and #{other_person.name} go to Fiji."
end
def have_a_child(person, other_person)
sex_of_baby = [:male, :female].sort_by { rand }.first
name_of_baby = person.name[0..2] + other_person.name[-1..2]
new_baby = Person.new(sex_of_baby, name_of_baby)
puts "#{new_baby.name} is born on #{new_baby.birthday}!"
end
end<file_sep>/weekend/apps/oo_concepts/blackjack/player.rb
class Player
def initialize(game)
@game = game
@hand = []
end
def game
@game
end
def hand
@hand
end
def take_card(card)
@hand << card
end
def hit
next_card = game.cards.shift
take_card(next_card)
end
def stay
end
def points
#@hand.inject(0) { |sum, card| sum += Deck::CARDS[card[0]] }
sum = 0
@hand.each do |card|
sum += Deck::CARDS[card[0]]
end
sum
end
end<file_sep>/weekend/apps/oo_concepts/blackjack/dealer.rb
class Dealer < Player
def shuffle_cards(cards_to_be_shuffled)
cards_to_be_shuffled.sort_by do
rand
end
end
def deal
2.times do
game.players.each do |player|
player.hit
end
end
end
end<file_sep>/weekend/apps/twitter/v1.rb
require "rubygems"
require "twitter"
Twitter.search("beiber").each do |status|
puts status[:text]
end
<file_sep>/weekend/apps/address_book/v5.rb
require "rubygems"
require "json"
@address_book = if File.exists?("addresses.json")
JSON.parse(File.read("addresses.json"))
else
[]
end
def list
@address_book.each do |address|
puts "Name:\t\t" + address["first_name"] + " " + address["last_name"]
puts "Phone Number:\t" + address["phone"]
puts "Email Address:\t" + address["email"]
puts "\n"
end
end
def add
first_name = ask("First Name? ")
last_name = ask("Last Name? ")
phone = ask("Phone Number? ")
email = ask("Email Address? ")
@address_book << {
"first_name" => first_name,
"last_name" => last_name,
"phone" => phone,
"email" => email
}
File.write("addresses.json", @address_book.to_json)
end
def search
query = ask("Query? ")
addresses = @address_book.select do |address|
"#{address["first_name"]} #{address["last_name"]}" =~ /#{query}/i
end
addresses.each do |address|
puts "Name:\t\t#{address["first_name"]} #{address["last_name"]}"
puts "Phone Number:\t#{address["phone"]}"
puts "Email Address:\t#{address["email"]}"
puts "\n"
end
end
choose do |menu|
menu.prompt = "What would you like to do? "
menu.choice(:list) { list }
menu.choice(:add) { add }
menu.choice(:search) { search }
end
puts "What would you like to do? "
puts "1. List Addresses"
puts "2. Add Address"
puts "3. Search Addresses"
print "Type number selection from above: "
choice = gets.chomp
if choice == "1"
list
elsif choice == "2"
add
elsif choice == "3"
search
end
| c2a7b120dbf17815fe35ca19b8a6ad9bf8641d2e | [
"Ruby"
] | 32 | Ruby | LasVegasRubyGroup/rubyweekend | d32e6801169f398a742a374a0299042b5aa0a45e | cd1bd9ed3a3094c8e5500e0fe9985b95238af6f7 |
refs/heads/master | <repo_name>franco954/Editor-de-texto<file_sep>/README.md
# Bloc de notas
Bloc de notas realizado en python con la libreria Tkinter
<img src="./recursos/bloc 2.PNG" width="380"><file_sep>/Editor de Texto.py
from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
root=Tk()
root.config(width=500, height=600)
root.title("Editor de Texto")
# root.iconbitmap('C:\recursos\icono.ico')
#usada para la ventana emergente de abrir
ruta=""
#Ventanas emergentes
def infoAcercaDe():
varAcercaDe = messagebox.showinfo("Editor de Texto", "Copyright * 2020 * Version 1.0")
def infoLicencia():
varLicencia = messagebox.showwarning("Licencia", "Su Licencia tiene validez hasta el 26/07/2025")
def confirmacionSalir():
varSalir = messagebox.askquestion("Salir", "¿Deseas salir de la aplicacion?")
if varSalir=="yes":
root.quit()
#Funciones del menu archivo
def nuevoArchivo():
mensajeInferiorDerecha.set("Nuevo archivo")
cajaTexto.delete(1.0, END)
ruta=""
root.title("Editor de Texto")
#abrir archivo ventana emergente
def abrirArchivo():
global ruta
mensajeInferiorDerecha.set("Abrir archivo")
ruta = filedialog.askopenfilename(initialdir="C:", filetypes=(("Abrir ficheros de texto","*.txt"),("Todos los ficheros","*.*")),
title="Abrir un Fichero")
if ruta!="":
fichero = open(ruta, "r")
contenido = fichero.read()
cajaTexto.delete(1.0, "end") #nos aseguramos que este vacio
cajaTexto.insert("insert", contenido) #insertamos contenido
fichero.close() #cerramos fichero abierto
root.title(ruta + " - Editor de Texto") #cambiamos el titulo a la ventana
def guardarArchivo():
mensajeInferiorDerecha.set("Guardar archivo")
global ruta
if ruta!="":
contenido = cajaTexto.get(1.0, "end-1c") #recuperamos el texto
fichero = open(ruta, "w+") #creamos el fichero o abrimos
fichero.write(contenido) #volcamos el contenido
fichero.close()
mensajeInferiorDerecha.set("Fichero guardado correctamente")
else:
guardarArchivoComo()
def guardarArchivoComo():
mensajeInferiorDerecha.set("Guardar archivo como")
global ruta
fichero = filedialog.asksaveasfile(title="Guardar fichero", mode="w", defaultextension=".txt")
ruta = fichero.name
if fichero is not None:
contenido = cajaTexto.get(1.0, "end-1c")
fichero = open(ruta, "w+")
fichero.write(contenido)
fichero.close()
mensajeInferiorDerecha.set("Fichero guardado correctamente")
else:
mensajeInferiorDerecha.set("Guardado cancelado")
#COLORES DE FONDO
def colorNegro():
cajaTexto.config(bg="black")
def colorAzul():
cajaTexto.config(bg="light blue")
def colorRojo():
cajaTexto.config(bg="red")
def colorVerde():
cajaTexto.config(bg="light green")
def colorPredeterminado():
cajaTexto.config(bg="white")
#COLORES LETRA
def colorBlancoLetra():
cajaTexto.config(fg="white")
def colorVerdeLetra():
cajaTexto.config(fg="green")
def colorAzulLetra():
cajaTexto.config(fg="blue")
def colorRojoLetra():
cajaTexto.config(fg="red")
def colorPredeterminadoLetra():
cajaTexto.config(fg="black")
#Tipos de letra
def tipoLetra1():
cajaTexto.config(font=("Calibri"))
mensajeInferiorDatosTipo.set("Letra: Calibri")
def tipoLetra2():
cajaTexto.config(font=("Arial"))
mensajeInferiorDatosTipo.set("Letra: Arial")
def tipoLetra3():
cajaTexto.config(font=("Georgia"))
mensajeInferiorDatosTipo.set("Letra: Georgia")
def tipoLetra4():
cajaTexto.config(font=("Consolas"))
mensajeInferiorDatosTipo.set("Letra: Consolas")
#Tamaños de letra
def tamanoLetra1():
cajaTexto.config(font=8)
mensajeInferiorDatos.set("Tamaño: 8")
def tamanoLetra2():
cajaTexto.config(font=12)
mensajeInferiorDatos.set("Tamaño: 12")
def tamanoLetra3():
cajaTexto.config(font=15)
mensajeInferiorDatos.set("Tamaño: 15")
def tamanoLetra4():
cajaTexto.config(font=18)
mensajeInferiorDatos.set("Tamaño: 18")
def tamanoLetra5():
cajaTexto.config(font=22)
mensajeInferiorDatos.set("Tamaño: 22")
#MENU
menuBar = Menu(root)
fileMenu=Menu(menuBar, tearoff=0)
fileMenu.add_command(label="Nuevo", command=nuevoArchivo)
fileMenu.add_command(label="Abrir", command=abrirArchivo)
fileMenu.add_command(label="Guardar", command=guardarArchivo)
fileMenu.add_command(label="Guardar como...", command=guardarArchivoComo)
fileMenu.add_separator()
fileMenu.add_command(label="Salir", command=confirmacionSalir)
editMenu=Menu(menuBar, tearoff=0)
colorEditMenu=Menu(editMenu, tearoff=0)
colorEditMenu.add_command(label="Negro", command=colorNegro)
colorEditMenu.add_command(label="Azul", command=colorAzul)
colorEditMenu.add_command(label="Rojo", command=colorRojo)
colorEditMenu.add_command(label="Verde", command=colorVerde)
colorEditMenu.add_command(label="Predeterminado", command=colorPredeterminado)
letraEditMenu=Menu(editMenu, tearoff=0)
letraEditMenuTipo=Menu(letraEditMenu, tearoff=0)
letraEditMenuTipo.add_command(label="Calibri", command=tipoLetra1)
letraEditMenuTipo.add_command(label="Arial", command=tipoLetra2)
letraEditMenuTipo.add_command(label="Georgia", command=tipoLetra3)
letraEditMenuTipo.add_command(label="Predeterminado", command=tipoLetra4)
letraEditMenuColor=Menu(letraEditMenu, tearoff=0)
letraEditMenuColor.add_command(label="Blanco", command=colorBlancoLetra)
letraEditMenuColor.add_command(label="Verde", command=colorVerdeLetra)
letraEditMenuColor.add_command(label="Azul", command=colorAzulLetra)
letraEditMenuColor.add_command(label="Rojo", command=colorRojoLetra)
letraEditMenuColor.add_command(label="Predeterminado", command=colorPredeterminadoLetra)
verMenu=Menu(menuBar, tearoff=0)
verMenu.add_command(label="Fecha y Hora")
zoomVerMenu=Menu(verMenu, tearoff=0)
helpMenu=Menu(menuBar, tearoff=0)
helpMenu.add_command(label="Licencia", command=infoLicencia)
helpMenu.add_command(label="Enviar Comentarios")
helpMenu.add_separator()
helpMenu.add_command(label="Acerca de...", command=infoAcercaDe)
editMenu.add_cascade(label="Fondo ", menu=colorEditMenu)
editMenu.add_cascade(label="Letra", menu=letraEditMenu)
letraEditMenu.add_cascade(label="Color", menu=letraEditMenuColor)
letraEditMenu.add_cascade(label="Tipo", menu=letraEditMenuTipo)
menuBar.add_cascade(label="Archivo", menu=fileMenu)
menuBar.add_cascade(label="Editar", menu=editMenu)
menuBar.add_cascade(label="Ver", menu=verMenu)
menuBar.add_cascade(label="Ayuda", menu=helpMenu)
#Hoja para escribir
cajaTexto = Text(root)
cajaTexto.pack(fill="both", expand=1)
cajaTexto.config(pady=1, padx=1, bd=2, relief="sunken", font=("consolas", 12,))
#Mensaje inferior
mensajeInferior = StringVar()
mensajeInferior.set("Copyright 2020 - <NAME>")
labelInferior = Label(root, textvar=mensajeInferior)
labelInferior.pack(side="left")
#label de tamaño
mensajeInferiorDatos = StringVar()
mensajeInferiorDatos.set("- Tamaño: 12 ")
labelInferiorDatos = Label(root, textvar=mensajeInferiorDatos)
labelInferiorDatos.pack(side="right")
#label de tipo de letra
mensajeInferiorDatosTipo = StringVar()
mensajeInferiorDatosTipo.set("- Letra: Consolas")
labelInferiorDatosTipo = Label(root, textvar=mensajeInferiorDatosTipo)
labelInferiorDatosTipo.pack(side="right")
#mensaje inferior derecha
mensajeInferiorDerecha = StringVar()
mensajeInferiorDerecha.set("")
labelInferiorDerecho=Label(root, textvar=mensajeInferiorDerecha)
labelInferiorDerecho.pack(side="left")
root.config(menu=menuBar)
root.mainloop()
| 684fa091eb7ad723a1faed7e58634bee4701c046 | [
"Markdown",
"Python"
] | 2 | Markdown | franco954/Editor-de-texto | aadc61ade01492e4642aef80cd565351fe749bf2 | 3db98869d53a6851498ebc9d2df3061d8ef58e06 |
refs/heads/master | <repo_name>devinhenkel/nodemini<file_sep>/models/family.js
var apoc = require('apoc');
//var User = require('../models/user');
//module.exports = mongoose.model('Family', schema);
<file_sep>/assets/app/family/relationship.component.ts
import { Component, OnInit } from "@angular/core";
import { RelationshipService } from "./relationship.service";
@Component({
selector: 'my-member',
template: `
<h1>Relationships</h1>
<div class="row spacing" *ngFor="let member of members">
<section class="col-md-8 col-md-offset-2">
<article class="panel panel-default">
<my-member><div class="panel-body">{{member["x.firstname"]}} {{member["x.lastname"]}}</div></my-member>
</article>
</section>
</div>
`,
directives: []
})
export class RelationshipComponent implements OnInit {
constructor(private _relationshipService: RelationshipService) {}
members = [];
ngOnInit() {
this._relationshipService.getAll()
.subscribe(
members => {
//console.log(members);
this.members = members;
console.log(this.members);
}
);
}
}
<file_sep>/routes/family.js
var express = require('express');
var neo4j = require('neo4j');
if (neo4j){
var db = new neo4j.GraphDatabase('http://neo4j:G00fu$3141@localhost:7474');
}
var router = express.Router();
router.get('/', function(req, res, next){
if (db){
var queryString = 'MATCH (x:Person) RETURN x.firstname, x.lastname ORDER BY x.lastname, x.firstname';
var node = db.cypher({
query: queryString,
params: {
},
}, function (err, results) {
if (err) throw err;
var result = results;
if (!result) {
console.log('No user found.');
} else {
var user = result;
console.log("route:"+JSON.stringify(user, null, 4));
res.send(JSON.stringify(user, null, 4));
}
//response.send('pages/graphene', { results: results, something: "else" });
});
} else {
res.send('db not started');
}
});
router.get('/:relationship/:name', function(req, res, next){
console.log(req.params.name);
if (db){
var queryString = '';
if (req.params.relationship=='cousins'){
queryString = 'MATCH (u:Person {firstname: {firstname}})<-[:MOTHER|:FATHER]-(v:Person)<-[:BROTHER|:SISTER]-(w:Person)<-[:SON|:DAUGHTER]-(x) RETURN x.firstname, x.lastname';
}
if (queryString === '' && req.params.relationship=='parents'){
queryString = 'MATCH (u:Person {firstname: {firstname}})<-[:MOTHER|:FATHER]-(x) RETURN x.firstname, x.lastname';
}
if (queryString === '' && req.params.relationship=='siblings'){
queryString = 'MATCH (u:Person {firstname: {firstname}})<-[:BROTHER|:SISTER]-(x) RETURN x.firstname, x.lastname';
}
if (queryString === '' && req.params.relationship=='aunts'){
queryString = 'MATCH (u:Person {firstname: {firstname}})<-[:MOTHER|:FATHER]-(v:Person)<-[:SISTER]-(x) RETURN x.firstname, x.lastname';
}
if (queryString === '' && req.params.relationship=='uncles'){
queryString = 'MATCH (u:Person {firstname: {firstname}})<-[:MOTHER|:FATHER]-(v:Person)<-[:BROTHER]-(x) RETURN x.firstname, x.lastname';
}
var node = db.cypher({
query: queryString,
params: {
firstname: req.params.name,
},
}, function (err, results) {
if (err) throw err;
var result = results;
if (!result) {
console.log('No user found.');
} else {
var user = result;
//console.log(JSON.stringify(user, null, 4));
res.send(JSON.stringify(user, null, 4));
}
//response.send('pages/graphene', { results: results, something: "else" });
});
} else {
res.send('db not started');
}
});
module.exports = router;
<file_sep>/assets/app/family/family.service.ts
import { Http, Headers } from "@angular/http";
import { Injectable, EventEmitter } from "@angular/core";
import 'rxjs/Rx';
import { Observable } from "rxjs/Observable";
@Injectable()
export class FamilyService {
members = [];
constructor (private _http: Http) {}
getAll() {
return this._http.get('/familyapi')
.map(response => {
//console.log("service: "+response._body);
const data = response.json();
let members: any[] = data;
return members;
})
.catch(error => Observable.throw(error));
}
}
<file_sep>/assets/app/family/family.component.ts
import { Component } from "@angular/core";
import { Routes, ROUTER_DIRECTIVES } from "@angular/router";
import { FamilyListComponent } from "./family-list.component";
import { RelationshipComponent } from "./relationship.component";
@Component({
selector: 'my-auth',
template: `
<header class="row spacing">
<nav class="col-md-8 col-md-offset-2">
<ul class="nav nav-tabs">
<li><a [routerLink]="['./list']">List</a></li>
<li><a [routerLink]="['./relationship']">Relationship</a></li>
</ul>
</nav>
</header>
<div class="row spacing">
<router-outlet></router-outlet>
</div>
`,
directives: [ROUTER_DIRECTIVES],
styles: [`
.router-link-active {
color: #555;
cursor: default;
background-color: #fff;
border: 1px solid #ddd;
border-bottom-color: transparent;
}
`]
})
@Routes([
{path: '/list', component: FamilyListComponent},
{path: '/relationship', component: RelationshipComponent}
])
export class FamilyComponent {
}
<file_sep>/assets/app/family/family-list.component.ts
import { Component, OnInit } from "@angular/core";
import { Routes, ROUTER_DIRECTIVES } from "@angular/router";
import { RelationshipComponent } from "./relationship.component";
import { FamilyService } from "./family.service";
@Component({
selector: 'my-family',
template: `
<div class="row spacing" *ngFor="let member of members">
<section class="col-md-8 col-md-offset-2">
<article class="panel panel-default">
<my-member><div class="panel-body">{{member["x.firstname"]}} {{member["x.lastname"]}}</div></my-member>
</article>
</section>
</div>
`,
directives: [ROUTER_DIRECTIVES]
})
@Routes([
{path: '/relationship', component: RelationshipComponent}
])
export class FamilyListComponent implements OnInit {
constructor(private _familyService: FamilyService) {}
members = [];
ngOnInit() {
this._familyService.getAll()
.subscribe(
members => {
//console.log(members);
this.members = members;
//this._familyService.members = members;
console.log(this.members);
}
);
}
}
| 54ec337bd675fcf6d0808a5a8d95e84429bccc06 | [
"JavaScript",
"TypeScript"
] | 6 | JavaScript | devinhenkel/nodemini | 234362e9150b8dc0c8af0b2f7b795b827dfce7a6 | 57b8bc2a2135cb88d0c27065648fe1a2a88464e5 |
refs/heads/master | <file_sep>function getEle(id) {
return document.getElementById(id);
}
//var list = [];
var dssv = new DanhSachSinhVien();
var validation = new Validation();
getLocalStorage();
function addUser(){
console.log("Day la addUser thanh cong cua thuan");
}
function layDuLieuDauVao(isAdd)
{
var _maSV = getEle("txtMaSV").value;
var _tenSV = getEle("txtTenSV").value;
var _email = getEle("txtEmail").value;
var _matkhau = getEle("txtPass").value;
var _ngaysinh = getEle("txtNgaySinh").value;
var _khoahoc = getEle("khSV").value;
var _diemtoan = getEle("txtDiemToan").value;
var _diemly = getEle("txtDiemLy").value;
var _diemhoa = getEle("txtDiemHoa").value;
var isValid = true;
if(isAdd){
isValid =
validation.kiemTraRong(
_maSV,
"divMaErr",
"(*)Ma sinh vien khong dc rong"
) &&
validation.kiemTraDoDaiKiTu(
_maSV,
"divMaErr",
"(*)Do dai ki tu tu 4 den 10",
4,
10
) &&
validation.kiemTraTrungMaSV(
_maSV,
"divMaErr",
"(*)Ma sinh vien trung",
dssv.list
);
}
isValid &=
validation.kiemTraRong(
_tenSV,
"divTenErr",
"(*)Ten sinh vien khong dc rong"
) &&
validation.kiemTraKiTuChuoi(
_tenSV,
"divTenErr",
"(*)Ten sinh vien phai la chu"
);
isValid &=
validation.kiemTraRong(
_email,
"divEmailErr",
"(*)Email sinh vien khong dc rong"
) &&
validation.kiemTraEmail(_email, "divEmailErr", "(*)Email khong hop le");
isValid &=
validation.kiemTraRong(
_matkhau,
"divMatKhauErr",
"(*)Mat khau khong dc rong"
) &&
validation.kiemTraMatKhau(
_matkhau,
"divMatKhauErr",
"(*)Mat khau khong hop le"
);
isValid &=
validation.kiemTraRong(
_ngaysinh,
"divNgaySinhErr",
"(*)Ngay sinh khong dc rong"
) &&
validation.kiemTraNgaySinh(
_ngaysinh,
"divNgaySinhErr",
"(*)Ngay sinh chua dung du=inh dang"
);
//validation.kiemTraRong(_khoahoc,"divKhErr","(*)Khoa hoc khong dc rong");
isValid &= validation.kiemTraKhoaHoc(
"khSV",
"divKhErr",
"(*)Vui long chon khoa hoc"
);
isValid &=
validation.kiemTraRong(
_diemtoan,
"divToanErr",
"(*)Diem toan khong dc rong"
) &&
validation.kiemTraDiem(
_diemtoan,
"divToanErr",
"(*)Diem khong dung dinh dang"
);
isValid &=
validation.kiemTraRong(_diemly, "divLyErr", "(*)Diem ly khong dc rong") &&
validation.kiemTraDiem(_diemly, "divLyErr", "(*)Diem khong dung dinh dang");
isValid &=
validation.kiemTraRong(
_diemhoa,
"divHoaErr",
"(*)Diem hoa khong dc rong"
) &&
validation.kiemTraDiem(
_diemhoa,
"divHoaErr",
"(*)Diem khong dung dinh dang"
);
if(isValid){
var sinhVien = new SinhVien(
_maSV,
_tenSV,
_email,
_matkhau,
_ngaysinh,
_khoahoc,
_diemtoan,
_diemly,
_diemhoa
);
return sinhVien;
}
return null;
}
getEle("btnAdd").addEventListener("click", function () {
/* */
//console.log(sinhVien);
/* function kiemTraRong(input,divId,mess) {
if (input.trim() === "") {
getEle(divId).innerHTML = mess;
//getEle("divMaErr").style.color = "red";
//getEle("divMaErr").classList.add("alert");
//getEle("divMaErr").classList.add("alert-danger");
getEle(divId).className = "alert alert-danger";
return false;
} else {
getEle(divId).innerHTML = "";
getEle(divId).className = "";
return true
}
} */
//console.log(isValid);
//isValid = true
//console.log(123);
var sinhVien = layDuLieuDauVao(true);
if (sinhVien) {
sinhVien.tinhDTB();
dssv.themSinhVien(sinhVien);
//console.log(dssv);
taoBang(dssv.list);
setLocalStorage();
}
});
function taoBang(arr) {
getEle("tbodySinhVien").innerHTML = "";
for (var i = 0; i < arr.length; i++) {
var tagTR = document.createElement("tr");
var tagTD_MaSV = document.createElement("td");
var tagTD_TenSV = document.createElement("td");
var tagTD_Email = document.createElement("td");
var tagTD_NgaySinh = document.createElement("td");
var tagTD_KhoaHoc = document.createElement("td");
var tagTD_DTB = document.createElement("td");
var tagTD_Button_Edit = document.createElement("td");
var tagTD_Button_Delete = document.createElement("td");
tagTD_MaSV.innerHTML = arr[i].maSV;
tagTD_TenSV.innerHTML = arr[i].tenSV;
tagTD_Email.innerHTML = arr[i].email;
tagTD_NgaySinh.innerHTML = arr[i].ngaySinh;
tagTD_KhoaHoc.innerHTML = arr[i].khoaHoc;
//arr[i].tinhDTB();
tagTD_DTB.innerHTML = /* arr[i].diemTB */ arr[i].diemTB;
tagTD_Button_Edit.innerHTML = '<button class="btn btn-info" onclick = "suaSinhVien(\''+arr[i].maSV+'\')">Sua</button>';
tagTD_Button_Delete.innerHTML = '<button class="btn btn-danger" onclick = "xoaSinhVien(\''+arr[i].maSV+'\')">Xoa</button>';
tagTR.appendChild(tagTD_MaSV);
tagTR.appendChild(tagTD_TenSV);
tagTR.appendChild(tagTD_Email);
tagTR.appendChild(tagTD_NgaySinh);
tagTR.appendChild(tagTD_KhoaHoc);
tagTR.appendChild(tagTD_DTB);
tagTR.appendChild(tagTD_Button_Edit);
tagTR.appendChild(tagTD_Button_Delete);
getEle("tbodySinhVien").appendChild(tagTR);
}
}
/* getEle("btnDelete").addEventListener("click",function(){
console.log("123");
}); */
function xoaSinhVien(maSV){
//console.log(maSV);
dssv._xoaSinhVien(maSV);
taoBang(dssv.list);
setLocalStorage();
}
function suaSinhVien(maSV)
{
//console.log(maSV);
var sinhVien = dssv.layThongTinSinhVien(maSV);
//console.log(sinhVien);
getEle("txtMaSV").value = sinhVien.maSV;
getEle("txtMaSV").disabled = true;
getEle("txtTenSV").value = sinhVien.tenSV;
getEle("txtEmail").value = sinhVien.email;
getEle("txtPass").value = sinhVien.matKhau;
getEle("txtNgaySinh").value = sinhVien.ngaySinh;
getEle("khSV").value = sinhVien.khoaHoc;
getEle("txtDiemToan").value = sinhVien.diemToan;
getEle("txtDiemLy").value = sinhVien.diemLy;
getEle("txtDiemHoa").value = sinhVien.diemHoa;
getEle("btnUpdate").style.display = "inline-block";
}
getEle("btnUpdate").addEventListener("click",function(){
//console.log(123);
/* var _maSV = getEle("txtMaSV").value;
var _tenSV = getEle("txtTenSV").value;
var _email = getEle("txtEmail").value;
var _matkhau = getEle("txtPass").value;
var _ngaysinh = getEle("txtNgaySinh").value;
var _khoahoc = getEle("khSV").value;
var _diemtoan = getEle("txtDiemToan").value;
var _diemly = getEle("txtDiemLy").value;
var _diemhoa = getEle("txtDiemHoa").value; */
var sinhVien = layDuLieuDauVao(false);
sinhVien.tinhDTB();
//console.log(sinhVien);
dssv.capNhatThongTin(sinhVien);
taoBang(dssv.list);
setLocalStorage();
});
getEle("btnReset").addEventListener("click",function(){
});
getEle("txtSearch").addEventListener("keyup",function(){
var keyWord = getEle("txtSearch").value;
console.log(keyWord);
var mangTimKiem = dssv.timKiemSinhVien(keyWord);
taoBang(mangTimKiem);
});
function setLocalStorage() {
var arrString = JSON.stringify(dssv.list);
localStorage.setItem("DSSV1", arrString);
}
function getLocalStorage() {
if (localStorage.getItem("DSSV1")) {
dssv.list = JSON.parse(localStorage.getItem("DSSV1"));
//localStorage.getItem("DSV1");
taoBang(dssv.list);
}
}
<file_sep>function DanhSachSinhVien()
{
this.list = [];
this.themSinhVien = function(sinhVien){
this.list.push(sinhVien);
};
this.timViTri = function(maSV){
for(var i = 0;i<this.list.length;i++)
{
if(this.list[i].maSV == maSV) return i;
}
return i;
}
this._xoaSinhVien = function(maSV){
var index = this.timViTri(maSV);
if(index!==-1){
this.list.splice(index,1);
}
}
this.layThongTinSinhVien = function(maSV){
var index = this.timViTri(maSV);
if(index!==-1)
{
return this.list[index];
}
}
this.capNhatThongTin = function(sinhVien){
var index = this.timViTri(sinhVien.maSV);
/* this.list[index].tenSV = sinhVien.tenSV;
this.list[index].email = sinhVien.email;
this.list[index].matKhau = sinhVien.matKhau;
this.list[index].ngaySinh = sinhVien.ngaySinh;
this.list[index].khoaHoc = sinhVien.khoaHoc;
this.list[index].diemToan = sinhVien.diemToan;
this.list[index].diemLy = sinhVien.diemLy;
this.list[index].diemHoa = sinhVien.diemHoa; */
this.list[index] = sinhVien;
}
/* this.timKiemSinhVien = function(keyWord){
} */
}
DanhSachSinhVien.prototype.timKiemSinhVien = function(keyWord){
var listTimKiem = [];
for(var i = 0;i<this.list.length;i++)
{
if(this.list[i].tenSV.toLowerCase().indexOf(keyWord.toLowerCase())!==-1)
{
listTimKiem.push(this.list[i]);
}
}
return listTimKiem;
} | 0da3b7efab562c1f3db166af9ea8255cdca687e5 | [
"JavaScript"
] | 2 | JavaScript | NguyenDucThuan-CS/qlsv_practice | 3325f2bc7455b2bf13dd1e696de3427f51b6db02 | fa6a9fc22ed0bebf11b826a053f9b93b0b55da06 |
refs/heads/master | <repo_name>kistompa/DeveloperHomework<file_sep>/src/main/java/hu/tt/model/TransactionType.java
package hu.tt.model;
public enum TransactionType {
Deposit,Withdrawal,Transfer,History,User
}
<file_sep>/src/main/java/hu/tt/services/UserTransactionService.java
package hu.tt.services;
import java.util.List;
import hu.tt.model.UserTransaction;
public interface UserTransactionService {
List<UserTransaction> getHistory(long id);
}
<file_sep>/src/main/java/hu/tt/services/UserService.java
package hu.tt.services;
import java.math.BigDecimal;
import hu.tt.model.User;
public interface UserService {
User saveUser(User user);
boolean transfer(User user, User toUser, BigDecimal value );
boolean deposit(User user, BigDecimal value);
boolean Withdrawal(User user, BigDecimal value);
User getUser(Long id);
boolean deposit(User user, int i);
}
<file_sep>/src/main/java/hu/tt/model/UserTransaction.java
package hu.tt.model;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
public class UserTransaction {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String transactionType;
// @ManyToOne
// @JoinColumn(name = "user" ,referencedColumnName = "id")
private Long user;
private BigDecimal value;
// @OneToOne
private Long toUser;
@Temporal(TemporalType.TIMESTAMP)
private Date transactionDate;
public Date getTransactionDate() {
return transactionDate;
}
public void setTransactionDate(Date transactionDate) {
this.transactionDate = transactionDate;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTransactionType() {
return transactionType;
}
public void setTransactionType(String transactionType) {
this.transactionType = transactionType;
}
public Long getUser() {
return user;
}
public void setUser(Long user) {
this.user = user;
}
public BigDecimal getValue() {
return value;
}
public void setValue(BigDecimal value) {
this.value = value;
}
public Long getToUser() {
return toUser;
}
public void setToUser(Long toUser) {
this.toUser = toUser;
}
@Override
public String toString() {
return "UserTransaction [id=" + id + ", transactionType=" + transactionType + ", user=" + user + ", value="
+ value + ", toUser=" + toUser + ", transactionDate=" + transactionDate + "]";
}
}
<file_sep>/src/main/java/hu/tt/Main.java
package hu.tt;
import java.math.BigDecimal;
import java.util.stream.Collectors;
import hu.tt.controller.MyEntityManager;
import hu.tt.model.TransactionType;
import hu.tt.model.User;
import hu.tt.services.UserService;
import hu.tt.services.UserServiceImpl;
import hu.tt.services.UserTransactionService;
import hu.tt.services.UserTransactionServiceImpl;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
TransactionType command;
if (args.length > 0) {
command = TransactionType.valueOf(args[0]);
} else {
command = TransactionType.User;
}
UserService us = new UserServiceImpl();
switch (command) {
case Withdrawal:
if (us.Withdrawal(us.getUser(Long.valueOf(args[1])), BigDecimal.valueOf(Long.valueOf(args[2])))) {
System.out.println("Withdrawal \n" + us.getUser(Long.valueOf(args[1])) + "\n Completed");
} else {
System.out.println("Withdrawal \n" + us.getUser(Long.valueOf(args[1])) + "\n Faild");
}
break;
case Deposit:
if (us.deposit(us.getUser(Long.valueOf(args[1])), BigDecimal.valueOf(Long.valueOf(args[2])))) {
System.out.println("Deposit \n" + us.getUser(Long.valueOf(args[1])) + "\n Completed");
} else {
System.out.println("Deposit \n" + us.getUser(Long.valueOf(args[1])) + "\n Faild");
}
break;
case Transfer:
if (us.transfer(us.getUser(Long.valueOf(args[1])), us.getUser(Long.valueOf(args[2])),
BigDecimal.valueOf(Long.valueOf(args[3])))) {
System.out.println("Transfer \n" + "From user" + us.getUser(Long.valueOf(args[1])) + "To user"
+ us.getUser(Long.valueOf(args[2])) + "\n Completed");
} else {
System.out.println("Transfer \n" + "From user" + us.getUser(Long.valueOf(args[1])) + "To user"
+ us.getUser(Long.valueOf(args[2])) + "\n Faild");
}
break;
case History:
UserTransactionService ut = new UserTransactionServiceImpl();
System.out.println(ut.getHistory(Long.valueOf(args[1])).stream().map(item->item.toString()).collect(Collectors.joining("\n")));
break;
default:
User u = new User();
u.setName("<NAME>");
u.setDebit(BigDecimal.valueOf(0L));
System.out.println(us.saveUser(u));
u = new User();
u.setName("<NAME>");
u.setDebit(BigDecimal.valueOf(0L));
System.out.println(us.saveUser(u));
u = new User();
u.setName("<NAME>");
u.setDebit(BigDecimal.valueOf(0L));
System.out.println(us.saveUser(u));
break;
}
} finally {
MyEntityManager.closeEntyyManaggerFactroy();
}
}
}
<file_sep>/src/main/java/hu/tt/controller/UserController.java
package hu.tt.controller;
import hu.tt.services.UserService;
import hu.tt.services.UserServiceImpl;
public class UserController {
private UserService userService = new UserServiceImpl();
}
| 545a24a99c9c1b65cf89ac66cf4d12beceadd053 | [
"Java"
] | 6 | Java | kistompa/DeveloperHomework | da6e2b3ccaadb57c4cb5e49471cd6c087540ed98 | 2b132f7917cd73346bf6826415fb60f263c42d93 |
refs/heads/master | <repo_name>vanessasuthat03/Customers-saver<file_sep>/src/contexts/CustomerContext.js
import React, { createContext } from "react"
export const CustomerContext = createContext([])
export const UserContext = createContext({})
<file_sep>/src/components/Headers.jsx
import React from "react"
import styled from "styled-components"
import headerimage from "..//images/headerimage.png"
const BackgroundImg = styled.div`
justify-content: center;
display: flex;
`
const Img = styled.img`
width: 100%;
height: 435px;
object-fit: cover;
`
const HeaderText = styled.div`
width: 50%;
height: 250px;
color: #222831;
position: absolute;
text-align: center;
left: 10px;
transform: rotate(-20deg);
font-family: "Dancing Script", cursive;
opacity: 0.85;
border-radius: 50%;
p {
font-size: 20px;
padding-top: 20px 0px;
}
`
export default function Headers() {
return (
<>
<BackgroundImg>
<Img src={headerimage} alt="header" />
<HeaderText>
<p><NAME> </p>
<p>JavaScript 3 med <NAME></p>
</HeaderText>
</BackgroundImg>
</>
)
}
<file_sep>/src/components/CustomerForm.jsx
import React from "react"
import { useForm } from "react-hook-form"
import styled from "styled-components"
const InputStyle = styled.div`
width: 95%;
margin: auto;
background-color: black;
text-align: center;
input {
font-size: 16px;
padding: 8px;
border: none;
border-bottom: 1px solid #838383;
margin: 40px 13px 0;
background-color: black;
color: white;
}
p {
color: #e11d74;
}
`
const CreatFormStyle = styled.div`
display: flex;
flex-direction: column;
width: 50%;
margin 0 auto;
`
const ButtonStyle = styled.button`
padding: 0 35px;
margin: 30px auto 50px;
border-radius: 7px;
background: #e11d74;
color: white;
border: none;
font-size: 25px;
font-family: "Peddana", serif;
`
export default function CustomerForm({
handleCreateCustomer,
handleEditCustomer,
preloadedValues,
}) {
const { register, handleSubmit, errors } = useForm({
defaultValues: preloadedValues,
})
const onSubmit = (data, e) => {
e.target.reset()
if (handleCreateCustomer) {
let seUpperCase = data.vatNr
.substring(0, 2)
.toUpperCase()
.concat(data.vatNr.substring(2))
data.vatNr = seUpperCase
handleCreateCustomer(data)
} else if (handleEditCustomer) {
handleEditCustomer(data)
}
}
console.log("hej från customer form")
return (
<InputStyle>
<form onSubmit={handleSubmit(onSubmit)}>
<CreatFormStyle>
<input
type="text"
name="name"
placeholder="<NAME>"
ref={register({
required: true,
minLength: 3,
maxLength: 50,
})}
/>
{errors.name && errors.name.type === "required" && (
<p>
<span>This is required.</span>
</p>
)}
{errors.name && errors.name.type === "minLength" && (
<p>Customer name required minimum 3 characters. </p>
)}
{errors.name && errors.name.type === "maxLength" && (
<p>Customer name required maximum 50 characters. </p>
)}
<input
type="number"
name="organisationNr"
placeholder="Organisation Number"
ref={register({ required: true, minLength: 10, maxLength: 15 })}
/>
{errors.organisationNr &&
errors.organisationNr.type === "required" && (
<p>This is required.</p>
)}
{errors.organisationNr &&
errors.organisationNr.type === "minLength" && (
<p>Required minimum 10 numbers.</p>
)}
{errors.organisationNr &&
errors.organisationNr.type === "maxLength" && (
<p>Required maximum 15 numbers.</p>
)}
<input
type="text"
name="vatNr"
placeholder="Vat number"
ref={register({
required: true,
minLength: 12,
maxLength: 12,
pattern: { value: /[SE-se]+[0-9]/ },
})}
/>
{errors.vatNr && errors.vatNr.type === "required" && (
<p>This is required.</p>
)}
{errors.vatNr && errors.vatNr.type === "pattern" && (
<p>Required SE and 10 numbers.</p>
)}
{errors.vatNr && errors.vatNr.type === "minLength" && (
<p>Required SE and 10 numbers.</p>
)}
{errors.vatNr && errors.vatNr.type === "maxLength" && (
<p>Required SE and 10 numbers.</p>
)}
<input
type="text"
name="reference"
placeholder="Reference"
ref={register({ required: true })}
/>
{errors.reference && errors.reference.type === "required" && (
<p>This is required.</p>
)}
<input
type="number"
name="paymentTerm"
placeholder="Payment Term"
ref={register({ required: true, maxLength: 20 })}
/>
{errors.paymentTerm && errors.paymentTerm.type === "required" && (
<p>This is required.</p>
)}
{errors.paymentTerm && errors.paymentTerm.type === "maxLength" && (
<p>Max 20.</p>
)}
<input
type="text"
name="website"
placeholder="Website"
ref={register({
required: true,
pattern: { value: /www.+[a-zA-Z0-9.-]+\.[a-z]/ },
})}
/>
{errors.website && errors.website.type === "required" && (
<p>This is required.</p>
)}
{errors.website && errors.website.type === "pattern" && (
<p>Invalid website address.</p>
)}
<input
type="email"
name="email"
placeholder="Email"
ref={register({
required: true,
pattern: { value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i },
})}
/>
{errors.email && errors.email.type === "required" && (
<p>This is required.</p>
)}
{errors.email && errors.email.type === "pattern" && (
<p>Invalid email address.</p>
)}
<input
type="number"
name="phoneNumber"
placeholder="Phone Number"
ref={register({ required: true })}
/>
{errors.phoneNumber && errors.phoneNumber.type === "required" && (
<p>This is required.</p>
)}
</CreatFormStyle>
<ButtonStyle type="submit">Submit</ButtonStyle>
</form>
</InputStyle>
)
}
<file_sep>/src/pages/HomePage.jsx
import React, { useContext } from "react"
import { CustomerContext } from "../contexts/CustomerContext.js"
import CreateCustomer from "../components/CreateCustomer"
import CustomerList from "../components/CustomerList"
import UserKit from "../data/UserKit.js"
export default function HomePage() {
const userKit = new UserKit()
const { customerList, setCustomerList } = useContext(CustomerContext)
function createCustomerList() {
userKit
.getCustomerList()
.then(res => res.json())
.then(data => {
setCustomerList(data.results)
})
.catch(error => {
console.log("error", error)
})
}
return (
<div value={{ customerList, setCustomerList }}>
<CustomerList createCustomerList={createCustomerList} />
<CreateCustomer createCustomerList={createCustomerList} />
</div>
)
}
<file_sep>/src/pages/DetailPage.jsx
import React, { useState, useEffect, useContext } from "react"
import { useHistory } from "react-router-dom"
import UserKit from "../data/UserKit"
import CustomerForm from "../components/CustomerForm"
import LayoutSimple from "../components/LayoutSimple"
import { UserContext } from "../contexts/CustomerContext.js"
import styled from "styled-components"
const DetailContainer = styled.div`
background-color: #e11d74;
display: block;
flex-direction: column;
`
const DetailList = styled.div`
color: black;
font-size: 30px;
margin: 0 auto;
width: 500px;
text-align: center;
padding: 40px;
font-family: "Peddana", serif;
p {
margin: 0;
}
span {
color: #fab95b;
}
`
const ButtonContainer = styled.div`
background-color: #e11d74;
font-family: "Peddana", serif;
p {
margin: 0 0 0 65px;
padding-top: 30px;
font-size: 45px;
}
`
const DetailButton = styled.div`
font-size: 35px;
font-family: "Peddana", serif;
padding-left: 68px;
`
const EditButton = styled.a`
color: black;
background-color: #fab95b;
font-family: "Peddana", serif;
font-size: 23px;
border: none;
border-radius: 10px;
padding: 0 25px 0 25px;
text-decoration: none;
`
const DeleteButton = styled(EditButton)`
margin-left: 40px;
`
export default function DetailPage(props) {
const id = props.match.params.id
const [detailId, setDetailId] = useState({})
const [editInput, setEditInput] = useState(false)
const { user } = useContext(UserContext)
const userKit = new UserKit()
const history = useHistory()
useEffect(() => {
handleGetDetail()
}, [])
const name = detailId.name
const organisationNr = detailId.organisationNr
const vatNr = detailId.vatNr
const reference = detailId.reference
const paymentTerm = detailId.paymentTerm
const website = detailId.website
const email = detailId.email
const phoneNumber = detailId.phoneNumber
const preloadedValues = {
name: name,
organisationNr: organisationNr,
vatNr: vatNr,
reference: reference,
paymentTerm: paymentTerm,
website: website,
email: email,
phoneNumber: phoneNumber,
}
function showEditInput() {
setEditInput(true)
}
function handleEditCustomer(data) {
userKit
.editCustomerDetail({ id, data })
.then((res) => res.json())
.then((data) => {
handleGetDetail()
setEditInput(false)
})
}
function handleGetDetail() {
userKit
.getDetail(id)
.then((res) => res.json())
.then((data) => {
setDetailId(data)
})
}
function handleDeleteCustomer(data) {
userKit
.deleteCustomer({ id, data })
.then((data) => {
setDetailId(data)
history.push("/home")
})
}
console.log("hajjjkk")
return (
<div>
<LayoutSimple user={user} />
<ButtonContainer>
<p>Customer Detail test</p>
<DetailButton>
<EditButton herf="#edit" onClick={showEditInput}>
Edit
</EditButton>
<DeleteButton onClick={handleDeleteCustomer}>Delete</DeleteButton>
</DetailButton>
</ButtonContainer>
{detailId && (
<DetailContainer>
<DetailList>
<p>
Customer: <span>{detailId.name}</span>
</p>
<p>
Organisation Number: <span>{organisationNr}</span>
</p>
<p>
VatNr: <span>{vatNr}</span>
</p>
<p>
Reference: <span>{reference}</span>
</p>
<p>
Payment: Term <span>{paymentTerm}</span>
</p>
<p>
Website: <span>{website}</span>
</p>
<p>
Email: <span>{email}</span>
</p>
<p>
Phone: <span>{phoneNumber}</span>
</p>
</DetailList>
</DetailContainer>
)}
<div>
<div id="edit">
{editInput && (
<CustomerForm
handleEditCustomer={handleEditCustomer}
preloadedValues={preloadedValues}
/>
)}
</div>
</div>
</div>
)
}
<file_sep>/src/pages/ActivateUserPage.jsx
import React from "react"
import { useHistory } from "react-router-dom"
import UserKit from "../data/UserKit"
import Headers from "../components/Headers"
import styled from "styled-components"
const Activate = styled.div`
color: #e11d74;
font-family: "Peddana", serif;
background-color: black;
text-align: center;
height: 100vh;
p {
font-size: 30px;
margin: 0;
padding: 20px 0 0 0;
}
button {
background: #e11d74;
border: none;
border-radius: 7px;
font-size: 25px;
color: white;
font-family: "Peddana", serif;
margin-bottom: 30px;
padding: 0 35px;
}
`
export default function ActivateUserPage({ token, setToken, uid, setUid }) {
const history = useHistory()
const userKit = new UserKit()
function handleActivateUser() {
userKit.activateUser(uid, token).then(() => {
setUid(null)
setToken(null)
history.push("/login")
})
}
return (
<div>
<Headers />
<Activate>
<p>Activate Account</p>
<button onClick={handleActivateUser}>Activate User</button>
</Activate>
</div>
)
}
<file_sep>/src/components/CreateCustomer.jsx
import React from "react"
import UserKit from "../data/UserKit.js"
import CustomerForm from "../components/CustomerForm"
import styled from "styled-components"
export const HomeCreate = styled.div`
background-color: #e11d74;
text-align: center;
margin: 0 auto;
padding-bottom: 15px;
`
const CreateTextStyle = styled.div`
background-color: black;
width: 95%;
color: #e11d74;
font-size: 20px;
padding: 15px 0 15px 0;
margin: 0 auto;
`
export default function CreateCustomer({ createCustomerList }) {
const userKit = new UserKit()
function handleCreateCustomer(data) {
userKit
.createCustomer(data)
.then(res => res.json())
.then(data => {
createCustomerList()
})
.catch(error => {
console.log("error", error)
})
}
return (
<HomeCreate>
<CreateTextStyle>Create new Customer</CreateTextStyle>
<CustomerForm handleCreateCustomer={handleCreateCustomer} />
</HomeCreate>
)
}
<file_sep>/src/components/RegisterForm.jsx
import React from "react"
import { useForm } from "react-hook-form"
import UserKit from "../data/UserKit"
import styled from "styled-components"
import Headers from "../components/Headers"
const FormStyle = styled.div`
text-align: center;
color: #eeeeee;
background-color: black;
h2 {
font-size: 35px;
font-family: "Peddana", serif;
text-decoration: underline;
text-decoration-color: #fab95b;
margin: 0;
}
p {
font-size: 17px;
}
`
const InputStyle = styled.div`
width: 95%;
margin: auto;
background-color: black;
input {
font-size: 16px;
padding: 8px;
border: none;
border-bottom: 1px solid #838383;
margin: 40px 13px 0;
background-color: black;
color: white;
}
p {
color: #e11d74;
}
`
const CreatFormStyle = styled.div`
display: flex;
flex-direction: column;
width: 50%;
margin 0 auto;
`
const ButtonStyle = styled.button`
padding: 0 35px;
margin: 30px auto 50px;
border-radius: 7px;
background: #e11d74;
color: white;
border: none;
font-size: 25px;
font-family: "Peddana", serif;
`
export default function RegisterForm() {
const { register, handleSubmit, errors } = useForm()
const userKit = new UserKit()
const onSubmit = (data, e) => {
handleRegister(data)
e.target.reset()
}
function handleRegister(data) {
userKit.register(data)
}
return (
<div>
<Headers />
<FormStyle>
<h2>Register</h2>
<p>Enter details to register</p>
<InputStyle>
<form onSubmit={handleSubmit(onSubmit)}>
<CreatFormStyle>
<input
type="text"
name="firstName"
placeholder="<NAME>"
ref={register({ required: true, minLength: 1, maxLength: 30 })}
/>
{errors.firstName && errors.firstName.type === "required" && (
<p>This is required.</p>
)}
{errors.firstName && errors.firstName.type === "minLength" && (
<p>Customer name required min 1 characters. </p>
)}
{errors.firstName && errors.firstName.type === "maxLength" && (
<p>Customer name required max 30 characters. </p>
)}
<input
type="text"
name="lastName"
placeholder="<NAME>"
ref={register({ required: true, minLength: 1, maxLength: 30 })}
/>
{errors.lastName && errors.lastName.type === "required" && (
<p>This is required.</p>
)}
{errors.lastName && errors.lastName.type === "minLength" && (
<p>Customer name required min 1 characters. </p>
)}
{errors.lastName && errors.lastName.type === "minLength" && (
<p>Customer name required max 30 characters. </p>
)}
<input
type="email"
name="email"
placeholder="Email"
ref={register({
required: true,
pattern: {
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
},
})}
/>
{errors.email && errors.email.type === "required" && (
<p>This is required.</p>
)}
{errors.email && errors.email.type === "pattern" && (
<p>Invalid email address.</p>
)}
<input
type="<PASSWORD>"
name="password"
placeholder="<PASSWORD>"
ref={register({
required: true,
})}
/>
{errors.password && errors.password.type === "required" && (
<p>This is required.</p>
)}
<input
type="text"
name="organisationName"
placeholder="Organisation Name"
ref={register({
required: true,
minLength: 3,
})}
/>
{errors.organisationName &&
errors.organisationName.type === "required" && (
<p>This is required.</p>
)}
{errors.organisationName &&
errors.organisationName.type === "minLength" && (
<p>Customer name required minimum 3 characters. </p>
)}
<input
type="number"
name="organisationKind"
placeholder="Organisation Kind (0,1,2)"
ref={register({
required: true,
maxLength: 1,
})}
/>
{errors.organisationKind &&
errors.organisationKind.type === "required" && (
<p>You can type in 0, 1 or 2 in this field. </p>
)}
</CreatFormStyle>
<ButtonStyle type="submit">Register</ButtonStyle>
</form>
</InputStyle>
</FormStyle>
</div>
)
}
<file_sep>/src/App.js
import React, { useState } from "react"
import { Switch, Route, useHistory } from "react-router-dom"
import RegisterPage from "./pages/RegisterPage"
import ActivateUserPage from "./pages/ActivateUserPage"
import LoginPage from "./pages/LoginPage.jsx"
import HomePage from "./pages/HomePage.jsx"
import { CustomerContext } from "./contexts/CustomerContext"
import { UserContext } from "./contexts/CustomerContext"
import DetailPage from "./pages/DetailPage"
function App() {
const history = useHistory()
const searchString = history.location.search
const urlParameters = new URLSearchParams(searchString)
const [customerList, setCustomerList] = useState([])
const [user, setUser] = useState({})
const [uid, setUid] = useState(urlParameters.get("uid"))
const [token, setToken] = useState(urlParameters.get("token"))
return (
<div>
<Switch>
<UserContext.Provider value={{ user, setUser }}>
<CustomerContext.Provider value={{ customerList, setCustomerList }}>
<Route
path="/customer/:id"
render={props => <DetailPage {...props} />}
/>
<Route path="/home">
<HomePage />
</Route>
<Route path="/login">
{uid && token ? (
<ActivateUserPage
token={token}
setToken={setToken}
uid={uid}
setUid={setUid}
/>
) : (
<LoginPage />
)}
</Route>
<Route exact path="/">
<RegisterPage />
</Route>
</CustomerContext.Provider>
</UserContext.Provider>
</Switch>
</div>
)
}
export default App
| 0ecdb268e986a1fdb9e1a05ab331a63be050762c | [
"JavaScript"
] | 9 | JavaScript | vanessasuthat03/Customers-saver | f00062550c94fe5a1f3725fe8b68dd9b9865748a | 2f40535b9f7bd7293c27f678638bbc564bcc897d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.