Adding NumAtCard from ORDR to txtBaseDocument
Eddy Kalliski
Hi there,We often deliver goods from multiple different sales orders at one time. In addition to our own order number, I would like to add the customer's order reference (NumAtCard) to the txtBaseDocument line(s) on the delivery note (and invoice).
I added the following line (in bold script) to the code that we have been using so far :
txtBaseDocument.Value=""
' Bassierend auf Auftrag
If(DocumentRow("BaseType")=17) Then
txtBaseDocument.Value = GetData("LD.Txt.T0000073") + " " + LD.FStr(DocumentRow("BaseDocNum"),"0") + " (" + LD.FStr(Document("NumAtCard"),"0") + ")" + " van " + LD.Date(LD.QueryData("SELECT TaxDate FROM ORDR WHERE DocEntry =" + LD.FStr(DocumentRow("BaseEntry"),"0")),"dd-MM-yyyy.")
End If
It works fine as long as there is only one order reference. As soon as there is more than one order on the delivery note, it just shows "0" every time. That is probably because the script doesn't tell it how to handle multiple numbers. I assume I need to get the NumAtCard from "ORDR", but I don't know how to do that.
I would appreciate it if you could help me with this.
p.s. I have found the following http://www.coresuite.ch/index.php?id=48&L=1&tx_mmforum_pi1[action]=list_post&tx_mmforum_pi1[tid]=983, but I think this is way too much scripting for my needs.
Philipp Knecht
Hi EddyI think there is a BaseAtCard or BaseCard Field in the DocumentRow Databand. Try that one.
hth
Eddy Kalliski
Hi Philipp,"BaseAtCard" makes it show "empty value"
"BaseCard" makes it show the customer number, which is not what I want.
+ LD.FStr(Document("NumAtCard"),"0") works fine! But only when the delivery originates from only 1 order and the customer's order reference is a number (digits from 0-9 only).
When the delivery comes from multiple orders, or the reference is a word (alphanumeric), it shows "0".
I can also try to explain my problem in German, if that helps...
Philipp Knecht
Hi EddyI just checked DocumentRow("BaseAtCard") and it worked fine?
I've tested with Sales Order -> Delivery.
hth
Eddy Kalliski
Hi Philipp,I have added this exact line:
+ LD.FStr(DocumentRow("BaseAtCard"),"0")
In the place where I wrote the "NumAtCard" part in bold script my first post. But it still shows me a "0" (without the brackets) on the print layout... is the line I added correct?
It works fine when the delivery comes from only one order, exactly like I have whenever I write "NumAtCard". But it doesn't work when the description is a word or when it comes from multiple orders (so whenever there is a ";"-sign inbetween the order references in the NumAtCard field.)
Philipp Knecht
Hi EddyAs soon as you have alphanumeric characters FStr won't work anymore.
Just try with DocumentRow("BaseAtCard") and you should get your information.
This Field is saved on row level. So it should work when row is coming from sales order x and row 2 form sales order y.
hth
Eddy Kalliski
Thanks. Can you also tell me how to tell it in which row to look? (Like you say row 1 from order x and row 2 from order y?). Or where I can find the info on how to do this.Thank you in advance!
Philipp Knecht
Hi EddyDocumentRow("xyz") always points to the actual row in the DataBand.
A DataBand iterates through all the rows so if you pull the Value within the DocumentRow DataBand it should work for all rows.
hth
Carl Verhagen
Hi all,I saw the question and discussion above and wonder if there was a final answer to it?
I also use the BaseAtCard at row level in our document and that works fine if you create 1 delivery of a salesorder or more.
So for the output of the deliverydocument it works fine.
However when you create a consolidated invoice of alle the outstanding deliveries, the value in BaseAtCard will be all the customer reference numbers seperated by a ";", which were stored in the delivery. (see attachement)
So the information to the customer is no good enough as the customer reference will exist of all referencenumbers from the deliveries.
The customer has to guess which position at the invoice belongs to which of his order.
Is there a solution for this?
Best regards,
Carl Verhagen
Attachment
[url=http://www.coresystems.ch/wp-content/../wp-content/forum-file-uploads/carl66/Customer ref at invoice.doc]Customer ref at invoice.doc[/url]
Philipp Knecht
Hi CarlDid you Preview this Invoice also with the default MarketingDIN Layout?
Because there we always have a base reference before the item line.
hth
Carl Verhagen
Hi Philippe,My first example wasn't based at the standard document, but when I did, the value is still the same. I've add the BaseAtCard at yhe band Documentrowdetail:Detail.
See attachment.
The delivery was created for 3 salesorders and per position, the correct Customer reference will be printed.
Then the invoice was created for this deliverynote and the value in BaseAtCard is now the 3 customerreferences of the delivery separeted by a ";" and I want the single reference of the customer which was printed at the delivery note.
Is that possible?
Best regards,
Carl Verhagen
Attachment
[url=http://www.coresystems.ch/wp-content/../wp-content/forum-file-uploads/carl66/Customer ref at invoice 2.doc]Customer ref at invoice 2.doc[/url]
Philipp Knecht
Hi CarlYou can always lookup Values From your BaseDocs like we did in the default Template on txtBaseDocument.
There you need to inspect the Generatescript.
hth
Carl Verhagen
Hi Philipp,Thanks for the tip, after some changing, the script works fine.
For others to use:
' Bassierend auf Lieferschein
If(DocumentRow("BaseType")=15) Then
textBox148.Value = LD.QueryData("SELECT BaseAtCard FROM DLN1 WHERE DocEntry =" + LD.FStr(DocumentRow("BaseEntry"),"0") + " AND LineNum =" + LD.FStr(DocumentRow("BaseLine"),"0"))
End If
Thanks and best regards,
Carl Verhagen
Hitma Beheer B.V.
0
Please sign in to leave a comment.
Comments
0 comments