Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Emergency Response Form for Email/Network/Local


  • Please log in to reply
No replies to this topic
Rhys
  • Members
  • 761 posts
  • Last active: Aug 09 2013 04:53 PM
  • Joined: 17 Apr 2007
I work in a large call center and I want to share the form I created for Emergency Response (main database goes down) purposes. While this particular form might not apply to anyone else's environment, there are some cool concepts that anyone needing a form could use. A lot of the features are basic, but if I had had something like this to 'reverse engineer' when I started, it would have saved some time. I hope this might help someone else, though!

The form is divided into 4 tabs - for service calls, supply orders, customer care, and invoice viewing. Each tab has some different fields, but the ones that are shared will transfer across tabs. Upon submission, it will create a pre-formatted email, a local text file, and a remote text file (this allows the form to be used if email and/or network is down).

Apologies in advance for very light commenting, but I did this as I was teaching myself and haven't gotten in the habit of commenting as I go yet.

#SingleInstance, Force
#NoTrayIcon
#NoEnv
App = Emergency Response Call Placement
Version = Beta 5
;;MAILTO ADDRESSES
SvcMailto = [email protected]
SupMailto = [email protected]
CCMailto = [email protected]

;;LIST OF STATES/TERRITORIES USED TO VALIDATE STATE ENTRY IN FORM
StatesList=AL|AK|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY

;;SPLASH SCREEN
FileInstall, https://ahknet.autohotkey.com/~Rhys/ER.gif, %A_Temp%\ER.gif, 1
SplashImage, %A_Temp%\ER.gif, Cxy b
SetTimer, KillSplash, 1500

Gui:
Gui, Add, Tab, x-4 y0 w470 h460 gSwitchTab vTab, Service|Supplies|Care|View Invoices ;Whenever you change tabs, 'SwitchTab' sub will run, and the current tab name will be passed to var 'Tab'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;SERVICE TAB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Gui, Tab, Service
Gui, Add, Text, x6 y30 w220 h18 +Center +Border, Request Type
Gui, Add, CheckBox, x11 y50 w105 h20 vSR, Service Request
Gui, Add, CheckBox, x11 y70 w105 h20 vCXL, Cancellation
Gui, Add, CheckBox, x11 y90 w105 h20 vCSF, Customer Sat
Gui, Add, CheckBox, x116 y50 w105 h20 +Right vCB, Call Back
Gui, Add, CheckBox, x116 y70 w105 h20 +Right vAHS, After Hours
Gui, Add, CheckBox, x116 y90 w105 h20 +Right vXN, Install/Removal

Gui, Add, Text, x236 y30 w220 h18 +Center +Border, Equipment Information
Gui, Add, Text, x236 y50 w80 h20 , Equipment ID #:
Gui, Add, Text, x236 y70 w80 h20 , Serial #:
Gui, Add, Text, x236 y90 w80 h20 , Make/Model #:
Gui, Add, Edit, x316 y50 w140 h20 vSvcEquipID, ;SvcEquipID
Gui, Add, Edit, x316 y70 w140 h20 vSvcSerial, ;SvcSerial
Gui, Add, Edit, x316 y90 w140 h20 vSvcMakeModel, ;SvcMakeModel

Gui, Add, Text, x6 y120 w450 h18 +Center +Border, Customer Information
Gui, Add, Text, x6 y140 w110 h20 , Company Name:
Gui, Add, Text, x6 y160 w110 h20 , Customer #:
Gui, Add, Text, x6 y180 w110 h20 , Address Line 1:
Gui, Add, Text, x6 y200 w110 h20 , Address Line 2:
Gui, Add, Text, x6 y220 w110 h20 , City:
Gui, Add, Text, x296 y222 w30 h20 +Right, State:
Gui, Add, Text, x356 y222 w20 h20 +Right, Zip:
Gui, Add, Edit, x116 y140 w340 h20 vSvcCompanyName, ;SvcCompanyName
Gui, Add, Edit, x116 y160 w340 h20 vSvcCustomerNum, ;SvcCustomerNum
Gui, Add, Edit, x116 y180 w340 h20 vSvcAddress1, ;SvcAddress1
Gui, Add, Edit, x116 y200 w340 h20 vSvcAddress2, ;SvcAddress2
Gui, Add, Edit, x116 y220 w180 h20 vSvcCity, ;SvcCity
Gui, Add, Edit, x326 y220 w30 h20 vSvcState, ;SvcState
Gui, Add, Edit, x376 y220 w80 h20 vSvcZip, ;SvcZip
Gui, Add, Text, x6 y240 w110 h20 , Contact Name:
Gui, Add, Text, x6 y260 w110 h20 , Contact Phone:
Gui, Add, Text, x6 y280 w110 h20 , Equipment Location:
Gui, Add, Edit, x116 y240 w180 h20 vSvcContactName, ;SvcContactName
Gui, Add, Edit, x116 y260 w180 h20 vSvcContactPhone, ;SvcContactPhone
Gui, Add, Edit, x116 y280 w180 h20 vSvcLocation, ;SvcLocation
Gui, Add, Text, x300 y247 w30 h20 , PO #:
Gui, Add, Edit, x331 y245 w125 h20 -TabStop vSvcPO, ;SvcPO
Gui, Add, Text, x300 y265 w160 h20 , AHS Authorized Signature:
Gui, Add, Edit, x300 y280 w155 h20 -TabStop vAHSAuth, ;AHSAuth

Gui, Add, Text, x6 y310 w450 h18 +Center +Border, Reason For Service
Gui, Add, Edit, x6 y330 w450 h90 vReason, ;Reason
Gui, Add, Button, x116 y430 w90 h20 gSvcSubmit, Submit
Gui, Add, Button, x256 y430 w90 h20 gClear, Clear
Gui, Add, Checkbox, x210 y430 w42 h20 vSvcEmailChk +Checked, Email
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;SUPPLIES TAB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Gui, Tab, Supplies
Gui, Add, Text, x6 y30 w105 h18 +Center +Border, Request Type
Gui, Add, Radio, x26 y50 w90 h20 vSO gSupReqType, Order
Gui, Add, Radio, x26 y70 w90 h20 vOS gSupReqType, Order Status
Gui, Add, Radio, x26 y90 w90 h20 vRMA gSupReqType, RMA

Gui, Add, Text, x121 y30 w105 h18 +Center +Border, Ship Method
Gui, Add, Radio, x141 y50 w65 h20 vBestWay, BestWay
Gui, Add, Radio, x141 y70 w65 h20 vOvernight, Overnight
Gui, Add, Radio, x141 y90 w65 h20 vOther, Other

Gui, Add, Text, x236 y30 w220 h18 +Center +Border, Equipment Information
Gui, Add, Text, x236 y50 w80 h20 , Equipment ID #:
Gui, Add, Text, x236 y70 w80 h20 , Serial #:
Gui, Add, Text, x236 y90 w80 h20 , Make/Model #:
Gui, Add, Edit, x316 y50 w140 h20 vSupEquipID, ;SupEquipID
Gui, Add, Edit, x316 y70 w140 h20 vSupSerial, ;SupSerial
Gui, Add, Edit, x316 y90 w140 h20 vSupMakeModel, ;SupMakeModel

Gui, Add, Text, x6 y120 w450 h18 +Center +Border, Customer Information
Gui, Add, Text, x6 y140 w110 h20 , Company Name:
Gui, Add, Text, x6 y160 w110 h20 , Customer #:
Gui, Add, Text, x6 y180 w110 h20 , Address Line 1:
Gui, Add, Text, x6 y200 w110 h20 , Address Line 2:
Gui, Add, Text, x6 y220 w110 h20 , City:
Gui, Add, Text, x296 y222 w30 h20 +Right, State:
Gui, Add, Text, x356 y222 w20 h20 +Right, Zip:
Gui, Add, Edit, x116 y140 w340 h20 vSupCompanyName, ;SupCompanyName
Gui, Add, Edit, x116 y160 w340 h20 vSupCustomerNum, ;SupCustomerNum
Gui, Add, Edit, x116 y180 w340 h20 vSupAddress1, ;SupAddress1
Gui, Add, Edit, x116 y200 w340 h20 vSupAddress2, ;SupAddress2
Gui, Add, Edit, x116 y220 w180 h20 vSupCity, ;SupCity
Gui, Add, Edit, x326 y220 w30 h20 vSupState, ;SupState
Gui, Add, Edit, x376 y220 w80 h20 vSupZip, ;SupZip
Gui, Add, Text, x6 y240 w110 h20 , Contact Name:
Gui, Add, Text, x6 y260 w110 h20 , Contact Phone:
Gui, Add, Text, x6 y280 w110 h20 +Hidden, Order Number:
Gui, Add, Edit, x116 y240 w180 h20 vSupContactName, ;SupContactName
Gui, Add, Edit, x116 y260 w180 h20 vSupContactPhone, ;SupContactPhone
Gui, Add, Edit, x116 y280 w180 h20 vSupOrderNum +Hidden, ;SupOrderNum
Gui, Add, Text, x300 y247 w30 h20 , PO #:
Gui, Add, Edit, x331 y245 w125 h20 -TabStop vSupPO, ;SupPO
Gui, Add, Text, x300 y265 w160 h20 , Defer Reason:
Gui, Add, Edit, x300 y280 w155 h20 -TabStop vDefer, ;Defer

Gui, Add, Text, x6 y310 w450 h18 +Center +Border, Supplies
Gui, Add, Text, x6 y330 w110 h18 +Center +Border, Product
Gui, Add, Text, x116 y330 w30 h18 +Center +Border, Qty
Gui, Add, Text, x161 y330 w110 h18 +Center +Border, Product
Gui, Add, Text, x271 y330 w30 h18 +Center +Border, Qty
Gui, Add, Text, x426 y330 w30 h18 +Center +Border, Qty
Gui, Add, Text, x316 y330 w110 h18 +Center +Border, Product
;Group 1
Gui, Add, Edit, x6 y350 w110 h20 vSup1, ;Sup1
Gui, Add, Edit, x116 y350 w30 h20 vQty1, ;Qty1
Gui, Add, Edit, x6 y370 w110 h20 vSup2, ;Sup2
Gui, Add, Edit, x116 y370 w30 h20 vQty2, ;Qty2
Gui, Add, Edit, x6 y390 w110 h20 vSup3, ;Sup3
Gui, Add, Edit, x116 y390 w30 h20 vQty3, ;Qty3
Gui, Add, Edit, x6 y410 w110 h20 vSup4, ;Sup4
Gui, Add, Edit, x116 y410 w30 h20 vQty4, ;Qty4
;Group 2
Gui, Add, Edit, x161 y350 w110 h20 vSup5, ;Sup5
Gui, Add, Edit, x271 y350 w30 h20 vQty5, ;Qty5
Gui, Add, Edit, x161 y370 w110 h20 vSup6, ;Sup6
Gui, Add, Edit, x271 y370 w30 h20 vQty6, ;Qty6
Gui, Add, Edit, x161 y390 w110 h20 vSup7, ;Sup7
Gui, Add, Edit, x271 y390 w30 h20 vQty7, ;Qty7
Gui, Add, Edit, x161 y410 w110 h20 vSup8, ;Sup8
Gui, Add, Edit, x271 y410 w30 h20 vQty8, ;Qty8
;Group 3
Gui, Add, Edit, x316 y350 w110 h20 vSup9, ;Sup9
Gui, Add, Edit, x426 y350 w30 h20 vQty9, ;Qty9
Gui, Add, Edit, x316 y370 w110 h20 vSup10, ;Sup10
Gui, Add, Edit, x426 y370 w30 h20 vQty10, ;Qty10
Gui, Add, Edit, x316 y390 w110 h20 vSup11, ;Sup11
Gui, Add, Edit, x426 y390 w30 h20 vQty11, ;Qty11
Gui, Add, Edit, x316 y410 w110 h20 vSup12, ;Sup12
Gui, Add, Edit, x426 y410 w30 h20 vQty12, ;Qty12

Gui, Add, Button, x116 y435 w90 h20 gSupSubmit, Submit
Gui, Add, Checkbox, x210 y435 w42 h20 vSupEmailChk +Checked, Email
Gui, Add, Button, x256 y435 w90 h20 gClear, Clear
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;CARE TAB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Gui, Tab, Care
Gui, Add, Text, x6 y30 w220 h18 +Center +Border, Request Type
Gui, Add, Radio, x11 y50 w105 h20 vBSR, Billing SR
Gui, Add, Radio, x11 y70 w105 h20 vCSR, Contract SR
Gui, Add, Radio, x11 y90 w105 h20 vMR, Meter Read
Gui, Add, Radio, x116 y50 w105 h20 +Right vTSR, Tax SR
Gui, Add, Radio, x116 y70 w105 h20 +Right vLEAD, Lead
Gui, Add, Radio, x116 y90 w105 h20 +Right vOTH gCCOtherWarn, Other

Gui, Add, Text, x236 y30 w220 h18 +Center +Border, Equipment Information
Gui, Add, Text, x236 y50 w80 h20 , Equipment ID #:
Gui, Add, Text, x236 y70 w80 h20 , Serial #:
Gui, Add, Text, x236 y90 w80 h20 , Make/Model #:
Gui, Add, Edit, x316 y50 w140 h20 vCCEquipID, ;CCEquipID
Gui, Add, Edit, x316 y70 w140 h20 vCCSerial, ;CCSerial
Gui, Add, Edit, x316 y90 w140 h20 vCCMakeModel, ;CCMakeModel

Gui, Add, Text, x6 y120 w450 h18 +Center +Border, Customer Information
Gui, Add, Text, x6 y140 w110 h20 , Company Name:
Gui, Add, Text, x6 y160 w110 h20 , Customer #:
Gui, Add, Text, x6 y180 w110 h20 , Address Line 1:
Gui, Add, Text, x6 y200 w110 h20 , Address Line 2:
Gui, Add, Text, x6 y220 w110 h20 , City:
Gui, Add, Text, x296 y222 w30 h20 +Right, State:
Gui, Add, Text, x356 y222 w20 h20 +Right, Zip:
Gui, Add, Edit, x116 y140 w340 h20 vCCCompanyName, ;CCCompanyName
Gui, Add, Edit, x116 y160 w340 h20 vCCCustomerNum, ;CCCustomerNum
Gui, Add, Edit, x116 y180 w340 h20 vCCAddress1, ;CCAddress1
Gui, Add, Edit, x116 y200 w340 h20 vCCAddress2, ;CCAddress2
Gui, Add, Edit, x116 y220 w180 h20 vCCCity, ;CCCity
Gui, Add, Edit, x326 y220 w30 h20 vCCState, ;CCState
Gui, Add, Edit, x376 y220 w80 h20 vCCZip, ;CCZip
Gui, Add, Text, x6 y240 w110 h20 , Contact Name:
Gui, Add, Text, x6 y260 w110 h20 , Contact Phone:
Gui, Add, Text, x300 y262 w20 h20 , Fax:
Gui, Add, Text, x6 y280 w110 h20 , Email Address:
Gui, Add, Edit, x116 y240 w180 h20 vCCContactName, ;CCContactName
Gui, Add, Edit, x116 y260 w180 h20 vCCContactPhone, ;CCContactPhone
Gui, Add, Edit, x325 y260 w130 h20 vCCFax, ;CCFax
Gui, Add, Edit, x116 y280 w180 h20 vCCEmail, ;CCEmail
Gui, Add, Text, x6 y310 w450 h18 +Center +Border, Customer Issue
Gui, Add, Edit, x6 y330 w450 h90 vIssue, ;Issue

Gui, Add, Button, x116 y430 w90 h20 gCCSubmit, Submit
Gui, Add, Checkbox, x210 y430 w42 h20 vCCEmailChk +Checked, Email
Gui, Add, Button, x256 y430 w90 h20 gClear, Clear
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;VIEW INVOICES TAB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Gui, Tab, View Invoices
Gui, Add, Edit, x16 y50 w140 h20 vInvNum
Gui, Add, Text, x16 y30 w140 h20 , Invoice Number:
Gui, Add, Button, x36 y80 w90 h20 gView Default, View

Gui, Show, xCenter yCenter h459 w466, %App% %Version%
Return

SwitchTab:
;Passes 'shared' variables from the last tab you were on to a general variable
LastTab := Tab
If LastTab = Service
{
	GuiControlGet, EquipID, , SvcEquipID
	GuiControlGet, Serial, , SvcSerial
	GuiControlGet, MakeModel, , SvcMakeModel
	GuiControlGet, CompanyName, , SvcCompanyName
	GuiControlGet, CustomerNum, , SvcCustomerNum
	GuiControlGet, Address1, , SvcAddress1
	GuiControlGet, Address2, , SvcAddress2
	GuiControlGet, City, , SvcCity
	GuiControlGet, State, , SvcState
	GuiControlGet, Zip, , SvcZip
	GuiControlGet, Location, , SvcLocation
	GuiControlGet, ContactName, , SvcContactName
	GuiControlGet, ContactPhone, , SvcContactPhone
	GuiControlGet, EmailChk, ,SvcEmailChk
}
If LastTab = Supplies
{
	GuiControlGet, EquipID, , SupEquipID
	GuiControlGet, Serial, , SupSerial
	GuiControlGet, MakeModel, , SupMakeModel
	GuiControlGet, CompanyName, , SupCompanyName
	GuiControlGet, CustomerNum, , SupCustomerNum
	GuiControlGet, Address1, , SupAddress1
	GuiControlGet, Address2, , SupAddress2
	GuiControlGet, City, , SupCity
	GuiControlGet, State, , SupState
	GuiControlGet, Zip, , SupZip
	GuiControlGet, Location, , SupLocation
	GuiControlGet, ContactName, , SupContactName
	GuiControlGet, ContactPhone, , SupContactPhone
	GuiControlGet, EmailChk, ,SupEmailChk
}
If LastTab = Care
{
	GuiControlGet, EquipID, , CCEquipID
	GuiControlGet, Serial, , CCSerial
	GuiControlGet, MakeModel, , CCMakeModel
	GuiControlGet, CompanyName, , CCCompanyName
	GuiControlGet, CustomerNum, , CCCustomerNum
	GuiControlGet, Address1, , CCAddress1
	GuiControlGet, Address2, , CCAddress2
	GuiControlGet, City, , CCCity
	GuiControlGet, State, , CCState
	GuiControlGet, Zip, , CCZip
	GuiControlGet, ContactName, , CCContactName
	GuiControlGet, ContactPhone, , CCContactPhone
	GuiControlGet, EmailChk, ,CCEmailChk
}
GoSub, SyncFields
Return

SyncFields:
;Passes general variables from above to the 'shared' variables on all tabs
GuiControl,, SupEquipID, %EquipID%
GuiControl,, SvcEquipID, %EquipID%
GuiControl,, CCEquipID, %EquipID%
GuiControl,, SupSerial, %Serial%
GuiControl,, SvcSerial, %Serial%
GuiControl,, CCSerial, %Serial%
GuiControl,, SupMakeModel, %MakeModel%
GuiControl,, SvcMakeModel, %MakeModel%
GuiControl,, CCMakeModel, %MakeModel%
GuiControl,, SupCompanyName, %CompanyName%
GuiControl,, SvcCompanyName, %CompanyName%
GuiControl,, CCCompanyName, %CompanyName%
GuiControl,, SupCustomerNum, %CustomerNum%
GuiControl,, SvcCustomerNum, %CustomerNum%
GuiControl,, CCCustomerNum, %CustomerNum%
GuiControl,, SupAddress1, %Address1%
GuiControl,, SvcAddress1, %Address1%
GuiControl,, CCAddress1, %Address1%
GuiControl,, SupAddress2, %Address2%
GuiControl,, SvcAddress2, %Address2%
GuiControl,, CCAddress2, %Address2%
GuiControl,, SupCity, %City%
GuiControl,, SvcCity, %City%
GuiControl,, CCCity, %City%
GuiControl,, SupState, %State%
GuiControl,, SvcState, %State%
GuiControl,, CCState, %State%
GuiControl,, SupZip, %Zip%
GuiControl,, SvcZip, %Zip%
GuiControl,, CCZip, %Zip%
GuiControl,, SupContactName, %ContactName%
GuiControl,, SvcContactName, %ContactName%
GuiControl,, CCContactName, %ContactName%
GuiControl,, SupContactPhone, %ContactPhone%
GuiControl,, SvcContactPhone, %ContactPhone%
GuiControl,, CCContactPhone, %ContactPhone%
GuiControl,, SupLocation, %Location%
GuiControl,, SvcLocation, %Location%
GuiControl,, SvcEmailChk, %EmailChk%
GuiControl,, SupEmailChk, %EmailChk%
GuiControl,, CCEmailChk, %EmailChk%
Return

SupReqType:
;RMA and Order Status inquiries don't require Ship Method, but might need Order Numbers
GuiControlGet, OS, , OS
GuiControlGet, RMA, , RMA
GuiControlGet, SO, , SO

If (RMA = 1 OR OS = 1)
{
	GuiControl,, Bestway, 0
	GuiControl,, Overnight, 0
	GuiControl,, Other, 0
}

If (OS = 1 OR RMA = 1)
{
	GuiControl, Show, Order Number:
	GuiControl, Show, SupOrderNum
}
Else
{
	GuiControl, Hide, Order Number:
	GuiControl, Hide, SupOrderNum
}
Return

SvcSubmit:
Gui, Submit, NoHide
GoSub, SvcAuthenticate
If (AuthError = 0)
{
	DateTimeStamp := a_now
	GoSub, SvcSubject
	GoSub, SvcCompose
	GoSub, Upper
	GoSub, CreateFile
	IfInString, SvcEmailChk, 1
	{
		GoSub, Send
	}
	MsgBox, , ER Call Status, ER Call Submitted!
}
Return

SupSubmit:
Gui, Submit, NoHide
GoSub, SupReqType
GoSub, SupAuthenticate
If (AuthError = 0)
{
	DateTimeStamp := a_now
	GoSub, SupSubject
	GoSub, SupCompose
	GoSub, Upper
	GoSub, CreateFile
	IfInString, SupEmailChk, 1
	{
		GoSub, Send
	}
	MsgBox, , ER Call Status, ER Call Submitted!
}
Return

CCSubmit:
Gui, Submit, NoHide
GoSub, CCAuthenticate
If (AuthError = 0)
{
	DateTimeStamp := a_now
	GoSub, CCSubject
	GoSub, CCCompose
	GoSub, Upper
	GoSub, CreateFile
	IfInString, CCEmailChk, 1
	{
		GoSub, Send
	}
	MsgBox, , ER Call Status, ER Call Submitted!
}
Return

SvcAuthenticate:
AuthError = 0

AuthError1 =
If (SR = 0 AND CXL = 0 AND CSF = 0 AND CB = 0 AND AHS = 0 AND XN = 0)
{
	AuthError++
	AuthError1 = • Request type not selected.`n
}

AuthError2 =
If (AHS = 1 AND StrLen(AHSAuth)=0)
{
	AuthError++
	AuthError2 = • AHS selected with no authorized signature.`n
}

AuthError3 =
If (StrLen(SvcEquipID)=0 AND StrLen(SvcMakeModel)=0 AND StrLen(SvcSerial)=0)
{
	AuthError++
	AuthError3 = • At least one of the following are required:`n     Equipment ID, Serial, Make/Model.`n
}

AuthError4 =
If (StrLen(SvcCompanyName)=0)
{
	AuthError++
	AuthError4 = • Company Name field is required.`n
}

AuthError5 =
If (StrLen(SvcAddress1)=0)
{
	AuthError++
	AuthError5 = • Address Line 1 field is required.`n
}

AuthError6 =
If (StrLen(SvcCity)=0)
{
	AuthError++
	AuthError6 = • City field is required.`n
}

AuthError7 =
If ((StrLen(SvcState) <>2) OR (!InStr(StatesList, SvcState)))
{
   AuthError++
   AuthError7 = • State selection invalid.`n
}

AuthError8 =
If (StrLen(SvcZip)<>5)
{
	AuthError++
	AuthError8 = • Zip field is required and must be 5 characters long.`n
}

AuthError9 =
If (StrLen(SvcLocation)=0)
{
	AuthError++
	AuthError9 = • Location field is required.`n
}

AuthError10 =
If (StrLen(SvcContactName)=0)
{
	AuthError++
	AuthError10 = • Contact Name field is required.`n
}

AuthError11 =
If (StrLen(SvcContactPhone)=0)
{
	AuthError++
	AuthError11 = • Contact Phone field is required.`n
}

AuthError12 =
If (StrLen(Reason)=0)
{
	AuthError++
	AuthError12 = • Reason For Service field is required.`n
}

If (AuthError <> 0)
{
	MsgBox, 16, Validation Error!, Please correct the following issues:`n`n%AuthError1%%AuthError2%%AuthError3%%AuthError4%%AuthError5%%AuthError6%%AuthError7%%AuthError8%%AuthError9%%AuthError10%%AuthError11%%AuthError12%
}
Return

SupAuthenticate:
AuthError = 0

AuthError1 =
If (SO = 0 AND OS = 0 AND RMA = 0)
{
	AuthError++
	AuthError1 = • Request type not selected.`n
}

AuthError2 =
If (SO = 1 AND BestWay = 0 AND Overnight = 0 AND Other = 0)
{
	AuthError++
	AuthError2 = • Ship Method is required for all orders.`n
}

AuthError3 =
If (StrLen(SupEquipID)=0 AND StrLen(SupMakeModel)=0 AND StrLen(SupSerial)=0)
{
	AuthError++
	AuthError3 = • At least one of the following are required:`n     Equipment ID, Serial, Make/Model.`n
}

AuthError4 =
If (StrLen(SupCompanyName)=0)
{
	AuthError++
	AuthError4 = • Company Name field is required.`n
}

AuthError5 =
If (StrLen(SupAddress1)=0)
{
	AuthError++
	AuthError5 = • Address Line 1 field is required.`n
}

AuthError6 =
If (StrLen(SupCity)=0)
{
	AuthError++
	AuthError6 = • City field is required.`n
}

AuthError7 =
If ((StrLen(SupState) <>2) OR (!InStr(StatesList, SupState)))
{
   AuthError++
   AuthError7 = • State selection invalid.`n
}

AuthError8 =
If (StrLen(SupZip)<>5)
{
	AuthError++
	AuthError8 = • Zip field is required and must be 5 characters long.`n
}

AuthError9 =
If ((OS = 1) AND (StrLen(SupOrderNum) = 0))
{
	AuthError++
	AuthError9 = • Order Number required for 'Order Status' inquiries.`n
}

AuthError10 =
If (StrLen(SupContactName)=0)
{
	AuthError++
	AuthError10 = • Contact Name field is required.`n
}

AuthError11 =
If (StrLen(SupContactPhone)=0)
{
	AuthError++
	AuthError11 = • Contact Phone field is required.`n
}

AuthError12 =
If (((StrLen(Sup1)=0) OR If (StrLen(Qty1)=0)) AND If ((RMA = 1) OR (SO = 1)))
{
	AuthError++
	AuthError12 = • At least one product type and quantity are required.`n
}

If (AuthError <> 0)
{
	MsgBox, 16, Validation Error!, Please correct the following issues:`n`n%AuthError1%%AuthError2%%AuthError3%%AuthError4%%AuthError5%%AuthError6%%AuthError7%%AuthError8%%AuthError9%%AuthError10%%AuthError11%%AuthError12%
}
Return

CCAuthenticate:
AuthError = 0

AuthError1 =
If (BSR = 0 AND CSR = 0 AND MR = 0 AND TSR = 0 AND LEAD = 0 AND OTH = 0)
{
	AuthError++
	AuthError1 = • Request type not selected.`n
}

AuthError2 =
If (StrLen(Issue)=0)
{
	AuthError++
	AuthError2 = • Customer Issue field is required.`n
}

AuthError4 =
If (StrLen(CCCompanyName)=0)
{
	AuthError++
	AuthError4 = • Company Name field is required.`n
}

AuthError10 =
If (StrLen(CCContactName)=0)
{
	AuthError++
	AuthError10 = • Contact Name field is required.`n
}

AuthError11 =
If (StrLen(CCContactPhone)=0)
{
	AuthError++
	AuthError11 = • Contact Phone field is required.`n
}

AuthError12 =
If ((BSR = 1 OR CSR = 1 OR TSR = 1) AND (StrLen(CCEmail) = 0))
{
	AuthError++
	AuthError12 = • Email Address is required for all SRs.`n
}

If (AuthError <> 0)
{
	MsgBox, 16, Validation Error!, Please correct the following issues:`n`n%AuthError1%%AuthError2%%AuthError3%%AuthError4%%AuthError5%%AuthError6%%AuthError7%%AuthError8%%AuthError9%%AuthError10%%AuthError11%%AuthError12%%AuthError13%
}
Return

SvcSubject:
IfInString, CSF, 1,{
	sCSF := "CSF - "
}
Else,{
	sCSF =
}
IfInString, CXL, 1,{
	sCXL := "CANCELLATION - "
}
Else,{
	sCXL =
}
IfInString, AHS, 1,{
	sAHS := "AHS - "
}
Else,{
	sAHS =
}
IfInString, XN, 1,{
	sXN := "INSTALL-REMOVAL -  "
}
Else,{
	sXN =
}
IfInString, SR, 1,{
	sSR := "SERVICE REQUEST -  "
}
Else,{
	sSR =
}
IfInString, CB, 1,{
	sCB := "CALL BACK -  "
}
Else,{
	sCB =
}
Function = %sCSF%%sCXL%%sSR%%sAHS%%sXN%%sCB%
Return

SupSubject:
IfInString, SO, 1,{
	sSO := "SUPPLIES ORDER - "
	IfInString, BestWay, 1,{
		ShipMethod := "BestWay - "
	}
	IfInString, Overnight, 1,{
		ShipMethod := "Overnight - "
	}
	IfInString, Other, 1,{
		ShipMethod := "Other - "
	}	
}
Else,{
	sSO =
	ShipMethod =
}
IfInString, OS, 1,{
	sOS := "ORDER STATUS - "
}
Else,{
	sOS =
}
IfInString, RMA, 1,{
	sRMA := "RMA - "
}
Else,{
	sRMA =
}

Function = %sRMA%%sOS%%sSO%%ShipMethod%
Return

CCSubject:
IfInString, BSR, 1,{
	sBSR := "BILLING SR - "
}
Else,{
	sBSR =
}
IfInString, CSR, 1,{
	sCSR := "CONTRACT SR - "
}
Else,{
	sCSR =
}
IfInString, TSR, 1,{
	sTSR := "TAX SR - "
}
Else,{
	sTSR =
}
IfInString, MR, 1,{
	sMR := "METER READ -  "
}
Else,{
	sMR =
}
IfInString, LEAD, 1,{
	sLEAD := "LEAD -  "
}
Else,{
	sLEAD =
}
IfInString, OTH, 1,{
	sOTH := "CARE (OTHER) -  "
}
Else,{
	sOTH =
}
Function = %sBSR%%sCSR%%sMR%%sTSR%%sLEAD%%sOTH%
Return

SvcCompose:
FormatTime, TimeStamp, %DateTimeStamp%, Time
FormatTime, DateStamp, %DateTimeStamp%, ShortDate
mailto = %SvcMailto%
subject = %SvcState% - %function% %svccompanyname%
body =
(
%DateStamp% %TimeStamp%
%function%

Equipment ID: %SvcEquipID%
Serial #: %SvcSerial%
Make/Model: %SvcMakeModel%

Company Name: %SvcCompanyName%
Customer #: %SvcCustomerNum%
Address Line 1: %SvcAddress1%
Address Line 2: %SvcAddress2%
City: %SvcCity%
State: %SvcState%
Zip: %SvcZip%

Contact Name: %SvcContactName%
Contact Phone: %SvcContactPhone%
Equipment Location: %SvcLocation%

Reason for Service: %Reason%

PO #: %SvcPO%
AHS Signature: %AHSAuth%
)
Text := Body
StringReplace, Reason, Reason, `%,`%25, all
StringReplace, Body, Body, `n,`%0A, all
Return

SupCompose:
FormatTime, TimeStamp, %DateTimeStamp%, Time
FormatTime, DateStamp, %DateTimeStamp%, ShortDate
mailto = %SupMailto%
subject = %function% %supcompanyname%

If (SO = 1)
{
body =
(
%DateStamp% %TimeStamp%
%function%
Equipment ID: %SupEquipID%
Serial #: %SupSerial%
Make/Model: %SupMakeModel%
Company Name: %SupCompanyName%
Customer #: %SupCustomerNum%
Address Line 1: %SupAddress1%
Address Line 2: %SupAddress2%
City: %SupCity%
State: %SupState%
Zip: %SupZip%
Contact Name: %SupContactName%
Contact Phone: %SupContactPhone%
Deferral Reason: %Defer%
PO#: %SupPO%
Supplies Needed:
%Sup1% - %Qty1%, %Sup2% - %Qty2%
%Sup3% - %Qty3%, %Sup4% - %Qty4%
%Sup5% - %Qty5%, %Sup6% - %Qty6%
%Sup7% - %Qty7%, %Sup8% - %Qty8%
%Sup9% - %Qty9%, %Sup10% - %Qty10%
%Sup11% - %Qty11%, %Sup12% - %Qty12%
)
}

If (OS = 1 OR RMA = 1)
{
body =
(
%DateStamp% %TimeStamp%
%function%
Equipment ID: %SupEquipID%
Serial #: %SupSerial%
Make/Model: %SupMakeModel%
Company Name: %SupCompanyName%
Customer #: %SupCustomerNum%
Address Line 1: %SupAddress1%
Address Line 2: %SupAddress2%
City: %SupCity%
State: %SupState%
Zip: %SupZip%
Contact Name: %SupContactName%
Contact Phone: %SupContactPhone%
Deferral Reason: %Defer%
PO#: %SupPO%
Order #: %SupOrderNum%
Supplies Needed:
%Sup1% - %Qty1%, %Sup2% - %Qty2%
%Sup3% - %Qty3%, %Sup4% - %Qty4%
%Sup5% - %Qty5%, %Sup6% - %Qty6%
%Sup7% - %Qty7%, %Sup8% - %Qty8%
%Sup9% - %Qty9%, %Sup10% - %Qty10%
%Sup11% - %Qty11%, %Sup12% - %Qty12%
)
}

Text := Body
StringReplace, Reason, Reason, `%,`%25, all
StringReplace, Body, Body, `n,`%0A, all
Return

CCCompose:
FormatTime, TimeStamp, %DateTimeStamp%, Time
FormatTime, DateStamp, %DateTimeStamp%, ShortDate
mailto = %CCMailto%
subject = %function% %cccompanyname%
body =
(
%DateStamp% %TimeStamp%
%function%

Equipment ID: %CCEquipID%
Serial #: %CCSerial%
Make/Model: %CCMakeModel%

Company Name: %CCCompanyName%
Customer #: %CCCustomerNum%
Address Line 1: %CCAddress1%
Address Line 2: %CCAddress2%
City: %CCCity%
State: %CCState%
Zip: %CCZip%

Contact Name: %CCContactName%
Contact Phone: %CCContactPhone%
Contact Fax: %CCFax%
Contact Email: %CCEmail%

Customer Issue: %Issue%
)
Text := Body
StringReplace, Reason, Reason, `%,`%25, all
StringReplace, Body, Body, `n,`%0A, all
Return

Upper:
StringUpper, text, text
StringUpper, body, body
StringUpper, subject, subject
Return

CreateFile:
FileAppend, %text%, \\network_path\~ERCALLS\%DateTimeStamp% - %subject% - %A_UserName%.txt
If (%ErrorLEvel% <> 0)
{
MsgBox, Error Writing Remote File!
}
FileCreateDir, %A_MyDocuments%\~ERCALLS\
If (%ErrorLEvel% <> 0)
{
MsgBox, Error Creating Local ER Directory!
}
FileAppend, %text%, %A_MyDocuments%\~ERCALLS\%DateTimeStamp% - %subject% - %A_UserName%.txt
If (%ErrorLEvel% <> 0)
{
MsgBox, Error Writing Local File!
}
Return

Send:
run, mailto:%mailto%?subject=%subject%&body=%body%
Return

Clear:
Loop, 2 ;Why this doesn't reliably completely uncheck everything on the 1st run?
{
	;First we clear the boxes and radio buttons, because they need '0' to be clear...
	Boxes = SR|CXL|CSF|CB|AHS|XN|SO|OS|RMA|BestWay|Overnight|Other|BSR|CSR|MR|TSR|LEAD|OTH
	StringSplit, Boxes_Array, Boxes, |
	Loop, %Vars_Array0%
	{
		BoxName := Boxes_Array%a_index%
		GuiControl, , %BoxName%, 0
	}
	;Next we clear the text boxes, because they need <null> to be clear...
	Vars = SvcEquipID|SvcSerial|SvcMakeModel|SvcCompanyName|SvcCustomerNum|SvcAddress1|SvcAddress2|SvcCity|SvcState|SvcZip|SvcContactName|SvcContactPhone|SvcLocation|SvcPO|AHSAuth|Reason|SupEquipID|SupSerial|SupMakeModel|SupCompanyName|SupCustomerNum|SupAddress1|SupAddress2|SupCity|SupState|SupZip|SupContactName|SupContactPhone|SupLocation|SupPO|Defer|Sup1|Sup2|Sup3|Sup4|Sup5|Sup6|Sup7|Sup8|Sup9|Sup10|Sup11|Sup12|Qty1|Qty2|Qty3|Qty4|Qty5|Qty6|Qty7|Qty8|Qty9|Qty10|Qty11|Qty12|CCEquipID|CCSerial|CCMakeModel|CCCompanyName|CCCustomerNum|CCAddress1|CCAddress2|CCCity|CCState|CCZip|CCContactName|CCContactPhone|CCFax|CCEmail|Issue
	StringSplit, Vars_Array, Vars, |
	Loop, %Vars_Array0%
	{
		VarName := Vars_Array%a_index%
		GuiControl, , %VarName%
	}
}
Return

View:
InvNum =
Gui Submit, NoHide
If (StrLen(InvNum)=0)
{	MsgBox,16,Error, Please enter an invoice number!
	Return
}
If (StrLen(InvNum)=9)
{	run http://cs/idmws/ShowInvoice.asp?Invoice=%InvNum%
	Return
}
Else
{	MsgBox,16,Error, Invoices must be 9 digits long!
}
Return

CCOtherWarn:
MsgBox, 48, Notice!,
(
If your caller is requesting to make an invoice payment
please inform them “Due to a system upgrade I am
currently unable to process payment transactions.
Could you please call back at a later time?”
)
Return

KillSplash:
SetTimer, KillSplash, Off
SplashImage, Off
Return

GuiClose:
ExitApp

/*
;Debugging use only - Do not include in compiled script!
;Alt + R = Reload Form
!r::
Reload
Return

;Alt + Shift + V = List Variables
+!V::
ListVars
Return

Special Thanks:
BoBo for the %0A line break in mailto tip
Tonne for the great URL encoding link
engunneer for offering a more sane solution to my shared fields problem
daniel2 for showing me an example of how tabs can contain a variable and a subroutine call
Seabiscuit (and Tonne) for helping me with IF functions