Android Question Capture Image - receipt - Document

Harris

Expert
Licensed User
Longtime User
Essentially, take a picture of your receipt and save this as (an image, OCR, or any other suggestion).
These device images (or documents) will be uploaded to a server to be stored as an on-going accumulation of expenses for a specific piece of equipment.

Any suggestions to make this work in a practical sense?

Thanks
 

udg

Expert
Licensed User
Longtime User
I did exactly what you describe months ago.
In my case the back-end was from a difefrent programemr working in PHP so data from locald evice tos erver ere transmitetd as JSON.
Fundamentally, local device recorded images localy along some info data, then on user command (i.e. when a connection is available and he/she is ready/willing to transimit) selected data were uploaded to the server. A second program (PHP) let a manager work on documents for approval and any other operations needed.

If you find it useful I could share some code with you. Unfortunately I'll be away from my PC for a few days (hope to recover on late afternoon of next Monday).

udg
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Thanks udg,

I would be interested in the device code. This should prove valuable.

I would not be using php on the server side, but rather jRDC to handle the sql record and http to send the recorded (zipped) images.

For example, the following sub takes a zipped file (could be images / pictures, pdfs, or a collection of text files and a helper on the server unzips the package and places the files in the specified directory. The JobDone handles clean up on the device (removes temp zips and other source files - when successful).

Thanks

Mike Whetmore


B4X:
Sub SendtoSever(dir As String, pk As String, FileName As String, pt As String)  'pt identifies what the package contains for server handling
    If File.Exists(dir,FileName) Then
      ' continue
    Else
        ToastMessageShow(" Sorry - Zip Not Found: "&FileName, False)
        Log(" Sorry - Zip Not Found: "&FileName)
        Return     
    End If

        Dim j As HttpJob
        Dim out As OutputStream
        out.InitializeToBytesArray(0)
        Dim In As InputStream = File.OpenInput(dir, FileName)
'        Log(" send to server file: "&FileName)
        File.Copy2(In, out)
        
        Dim lastSlash As Int = FileName.LastIndexOf("/")
        If lastSlash > -1 Then
            FileName = FileName.SubString(lastSlash + 1)
        End If
        Dim su As StringUtils
        Dim j As HttpJob
        j.Initialize("file", Me)
        If pk = 1 Then  'campics
            j.PostBytes( Main.srvlinkcam & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8")&"&pk="&pk&"&where="&pt,     out.ToBytesArray)
        End If

        If pk = 2 Then  ' inspect pdfs
            j.PostBytes( Main.srvlinkins & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8")&"&pk="&pk&"&where="&pt,     out.ToBytesArray)
        End If

        If pk = 3 Then ' ecmdata files zips
            j.PostBytes( Main.srvlinkecm & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8")&"&pk="&pk&"&where="&pt,     out.ToBytesArray)
       '     ToastMessageShow("Sending Zip File to Server: "&FileName,False)
        End If
            
End Sub
 
Upvote 0

AHilton

Active Member
Licensed User
Longtime User
I did something similar to this a few years ago for a client that serves the (trucking) transportation industry. The essence of it is that the truck drivers needed to send in to the company any paper receipts (fuel purchases, tickets, drop-off receipts, repairs bills, citations, accident/incident photos and reports, etc.). It used to be that those were stored in a trip packet by the drivers and then handed-in to the office once they got back to the company headquarters. Very slow, of course. And the company couldn't invoice their customers until that happened.

So, our prototype solution was to use B4A / B4I to capture those paper images and other information (gps, notes, datetime, etc.) and send that back to a B4J server that then stores it in an SQL DB with the images as files for the webserver to access.

The B4J server does various other things like doing OCR on the images, storing the OCR'd text in other tables, reporting back to the B4A/B4I clients, serving the web requests from office management on those 'electronic trip packets', automatically invoicing (by email) some of those trips and just generally being a business layer for the whole thing.

Previously, the company couldn't invoice customers, typically, for about a week (sometimes 2 weeks) after a trip was done because the drivers might not make it back to the home office directly. Now, they can invoice within minutes of the completed trip. AND, there's a paper-trail with proof that their customers can access if there's any questions … served by that B4J webserver, of course.

We've had inquiries from other clients about a similar solution but for relaying back to management offices the images of purchased/to-be-purchased railroad equipment, documents and related meta-data. Sure makes these types of operations quick when you have to have decision-makers in multiple places and timezones.

Unfortunately, I can't share any code because it's a commercial product sold to our clients.

As far as "... make this work in a practical sense?", there's lots of practical / non-practical things about it. Send me a PM if you'd like to discuss it.
 
Upvote 0
Top