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)

Communication Log Report

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("") write("") write("") write("") write("") write("
聯絡日期: "+ datetoString(log.calldate) + " 聯絡時間: " + log.calltime + "
主題: " + log.subject +"
內容: " + log.notes +"

") while(log.next()) { write("") write("") write("") write("") write("") write("
聯絡日期: "+ datetoString(log.calldate) + " 聯絡時間: " + log.calltime + "
主題: " + log.subject +"
內容: " + log.notes +"

") } } else { // error message for no logs. if(request.rangewithin) { write(contact.firstname + "( " + contact.lastname + " )在" + request.submit + "天內並無聯絡資料.") } if(request.rangebetween) { write(contact.firstname + "( " + contact.lastname + " )在" + request.rangebetween1 + "" + request.rangebetween2 + "期間並無聯絡資料") } } }