Search for question
Question

4. You need to create a trigger that will automatically create the charge sheet when a contract is completed and all the expenses have been submitted and approved. The 'fee'

is determined by the following criteria:10000 base charge for all jobs Each Day a job takes over 14 is charged at an additional rate of 500 a day. The 'expenses' for the job are the total expenses associated with the job. The logic of the charge sheet being completed is as follows:When a contract is closed the expenses for the job are checked to see ifthere are any outstandingIf there are no outstanding expenses then a new charge sheet record iscreated with the fee and expenses due calculated and inserted with thedata. If there are expenses outstanding then no charge sheet is created. A charge sheet may also be triggered from the expenses table, that logic is as follows: When an expense is authorised a check is carried out to see the contract has ended and if there are any other outstanding expense If the job is closed and the expenses are all authorised then a new chargesheet record is created with the fee and expenses due calculated and inserted with the data as described above.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5