Sign in to follow this  
Followers 0
JayHawkfl

Billing notation Program

1 post in this topic

Something I was asked to make happen at work. I'm sure there are better ways to do some of the stuff I did but here you go.
The Read Me and ini files will go to c:AMS_ExtrasTigerTool2 and it will put itself in your start up folder if/when you run it, please just be aware of that if you have other hot keys set, this has Ctrl+Alt +A, Ctrl+Alt +S, Ctrl+Alt +Z for various fucntions
If some of the comments are unclear/simple/beginner or not there please let me know where I could make improvements.

;Programmers: Doug Hanson and, Jim Heyenbruch
;Special Thanks goes to Melba23, and danwilli for giving me GUISetAccelerators

;This program will assist Technitions in updating tickets while maintaining uniformity
;for easy billing purposes. Feel free to use and or change as needed.

#include <DateTimeConstants.au3>
#include <date.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Opt("SendCapslockMode", 0) ;1=store and restore, 0=don't
Local $ReadMeTest = FileExists("C:\AMS_Extras\TigerTool2\Readme.txt")
Local $ErrorFolder = FileExists('C:\AMS_extras\TigerTool2')
Local $DefaultTab ;the tab that will appear any time
Local $PhoneDefault ;from line 20 - 24 help in the display of the default tab
Local $OnSiteDefault
Local $DepoDefault
Local $QuoteDefault
Local $SuppliesDefault
Local $NumLockON ;this was a complete miscommunication, but it works so why take it out. This will auto set numlock on
Local $hDLL = DllOpen("user32.dll") ;stoeln/borrowed code. No idea what it dows. need it to work
Global $CustBill = "Fail" ;test message from early version
Global $LaborVar = 0
Global Const $VK_CAPITAL = 0x14 ;stoeln/borrowed code. No idea what it dows. need it to work
Global $CapsLockTest = 0 ;off by default, test to see if the Caps lock is turned on
Global $CapsLockReSet = 0;off by default If caps was turned on, this will reset it after the program has finished with send()
Global $MagCards = 0 ;the default cost of mag cards,
Global $MicrosRibbon = 0 ;the default cost of blacl/red ribbon
Global $MicrosBlackRibbon = 0;the default cost of black ribbon
Global $FutureRibbon = 0 ;the default cost of future ribbon
Global $OnePly = 0 ;the default cost of one ply printer paper
Global $TwoPly = 0 ;the default cost of two ply printer paper
Global $Thermal = 0 ;the default cost of thermal printer paper
Global $PartCostInput = 0 ;default cost for parts
Global $ShippingCostInput = 0 ;default cost of shipping
Global $Win7StartMenuFilePath = "C:\ProgramData\Microsoft\Windows\Start Menu"
Global $WinXPStartMenuFilePath = 'C:\Documents and Settings\All Users\Start Menu'
Global $OSVersion = @OSVersion

If $ErrorFolder = 0 Then ;checks to ensure the folder is there
    DirCreate('C:\AMS_Extras\TigerTool2')
EndIf

If $OSVersion = "WIN_XP" Then
    FileCopy('C:\AMS_extras\TigerTool2\TigerTool2.exe', 'C:\Documents and Settings\All Users\Start Menu');This places the tiger tool in everyone's start menu, allowing the program to activate when anyone logs in to windows
EndIf

If $OSVersion = "WIN_7" Then
    FileCopy('C:\AMS_extras\TigerTool2\TigerTool2.exe', 'C:\ProgramData\Microsoft\Windows\Start Menu');This places the tiger tool in everyone's start menu, allowing the program to activate when anyone logs in to windows
EndIf

If $ReadMeTest = 0 Then ;the read me generator, and the text inside it
    FileOpen("C:\AMS_Extras\Future_Control_panel\README.TXT", 2)
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", '===Tiger Tool2.0===')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'Programers: Douglas Hanson, Jim Heyenbruch')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'Feel free to use/distribute as you see fit.')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", '===Instructions===')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'Open the ini file. For "TechName," put your first name and last initial')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'If you want the program to automatically turn NumLock on, set "NumLock" to "1"')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'You can choose your default tab by puting in the appropriate # 1-5')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", '1 is Phone Support, 2 is On-Site, 3 is Depo, 4 is Quote, and 5 is Supplies')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'The Dennys download is the cost of the current menu updates.')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'You can edit the price of supplies, if there is a change you will need to update')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'the cost of the item.')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'If any changes are made to the INI file, the program will need to be relaunched')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'before the changes will take effect.')
    FileWriteLine("C:\AMS_Extras\TigerTool2\README.TXT", 'Bug Reports/Feture Requests e-mail Hansonprogramming@gmail.com')
    FileClose("C:\AMS_Extras\TigerTool2\README.TXT")
EndIf

Opt("TrayMenuMode", 1) ;This section sets up the tray icon

Local $aboutitem = TrayCreateItem("About")
TrayCreateItem("")
Local $exititem = TrayCreateItem("Exit")

TraySetState(1)

Local $IniTest = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'TechName', 'xxx');this set generates the .ini file
If $IniTest = 'xxx' Then
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'TechName', 'xxx')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'NumLock', '0')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'DefaultTab', 'x')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'Dennys Download Cost', 'x')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'MagCards', '24')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'MicrosRibbon', '18')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'MicrosBlackRibbon', '18')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'FutureRibbon', '3.25')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'OnePly', '44.50')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'TwoPly', '61.50')
    IniWrite('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'Thermal', '77.50')
EndIf

Local $TechName = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'TechName', 'xxx') ;This reads the information in the .ini file
Local $NumLockON = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'NumLock', '0')
Local $DefaultTab = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'DefaultTab', 'x')
Local $DennysDownloadCost = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'Dennys Download Cost', '100')
Local $PriceMagCards = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'MagCards', '24.00')
Local $PriceMicrosRibbon = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'MicrosRibbon', '18.00')
Local $PriceMicrosBlackRibbon = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'MicrosBlackRibbon', '18.00')
Local $PriceFutureRibbon = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'FutureRibbon', '3.25')
Local $PriceOnePly = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'OnePly', '44.50')
Local $PriceTwoPly = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'TwoPly', '61.50')
Local $PriceThermal = IniRead('C:\AMS_extras\TigerTool2\TigerTool2.ini', 'SETUP', 'Thermal', '77.50')

If $DefaultTab = 1 Then ;These set the which tab opens for you
    $PhoneDefault = $Gui_SHOW
EndIf
If $DefaultTab = 2 Then
    $OnSiteDefault = $Gui_SHOW
EndIf
If $DefaultTab = 3 Then
    $DepoDefault = $Gui_SHOW
EndIf
If $DefaultTab = 4 Then
    $QuoteDefault = $Gui_SHOW
EndIf
If $DefaultTab = 5 Then
    $SuppliesDefault = $Gui_SHOW
EndIf


HotKeySet("^!a", "TimeStamp") ;here are your hotkeys
HotKeySet("^!s", "Billing")
HotKeySet("^!z", "TimeFix")

While 1
    Local $msg = TrayGetMsg();this determins what is in your tray, and what that says
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $aboutitem
            MsgBox(64, "Version:", "Beta 1.2")
        Case $msg = $exititem
            Exit
    EndSelect
WEnd

Func TimeStamp();This function pulls the time from the PC, rearranges it to the desired format and send()s it to what ever text box you have selected
    $CapsLockTest = _GetCapsLock()
    If $CapsLockTest = 1 Then
        Send("{CAPSLOCK OFF}")
        $CapsLockReSet = 1
    EndIf
    $TimeHourMin = _NowTime();Retreave and store the current time
    If (StringMid($TimeHourMin, "2", "1") = ":") Then
        $TimeHourMin = "0" & $TimeHourMin
    EndIf
    $TimeHourMin = StringMid($TimeHourMin, "1", "5") & " " & StringMid($TimeHourMin, "10", "2");reformats how I wanted it
    ;MsgBox(0, '', $TimeHourMin)
    Local $CurDateTime = @MON & "-" & @MDAY & "-" & @YEAR & "---" & $TimeHourMin;Pulls date and combines it with the reformatted time
    Sleep(100)
    Send($CurDateTime & "--" & $TechName & "{ENTER}{ENTER}Hrs- {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{UP}{UP}")
    If $CapsLockReSet = 1 Then
        Send("{CAPSLOCK ON}")
        $CapsLockReSet = 0
    EndIf
    NumLock()
EndFunc   ;==>TimeStamp

Func Billing();This constructs the billing Gui
    #region ### START Koda GUI section ### ;Form=c:\documents and settings\administrator\my documents\doug's autoit\dev\tigertool\billing tabs.kxf
    $Form1_1 = GUICreate("Billing", 355, 307, 185, 114)
    $Tab1 = GUICtrlCreateTab(0, 0, 353, 305)
    $Phone = GUICtrlCreateTabItem("Phone Support")
    GUICtrlSetState(-1, $PhoneDefault);These set which tab displays per the users request
    $Checkbox1 = GUICtrlCreateCheckbox("Neglect", 16, 48, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox("Warranty", 142, 48, 97, 17)
    $Input8 = GUICtrlCreateInput("Parts", 16, 77, 97, 22)
    $Input9 = GUICtrlCreateInput("Shipping", 142, 77, 105, 22)
    $Combo2 = GUICtrlCreateCombo("Labor Hours", 16, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "0.5|1.0|1.5|2.0|2.5|3.0")
    $Combo1 = GUICtrlCreateCombo("Travel Hours", 142, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Local|0.5|1.0|1.5|2.0|2.5|3.0")
    $Button1 = GUICtrlCreateButton("Office Hours", 16, 155, 99, 33)
    $Button2 = GUICtrlCreateButton("After Hours", 16, 204, 99, 33)
    $Button3 = GUICtrlCreateButton("Holiday", 16, 251, 99, 33)
    $Button4 = GUICtrlCreateButton("Training", 142, 155, 99, 33)
    $Button5 = GUICtrlCreateButton("Programming", 142, 204, 99, 33)
    $Button6 = GUICtrlCreateButton("Denny's Download", 142, 251, 99, 33)
    $OnSite = GUICtrlCreateTabItem("On-Site")
    GUICtrlSetState(-1, $OnSiteDefault);These set which tab displays per the users request
    $Checkbox3 = GUICtrlCreateCheckbox("Neglect", 16, 48, 97, 17)
    $Checkbox4 = GUICtrlCreateCheckbox("Warranty", 142, 48, 97, 17)
    $Input10 = GUICtrlCreateInput("Parts", 16, 77, 97, 22)
    $Input11 = GUICtrlCreateInput("Shipping", 142, 77, 105, 22)
    $Combo4 = GUICtrlCreateCombo("Labor Hours", 16, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "0.5|1.0|1.5|2.0|2.5|3.0")
    $Combo3 = GUICtrlCreateCombo("Travel Hours", 142, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Local|0.5|1.0|1.5|2.0|2.5|3.0")
    $Button7 = GUICtrlCreateButton("Office Hours", 16, 155, 99, 33)
    $Button8 = GUICtrlCreateButton("After Hours", 16, 204, 99, 33)
    $Button9 = GUICtrlCreateButton("Holiday", 16, 251, 99, 33)
    $Button10 = GUICtrlCreateButton("Training", 142, 155, 99, 33)
    $Button11 = GUICtrlCreateButton("Programming", 142, 204, 99, 33)
    $Depo = GUICtrlCreateTabItem("Depo")
    GUICtrlSetState(-1, $DepoDefault);These set which tab displays per the users request
    $Checkbox5 = GUICtrlCreateCheckbox("Neglect", 16, 48, 97, 17)
    $Checkbox6 = GUICtrlCreateCheckbox("Warranty", 142, 48, 97, 17)
    $Input12 = GUICtrlCreateInput("Parts", 16, 77, 97, 22)
    $Input13 = GUICtrlCreateInput("Shipping", 142, 77, 105, 22)
    $Combo6 = GUICtrlCreateCombo("Labor Hours", 16, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "0.5|1.0|1.5|2.0|2.5|3.0")
    $Combo5 = GUICtrlCreateCombo("Travel Hours", 142, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Local|0.5|1.0|1.5|2.0|2.5|3.0")
    $Button12 = GUICtrlCreateButton("Office Hours", 16, 155, 99, 33)
    $Quote = GUICtrlCreateTabItem("Quote")
    GUICtrlSetState(-1, $QuoteDefault);These set which tab displays per the users request
    $Checkbox7 = GUICtrlCreateCheckbox("Neglect", 16, 48, 97, 17)
    $Checkbox8 = GUICtrlCreateCheckbox("Warranty", 142, 48, 97, 17)
    $Input14 = GUICtrlCreateInput("Parts", 16, 77, 97, 22)
    $Input15 = GUICtrlCreateInput("Shipping", 142, 77, 105, 22)
    $Combo8 = GUICtrlCreateCombo("Labor Hours", 16, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "0.5|1.0|1.5|2.0|2.5|3.0|4.0|8.0")
    $Combo7 = GUICtrlCreateCombo("Travel Hours", 142, 113, 99, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Local|0.5|1.0|1.5|2.0|2.5|3.0")
    $Button13 = GUICtrlCreateButton("COS", 16, 155, 99, 33)
    $Button14 = GUICtrlCreateButton("Equipment", 16, 204, 99, 33)
    $Button15 = GUICtrlCreateButton("Programming", 16, 251, 99, 33)
    $TabSheet5 = GUICtrlCreateTabItem("Supplies")
    GUICtrlSetState(-1, $SuppliesDefault);These set which tab displays per the users request
    $Label1 = GUICtrlCreateLabel("Mag Cards", 16, 48, 124, 17)
    $Input1 = GUICtrlCreateInput("How many?", 16, 64, 121, 21)
    $Label2 = GUICtrlCreateLabel("Micros Ribbon", 16, 96, 124, 17)
    $Input2 = GUICtrlCreateInput("How many?", 16, 112, 121, 21)
    $Label3 = GUICtrlCreateLabel("Micros Black Ribbon", 16, 144, 124, 17)
    $Input3 = GUICtrlCreateInput("How many?", 16, 160, 121, 21)
    $Label4 = GUICtrlCreateLabel("Future Ribbon", 16, 192, 124, 17)
    $Input4 = GUICtrlCreateInput("How many?", 16, 208, 121, 21)
    $Label5 = GUICtrlCreateLabel("One Ply", 208, 48, 124, 17)
    $Input5 = GUICtrlCreateInput("How many?", 208, 64, 121, 21)
    $Label6 = GUICtrlCreateLabel("Two Ply", 208, 96, 124, 17)
    $Input6 = GUICtrlCreateInput("How many?", 208, 112, 121, 21)
    $Label7 = GUICtrlCreateLabel("Thermal", 208, 144, 124, 17)
    $Input7 = GUICtrlCreateInput("How many?", 208, 160, 121, 21)
    $Button16 = GUICtrlCreateButton("Total", 208, 192, 123, 41)
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

    While 1;This will handle the buttons being clicked
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button1
                GUISetState(@SW_HIDE);You have to keep the GUI "intact" at this point, but you want to give the illuson of it being closed
                $ButtonPressed = "***OFFICE HOURS***{Enter}***PHONE SUPPORT***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox1 = GUICtrlRead($Checkbox1)
                $ReadCheckBox2 = GUICtrlRead($Checkbox2)
                $Travel = GUICtrlRead($Combo1)
                $Labor = GUICtrlRead($Combo2)
                $ReadPartsInput = GUICtrlRead($Input8)
                $ReadShippingInput = GUICtrlRead($Input9)
                BillingVar($ReadCheckBox1, $ReadCheckBox2, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button2
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***AFTER HOURS***{Enter}***PHONE SUPPORT***"
                $LaborRate = 232
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox1 = GUICtrlRead($Checkbox1)
                $ReadCheckBox2 = GUICtrlRead($Checkbox2)
                $Travel = GUICtrlRead($Combo1)
                $Labor = GUICtrlRead($Combo2)
                $ReadPartsInput = GUICtrlRead($Input8)
                $ReadShippingInput = GUICtrlRead($Input9)
                BillingVar($ReadCheckBox1, $ReadCheckBox2, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button3
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***HOLIDAY***{Enter}***PHONE SUPPORT***"
                $LaborRate = 310
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox1 = GUICtrlRead($Checkbox1)
                $ReadCheckBox2 = GUICtrlRead($Checkbox2)
                $Travel = GUICtrlRead($Combo1)
                $Labor = GUICtrlRead($Combo2)
                $ReadPartsInput = GUICtrlRead($Input8)
                $ReadShippingInput = GUICtrlRead($Input9)
                BillingVar($ReadCheckBox1, $ReadCheckBox2, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button4
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***TRAINING***{Enter}***PHONE SUPPORT***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox1 = GUICtrlRead($Checkbox1)
                $ReadCheckBox2 = GUICtrlRead($Checkbox2)
                $Travel = GUICtrlRead($Combo1)
                $Labor = GUICtrlRead($Combo2)
                $ReadPartsInput = GUICtrlRead($Input8)
                $ReadShippingInput = GUICtrlRead($Input9)
                BillingVar($ReadCheckBox1, $ReadCheckBox2, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button5
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***PROGRAMMING***{Enter}***PHONE SUPPORT***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox1 = GUICtrlRead($Checkbox1)
                $ReadCheckBox2 = GUICtrlRead($Checkbox2)
                $Travel = GUICtrlRead($Combo1)
                $Labor = GUICtrlRead($Combo2)
                $ReadPartsInput = GUICtrlRead($Input8)
                $ReadShippingInput = GUICtrlRead($Input9)
                BillingVar($ReadCheckBox1, $ReadCheckBox2, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button6
                GUISetState(@SW_HIDE);This buttong behaives diffrently, Purely because of the "$buttonPressed. See the billing function later on
                $ButtonPressed = "***DENNY'S MENU DOWNLOAD***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox1 = GUICtrlRead($Checkbox1)
                $ReadCheckBox2 = GUICtrlRead($Checkbox2)
                $Travel = GUICtrlRead($Combo1)
                $Labor = GUICtrlRead($Combo2)
                $ReadPartsInput = GUICtrlRead($Input8)
                $ReadShippingInput = GUICtrlRead($Input9)
                BillingVar($ReadCheckBox1, $ReadCheckBox2, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button7
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***OFFICE HOURS***{Enter}***ON-SITE***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox3 = GUICtrlRead($Checkbox3)
                $ReadCheckBox4 = GUICtrlRead($Checkbox4)
                $Travel = GUICtrlRead($Combo3)
                $Labor = GUICtrlRead($Combo4)
                $ReadPartsInput = GUICtrlRead($Input10)
                $ReadShippingInput = GUICtrlRead($Input11)
                BillingVar($ReadCheckBox3, $ReadCheckBox4, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button8
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***AFTER HOURS***{Enter}***ON-SITE***"
                $LaborRate = 232.5
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox3 = GUICtrlRead($Checkbox3)
                $ReadCheckBox4 = GUICtrlRead($Checkbox4)
                $Travel = GUICtrlRead($Combo3)
                $Labor = GUICtrlRead($Combo4)
                $ReadPartsInput = GUICtrlRead($Input10)
                $ReadShippingInput = GUICtrlRead($Input11)
                BillingVar($ReadCheckBox3, $ReadCheckBox4, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button9
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***HOLIDAY***{Enter}***ON-SITE***"
                $LaborRate = 310
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox3 = GUICtrlRead($Checkbox3)
                $ReadCheckBox4 = GUICtrlRead($Checkbox4)
                $Travel = GUICtrlRead($Combo3)
                $Labor = GUICtrlRead($Combo4)
                $ReadPartsInput = GUICtrlRead($Input10)
                $ReadShippingInput = GUICtrlRead($Input11)
                BillingVar($ReadCheckBox3, $ReadCheckBox4, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button10
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***TRAINING***{Enter}***ON-SITE***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox3 = GUICtrlRead($Checkbox3)
                $ReadCheckBox4 = GUICtrlRead($Checkbox4)
                $Travel = GUICtrlRead($Combo3)
                $Labor = GUICtrlRead($Combo4)
                $ReadPartsInput = GUICtrlRead($Input10)
                $ReadShippingInput = GUICtrlRead($Input11)
                BillingVar($ReadCheckBox3, $ReadCheckBox4, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button11
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***PROGRAMMING***{Enter}***ON-SITE***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox3 = GUICtrlRead($Checkbox3)
                $ReadCheckBox4 = GUICtrlRead($Checkbox4)
                $Travel = GUICtrlRead($Combo3)
                $Labor = GUICtrlRead($Combo4)
                $ReadPartsInput = GUICtrlRead($Input10)
                $ReadShippingInput = GUICtrlRead($Input11)
                BillingVar($ReadCheckBox3, $ReadCheckBox4, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button12
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***DEPO***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox5 = GUICtrlRead($Checkbox5)
                $ReadCheckBox6 = GUICtrlRead($Checkbox6)
                $Travel = GUICtrlRead($Combo5)
                $Labor = GUICtrlRead($Combo6)
                $ReadPartsInput = GUICtrlRead($Input12)
                $ReadShippingInput = GUICtrlRead($Input13)
                BillingVar($ReadCheckBox5, $ReadCheckBox6, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button13
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***COS QUOTE***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox7 = GUICtrlRead($Checkbox7)
                $ReadCheckBox8 = GUICtrlRead($Checkbox8)
                $Travel = GUICtrlRead($Combo7)
                $Labor = GUICtrlRead($Combo8)
                $ReadPartsInput = GUICtrlRead($Input14)
                $ReadShippingInput = GUICtrlRead($Input15)
                BillingVar($ReadCheckBox7, $ReadCheckBox8, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button14
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***EQUIPMENT QUOTE***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox7 = GUICtrlRead($Checkbox7)
                $ReadCheckBox8 = GUICtrlRead($Checkbox8)
                $Travel = GUICtrlRead($Combo7)
                $Labor = GUICtrlRead($Combo8)
                $ReadPartsInput = GUICtrlRead($Input14)
                $ReadShippingInput = GUICtrlRead($Input15)
                BillingVar($ReadCheckBox7, $ReadCheckBox8, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button15
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***PROGRAMMING QUOTE***"
                $LaborRate = 155
                $LaborRate = Round($LaborRate, 2)
                $ReadCheckBox7 = GUICtrlRead($Checkbox7)
                $ReadCheckBox8 = GUICtrlRead($Checkbox8)
                $Travel = GUICtrlRead($Combo7)
                $Labor = GUICtrlRead($Combo8)
                $ReadPartsInput = GUICtrlRead($Input14)
                $ReadShippingInput = GUICtrlRead($Input15)
                BillingVar($ReadCheckBox7, $ReadCheckBox8, $Travel, $Labor, $ButtonPressed, $ReadPartsInput, $ReadShippingInput, $LaborRate)
                NumLock()
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button16
                GUISetState(@SW_HIDE)
                $ButtonPressed = "***SUPPLIES QUOTE***"
                $MagCards = GUICtrlRead($Input1)
                $MicrosRibbon = GUICtrlRead($Input2)
                $MicrosBlackRibbon = GUICtrlRead($Input3)
                $FutureRibbon = GUICtrlRead($Input4)
                $OnePly = GUICtrlRead($Input5)
                $TwoPly = GUICtrlRead($Input6)
                $Thermal = GUICtrlRead($Input7)
                Supplies($ButtonPressed, $MagCards, $MicrosRibbon, $MicrosBlackRibbon, $FutureRibbon, $OnePly, $TwoPly, $Thermal)
                GUIDelete($Form1_1)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>Billing

Func NumLock()
    If $NumLockON = 1 Then
        Send("{NUMLOCK ON}")
    EndIf
EndFunc   ;==>NumLock

Func BillingVar($NeglectCheckBox, $WarrentyCheckBox, $TravelAdd, $LaborAdd, $ButtonPass, $PartCostInput, $ShippingCostInput, $LaborRate)
    Sleep(100)
    $CapsLockTest = _GetCapsLock()
    If $CapsLockTest = 1 Then
        Send("{CAPSLOCK OFF}")
        $CapsLockReSet = 1
    EndIf
    If $NeglectCheckBox = 1 Then
        Sleep(50)
        Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}***NEGLECT***{ENTER}")
    EndIf
    If $WarrentyCheckBox = 1 Then
        Sleep(50)
        Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}***WARRANTY***{ENTER}")
    EndIf
    $PartCostInput = Number($PartCostInput)

    $ShippingCostInput = Number($ShippingCostInput)

    $LaborAdd = Number($LaborAdd)
    $LaborAdd = $LaborAdd * $LaborRate

    If $TravelAdd <> "Local" Then
        $TravelAdd = Number($TravelAdd)
        $TravelAdd = $TravelAdd * 155.00

    Else
        $TravelAdd = 35.00

    EndIf
    If $ButtonPass = "***DENNY'S MENU DOWNLOAD***" Then
        $LaborAdd = $DennysDownloadCost

    EndIf

    $CustBill = $LaborAdd + $TravelAdd + $PartCostInput + $ShippingCostInput
    If $WarrentyCheckBox = 1 Then
        $CustBill = 0
    EndIf
    Send($ButtonPass & "{ENTER}--ACCOUNTING TOTALS--{ENTER}")
    $StrLaborAdd = TwoDecimals($LaborAdd)
    Send("Labor Cost = $" & $StrLaborAdd & "{ENTER}")
    If $TravelAdd <> 0 Then
        $StrTravelAdd = TwoDecimals($TravelAdd)
        Send("Travel Cost = $" & $StrTravelAdd & "{ENTER}")
    EndIf
    If $PartCostInput <> 0 Then
        $StrPartCost = TwoDecimals($PartCostInput)
        Send("Parts Cost = $" & $StrPartCost & " {ENTER}")
    EndIf
    If $ShippingCostInput <> 0 Then
        $StrShippingCost = TwoDecimals($ShippingCostInput)
        Send("Shipping Cost = $" & $StrShippingCost & " {ENTER}")
    EndIf
    $strCustBill = TwoDecimals($CustBill)
    Send("Customer Bill = $" & $strCustBill)
    If $CustBill = 0 Then
        Send(" {ENTER}(Techs Billing Notes -) {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{LEFT}{LEFT}{Left}Non-Billable")
    Else
        Send(" {ENTER}(Techs Billing Notes -) {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{LEFT}{LEFT}{Left}Billable")
    EndIf
    If $CapsLockReSet = 1 Then
        Send("{CAPSLOCK ON}")
        $CapsLockReSet = 0
    EndIf
EndFunc   ;==>BillingVar

Func Supplies($ButtonPressed, $MagCards, $MicrosRibbon, $MicrosBlackRibbon, $FutureRibbon, $OnePly, $TwoPly, $Thermal)
    Number($MagCards)
    Number($MicrosRibbon)
    Number($MicrosBlackRibbon)
    Number($FutureRibbon)
    Number($OnePly)
    Number($TwoPly)
    Number($Thermal)
    $CapsLockTest = _GetCapsLock()
    If $CapsLockTest = 1 Then
        Send("{CAPSLOCK OFF}")
        $CapsLockReSet = 1
    EndIf
    Sleep(100)
    Send($ButtonPressed & '{ENTER}')
    If $MagCards <> 0 Then
        Send($MagCards & ' Pack(s) of Mag Cards at ' & $PriceMagCards & '{ENTER}')
        $MagCards = $MagCards * 24
        $StrMagCards = TwoDecimals($MagCards)
        Send('Mag Card total = $' & $StrMagCards & '{ENTER}')
    EndIf
    If $MicrosRibbon <> 0 Then
        Send($MicrosRibbon & ' Pack(s) of Red/Black Ribbon at ' & $PriceMicrosRibbon & '{ENTER}')
        $MicrosRibbon = $MicrosRibbon * 18
        $StrMicrosRibbon = TwoDecimals($MicrosRibbon)
        Send('Micros Ribbon total = $' & $StrMicrosRibbon & '{ENTER}')
    EndIf
    If $MicrosBlackRibbon <> 0 Then
        Send($MicrosBlackRibbon & ' Pack(s) of Black Ribbon at ' & $PriceMicrosBlackRibbon & '{ENTER}')
        $MicrosBlackRibbon = $MicrosBlackRibbon * 18
        $StrMicrosBlackRibbon = TwoDecimals($MicrosBlackRibbon)
        Send('Micros Black Ribbon total = $' & $StrMicrosBlackRibbon & '{ENTER}')
    EndIf
    If $FutureRibbon <> 0 Then
        Send($FutureRibbon & ' Future Ribbon(s) at ' & $PriceFutureRibbon & '{ENTER}')
        $FutureRibbon = $FutureRibbon * 3.25
        $StrFutureRibbon = TwoDecimals($FutureRibbon)
        Send('Future Ribbon total = $' & $StrFutureRibbon & '{ENTER}')
    EndIf
    If $OnePly <> 0 Then
        Send($OnePly & ' case(s) of One Ply paper at ' & $PriceOnePly & '{ENTER}')
        $OnePly = $OnePly * 44.50
        $StrOnePly = TwoDecimals($OnePly)
        Send('OnePly total = $' & $StrOnePly & '{ENTER}')
    EndIf
    If $TwoPly <> 0 Then
        Send($TwoPly & ' case(s) of Two Ply paper at ' & $PriceTwoPly & '{ENTER}')
        $TwoPly = $TwoPly * 61.50
        $StrTwoPly = TwoDecimals($TwoPly)
        Send('TwoPly total = $' & $StrTwoPly & '{ENTER}')
    EndIf
    If $Thermal <> 0 Then
        Send($Thermal & ' case(s) of Thermal paper at ' & $PriceThermal & '{ENTER}')
        $Thermal = $Thermal * 77.50
        $StrThermal = TwoDecimals($Thermal)
        Send('Thermal total = $' & $StrThermal & '{ENTER}')
    EndIf
    $SupplyBillTotal = $MagCards + $MicrosRibbon + $MicrosBlackRibbon + $FutureRibbon + $OnePly + $TwoPly + $Thermal
    $StrSupplyBillTotal = TwoDecimals($SupplyBillTotal)
    Send('{ENTER}Supply Subtotal = $' & $StrSupplyBillTotal)
    If $CapsLockReSet = 1 Then
        Send("{CAPSLOCK ON}")
        $CapsLockReSet = 0
    EndIf
EndFunc   ;==>Supplies

Func TimeFix()
    #region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\Desktop\Doug's AutoIT\Dev\TigerTool\TimeDateAdjust.kxf
    Local $TmpDate = _NowDate()
    Local $Hour = @HOUR
    If $Hour < 10 Then
        $Hour = String($Hour)
        $Hour = StringMid($Hour, "2", "1")
    EndIf
    Local $Minute = @MIN
    Local $AMorPM = "PM"
    $Form1 = GUICreate("Time", 275, 280, 192, 114)
    $MonthCal1 = GUICtrlCreateMonthCal($TmpDate, 24, 64, 225, 175)
    $HourInput = GUICtrlCreateCombo($Hour, 24, 24, 57, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $Label1 = GUICtrlCreateLabel("Hours", 24, 8, 32, 17)
    $MinuteInput = GUICtrlCreateCombo($Minute, 104, 24, 57, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "00|05|10|15|20|25|30|35|40|45|50|55")
    $Label2 = GUICtrlCreateLabel("Minutes", 104, 8, 41, 17)
    $Label3 = GUICtrlCreateLabel("AM/PM", 184, 8, 41, 17)
    $Combo9 = GUICtrlCreateCombo("AM", 184, 24, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "PM")
    $UpDown1 = GUICtrlCreateUpdown($HourInput)
    $UpDown2 = GUICtrlCreateUpdown($MinuteInput)
    $Button17 = GUICtrlCreateButton("Submit", 24, 245, 225, 25)
    Local $AccelKeys[1][2] = [["{enter}", $Button17]]
    GUISetAccelerators($AccelKeys)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###
    Local $hDLL = DllOpen("user32.dll")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $Button17
                GUISetState(@SW_HIDE)
                $CapsLockTest = _GetCapsLock()
                If $CapsLockTest = 1 Then
                    Send("{CAPSLOCK OFF}")
                    $CapsLockReSet = 1
                EndIf
                $TmpHour = GUICtrlRead($HourInput)
                $TmpMinute = GUICtrlRead($MinuteInput)
                $TmpAMorPM = GUICtrlRead($Combo9)
                $TmpDate = GUICtrlRead($MonthCal1)
                $TmpDate = StringMid($TmpDate, "6", "2") & "-" & StringMid($TmpDate, "9", "2") & "-" & StringMid($TmpDate, "1", "4")
                If $TmpHour < 10 Then
                    $TmpHour = "0" & $TmpHour
                EndIf
                Sleep(50)
                Send($TmpDate & "---" & $TmpHour & ":" & $TmpMinute & " " & $TmpAMorPM & "--" & $TechName & "{ENTER}{ENTER}Hrs- {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{UP}{UP}")
                GUIDelete($Form1)
                If $CapsLockReSet = 1 Then
                    Send("{CAPSLOCK ON}")
                    $CapsLockReSet = 0
                EndIf
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>TimeFix

Func TwoDecimals($CostInput)
    $DecimalCheck = StringInStr($CostInput, ".") ;Finds the decimal in the string
    $RetreveCents = StringMid($CostInput, $DecimalCheck, "4") ;Stores the decimal and three charecters after
    $StringLength = StringLen($RetreveCents) ;Counts the number of decimals
    If $StringLength = 0 Or 1 Then ;if we only got the decimal or not
        $StrCostInput = $CostInput
        String($StrCostInput)
        $StrCostInput = $StrCostInput & ".00"
    EndIf
    If $StringLength = 2 Then ;If we got the decimal and one number
        $StrCostInput = $CostInput
        String($StrCostInput)
        $StrCostInput = $StrCostInput & "0"
    EndIf
    If $StringLength > 2 Then ;If we got the decimal and many numbers
        $CostInput = Round($CostInput, 2)
        $StrCostInput = $CostInput
        String($StrCostInput)
    EndIf
    Return ($StrCostInput)
EndFunc   ;==>TwoDecimals

Func _GetCapsLock()
    Local $ret
    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_CAPITAL)
    Return $ret[0]
EndFunc   ;==>_GetCapsLock
DllClose($hDLL)

Thanks for your time

 

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
Sign in to follow this  
Followers 0