purchase order report

ACN_P
Member Posts: 2
I have a report that should prints the image of the products that are in the related purchase order ( print only the images of the products that has the property Imprimir Desenho checked on Quality product requirement)
the code I have in the report is
*Requisito produto Qualidade - OnAfterGetRecord()
IF ReqQualidade.GET("Requisito produto Qualidade".Requisito) THEN
BEGIN
IF ReqQualidade."Imprimir Desenho" THEN
BEGIN
ItemTemp."No.":=PurchLine."No.";
IF ItemTemp.INSERT THEN
BEGIN
ndesenhos+=1;
flagglobal:=TRUE;
END;
END;
END;
*Desenho - OnPreDataItem()
IF NOT flagglobal THEN
CurrReport.BREAK;
Desenho.SETRANGE(Number,1,ndesenhos);
ItemTemp.FINDFIRST;
*Desenho - OnAfterGetRecord()
IF ItemI.GET(ItemTemp."No.") THEN
BEGIN
manufactsetup.GET;
ItemTemp.DELETEALL;
IF filee.OPEN(manufactsetup.Destino+'\'+ItemI.Ficheiros) THEN
BEGIN
filee.CREATEINSTREAM(Instream);
ItemTemp.Picture.CREATEOUTSTREAM(OutStream2);
COPYSTREAM(OutStream2,Instream);
ItemTemp.INSERT;
ItemTemp.CALCFIELDS(Picture);
filee.CLOSE;
END;
END;
The report only prints the first product that has the property Imprimir Desenho checked on Quality product requirement, but it print it as many time as products in the order with that same characteristic.
For example
in an order with 2 products with the requirement "Imprimir Desenho" it only prints the image of the first but 2 times
Can same one tell me where the problem is?
the code I have in the report is
*Requisito produto Qualidade - OnAfterGetRecord()
IF ReqQualidade.GET("Requisito produto Qualidade".Requisito) THEN
BEGIN
IF ReqQualidade."Imprimir Desenho" THEN
BEGIN
ItemTemp."No.":=PurchLine."No.";
IF ItemTemp.INSERT THEN
BEGIN
ndesenhos+=1;
flagglobal:=TRUE;
END;
END;
END;
*Desenho - OnPreDataItem()
IF NOT flagglobal THEN
CurrReport.BREAK;
Desenho.SETRANGE(Number,1,ndesenhos);
ItemTemp.FINDFIRST;
*Desenho - OnAfterGetRecord()
IF ItemI.GET(ItemTemp."No.") THEN
BEGIN
manufactsetup.GET;
ItemTemp.DELETEALL;
IF filee.OPEN(manufactsetup.Destino+'\'+ItemI.Ficheiros) THEN
BEGIN
filee.CREATEINSTREAM(Instream);
ItemTemp.Picture.CREATEOUTSTREAM(OutStream2);
COPYSTREAM(OutStream2,Instream);
ItemTemp.INSERT;
ItemTemp.CALCFIELDS(Picture);
filee.CLOSE;
END;
END;
The report only prints the first product that has the property Imprimir Desenho checked on Quality product requirement, but it print it as many time as products in the order with that same characteristic.
For example
in an order with 2 products with the requirement "Imprimir Desenho" it only prints the image of the first but 2 times
Can same one tell me where the problem is?
0
Answers
-
Why you create deleteall in ItemTemp in Desenho - OnAfterGetRecord() trigger0
-
Try delete line with deleteall and add ItemTemp.Next
Like:
IF ItemI.GET(ItemTemp."No.") THEN BEGIN
manufactsetup.GET;
IF filee.OPEN(manufactsetup.Destino+'\'+ItemI.Ficheiros) THEN BEGIN
filee.CREATEINSTREAM(Instream);
ItemTemp.Picture.CREATEOUTSTREAM(OutStream2);
COPYSTREAM(OutStream2,Instream);
ItemTemp.INSERT;
ItemTemp.CALCFIELDS(Picture);
filee.CLOSE;
END;
END;
ItemTemp.NEXT;0 -
thank you for your answer
I did note create the code I´m trying to fix it because it does not do what is supose to, but I´m not been able to find the error
the change you suggest does not work because if I delete ItemTemp.DELETEALL the report does not run
I think it enters in loop because it gives an error the productXXX already exists0
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