formatted nav patterns
This commit is contained in:
parent
38a19d75d8
commit
2fad891a77
59 changed files with 1403 additions and 1970 deletions
|
|
@ -10,13 +10,13 @@ Group 2: Jens Winberg, Tim Grant, Alen Tot
|
|||
|
||||
Thanks to Tim Grant who had merged the two patterns, corrected, sent for review and finalized them.
|
||||
|
||||
## **Meet the Pattern**
|
||||
## Meet the Pattern
|
||||
|
||||
It should be possible to change which document report object should be used when printing. This configuration can be stored in one place (Report Selection) and available at configuration time. In this situation, the code for printing records can remain the same.
|
||||
|
||||
The purpose of this pattern is to describe the process to implement a reports selection by retrieving the specific **Document Header**, determining which type of document is related to it in the **Report Selection Screen**, and call the report which needs to be printed by passing the specific document header. This specifies the reports that you can print when you work with the various documents for sales and purchases, such as orders, quotes, invoices, and credit memos.
|
||||
|
||||
## **Know the Pattern**
|
||||
## Know the Pattern
|
||||
|
||||
The program can preselect which report will be printed when you print from various types of purchase and sales headers. For example, on an order, the **Order Confirmation** report is automatically printed.
|
||||
|
||||
|
|
@ -26,31 +26,31 @@ The user can, of course, choose to have the program print a different report tha
|
|||
|
||||
This pattern should be used when the user needs to print a new type of document which can have different report layouts, or when the user needs to print several different reports in sequence. This can also be used during a new post and print routine, a test report for journal posting or for re-printing a posted document. Using this pattern will minimize code by allowing a flexible means of specifying different reports to print, instead of hard-coding a report id when printing a document.
|
||||
|
||||
## **Use the Pattern**
|
||||
## Use the Pattern
|
||||
|
||||
The Report Selection Pattern involves the **Report Selection** table as the central configuration element also with the **Report Selection** Page. The table is used in 4 generic functional workflows:
|
||||
|
||||
1) Test Print un-posted
|
||||
1. Test Print un-posted
|
||||
|
||||
If the Report Selection is related to a Test Report relating to a Document:
|
||||
|
||||
* The Document's Page including Printing Actions
|
||||
* Test Report-Print Codeunit 228
|
||||
* The Document's Page including Printing Actions
|
||||
* Test Report-Print Codeunit 228
|
||||
|
||||
2) Print un-posted. If the Report Selection is related to an existing Document (un-posted):
|
||||
2. Print un-posted. If the Report Selection is related to an existing Document (un-posted):
|
||||
|
||||
* The Document's Page (Document / List) including the Printing Actions
|
||||
* The Document-Print Codeunit 229 is used atomically to use the document type in the generic Sales Header table before the report selection is found.
|
||||
* The Document's Page (Document / List) including the Printing Actions
|
||||
* The Document-Print Codeunit 229 is used atomically to use the document type in the generic Sales Header table before the report selection is found.
|
||||
|
||||
3) Print while posting. If the Document is printed at the point of posting then:
|
||||
3. Print while posting. If the Document is printed at the point of posting then:
|
||||
|
||||
* The Document's Post + Print Codeunit (82 or 92), with the related **GetReport** and **PrintReport** functions.
|
||||
* The Document's Post + Print Codeunit (82 or 92), with the related **GetReport** and **PrintReport** functions.
|
||||
|
||||
4) Print after posting. If the Report Selection is related to an existing Document (posted):
|
||||
4. Print after posting. If the Report Selection is related to an existing Document (posted):
|
||||
|
||||
* The specific document related posted header table is used along with a typical function: **PrintRecords** within the respective table.
|
||||
* The specific document related posted header table is used along with a typical function: **PrintRecords** within the respective table.
|
||||
|
||||
## **Example**
|
||||
## Example
|
||||
|
||||
Sales Document (Invoice)
|
||||
|
||||
|
|
@ -65,30 +65,34 @@ Implementation:
|
|||
* Add a new **Option String** to the **Report Selection** table, **Usage** field (including any ML Captions).
|
||||
* Calling of **GetReport** function, passing the document header.
|
||||
|
||||
SalesSetup.GET;
|
||||
IF SalesSetup."Post & Print with ob Queue" THEN
|
||||
```al
|
||||
SalesSetup.GET;
|
||||
IF SalesSetup."Post & Print with ob Queue" THEN
|
||||
SalesPostViaobQueue.EnqueueSalesDoc(SalesHeader)
|
||||
ELSE BEGIN
|
||||
ELSE BEGIN
|
||||
CODEUNIT.RUN(CODEUNIT::"Sales-Post",SalesHeader);
|
||||
GetReport(SalesHeader);
|
||||
END;
|
||||
COMMIT;
|
||||
END;
|
||||
COMMIT;
|
||||
```
|
||||
|
||||
* Implementing the new document type within the **GetReport** Function, and calling **PrintReport** with the New OptionString
|
||||
|
||||
"Document Type"::Invoice:
|
||||
```al
|
||||
"Document Type"::Invoice:
|
||||
BEGIN
|
||||
IF "Last Posting No." = '' THEN
|
||||
SalesInvHeader."No.":= "No."
|
||||
ELSE
|
||||
SalesInvHeader."No." := "Last Posting No.";
|
||||
SalesInvHeader.SETRECFILTER;
|
||||
PrintReport(ReportSelection.Usage::"S.Invoice");
|
||||
IF "Last Posting No." = '' THEN
|
||||
SalesInvHeader."No.":= "No."
|
||||
ELSE
|
||||
SalesInvHeader."No." := "Last Posting No.";
|
||||
SalesInvHeader.SETRECFILTER;
|
||||
PrintReport(ReportSelection.Usage::"S.Invoice");
|
||||
END;
|
||||
```
|
||||
|
||||
* Implement the new Document Type and calling the associated report ID, passing the document header
|
||||
|
||||
## **NAV Usages**
|
||||
## NAV Usages
|
||||
|
||||
* Codeunits 82, 92, for post and printing purchase and sales documents
|
||||
* Codeunit 229 for Document printing
|
||||
|
|
@ -96,9 +100,7 @@ Implementation:
|
|||
|
||||
This pattern is already used for printing documents like sales invoices, proforma, waybills, Finance Charge Memos, Receipt Documents.
|
||||
|
||||
****
|
||||
|
||||
## **Ideas for improvement**
|
||||
## Ideas for improvement
|
||||
|
||||
The "Usage" Field could be more dynamic through a setup field linked to a document type table mapped to the document header Table ID.
|
||||
|
||||
|
|
@ -110,7 +112,7 @@ Merge the **PrintReport** functions in the purchase and sales post printing func
|
|||
|
||||
Merge the **PrintRecords** functions in the separate posted header tables into a more atomic print selection component.
|
||||
|
||||
## **Related Patterns**
|
||||
## Related Patterns
|
||||
|
||||
* Posting Routine Pattern (Journal/Document)
|
||||
* Post Batch Routine Pattern
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue