📄 main.pas
字号:
ppDBCalc18: TppDBCalc;
ppDBCalc19: TppDBCalc;
ppDBCalc20: TppDBCalc;
ppLabel75: TppLabel;
ppDBCalc17: TppDBCalc;
myDBCheckBox19: TmyDBCheckBox;
ppLabel46: TppLabel;
ppDBText32: TppDBText;
myDBCheckBox20: TmyDBCheckBox;
ppLabel47: TppLabel;
ppDBText33: TppDBText;
myDBCheckBox21: TmyDBCheckBox;
ppLabel48: TppLabel;
ppDBText34: TppDBText;
myDBCheckBox22: TmyDBCheckBox;
ppLabel49: TppLabel;
ppDBText35: TppDBText;
procedure QEstrazioneCalcFields(DataSet: TDataSet);
procedure StatisticaDBDalChange(Sender: TField);
procedure StatisticaDBArticoloChange(Sender: TField);
procedure StatisticaDBCategoriaChange(Sender: TField);
procedure StatisticaDBTipoChange(Sender: TField);
procedure StatisticaDBMarcaChange(Sender: TField);
procedure CentrifugaClick(Sender: TObject);
procedure StatisticaDBSoggettoChange(Sender: TField);
procedure SelezioneHide(Sender: TObject);
procedure StatisticaDBAgenteChange(Sender: TField);
procedure SoggettoShow(Sender: TObject);
procedure SoggettoHide(Sender: TObject);
procedure GiornoHide(Sender: TObject);
procedure GiornoShow(Sender: TObject);
procedure MensileShow(Sender: TObject);
procedure MensileHide(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure StatisticaDBBeforeEdit(DataSet: TDataSet);
procedure FormCreate(Sender: TObject);
procedure StatisticaDBDocumentoChange(Sender: TField);
private
{ Private declarations }
public
procedure CentrifugaDati;
procedure CompilaMesi;
procedure AbilitaVisione;
procedure DisabilitaVisione;
{ Public declarations }
end;
var
main_form: Tmain_form;
implementation
{$R *.DFM}
procedure Tmain_form.QEstrazioneCalcFields(DataSet: TDataSet);
begin
(*If QestrazioneValuta.AsString = 'L' then
begin
QEstrazioneImponibileL.AsCurrency := QEstrazioneImponibile.asCurrency ;
QEstrazioneImponibileE.AsCurrency := QEstrazioneImponibile/ 1936.27 ;
end
else
begin
QEstrazionePrezzoL.AsCurrency := QestrazionePrezzo.ascurrency * 1937.27 ;
QestrazionePrezzoE.AsCurrency := QEstrazionePrezzo.AsCurrency ;
end ;
QEstrazioneImponibileL.AsCurrency := QestrazioneQta.asFloat *
QestrazionePrezzoL.AsFloat *
(1 - QestrazioneScontoRiga.AsFloat / 100) ;
QEstrazioneImponibileE.AsCurrency := QestrazioneQta.asFloat *
QestrazionePrezzoE.AsFloat *
(1 - QestrazioneScontoRiga.AsFloat / 100) ;
*)
end ;
procedure Tmain_form.StatisticaDBDalChange(Sender: TField);
begin
StatisticaDBTutti_Movimenti.AsBoolean := False ;
end;
procedure Tmain_form.StatisticaDBArticoloChange(Sender: TField);
begin
StatisticaDBTutti_Articoli.AsBoolean := False ;
end;
procedure Tmain_form.StatisticaDBCategoriaChange(Sender: TField);
begin
StatisticaDBTutte_Categorie.AsBoolean := false ;
end;
procedure Tmain_form.StatisticaDBTipoChange(Sender: TField);
begin
StatisticaDBTutti_Tipi.AsBoolean := false ;
end;
procedure Tmain_form.StatisticaDBMarcaChange(Sender: TField);
begin
StatisticaDbTutte_Marche.AsBoolean := False ;
end;
procedure Tmain_form.CentrifugaClick(Sender: TObject);
begin
CentrifugaDati;
//Pagine.ActivePage := Risultato ;
end;
procedure Tmain_form.StatisticaDBSoggettoChange(Sender: TField);
begin
StatisticaDbTutti_soggetti.AsBoolean := False ;
end;
procedure Tmain_form.SelezioneHide(Sender: TObject);
begin
If not Qestrazione.Active then Qestrazione.Open ;
if (StatisticaDb.State = dsInsert) or (statisticaDb.State = dsEdit) then StatisticaDb.Post ;
end;
procedure Tmain_form.CentrifugaDati;
begin
DisaBilitaVisione ;
Pagine.ActivePage := Selezione ;
estrazione.Max := 4 ;
estrazione.Min := 0 ;
estrazione.Position := 1 ;
if (StatisticaDb.State = dsInsert) or (statisticaDb.State = dsEdit) then StatisticaDb.Post ;
If not Qestrazione.Active then Qestrazione.Open ;
estrazione.Position := 2 ;
batchRisultato.Execute ;
estrazione.Position := 3 ;
RisultatoDb.Open ;
estrazione.Position := 4 ;
AbilitaVisione ;
end;
procedure Tmain_form.StatisticaDBAgenteChange(Sender: TField);
begin
StatisticaDBTutti_Agenti.AsBoolean := False ;
end;
procedure Tmain_form.SoggettoShow(Sender: TObject);
begin
Qsoggetto.Open ;
end;
procedure Tmain_form.SoggettoHide(Sender: TObject);
begin
Qsoggetto.close ;
end;
procedure Tmain_form.GiornoHide(Sender: TObject);
begin
qGiorno.Close ;
end;
procedure Tmain_form.GiornoShow(Sender: TObject);
begin
QGiorno.Open ;
end;
procedure Tmain_form.MensileShow(Sender: TObject);
begin
CompilaMesi ;
QMensile.Open ;
end;
procedure Tmain_form.CompilaMesi;
Var
AnnoInizio,MeseInizio,GiornoInizio : Word ;
AnnoFine,MeseFine,GiornoFine : Word ;
Anno,Mese,Giorno,FineMese : Word ;
DataInizio,DataFine : Tdate ;
Mesi : array[1..12] of integer ;
begin
Mesi[1] := 31 ;
Mesi[2] := 28 ;
Mesi[3] := 31 ;
Mesi[4] := 30 ;
Mesi[5] := 31 ;
Mesi[6] := 30 ;
Mesi[7] := 31 ;
Mesi[8] := 31 ;
Mesi[9] := 30 ;
Mesi[10]:= 31 ;
Mesi[11]:= 30 ;
Mesi[12]:= 31 ;
QMinMax.Open ;
MesiDb.CreateTable ;
MesiDb.Open ;
DecodeDate(QminMaxMinData.AsDateTime,Annoinizio,MeseInizio,GiornoInizio) ;
DecodeDate(QminMaxMaxData.AsDateTime,AnnoFine,MeseFine,GiornoFine) ;
For Anno := AnnoInizio to AnnoFine do
For Mese := 1 to 12 do
begin
Giorno := 1 ;
DataInizio := EncodeDate(Anno,Mese,Giorno);
If Mese <> 2 then
FineMese := Mesi[Mese]
else
begin
If isLeapYear(Anno) then
FineMese := 29
else
FineMese := 28 ;
end ;
Datafine := EncodeDate(Anno,Mese,FineMese) ;
MesiDb.Append ;
MesiDBDataInizio.AsDateTime := DataInizio ;
MesiDbDataFine.AsDateTime := dataFine ;
MesiDbAnno.AsInteger := Anno ;
MesiDbMese.AsInteger := Mese ;
MesiDBDescrizione.asString := IntToStr(Mese) + '/' + IntToStr(Anno) ;
MesiDb.Post ;
end ;
MesiDb.Close ;
QMinMax.Close ;
end;
procedure Tmain_form.MensileHide(Sender: TObject);
begin
Qmensile.Close ;
end;
procedure Tmain_form.SpeedButton1Click(Sender: TObject);
begin
If Pagine.ActivePage = Risultato then
begin
ppdbtext43.Visible := not StatisticaDBTutti_Soggetti.AsBoolean ;
ppdbText44.Visible := not StatisticaDbTutti_Documenti.AsBoolean ;
ppdbText42.Visible := not StatisticaDbTutti_Agenti.asBoolean ;
ppdbText45.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppdbText46.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel68.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel69.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
RisultatoReport.Print ;
exit ;
end ;
If Pagine.ActivePage = Soggetto then
begin
ppdbtext2.Visible := not StatisticaDBTutti_Soggetti.AsBoolean ;
ppdbText3.Visible := not StatisticaDbTutti_Documenti.AsBoolean ;
ppdbText1.Visible := not StatisticaDbTutti_Agenti.asBoolean ;
ppdbText4.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppdbText5.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel8.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel9.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
SoggettoReport.Print ;
exit ;
end ;
If Pagine.ActivePage = Giorno then
begin
ppdbtext12.Visible := not StatisticaDBTutti_Soggetti.AsBoolean ;
ppdbText13.Visible := not StatisticaDbTutti_Documenti.AsBoolean ;
ppdbText11.Visible := not StatisticaDbTutti_Agenti.asBoolean ;
ppdbText14.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppdbText14.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel23.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel24.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
If PagineGiorno.ActivePage = TabellaGiorno then
GiornoReport.Print
else
GraficoGiornaliero.Print ;
exit ;
end ;
If Pagine.ActivePage = Mensile then
begin
ppdbtext23.Visible := not StatisticaDBTutti_Soggetti.AsBoolean ;
ppdbText24.Visible := not StatisticaDbTutti_Documenti.AsBoolean ;
ppdbText22.Visible := not StatisticaDbTutti_Agenti.asBoolean ;
ppdbText25.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppdbText26.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel38.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
ppLabel39.Visible := not StatisticaDBTutti_Movimenti.AsBoolean ;
If PagineMensile.ActivePage = Tabella then
MensileReport.Print
else
GraficoMensile.Print ;
exit ;
end ;
ShowMessage('Seleziona Risultato/Soggetto/Giorno/Mensile e poi clicca su "Stampa"') ;
end;
procedure Tmain_form.AbilitaVisione;
begin
RisultatoDb.Refresh ;
If RisultatoDb.IsEmpty then
begin
ShowMessage('Nessun dato disponibile.') ;
exit ;
end ;
Risultato.Tabvisible := True ;
Soggetto.Tabvisible := true;
Giorno.Tabvisible := True ;
Mensile.Tabvisible := True ;
end;
procedure Tmain_form.DisabilitaVisione;
begin
Pagine.Activepage := Selezione ;
Risultato.TabVisible := False ;
Soggetto.TabVisible := False;
Giorno.TabVisible := False ;
Mensile.Tabvisible := False ;
end;
procedure Tmain_form.StatisticaDBBeforeEdit(DataSet: TDataSet);
begin
DisabilitaVisione ;
end;
procedure Tmain_form.FormCreate(Sender: TObject);
begin
disabilitaVisione ;
end;
procedure Tmain_form.StatisticaDBDocumentoChange(Sender: TField);
begin
StatisticaDBTutti_documenti.AsBoolean := False ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -