Counting/stock take app.

Discussion in 'iOS Programming' started by ethan-1878, Sep 20, 2015.

  1. ethan-1878 macrumors member

    Joined:
    Jun 8, 2014
    #1
    Hi all,

    I'm wanting to make a simple iOS app for work wherein employees get given an iPad mini and then each time they sell an item, they use the app to keep track of what they've sold. I'm using the Single-View application mode in Xcode 7, then using buttons with a modal link to each separate story board, here's an example.

    If an employee sells a t-shirt, this would be the process:

    1) Press 'T-Shirt' button (modal link to the Design name story board)
    2) Press 'Design Name' (modal link to Size story board)
    3) Select the Size

    It is at this point I want to tell Xcode to +1 to the total of that size t-shirt to the days running total, but I'm not sure what the best way to hold that data would be. Does anybody have any suggestions?

    I'm relatively new to Xcode but I've done bits of light coding in the past. I'm not exactly fluent in any coding languages which I why I'm using the GUI in Xcode as apposed to just writing out the relevant strings of code. Any help would be appreciated!

    Thanks in advance to anyone who has spared some of there time to read this!
     
  2. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #2
    How many employees do you have? Would they be using their Minis simultaneously? Will they have a network connection where sales are made?

    ...

    B
     
  3. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #3
    Hi balamw,

    No, there will only be initially one iPad under the counter until its needed and it will only ever be single user (as in, no need for each separate employee to log in to their own account). In the future we might get some extra mini's but i wouldn't have a problem spending 10 minutes correlating the 2-3 separate sets of data. There will be a network connection available but I'd rather not use it if its avoidable.

    Ethan.
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    You probably want more than a simple counter. I would think you'd like a timestamp and the name of the salesperson, along with the product and size.

    There are several common ways of persisting data on iOS: Plain text file, plist file, core data store or sqlite database file. The first two are simple to implement, the last two require more programming knowledge.

    You might want to be able to email reports as one way of exporting the data. The app could also generate plain text reports that could be taken off the device with iTunes file sharing.
     
  5. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #5
    Hi PhoneyDeveloper,

    I don't need anything that sophisticated. Names and timestanps don't really matter, this is a very small scale implementation where information other than the specifics of the product wouldn't benefit me in any way. We currently have an Access database that we use for all of our accounts based work and I've tried using that as a method of keeping track of stock but it's not really what I want it to be. The best thing to export probably would be a table with design names down the left-most column and sizes across the top row but I suppose a plain text file would do the job just as well with a line for each product eg:

    'Design Name' - 'size': n

    Where n is the amount of said item that has been sold. It's literally only to allow us to make less frequent stick checks as we're currently having to do them bi-weekly and it's not at all efficient.
    Email implementation sounds good, maybe an 'export data' button that just attaches the report (whether it be .txt or otherwise) to an email which can be sent to a computer.

    Thanks for your input! Let me know if you have any ideas where I could go with this on the technical side.

    Ethan.
     
  6. Punkjumper macrumors member

    Joined:
    Jan 12, 2013
    #6
    A plist saved to disk would most like be the simplest way to go. Read up on how they work and I'm sure it will work for you. You can export a .csv file with the data from the plist. There is no simple export to csv built in function, you would need to write your own or there are 3rd party libraries that can help. Not beginner level stuff but not too hard.
     
  7. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #7
    Hi @Punkjumper

    Sorry for bouncing between threads but I think this is the better one for me to continue our discussion. Here's what I have so far:

    Screen Shot 2015-09-23 at 09.51.17.png

    When pressing the 'SOLD' button, the item selected above should have a 1 added next to its listing in the report. In the screenshot shown above, when the sold button is pressed +1 should be added onto the current amount of that item sold in the report. How could I implement this? I know how to tell Xcode to +1 to a running total but I don't know how to tell it to remember the above selection when doing so.

    Also, one thing thats really bugging my OCD is that no matter what I try the content won't centre on the page! Let me know what parts of code you want me to copy/paste (if any), I'll be more than happy to post it.

    Thanks for your help so far!
     
  8. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #8
    Im now getting a new error preventing my app from launching. I have tried reversing any modifications I have made with my code but its till now working.

    Here is a snipped of the part I'm having trouble with, and a screenshot of the error:

    Code:
       
    let pickerData = [
            ["Small", "Medium", "Large", "XL", "XXL"], ["Racists", "Istanbul","Born a Red", "We are Liverpool", "Jordan Henderson", "Nobody Gary Nev", "Simpsons Sterling", "Team List", "Kopite Behaviour", "Fowler", "Shanks/Paisley", "Black Walk On", "Kopfather", "Sons of Anfield", "Skrtel", "Coutinho", "Success Fathers", "Official Black", "Official Red", " ", "Red Liverbird", "Grey Liverbird", "Black Born a Red", "We Are Liverpool"]
            ]
    
    Screen Shot 2015-09-23 at 10.31.04.png Screen Shot 2015-09-23 at 10.31.17.png
     
  9. VPrime macrumors 68000

    VPrime

    Joined:
    Dec 19, 2008
    Location:
    London Ontario
    #9
    Couldn't this be done in excell fairly simply? I know you can create simple interfaces so your not entering data manually in a spreadsheet.. Any reason why this has to be a standalone app?
     
  10. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #10
    It's intended for use on a market stall where typing into a spreadsheet would take too long, having the ability to quickly select the item and press one butting to make a log is a lot more practical in this situation. The current method is to count stock before and after each day, this data in then put into a spreadsheet so we have a more organised way of correlating the data but for the time it takes to manually count everything twice for every day we are out selling then putting that data into a spreadsheet everybody has agreed a in-house app would be easiest/best/more efficient going forward.

    The excel part comes into the exporting of data, which looks like its going to be in a .CSV file instead of a .xls(x) - if i can figure out how to do that part ;)
     
  11. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #11
    Do you see the part where it says 'breakpoint?' Your code is stopped at a breakpoint.
    Since you're going to have long names for the products I would make the right side of the picker wider and the left side narrower. Use S, M, L, XL for the sizes.

    Your app needs a data model. This is where your counts are stored. One simple way would be to have a dictionary where the keys are 'product name-size' and the values are NSNumbers. Create a data model class. Add a incrementProductCount(name: String, size: String) method.

    You should consider what happens if a mistake is made where the person clicks the Add button and then realizes they used the wrong size or product name.
     
  12. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #12
    Hi @PhoneyDeveloper

    Do you have any idea why there is a breakpoint? I genuinely don't have a clue why it's happening so really don't know what to do about it.

    In regards to the data model, what would be the best way to export the data from the dictionary after each day? then what would be the best way to reset the counters to 0? My original idea was just to have a 'reset' button on a separate page of the app to reset, or to just tell it to reset when it's successfully exported the data.
     
  13. Dookieman macrumors 6502

    Joined:
    Oct 12, 2009
    #13
    A break point isn't an error, it's something programmers use to help with debugging. Did you by chance accidentally click the small grey area between the class viewing area and the area where you write code? A small blue arrow will pop up in that region and will cause the app to "pause", not crash (though it will look like it crashed since it will stop responding), so you can look at what the internals of the app are doing. Those breakpoints can be quite easily set when you are trying to look at an inline error or warning. I find their placement very annoying.

    Anyway, when you say "export data", what do you envision that being? A hard copy printed off? Saving a file with the days sales on the device?
     
  14. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #14
    Thanks, I'll have a look for that and see if I get it to respond first time again.

    A hard copy printed off would be useful but we don't have any AirPrint enabled printers so to keep things simple (hopefully) some sort of table or even just a list eg:

    Jordan Henderson - Small: 3
    Team List - Large: 1
    Official Red - Medium: 5

    Would be fine, if I could add in a share sheet so that I could emails myself the report it would solve the printing issue should I ever need to print a copy for whatever reason.
    So, preferably a table (sizes along the top row) but a simple .txt list would be just as useful.

    Thanks for all of your help so far by the way, I would probably have given up without it!

    Ethan.
     
  15. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #15
    I can see the tip of the blue breakpoint marker on the line that is the end of your array. Click and drag the breakpoint away from where it is and let the mouse go. The breakpoint should disappear in a puff of smoke.

    Regarding sending email look up MFMailComposeViewController. You should be able to find numerous tutorials online. Like:

    http://www.appcoda.com/ios-programming-101-send-email-iphone-app/
    http://www.raywenderlich.com/1980/e...and-export-app-data-via-email-in-your-ios-app

    You will need to create a single string that holds all your data and then send that as the message body. You could also send it as a text attachment. You could also format an html table with your data and send that as the message body but that might be for your version 2.
     
  16. Dookieman, Sep 24, 2015
    Last edited: Sep 25, 2015

    Dookieman macrumors 6502

    Joined:
    Oct 12, 2009
    #16
    That was going to be my simple suggestion on how to export the data.

    If you want something you can track online. Look into parse or firebase. They allow easy to use/create databases. You can export their data in JSON format, a very common and useful format for online data.

    These require a bit more experience, not much more difficult, just need to be familiar with 3rd party frameworks.
     
  17. ethan-1878 thread starter macrumors member

    Joined:
    Jun 8, 2014
    #17
    @PhoneyDeveloper , @Dookieman

    Thanks for your help! I'll get back to work on it and see how far I get.

    Couldn't thank you (and the forum) enough fro the help you have all offered me!


    Ethan.
     

Share This Page