Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Letting the end user specify the starting invoice number.

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

    Letting the end user specify the starting invoice number.

    I am finishing up a new version of one of my apps and I want to give the user the ability to specify the starting invoice number.

    In the table I have a field "Invoice_ID" that is C,16,0 setup as Auto Increment and used for the primary index. No one really ever sees this number and it is only used within the database for index purposes and to tie everything together.

    I Also have a field "Invoice_Number" in the table and is the one that they see and prints out on reports. It is also currently C,16,0 Auto Increment and I have the starting value set at "1001". I can change the field type or settings if needed as long as I do it before deployment of the app. I want the end user to be able to specify the starting number so if they want to start the invoice numbering at 20000 they can.

    I was thinking I could setup a field in a "Settings" table where they could input the number they wished the next invoice to start counting from but my brain is going blank on the best way to get the number to auto increase up from there.

    One of the main reasons for wanting to do this is I have several hundred customers of my app that want the new version and do not want to start the invoice numbering back with invoice numbers they have already used. The new app is so different from the other one that I cannot just put it out there as an upgrade but will be another stand alone app instead.

    Any advice or suggestions would be appreciated.

    Thanks in advance,
    Preston.

    #2
    Re: Letting the end user specify the starting invoice number.

    For a field ID in a table atest, the following sets the default starting value to "9009".

    tbl = table.open("atest")
    rul = tbl.rules_get()
    rul.change_begin()
    rul.ID.Default.Default = "9009"
    rul.change_end()
    tbl.close()
    There can be only one.

    Comment


      #3
      Re: Letting the end user specify the starting invoice number.

      It is also currently C,16,0 Auto Increment and I have the starting value set at "1001".
      If I am not mistaken, "1001" increments to "9999" and then "0000", regardless of the field size.
      There can be only one.

      Comment


        #4
        Re: Letting the end user specify the starting invoice number.

        Originally posted by Stan Mathews View Post
        For a field ID in a table atest, the following sets the default starting value to "9009".

        tbl = table.open("atest")
        rul = tbl.rules_get()
        rul.change_begin()
        rul.ID.Default.Default = "9009"
        rul.change_end()
        tbl.close()
        That changes the starting value but if it has already started the count once the invoice form is first opened it has no affect on any future increments. This means the end user would have to specify the starting rul.ID.Default.Default before they ever opened the invoice form for the first time.

        Comment


          #5
          Re: Letting the end user specify the starting invoice number.

          Originally posted by Stan Mathews View Post
          If I am not mistaken, "1001" increments to "9999" and then "0000", regardless of the field size.
          Actually it goes to '9999000000000000' then '9999000000000001' (just tried it) so that is something I will also need to fix. I may be better off setting is as N,16,0 and then trying to figure out how to let them specify a starting number or jumping to a new higher number to use. Just need to also make sure the numbers stay unique.

          Comment


            #6
            Re: Letting the end user specify the starting invoice number.

            If you do numeric and the people don't see it, the start number does not matter and it is autoincrement which unique also not necessary.

            The Invoice number is different since they see it. If it is numeric, they will just see it go up 1(if it is ai) and you or they(using stan's method) can specify a start point.

            I have had a lot of clients tell me they wanted some wierd invoice number system, but I gave them a number and they wound up very hapy with it.

            on the first one pad the number left to the end if you do character. as "0000000000001001" It just might work better.
            Dave Mason
            [email protected]
            Skype is dave.mason46

            Comment


              #7
              Re: Letting the end user specify the starting invoice number.

              Originally posted by DaveM View Post
              If you do numeric and the people don't see it, the start number does not matter and it is autoincrement which unique also not necessary.

              The Invoice number is different since they see it. If it is numeric, they will just see it go up 1(if it is ai) and you or they(using stan's method) can specify a start point.

              I have had a lot of clients tell me they wanted some wierd invoice number system, but I gave them a number and they wound up very hapy with it.
              Dave,

              I have a "Invoice_ID" which the user never sees and does not care anything about. But the "Invoice_Number", they do see and do care about. I do not personally want to custom code a invoice number starting point for nearly 200 users of my application so I need to find a way that they can go into say a Settings table and specify what the next invoice number will be and then the application will AI from there.

              I may look at just writing a script, have the form OnInit look at the value in the settings table, add 1 to it and write that number to the Invoice_Number Field. Then run a script OnSave that writes that new number to the settings table. If my thoughts are right and I allow them to open a small window to edit that number in the settings table then it may just work. Then again, my luck it will all blow up.

              Comment


                #8
                Re: Letting the end user specify the starting invoice number.

                I do similar by getting the max in the table and suggesting by ui_msg box the next numeber accordingly. Up to them what they do at that point. I think stan had it right for the first number/character. message box to ask for the first one??
                Dave Mason
                [email protected]
                Skype is dave.mason46

                Comment


                  #9
                  Re: Letting the end user specify the starting invoice number.

                  hello

                  the auto increment field need not be used at all for the invoice number. that field is set for your table designs, set designs and to get the proper record.
                  i think the better way to handle the invoice number to start some random number
                  have a separate table say the company table that has all the control data
                  like
                  sales_tax_rate1
                  sales_tax_rate2
                  date_last_close
                  date_last_period_close
                  date_last_year_close and so on and on
                  and the
                  invoice_number.
                  then get the invoice number from the user to populate this table as the other fields.
                  then at the end entering the record one can lookup that invoice number and assign to the record to field called invoice_number which is not the auto increment field. and increase the invoice number in the control data.
                  i think this better than attacking the auto increment field.
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                    #10
                    Re: Letting the end user specify the starting invoice number.

                    Well I think I am on the right track.

                    I got something to work the way I want it to. Still need to do some cleanup before implementing it in my app and I still need to track down why I have to click the save twice to get the save button to clear. And yes I have tried topparent.commit

                    But, it works....

                    I will add it to where they can set a password in order to be able to set the next invoice number in the settings table. That way only the boss can set that and employees cannot mesh with it.
                    Attached Files

                    Comment


                      #11
                      Re: Letting the end user specify the starting invoice number.

                      I have to allow users to combine Alpha and Numerics in an invoice number.
                      All digits increment when their turn comes. A little dialog allows the user to re-set the starting number. Each new client wants to continue from their past system's last number.
                      Needs a table called SETSEQUENCE with at least a field with the last number used (linvnum).

                      Before beginning the postings for next invoice
                      Code:
                      tc=table.open("setsequence",FILE_RW_shared)
                      invnxt=increment_value(tc.linvnum)
                      newinvno = invnxt
                      [COLOR="#A9A9A9"]tc.change_begin()
                      'tc.linvnum= NEWINVNO 'after
                      tc.lockby=var->u_nam
                      tc.locknum=invnxt ' This must release to invoice next
                      tc.locktime=now()
                      tc.lockfor="Inv"
                      tc.change_end()[/COLOR]
                      tc.close()
                      And then after invoice succeeds.

                      Code:
                      ttc=table.open("setsequence",66)	'FILE_RW_shared)
                      ttC.fetch_first()
                      ttc.change_begin()
                      ttc.linvnum= NEWINVNO
                      [COLOR="#A9A9A9"]ttc.locknum="" ' This must release to invoice next
                      ttc.lockfor="Completed"
                      [/COLOR]ttc.change_end()
                      ttc.close()
                      You don't need the greyed out code - notifies all users when an invoice is busy updating (No one has ever seen that appear because the update is so quick) but when a failure occcurs, all users are prevented from proceeding to post invoices until a rollback or clear is performed. 100% integrity
                      Last edited by Ray in Capetown; 07-02-2013, 07:11 AM.

                      Comment

                      Working...
                      X