Man Without Face
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору procedure TfTypes.ChangeReservFiltr; var bar_ser:TBarSeries; mseries:array of TFastLineSeries; mproduct:array of integer; count_product,i,j:integer; value_found: Boolean; begin if not bInit then begin with qReservoirsState do begin if Active then Close; ParamByName('obj').AsInteger:=ID_AZS; ParamByName('date_from').AsDate:=cxdedReservFrom.Date; ParamByName('date_to').Asdate:=cxdedReservTo.Date; Prepare; Open; end; with qReservoirsStatus do begin if Active then Close; ParamByName('obj').AsInteger:=ID_AZS; ParamByName('date_from').AsDate:=cxdedReservFrom.Date; ParamByName('date_to').Asdate:=cxdedReservTo.Date; Prepare; Open; end; with qryShiftListRes do begin if Active then Close; ParamByName('obj').AsInteger:=ID_AZS; ParamByName('date_from').AsDate:=cxdedReservFrom.Date; ParamByName('date_to').Asdate:=cxdedReservTo.Date; Prepare; Open; end; ////////////////////////////////////////////////////////////////////////// with qCharts do begin if Active then Close; ParamByName('obj').AsInteger:=ID_AZS; ParamByName('date_from').AsDate:=cxdedReservFrom.Date; ParamByName('date_to').Asdate:=cxdedReservTo.Date; Prepare; Open; end; with qChart2 do begin if Active then Close; ParamByName('obj').AsInteger:=ID_AZS; ParamByName('date_from').AsDate:=cxdedReservFrom.Date; ParamByName('date_to').Asdate:=cxdedReservTo.Date; Prepare; Open; end; //Строим график dbChart1.View3D:=false; dbChart1.Legend.Visible:=true; dbChart1.Legend.ColorWidth:=0; dbChart1.Legend.ShadowSize:=1; dbChart1.Legend.Alignment:=laRight; dbChart1.Legend.ColorWidth:=15; dbChart1.SeriesList.Clear; //Очищаю график dbchart1.Refresh; begin //dbChart1.Title.Text.Add('График отклонения фактического движения за смену от расчетного'); //Подсчитываю количество линий: count_product:=0; while not(qCharts.Eof) do begin inc(count_product); SetLength(mproduct,count_product); mproduct[count_product-1]:=qCharts.FieldByName('rc_smenavol_volumenum').AsInteger; qCharts.Next; end; //Строю график qChart2.Open; for i:=0 to count_product-1 do begin SetLength(mseries,dbChart1.SeriesList.Count+1); mseries[dbChart1.SeriesList.Count]:=TFastLineSeries.Create(dbChart1); mseries[dbChart1.SeriesList.Count].LinePen.Width:=2; dbChart1.AddSeries(mseries[dbChart1.SeriesList.Count]); qChart2.First(); for j := Trunc(cxdedReservFrom.Date) to trunc(strtodate('07.03.2010')) do begin while trunc(qChart2.FieldByName('rc_sd_begindate').AsDateTime) < j do //begin qChart2.Next(); value_found := False; //end; //showmessage(DateToStr(j)); while trunc(qChart2.FieldByName('rc_sd_begindate').AsDateTime) = j do begin if qChart2.FieldByName('rc_smenavol_volumenum').AsInteger = mproduct[i] then begin if cxRadioGroup1.ItemIndex = 0 then //График фактического отклонения движения за смену от расчетного mseries[dbChart1.SeriesList.Count-1].Add(qChart2.FieldByName('otklon_fakdvforsmena').AsInteger,datetostr(trunc((qChart2.FieldByName('rc_sd_begindate').Asdatetime)))) else //График фактического остатка от нарастающего расчетного mseries[dbChart1.SeriesList.Count-1].Add(qChart2.FieldByName('otklon_fakrestfromincrease').AsInteger,datetostr(trunc((qChart2.FieldByName('rc_sd_begindate').Asdatetime)))); value_found := True; end; qChart2.Next(); end; if not value_found then mseries[dbChart1.SeriesList.Count-1].Add(0,datetostr(trunc((qChart2.FieldByName('rc_sd_begindate').Asdatetime)))); end; end; end; end; end; |