Notes Creation Process

Purpose
The Notes Maintenance screen allows a user to enter a new Note or edit an existing note. This document will focus on the former Note Creation. Once the note is created an invoice will be automatically created for the entire Note Amount. An EFT record for the Note Number will also be created based upon the current entity's Royalty Balance Type information.

Process
The user must first decide what Entity the Note is for this can be Corporation, Developer Contract, Person or Store. If a note is being created for a Store it must have an EFT account setup prior to creating the note unless the Loan Type is 'Minority'. If one is not setup the user will see a popup notification once they attempt to choose a Loan Type other than 'Minority'. Once that user has filled out the form and hit the Save button the Notes Creation process does the following:


 * 1) If this is a new Note than create a new Note object and assign it to the Note Selector Control
 * 2) Assign all the values from the form to the Note object
 * 3) For the Entity Type and Entity Id, determine the Entity Type and take the values from the correct corresponding control.
 * 4) For a new Note assign the properties of the sub objects for Document Tracking, Account Balance and Invoice Unposted
 * 5) The Account Balance Object is assigned a zero balance
 * 6) The Invoice Unposted object is an Invoice with one Item of type Note Distribution and the original total note amount in the defined currency. If the currency chosen is different then the country currency or the Agreed to Exchange Rate is entered then the USDToLocalConversionRate and ItemAmtToUSDConversionRate are filled in to do the local currency conversion later on in posting.
 * 7) The Note Lenders sub object is re-assigned for new and existing Notes
 * 8) Validation against the newly created Note is checked. If the Note object is not valid set the broken rules visuals and stop the save process.
 * 9) Then check if an EFT record for Royalty balance exist if the Entity is a Store unless the Loan Type is 'Minority' or the Store has a waiver for PA Account - Per Agreement or PA Account - No Availability, if it does not, display a message box to the user stating 'EFT information must be set up for this note' and stop the save process.
 * 10) Next Check that at least one Notes Receivable Lender has been chosen if not set the broken rules visuals and stop the save process.
 * 11) If all the previous validations are valid save the Note Object to the database.
 * 12) First the Note will be inserted into the NRMasterfile table
 * 13) Then the Note Lenders collection will be saved
 * 14) Then save the EFT object
 * 15) If this is a new Note save the Document Tracking Object and the Account Balance Object
 * 16) Create a invoice in the Unposted tables
 * 17) Create a Note Delinquency Object
 * 18) Finally the unposted invoice is posted and the invoice Session Register is created in the file system and sent in an email.
 * 19) Reset the Object Cache with the new Note Number and refresh the form making it read only.

Validations

 * 1) Loan Type is required
 * 2) If Loan Type is 'DA Other' or 'Franchisee Other' then a Comment is required
 * 3) Note Amount must be greater than 0
 * 4) Term must be greater than 0, the default is 60. This can be months or Weeks depending upon the Payment Frequency.
 * 5) Start Date is required. The default is today.
 * 6) Payment Date is required
 * 7) If Interest Calculation is Daily then Days in Year must be between 1 and 366
 * 8) Adjustment Code is required
 * 9) If Adjustment Code is 'Interest Only' then Interest Rate must be greater or equal to 0.01
 * 10) If Adjustment Code is 'Fixed' or 'Interest Plus' then Adjustment Amount can not be greater than 100,000

Stored Procedure
The Notes Maintenance form uses the following procedures