Hello all,
I have been struggling for awhile now on getting the logic correct for a simple checkbox to get checked. The goal is that if a Ticket gets closed within 24 hours of the date/time it is received then the checkbox should be checked. The part that I am struggling with is how to account for the different ways that times are being displayed and stored in SalesLogix as well as trying to account for weekends. We are using SalesLogix version 7.5.0.1 (LAN) with SQL. For us, Saleslogix is published through Citrix, and the Citrix servers are set to Arizona time. Below is my code so far. Am I completely out in left field?
I think my biggest struggle (other than being barely proficient at VBscript) is that I cannot work the logic in my head, so I'll try to write it in plainly here.
If a Ticket is closed within 24 hours of it's received date then checked= T. However, Saturday and Sunday should not be counted in the calculation. I hope this makes sense. Any help provided would be most appreciated!
<pre><p>If pklStatus.Text = Application.Translator.Localize("Closed") Then
Dim strSQL Dim objrs Dim TNUM
TNUM = edTicketID.Text
Set objRS = objSLXDB.GetNewRecordSet strSQL = "Select ReceivedDate From Ticket Where Ticketid = '" & TNUM & "'" 'msgbox(DateAdd("h",24,(txtReceivedDate.Text))) objRS.Open strSQL, objSLXDB.Connection If Not objRS.EOF Then txtReceivedDate.Text = objRS.Fields("RECEIVEDDATE").Value & "" 'DNL Else objRS.Close End If ''ReceivedDate is stored as UTC +7 If DateAdd("h",24,(txtReceivedDate.Text))> NOW Then 'msgbox("16" & DateAdd("h",16,(txtReceivedDate.text))) msgbox (NOW) chkResolved.Checked = True End If
If Weekday (txtReceivedDate.Text) = vbFriday Then If DateAdd("h",65,(txtReceivedDate.Text))< NOW Then msgbox("Fri" & DateAdd("h",72,(txtReceivedDate.text))) chkResolved.Checked = True End If
End IF
If Weekday (txtReceivedDate.Text) = vbSaturday Then If DateAdd("h",65,(txtReceivedDate.Text))< NOW Then 'msgbox("Sat" & DateAdd("h",72,(txtReceivedDate.DateTime))) chkResolved.Checked = True End If
End IF
If Weekday (txtReceivedDate.Text) = vbSunday Then If DateAdd("h",41,(txtReceivedDate.Text))< NOW Then 'msgbox("Sun" & DateAdd("h",48,(txtReceivedDate.DateTime))) chkResolved.Checked = True End If
End IF
End If
|