Jump to content

Project: Management for bakery.


 Share

Recommended Posts

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
Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Link to comment
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.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Link to comment
Share on other sites

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

Link to comment
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

Link to comment
Share on other sites

  • 3 weeks later...

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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...