Hi Nav Masters,
My client wants me to display The List of Posted Invoice on the Posted Shipment Form.
For Shipment done from Sales Order by posting Ship, i can do.
I just create a new flow field on the Sales Shipment Header and COUNT the Sales Invoice Header and link it with Order No.
Then some problems occur.
If the user posting Invoice from Sales Invoice then the Order No. field will be blank.
Also If the user Posting from Sales Invoice with Get Shipment Line, the Order No. is empty too.
My question is, is there any link between the posted Invoice and Posted Shipment?
I think of creating a new Table to keep the relation between Shipment and Invoice that is not posted from Sales Order
The fields will consist of:
1. Shipment No (code)
2. Invoice No (code)
3. Posted from Sales Invoice (boolean)
I keep the Shipment No. and Invoice No. everytime posting from Sales Invoice. But there's more problems, how to get the Shipment No. when Get Shipment Line??? ](*,) ](*,) ](*,)
Is there any other better idea?
Please help me.
Thanks in advance,
______________
Regards,
Steven
0
Answers
To find the invoices of a shipment then you must find all the Item Ledger Entry of that shipment, (by filtering the Item Ledger Entry Table with document no. and posting date), then get every Value Entry for each Item Ledger Entry. The Value Entries are created from invoices, so by getting the "Document No." and the "Posting Date" of all those value entry records, you will have all your invoices.
Since an invoice may have posted alot value entry records, then you could use a record of Sales Invoice Header to find the appropriate invoice (with document no. and posting date) and MARK it, then apply a filter MARKEDONLY and then show the posted invoices list...
You could also make a integer variable on the shipment form and calculate the number of the records that you got marked and show it on the form so that the user can know how many invoices the shipment has. The lookup i menthioned earlier could be in the drill down of that control that shows the invoices count that you calculated (maybe in the onAfterGetRecord trigger of the form)
All this was just an idea, and I think it is a lot simpler than modifying codeunits and creating new tables...
Anyway, I hope I helped...
Arhontis
https://forum.mibuso.com/search
Yes i want to display using integer to count the total invoice a shipment have.
Please explain more with codes, coz i'm new in Nav and i dont know how to use MARK
Thanks in advance
Regards,
Steven
Use the C/Side help to see at the MARK, MARKEDONLY and CLEARMARKS, it is best to seeit for yourself...
I will write you the link between the tables:
- Sales Shipment Header -> Item Ledger Entry
Filter the "Document No." and "Posting Date" fields of Item Ledger Entry table with the "No." and "Posting Date" of the shipment header.
- Item Ledger Entry -> Value Entry
Filter the "Item Ledger Entry No." of the Value Entry for each Item Ledger Entry with the "Entry No." of Item Ledger Entry record (by using a loop).
The "Document No." and the "Posting Date" of all the Value Entry that you will find will give you all the invoices...
Code sample: This finds and shows a form with all the invoices of a shipment and the variable CalcNumOfInvoices holds the number of invoices that where found...
I haven't tested it but I think it will work just fine... Just place the above code in a button on the shipments form to test it...
Study the code and understand how it works...
And remember, practice makes perfect...
NOTE:
You can always replace the FIND('-') with FINDSET(FALSE,FALSE) to increase speed...
Arhontis
https://forum.mibuso.com/search
Thanks for your explanation,
i tried your code,
i make a function "CalcInvoice" to run your code (without using the FORM.RUNMODAL coz i just want to display the total of invoice on my Posted Shipment form).
After the user click the DrillDown button the it shows the list of the invoice.
I call the function "CalcInvoice" from <Form - OnAfterGetRecord()>
Then i create a new text box with DrillDown properties set to Yes
and set the SourceExpr properties to my countInv variable.
But it still display all total Invoice, not only the invoice for that Shipment.
Is there any mistake that i make?
Regards,
Steven
Look at the C/SIDE help on the menu and look for the MARK, CLEARMARKS and MARKEDONLY functions, so that you can learn more about it and be able to use it more in the future...
Arhontis
https://forum.mibuso.com/search
No i manage to display the total Invoice count for a Shipment
Now how to make the DrillDown show the list of invoice for that Shipment.
Do i need to create a new Form?
Thanks in advance
Regards,
Steven
Navision Technical Consultant
That will run the appropriate form... If you need to use another form the replace the 0 with the report ID you want...
In general it is not proper to write code in forms, so finally I suggest you put all the code you wrote as function in a custom codeunit and call it from your form...
Anyway... I am glad you made it is working...
Please edit your first post and place a SOLVED: at the beginning of the subject...
Arhontis
https://forum.mibuso.com/search
My problems solved,
I use global variable for all variable in my "CalcInvoice" function
So on <Form - OnAfterGetRecord()> i call that function
and on <OnDrillDown()> i use only the :
FORM.RUNMODAL(0,SalesInvHeader);
And its all done..
Thank you all, for helping me to solve this problems
Regards,
Steven
I wanted to mention using global variable about the sales invoice header and just call the FORM.RUNMODAL, but as I mentioned it is not proper... I know that it is the easiest solution, but better implementation is using local variables in the function and placing the code in a cu or as a function in the table object (Sales Shipment Header) and use return value or return parameters of the function to get stuff out of it...
I am glad to be of help...
Arhontis
https://forum.mibuso.com/search
If i code in Form, i only export 1 object to import to my client. Form 130 Posted Sales Shipment.
If i create a cu or place in table, i need to export and import more than 1 objects?
Maybe you can explain me?
Thanks
Regards,
Steven
It is easier to handle migrations that way... (moving to new versions in Nav)
In addition another developer would understand better on what you are trying to do...
Nav has a lot of standards like that and I think there is a pdf document about it. Have studied it a few years ago.
Have you read it?
Arhontis
https://forum.mibuso.com/search
I'm still new so i don't know bout that.
I there any website where i can download the pdf file?
Thanks
Regards,
Steven
http://www.mibuso.com/forum/viewtopic.p ... =gui+guide
http://www.mibuso.com/forum/viewtopic.p ... =gui+guide
You can find the cal guide that describes a lot that you might find very useful is in the Tools CD:
3.70:
https://mbs.microsoft.com/partnersource ... page=false
4.0 (the cal guide is missing on 4.0 so look in the 3.70):
https://mbs.microsoft.com/partnersource ... page=false
Arhontis
https://forum.mibuso.com/search
It helps me a lot.
Another question, if i put the code in my table. I just call it as a function. Or i create a new Integer field to keep the total count of Invoices for that Shipment. Just curious, can we create a flowfield but use c/al code as the CalcFormula?
Thanks
Regards,
Steven
Arhontis
https://forum.mibuso.com/search