Posted Sales Invoice->Print all with specific Resource li

emulsified
Member Posts: 139
What is the easiest way to print all Posted Sales Invoices that contain type RESOURCE with certain conditions?
For example, in our system we have:
Resource DISC1
Resource DISC2
On any given Posted Sales Invoice there will be a sales line that looks like this:
Resource DISC1 -1 5.00 -5.00
I know I can run the Posted Sales Invoice report without giving it a RecordNo and it will give me the dialog to Print, Preview, and all the other criteria where I can also add a filter for Type ->Resource, Salesperson, etc...
My goal is to print all Posted Sales Invoices within a date range that contains specific resource discounts, not just all of them.
Here is some code that I used in another report section Sales Invoice Line, Body - OnPreSection() that modified the OUTPUT that was shown to show only Resources I was interested in seeing and gathering the totals as you can see from the code below:
Should I just use the above with modification? I know that there is probably a shorter method using CASE or something else.
Any suggestions would be greatly appreciated. Thanks.
For example, in our system we have:
Resource DISC1
Resource DISC2
On any given Posted Sales Invoice there will be a sales line that looks like this:
Resource DISC1 -1 5.00 -5.00
I know I can run the Posted Sales Invoice report without giving it a RecordNo and it will give me the dialog to Print, Preview, and all the other criteria where I can also add a filter for Type ->Resource, Salesperson, etc...
My goal is to print all Posted Sales Invoices within a date range that contains specific resource discounts, not just all of them.
Here is some code that I used in another report section Sales Invoice Line, Body - OnPreSection() that modified the OUTPUT that was shown to show only Resources I was interested in seeing and gathering the totals as you can see from the code below:
IF "Sales Invoice Line".Type = 3 THEN IF "Sales Invoice Line"."No." = '' THEN BEGIN CurrReport.SHOWOUTPUT(FALSE); END ELSE IF "Sales Invoice Line"."No." = 'TRACKINGNUMBER' THEN BEGIN CurrReport.SHOWOUTPUT(FALSE); END ELSE IF "Sales Invoice Line"."No." = 'CODISC' THEN BEGIN TotalCODISC := TotalCODISC + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'DSC' THEN BEGIN TotalDSC := TotalDSC + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'FDISC' THEN BEGIN TotalFDISC := TotalFDISC + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'FREIGHT CHARGE' THEN BEGIN TotalFREIGHTCHARGE := TotalFREIGHTCHARGE + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'LIDISC' THEN BEGIN TotalLIDISC := TotalLIDISC + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'LTDISC' THEN BEGIN TotalLTDISC := TotalLTDISC + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'NDISC' THEN BEGIN TotalNDISC := TotalNDISC + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'PKDISC' THEN BEGIN TotalPKDISC := TotalPKDISC + "Sales Invoice Line".Amount; END ELSE IF "Sales Invoice Line"."No." = 'WIRE TRANSFER' THEN BEGIN TotalWIRETRANSFER := TotalWIRETRANSFER + "Sales Invoice Line".Amount; END ELSE CurrReport.SHOWOUTPUT(TRUE) ELSE CurrReport.SHOWOUTPUT(FALSE);
Should I just use the above with modification? I know that there is probably a shorter method using CASE or something else.
Any suggestions would be greatly appreciated. Thanks.
Half-empy or half-full how do you view your database?
Thanks.
Thanks.
0
Comments
-
I think, you can modify this same type of code but ofcoursely with a sitch case will make this code look better.Diptish Naskar
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/0 -
emulsified wrote:My goal is to print all Posted Sales Invoices within a date range that contains specific resource discounts, not just all of them.
do you just really need to list them in a report or do you really need the invoice?0 -
All I really need is to be able to PRINT or PREVIEW any Posted Sales Invoices that contain those RESOURCE codes.
Here is the logic I am going for:
:arrow: Use the Sales Invoice form.
:arrow: Only show for PREVIEW or PRINT those Posted Sales Invoices that contain those RESOURCE codes in the Sales Lines.
That's it.Half-empy or half-full how do you view your database?
Thanks.0 -
emulsified wrote:All I really need is to be able to PRINT or PREVIEW any Posted Sales Invoices that contain those RESOURCE codes.
Here is the logic I am going for:
:arrow: Use the Sales Invoice form.
:arrow: Only show for PREVIEW or PRINT those Posted Sales Invoices that contain those RESOURCE codes in the Sales Lines.
That's it.
OK, the simple way....
Create a Batch (non printing report) based on Sales Line.
You will run this filters by Doc Typ Order, Typ Res, No. (your resources).
Create a Temp record of Sales Header.
In the onaftergetrec section in the report add code like:TempSalesHeader."Document Type := "document type"; TempSalesHeader."no." := "Document no."; If tempsalesheader.insert then ;
Teh in the onpostrecord section, run through the temp records, and send them as paramaters to your report to print.
It probably took me longer to write this post that it will to write the code.David Singleton0 -
I am relatively new to Navision (C/AL) and that looks like the best solution to me, but I am a bit confused.
I know the following:
*Create a report using TABLE 'Sales Line'.
*The DataItem should be 'Sales Line'.
*I should set ProcessingOnly to 'Yes'.
*The user should see a Request Form where they can choose a
Date Filter and Salesperson Code.
*I should somehow write code to loop through the filtered Sales Lines
(the code I already wrote for a previous report) and if I get a TRUE I
should then call the REPORT.RUNMODAL function for each instance of
TRUE using the SalesInvoiceHeader."No."
:? What I am not sure of:
*How I get there? ](*,)
*Will the user have a Request Form to input a Salesperson Code and
Date Filter?
*If I use REPORT.RUNMODAL function will the user get to select a
printer?
:-k Can't I use or modify, create a copy of the Navision report 'Sales Invoice' to do the same thing that the ProcessingOnly report does? I feel this is the best option (users like to preview and print) because my understanding is that I can run this report using the Request Form and just hard code in one of the sections (OnPre?) to do a CurrReport.SHOWOUTPUT(TRUE) when I get a Sales Line that is one of the RESOURCES I am looking for?
Thanks.Half-empy or half-full how do you view your database?
Thanks.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions