error471

Project: Management for bakery.

10 posts in this topic

#1 ·  Posted (edited)

Hello autoit-community,

my mate started a small business by delivering sandwiches, fruits and milk to a few local companies. To ease her work, I started to script an application for the production, delivery and invoicing. I am not a noob, but I must admit, I am still a beginner. So here is what I could do so far:

 

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ###
$Form1 = GUICreate("Management 0.01", 970, 547, 192, 124)
$FileMenu = GUICtrlCreateMenu("Menu")
$FileExit = GUICtrlCreateMenuItem("Exit", $FileMenu)
$MenuItem2 = GUICtrlCreateMenu("Edit")
$MenuItem3 = GUICtrlCreateMenu("About")
$ListView1 = GUICtrlCreateListView("", 172, 6, 792, 483)
$Button1 = GUICtrlCreateButton("Duplicate last week", 248, 496, 107, 25)
$ExitButton = GUICtrlCreateButton("Exit", 856, 496, 107, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


;===========Read-INI-and-create-Treeview=======================
Dim $Location = @ScriptDir & "\placesandproducts.ini"

$treeview = GUICtrlCreateTreeView(6, 6, 160, 483, BitOR($tvs_hasbuttons, $tvs_haslines, $tvs_linesatroot, $tvs_disabledragdrop, $tvs_showselalways), $ws_ex_clientedge)

$sections = IniReadSectionNames($Location)
If @error Then
    MsgBox(4096, "Error", "No ini-file found.")
Else
    For $i = 1 To $sections[0]
        $keys = IniReadSection($Location, $sections[$i])
        $item = GUICtrlCreateTreeViewItem($sections[$i], $treeview)
        For $x = 1 To $keys[0][0]
            GUICtrlCreateTreeViewItem($keys[$x][0], $item)
        Next
    Next
EndIf




While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $ExitButton, $FileExit
            Exit

    EndSwitch
WEnd

 

placesandproducts.ini:

[JT-Garden]
Cheese=Cheese
Ham=Ham
Thuna=Thuna
Apples=Apples
Bananas=Bananas
Milk=Milk
[SR-Elements]
Cheese=Cheese
Ham=Ham
Thuna=Thuna
Apples=Apples
Bananas=Bananas
Milk=Milk
[TJ-West]
Cheese=Cheese
Ham=Ham
Thuna=Thuna
Apples=Apples
Bananas=Bananas
Milk=Milk

 

So far, I could do the ini-loading for the treeview on my own. What I think I need to do next is creating an excel-like editable listview for each subitem of the treeview. I googled, but I haven't found something I could use... Maybe someone can help?

Edited by error471

Share this post


Link to post
Share on other sites



Welcome to AutoIt and the forum!
Use Google to search the site and you will get a lot of hits which should get you started: https://www.google.de/#q=site:autoitscript.com+listview+editable


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I applaud you for taking on this challenge, as this no easy task. It's great that you have chosen AutoIt, but if the reason for your choice is because it's an "easy" language to understand and not because it's the right tool, then you might want to do some research a little bit. How I would do it would be...

  • PHP 7 backend using the Laravel framework for all that goodness
  • MySQL database for storing products and customer data. As a starting point 3 tables, customers, products and orders, in which the orders table would have a relationship between the customer and product tables. (Of course I don't know the business requirements)
  • HTML5/CSS3/JavaScript (ideally ES2015 transpiled to ES5) frontend

From there I would add certain roles and access rights, in that multiple employees could use the system, but not mess it up.

Anyway, you get the idea.

Edited by guinness
1 person likes this

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

May I say, you also can do it with AutoIt   :D
And using a SQLite db instead of a .ini is a really nice idea

1 person likes this

Share this post


Link to post
Share on other sites
2 hours ago, mikell said:

May I say, you also can do it with AutoIt   :D
And using a SQLite db instead of a .ini is a really nice idea

I think they knew this already, on account of posting here.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites
3 hours ago, mikell said:

May I say, you also can do it with AutoIt   :D
And using a SQLite db instead of a .ini is a really nice idea

Can you link an example project for learning?

Share this post


Link to post
Share on other sites

You should first learn how to create, populate and use a SQLite db
Look at the _SQLite_* functions and their examples in the helpfile, there are also many sample scripts in the forum

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Error471,

Quote

To ease her work, I started to script an application for the production, delivery and invoicing.

What do you mean by "production"?

When you try to implement more complexity you will soon appreciate the suggestion to use a DB of some kind to manage customers, product and orders as opposed to an INI file (extremely limited).

Your project does not seem to need network capabilities so SQLite is the tool to use.  SQLite Expert is a free tool used for DB prototyping, SQL development and DB management. You can download it here.   AutoIT has full support for SQLite (see the Help file).

Now comes the part that no one wants to hear:  Before you start to code you need to define your data, functionality and outcomes.

Leaving the "production" piece out, something like this...(in it's simplest form)

Customers

  1. Id
  2. Store Name
  3. Store Address
  4. Contact Name
  5. Contact Address
  6. Contact Tele

Products

  1. Id
  2. Name
  3. Cost

Orders

  1. Id
  2. Date Delivered
  3. Customer Id
  4. Delivery Date (for one time orders)
  5. Delivery Day (for repeating orders)
  6. Product Id
  7. Cost (per unit)

Now the functionality that you need...

  • managing customers and products
  • managing the orders
  • creating invoices

...and the Outcomes

  • invoices
  • orders

Without a clear definition of your business needs this might serve as a starting point.  I see where you are going with the treeview and listview but don't think that this is the best way to do this.  However, without more definition a different approach is hard to recommend.  You might look at this from the perspective of "what is the user going to be doing the majority of the time"  (probably taking/modifying orders) and start building from there.

Whichever way you decide to go, good luck and don't hesitate to ask questions...

kylomas

Edited by 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

Share this post


Link to post
Share on other sites

What I am intending to do can be seen in the mockup that I created yesterday. I think Melba23s GuiListViewEx.au3 together with his new improvement for my purpose (https://www.autoitscript.com/forum/topic/180007-guilistviewex-integration/) will do what I want, which is a guilistview saveable/loadable to a file including formatting (bold/italic) and colors (textcolor/backgroundcolor). The colors will mean order received, in production, delivered, invoice created etc. and according to the status I want a single click creation of production list, delivery list an invoices.

I know that SQLite is powerful , but I am not quite sure if or how I could realize the formatting/color issue. I am always thankful for your ideas and examples to learn and improve.

 

mockup.thumb.png.9514f5dd668e4256f3c3d460bd71d406.png

Share this post


Link to post
Share on other sites

Melba23s enhancements of his GUILIstViewEx UDFs helped me a lot to improve my AutoIt knowledge and to progress this little project. Now I am at the point to link treeview subitems on the left side of the GUI with an action, in my case to load another database into the ListView on the righthand. I looked into the documentation and searched for examples, but found nothing useful or comparable. Does someone have a good example?

Share this post


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