Calculate Adam McLean's final invoice bill for his family visit started on 2021-08-03. Adam McLean's guest...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Calculate Adam McLean's final invoice bill for his family visit started on 2021-08-03. Adam McLean's guest ID is G5 and the invoice sales tax percentage is 9%. Follow the steps below to complete this assignment. Read the entire assignment before you work on these steps. Step 1: create an invoice table with the following script (Copy and paste the script to SSMS) CREATE TABLE INVOICE ( InvoiceID InvoiceDate BookID GuestID smallint date Int varchar(4) date identity (1000,1) Primary Key, default getdate(), decimal(7,2) decimal(7,2) decimal(7,2) decimal(5,2) decimal(7,2) Not Null, Not Null, Not Null, StartDate CondoFee ActivityFee Invoice Total default 0, Sales Tax Grand Total default 0, Foreign key (BookID) REFERENCES BOOKING (BookID), Foreign key (GuestID) REFERENCES GUEST (GuestID)); default 0, default 0, default 0, Submit the Select * from invoice query result. (You should see an empty table as shown below) Results | Messages Invoice D Invoice Date BookID Guest ID StartDate Condo Fee ActivityFee Invoice Total Sales Tax Grand Total Step 2: write a select statement to calculate the condo fee for the McLean family. (15 points) Condofee = (No of days * daily rate) of the condo booked by the McLean family on 2021-08-03 1 Total Condo Fee 1015.00 Step 3: write a select statement to calculate the activity fee for the McLean family. (15 points) Activityfee = Numberinparty* PPP (McLean family had two reservations during their visit) 1 Activityfee 275.00 Step 4: Write a stored procedure, Create_Invoice, to insert an invoice record. (30 points) 1. Use TRY CATCH, Transaction Commit/Rollback to insert a new invoice record for the McLean Family. 2. The stored procedure will pass two input parameters, GuestID and StartDate, to avoid hard-coding in step 2 and 3. 3. The invoice record will be populated with invoice ID, invoice date, book ID, GuestID, Start Date, CondoFee, and ActivityFee. The rest of the attributes will contain zeros. Invoice ID and date will be automatically populated. You will have 5 attributes in your insert statement. Make sure the number and position of commas and parentheses are correct to separate these 5 in your insert statement. CREATE PROCEDURE Create_Invoice (input parameters) AS BEGIN Try begin transaction End Try Begin Catch +0 Commit transaction End Catch Enter your insert into statement here............ Select ERROR_NUMBER() AS Error Number, ERROR_MESSAGE() AS ErrorMessage; Rollback 37165_stung4 Database Diagrams Tables Views External Resources Synonyms Programmability Stored Procedures Rollback End Catch +0 37165_stung4 Database Diagrams Tables Views External Resources Synonyms Programmability Stored Procedures System Stored Procedures dbo.Create_Invoice Step 5: Create 1 trigger, Calculate_Invoice_Total, on the INVOICE table. (20 points) When an invoice record is inserted in step 4, this trigger will 1. Read the inserted temp table from Step 4 to get the Condofee and ActivityFee for invoice calculation 2. Use update statements to calculate and update invoice total, sales tax, and grand total. Invoicetotal = condofee + activityfee Salestax Invoicetotal *0.09 Grandtotal invoice total + sales tax = Submit the Create trigger statement and a screenshot of the created trigger under the INVOICE table folder (see example below). Create trigger Calculate_Invoice_Total Enter your trigger creation statement here.......... dbo.INVOICE Columns Keys 1 Constraints Triggers Calculate_Invoice_Total Indexes Step 6: execute the stored procedure and select the final invoice record for display. The result should look similar to the sample below. (10 points) Exec Create_Invoice 'G5', '2021-08-03'; Select * from invoice; (Your invoice number and invoice date might be different from the example below) InvoiceID Invoice Date BookID GuestID Start Date Condo Fee Activity Fee 1000 2022-07-13 168 G5 2021-08-03 1015.00 275.00 Invoice Total Sales Tax 1290.00 116.10 Grand Total 1406.10 Calculate Adam McLean's final invoice bill for his family visit started on 2021-08-03. Adam McLean's guest ID is G5 and the invoice sales tax percentage is 9%. Follow the steps below to complete this assignment. Read the entire assignment before you work on these steps. Step 1: create an invoice table with the following script (Copy and paste the script to SSMS) CREATE TABLE INVOICE ( InvoiceID InvoiceDate BookID GuestID smallint date Int varchar(4) date identity (1000,1) Primary Key, default getdate(), decimal(7,2) decimal(7,2) decimal(7,2) decimal(5,2) decimal(7,2) Not Null, Not Null, Not Null, StartDate CondoFee ActivityFee Invoice Total default 0, Sales Tax Grand Total default 0, Foreign key (BookID) REFERENCES BOOKING (BookID), Foreign key (GuestID) REFERENCES GUEST (GuestID)); default 0, default 0, default 0, Submit the Select * from invoice query result. (You should see an empty table as shown below) Results | Messages Invoice D Invoice Date BookID Guest ID StartDate Condo Fee ActivityFee Invoice Total Sales Tax Grand Total Step 2: write a select statement to calculate the condo fee for the McLean family. (15 points) Condofee = (No of days * daily rate) of the condo booked by the McLean family on 2021-08-03 1 Total Condo Fee 1015.00 Step 3: write a select statement to calculate the activity fee for the McLean family. (15 points) Activityfee = Numberinparty* PPP (McLean family had two reservations during their visit) 1 Activityfee 275.00 Step 4: Write a stored procedure, Create_Invoice, to insert an invoice record. (30 points) 1. Use TRY CATCH, Transaction Commit/Rollback to insert a new invoice record for the McLean Family. 2. The stored procedure will pass two input parameters, GuestID and StartDate, to avoid hard-coding in step 2 and 3. 3. The invoice record will be populated with invoice ID, invoice date, book ID, GuestID, Start Date, CondoFee, and ActivityFee. The rest of the attributes will contain zeros. Invoice ID and date will be automatically populated. You will have 5 attributes in your insert statement. Make sure the number and position of commas and parentheses are correct to separate these 5 in your insert statement. CREATE PROCEDURE Create_Invoice (input parameters) AS BEGIN Try begin transaction End Try Begin Catch +0 Commit transaction End Catch Enter your insert into statement here............ Select ERROR_NUMBER() AS Error Number, ERROR_MESSAGE() AS ErrorMessage; Rollback 37165_stung4 Database Diagrams Tables Views External Resources Synonyms Programmability Stored Procedures Rollback End Catch +0 37165_stung4 Database Diagrams Tables Views External Resources Synonyms Programmability Stored Procedures System Stored Procedures dbo.Create_Invoice Step 5: Create 1 trigger, Calculate_Invoice_Total, on the INVOICE table. (20 points) When an invoice record is inserted in step 4, this trigger will 1. Read the inserted temp table from Step 4 to get the Condofee and ActivityFee for invoice calculation 2. Use update statements to calculate and update invoice total, sales tax, and grand total. Invoicetotal = condofee + activityfee Salestax Invoicetotal *0.09 Grandtotal invoice total + sales tax = Submit the Create trigger statement and a screenshot of the created trigger under the INVOICE table folder (see example below). Create trigger Calculate_Invoice_Total Enter your trigger creation statement here.......... dbo.INVOICE Columns Keys 1 Constraints Triggers Calculate_Invoice_Total Indexes Step 6: execute the stored procedure and select the final invoice record for display. The result should look similar to the sample below. (10 points) Exec Create_Invoice 'G5', '2021-08-03'; Select * from invoice; (Your invoice number and invoice date might be different from the example below) InvoiceID Invoice Date BookID GuestID Start Date Condo Fee Activity Fee 1000 2022-07-13 168 G5 2021-08-03 1015.00 275.00 Invoice Total Sales Tax 1290.00 116.10 Grand Total 1406.10
Expert Answer:
Related Book For
Fundamentals of Law Office Management
ISBN: 978-1133280842
5th edition
Authors: Pamela Everett Nollkamper
Posted Date:
Students also viewed these databases questions
-
Follow the steps below to complete the assignment: Workbook: Begin by creating a new workbook. In the workbook you will want to have 2 worksheets. Name your worksheets as follows: Sheet 1: Monthly...
-
The payroll project that follows is the online version of the same project you completed manually in Chapter 7 of your text. For this project, you will use the Cengage Learning General Ledger to...
-
Find the area between the parabolas y = 2x 2 + 1 and y = x 2 + 5.
-
William Potts was employed by Jemoli Holdings, Inc., to liquidate assets of defunct companies. Potts had the authority to sign checks for Jemoli. Potts had a personal investment account with Raymond...
-
What ethical considerations arise when engaging in cross-cultural research and representation, particularly in terms of cultural appropriation, representation, and the ethics of cultural exchange ?
-
How to cure a default judgment?
-
At the end of June, Morton Company had a balance of $49,900 in the vacation benefits payable account. During July, employees earned an additional $3,110 in vacation benefits, but some employees used...
-
+ Year Proposal A ($) Proposal B ($) Proposal C ($) Proposal D ($) 0 -540,000 -250,000 -640,000 -310,000 1 150,000 100,000 220,000 130,000 2 150,000 90,000 210,000 100,000 3 150,000 80,000 210,000...
-
Tameka wants you to consider a hybrid aggregate plan, using up to the maximum overtime per employee for any period where demand cannot be satisfied with the current regular-time production and the...
-
The marginal revenue (in thousands of dollars) from the sale of x gadgets is given by the following function -2/3 R'(x)=4x(x+26,000) a Find the total revenue function if the revenue from 130 gadgets...
-
When considering which industry segments a firm should specialize in , it is more important to be guided by segment attractiveness than whether the key success factors align with the firm s resource...
-
Solve for x. Check your work. x - 2y + 3z = 9 -x+3y-z = -6 2x - 5y + 5z = 17
-
**Please upload your answers to Canvas as a single PDF file. 1. Suppose X and Y are two binary random variables. Their joint distribution is given below: Y = 1 Y = 3 Y = 5 0.07 0.04 0.09 0.14 0.20...
-
S Ltd has the following capital structure: 800,000 ordinary shares of 1 800,000 Share premium account 160,000 Retained earnings 320,000 Shareholders' equity 1,280,000 1,000,000 ordinary shares of 1...
-
Blossom Corporation has collected the following information after its first year of operations. Sales were $1,250,000 on 125,000 units, selling expenses $250,000 (40% variable and 60% fixed), direct...
-
The coefficient of thermal expansion of concrete and steel are alpha_concrete = 1.2 x 10-5/C and alpha_steel = 1.1 x 10-5/C, respectively. The length of the steel conforms to the size of the...
-
Pearl Medavoy will invest $10,240 a year for 20 years in a fund that will earn 10% annual interest. . If the first payment into the fund occurs today, what amount will be in the fund in 20 years? If...
-
It all came apart in less than a year: a booming products liability boutique headed by an ex-partner from a big firmthe scion of one of Marylands most prominent legal families, an author, and a...
-
Margaret Cleary is a paralegal who works for a law firm that requires her to bill clients seven hours a day. One of Margarets assignments was to prepare interrogatories on a real estate case. She...
-
Norma Hunter, a paralegal, works for the law firm of Everett & Mullins, a respected medium-sized law firm. Her supervising attorney is Rick Everett, who specializes in criminal defense work. Norma...
-
After Megan Jones finished her BS degree in Management at The University of Rhode Island, she landed a great job with the app developing company Global App Creations (GAC). In her six months of...
-
Demarco just graduated from Texas University and had been snatched up by Xeon Natural Resources Incorporated, one of the top natural resource extraction companies in the world. Because he was...
-
Jayla just landed an internship with Acme Incorporated in the Payroll Department. She was excited because these internships usually turned into a full-time job after graduation. Jayla was hired by...
Study smarter with the SolutionInn App