Download presentation
Presentation is loading. Please wait.
Published byAdrian Cornelius Hood Modified over 5 years ago
1
Create Purchase Order Application Using Appaserver
Create the purchase order database design. Create the purchase order database tables. ©Tim Riley
2
Purchase Order Database Design
Allocate 4 characters of database space for the purchase time. The format will be HH24. For example, 1310 represents 1:10 PM. The time will be automatically pre-populated in the data entry form. Purchase_ Order Vendor purchase_date date * purchase_time time 4 * vendor char 30 * From vendor char 30 * It's possible that two or more purchases could occur at the same minute. So include the vendor in the primary key. Allocate 30 characters of text for each vendor name. ©Tim Riley
3
Purchase Inventory Purchase_ Order Inventory many many ©Tim Riley
Inventory are goods available for sale. There is a many-to-many relationship between purchase order and inventory. purchase_date date * purchase_time time 4 * vendor char 30 * Inventory is recorded as an asset until sold. It is recorded in the books at cost. many When sold, the cost of inventory is recorded in the account called cost-of-goods-sold. many Inventory Total cost-of-goods sold is subtracted from total revenues to yield gross-margin. inventory char 30 * ©Tim Riley
4
Purchase Inventory Purchase_ Order Purchase_ Inventory Inventory
The new table is usually named by combining the names of both many-to-many tables. Purchase_ Order The primary key of the new table are the primary keys of both tables. purchase_date date * purchase_time time 4 * vendor char 30 * Purchase_ Inventory Convert the many-to-many relationship into two many-to-one relationships. purchase_date date * purchase_time time 4 * vendor char 30 * inventory char 30 * quantity integer cost_per_item float Inventory inventory char 30 * Record the quantity purchased and the cost per item. ©Tim Riley
5
Purchase Plant and Equipment
Order Plant is the business term for buildings. Purchase_ Plant_Equipment purchase_date date * purchase_time time 4 * vendor char 30 * purchase_date date * purchase_time time 4 * vendor char 30 * plant_equipment char 30 * quantity integer cost_per_item float Plant and equipment are buildings, machines, furniture, and tools that are used to add value to products and services. Their costs are material enough to warrant additional book-keeping. Record the quantity purchased and the cost per item. Plant_Equipment plant_equipment char 30 * Plant and equipment are recorded as an asset. They are systematically expensed over time in the account called depreciation expense. ©Tim Riley
6
Purchase Supplies Purchase_ Purchase_ Order Supply Supply ©Tim Riley
purchase_date date * purchase_time time 4 * vendor char 30 * purchase_date date * purchase_time time 4 * vendor char 30 * supply char 30 * quantity integer cost_per_item float Supplies are products that cost less than a material amount. Record the quantity purchased and the cost per item. Supply supply char 30 * Supplies are expensed when purchased into the account called supplies expense. ©Tim Riley
7
Purchase Services Purchase_ Purchase_ Order Service Service ©Tim Riley
purchase_date date * purchase_time time 4 * vendor char 30 * purchase_date date * purchase_time time 4 * vendor char 30 * service char 30 * hours integer cost_per_hour float Services are consumed upon purchase. Record the hours worked and the cost per hour. Service service char 30 * Services are expensed when purchased into the account called {service} expense. Replace {service} with the actual service. For example, Lawn Mowing expense. ©Tim Riley
8
} Receive Inventory Receive_ Inventory Purchase_ Inventory ©Tim Riley
received_date date * received_time time 4 * vendor char 30 * inventory char 30 * purchase_date date purchase_time time 4 quantity integer purchase_date date * purchase_time time 4 * vendor char 30 * inventory char 30 * quantity integer cost_per_item float } Foreign key to purchase inventory table. Record the quantity received. Partial shipments are possible. ©Tim Riley
9
} Receive Supplies Receive_ Supply Purchase_ Supply ©Tim Riley
received_date date * received_time time 4 * vendor char 30 * supply char 30 * purchase_date date purchase_time time 4 quantity integer purchase_date date * purchase_time time 4 * vendor char 30 * supply char 30 * quantity integer cost_per_item float } Foreign key to purchase supply table. Record the quantity received. Partial shipments are possible. ©Tim Riley
10
} Receive Equipment Receive_ Plant_Equipment Purchase_ Plant_Equipment
received_date date * received_time time 4 * vendor char 30 * plant_equipment char 30 * purchase_date date purchase_time time 4 quantity integer purchase_date date * purchase_time time 4 * vendor char 30 * plant_equipment char 30 * quantity integer cost_per_item float } Foreign key to purchase plant equipment table. Record the quantity received. Partial shipments are possible. ©Tim Riley
11
} Make Payment Cash_Account Bank Purchase_ Order_Payment Purchase_
bank char 30 * account_number char 30 * bank char 30 * Purchase_ Order_Payment Purchase_ Order payment_date date * payment_time time 4 * vendor char 30 * purchase_date date purchase_time time 4 bank char 30 account_number char 30 amount_paid float purchase_date date * purchase_time time 4 * vendor char 30 * amount_due float } Foreign key to purchase order table. Partial payments are allowed. ©Tim Riley
12
Purchase Order Database Tables
Log in with your address and password of “changeit”. ©Tim Riley
13
Become Administrator Role
Choose the administrator role. ©Tim Riley
14
Purchase Order Database Tables
To preserve relational integrity, create all ”one” tables first. Purchase_ Order Vendor purchase_date date * purchase_time time 4 * vendor char 30 * From vendor char 30 * Insert the vendor attribute very first. ©Tim Riley
15
Insert Attribute Choose the insert attribute menu item. ©Tim Riley
16
Insert Vendor Attribute
The attribute name is “vendor”, the datatype is ”Text”, and the size is 30 characters. Leave everything else blank. ©Tim Riley
17
Insert Vendor Attribute
Scroll to the bottom of the top frame. Press the <Submit> button. ©Tim Riley
18
Insert Vendor Attribute
The new vendor attribute is inserted into the attribute table. ©Tim Riley
19
Purchase Order Database Tables
Second, insert the vendor folder. Purchase_ Order Vendor purchase_date date * purchase_time time 4 * vendor char 30 * From vendor char 30 * ©Tim Riley
20
Insert Folder Choose the insert folder menu item. ©Tim Riley
21
Insert Vendor Folder ©Tim Riley
The folder name is “vendor”, the form is “Prompt”, and the insert screen will have 5 blank rows for data entry. Leave everything else blank. When the user chooses to lookup this folder, the Prompt form displays a query screen to select subsets. The alternative to the Prompt form is the Table form. The Table form displays all of the rows without a query screen first. ©Tim Riley
22
Insert Vendor Folder ©Tim Riley Scroll to the bottom of the top frame.
Press the <Submit> button. ©Tim Riley
23
Insert Vendor Folder Attribute
Upon pressing <Submit>, the bottom frame displays rows to insert the new folder's attributes. ©Tim Riley
24
Insert Vendor Folder Attribute
The press the <Submit> button. To show Appaserver that an attribute is not participating in the primary key, enter an integer in the display order column and leave the primary key index blank. Currently, the vendor folder only has one attribute, and it's the primary key. Choose “Vendor” from the attribute drop-down, and enter “1” for the primary key index. Leave everything else blank. ©Tim Riley
25
Insert Vendor Relationship
This one-to-many relationship will be inserted into the relation folder when we insert the purchase order folder. When we insert the purchase order folder, the relationship will be many-to-one. The next screen that appears in the bottom frame allows you to insert relations for the vendor folder. However, this folder doesn't have any many-to-one relationships. Purchase_ Order Vendor purchase_date date * purchase_time time 4 * vendor char 30 * From vendor char 30 * Instead, the vendor folder has a one-to-many relationship. ©Tim Riley
26
Insert Vendor Relationship
The bottom frame allows you to insert relations for the vendor folder. However, this folder doesn't have any many-to-one relationships. Press the <Submit> button without filling out this form.. ©Tim Riley
27
Insert Vendor Permissions
The press the <Submit> button. The permissions for a folder are assigned to roles. This screen allows you to insert permissions for the vendor folder. The permissions are insert, update, and lookup. Since the update permission has more authority than the lookup permission, the update permission assumes the user has lookup permission. Only a supervisor should be allowed to insert and update vendors. ©Tim Riley
28
Insert Vendor Role Operation
The press the <Submit> button. An operation places a yes/no check-box at the beginning of each row following a query. The delete operation places a trash-can check-box on each row. Allow the supervisor to be able to delete vendors. ©Tim Riley
29
Insert Vendor Folder Complete
The next step is to create the vendor table in the RDBMS. We have just inserted rows into the following tables: 1) folder 2) folder_attribute 3) role_folder 4) role_operation ©Tim Riley
30
Create Vendor Table ©Tim Riley Scroll to the top of the top frame.
This will expose the menu choices. We're going to run a process. ©Tim Riley
31
Create Vendor Table Choose the Create Table process. ©Tim Riley
32
Create Vendor Table ©Tim Riley
Choose the “Finance” application and the “Vendor” folder. This will create the vendor table in the RDBMS. All processes that manipulate the database have a ”Really yn” safety mechanism. Choosing “No” (or leaving at “Select”) will only display the work that will take place. Choosing “Yes” will really do the work. Finally press <Submit>. Choose “No” the first time. ©Tim Riley
33
Create Vendor Table ©Tim Riley
This is the create table command that will be sent to the RDBMS. Next, set “Really yn” to “Yes”, and press <Submit>. The create unique index command enforces the element uniqueness integrity constraint. ©Tim Riley
34
Create Vendor Table ©Tim Riley
Any error messages would have appeared in the bottom frame. The table is created. ©Tim Riley
35
Populate Vendor Table Switch to the supervisor role. ©Tim Riley
36
Populate Vendor Table ©Tim Riley
Choose the menu item of insert vendor. ©Tim Riley
37
Populate Vendor Table ©Tim Riley
This asterisk means vendor is the primary key. Optionally, we could enter in each vendor one at a time by pressing <Submit> each time. Remember when we set the insert rows number to 5? Press <Submit> without entering in a vendor name. ©Tim Riley
38
Populate Vendor Table ©Tim Riley
If we need to add more than 5 vendors in the bottom frame, then press <Submit> again in the top frame to get 5 more empty rows. By leaving any primary key attribute blank on the top frame, you get rows in the bottom frame to insert new data. Enter in all the new rows, then press <Submit> in the bottom frame once. ©Tim Riley
39
Populate Vendor Table ©Tim Riley Type in some vendor names.
Then press <Submit>. ©Tim Riley
40
Populate Vendor Table The insert succeeded. ©Tim Riley
41
Lookup Vendor Table ©Tim Riley Choose the menu item lookup vendor.
The table was empty prior to our insert. However, this count won't get updated until the top frame get repainted. ©Tim Riley
42
Lookup Vendor Table ©Tim Riley
This is the prompt form. Remember when we chose this form over the table form when we inserted this folder? Each attribute will have some mechanism to query subsets. ©Tim Riley
43
Lookup Vendor Table ©Tim Riley Then press <Submit>.
Lookup all vendors that begin with “a”. ©Tim Riley
44
Lookup Vendor Table ©Tim Riley
All rows matching the lookup query in the top frame are displayed in the bottom frame. Remember, we inserted the “Delete” operation to the supervisor role into the role operation folder for the vendor folder? ©Tim Riley
45
Create Purchase Order Table
Vendor purchase_date date * purchase_time time 4 * vendor char 30 * From vendor char 30 * Insert the purchase order attributes. ©Tim Riley
46
Insert Purchase Order Attributes
Choose the insert attribute menu item. ©Tim Riley
47
Insert Purchase Order Attributes
The attribute name is purchase_date. The attribute datatype is current date. The only difference between datatypes of date and current date is current date will prepopulate the field with the current date. The attribute width is 10 characters. The standard format for date is yyyy-mm-dd. However, users can change the way dates are displayed to the American format – mm/dd/yyyy. ©Tim Riley
48
Insert Purchase Order Attributes
Press the <Submit> button in the top frame. Leave everything else blank, and scroll down to the bottom of the top frame. ©Tim Riley
49
Insert Purchase Order Attributes
Press the <Top> button so we don't have to use the scroll bar to get to the top. Press the <Reset> button in the top frame. This will clear the form so we can insert the purchase time attribute. The bottom frame shows the results. ©Tim Riley
50
Insert Purchase Order Attributes
The attribute name is purchase_time. The attribute datatype is current time. The only difference between datatypes of time and current time is current time will prepopulate the field with the current time. The attribute width is 4 characters. The standard format for time is HH24, which is down to the minute. However, you can have times down to the second by making the width 7. Then the format is HH24:SS. For example 1310:15 is 1:10 PM and 15 seconds. ©Tim Riley
51
Insert Purchase Order Attributes
Press the <Submit> button in the top frame. Leave everything else blank, and scroll down to the bottom of the top frame. The bottom frame shows the results. ©Tim Riley
52
Create Purchase Order Table
Insert the purchase order folder. Purchase_ Order Vendor purchase_date date * purchase_time time 4 * vendor char 30 * From vendor char 30 * ©Tim Riley
53
Insert Purchase Order Folder
Choose the insert folder menu item. ©Tim Riley
54
Insert Purchase Order Folder
The behavior will be just like inserting folders. The top frame inserts the folder. Then the bottom frame inserts many rows in each related folder: 1) Attribute 2) Relation 3) Role Folder 4) Role Operation The folder name is purchase_order. The form type is Prompt. The number of rows to insert is 1. We will generate a one-to-many data entry screen. The top frame will be to insert the one purchase order. The bottom frame will be to insert many rows in each related folder: 1) Purchase Inventory 2) Purchase Plant Equipment 3) Purchase Supply 4) Purchase Service ©Tim Riley
55
Insert Purchase Order Folder
Press the <Submit> button. Scroll to the bottom of the top frame. ©Tim Riley
56
Insert Purchase Order Folder Attributes
Press <Submit> in the bottom frame. Insert the purchase order's 3 primary key attributes. ©Tim Riley
57
Insert Purchase Order Relation
Press <Submit> in the bottom frame. The related attribute is part of the relation table's primary key. So it must be populated with something. The Null string provides this placeholder. Choose Null for the related attribute. Purchase order has a many-to-one relation to vendor. ©Tim Riley
58
Insert Purchase Order Permissions
Press <Submit> in the bottom frame. Give both insert and update permissions to supervisors and users. ©Tim Riley
59
Insert Purchase Order Operations
Press <Submit> in the bottom frame. The delete operation places a trash can next to each row following a query. The detail operation places a magnifying glass next to each row following a query. By checking the magnifying glass, the bottom screen will then display for this purchase order the related folders: 1) Purchase Inventory 2) Purchase Plant Equipment 3) Purchase Supply 4) Purchase Service ©Tim Riley
60
Insert Purchase Order Complete
The next step is to create the purchase order table in the RDBMS. We have just inserted rows into the following tables: 1) folder 2) relation 3) folder_attribute 4) role_folder 5) role_operation ©Tim Riley
61
Create Purchase Order Table
©Tim Riley
62
Create Purchase Order Table
©Tim Riley
63
Purchase Order Design Purchase_Order Vendor Purchase_ Inventory
Each screen title will provide you with a guide. Purchase_Order Vendor We created these 2 tables. Purchase_ Inventory The rest of the tutorial will create these 2 tables with only minimum callouts. Inventory ©Tim Riley
64
Insert Purchase Inventory Attributes
©Tim Riley
65
Insert Purchase Inventory Attributes
©Tim Riley
66
Insert Purchase Inventory Attributes
©Tim Riley
67
Insert Purchase Inventory Attributes
©Tim Riley
68
Insert Purchase Inventory Attributes
©Tim Riley
69
Insert Inventory Folder
©Tim Riley
70
Insert Inventory Folder
Now we're going to insert the inventory folder. ©Tim Riley
71
Insert Inventory Folder Attribute
©Tim Riley
72
Insert Inventory Relation
The inventory folder doesn't have any many-to-one relationships. ©Tim Riley
73
Insert Inventory Permissions
©Tim Riley
74
Insert Inventory Operations
©Tim Riley
75
Insert Purchase Inventory Folder
Now we're going to insert the purchase inventory folder. ©Tim Riley
76
Insert Purchase Inventory Attributes
©Tim Riley
77
Insert Purchase Inventory Relations
Pair 1tom order is the feature that automatically displays each many related table in sequence when inserting into the one table. ©Tim Riley
78
Insert Purchase Inventory Permissions
©Tim Riley
79
Insert Purchase Inventory Operations
©Tim Riley
80
Insert Purchase Inventory Completed
©Tim Riley
81
Create Inventory Table
©Tim Riley
82
Create Purchase Inventory Table
©Tim Riley
83
Insert Inventory Item The two new tables are created. Now populate them. ©Tim Riley
84
Insert Inventory Item ©Tim Riley
85
Insert Inventory Item ©Tim Riley
86
Insert Purchase Order ©Tim Riley
87
Insert Purchase Order ©Tim Riley
88
Insert Purchase Order Inventory
©Tim Riley
89
Insert Purchase Order Completed
©Tim Riley
90
Lookup Purchase Order The insert screen has a lookup feature. Let's lookup the purchase order we just inserted. ©Tim Riley
91
Lookup Purchase Order ©Tim Riley
92
Purchase Order Detail If you were to delete this purchase order, then all of the rows in the one-to-many related tables would be deleted also. This is necessary to enforce the relational integrity constraint. The detail operation allows you to view all of the rows in each one-to-many related table. Currently, we've only created the purchase inventory table. ©Tim Riley
93
Purchase Order Detail ©Tim Riley
94
Insert Purchase Order Inventory
You can insert new inventory purchases for this purchase order here. ©Tim Riley
95
Insert Purchase Order Inventory
You can insert new inventory purchases for this purchase order here. However, we only inserted one inventory item – widget. Inserting another widget for this purchase order would be rejected because it would violate the element uniqueness integrity constraint. ©Tim Riley
96
Purchase Order Design Purchase_Order Vendor Purchase_ Inventory
We created these 4 tables. The other purchase tables plus the receive and payment tables still need to be created. Purchase_Order Vendor Purchase_ Inventory Purchase_ Plant Equipment Purchase_ Supply Purchase_ Service Inventory Plant Equipment Supply Service ©Tim Riley
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.