Cycle Count Report based on 1st business day of Month

gadzilla1gadzilla1 Member Posts: 316
Hello,
I have a report request to display items (from the item table) to be counted during the 1st 20 business days of every month. This is somewhat difficult to explain but I'll do my best.


Each of our items has a category: A1 through A20, B1 through B40 and C1 through C60. I've put this data in a table with Item No. (table related) and the Item Category.

On the first business day of the first month, items with A1, B1, and C1 should be printed in the report to be counted (the second business day A2, B2, C2 print, and so on until the 20th business day when A20, B20, C20 print).

Here's where it gets tricky: On the first business day of the second month, items with A1, B21, and C21 should be printed in the report to be counted (the second business day A2, B22, C22 print, and so on until the 20th business day when A20, B40, C40 print).

On the first business day of the third month, items with A1, B1, and C41 should be printed in the report to be counted (the second business day A2, B2, C42 print, and so on until the 20th business day when A20, B20, C60 print).

I've developed a report that works, but I have to enter too much date information on the request form...can anyone think of a formula, or any additional table, or date field that could further automate this report? It's a tough one, I know, and difficult to explain. I guess an option would be to enter in the date to print in a field in the table described, but that seems like too much maintenance. Thanks for any ideas!

Comments

  • sergisoftsergisoft Member Posts: 37
    I did not test it but may it work OK:

    Parameters:
    p_intDay --> Integer
    p_intMonth --> Integer
    p_codItemType --> Code 1

    Return:
    Text 3
    intRule := 0;
    
    CASE p_codItemType OF
    
      A: BEGIN
        intRule := 1;
      END;
    
      B: BEGIN
        IF p_intMonth=1 THEN
          intRule := 1
        ELSE
          intRule := 2;
      END;
    
      C: BEGIN
        IF p_intMonth=3 THEN
          intRule := 2
        ELSE
          intRule := 1;
      END;
    
    END;
    
    IF intRule=0 THEN
      ERROR('Invalid Rule')
    ELSE BEGIN
      CASE intRule OF
        1: EXIT(p_codItemType + FORMAT(p_intDay));
        2: EXIT(p_codItemType + FORMAT(20*(p_intMonth-1) + p_intDay);
      END;
    END;
    
    

    If you need I'll save an Excel about how I get it:

    Sergi Navarro

    MCTS: Microsoft Dynamics™ NAV 2009 C/SIDE Solution Development

    Visit my Navision Spanish Blog here: http://www.sergisoft.com
  • gadzilla1gadzilla1 Member Posts: 316
    Hi,

    Thank you very much, I'll try this now and report back.

    Have a nice day. Chris
Sign In or Register to comment.