知方号

知方号

组态王的年月报表<统计月报表图片>

组态王的年月报表

(1)建立报表的步骤

将《实时数据》插入到《日报表后台数据的累计量》插入到《月报表后台累计量》插入到《年报表后台》

 

 

 //...........................................................................................................................................................................................................................................................................................................................................

//每小时将repot7的实时数据插入到report 6中 ,long hang;hang= \本站点$时+3;//定位long Value;Value=ReportGetCellValue("Report7", 4, 2);//获取指定报表单元格的数值ReportSetCellValue("Report6", hang, 2, Value);//将指定报表的指定单元格设定为指定值Value=ReportGetCellValue("Report7", 4, 3);ReportSetCellValue("Report6", hang, 3, Value);Value=ReportGetCellValue("Report7", 4, 4);ReportSetCellValue("Report6", hang, 4, Value);Value=ReportGetCellValue("Report7", 4, 5);ReportSetCellValue("Report6", hang, 5, Value);Value=ReportGetCellValue("Report7", 4, 6);ReportSetCellValue("Report6", hang, 6, Value);Value=ReportGetCellValue("Report7", 4, 7);ReportSetCellValue("Report6", hang, 7, Value);Value=ReportGetCellValue("Report7", 4, 8);ReportSetCellValue("Report6", hang, 8, Value);Value=ReportGetCellValue("Report7", 4, 9);ReportSetCellValue("Report6", hang, 9, Value);Value=ReportGetCellValue("Report7", 4, 10);ReportSetCellValue("Report6", hang, 10, Value);Value=ReportGetCellValue("Report7", 4, 11);ReportSetCellValue("Report6", hang, 11, Value);Value=ReportGetCellValue("Report7", 4, 12);ReportSetCellValue("Report6", hang, 12, Value);Value=ReportGetCellValue("Report7", 4, 13);ReportSetCellValue("Report6", hang, 13, Value);Value=ReportGetCellValue("Report7", 4, 14);ReportSetCellValue("Report6", hang, 14, Value);Value=ReportGetCellValue("Report7", 4, 15);ReportSetCellValue("Report6", hang, 15, Value);//将实时报表report 7中的统计数据输入到日报表后台中

//填写时间string temp;long StartTime;long y;StartTime=cyl_HTConvertTime(\本站点$年,\本站点$月,\本站点$日,0,0,0);//获取选着时间的长整形单位 y=StartTime+\本站点$时*3600;temp=StrFromTime( y, 2 );ReportSetCellString("Report6", hang, 1, temp);

ReportSetCellString("Report6", 28, 1, "当天累积");//填充ReportSetCellString("Report6", 29, 1, "备注");//填充

//............................................................................................................................................................................................................................................................................................................................................

ReportSetCellString2("Report6", 4, 1, 27, 8, " "); //清空单元格

//............................................................................................................................................................................................................................................................................................................................................

 

 (1)查询月报

string FileName;FileName=InfoAppDir()+"月报"+\本站点报表名;ReportLoad("月报",FileName);

//............................................................................................................................................................................................................................................................................................................................................

(2)删除月报

string FileName;FileName=InfoAppDir()+"月报"+\本站点报表名;FileDelete( Filename );string FileName1;FileName1=InfoAppDir()+"月报*.rtl";listClear("月报查询");ListLoadFileName( "月报查询", FileName1 );

//............................................................................................................................................................................................................................................................................................................................................

(3)刷新月报

string FileName;FileName=InfoAppDir()+"月报"+"*.rtl";listClear("月报查询");ListLoadFileName( "月报查询", FileName );

//............................................................................................................................................................................................................................................................................................................................................

 

 

//每天定时将日报后台reprot 6中的累积量插入到月报表reprot5后台中

string reportname2=StrFromReal( \本站点$年, 0, "f" )+StrFromReal( \本站点$月, 0, "f" )+".rtl";//把年月转化为字符串用来命名

//====================string FileName;//自定义变量FileName=InfoAppDir()+"月报"+reportname2;long return02=InfoFile( Filename, 1, \本站点$分 );//查找文件是否存在,找不到返回0ShowPicture("月报后台");//HidePicture("月报后台");//判断月报目录下是否已经有当月的报表文件了if (return02==0)//当前目录下没有相应月报表报表{FileName=InfoAppDir()+"报表月报.rtl";ReportLoad("Roport5",FileName);//把filename名称文件中数据填入到report中FileName=InfoAppDir()+"月报"+ reportname2;Reportsaveas("Roport5",FileName);//报存月报后台//\本站点日计数=0;}//如果当月的月报文件还没有产生则调入月报.rtl文件并按规定格式保存报表文件

FileName=InfoAppDir()+"月报"+StrFromReal( \本站点$年, 0, "f" )+StrFromReal(\本站点$月, 0, "f" )+".rtl";

ReportLoad("Report5",FileName);//读取指定路径下的报表到当前控件报表long hang;hang= \本站点$日+3;//定位//\本站点日计数=\本站点日计数+1;string str;long Value;long Value1;long Value2;str=ReportGetCellString("Report6", 2, 5);//获取指定报表单元格的文本ReportSetCellString("Report5", hang, 1, str);//将指定报表单元格设定为指定字符串//以上为在月报第一列添加日期

Value=ReportGetCellValue("Report6", 28, 2);//获取指定报表单元格的数值ReportSetCellValue("Report5", hang, 2, Value);//将指定报表的指定单元格设定为指定值Value=ReportGetCellValue("Report6", 28, 3);ReportSetCellValue("Report5", hang, 3, Value);Value=ReportGetCellValue("Report6", 28, 4);ReportSetCellValue("Report5", hang, 4, Value);Value=ReportGetCellValue("Report6", 28, 5);ReportSetCellValue("Report5", hang, 5, Value);Value=ReportGetCellValue("Report6", 28, 6);ReportSetCellValue("Report5", hang, 6, Value);Value=ReportGetCellValue("Report6", 28, 7);ReportSetCellValue("Report5", hang, 7, Value);Value=ReportGetCellValue("Report6", 28, 8);ReportSetCellValue("Report5", hang, 8, Value);Value=ReportGetCellValue("Report6", 28, 9);ReportSetCellValue("Report5", hang, 9, Value);Value=ReportGetCellValue("Report6", 28, 10);ReportSetCellValue("Report5", hang, 10, Value);Value=ReportGetCellValue("Report6", 28, 11);ReportSetCellValue("Report5", hang, 11, Value);Value=ReportGetCellValue("Report6", 28, 12);ReportSetCellValue("Report5", hang, 12, Value);Value=ReportGetCellValue("Report6", 28, 13);ReportSetCellValue("Report5", hang, 13, Value);Value=ReportGetCellValue("Report6", 28, 14);ReportSetCellValue("Report5", hang, 14, Value);Value=ReportGetCellValue("Report6", 28, 15);ReportSetCellValue("Report5", hang, 15, Value);//将日报表中的统计数据当天累积值输入到月报表中

//以下为计算累积值

Value1=ReportGetCellValue("Report5", 4, 2);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 2);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 2, Value);Value1=ReportGetCellValue("Report5", 4, 2);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 2);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 2, Value);Value1=ReportGetCellValue("Report5", 4, 3);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 3);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 3, Value);Value1=ReportGetCellValue("Report5", 4, 4);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 4);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 4, Value);Value1=ReportGetCellValue("Report5", 4, 5);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 5);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 5, Value);

Value1=ReportGetCellValue("Report5", 4, 6);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 6);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 6, Value);

Value1=ReportGetCellValue("Report5", 4, 7);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 7);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 7, Value);

Value1=ReportGetCellValue("Report5", 4, 8);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 8);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 8, Value);

Value1=ReportGetCellValue("Report5", 4, 9);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 9);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 9, Value);

Value1=ReportGetCellValue("Report5", 4, 10);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 10);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 10, Value);

Value1=ReportGetCellValue("Report5", 4, 11);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 11);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 11, Value);

Value1=ReportGetCellValue("Report5", 4, 12);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 12);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 12, Value);

Value1=ReportGetCellValue("Report5", 4, 13);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 13);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 13, Value);

Value1=ReportGetCellValue("Report5", 4, 14);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 14);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 14, Value);

Value1=ReportGetCellValue("Report5", 4, 15);//获取月报后台起始值Value2=ReportGetCellValue("Report5", hang, 15);//获取月报后台末尾值Value=Value2-Value1;ReportSetCellValue("Report5", 35, 15, Value);

Reportsaveas("Report5",FileName);//HidePicture("月报后台");

//..........................................................................................................................................................................................................................................................................................................................................

 

 

 

//每天定时将月报后台reprot 5中的累积量插入到年报表后台report 8中

string reportname2=StrFromReal( \本站点$年, 0, "f" )+".rtl";//把年转化为字符串用来命名//====================string FileName;//自定义变量FileName=InfoAppDir()+"年报"+reportname2;long return02=InfoFile( Filename, 1, \本站点$分 );//查找文件是否存在,找不到返回0ShowPicture("年报后台");//HidePicture("年报后台");//判断年报目录下是否已经有当年的报表文件了if (return02==0)//当前目录下没有相应年报表报表{FileName=InfoAppDir()+"报表年报.rtl";ReportLoad("Roport8",FileName);//把filename名称文件中数据填入到report中FileName=InfoAppDir()+"年报"+ reportname2;Reportsaveas("Roport8",FileName);//报存月报后台}//如果当月的月报文件还没有产生则调入月报.rtl文件并按规定格式保存报表文件

FileName=InfoAppDir()+"年报"+StrFromReal( \本站点$年, 0, "f" )+".rtl";

ReportLoad("Report8",FileName);//读取指定路径下的报表到当前控件报表long hang;hang= \本站点$月+3;//定位string str;long Value;long Value1;long Value2;str=ReportGetCellString("Report5", 2, 5);//获取指定报表单元格的文本str=StrLeft(str, 7);//裁剪str,只获取月ReportSetCellString("Report8", hang, 1, str);//将指定报表单元格设定为指定字符串//以上为在月报第一列添加日期

Value=ReportGetCellValue("Report5", 35, 2);//获取指定报表单元格的数值ReportSetCellValue("Report8", hang, 2, Value);//将指定报表的指定单元格设定为指定值Value=ReportGetCellValue("Report5", 35, 3);ReportSetCellValue("Report8", hang, 3, Value);Value=ReportGetCellValue("Report5", 35, 4);ReportSetCellValue("Report8", hang, 4, Value);Value=ReportGetCellValue("Report5", 35, 5);ReportSetCellValue("Report8", hang, 5, Value);Value=ReportGetCellValue("Report5", 35, 6);ReportSetCellValue("Report8", hang, 6, Value);Value=ReportGetCellValue("Report5", 35, 7);ReportSetCellValue("Report8", hang, 7, Value);Value=ReportGetCellValue("Report5", 35, 8);ReportSetCellValue("Report8", hang, 8, Value);Value=ReportGetCellValue("Report5", 35, 9);ReportSetCellValue("Report8", hang, 9, Value);Value=ReportGetCellValue("Report5", 35, 10);ReportSetCellValue("Report8", hang, 10, Value);Value=ReportGetCellValue("Report5", 35, 11);ReportSetCellValue("Report8", hang, 11, Value);Value=ReportGetCellValue("Report5", 35, 12);ReportSetCellValue("Report8", hang, 12, Value);Value=ReportGetCellValue("Report5", 35, 13);ReportSetCellValue("Report8", hang, 13, Value);Value=ReportGetCellValue("Report5", 35, 14);ReportSetCellValue("Report8", hang, 14, Value);Value=ReportGetCellValue("Report5", 35, 15);ReportSetCellValue("Report8", hang, 15, Value);//将月报表后台report 5中的统计数据当天累积值输入到年报表后台report 8中;

Value1=ReportGetCellValue("Report8", 4, 2);//起始值Value2=ReportGetCellValue("Report8", hang, 2);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 2, Value);

Value1=ReportGetCellValue("Report8", 4, 3);//起始值Value2=ReportGetCellValue("Report8", hang, 3);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 3, Value);

Value1=ReportGetCellValue("Report8", 4, 4);//起始值Value2=ReportGetCellValue("Report8", hang, 4);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 4, Value);

Value1=ReportGetCellValue("Report8", 4, 5);//起始值Value2=ReportGetCellValue("Report8", hang, 5);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 5, Value);

Value1=ReportGetCellValue("Report8", 4, 6);//起始值Value2=ReportGetCellValue("Report8", hang, 6);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 6, Value);

Value1=ReportGetCellValue("Report8", 4, 7);//起始值Value2=ReportGetCellValue("Report8", hang, 7);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 7, Value);

Value1=ReportGetCellValue("Report8", 4, 8);//起始值Value2=ReportGetCellValue("Report8", hang, 8);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 8, Value);

Value1=ReportGetCellValue("Report8", 4, 9);//起始值Value2=ReportGetCellValue("Report8", hang, 9);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 9, Value);

Value1=ReportGetCellValue("Report8", 4, 10);//起始值Value2=ReportGetCellValue("Report8", hang, 10);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 10, Value);

Value1=ReportGetCellValue("Report8", 4, 11);//起始值Value2=ReportGetCellValue("Report8", hang, 11);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 11, Value);

Value1=ReportGetCellValue("Report8", 4, 12);//起始值Value2=ReportGetCellValue("Report8", hang, 12);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 12, Value);

Value1=ReportGetCellValue("Report8", 4, 13);//起始值Value2=ReportGetCellValue("Report8", hang, 13);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 13, Value);

Value1=ReportGetCellValue("Report8", 4, 14);//起始值Value2=ReportGetCellValue("Report8", hang, 14);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 14, Value);

Value1=ReportGetCellValue("Report8", 4, 15);//起始值Value2=ReportGetCellValue("Report8", hang, 15);//结束值Value=Value2-Value1;ReportSetCellValue("Report8", 16, 15, Value);

Reportsaveas("Report8",FileName);//HidePicture("年报后台");

//............................................................................................................................................................................................................................................................................................................................................

 

 

 

 

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lizi9903@foxmail.com举报,一经查实,本站将立刻删除。