Inventory Received Report  Topic is solved

Support for Crystal Reports within Jiwa.

Inventory Received Report

Postby marcosomizu » Tue Dec 01, 2015 7:05 pm

Hi,

I need to add the comment line from the PO lines into the default Inventory Received Report.

Could someone help me please?

Cheers
marcosomizu
Occasional Contributor
Occasional Contributor
 
Posts: 23
Joined: Mon Sep 07, 2015 12:01 pm
Topics Solved: 1

Re: Inventory Received Report

Postby Scott.Pearce » Wed Dec 02, 2015 8:41 am

That's a bit tricky. JOINing RE_Lines to PO_Lines will omit the comment lines (this is what the report currently does). Changing the report links so that we are JOINing PO_Lines to RE_Lines will omit non-ordered lines. If I were doing it, I'd write the whole thing as a stored procedure based report - this would give the flexibility required. If stored procedures are too scary, you could perhaps use a view and join that in somehow.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Inventory Received Report

Postby marcosomizu » Fri Dec 04, 2015 5:18 pm

Hi Scott,

Good! We are on the same page.

I created a Stored Procedure that lists everything that I need on the report. The problem is, for some reason I cannot make Jiwa sets the @SP_PackSlipID parameter automatically, so a Parameter Dialog is open when I try to print the report.

The question is: what are the steps to make Jiwa sets the parameters automatically to the Stored Procedure, like it does in the Invoice for example?

Cheers!
marcosomizu
Occasional Contributor
Occasional Contributor
 
Posts: 23
Joined: Mon Sep 07, 2015 12:01 pm
Topics Solved: 1

Re: Inventory Received Report  Topic is solved

Postby Mike.Sheen » Sat Dec 05, 2015 1:45 pm

marcosomizu wrote:The question is: what are the steps to make Jiwa sets the parameters automatically to the Stored Procedure, like it does in the Invoice for example?
Cheers!


The GRN form by default will inject into the record selection formula "{RE_Main.PackSlipID}=<value>" - but it also looks for a Pass_SP_StartingSlipNo and Pass_SP_EndingSlipNo formula and sets those.

So, you need to create a formula named Pass_SP_StartingSlipNo - you don't need anything in here, it just has to exist - the GRN form will set the contents when the user prints. You don't need to worry about the Pass_SP_EndingSlipNo formula - that's optional - it was designed to allow the same report to be used either from printing on the form, or the menu (range based report).

Then you need to add a JiwaRanges forumula - in there put the text:
Code: Select all
//{@Pass_SP_StartingSlipNo}


Note the comment at the start - the print engine in Jiwa will wire this up to the stored proc parameter.

You will also have to alter your stored procedure to have a parameter named SP_StartingSlipNo instead of your SP_PackSlipID. Note you'll also have to modify your query(ies) in your stored proc to deal with being passed the SlipNo instead of the ID.

If you must have the parameter in the stored proc SP_PackSlipID instead of SP_StartingSlipNo, then you'll need to have a plugin to override the print tool click on the GRN form and set the appropriate formula. Let us know if you need that, but It would be better if you modified your stored proc to suit the form instead.

To give you an idea what happens when the print tool is clicked on the GRN form - here is the code from that form:

Code: Select all
Public Overrides Sub PrintRecord(ByVal ReportDefinition As JiwaApplication.PrintGroup.FormReports.ReportDefinition)
        Dim PrintUIObject As JiwaApplication.JiwaPrintReportUI.MainForm
        Dim MyLoop As Integer

        PrintUIObject = JiwaApplication.Manager.Instance.CreateReport(ReportDefinition, 1, True, False, True, "{RE_Main.PackSlipID}=" & JiwaApplication.Manager.Instance.Database.FormatChar(_InventoryReceival.RecID))
        If Not (PrintUIObject Is Nothing) Then
            For MyLoop = 1 To PrintUIObject.PrintReportObject.JiwaReportRangeCollection.Count
                If UCase(PrintUIObject.PrintReportObject.JiwaPrintFormulaCollection(PrintUIObject.PrintReportObject.JiwaReportRangeCollection(MyLoop).FormulaKey).Name) = UCase("Pass_SP_StartingSlipNo") Or UCase(PrintUIObject.PrintReportObject.JiwaPrintFormulaCollection(PrintUIObject.PrintReportObject.JiwaReportRangeCollection(MyLoop).FormulaKey).Name) = UCase("Pass_SP_EndingSlipNo") Then
                    PrintUIObject.PrintReportObject.JiwaReportRangeCollection(MyLoop).Value = _InventoryReceival.GRNNo
                End If
            Next MyLoop
            PrintUIObject.UpdateReport()
            PrintUIObject.chkDrill.Checked = True
            PrintUIObject.PrintReportToScreen()
            PrintUIObject.Show()
        End If
    End Sub


Note the overrides the PrintRecord of the base class - which is JiwaFinancials.Jiwa.JiwaApplication.Maintenence.UserInterface. We override it to support legacy reports from version 6. If it wasn't overridden, then the base class PrintRecord would have been invoked - which looks like this:

Code: Select all
Public Overridable Sub PrintRecord(ByVal ReportDefinition As JiwaApplication.PrintGroup.FormReports.ReportDefinition)
            Dim PrintUIObject As JiwaApplication.JiwaPrintReportUI.MainForm
            Dim SelectionFormula As String = ""

            SelectionFormula = "{" & BusinessLogic.RecIDFieldName & "} = " & JiwaApplication.Manager.Instance.Database.FormatChar(BusinessLogic.RecID)
            PrintUIObject = JiwaApplication.Manager.Instance.CreateReport(ReportDefinition, 1, True, ReportDefinition.Report.ReportType = Report.Configuration.Report.ReportTypes.Menu, True, SelectionFormula)
            If Not (PrintUIObject Is Nothing) Then
                PrintUIObject.UpdateReport()
                PrintUIObject.PrintReportToScreen()
                PrintUIObject.Show()
            End If

        End Sub


As you can see, by default we simply set the record selection formula.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Inventory Received Report

Postby Scott.Pearce » Mon Dec 07, 2015 8:21 am

I'd like to add that because the selection formula is *always* set to

Code: Select all
"{RE_Main.PackSlipID}=" & JiwaApplication.Manager.Instance.Database.FormatChar(_InventoryReceival.RecID)


then I *suspect* that the report will error if it does not contain a table called "RE_Main". This could be rectified by overriding the PrintRecord routine, or by simply linking in the RE_Main table on the report (ie. inner join to a field on your stored proc in crystal). Yes you can link tables to stored procedures!
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Inventory Received Report

Postby marcosomizu » Mon Dec 07, 2015 12:56 pm

Thank you for your help guys!

Once you said that the parameter that Jiwa looks for is Pass_SP_StartingSlipNo and Pass_SP_EndingSlipNo, it was very easy to finish what I had to do!

Just wondering if it's possible: Is there a way to know which parameter does Jiwa sets automatically in each form by myself?

For example, is there a help file that says:

Goods Receipt Note -> automatically looks for parameters Pass_SP_StartingSlipNo and Pass_SP_EndingSlipNo, or RE_Main.PackSlipID
Sales Order -> automatically looks for parameter Pass_SP_InvoiceHistoryID
And so on?

You don't need to rush to answer this. I am just asking this because this may help us (developers) and save you guys a little bit of time.

Thank you again!
Cheers,
Marcos Omizu
marcosomizu
Occasional Contributor
Occasional Contributor
 
Posts: 23
Joined: Mon Sep 07, 2015 12:01 pm
Topics Solved: 1

Re: Inventory Received Report

Postby Scott.Pearce » Mon Jan 11, 2016 8:20 am

There is no such file. That said, we will look in to addressing this in some way soon.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221


Return to Crystal Reports

Who is online

Users browsing this forum: No registered users and 6 guests