Item <-> Item Ledger Entry

valkatamakevalkatamake Member Posts: 38
Hi I want to do report which shows me in specified period of time what item hasn't been sold but it is in inventory ...
Item - OnPreDataItem()
itemledger.RESET;
SETFILTER(Inventory,'>0');
date1:=CALCDATE(refdate,TODAY);
itemledger.SETRANGE("Posting Date",date1,TODAY);

Item - OnAfterGetRecord()
IF itemledger."Entry Type" = itemledger."Entry Type"::Sale THEN CurrReport.SKIP   ;

but they don't respond with each other

Comments

  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    Item - OnPreDataItem()
    itemledger.RESET;
    SETFILTER(Inventory,'>0');
    date1:=CALCDATE(refdate,TODAY);
    itemledger.SETRANGE("Posting Date",date1,TODAY);
    
    Item - OnAfterGetRecord()
    itemledger.SETRANGE("Item No.",Item."No.");  // here it is linked now
    itemledger.SETRANGE("Entry type",itemLedger."entry Type"::sale);
    if ItemLedger.findset then
    CurrReport.SKIP;
    
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • valkatamakevalkatamake Member Posts: 38
    2 setranges ? :shock:
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    edited 2008-07-15
    2 setranges ? :shock:

    first one is for linking and
    2nd one to filter all Item Ledger Entries of type : Sale
    if there is any sale entry type the report skips the iteration for the item


    This is what you wanted...?? Isn't it..?? :|
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    Item - OnPreDataItem() 
    SETFILTER(Inventory,'>0'); 
    date1:=CALCDATE(refdate,TODAY); 
    
    
    Item - OnAfterGetRecord()
    itemledger.RESET; 
    itemledger.SETRANGE("Posting Date",date1,TODAY);  
    itemledger.SETRANGE("Item No.",Item."No.");  // here it is linked now 
    itemledger.SETRANGE("Entry type",itemLedger."entry Type"::sale); 
    if ItemLedger.findset then 
    CurrReport.SKIP; 
    

    Try this, as in the previous one ItemLedger Record will not get reset for the iterations of Item DataItem
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • Revolution1210Revolution1210 Member Posts: 161
    You should be able to get what you want from existing reports I think, if not then with a few tweaks here and there.

    Inventory - Sales Statistics for example, you can run this with Include Items Not Sold ticked, and add a filter for Inventory > 0
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • valkatamakevalkatamake Member Posts: 38
    Yes but I have to do it myself i'm applying for job and have to know these things before i get started
Sign In or Register to comment.