Delphi 6 + QuickReport – Removing or Disabling the Save and Load Buttons during preview [solved]

This has been an age old question that one needs to tackle if you have clients that want to control data coming in and out of the company.

That is why I am quite happy and relieved to have found it as well.

Without further adue, here it is

uses
, QRPrntr, QRPrev;

procedure TqrpLabelGrader.QuickRep1Preview(Sender: TObject);
var
  qrStandardPreview: TQRStandardPreview;
begin
  //, QRPrntr, QRPrev;
  qrStandardPreview:=TQRStandardPreview.CreatePreview(Self, TQRPrinter(Sender));
  qrStandardPreview.SaveReport.Enabled := False;
  qrStandardPreview.LoadReport.Enabled := False;
  qrStandardPreview.Show;
end;

Enjoy

Coffee Cup

Delphi 6 – Get Date From and Date To With Number of Days

So far I have recreated this code far more in the 16 years that I have been using Delphi. Just wanted to log it here so that when I need it again, it will be here.

Hope it can also help other people

Enjoy

Coffee Cup

procedure TfrmPassword.BitBtn1Click(Sender: TObject);
var
vWeekDay : String;
begin
//DateUtils
//get the first and last day
if (ALMONTH.VALUE <= 11) then
begin
ALFROM.VALUE := StrToDate( ALMONTH.Text + ‘/01/’ + ALYEAR.Text );
ALTO.VALUE := StrToDate( IntToStr(ALMONTH.VALUE + 1) + ‘/01/’ + ALYEAR.Text ) – 1;
end
else
begin
ALFROM.VALUE := StrToDate( ’12/01/’ + ALYEAR.Text );
ALTO.VALUE := StrToDate( ’01/01/’ + inttostr(ALYEAR.Value + 1) ) – 1;
end;
//loop the number of days
ALDAYS.VALUE := DaysBetween(ALTO.VALUE, ALFROM.VALUE) + 1;
ALDATE.VALUE := ALFROM.VALUE;
ALSUN.VALUE := 0;
ALTOTAL.Value := 0;
while (ALDATE.Value <= ALTO.Value) do
begin
vWeekDay := LongDayNames[DayOfWeek(ALDATE.Value)]; if (vWeekDay = 'Sunday') then ALSUN.VALUE := ALSUN.VALUE + 1 else ALTOTAL.Value := ALTOTAL.Value + 1; ALDATE.Value := ALDATE.Value + 1;
end;
end;