Announcement

Collapse
No announcement yet.

Grid report , how to select only due date raw before 30 -45 days from due date

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Grid report , how to select only due date raw before 30 -45 days from due date

    Hello

    I want to make a report for due dates records before 30 - 45 days from due date

    i want to select all records before 30 - 45 days from due date on first and 15 from each month

    which application type best for my report : Grid or Form ?

    i am thinking to do it like this :
    Code:
    $date_period = array(30, 45);
    $day = (int)date('j');
            if ($day < 15) {
                $starting_date = date('Y-m-01');
            } else {
                $starting_date = date('Y-m-15');
            }
    
    //then i will find different {due_date} and $starting_date
    
    '((DATEDIFF({due_date},\'' . $starting_date . '\') between ' . $date_period [0] . ' and ' . $date_period [1] . ' OR ' . '(DATEDIFF({due_date},\'' . $starting_date . '\') < ' . $date_period [0] . ' and DATEDIFF({due_date},\'' . $starting_date . '\')>-60)))');
    is that correct ? if not can you please help me ? also tell me where to put the code

    Thanks in advanced

  • #2
    hey walid:

    The best would be a grid, but looking at what you are trying to do my suggestion is... make it in a query instead of php code.

    for example
    PHP Code:
    select *
    from  invoices
    where DATEDIFF
    (invoice_due_date invoice_generation_date) >=30
    group by date 
    Remember that such query must be placed in the SQL section of your grid.

    Regards

    Comment


    • #3
      Originally posted by kafecadm View Post
      hey walid:

      The best would be a grid, but looking at what you are trying to do my suggestion is... make it in a query instead of php code.

      for example
      PHP Code:
      select *
      from  invoices
      where DATEDIFF
      (invoice_due_date invoice_generation_date) >=30
      group by date 
      Remember that such query must be placed in the SQL section of your grid.

      Regards
      HI Kafecadm
      Thank you for helping me, it worked with me .
      i will put code for others
      PHP Code:
      select 
      from  invoices 
      WHERE DATEDIFF
      (invoice_due_date ,  CURDATE()) <=30  AND  DATEDIFF(invoice_due_date ,  CURDATE()) >= -60
      ORDER BY invoice_due_date 

      Comment

      Working...
      X