Jump to content

GUI beginner attempt, cash register


Recommended Posts

Ok I will try, but seriously, is there some programming language which would be better for this? 

I googled a bit, got results about java, msql, etc etc...

Because at the end I will have to be able to do "fiscalisation", and I'm not sure if I can do it with autoit...

No idea how to explain it, but I will try....

So, law is that all bills must have unique code recieved from the national tax administration, in Ministry of finances...

It's basically 2 lines of a long code and it looks like this:

http://www.datalab.hr/index.php?id=5145

So, for any bill that is paid by cash, the program quickly connects to some website, probobly enters the bill price and tax, and returns the code back and you print the bill.

I probobly explained horribly, ask me please whatever is not clear.

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to post
Share on other sites
  • Replies 146
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

CroatianPig,   The "programming language" is not your problem.  This project is significantly bigger than "create a gui with some buttons" which is how the thread started. I am suggesting the fo

okay, now that WhiteSpace has begun, i dare to alter the script as well. . ;http://www.autoitscript.com/forum/topic/153239-gui-beginner-attempt-cash-register/#entry1102600 ;Post #6 ;D:\DOKUME~1\ADM

. hi there $i and $j are loop counts, the matrices are called "arrays", and the rest is math. arrays index a variable, you have one with the name aray[0], the next is array[1]  and so on. for eve

If I wanted a sql type database for server database, is it free? I am googling, it directs me to the Microsoft site, and I don't see it's free.

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to post
Share on other sites

SQLite would be what you're looking for.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

CroatianPig,

 Ok I will try, but seriously, is there some programming language which would be better for this?

 

The "programming language" is not your problem.  This project is significantly bigger than "create a gui with some buttons" which is how the thread started.

I am suggesting the following with your best interests at heart.  You are clearly a beginner at both AutoIT and programming / system development.

Three things are standing in your way:

  - lack of planning

  - lack of formal definition

  - impatience

You have shown some aptitude for picking up the language.  Now you need to slow down a bit and truly understand what each function / instruction / operator is doing.  Some of your questions suggest that you are reading the doc, but not understanding all of the implications (understandable for a new programmer).

Now that you have gotten your hands wet, take a step back and document what you really want to do.  Define the kinds of data that you will need, how the data will be stored, presented and used.  Following that, define your task at a very high level.  Then start breaking each "thing" that you want to do into

smaller and smaller pieces.  Each of these piece is what you will code from.  If you are familiar with programming flowcharts, use this to document your task. 

All that you want to do can be done with one driver gui, some subordinate gui's (product/customer/inventory definition for example) and an SQLite DB.  At this point I would recommend NOT using an *.INI file, the SQLite UDF makes SQLite as simple as using an INI file for data storage.

Final Comment...

I know this seems like a waste of time and you don't want to "throw away what you've done" or "change directions".  However, it will pay dividends later, especially slowing down and understanding what you are reading in the Help file and example scripts.

Good Luck,

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to post
Share on other sites

CroatianPig,

 

The "programming language" is not your problem.  This project is significantly bigger than "create a gui with some buttons" which is how the thread started.

I am suggesting the following with your best interests at heart.  You are clearly a beginner at both AutoIT and programming / system development.

Three things are standing in your way:

  - lack of planning

  - lack of formal definition

  - impatience

You have shown some aptitude for picking up the language.  Now you need to slow down a bit and truly understand what each function / instruction / operator is doing.  Some of your questions suggest that you are reading the doc, but not understanding all of the implications (understandable for a new programmer).

Now that you have gotten your hands wet, take a step back and document what you really want to do.  Define the kinds of data that you will need, how the data will be stored, presented and used.  Following that, define your task at a very high level.  Then start breaking each "thing" that you want to do into

smaller and smaller pieces.  Each of these piece is what you will code from.  If you are familiar with programming flowcharts, use this to document your task. 

All that you want to do can be done with one driver gui, some subordinate gui's (product/customer/inventory definition for example) and an SQLite DB.  At this point I would recommend NOT using an *.INI file, the SQLite UDF makes SQLite as simple as using an INI file for data storage.

Final Comment...

I know this seems like a waste of time and you don't want to "throw away what you've done" or "change directions".  However, it will pay dividends later, especially slowing down and understanding what you are reading in the Help file and example scripts.

Good Luck,

kylomas

 

I agree with everything, but it's not easy... Specially because I'm learning to programm only using the internet.

I asked many people who have some knowledge about programming about AutoIt, they haven't even heard of it.

So, I have to do it alone, no one can show me in real life what something does, and it would be much easier, but ok, I'm not complaning.

I know there is alot of work and learning, and I'm ready for that.

Someone advised me to download MySQL, instead of SQLite, as he said SQLite is very limited.

I'm watching tutorials, and some german forum site about AutoIt mixing with MySQL.

Alot of work..................

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to post
Share on other sites
  • 1 month later...
  • 2 years later...
On 4-8-2013 at 6:09 AM, kylomas said:

CroatianPig,

It is generally advisable to seperate data from code.  In your example adding or subtracting procucts would require code changes.  Changes to your gui are also unneccesarily diffucult as the placement of the buttons are dependent on the window size.

It is certainly possible to keep using buttons to represent products, and as you learn more about gui management you will find smarter ways to do this. 

However, I would like to offer you an alternative.  The following code is a completely different way to look at the task.  It isolates the data from the code by using a simple INI file (attached).  The code is barebones but illustrates the idea.

As you are learning, and learning well I might add, you will find that the possibilities for gui creation are limited only by your knowledge of gui management and creativity.  You are far enough along that a thorough reading of the all gui related sections of the Help file would benefit you.

Use the following code or not.  Just be aware that there are many possibilities.

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <array.au3>

#AutoIt3Wrapper_Add_Constants=n

local $inifile = @scriptdir & "\vacations.ini"

local $gui010   =   guicreate('Vacations Are Us',900,350)
                    guisetfont(12,400,-1,'Comic Sans MS')
local $aSize    =   wingetclientsize($gui010)
                    guictrlcreatelabel('Products',20,20,200,30)
                    guictrlsetfont(-1,14,800)
local $lst010   =   guictrlcreatelist('',20,50,200,150)
local $edt010   =   guictrlcreateedit('',230,50,660,200,BitOr($ws_hscroll,$es_readonly))
                    guictrlsetfont(-1,10,800,-1,'Courier New')
                    guictrlcreatelabel('Description',230,20,200,30)
                    guictrlsetfont(-1,14,800)
local $inp010   =   guictrlcreateinput('',110,220,20,30)
                    guictrlsetlimit(-1,1)
                    guictrlcreatelabel('Quantity:',20,220,85,30)
                    guictrlsetfont(-1,14,800)
local $btn010   =   guictrlcreatebutton('Book The Trip',10,$aSize[1]-80,$aSize[0]-20)
                    GUICtrlSetBkColor(-1,0x00ffff)
                    guictrlcreatelabel('Status',20,$aSize[1]-35,$aSize[0]-40,50)
local $warn     =   guictrlcreatelabel('',120,$aSize[1]-35,$aSize[0]-120,30,$ss_sunken)
                    GUICtrlSetColor(-1,0xaa0000)

                    ; product (trip) definitions are in an INI file.  Each product corresponds to one section.
                    ; The second array ($aDesc is to hold values from each section)

                    Local $aProducts = IniReadSectionNames($inifile), $aDesc[5][2]

                    for $1 = 1 to ubound($aProducts) - 1
                        guictrlsetdata($lst010,$aProducts[$1])
                    next

                    guisetstate()
                    guictrlsetstate($lst010,$gui_focus)

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
        case $lst010
            guictrlsetdata($edt010,'')
            $aDesc = inireadsection($inifile,guictrlread($lst010))
            for $1 = 2 to ubound($aDesc) - 1
                guictrlsetdata($edt010,stringformat('%-7s : %-900s',stringupper($aDesc[$1][0]),$aDesc[$1][1]) & @CRLF,1)
            next
        case $btn010
            guictrlsetdata($warn,'')
            if guictrlread($inp010) = '' or not StringIsDigit(guictrlread($inp010)) then
                guictrlsetstate($inp010,$gui_focus)
                guictrlsetdata($warn,'  Quantity Required...')
            endif

            ;
            ; this is where you would do your "bill of sale" routine
            ;

    EndSwitch
WEnd

vacations.txt

The uploader will not let me upload an INI file so I changed it to a txt file.  Just rename it and put it in whatever directory you run the script from.

kylomas

@kylomas: nice demo; one question: the line here does set focus to the control, however, does not really 'highlight' the first item. Only does so after a cursor key or space bar is pressed. Is there a method to do so?

GUICtrlSetState($inp010, $GUI_FOCUS)

Ad

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...