AnsweredAssumed Answered

Setting Date ranges

Question asked by Kirk_1 on Nov 5, 2012
Latest reply on Nov 8, 2012 by philmodjunk

Title

Setting Date ranges

Post

     Im doing a script to create an aged AR report. Im trying to set a date rage... that if the posted date is equal to that it will set the invoice amount into that field.

     The result of this script is that the  less than 20 day = to total AR and the greater than 121 has 90% of the invoice total.

     How can i script it to get the results i need?

      

         
  •           Go to Layout [ “Aged AR” (Invoice) ]
  •      
  •           Enter Find Mode [ ]
  •      
  •           Set Field [ Invoice::IN_Unpaid; "1" ]
  •      
  •           Set Field [ Invoice::INPosted; "yes" ]
  •      
  •           Perform Find [ ]
  •      
  •           Sort Records [ Specified Sort Order: Invoice::INCustomerName; ascending Invoice::IN__PKFlgsiProNumber; ascending ] [ Restore; No dialog ]
  •      
  •           Go to Record/Request/Page [ First ]
  •      
  •           Loop
  •      
  •           // If [ Let ( [ ~num = GetAsDate ( Invoice::INPostedDate ) ] ; ~num ≤ 20 ) ]
  •      
  •           If [ Let ( [ ~num = GetAsDate ( Invoice::INPostedDate ) ] ; ~num ≥ GetAsDate ( Invoice::INPostedDate ) and ~num ≤ GetAsDate ( Invoice::INPostedDate )+ 20 ) ]
  •      
  •           Set Field [ Invoice::INAged020days; Invoice::INRemaining ]
  •      
  •           End If
  •      
  •           If [ Let ( [ ~num = GetAsDate ( Invoice::INPostedDate ) ] ; ~num ≥ GetAsDate ( Invoice::INPostedDate ) +21 and ~num ≤ GetAsDate ( Invoice::INPostedDate )+ 32 ) ]
  •      
  •           Set Field [ Invoice::INAged2132days; Invoice::INRemaining ]
  •      
  •           End If
  •      
  •           If [ Let ( [ ~num = GetAsDate ( Invoice::INPostedDate ) ] ; ~num ≥ GetAsDate ( Invoice::INPostedDate ) +33 and ~num ≤ GetAsDate ( Invoice::INPostedDate )+ 59 ) ]
  •      
  •           Set Field [ Invoice::INAged3359days; Invoice::INRemaining ]
  •      
  •           End If
  •      
  •           If [ Let ( [ ~num = GetAsDate ( Invoice::INPostedDate ) ] ; ~num ≥ GetAsDate ( Invoice::INPostedDate ) +60 and ~num ≤ GetAsDate ( Invoice::INPostedDate )+ 90 ) ]
  •      
  •           Set Field [ Invoice::INAged6090days; Invoice::INRemaining ]
  •      
  •           End If
  •      
  •           If [ Let ( [ ~num = GetAsDate ( Invoice::INPostedDate ) ] ; ~num ≥ GetAsDate ( Invoice::INPostedDate ) + 91 and ~num ≤ GetAsDate ( Invoice::INPostedDate )+ 120 ) ]
  •      
  •           Set Field [ Invoice::INAged91120days; Invoice::INRemaining ]
  •      
  •           End If
  •      
  •           If [ Let ( [ ~num = GetAsDate ( Invoice::INPostedDate ) ] ; ~num ≥ GetAsDate ( Invoice::INPostedDate ) +121 ) ]
  •      
  •           Set Field [ Invoice::INAged121days; Invoice::INRemaining ]
  •      
  •           End If
  •      
  •           Go to Record/Request/Page [ Next; Exit after last ]
  •      
  •           End Loop

Outcomes