Announcement

Collapse
No announcement yet.

Running Number

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

  • Running Number

    I am developing a master detail Invoice. Does anyone know how I can insert a running number on the DETAIL section of the invoice when I add a new item?

    Example:
    Say I am working on invoice# 10001
    I already generated the Inv#10001 in the master (header) of the invoice.
    I then add the ADDNEW record on the detail section of the invoice for salable items
    Upon ADDNEW, I need to have the column "ROW#" to display the row number for every line added. And when I delete a line, the entire details section of the ROW# will automatically RE-RUN and be replaced by the new sorting order....

    Thanks
    GT

  • #2
    There are events onafterupdate, onafterinsert and onafterdelete. Here you need to apply your php code to do what you want. After renumbering you need to reload the form to reflect the new numbering situations.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      OK.
      Just thought I should share what I have done.

      This is the piece of code I use to rearrange the "detail" section of the master detail app that I have created to make sure the ROW# is in running order
      -------------------------------------------------------------------------------------------------------------
      sc_lookup(dsM,"SELECT ID FROM SODetail WHERE SONumber = '".$SONumber."'");
      sc_lookup(ds,"SELECT Count(*) FROM SODetail WHERE SONumber = '".$SONumber."'");
      $y = {ds[0][0]};

      for ($i=0; $i<=$y-1; $i++)
      {
      sc_exec_sql("UPDATE SODetail SET Row =$i+1 WHERE (ID = ".{dsM[$i][0]}.")");
      }

      sc_redir("form_SODetail");

      Comment

      Working...
      X