I've created a report that you can choose either All data in a date range ordered by date range/client job # or Selected customers in a date range ordered by date range/client job #. When they choose the order of the report (drop date or client job #), it selects the actual report to use.
I've gotten most of the report up and working but the date range for my report will only pull for the selected customer even though I have 'ALL' selected.
Here is the code and a print screen of the dialog report. My eyes are about crossed trying to see the obvious error in my coding. Any help is much appreciated!
Activate
dim reports as c
reports = <<%text%
Date Range|Schedule Date Range@[PathAlias.ADB_Path]\workorder set.set
Client Job #|Schedule-jobno@[PathAlias.ADB_Path]\workorder set.set
%text%
After Validate
StartDate = alltrim(CurrentForm.Controls.From)
EndDate = alltrim(CurrentForm.Controls.To)
ClientName = alltrim(CurrentForm.Controls.Name)
reports = alltrim(CurrentForm.Controls.ordertype)
if alltrim(currentform.controls.Client) = "2" then and alltrim(CurrentForm.Controls.ordertype) = "Date Range"
IF eval_valid("ClientName") = .f. .or. eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Client = \""+ClientName+"\" ) .and. (Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "cdate(Dropdate)+Truckcharg+str(Newjobno,19,5)"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
else
if alltrim(currentform.controls.Client) = "2" then and alltrim(CurrentForm.Controls.ordertype) = "Client Job #"
IF eval_valid("ClientName") = .f. .or. eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Client = \""+ClientName+"\" ) .and. (Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "Clientjobn"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
else
if alltrim(currentform.controls.Client) = "1" then and alltrim(CurrentForm.Controls.ordertype) = "Client Job #"
IF eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "Clientjobn"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
else
if alltrim(currentform.controls.Client) = "1" then and alltrim(CurrentForm.Controls.ordertype) = "Date Range"
IF eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "cdate(Dropdate)+Truckcharg+Clientjobn"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
end if
end if
end if
I've gotten most of the report up and working but the date range for my report will only pull for the selected customer even though I have 'ALL' selected.
Here is the code and a print screen of the dialog report. My eyes are about crossed trying to see the obvious error in my coding. Any help is much appreciated!
Activate
dim reports as c
reports = <<%text%
Date Range|Schedule Date Range@[PathAlias.ADB_Path]\workorder set.set
Client Job #|Schedule-jobno@[PathAlias.ADB_Path]\workorder set.set
%text%
After Validate
StartDate = alltrim(CurrentForm.Controls.From)
EndDate = alltrim(CurrentForm.Controls.To)
ClientName = alltrim(CurrentForm.Controls.Name)
reports = alltrim(CurrentForm.Controls.ordertype)
if alltrim(currentform.controls.Client) = "2" then and alltrim(CurrentForm.Controls.ordertype) = "Date Range"
IF eval_valid("ClientName") = .f. .or. eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Client = \""+ClientName+"\" ) .and. (Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "cdate(Dropdate)+Truckcharg+str(Newjobno,19,5)"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
else
if alltrim(currentform.controls.Client) = "2" then and alltrim(CurrentForm.Controls.ordertype) = "Client Job #"
IF eval_valid("ClientName") = .f. .or. eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Client = \""+ClientName+"\" ) .and. (Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "Clientjobn"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
else
if alltrim(currentform.controls.Client) = "1" then and alltrim(CurrentForm.Controls.ordertype) = "Client Job #"
IF eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "Clientjobn"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
else
if alltrim(currentform.controls.Client) = "1" then and alltrim(CurrentForm.Controls.ordertype) = "Date Range"
IF eval_valid("StartDate") = .f. .or. eval_valid("EndDate") = .f. Then
goto skipreport
end if
dim filter as c
dim order as c
Filter = "(Dropdate >= ctod(\""+StartDate+"\") ) .and. (Dropdate <= ctod(\""+EndDate+"\") )"
Order = "cdate(Dropdate)+Truckcharg+Clientjobn"
Dim filename as c
filename = session.session_folder + "tempreport.pdf"
filename = report.saveas(reports,"pdf",filter,order,filename,.f.)
if file.exists(filename)
currentform.RedirectTarget = session.session_url + "tempreport.pdf?" + time("hms3")
end if
end if
end if
end if
Comment