Results 1 to 15 of 15

Thread: pos for windows

  1. #1

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Resolved pos for windows

    1111
    Last edited by bob5731; Jan 7th, 2005 at 01:23 AM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    that code looks messed up. Don't you realize that everytime you press a key, the keypress event will fire? What are you trying to do? Also, use VB code tags. Here's how it looks:

    Code:
    Dim IGap As Integer
    Dim QGap As Integer
    Dim AGap As Integer
    Dim EGap As Integer
    Private Type stocktable
    descript As String * 24
    PRICE As String * 7

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    You don't have to PM me to get me to read the thread.
    You should zip up the project, and the files that it is supposed to be reading, and then maybe we could make some sense of it.

    What does it do? What do you want the subtotal of? It looks like the instances of rec.Price are used incorrectly or commented out.

    If this program ran at all, it would run 100's of times slower than it should. It is so poorly designed that it isn't worth fixing, if you ask me.

  4. #4
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236
    The code might look better if you use the vb code tags.
    [ vbcode ]
    your code
    [ /vbcode ]

    With no spaces inside [ ]
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Your table appears to be Binary. Try to open it with notepad to see what I mean. The program doesn't read binary files.
    Can you get it to do anything? I can't. Maybe if you could get it to a running state, the we could help get subtotals. I don't think that it will ever work right, as its poorly written.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    If your problem has been solved the dont forget to edit your original
    post and add the green checkmark as the subject icon or add
    Resolved to the post's subject.


    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    then your .tbl file was corrupt. I looked at it in Notepad, after stepping through. None of the fields had values, unless it was an unsupported (Non-English) character set.
    If you want to try and post it again, I'll take another look.
    Do you realize that it is supposed to read 13001 fields here?

    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    Dim rec As stocktable
    Open "c:\pos\bob.tbl" For Random As #1 Len = 120
    For X% = 2 To 13001
    Get #1, X%, rec
    If RTrim$(LTrim$(rec.STOCKNUMBER)) = RTrim$(LTrim$(Text1.Text)) Then
    'Label14 = ""
    'InputBox "subtotal", subtotal
    Text2.Text = rec.PRICE
    Text4.Text = rec.descript
    'InputBox "subtotal", rec.price
    'subtotal = subtotal + rec.PRICE
    'Label14 = subtotal
    'Print #2, Text2.Text
    and that it happens in a keypress routine?

    also, why is everything commented out?

    To get a sub-total, you have do determine which field you want to use to compute the total, then declare a field (curSubTotal as Currency), and set it to 0 first off, then add to it (curSubTotal = curSubTotal + ???) where ??? is your field.

    What do you want the subtotal of? All of the records, or everything for that item, or something else?

    When you start the program, what is the first step? (Load File?) or Enter Data somewhere?

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    I am trying to fill the list, and when I type the second letter of the description, it adds to the list. I couldn't get any items by number, so I don't know if you want to keep track of the prices that you enter before they get added, and then compute tax and subtotal, or want to loop through the listbox to subtotal the items.

    You need to check for CHR(13) Enter in the keypress routine, and then move the data.

    Code:
    Private Sub flx_KeyPress(KeyAscii As Integer)
      If KeyAscii <> 13 Then ' Not Enter
        If KeyAscii = 27 Then ' IS Escape
            txtInput.Visible = False
            Exit Sub
        End If
        If KeyAscii = 8 Then ' IS BackSpace
          tl = Len(txtInput.Text)
          If Len(tl) > 0 Then
             txtInput.Text = Left(txtInput.Text, tl - 1)
             Exit Sub
          End If
        End If
     Else
         flx.TextMatrix(flx.Row, flx.Col)  =  txtInput.Text
         txtInput.Visible = False
     endif
    End Sub
    I only add them when the user hits ENTER.

    You don't have a tax rate anywhere, but if it's 5%, just multiply the total by .05 to get the tax, or 1.05 to get the total including the tax. (I compute the tax and then add it to the subtotal to get the total.)

    Here is some of my calculation code. I'm making Panels.

    Code:
      txtTotal(4).Text = Format(PanelSubTotal, "$ ##,###.00")
      PanelTax = PanelSubTotal * TaxRate
      txtTotal(5).Text = Format(PanelTax, "$ ##,###.00")
      PanelTotal = PanelSubTotal + PanelTax
      txtTotal(6).Text = Format(PanelTotal, "$ ##,###.00")
      PanelQuantity = Val(txtTotal(7).Text)
      If PanelQuantity <> 0 Then
        txtTotal(8).Text = Format(PanelTotal * PanelQuantity, "$ ##,###.00")
      Else
        txtTotal(8).Text = " Estimate Only   "
        PanelQuantity = 0
      End If
    Last edited by dglienna; Nov 23rd, 2004 at 12:02 AM.

  9. #9
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    that was code from my app. I didn't change yours. feel free to copy it and modify it for your use.

    I was using a textbox that floated OVER the cell. The user types in it, and when he presses Enter, the value is transferred to the flexgrid.

    Then, I have a control array of textboxes to keep the totals information.

    I still have to transfer the info to one more place (or maybe two - for a summary sheet ) before my app is done. It was 35 pages last month.

    I also have option buttons for choices (like taxable, and if the panel is to be assembled)
    Last edited by dglienna; Nov 23rd, 2004 at 01:25 AM.

  10. #10
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    what is the name of the field that you want totalled?
    where is it entered, or read?
    when do you want the subtotal?
    I've already showed you the code that I used to actually do the subtotal and add the tax which gives the total.

    ps. just reply back to the thread, and I will see it. no need to email or PM. I won't do the work FOR you, and nobody else will, either. we'll all help you get it working, though.

    I don't understand how you managed to get it working. I can't look up any part numbers that exist in the table, but can enter prices and quantities of item that i make up. I don't think that this is what you want/need, though.

    tell me which buttons you press, and what you enter (and in what textbox) to get the item to subtotal.

    ps - have you read anything that I've posted about the errors?
    ---- what do you want to do about them?

  11. #11
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Code:
    Private Sub Text4_KeyPress(KeyAscii As Integer)
      If KeyAscii <> 13 Then
        If KeyAscii t= 8 Then ' IS BackSpace
          tl = Len(rec.PRICE)
          If Len(tl) > 0 Then
              Text4.text = Left(Text4.text, tl - 1)
          End If
        End If
      Else
        Dim rec As stocktable
        Dim STOCKNUMBER As String
        Dim a#(60, 4)
        Open "c:\pos\bob.tbl" For Random As #1 Len = 120
        For X% = 2 To 13001
        Get #1, X%, rec
          ' If rec.???? = Text4.text Then Exit For
          ' You must use the name of the variable here
        Next X%
       Close #1
      End If
    Exit Sub
    Here is how the logic should be if you want to read the file to get the part info. Change the IF statement, and then copy the values of .rec to the form.

    When you have something that works, post it here. I used your old project, and changed the location of the file. I could only enter one character into the textbox.

  12. #12
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    Each time you enter a quantity, calculate the total price before you put it up. also, add the total price to the subtotal variable.
    when you press the subtotal button, display the value.

    when you hit the total button, add the tax to the subtotal to get the total, also.

    I got you program to work without generating an error.

    It is very confusing, and that's probably why nobody else wanted to get involved.

    If you have more problems, then post the project again, because I am deleting it.

  13. #13
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    create a subtotal field, and use it.
    then, print it when you press subtotal. set a flag afterwards.
    when you hit total, if you didn't press subtotal, calculate it anyways.

    if you used currency data types, then divided everything by 100, you could get things to be formatted.

    Code:
    format(text1.text."$ ##0.##")

  14. #14
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    don't you read what I post? forget about the code that I posted. to format, just change the string to what you want.

    "####" is for an Integer. Use "$#,###.00" for currency.

    you need to print a subtotal line, a tax line, and a total line.

    post another version of the project, and I'll look at it again.

  15. #15
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    I made some changes, for subtotal, tax, and total. i didn't change anything else, though. you'll still want to change things, but I hope that I have gotten you started in the right direction.

Posting Permissions

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



Click Here to Expand Forum to Full Width