Multiple line of items of PO on the report not printing?

mdsrmdsr Member Posts: 163
Hi all,
I have to create custom Purchase order report in which multiple copies of PO report.
I have done that using page loop and copy loop but one poblem is
PO having multiple item say 4 item lines then report only showing first line item
any solution so i get all four items printed on report
Documentation()


OnInitReport()

OnPreReport()

RecCompany.GET();
RecCompany.CALCFIELDS(RecCompany.Picture);

RecCountry.RESET;
RecCountry.SETRANGE(Code,RecCompany."Country/Region Code");
IF RecCountry.FINDFIRST THEN
CompanyCountry:=RecCountry.Name;


OnPostReport()

Purchase Header - OnPreDataItem()

Purchase Header - OnAfterGetRecord()

"Purchase Header".CALCFIELDS("Amount to Vendor");
Vendors.GET("Purchase Header"."Buy-from Vendor No.");

RecNoseries.GET("Purchase Header"."No. Series");


i:=0;
PurchCmmntLine.RESET;
PurchCmmntLine.SETRANGE(PurchCmmntLine."Document Type","Purchase Header"."Document Type");
PurchCmmntLine.SETRANGE(PurchCmmntLine."No.","Purchase Header"."No.");
IF PurchCmmntLine.FINDFIRST THEN REPEAT
    i +=1;
    POComments[i]+=PurchCmmntLine.Comment;
  UNTIL PurchCmmntLine.NEXT=0;



CLEAR(vStateCode_Location);
CLEAR(vStateName_Location);
CLEAR(LocationName);
CLEAR(LocationName_Add1);
CLEAR(LocationName_Add1);
CLEAR(LocationName_city);
CLEAR(LocationName_GSTIN);
CLEAR(LocationName_Pincode);
CLEAR(LocationName_Email);
CLEAR(LocationName_homepage);
RecLocation.RESET;
RecLocation.SETRANGE(Code,"Location Code");
IF RecLocation.FINDFIRST THEN BEGIN
  LocationName:=RecLocation.Name;
  LocationName_Add1:=RecLocation.Address;
  LocationName_Add2:=RecLocation."Address 2";
  LocationName_city:=RecLocation.City;
  LocationName_GSTIN:=RecLocation."GST Registration No.";
  LocationName_Pincode:=RecLocation."Post Code";
  LocationName_Email:=RecLocation."E-Mail";
  LocationName_homepage:=RecLocation."Home Page";
  RecState.RESET;
  RecState.SETRANGE(Code,RecLocation."State Code");
  IF RecState.FINDFIRST THEN BEGIN
    vStateName_Location := RecState.Description;
    vStateCode_Location := RecState."State Code (GST Reg. No.)";
  END;
END;



CLEAR(ShippmentMethod_Desc);
RecShippmentMethod.RESET;
RecShippmentMethod.SETRANGE(RecShippmentMethod.Code,"Shipment Method Code");
IF RecShippmentMethod.FINDFIRST THEN
 ShippmentMethod_Desc:=RecShippmentMethod.Description;

CLEAR(Payment_Desc);
RecPaymentTer.RESET;
RecPaymentTer.SETRANGE(RecPaymentTer.Code,"Purchase Header"."Payment Terms Code");
IF RecPaymentTer.FINDFIRST THEN
  Payment_Desc:=RecPaymentTer.Description;
  



Purchase Header - OnPostDataItem()

CopyLoop - OnPreDataItem()
NoOfLoops := ABS(NoOfCopies)  + 1;
IF NoOfLoops <= 0 THEN
  NoOfLoops := 1;
CopyText := '';
SETRANGE(Number,1,NoOfLoops);
OutputNo := 1;

CopyLoop - OnAfterGetRecord()
IF Number > 1 THEN BEGIN
  
  OutputNo += 1;
END;
IF OutputNo=1 THEN
  BEGIN
  CopyText:=Text001;
   END;
IF OutputNo=2 THEN
  BEGIN
  CopyText:=Text002;
    END;
 IF OutputNo=3 THEN
BEGIN
  CopyText:=Text003;
  END;
 IF OutputNo>=4 THEN
BEGIN
  CopyText:=Text004;
END;
CurrReport.PAGENO := 1;

CopyLoop - OnPostDataItem()

PageLoop - OnPreDataItem()

PageLoop - OnAfterGetRecord()

PageLoop - OnPostDataItem()

Purchase Line - OnPreDataItem()
"Sr.No":=0;

Purchase Line - OnAfterGetRecord()
MESSAGE('%1',"Purchase Line"."No.");
"Sr.No"+=1;
TotalAmt:=0; TotalGst:=0;TotalAmt1:=0;RoundValue:=0;
RecPurchaseLine.RESET;
RecPurchaseLine.SETRANGE(RecPurchaseLine."Document No.","Purchase Line"."Document No.");
IF RecPurchaseLine.FINDSET THEN BEGIN
   REPEAT

         TotalAmt+=RecPurchaseLine.Quantity*RecPurchaseLine."Unit Cost";
         TotalGst+=RecPurchaseLine."Total GST Amount";
   UNTIL RecPurchaseLine.NEXT=0;
END;





CLEAR(GST1);CLEAR(GST_Amt);
DetailGDTEntryBuffer.RESET;
DetailGDTEntryBuffer.SETRANGE("Document No.","Purchase Line"."Document No.");
DetailGDTEntryBuffer.SETRANGE("No.","No.");
DetailGDTEntryBuffer.SETRANGE("Document Type",DetailGDTEntryBuffer."Document Type"::Order);
DetailGDTEntryBuffer.SETRANGE("Transaction Type",DetailGDTEntryBuffer."Transaction Type"::Purchase);
DetailGDTEntryBuffer.SETRANGE("Line No.","Purchase Line"."Line No.");
IF DetailGDTEntryBuffer.FINDFIRST THEN
 REPEAT
    IF DetailGDTEntryBuffer."GST Component Code"='CGST' THEN BEGIN
      GST1[1]:=DetailGDTEntryBuffer."GST %";
      GST_Amt[1]:=DetailGDTEntryBuffer."GST Amount";
   END;
  IF DetailGDTEntryBuffer."GST Component Code"='SGST' THEN BEGIN
     GST1[2]:=DetailGDTEntryBuffer."GST %";
     GST_Amt[2]:=DetailGDTEntryBuffer."GST Amount";
     END;
    IF(DetailGDTEntryBuffer."GST Component Code"='IGST')OR(DetailGDTEntryBuffer."GST Component Code"='UTGST') THEN BEGIN
    GST1[3]:=DetailGDTEntryBuffer."GST %";
    GST_Amt[3]:=DetailGDTEntryBuffer."GST Amount";
    END;
  UNTIL DetailGDTEntryBuffer.NEXT=0;

TotalAmt1:=ROUND((TotalAmt+TotalGst),1,'=');
RoundValue:=TotalAmt1-(TotalAmt+TotalGst);

CheckReport.InitTextVariable;
CheckReport.FormatNoText(AmountInWords,TotalAmt1,'');

Purchase Line - OnPostDataItem()

Answers

Sign In or Register to comment.