     

    9  

     ,    ,       
  RENTMAN.   7, " 
  /",      
  ,      
.       -    , 
    7    . 
      ,      ,   
   ,       8, "  
 /". ,       
 . 
    . 
    . 
    . 
    . 
    . 
      8    ,     
  RENTMAN.         
   RENTMAN,      , 
    .  ,    
    ,    , 
   8. 

       RENTMAN 

            RENTMAN.    
  ,    8       
,     .    ,  
     /,   
       
.        
  ,  ,  ,    
   . 

       

        7,       
     .     
 :     (OLTP  online 
trasaction processing)      (DSS  

    182    II.   

decision support systems).        
 ,          
 .  ,  OLTP     
,    DSS     .  
-         
      . 
     RENTMAN    .  
     ,    , 
 ,        DSS. 
  ,   ,  ,  
      Allodium  
 . ,  RENTMAN,    
 /,         
  OLTP,     DSS.       
   ,     ,  
  OLTP   ,    DSS. 

           

        ,    8, 
         
( ,   ),     . 
,     ,      
    ,    .   
,        
  .         
    .        
  .         
,         , ,   
 . 
     ,           
.          
.  ,         
   . 
       ,     , 
   ,    ,  
   .  . 9.1    
  RENTMAN,  ,   , 
    . 
     ,    RENTMAN   , 
 ,    4, "".  , 
   . 9.1,         . 
 ,    ,     
,  ,      ,    
       .    
 ?        , 
  ,    DBCtrlGrid     
    .       
   , DBGrid,    
 .       
  . ,    /  
  ,       
      . 
    ,        
 ,   .   
 RENTMAN   :     . 
         
,       ,   
   (    
    ,    
  ).       
      (       
 ).  ,      ,   
   (,    ,   
 ..). 
    ,       . 
,         .  
,      ,     
  ,      .  . 9.1 
       RENTMAN. 

     9.  183 


    . 9.1.     ,    

     9.1.       RENTMAN 

                          	 				 

    fmRSYSMANO	 	 SDI 				   
    fmRCALEDTO        		   	      
    fmRCALGRDO	  	  		     
    fmRWORMDEO	  	  "-"         
    fmRWORGRDO	  	       		      
    fmREMPENTO	  		    	    
    fmREMPGRDO	  	   		    
    fmRWKTGRDO	  	       		     
    fmRWKTENTO	  		    	    
    fmRPROCGDO	  	       	  PROPERTY  
    fmRTENCGDO	  	       	  TENANT  
    fmRLEAGRDO	  	   		  LEASE 
    rpRLEAPRTO	     			-     			  


    184  II.   


     . 9.1 

                   	         

    rpRWORORDO	     		-     	 
    rpRTSKLSTO	          	        


         ,      
.           
  . 

       

             , 
     .   Delphi  
 ,         
   .  ,      
 -,     -.  , 
        (,   
   ),      
-,        ,   
   . 

      Delphi 

              
.        ,    
.    Delphi      
 . 
    Q   .  ,     . 
    Q . ,      ,   
     (     
    ). 
    Q  . ,      
 (      ). 
    Q -. ,       
 . 
         ,   . 9.1, 
    ,   . 9.2. 

     9.2.   RENTMAN,    

    		 

    fmRCALEDTO	   
    fmRCALGRDO	 
    fmRWORMDEO	- 
    fmRWORGRDO	 
    fmREMPENTO	   
    fmREMPGRDO 	 
    fmRWKTGRDO 	 
    fmRWKTENTO 	   
    fmRPROCGDO 	  
    fmRLEAGRDO 	 
    fmRTENCGDO 	  


     9.  185 

         ,  " ^RENTMAN 
"    .       
 ,    ,     
RENTMAN.  . 9.2     . 
              
 Delphi -.       , 
 . 
         RENTMAN    ,  
 .   ,  ,     , 
   AnyForm.       
,         RENTMAN. 
          
  .     DatabaseForm   
 ,    .       
        -    RENTMAN. 

    . 9.2.    RENTMAN 

        

       ,   -    
 .      , 
    .     ,  
  ""   .  
,      ,     
 .        -  
     ,  -  
   -   .  ,   
  ,      ,    
  /.         
 ,        . 

      BDE 

    ,           
Delphi,     BDE,     
.   ,    ,    
    ,    . 
       RENTMAN,      , 
    InterBase,    8.  
          . 

    186  II.   

         Delphi Database Explorer.   
       BDE. 
    . 
    1.  Delphi     Database=>Explore.   
   Database Explorer. (      
,   Delphi Client/Server    SQL Explorer.) 
    2.    Databases  SQL Explorer,     
,      Databases  ,    . 
    3.       Databases     
  New.       BDE. 
    4.   ,       
     .     INTRBASE  
   . 
    5.         RENTMAN,   
 <Enter>. 
    6.    SERVER NAME        
RENTMAN,    8.     : \DATA\RENTMAN\RENTMAN.GDB. 
        ,    
,     . 
    7.    USER NAME      
 InterBase (, SYSDBA). 
    8.    ENABLE BCD  True. 
    9.    Apply   Database Explorer ( 
     ,    
).       . 
     . 9.3.    Database Explorer    
 . 

    . 9.3.  Database Explorer     BDE 

     9.  187 

    ! 
       ENABLE BCD   True.  
   ,    InterBase   
  NUMERIC  DECIMAL.      
       BDE,   
        .  
   ,      ,  
      ,   .  
    .       
       ,   - 
          ,   
.           
, , ,   DBEdit,     
 ,         
.   ENABLE BCD  True  ,   
          BCD (Binary 
Coded Decimals      ),    . 

       

      Database Explorer,    Delphi,   
    Delphi  File=>New Application.   
      .   File=>Save All, 
  .        
 Unit1,         RENTMAN.  
    ,        
  (, C:\DATA\DELPHI\RENTMAN). 

       

          RENTMAN   
  .       , 
    , , ,  
     .  ,    
  ,      .  ,  
      .    
   RENTMAN    Table  DataSource 
    RENTMAN.       
   ,        Delphi 
.    ,    , 
       ,      
,   ,   ,   .   
        Delphi,   
   ,      .  
        
         . 
    ,   File=>New Data Module   Delphi.   
  ,       
.    Name   Object Inspector    
   dmRENTMAN. 
    , ,      ,  
     ,     
.  ,     . 
    1.    Data Access   Delphi   
     Database. 
    2.          
AliasName  Database,       
RENTMAN,    . 
    3.   DatabaseName  Name  Database,   
    dbRENTMAN. 
    4.        Table   
 DataSource. 

    188  II.   

     
             
   .  ,     
,     Delphi,    
 <Snift>.           
Delphi       .  
        (  
     ),   
   . 
    5.         (.. dbRENTMAN) 
    DatabaseName   Table. 

     
           ,   
 .          
     ,   , 
   (   ),     
     ,     
 .   ,  ,   , 
    ,  . 
    6.   Name  TableName  Table    
,   . 9.3. 

     9.3.       RENTMAN 

    Name  		TableName 

    taTENANT 	TENANT 
    taPROPERTY 	PROPERTY 
    taLEASE 	LEASE 
    taCALL 		CALL 
    taWORDER 	WORDER 
    taWODETAIL 	WODETAIL 
    taEMPLOYEE 	EMPLOYEE 
    taWORKTYPE 	WORKTYPE 


      
          ,    
     dbRENTMAN.      
 SYSDBA       masterkey. 
,      ,     
  .     ,  InterBase 
  .        
"  "  8.     InterBase  
    Windows,      
 . 
    7.           
Active   True.       
    ,      ,  
    . 
    8.   Table,    DataSource. 
  DataSet  Name   DataSource    
  . 

     9.  189 

    DataSet       Name

    taTENANT 	dsTENANT 
    taPROPERTY 	dsPROPERTY 
    ta LEASE 	dsLEASE 
    taCALL 		dsCALL 
    taWORDER 	dsWORDER 
    taWODETAIL 	dsWODETAIL 
    taEMPLOYEE 	dsEMPLOYEE 
    taWORKTYPE 	dsWORKTYPE 


     . 9.4      . 


    . 9.4.     RENTMAN 


             Delphi. 
    1.    Delphi   File=>Save    
     :\DATA\DELPHI\RENTMAN\RENTDATA. (  
      :\DATA\DELPHI\RENTMAN). 
    2.            
  Add  Repository. 
    3.   Title    dmRENTMAN,    
Description  Data module form for the RENTMAN database. 
    4.   Page   Data Modules     , 
   Add To Repository. 
     . 9.5    Add To Repository   
  . 
    
    190  II.   


    . 9.5.    dmRENTMAN    


       dmRENTMAN     , 
    RENTMAN. 

       

         RENTMAN    
  .       
    /,    Delphi. 
,     :   ,   
,  ,  ,      
  "-".     . 

    AnyForm 

        File=>Close,    ,   
   New form       File 
 New Form).     Delphi    
,  Forml.       
     ,    ,   
 AnyForm   . 
    1.      Name  fmAnyForm,   
position   poScreenCenter. 
    2.   AutoScroll  False. 
    3.      Panel      
.    (..     Name) paTop 
(), paMiddle ()  paBottom (). 
    4.   Align  paTop  alTop    
  Caption. 
    5.    paTop ,     1/3 
 . 
    6.   Align  paBottom   alBottom  
  . 
    7.    paBottom ,     40 . 

     9.  191 

    8.   Align  paMiddle   alClient.  
  ,        
   paBottom. 
    9.    Caption  paMiddle. 
        ,      ,  
 ,    ,  ,   
     AnyForm.  ,    
Position     ,    
  .  . 9.6       . 

    . 9.6.     AnyForm 

      ,     . 
    1.    Delphi   File=>Save    
     ANYFORM.S    RENTMAN. 
    2.            
 Add To Repository. 
    3.   Title    finAnyForm,    
Description  Top-level generic form class. 
    4.   Page   Forms     ,  
  Add To Repository.  . 9.7    Add To 
Repository     . 

    Database Form 

       ,    DatabaseForm.    
  ,   . 
    1.     File=>New,      
 New Items   Forms. 
    2.   Forms    fmAnyForm,     
   Inherit. 

    192  II.   


    . 9.7.    AnyForm    

    3.    ,       .   
  Delphi    ,  
fmAnyForm1.   ,       fmAnyForm. 
    4.   Name  fmDatabaseForm. 
    5.    paBottom      DBNavigator, 
      . 
    6.    paBottom       
Panel,       . 
    7.   Name     paRight,  
Align  alRight, a  BevelOuter  bvNone. 
    8.    paRight       
    DBNavigator. 
    9.    paRight   BitBtn.   
        paRight,     
    . 
    10.    paRight ,    
  . 
    11.   Kind   BitBtn   bkOK,  
  bkCancel. 
    12.   Name ,      
 bb,   Cancel  bbCancel. 
    13.           
    OnClick. 

    if (DBNavigator1.DataSource.State in [dsEdit, dsInsert]) then 
          DBNavigatorl.DataSource.DataSet.Post; 
          Close; 

         ,    
  ,   ,     DataSet . 
  ,        
  DataSet. 

     9.  193  
    7 Delphi 3   / 

    14.     bbCancel      
  

    OnClick.Close; 

            Cancel.     
        ,  
     OnClose  . 
    15.    Object Inspector  fmDatabaseForm,  
 ,        OnClose  
( Events  Object Inspector).      
   OnClose  fmDatabaseForm. 

    if (DBNavigatorl.DataSource.State in [dsEdit, dslnsert]) then 
       DBNavigatorl.DataSource.DataSet.Cancel; 

             
  ,       .  , 
     Cancel       
      ,      
 . 
      DatabaseForm .   File=>Save  
     DBFORM.PAS,      
RENTMAN.  . 9.8    . 

    . 9.8.    DatabaseForm 

     ,     ,   ,  
     Cancel ,    
.    ,     
 Align,      ,     
       , ,  
  . 
           .   
         Add To Repository.  
    fmDatabaseForm,       
Generic database form class.   Page   Forms    
 . 

    194  II.   


    Edit Form 

       DatabaseForm,     EditForm. 
         
    .  EditForm     
  DatabaseForm.       EditForm, 
  . 
    1.   File=>New    Forms   
 New Items   fmDatabaseForm. 
    2.    Inherit,      .   
  Delphi      frnDatabaseForml. 
    3.   Name  ,       fmEditForm. 
    4.      ,   paMiddle 
       paBottom.   
    -      
,  DBEdit  DBComboBox. 
    5.    paMiddle,   ,      
  Button.  -  btAdd,   btEdit, 
  btDelete. 
    6.   Caption  btAdd  &Add,  btEdit  
&Edit,   btDelete  &Delete.     , 
  ,      . 
    7.     btAdd       
 OnClick   . 

    DBNavigator1.BtnClick(nblnsert); 

    8.     btEdit       
 OnClick   . 

    DBNavigator1.BtnClick(nbEdit) ; 

    9.     btDelete       
  OnClick  : 

    DBNavigator1.BtnClick(nbDelete); 

          , 
      .   
   ,   fmEditForm,     
  ,  -    . 
      EditForm .   File=>Save  
     EDITFORM.PAS,      
RENTMAN.  . 9.9    . 
         ,     
 fmEditForm,       Generic database edit form 
class.     Forms. 

    GridForm 

     ,        GridForm.  
   EditForm      
 ,        
.      fmGridForm,   . 
    1.   File=>New    Forms   
 New Items   fmEditForm. 
    2.    Inherit,      .   
  Delphi    fmEditForml. 
    3.    Name,   fmGridForm. 
    4.   ,       DBGrid 
(   Data Controls   Delphi). 
    5.   Align  DBGrid   alClient, 
      . 

     9.  195 


    . 9.9.    Edit Form 

    6.    Object Inspector    fmGridForm   
   OnShow  Events.     
  OnShow  fmGridForm  : 

    if (DBGridl.DataSource = nil) then 
       DBGrid1.DataSource := DBNavigatorl.DataSource; 

           DBGrid,   
    ,        
 ,    .  ,  
         
DataSource  DBNavigator. 
        fmGridForm  (. 9.10).   
   GRIDFORM.PAS   RENTMAN. 
         ,     
 fmGridForm,       Generic database grid form 
class.     Forms. 

    ControlGridForm 

         ControlGridForm.     
  EditForm.  fmControlGridForm    
     ,   
fmGridForm.  ,        
  .      ControlGridForm 
  DBCtrlGrid,   DBGrid,     GridForm. 
      ContrMGridForm,   . 
    1.   File=>New     fmEditForm, 
   Forms   New Items.  
 Inherit     .      
    fmEditForml.    Name   
fmControlGridForm. 
    2.   ,       DBCtrlGrid 
(   Data Controls   Delphi). 

    196  II.   


    . 9.10.    GridForm 

    3.   Align  DBCtrlGrid   
alClient,        . 
    4.    Object Inspector    fmControlGridForm  
    OnShow  Events.    
     OnShow  fmControlGridForm: 

    if (DBCtrlGridI.DataSource = nil) then 
       DBCtrlGridl.DataSource := DBNavigatorl.DataSource; 

            
DBCtrlGrid,       ,    
     ,    
.  ,        
   DataSource  DBNavigator. 
        fmControlGridForm  (. 9.11).  
    CGRDFORM.S   RENTMAN. 
         ,     
 fmControlGridForm,       Generic database 
control grid form class.     Forms. 

    Master Detail Form 

             MasterDetailForm.  
   DatabaseForm      
  ,     ,    
.   MasterDetailForm     
DatabaseForm ,       paMiddle   
DBGrid.  ,   ,   
   .       
MasterDetailForm     .   
  MasterDetailForm   . 
    1.   File=>New     frnDatabaseForm, 
   Forms   New Items.  
 Inherit     .      
    fmDatabaseForml. 

     9.  197 


    . 9.1].    ControlGridForm 

    1.    Name   fmMasterDetailForm. 
    3.      ,    
     ,   paMiddle. 
    4.    paMiddle      DBGrid 
(   Data Controls  ). 
    5.   Align  DBGrid   alciient, 
      paMiddle. 
        fmMasterDetailForm  (. 9.12).  
    MSTRFORM.PAS   RENTMAN. 
         ,     
 fmMasterDetailForm,       Generic database 
master-detail form class.     Forms. 

      

             ,  
    .   RENTMAN   
         . 

     
               
 Delphi,        . 
       ,    
           
 -. 
            ,  
   -  ,  FORMREPO ( form 
repository).          ,  
   .        
    Unit1,      
      . 


    198  II.   


    . 9.12.    MasterDetallForm 


      

         RENTMAN    
 .    ,     RENTMAN,  
    ,    fmAnyForm,   
     Unitl.     
   RENTMAN. 
          ,     
 RENTMAN.DPR.  ,   ,   
     fmRSYSMANO. 
    1.   File=>New     fmAnyForm, 
   Forms   New Items.  
 Inherit     .      
    fmAnyForml. 
    2.    Name   fmRSYSMAN0,   Caption 
  RENTMAN Rental Management System. 
    3.   Project=>Options ,   Forms  
 Project Options,      RENTMAN  
 fmRSYSMANO.     Project Options   
 . 
    4.   WindowState     
wsMaximized,   Position   poDesigned.   
   ,     RENTMAN   
   . 
    5.      paBottom ,    30 
.       ,    
    RENTMAN. 
    6.     MainMenu     Name 
 mmRentMan.        
.     MainMenu,     
   Delphi. 
         RENTMAN   . 


     9.  199 

    1.      File,    Caption 
    &File.  ,   <F>  
        . 
    2.   File       ( 
Caption) &Log a Call     ( shortcut) 
<F2>.  . 9.4    File. 

     9.4.   File  RENTMAN 

    Caption		ShortCut 

    &Log a Call	F2 
    &Print Setup	None 
    E&xit		None 

    3.      Tables ( Caption  
 &Tables)        . 9.5. 

     9.5.   Tables  RENTMAN 

    Caption 	Shortcut 

    &Calls 		F3 
    &Property 	F4 
    &Tenants 	F5 
    &Leases 	F6 
    &Work Orders 	F7 
    &Employees 	F8 
    W&ork Types 	F9 

    4.      Reports ( Caption  
 &Reports)        . 9.6. 

     9.6.   Reports  RENTMAN 

    Caption 	ShortCut 

    &Work Order 	None 
    &Lease 		None 
    &Task List 	None 

    5.      Help ( Caption  
 &l). 
    6.   Help   Contents ( Caption  
 &Contents). 
    7.    Help   About ( Caption  
 &About). 
    
     . 9.13    .   , 
    Delphi. 
    
    200  II.   


    . 9.13.     RENTMAN 


       

            ,  
       .  
   . 
    1.    ,        
SpeedButton. 
    2.     SpeedButton      
 . 
    3.      Align.     
.   Space equally  Horizontal  Tops 
 Vertical,      . 
    4.     Name  SpeedButton  ( 
) sbLogCall, sbProperty, sbTenants, sbLeases, sbWorkOrders  sbPrintSetup. 
    5.    ,    
Glyph,   .       
   ,    
     Delphi.    
   Delphi\IMAGES\BUTTONS.  . 9-7 ,  
  ,   RENTMAN. 

     9.7.  ,     

    		 

    sbLogCall 	Phonerng.bmp 
    sbProperty 	Doorshut.bmp 
    sbTenants 	Picture.bmp 
    sbLeases 	Report.bmp 
    sbWorkOrders 	Tools.bmp 
    sbPrintSetup 	Printer.bmp 


     9.  201 

              
   ,   . 
    1.          Panel,  
     . 
    2.         
BevelOuter  bvNone. 
    3.   Align    alRight,   Name 
  paRight. 
    4.    paRight  ,     
      SpeedButton. 
    5.   SpeedButton   paRight. 
    6.   Name      
sbHelp,        Help.bmp (  
   \IMAGES\BUTTONS    Delphi). 
   paRight     ,    
      ,    .  
.9.14        . 

    . 9.14.    RENTMAN 


      
            
 Delphi,  CoolBar  ToolBar (   Win32  
).         
CTL3D32.DLL,        ,    
.  ,        
,   . 9.7,      
,   .    , 
      Win32     
 ,    Delphi. 


    202  II.   


      

         RENTMAN,    
    ,   .   
    . 
    1.   paBottom      StatusBar 
(   Win32  ). 
    2.      Name  StatusBar  
stRENTMAN,      Align  lClient. 
    3.      Panels  StatusBar  
    . 
    4.     Text    
StatusBar  Status,    User,    Version. 
    5.    width  Status  275,  
 User  Version  150,      . 
     . 9.15     fmRSYSMANO. 

    . 9.15.     RENTMAN 


       

      ,   ,  ,    
     .      
,    ""     
 .           
   Save all   Delphi,  
 File=>Save All.        
RSYSMANO.PAS. 
     ,    Run   <F9>  ,  
           
.         ,  
 ,        
RENTMAN (     SYSDBA,    masterkey).  
. 9.16    fmRSYSMANO    . 

     9.  203 


      
          DB   uses ,  
     State.    
      dsInsert, dsEdit  ..   
   ,  Delphi      
  ,   .       
  ,   ,      
 State ,   DB   uses  
 . 

      
       ,   InterBase  . 
   ,    . 

    . 9.16.        RENTMAN 


     

             ,  
        RENTMAN.  
,    ,     
    . ,       
   . 

     ... 

    , , ,     
RENTMAN .     " "   
    ,      
RENTMAN  . 

    204  II.   