Results 1 to 12 of 12
  1. #1
    Join Date
    Feb 2004
    Posts
    15

    Unanswered: auto Increment Invoice Number

    Right now I have the field set to autoenter with serial number in the field defination. I'd like to change this to where the next number and increment value is stored in a configs (MainMenu) database. So I can change the next number without going into 'GOD' mode every time the office staff needs to reset the number for the next month. ala the next number is 40032344 where 40 == 2004, 2014 would be 41, 03 is the month 01 - 12, 234 is the unit for the month, 4 is the office where it originated, 0 for testing.

    RIght now the serial number is 20032344 increment 10 for office 4

    I'd like to automate this. where mainmenu.fp5 has newrecord = 234 newrecordInc = 10

    then on New Record the field ourFileNumber in tracking.fp5 would get 40032344 and the increment newrecord to 235.

    I'm perplexed...
    Rob McKee

  2. #2
    Join Date
    Feb 2004
    Posts
    84

    Re: auto Increment Invoice Number

    Originally posted by crom
    Right now I have the field set to autoenter with serial number in the field defination. I'd like to change this to where the next number and increment value is stored in a configs (MainMenu) database. So I can change the next number without going into 'GOD' mode every time the office staff needs to reset the number for the next month. ala the next number is 40032344 where 40 == 2004, 2014 would be 41, 03 is the month 01 - 12, 234 is the unit for the month, 4 is the office where it originated, 0 for testing.

    RIght now the serial number is 20032344 increment 10 for office 4

    I'd like to automate this. where mainmenu.fp5 has newrecord = 234 newrecordInc = 10

    then on New Record the field ourFileNumber in tracking.fp5 would get 40032344 and the increment newrecord to 235.

    I'm perplexed...


    Okay....



    The way I would work with this issue is by working with the 'small' pieces and then put them together. If you calc all the 'small' pieces, then you can use a new calc to concantenate the pieces... Once you get it down you could consolidate to a single calc.

    Year Piece calc = Right (Status(CurrentDate),1)&Middle(Status(CurrentDate) ,Length(Status(CurrentDate)-2,1)

    Month digits = Right("0"&Month(Status(CurrentDate)),2)

    Serial piece = Right("00000) & Max(Current office Invoices::serial)+MainMenu::Increment,4)

    Office piece = Auto-enter from gOffice


    The only catch is that there needs to global field that has the 'current office' number input. This should be part of the startup startup, or if you require the user to log-in then this should be a lookup.

    There also needs to a realtionship called Current Office Invoices were the gOffice is the left key and 'Office piece' is the right key. This will allow each office to have there own set of serial numbers.

    If you wished the reset the serial number values every month then you would need to incoporate Year and Month with the Current Office Key.




    Hope this helps....



    Joe

  3. #3
    Join Date
    Feb 2004
    Posts
    15

    Wink

    That looks good... Thanks

    Question is how do I update the serial back into MainMenu:erial

    I haven't figured out how to run a script on a empty field without using a button for the user to press...
    Rob McKee

  4. #4
    Join Date
    Mar 2004
    Location
    Pittsburgh, PA
    Posts
    13
    You can do this with ScriptIt from Comm-Unity Networking Systems (http://www.cnsplug-ins.com) if you put the Script-It calculation into the field validation calculation for any field that is to be changed (such as, in joeking's example, "Office piece", the auto-enter from gOffice).

    J

    Originally posted by crom
    That looks good... Thanks

    Question is how do I update the serial back into MainMenu:erial

    I haven't figured out how to run a script on a empty field without using a button for the user to press...

  5. #5
    Join Date
    Feb 2004
    Posts
    15
    hmm I have troifile, fmexport, oEvents, and file toolbox. You think there is a function I can use in one of these?

    Maybe I avoid getting another plugin.
    Rob McKee

  6. #6
    Join Date
    Mar 2004
    Location
    Pittsburgh, PA
    Posts
    13

    don't think so

    I can't say that there is not such a function in any of those plugins, but i believe Scriptit is the only available plugin that can trigger scripts based on events. I'm happy to be wrong, though... if you can figure it out with those, please let me know!

    Alternatively, if you're interested in sample language to demonstrate this functionality in Scriptit, i can give you that.

    J

    Originally posted by crom
    hmm I have troifile, fmexport, oEvents, and file toolbox. You think there is a function I can use in one of these?

    Maybe I avoid getting another plugin.

  7. #7
    Join Date
    Feb 2004
    Posts
    15
    Eureka!

    In the script for new order, I do the month reset, and serial number increment. Works like a champ. And I don't need a new plug in. Thanks Guys!
    Rob McKee

  8. #8
    Join Date
    Feb 2004
    Posts
    84
    Originally posted by crom
    Eureka!

    In the script for new order, I do the month reset, and serial number increment. Works like a champ. And I don't need a new plug in. Thanks Guys!

    Good to see that you figured it out. I've been gone for a few days and I was surprised to see the plug-in advise. There are two factors that I think may have been missed.

    The first factor is that you don't need save the current serial in the main menu file. Each time a new number is created in the invoices file it uses the Max function and then adds '1' to that number. This would create an ever increasing serial number.

    To reset the Office part you would need to save the serial number ofr that office in a field. I orginal stated it should be a global, but that assumes that each office uses it's own solutiom, it they share the solution files then it would need to happen through a relationship. If you wanted to save the number in Main Menu instead of using the max function all you would need would be a script step to Set Field Main Menu:erial = Main Menu:erial + 1


    To handle the end of the month issue could be handled in a number of ways, but the easiest I have think of is to have another field called Current month in the Main menu file this should be a global or related to the Office, just like the current serail.

    In your 'new record' script all you would need to add the script steps before you created new records:

    if(Current Month not Month(Status(Current Date))
    Set field current serial = 0
    Set field current month= month(status(current date)
    end if




    thanks...




    Hope this helps.....


    Joe

  9. #9
    Join Date
    Feb 2004
    Posts
    15
    thats just about the same code I used for resetting the serial number
    I didn't use the max function since we have test orders in the 9999xxxx range... I check to make sure the number is unique before I store it to mainmenu.

    Boss still want to use log book, but I'm working on him since the web generated orders won't be in the log until we get 12 orders then the printer shoots out a new log sheet.

    Rob


    Originally posted by joeking

    if(Current Month not Month(Status(Current Date))
    Set field current serial = 0
    Set field current month= month(status(current date)
    end if

    thanks...

    Hope this helps.....

    Joe
    Rob McKee

  10. #10
    Join Date
    Feb 2004
    Posts
    84
    Originally posted by crom
    thats just about the same code I used for resetting the serial number
    I didn't use the max function since we have test orders in the 9999xxxx range... I check to make sure the number is unique before I store it to mainmenu.

    Boss still want to use log book, but I'm working on him since the web generated orders won't be in the log until we get 12 orders then the printer shoots out a new log sheet.

    Rob
    Why not work on him to log into the FileMaker solution to see the 'current log'. If he chooses to print it that's fine.

    Another solution is to find yourself an old dot matrix printer and use something like Troi Serial to print line by line.

    thanks,


    Joe

  11. #11
    Join Date
    Feb 2004
    Posts
    15
    I like the serial printer idea... I have boxen just sitting here which I could hook up a serial printer to loaded with green bar paper... Output a text file and have the printer box spit out a line.

    Rob


    [SIZE=1Why not work on him to log into the FileMaker solution to see the 'current log'. If he chooses to print it that's fine.

    Another solution is to find yourself an old dot matrix printer and use something like Troi Serial to print line by line.

    thanks,


    Joe [/SIZE]
    Rob McKee

  12. #12
    Join Date
    Feb 2004
    Posts
    84
    Originally posted by crom
    I like the serial printer idea... I have boxen just sitting here which I could hook up a serial printer to loaded with green bar paper... Output a text file and have the printer box spit out a line.

    Rob

    You don't even have to go to the trouble of creating a text file FileMaker can directly control the printer utilizing a plug-in or a WinBatch script.


    thanks,


    Joe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •