Set up the Journal Creation On Lock Script
The Journal Creation On Lock Script Editor can be used to override and add conditions to the automatic journal creation settings defined elsewhere in MineMarket. The script includes the following functions:
- CanGenerateJournalOnInvoiceLock()—Overrides the Generate Journals On Lock setting defined on the invoice type (see Set up Invoice Types), the Contractual Invoice Types node of the contract terms for the associated sales or purchase contract (see Specify Invoice Types for a Set of Contract Terms), or the Contractual Invoice Types tab of the associated service or freight contract (see Specify Invoice Types for a Service or Freight Contract).
- CanGenerateJournalOnPaymentLock()—Overrides the Generate Journals When Locking Payments setting defined in the sales and marketing settings. See Specify Sales and Marketing Settings.
- CanGenerateJournalOnRefundLock()—Overrides the Generate Journals When Locking Payments setting defined in the sales and marketing settings. See Specify Sales and Marketing Settings.
- CanGenerateJournalOnRevaluationLock()—Overrides the Generate Journals On Lock setting defined in the invoice revaluation stream. See Create an Invoice Revaluation Stream.
By default, each function returns a Boolean value of true but can be edited to return false as required. The JournalEntryContext for each function can be edited to define the conditions required for automatic journal creation.
Example
The following script extract validates whether the despatch order (DO) associated with the invoice has Bill of Lading Date. Journals are created when the invoice is locked only if the associated DO has a defined Bill of Lading Date.
public bool CanGenerateJournalOnInvoiceLock(JournalEntryContext journalEntryContext)
{
if(journalEntryContext != null && journalEntryContext.DespatchTotal.DespatchOrder != null)
{
return !journalEntryContext.DespatchTotal.DespatchOrder.BillOfLadingDate.IsNull;
}
return true;
}
Security Note: You need the Allow the user to maintain journal scripts security right in the Scripting user group security rights group for this activity.
Activity Steps
- Open the Chart Of Accounts screen.
- Click Edit Journal Creation On Lock Script.
The Journal Creation On Lock Script Editor and the Scripting Ribbon Tab display.
- Edit the C# script.
- Click the Build icon on the Scripting ribbon tab to compile the script.
- Click the Save icon on the Scripting ribbon tab.