Administrator Recipe: Add Job Code


A proper job code is a significant building block for the Time Cards recipe. For an employee's hours to be correctly logged to a specific project, they need to have the right job code. This first application page allows the project administrator to add job codes as needed. The Add Job Code application uses the Insert Record server behavior. The full set of codes is displayed in a list on the Add Time Card page in a list.

Step 1: Implement the Add Job Code Design

The Add Job Code page is basically a simple insert record application. As such, the layout of the page requires a few form elements: three text fields and a submit button. The three fieldsJob Name, Job Code, and Rateare used in other aspects of the application. The Job Name is displayed in a list on the Add Time Card page, while the Job Code and Rate are used in the HoursBreakdown SQL calculations. The Rate field is intended to accept the hourly rate charged to the client for a particular job.

1.

In the server model of your choice, create a dynamic page.

In the TimeCards folder, locate the folder for your server model and open the add_jobcode page from there.

2.

Add a table to the content region of your page to contain the form elements for the application.

From the Snippets panel, drag the Recipes > TimeCards > Wireframes > Add Job Code - Wireframe snippet into the Content editable region.

3.

Insert the form and, within it, a two-column table. The table should include form elements and labels for a job name, job code, and rate; the code and rate form fields should be limited to around 10 characters. You'll also need a form button for inserting the new record.

Place your cursor in the row below the words ADD JOB CODE and insert the Recipes > TimeCards > Forms > Add Job Code - Form snippet.

4.

Save the file [r5-1].

r5-1.


Step 2: Insert RecordAdd Job Code

The only server-side code required for this page is the standard Insert Record server behavior. The values entered will be stored in the JobTypes table. Once the insertion is completed, the user is taken to the Project Summary page.

For ASP

1.

From the Server Behaviors panel, choose Add (+) and select Insert Record from the list.

2.

In the Insert Record dialog, choose your data source.

Choose Recipes from the Connection list.

3.

Select the table into which you want to insert the record.

From the Insert Into Table list, choose JobTypes.

4.

Set the page that you want to appear after the record is inserted.

Choose the report_projectsummary.asp file from your server model's folder for the After Inserting, Go To field.

5.

Select the form on the current page from which to gather the record values.

From the Get Values From list, make sure AddJobCode is selected.

6.

In the Form Elements area, match the form elements on the page to the fields in the data source table.

Set JobName to insert into the JobType column as Text type.

 

Set JobCode to insert into the JobCode column as Text type.

 

Set JobRate to insert into the JobRate column as Numeric type.


7.

When you're sure your choices are correct, click OK to close the dialog and add the behavior.

8.

Save your page before continuing.

For ColdFusion and PHP

1.

From the Server Behaviors panel, choose Add (+) and select Insert Record.

2.

In the Insert Record dialog, choose the current form.

Select AddJobCode from the Submit Values From list.

3.

Select your data source from the list.

Choose Recipes from the Data Source list.

4.

Enter your username and password, if needed.

5.

Select the table in the data source to insert into from the list.

Choose JobTypes (jobtypes for PHP) from the Insert Into Table list.

6.

Set the data source fields to their corresponding form elements.

Make sure the JobTypeID data column is set to be an unused Primary Key.

 

Set JobType to the FORM.JobName form element and submit as Text type.

 

Set JobCode to the FORM.JobCode form element and submit as Text type.

 

Set JobRate to the FORM.JobRate form element and submit as Numeric type (Double in PHP).


7.

In the After Inserting, Go To field, enter report_projectsummary.cfm or report_projectsummary.php as appropriate and click OK to close the dialog.

8.

Save your page.




Macromedia Dreamweaver 8 Recipes
Macromedia Dreamweaver 8 Recipes
ISBN: 0321393910
EAN: 2147483647
Year: 2003
Pages: 121

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net