One of our client want to print the company logo in sales invoice report depends on sell to customer field dynamically.
I have written code for this and i need know in source exp of picture box how to use IF loop.
for ex IF Customer.Picture <> ‘’ THEN CompanyInfo.Picture ELSE Customer.Picture;
if the customer rec does not have any picture value it should print company information picture… how to define this… am unable to assign BLOG field to any variable please help me on this.
If you check the standard Invoice report (206) then you can see that it already have CompanyInfo1, CompanyInfo2 and CompanyInfo3.
So you can to do it the same way they are doing it here. Assuming your question is not about a “classic” report (you didn’t write this in your question [:’(] ), then you would be transferring both the customer and the company logo and in RDLC check if the field is empty or not.
Sorry its Classic report NAV 4.0 version. my question is for few customers, invoice should generate with separate logo. for other as usual same company information logo. CompanyInfo1, CompanyInfo2 and CompanyInfo3 are used for left, right, center alignment defined in Sales setup. i need to know in same picture box how to separate this. please help me.
Yes they are used for alignment, but the principles are the same. Only one is shown, based on which one is not empty.
And don’t show it in the same picture box, but use two picture boxes, and then if customer.picture is not blank, then show it, otherwise show the normal company picture.
set the sourceexpr property of e.g. the right picture from CompanyInfo2.Picture to CompInfoRight.Picture.
add following code to the trigger “Sales Invoice Header - OnAfterGetRecord()”:
IF SalesSetup.“Logo Position on Documents” =
SalesSetup.“Logo Position on Documents”::Right THEN BEGIN
customer.GET(“Sell-to Customer No.”);
customer.CALCFIELDS(Picture);
IF customer.Picture.HASVALUE THEN
CompInfoRight.Picture := customer.Picture;
ELSE
CompInfoRight.Picture := CompanyInfo2.Picture;
END;