home *** CD-ROM | disk | FTP | other *** search
-
- MMGRVAR.PAS Demo progam Page 1
-
-
- UNIT MMGRVAR;
- { ******************************************************************
- Support UNIT for MMGR.PAS.
- Declares Global Variables and Constants and types. Handles
- Initialization routines for most of the variables.
-
- (c) 1990 T W Harden, all rigths reserved.
-
- This UNIT relies heavely on ObjectBase and ObjectInterFace
- Developement ToolBoxes. Most of the types are Objects that
- are defined in one of the ToolBox Units.
-
- ****************************************************************** }
- INTERFACE
-
- USES userio, { ObjectInterFace - Primary Console I/O routines }
- forms, { ObjectInterFace - Manages the Form Objects }
- windows, { ObjectInterFace - Handles General Window functions, }
- { Menus }
- fields, { ObjectInterFace - Defines Screen Fields }
- utility, { ObjectInterFace - Interfaces program to help system }
- { and provides other basic, }
- { generalized functions. }
- OopBase; { OjbectBase - Low level file routines. }
-
- CONST
- { Filename aliases - Makes life easier when specific filenames must }
- { be used. }
- HelpFileName= 'MMGR.HLP';
- CompanyData = 'COMPANY.DAT';
- PersonData = 'PERSON.DAT';
- CompanySysNdx = 'COMPCD.NDX';
- CompanyUserNdx = 'COMPALPH.NDX';
- PersonSysNdx = 'PRSNCD.NDX';
- PersonUserNdx = 'PRSNALPH.NDX';
- ContactData = 'CONTACT.DAT';
- ContactCompAccess = 'CONTCCD.NDX';
- ContactPrsnAccess = 'CONTPCD.NDX';
- { Common Format strings }
- PhnMask = '(999)999-9999';
- ZipMask = '99999-9999';
- { Miscellaneous constants }
-
- TYPE
- RecordStamp = RECORD { standard information every record should have }
- RStatus, { Used in nonindexed sequential search. nonzero }
- { value means deleted. }
- InStamp, { Date of record creation }
- UpStamp : longint; { Date record was last updated }
- Locked : Boolean;
- END;
-
- CompanyType = RECORD { Company Entity }
- RcSt : RecordStamp;
- Code : String[5]; { Primary key - System defined}
- Alpha : String[12]; { Primary Key - User Defined }
- MMGRVAR.PAS Demo progam Page 2
-
-
- Name : String[50]; { Company Name }
- Addr1 : String[30]; { Address Line 1 }
- Addr2 : string[30]; { Address Line 2 }
- City : String[20]; { City }
- St : String[2]; { State postal abbreviation }
- Zip : String[9]; { ZipCode '999999999' }
- Phone : String[10]; { Phone No '9999999999' }
- Notes : String[50];
- flag : Boolean; { Used to select or deselect }
- Future : array[1..255] of BYTE; { allow for mods }
- END;
-
- PersonType = RECORD { Person Entity }
- RcSt : RecordStamp;
- Code : String[5]; { Primary Key - System Defined }
- LName : String[12]; { Last Name }
- FName : String[10]; { First Name }
- MName : String[10]; { Middle Name }
- AlphaK : String[12]; { Primary Key - LName+FName[1] }
- Salute : String[12]; { Salutation }
- Title : String[4]; { Mr, Mrs, Miss, Ms, Dr }
- Flag : Boolean; { Used to select or deselect }
- Future : Array[1..224] of BYTE; { allow for mods }
- END;
-
- ContactType = RECORD { Contact Relation Definition }
- RcSt : RecordStamp;
- PersonCode : String[5]; { Foriegn Key - NoNulls }
- CompanyCode: String[5]; { Foriegn Key - NoNulls }
- Position : String[15]; { Describes relationship }
- flag : Boolean; { Used to select }
- Future : Array[1..255] of BYTE; { allow for mods }
- END;
- { The following enumerated type allows for a more comprehensible method }
- { of specifying the index of the help text used by the helpw object. }
- { The text file that stores the help uses a semaphor to demark section }
- { boundaries. The text required for any given enumeration is }
- { ord(helplevels) semaphors from the begining of the helpfile. }
- helplevels = (overview,MMhelp,companyhelp,personhelp,
- CompanyEdithelp,companyaddhelp,companycontacthelp,
- comp2prsnaddhelp,companyfindhelp,personedithelp,
- personaddhelp,personfindhelp,prsn2compaddhelp,
- personcontacthelp,contactdel,Reporthelp,UtilHelp,
- ColorHelp,ReportFormHelp,LabelHelp,TestPrintHelp);
-
- VAR
- OldMode : word;
- Company : CompanyType;
- Person : PersonType;
- Contact : ContactType;
- MainMenu,
- CompanyMenu,
- PersonMenu,
- CompContMenu,
- PrsnContMenu,
- PersonContDelMenu,
- MMGRVAR.PAS Demo progam Page 3
-
-
- ReportMenu,
- LabelsMenu,
- CompLstMenu,
- DeviceMenu,
- UtilMenu : Menu; { ObjectInterFace Menu Objects}
- CompForm,
- PrsnContForm,
- PersonForm,
- CompContForm : Form; { ObjectInterFace Form Objects }
- EmptyFileMsg,
- dbloadMsg,
- dbclosemsg,
- notreadymsg,
- NoPrinterMsg,
- SetPrinterMsg,
- PrintingMsg : message; { ObjectInterFace Message Objects }
- Choice : integer;
- Finished : Boolean;
- Dbase : db; { ObjectBase DB Object }
- SysExit : Pointer;
-
- PROCEDURE InitForms;
- PROCEDURE InitMenus;
-
-
- IMPLEMENTATION
-
- PROCEDURE InitForms;
- { This Procedure uses the ObjectInterFace Form and Field OBjects to }
- { Define The Form. }
- { The Field Objects are Extensible and tell the form how to process }
- { various data types required. }
-
- var M : menuarray; { Defined in Windows Unit of ObjectInterFace }
-
- BEGIN { InitForms }
- { Initialize CompForm }
- { Define Window deminsions , Title , and prompt}
- CompForm.Init(2,5,75,17,DataBorder,' COMPANY MAINT. FORM ',
- ' <Ctrl Z> Exits ');
- { Define the Fields that are found in form }
- CompForm.Load(New(StrFldPtr,init(15, 2, SizeOf(company.Alpha)-1,
- 'AlphaK:','Enter Alphabetic Search Key...',
- 'UUUUUUUUUUUU',@company.Alpha)));
- CompForm.Load(New(TglFldPtr,Init(50,2,8,'Selected',' ','',
- @Company.Flag)));
- CompForm.Load(New(DspFldPtr,init(35, 2, SizeOf(Company.Code)-1,
- 'Code:',
- @Company.Code)));
- CompForm.Load(New(StrFldPtr,init(15, 3, SizeOf(company.Name)-1,
- 'Name:','Enter Company Name...',
- Rpt('W',sizeOf(company.Name)-1),
- @company.Name)));
- CompForm.Load(New(StrFldPtr,init(15, 4, SizeOf(company.addr1)-1,
- 'Street:','Enter PO Box or Street...',
- Rpt('W',sizeOf(company.Addr1)-1),
- MMGRVAR.PAS Demo progam Page 4
-
-
- @company.addr1)));
- CompForm.Load(New(StrFldPtr,init(15, 5, SizeOf(company.addr2)-1,':',
- 'Enter 2nd line of Address if required...',
- Rpt('W',sizeOf(company.Addr2)-1),
- @company.addr2)));
- CompForm.Load(New(StrFldPtr,init(15, 6, SizeOf(company.City)-1,
- 'City,St,Zip:','Enter City name...',
- Rpt('W',sizeOf(company.City)-1),
- @company.City)));
- CompForm.Load(New(StrFldPtr,init(15+sizeof(company.city), 6, SizeOf(company.St)-1,
- '','Enter postal Abbrv. for State...',
- 'UU',@company.St)));
- CompForm.Load(New(StrFldPtr,init(15 + sizeof(company.city) +
- SizeOf(Company.st), 6,
- SizeOf(company.Zip)-1,
- '','Enter zip code...',
- ZipMask,@company.Zip)));
- CompForm.Load(New(StrFldPtr,init(15, 7, SizeOf(company.Phone)-1,
- 'Phone:','Enter Company Phone No...',
- PhnMask,@company.Phone)));
- CompForm.Load(New(StrFldPtr,init(15, 8, SizeOf(company.Notes)-1,
- 'Notes:','Enter notes here...',
- Rpt('*',SizeOf(Company.Notes)-1),
- @company.Notes)));
- CompForm.Load(New(RStmpFldPtr,Init(15,9,22,'Entered:',
- @Company.RcSt.InStamp)));
- CompForm.Load(New(RstmpFldPtr,Init(15,10,22,'UpDated:',
- @Company.RcSt.UpStamp)));
- CompForm.Load(New(DspFldPtr,init(15,12, SizeOf(person.LName)-1,
- 'Contact(LFM):',
- @person.LName)));
- CompForm.Load(New(DspFldPtr,init(15+SizeOf(Person.Lname),12,
- SizeOf(person.FName)-1,
- '',
- @person.FName)));
- CompForm.Load(New(DspFldPtr,init(15 + SizeOf(Person.LName) +
- SizeOf(Person.FName) ,12,
- SizeOf(person.MName)-1,
- '',
- @person.MName)));
- CompForm.Load(New(DspFldPtr,init(15, 13, SizeOf(contact.position)-1,
- 'Position:',
- @contact.Position)));
-
- { Initialize PrsnContForm }
- PrsnContForm.Init(4,18,75,5,queryborder,' CONTACT MAINT. FORM ',
- ' <Ctrl Z> Exits Form ');
- PrsnContForm.Load(New(StrFldPtr,init(15, 1, SizeOf(person.LName)-1,
- 'Name(LFM):','Enter Contact''s Last Name...',
- Rpt('W',sizeOf(person.LName)-1),
- @person.LName)));
- PrsnContForm.Load(New(StrFldPtr,init(15+SizeOf(Person.Lname), 1,
- SizeOf(person.FName)-1,
- '','Enter Contact''s First Name...',
- Rpt('W',sizeOf(person.FName)-1),
- @person.FName)));
- MMGRVAR.PAS Demo progam Page 5
-
-
- PrsnContForm.Load(New(StrFldPtr,init(15+SizeOf(Person.Lname) +
- SizeOf(Person.FName) , 1,
- SizeOf(person.MName)-1,
- '','Enter Contact''s Middle Name or Initial...',
- Rpt('W',sizeOf(person.MName)-1),
- @person.MName)));
-
- { Initialize PersonForm }
- PersonForm.Init(2,5,75,12,DataBorder,'PERSON MAINT. FORM',
- ' <Ctrl Z> Exits Form ');
- PersonForm.Load(New(StrFldPtr,init(15, 2, SizeOf(person.LName)-1,
- 'Name(LFM):','Enter Contact''s Last Name...',
- Rpt('W',sizeOf(person.LName)-1),
- @person.LName)));
- PersonForm.Load(New(StrFldPtr,init(15+SizeOf(Person.Lname), 2,
- SizeOf(person.FName)-1,
- '','Enter Contact''s First Name...',
- Rpt('W',sizeOf(person.FName)-1),
- @person.FName)));
- PersonForm.Load(New(StrFldPtr,init(15+SizeOf(Person.Lname) +
- SizeOf(Person.FName) , 2,
- SizeOf(person.MName)-1,
- '',
- 'Enter Contact''s Middle Name or Initial...',
- Rpt('W',sizeOf(person.MName)-1),
- @person.MName)));
- { Initialize TitleMenu - Used in in PickField Object }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 6;
- Txt[ 0] := 'SELECT';
- Txt[ 1] := ' 1 Mr.';
- Txt[ 2] := ' 2 Mrs.';
- Txt[ 3] := ' 3 Ms.';
- Txt[ 4] := ' 4 Miss';
- Txt[ 5] := ' 5 Dr.';
- Txt[ 6] := ' 6 None';
- END;
- PersonForm.Load(New(PckFldPtr,init(15, 3, 4, M,'Title:',@Person.Title)));
- PersonForm.Load(New(StrFldPtr,init(35, 3, SizeOf(person.Salute)-1,
- 'Salutation:',
- 'Enter Text for addressing this individual, ie.Dear ? ...',
- Rpt('W',sizeOf(person.Salute)-1),
- @person.Salute)));
- PersonForm.Load(New(TglFldPtr,Init(53,3,8,'Selected',' ','',
- @Person.Flag)));
- PersonForm.Load(New(RStmpFldPtr,Init(15, 4,22,'Entered:',
- @Person.RcSt.InStamp)));
- PersonForm.Load(New(RstmpFldPtr,Init(15, 5,22,'UpDated:',
- @Person.RcSt.UpStamp)));
- PersonForm.Load(New(DspFldPtr,init(15, 7, SizeOf(contact.position)-1,
- 'Position:',
- @contact.Position)));
- PersonForm.Load(New(DspFldPtr,init(15, 8, SizeOf(company.Name)-1,
- 'Company:',
- MMGRVAR.PAS Demo progam Page 6
-
-
- @company.Name)));
-
- { Initialize CompContForm }
- CompContForm.Init(2,10,75,15,QueryBorder,'CONTACT MAINT. FORM',
- ' <Ctrl Z> Exits Form ');
- CompContForm.Load(New(StrFldPtr,init(15, 1, SizeOf(company.Alpha)-1,
- 'AlphaK:','Enter Alphabetic Search Key...',
- 'UUUUUUUUUUUU',@company.Alpha)));
- CompContForm.Load(New(StrFldPtr,init(15, 2, SizeOf(company.Name)-1,
- 'Name:','Enter Company Name...',
- Rpt('W',sizeOf(company.Name)-1),
- @company.Name)));
- CompContForm.Load(New(StrFldPtr,init(15, 3, SizeOf(company.addr1)-1,
- 'Street:','Enter PO Box or Street...',
- Rpt('W',sizeOf(company.Addr1)-1),
- @company.addr1)));
- CompContForm.Load(New(StrFldPtr,init(15, 4, SizeOf(company.addr2)-1,':',
- 'Enter 2nd line of Address if required...',
- Rpt('W',sizeOf(company.Addr2)-1),
- @company.addr2)));
- CompContForm.Load(New(StrFldPtr,init(15, 5, SizeOf(company.City)-1,
- 'City,St,Zip','Enter City name...',
- Rpt('W',sizeOf(company.City)-1),
- @company.City)));
- CompContForm.Load(New(StrFldPtr,init(15, 5, SizeOf(company.St)-1,
- '','Enter postal Abbrv. for State...',
- 'UU',@company.St)));
- CompContForm.Load(New(StrFldPtr,init(15, 5, SizeOf(company.Zip)-1,
- '','Enter zip code...',
- ZipMask,@company.Zip)));
- CompContForm.Load(New(StrFldPtr,init(15, 6, SizeOf(company.Phone)-1,
- 'Phone:','Enter Company Phone No...',
- PhnMask,@company.Phone)));
- CompContForm.Load(New(StrFldPtr,init(15, 7, SizeOf(company.Notes)-1,
- 'Notes:','Enter notes here...',
- Rpt('*',SizeOf(Company.Notes)-1),
- @company.Notes)));
- CompContForm.Load(New(StrFldPtr,init(15, 8, SizeOf(contact.position)-1,
- 'Position:',
- 'Enter position held by individual at this company...',
- Rpt('W',SizeOf(Contact.Position)-1),
- @contact.Position)));
-
- END; { InitForms }
-
- PROCEDURE InitMenus;
- { Initializes System Menu Objects - Menus are managed by WINDOWS Unit }
- { part of ObjectInterFace. }
-
- VAR
- M : MenuArray; { Defined in WINDOWS Unit of ObjectInterFace }
-
- BEGIN { InitMenus }
- { Initialize MainMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- MMGRVAR.PAS Demo progam Page 7
-
-
- BEGIN
- Size := 5;
- Txt[ 0] := 'MAIN MENU';
- Txt[ 1] := ' Company maint...';
- Txt[ 2] := ' Person maint ...';
- Txt[ 3] := ' Reports ...';
- Txt[ 4] := ' Utilities ...';
- Txt[ 5] := ' Quit program';
- END;
- MainMenu.init(65,4,MenuBorder,M);
-
- { Initialize CompanyMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 10;
- Txt[ 0] := 'COMPANY MAINT';
- Txt[ 1] := ' Edit company';
- Txt[ 2] := ' Find company';
- Txt[ 3] := ' Next company';
- Txt[ 4] := ' Prev company';
- Txt[ 5] := ' Add company';
- Txt[ 6] := ' Select/deSelect';
- Txt[ 7] := ' Contact add ...';
- Txt[ 8] := ' cOntact next';
- Txt[ 9] := ' Del contact';
- Txt[10] := ' Quit company mnt';
- END;
- CompanyMenu.init(65,4,MenuBorder,M);
-
- { Initialize PersonMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 10;
- Txt[ 0] := 'PERSON MAINT';
- Txt[ 1] := ' Edit person';
- Txt[ 2] := ' Find person';
- Txt[ 3] := ' Next person';
- Txt[ 4] := ' Prev person';
- Txt[ 5] := ' Add person';
- Txt[ 6] := ' Select/deSelect';
- Txt[ 7] := ' Contact add ...';
- Txt[ 8] := ' cOntact next';
- Txt[ 9] := ' Del contact';
- Txt[10] := ' Quit person mnt';
- END;
- PersonMenu.init(65,4,MenuBorder,M);
-
- { Initialize CompContMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 5;
- Txt[ 0] := 'PERSON SEARCH';
- Txt[ 1] := ' Correct person';
- MMGRVAR.PAS Demo progam Page 8
-
-
- Txt[ 2] := ' Next person';
- Txt[ 3] := ' Prev person';
- Txt[ 4] := ' Add person';
- Txt[ 5] := ' Quit search';
- END;
- CompContMenu.init(65,4,MenuBorder,M);
-
- { Initialize PrsnContMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 5;
- Txt[ 0] := 'COMPANY SEARCH';
- Txt[ 1] := ' Correct company';
- Txt[ 2] := ' Next company';
- Txt[ 3] := ' Prev company';
- Txt[ 4] := ' Add company';
- Txt[ 5] := ' Quit search';
- END;
- PrsnContMenu.init(65,4,MenuBorder,M);
-
- { Initialize PersonContDelMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 3;
- Txt[ 0] := 'CONTACT DELETE';
- Txt[ 1] := ' Del this relation';
- Txt[ 2] := ' Next relation';
- Txt[ 3] := ' Abort delete';
- END;
- PersonContDelMenu.init(65,4,MenuBorder,M);
-
- { Initialize ReportMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 4;
- Txt[ 0] := 'REPORTS MENU';
- Txt[ 1] := ' Mail labels ...';
- Txt[ 2] := ' Company report...';
- Txt[ 3] := ' conTact report...';
- Txt[ 4] := ' Quit reports';
- END;
- ReportMenu.init(65,4,MenuBorder,M);
-
- { Initialize LabelsMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 3;
- Txt[ 0] := 'LABELS MENU';
- Txt[ 1] := ' Contacts @company';
- Txt[ 2] := ' cOmpany';
- Txt[ 3] := ' Quit labels';
- END;
- MMGRVAR.PAS Demo progam Page 9
-
-
- LabelsMenu.init(65,4,MenuBorder,M);
-
- { Initialize CompLstMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 3;
- Txt[ 0] := 'COMPANY REPORT';
- Txt[ 1] := ' w/ Contacts';
- Txt[ 2] := ' w/O contacts';
- Txt[ 3] := ' Quit company rpts';
- END;
- CompLstMenu.init(65,4,MenuBorder,M);
-
- { Initialize DeviceMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 4;
- Txt[ 0] := 'DESTINATION';
- Txt[ 1] := ' Screen';
- Txt[ 2] := ' Printer';
- Txt[ 3] := ' File';
- Txt[ 4] := ' Abort';
- END;
- DeviceMenu.init(65,4,MenuBorder,M);
-
- { Initialize UtilMenu }
- FillChar(M,SizeOf(M),#0);
- WITH M DO
- BEGIN
- Size := 3;
- Txt[ 0] := 'UTILITY MENU';
- Txt[ 1] := ' Screen colors';
- Txt[ 2] := ' saVe data';
- Txt[ 3] := ' Quit utility';
- END;
- utilMenu.init(65,4,MenuBorder,M);
-
- END; { InitMenus }
-
- END. { mmgrvars.pas }
-
-