Sales Report

HexHex Member Posts: 6
edited 2005-08-09 in Navision Attain
I need a report, showing Quantity Invoiced pr Inventory Posting Group and Gen. Bus. Posting Group from the Customer.

This report should show this grouped by Inventory Posting Group, and you should be able to filter on the Gen. Bus. Posting Group from the customer.

There should be a total for each Inventory Posting Group.

Any help would be appreciated.
Who the hell is General Failure, and why is he reading my disk?

Comments

  • krikikriki Member, Moderator Posts: 9,112
    It was easier to make a little example than explaining it:
    OBJECT Report 99999 Total Per Inv/Gen Bus.Pst.Grp.
    {
      OBJECT-PROPERTIES
      {
        Date=09/08/05;
        Time=16:17:19;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table250;
            OnAfterGetRecord=BEGIN
                               tmpGenBusinessPostingGroup := "Gen. Business Posting Group";
                               tmpGenBusinessPostingGroup.INSERT(FALSE);
                             END;
    
            OnPostDataItem=BEGIN
                             SearchSalesInvoiceLines();
                           END;
    
          }
          SECTIONS
          {
          }
           }
        { PROPERTIES
          {
            DataItemTable=Table2000000026;
            DataItemTableView=SORTING(Number);
            DataItemVarName=InvGroup;
            OnPreDataItem=BEGIN
                            tmpInv.RESET;
    
                            RESET;
                            SETRANGE(Number,1,tmpInv.COUNT);
                          END;
    
            OnAfterGetRecord=BEGIN
                               IF Number = 1 THEN
                                 tmpInv.FIND('-')
                               ELSE
                                 tmpInv.NEXT;
                             END;
    
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=12000;
                SectionHeight=1269;
              }
              CONTROLS
              {
                { 1000000001;Label  ;0    ;0    ;1500 ;846  ;ParentControl=1000000000;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000003;Label  ;3300 ;0    ;1500 ;846  ;ParentControl=1000000002;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1000000006;Label  ;1650 ;0    ;1500 ;846  ;ParentControl=1000000005;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=12000;
                SectionHeight=1269;
              }
              CONTROLS
              {
                { 1000000002;TextBox;3300 ;423  ;1500 ;423  ;CaptionML=ENU=Quantity;
                                                             SourceExpr=tmpInv.Quantity }
                { 1000000000;TextBox;0    ;423  ;1500 ;423  ;CaptionML=ENU=Inventory Posting Group;
                                                             SourceExpr=tmpInv."Journal Template Name" }
                { 1000000008;Label  ;1650 ;423  ;1500 ;423  ;CaptionML=ENU=Total }
              }
               }
          }
           }
        { PROPERTIES
          {
            DataItemIndent=1;
            DataItemTable=Table2000000026;
            DataItemTableView=SORTING(Number);
            DataItemVarName=BusGroup;
            OnPreDataItem=BEGIN
                            tmpInvGen.RESET;
                            tmpInvGen.SETRANGE("Journal Template Name",tmpInv."Journal Template Name");
    
                            RESET;
                            SETRANGE(Number,1,tmpInvGen.COUNT);
                          END;
    
            OnAfterGetRecord=BEGIN
                               IF Number = 1 THEN
                                 tmpInvGen.FIND('-')
                               ELSE
                                 tmpInvGen.NEXT;
                             END;
    
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=12000;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1000000004;TextBox;3300 ;0    ;1500 ;423  ;CaptionML=ENU=Inventory Posting Group;
                                                             SourceExpr=tmpInvGen.Quantity }
                { 1000000005;TextBox;1650 ;0    ;1500 ;423  ;CaptionML=ENU=Gen. Bus. Posting Group;
                                                             SourceExpr=tmpInvGen."Journal Batch Name" }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          recItem@1000000003 : Record 27;
          recSalesInvoiceLine@1000000001 : Record 113;
          tmpGenBusinessPostingGroup@1000000002 : TEMPORARY Record 250;
          tmpInv@1000000004 : TEMPORARY Record 83;
          tmpInvGen@1000000000 : TEMPORARY Record 83;
    
        PROCEDURE SearchSalesInvoiceLines@1000000006();
        BEGIN
          // make a total per "Inventory Posting Group" and "Gen. Bus. Posting Group" in table tmpInvGen
          recSalesInvoiceLine.RESET;
          recSalesInvoiceLine.SETRANGE(Type,recSalesInvoiceLine.Type::Item);
          IF recSalesInvoiceLine.FIND('-') THEN
            REPEAT
              IF tmpGenBusinessPostingGroup.GET(recSalesInvoiceLine."Gen. Bus. Posting Group") THEN BEGIN
                recItem.GET(recSalesInvoiceLine."No.");
    
                IF NOT tmpInvGen.GET(recItem."Inventory Posting Group",recSalesInvoiceLine."Gen. Bus. Posting Group",0) THEN BEGIN
                  // create primary key with "Inventory Posting Group" and "Gen. Bus. Posting Group"
                  CLEAR(tmpInvGen);
                  tmpInvGen."Journal Template Name" := recItem."Inventory Posting Group";
                  tmpInvGen."Journal Batch Name" := recSalesInvoiceLine."Gen. Bus. Posting Group";
                  tmpInvGen."Line No." := 0;
                  tmpInvGen.INSERT(FALSE);
                END;
                tmpInvGen.Quantity += recSalesInvoiceLine."Quantity (Base)";
                tmpInvGen.MODIFY(FALSE);
    
                IF NOT tmpInv.GET(recItem."Inventory Posting Group",'',0) THEN BEGIN
                  // create primary key with "Inventory Posting Group"
                  CLEAR(tmpInv);
                  tmpInv."Journal Template Name" := recItem."Inventory Posting Group";
                  tmpInv."Journal Batch Name" := '';
                  tmpInv."Line No." := 0;
                  tmpInv.INSERT(FALSE);
                END;
                tmpInv.Quantity += recSalesInvoiceLine."Quantity (Base)";
                tmpInv.MODIFY(FALSE);
              END;
            UNTIL recSalesInvoiceLine.NEXT = 0;
        END;
    
        BEGIN
        END.
      }
    }
    



    PS "General Failure" is the writers name of Bill Gates and you can gues why he is reading your disk... :twisted:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.