// // 前进... procedure TForm1.Button4Click(Sender: TObject); begin case TabControl1.ActiveTab.Index of 0: if Browser1.CanGoForward then Browser1.GoForward; 1: if Browser2.CanGoForward then Browser2.GoForward; 2: if Browser3.CanGoForward then Browser3.GoForward; 3: if Browser4.CanGoForward then Browser4.GoForward; end; end;
// // 返回... procedure TForm1.Button5Click(Sender: TObject); begin case TabControl1.ActiveTab.Index of 0: if Browser1.CanGoBack then Browser1.GoBack; 1: if Browser2.CanGoBack then Browser2.GoBack; 2: if Browser3.CanGoBack then Browser3.GoBack; 3: if Browser4.CanGoBack then Browser4.GoBack; end; end;
// // 首页... procedure TForm1.Button6Click(Sender: TObject); begin case TabControl1.ActiveTab.Index of 0: Load1:=false; 1: Load2:=false; 2: Load3:=false; 3: Load4:=false; end; TabControl1Change(nil); end;
// // 切换到不同页面时... procedure TForm1.TabControl1Change(Sender: TObject); begin case TabControl1.ActiveTab.Index of // // 总指标查询... 0: begin Label1.Text:=formatdatetime('yyyy',now)+'年度指标总量'; if not Load1 then begin Load1:=true; Browser1.Navigate('http://172.18.254.100/jquerymobileexample/list-split-buttons.html'); end; end; // // 月计划查询... 1: begin Label1.Text:=formatdatetime('yyyy',now)+'年'+formatdatetime('mm',now)+'月指标使用计划'; if not Load2 then begin Load2:=true; Browser2.Navigate('http://172.18.254.100/webdemo/monthplan.asq?datafrom=zy_qegamsdatabase'); end; end; // // 热点支出... 2: begin Label1.Text:=formatdatetime('yyyy',now)+'年指标使用热点'; if not Load3 then begin Load3:=true; Browser3.Navigate('http://172.18.254.100/jquerymobileexample/list-icons.html'); end; end; // // 指标结余查询... 3: begin Label1.Text:=formatdatetime('yyyy',now)+'年指标额度结余'; if not Load4 then begin Load4:=true; Browser4.Navigate('http://172.18.254.100/jquerymobileexample/list-numbered.html'); end; end; end; end;
// // 主函数... function MainFunction(RequestParcel: TQBParcel; ResponseParcel: TQBParcel): boolean; var RawConn: _Connection; AdoConn: TAdoConnection; PoolId,ConnId,j: integer; // ParamParcel: TQBParcel; AdoDataset: TAdoDataset; ResponseBody,DatabaseId: AnsiString; // tmpFileName,tmpstr: ansistring; begin // // 取模板... tmpFileName:=RequestParcel.GetAnsiStringGoods('Dll_Filename'); j:=pos(ansistring('plugins\'),tmpFileName); tmpFileName:=copy(tmpFileName,1,j-1)+'templates\monthplan.tml'; if not fileexists(string(tmpFileName)) then begin result:=false; exit; end; result:=File2Str(string(tmpFileName),ResponseBody); if not result then exit; // // 得到数据库Id... ParamParcel:=TQBParcel.Create; result:=RequestParcel.GetParcelGoods('Parameters',ParamParcel); if not result then exit; DatabaseId:=ParamParcel.GetAnsiStringGoods('DataFrom'); FreeAndNil(ParamParcel); // // 通过API函数分配数据库连接对象... result:=GetAdoConnection(RequestParcel,DatabaseId,adoconn,RawConn,poolid,connid); if not result then exit; // // 创建访问数据库的Ado对象... AdoDataset:=TAdoDataset.Create(nil); AdoDataset.Connection:=AdoConn; AdoDataset.DisableControls; // // 打开通信录数据表... AdoDataset.CommandText:='SELECT * FROM CenterQuota order by FuncId'; try AdoDataset.Active:=true; result:=true; except result:=false; end; // // 转换为HTML... if result then begin try tmpstr:=''; AdoDataset.First; while not adodataset.Eof do begin tmpstr:=tmpstr+'<li>'#13#10; tmpstr:=tmpstr+'<a href="#">'#13#10; if trim(adodataset.FieldByName('BudgetType').AsString)='预算内' then tmpstr:=tmpstr+'<img src="/jquerymobileexample/images/in.png" />'#13#10 else tmpstr:=tmpstr+'<img src="/jquerymobileexample/images/out.png" />'#13#10; tmpstr:=tmpstr+'<h3>'+AnsiString(trim(adodataset.FieldByName('FuncName').AsString))+'</h3>'#13#10; tmpstr:=tmpstr+'<p>本月计划:'+AnsiString(trim(adodataset.FieldByName('MonthPlan').AsString))+'</p>'#13#10; tmpstr:=tmpstr+'<p>累计发生:'+AnsiString(trim(adodataset.FieldByName('YearExpenses').AsString))+'</p>'#13#10; tmpstr:=tmpstr+'</a>'#13#10; tmpstr:=tmpstr+'</li>'#13#10; AdoDataset.Next; end; j:=pos(ansistring('`嵌入列表`'),ResponseBody); delete(ResponseBody,j,10); Insert(tmpstr,ResponseBody,j); except result:=false; end; end; // // 打开表成功才取数据... if result then begin ResponseParcel.PutAnsiStringGoods('ResponseBody',ResponseBody); ResponseParcel.PutAnsiStringGoods('Content-Type','text/html'); ResponseParcel.PutBooleanGoods('DisableGZip',true); end; // // 完成,释放对象... FreeAndNil(AdoDataset); FreeAdoConnection(RequestParcel,AdoConn,RawConn,PoolId,ConnId); end;