Options

Purchase order report problem

Andreas_GunawanAndreas_Gunawan Member Posts: 64
Dear All,
I am currently creating a report, but I am not understand when I put one item in the purchase
line, then it's ok, the page is only one page when I preview the purchase order report. but after I put 2 items in the purchase line, the purchase order report page become 2 pages.
The coding in the C/AL :
dataitem : integer
Integer - OnAfterGetRecord()
IF "Last Purchase line" THEN
BEGIN
CurrReport.BREAK;
END
ELSE IF "Last Purchase line" = FALSE THEN
BEGIN
"Dummy Line Counter" := "Dummy Line Counter" + 1;
IF "Dummy Line Counter" > 35 THEN
CurrReport.SKIP;
END;


dataitem : purchase:

Purchase Line - OnAfterGetRecord()
"Purchase line counter" := "Purchase line counter" + 1;
"Dummy Line Counter" := "Dummy Line Counter" + 1;

IF (Type <> 0) AND ("No." <> '') THEN
Sequence := Sequence + 1;

PlineRec.COPY("Purchase Line");
IF PlineRec.NEXT <> 0 THEN
"Last Purchase line" := TRUE
ELSE
"Last Purchase line" := FALSE;

IF "Purchase line counter" >35 THEN
CurrReport.NEWPAGE;

disc := disc + "Line Discount Amount";

Could you provide me a hint to solve this problem, because if I set purchase line counter > 5, then the table in the report page doesn't fit the whole page according to our need. There is only 50% fit the page. The section contains table, no., item no., description, qty, unit of measure, unit cost and total cost. I apreciate your answer. tku


Rgds,
Andreas

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,096
    Can you first explain exactly what you want to obtain.
    And for what purpose is the integer-dataitem?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Andreas_GunawanAndreas_Gunawan Member Posts: 64
    Hi Kriki, All,
    Just disregard my first question and I renew now. I am willing to have a purchase order and sales order report and set dataitem as follows:
    DataItem Name
    Sales Header <Sales Header>
    Sales Line <Sales Line>
    Integer <rowline>

    C/Al for dataitem:
    sales header:
    Sales Header - OnAfterGetRecord()
    SubTotal := 0;
    Sequence := 0;
    TotalGrossAmount :=0;
    TotalAll :=0;
    Tax :=0;
    counter := 0;
    rowline := 0;
    Discount := 0;
    GrossAmount := 0;

    Sales Line:
    Sales Line - OnAfterGetRecord()
    Sequence := Sequence + 1;
    counter := counter + 1;
    IF counter > 43 THEN BEGIN
    counter := 0;
    CurrReport.NEWPAGE;
    END;

    Integer (rowline):
    rowline - OnAfterGetRecord()
    rowline := 43 - counter;
    IF Number > rowline THEN
    CurrReport.BREAK;


    The section parts consists of:
    1. Sales Line, Header
    2. Sales Line, body
    3. Integer, Body
    4. Sales line, Footer


    C/AL for section 1:
    Sales Line, Header (1) - OnPreSection()
    SubTotal := 0;
    TotalGrossAmount := 0;
    Discount := 0;
    TotalAll := 0;

    C/AL for section 2:
    Sales Line, Body (2) - OnPostSection()
    SubTotal := SubTotal + Amount;
    GrossAmount := "Line Amount";
    TotalGrossAmount := TotalGrossAmount + GrossAmount;
    Discount := Discount + "Inv. Discount Amount";
    TotalAll := TotalGrossAmount - Discount;

    The problems are how to make my report generated by the system consists of 39 items. The second problem is how to join the horizontal shape with vertical shape if the field PlaceInBottom of sales line footer section properties I select yes. The vertical shape are placed in the sales line body and integer sections, meanwhile the horizontal shape are placed in the sales line footer section. Could you tell me the solution then..? tku for your answer beforehand.

    Rgds,
    Andreas

    actually exists in the first page.
  • Options
    chrispaulchrispaul Member Posts: 174
    Hi Andr
    Rather then explaning your code please tell us as kriki said what exactly is your requirement so that we can help you more precisely
  • Options
    krikikriki Member, Moderator Posts: 9,096
    chrispaul wrote:
    Hi Andr
    Rather then explaning your code please tell us as kriki said what exactly is your requirement so that we can help you more precisely
    Exactly. To understand your code we need to understand what you want to obtain.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Andreas_GunawanAndreas_Gunawan Member Posts: 64
    Hi Chris, All,
    My problem is that the report I created for sales or purchase order can not contains 39 items to sell (sequence qty of items must be as same as the items exists in the sales order line of sales order from no. 1 to 39).
    I have created the coding, section etc as mentioned above. I don't want the report is two pages.
    If the report one pages it should contains 39 items, but it is not. You know that if it is sales order or purchase order oc course the report contains no., item no., description, qty, unit of measure, unit price/cost, total amount.
    and in the footer of course there is grand total field so sum all 39 items.
    I apreciate yout answer so much. Tku.


    Rgds,
  • Options
    krikikriki Member, Moderator Posts: 9,096
    So if I understood it correctly, you want all 39 items on 1 page?
    And if you have 100 items in a salesorder? I mean:sooner or later you will have so many items, you will have to use 2 or more pages.

    -To put more records on the pages, you can make the lines-section smaller (using a smaller font, so the textbox can be smaller, so the section can be smaller), you can make the header and footer section smaller. But still... sooner or later you will need more pages...
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Andreas_GunawanAndreas_Gunawan Member Posts: 64
    You are right. I one one page contains 39 items and if I have 100 items of course I will need 3 pages. But it should be 39 items in one page. Also, I have sales admin, sales mgr and customer signature box in the sales order footer section and I have selected yes in the field PlaceInBottom of sales line footer section properties so that the page section (bottom margin) is fully fit, but my table bottom row splitted with vertical row of sales line body section, this is really confusing me. How to unite the horizontal row back to vertical row ?


    Rgds,
    Andreas
  • Options
    krikikriki Member, Moderator Posts: 9,096
    I think it is best you start by taking a standard report like R205 and start changing that.
    It is not necessary that you count the lines to decide when to do a Newpage. Navision takes care of that.

    BTW : do you have multiple sections with property PlaceInBottom=Yes. And in the OnPreSection you decide to show or not to show them? In this case, Navision reserves space for printing ALL of them. If this is the case, you should use only 1 of those section and then clear or not clear some fields on them.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I guess he wants always 39 lines per page, also when the order contains eg. 5 lines.

    What I do is in the SalesHeader - OnAfterGetRecord trigger, writing code to count the no. of lines in the order, and to insert new lines (with Type = '', Description = ' ') until there are 39 (or a multiple of 39) lines in the order.

    In the SalesLine - OnPostDataItem trigger, you write your code to delete the inserted lines.

    This way, you don't have to use a Integer dataitem to count the no. of lines.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    Andreas_GunawanAndreas_Gunawan Member Posts: 64
    Dear All, Kriki and Luc,
    Tku for your reply. The problem I have in creating report can be viewed from website.
    I will describe the pictures:
    1.PO-Overall-1items.JPG --> this picture seems ok but there is a problem inside it when it contains 3items.
    http://www.geocities.com/andreas2975/PO ... 1items.JPG
    2.PO-3items-overall-page1.JPG
    This PO contains 3 items if viewed thoroughly in page 1
    http://www.geocities.com/andreas2975/PO ... -page1.JPG
    3.PO-3items-overall-page2.JPG
    This PO is continuation of picture PO-3items-overall-page1.JPG i.e. its page 2.
    http://www.geocities.com/andreas2975/PO ... -page2.JPG
    4.PO-3items-placeinbottom-yes-page1.JPG
    This PO placeinbottom field of purchase line footer section properties is selected to yes. The result of setting is this picture and it looks like PO-3items-overall-page1.JPG
    http://www.geocities.com/andreas2975/PO ... -page1.JPG
    5.PO-3items-placeinbottom-yes-page2.JPG
    This picture is continuation of PO-3items-placeinbottom-yes-page1.JPG and it seems that there are missing shapes (vertical shapestyle) that connecting top and bottom and I thought it can be like PO-Overall-1items.JPG and contains 3 - 35 items as you have said.
    http://www.geocities.com/andreas2975/PO ... -page2.JPG

    The codings and section picturescan be seen in the pictures:
    1. purchase-line coding.JPG
    http://www.geocities.com/andreas2975/pu ... coding.JPG
    2. integer coding.JPG
    http://www.geocities.com/andreas2975/integer-coding.JPG
    3. PO-section view.JPG
    http://www.geocities.com/andreas2975/PO ... n-view.JPG
    4. purchase line-section-coding.JPG
    http://www.geocities.com/andreas2975/pu ... coding.JPG

    To more clearly just download the file from this website:
    http://www.geocities.com/andreas2975/int-report1.zip

    I just want to maintain the report I designed and overlook the std report available in navision. Indeed it is a base of study but can't be treated
    as a guide.
    I I am very hoping by seeing the website, the problem can be seen clearly
    and I can have the answer. I really appreciate your answer. tku.

    Rgds,
    Andreas

    P.S.
    If I can pay for the report or the answer, maybe I can send the money
    for your answer, but I hope not too expensive.
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Why don't you try my suggestion to insert empty Purchase Lines before, and remove them afterwards? This way, you don't need the Integer-dataitem of your report, as you can use the normal Purchase Line body-section to print the "empty" lines.

    And you can use the normal Purchase Line Footer and Transfooter sections to close your rectangle/frame properly.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    Andreas_GunawanAndreas_Gunawan Member Posts: 64
    Dear Luc,
    Tku very much for your quick reply. I will try this nite. :)
    And 2morrow will send the result. I didn't mean to disregard your answer.



    Rgds,
    Andreas
Sign In or Register to comment.