二、定义变量
三、制作画面
3.1添加画面
3.2添加文本与报表
3.3添加日历控件并在事件中编辑closeup
插入通过控件,如图所示:选择后画到画面上,双击控件,在“常规”选项卡中为控件命名为“ADate”,点击“确定”,保存画面。再次双击日历控件,选择“事件”选项卡,点击在“事件”选项卡中点击CloseUp事件,弹出控件事件函数编辑窗口,在函数声明中为此函数命名:CloseUp()
在编辑窗口中编写脚本程序,在编写脚本程序之前在数据词典中定义字符串变量“选择日期”
双击日历控件设置属性如下图
程序如下:
float Ayear;
float Amonth;
float Aday;
long x;
long y;
long Row;
long StartTime;
string temp; Ayear=ADate.Year; Amonth=ADate.Month; Aday=ADate.Day;
temp=StrFromInt( Ayear, 10 );
if(Amonth<10)
temp=temp+"-0"+StrFromInt(Amonth,10);
else
temp=temp+"-"+StrFromInt(Amonth,10);
if(Aday<10)
temp=temp+"-0"+StrFromInt(Aday,10);
else
temp=temp+"-"+StrFromInt(Aday,10);
\\\\本站点\\选择日期=temp;
ReportSetCellString2("Report1
ReportSetCellString("Report1
StartTime=HTConvertTime(Ayear,Amonth,Aday,0,0,0);
ReportSetHistData("Report1
//ReportSetHistData("Report1
ReportSetHistData("Report1
ReportSetHistData("Report1
ReportSetHistData("Report1
ReportSetHistData("Report1
x=0;
while(x<24)
{row=4+x;
y=StartTime+x*3600;temp=StrFromTime(y,2);
ReportSetCellString("Report1
x=x+1;
}
添加选择日期变量如下图所示
3.4添加打印和保存
保存的程序如下:
string filename;
filename=InfoAppDir()+\\\\本站点\\选择日期+".xls"; ReportSaveAs("Report0
打印预览的程序如下
ReportPrintSetup("Report0");
详细设置请查看保存和打印文档
四、进入运行系统
运行系统结果如下图所示: