(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, \\本站點\$分 );//查找文件是否存在,找不到返回0
ShowPicture("月報后台");
//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, \\本站點\$分 );//查找文件是否存在,找不到返回0
ShowPicture("年報后台");
//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("年報后台");
//............................................................................................................................................................................................................................................................................................................................................