comrep.html
dbconnect();
/*
Below we create a cursor named log that selects all of the communications made by a
contact that the user has chosen. In the loop down below we output the results
in a table format. The contact cursor gets the first and last name of the contact.
*/
var today = new Date()
if(request.rangewithin) {
log = database.cursor("SELECT * FROM calls WHERE contactid = " + request.id + " AND calldate >= (today - " + request.submit + ")")
}
if(request.rangebetween) {
log = database.cursor("SELECT * FROM calls WHERE contactid = " + request.id + " AND calldate BETWEEN '" + request.rangebetween1 + "' AND '" + request.rangebetween2 + "'")
}
contact = database.cursor("SELECT firstname, lastname FROM contacts WHERE contactid = " + request.id)
if(contact.next()) {
write("客戶姓名: " + contact.firstname + " " + contact.lastname + " ")
// communication details are displayed individually in a table if a log is
// found for the search criteria.
if(log.next()) {
write("