All pastes #41757 Raw Edit

Mine

public text v1 · immutable
#41757 ·published 2006-02-15 17:27 UTC
rendered paste body
unit Uavailability;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls, Menus,
  ExtCtrls;


const
size=53;

type
  TFormAvailability = class(TForm)
    SGone: TStringGrid;
    Label11: TLabel;
    MainMenu1: TMainMenu;
    Main1: TMenuItem;
    Logoff1: TMenuItem;
    Exitprogram1: TMenuItem;
    Help1: TMenuItem;
    Search1: TMenuItem;
    Availabilitysearch1: TMenuItem;
    Customersearch1: TMenuItem;
    Customers1: TMenuItem;
    Bookings1: TMenuItem;
    Options1: TMenuItem;
    Backup1: TMenuItem;
    Backupall1: TMenuItem;
    Backupbookingsfile1: TMenuItem;
    Backupcustomersfile1: TMenuItem;
    Reports1: TMenuItem;
    PrintReport1: TMenuItem;
    ChangeAccountPassword1: TMenuItem;
    Helpfiles1: TMenuItem;
    About1: TMenuItem;
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Availabilitysearch1Click(Sender: TObject);
    procedure Bookings1Click(Sender: TObject);
    procedure Logoff1Click(Sender: TObject);
    procedure Exitprogram1Click(Sender: TObject);
    procedure Customers1Click(Sender: TObject);
    procedure ChangeAccountPassword1Click(Sender: TObject);
    procedure About1Click(Sender: TObject);
    procedure Helpfiles1Click(Sender: TObject);
    procedure PrintReport1Click(Sender: TObject);
    procedure Backupall1Click(Sender: TObject);
    procedure Backupbookingsfile1Click(Sender: TObject);
    procedure Backupcustomersfile1Click(Sender: TObject);
    procedure Customersearch1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormAvailability: TFormAvailability;

implementation

uses Upassword, Uabout, Ubooking, Ucustomers, Uadmin, Usearch;

{$R *.dfm}

procedure Grid;
var
x           : integer;
available   : string;
depstring   : string;
paidstring  : string;
commstring  : string;
begin
with FormAvailability do
begin
    SGone.RowCount:=size; // Rows in grid = 52 weeks
    SGone.Cells[0,0]:='Week No';
    SGone.Cells[1,0]:='Date';
    SGone.Cells[2,0]:='Availability';
    SGone.Cells[3,0]:='Week Price (£)';
    SGone.Cells[4,0]:='Occupants';
    SGone.Cells[5,0]:='Deposit paid?';
    SGone.Cells[6,0]:='Full amount paid?';
    SGone.Cells[7,0]:='AI?';
  FOR x:=1 TO size do // Repeat process for each record in array
  BEGIN
  available:='available'; // Define variable
  pos:=pos+1;             // Change to the next record in the array ready to insert data from
    SGone.Cells[0,x]:=inttostr(bookinglist[pos].weekno); // Insert the week number in grid
    SGone.Cells[1,x]:=bookinglist[pos].weekbegin; // Insert the weeks begin data in grid
    SGone.Cells[3,x]:=inttostr(bookinglist[pos].price);  // Insert the price of week in grid
    IF bookinglist[pos].lastname <> '' THEN // If booking has been made
      BEGIN
        available:='unavailable'; // Define availability as unavailable
        SGone.Cells[2,x]:='booked '+'(' +bookinglist[pos].lastname +')'; // Insert who week is booked by in grid
        SGone.Cells[4,x]:=inttostr(bookinglist[pos].occupants); // Insert into grid the amount of people who will occupy the appartment this week
        IF bookinglist[pos].deposit = true THEN  // If the deposit is paid..
        depstring:='Paid' // ..Define the booking deposit has been paid
          ELSE
          depstring:='Not Paid'; // If not, define as unpaid
        SGone.Cells[5,x]:=depstring; // Insert into grid wether deposit has been paid
        IF bookinglist[pos].paid = true THEN // If payment has been made..
        paidstring:='Paid' // ..Define variable as paid
          ELSE
          paidstring:='Not Paid'; // If not, define as unpaid
        SGone.Cells[6,x]:=paidstring ; // Insert into grid wether payment has been made
        IF bookinglist[pos].comments <> '' THEN
          commstring:='Y' // If there are extra comments/info for the booking display as Y
        ELSE
          commstring:='N'; // If no comments are made display as N
        SGone.Cells[7,x]:=commstring; // Show in grid
      END
    ELSE // If no booking has been made show the week as available on grid
      BEGIN
        SGone.Cells[2,x]:='available';
      END;
  END;
end;
end;

procedure TFormAvailability.Button2Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6')
end;

procedure TFormAvailability.Button3Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6')
end;

// Main menu buttons

procedure TFormAvailability.Availabilitysearch1Click(Sender: TObject);
begin
FormSearch.show;
end;

procedure TFormAvailability.Bookings1Click(Sender: TObject);
begin
FormBooking.Show;
end;

procedure TFormAvailability.Logoff1Click(Sender: TObject);
begin
FormAvailability.Close;
end;

procedure TFormAvailability.Exitprogram1Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TFormAvailability.Customers1Click(Sender: TObject);
begin
Formcustomers.Show;
end;

procedure TFormAvailability.ChangeAccountPassword1Click(Sender: TObject);
begin
FormPassword.show;
end;

procedure TFormAvailability.About1Click(Sender: TObject);
begin
FormAbout.show;
end;

procedure TFormAvailability.Helpfiles1Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6');
end;

procedure TFormAvailability.PrintReport1Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6');
end;

procedure TFormAvailability.Backupall1Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6');
end;

procedure TFormAvailability.Backupbookingsfile1Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6');
end;

procedure TFormAvailability.Backupcustomersfile1Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6');
end;

procedure TFormAvailability.Customersearch1Click(Sender: TObject);
begin
ShowMessage('To be developed in CP6');
end;

procedure TFormAvailability.Button1Click(Sender: TObject);
begin
Grid;
end;

procedure TFormAvailability.FormActivate(Sender: TObject);
begin
Grid;
end;

procedure TFormAvailability.FormShow(Sender: TObject);
begin
Grid;
end;

procedure TFormAvailability.FormCreate(Sender: TObject);
begin

end;

end.