Need to get xdialog to close before report prints.
any help would be appreciated.
Thanks
Charlie Crimmel
any help would be appreciated.
Thanks
Charlie Crimmel
Code:
'Date Created: 20-Jan-2011 01:26:47 PM 'Last Updated: 20-Jan-2011 02:00:15 PM 'Created By : E009933 'Updated By : E009933 'Run script: xdiag_start_end_empnum 'script_play("xdiag_start_end_empnum") 'Create an XDialog dialog box to prompt for parameters. trace.clear() DIM GLOBAL vstartdate as D DIM GLOBAL venddate as D DIM GLOBAL varC_result as C DIM GLOBAL vempnum as C Dim Global Printflag As L var->vstartdate={} var->venddate = {} var->vempnum="" var->Printflag = .F. dlg_title = "Enter Selection for Report" heading_string = "Enter Date Range" heading_string2 = "Enter Employee Number- Dont forget the Dashes" heading_string3 = "Example 05-1100-0" ok_button_label = "&OK" cancel_button_label = "&Cancel" Delete XdialogStyle dim XDialogStyle as p XDialogStyle.AccentColor = "White" XDialogStyle.Color = "#153+204+255" varC_result = ui_modeless_dlg_box(dlg_title,<<%dlg% {Windowstyle=Gradient Horizontal Bottom} {region} {text=55,1:heading_string}; {endregion}; {region} Enter Start date:| [%DATE;P=popup.calendar(dtoc(vstartdate));I=popup.calendar%.30vstartdate!vstartdate_*]; Enter Ending date:| [%DATE;P=popup.calendar(dtoc(venddate));I=popup.calendar%.30venddate!venddate_*]; {endregion}; {line=1,0}; {region3} {text=35,1:heading_string2}; {text=35,1:heading_string3}; Enter Employee Number: [.20vempnum!vempnum]; {endregion3}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%,<<%code% if left(a_dlg_button,11) = "vstartdate_" then if a_dlg_button = "vstartdate_killfocus" then var->vstartdate = ctod(dtoc(vstartdate)) end if var->printflag = .F. a_dlg_button = "" end if if left(a_dlg_button,9) = "venddate_" then if a_dlg_button = "venddate_killfocus" then var->venddate = ctod(dtoc(venddate)) end if var->printflag = .F. a_dlg_button = "" end if if left(a_dlg_button,7) = "vempnum" then if a_dlg_button = "vempnum_killfocus" then var->vempnum = vempnum end if var->printflag = .F. a_dlg_button = "" end if if a_dlg_button = "OK" then ' a_dlg_button = "" If var->vstartdate <> {} .and. var->venddate <> {} .and. var->vempnum <> "" then var->printflag = .T. trace.WriteLn("Printflag ="+ printflag) trace.WriteLn("Beginning Date ="+ vstartdate) trace.WriteLn("Ending Date ="+ venddate) trace.WriteLn("Employee Number ="+ vempnum) ui_modeless_dlg_close(dlg_title) goto printreport else code = UI_OK + UI_QUESTION_SYMBOL ui_msg_box("Question", "Fields cannot be Blank? ", code) ui_modeless_dlg_close(dlg_title) end if end if if a_dlg_button = "CANCEL" then a_dlg_button = "" trace.WriteLn("Beginning Date ="+ vstartdate) trace.WriteLn("Ending Date ="+ venddate) trace.WriteLn("Employee Number ="+ vempnum) var->printflag = .F. ui_modeless_dlg_close(dlg_title) end if printreport: if var->printflag = .T. then 'Preview a report, label, letter, form or browse layout. You can specify which records to preview. query.filter = "(Entrydate >= Var->vstartdate ) .and. (Entrydate <= Var->venddate ) .and. (Empnum = Var->vempnum )" query.order = "recno()" 'replace variables in the filter with their actual values query.filter = convert_expression(query.filter,"V") 'Prompt user whether to print, or preview the layout. Set default to Preview prompt_result = ui_get_print_or_preview("Preview ") If prompt_result = "Print" then :Report.Print("Employee Hours4",query.filter,query.order) Else if prompt_result = "Preview" then :Report.Preview("Employee Hours4",query.filter,query.order) End if end if %code%)
Comment