Monday, August 8, 2016

GoFundMe Calculator

GoFundMe Calculator V1.0

If you use GoFundMe or plan to in the future then you will find out that they charge a fee. Of course they do, they don't have to do anything for anyone and as they state on their website (and it most certainly makes sense to me) if you see anyone claiming to do it for free then more than likely it is a scam. I don't like being charged any more than anyone else, but I have to be grateful for a service that wouldn't be avaible otherwise; at least not as easily.

The fee they charge uses a formula with a percentage of the full donation + a fee for each card transaction that is ran through a card processing company. In the end (and IMHO) the fees really aren't that bad. But most people would never know exaclty what they will receive until the final withdrawal (or you do the math yourself of course). GoFundMe pricing can and formulas can be found here: GoFundMe Pricing Page, but today I bring you GoFundMe Calculator V1.0!

GoFundMe Calculator V1.0 calculates the total your recipient receives by providing the total donation and the total number of donations. This will work for all country regions and various VAT percentages in those respective countries. You can also use this before you even start the fund to estimate how much you need to aim for.


Note: This has been tested in the US and the math should all be good, but I am only 99% I did the VAT math right so if I can get a European/UK friend to verify this is accurate for VATs I would appreciate it.

Images

Script

As with most of my programs (mostly written in AutoHotkey) I provide the source.

; GoFundMe Calculator
#NoTrayIcon
OnExit, GuiClose
OnMessage(0x3,"WM_MOVE")
OnMessage(0x200, "WM_MOUSEMOVE")

; Init
#SingleInstance, Force

;Build Gui
Gui, Font, s11 cBlack, Segoe UI
Gui, Add, Text, xm ym w200, Donation Total:
Gui, Add, Edit, w200 vvTotal
Gui, Add, Text, w200, Donation Count:
Gui, Add, Edit, w200 vvDCount
Gui, Show, Autosize, GoFundMe Calculator
WinGet, vClst, ControlList, GoFundMe Calculator
Loop, Parse, vClst, `n
 {
  ControlGetPos, vX, vY, vW, vH, % A_LoopField, GoFundMe Calculator
  If !vTop
   vTop := vY - 23
  If !vLeft
   vLeft := vX
  vBttnX := (vX + vW) + 8
  vBttnH := (vY + vH) - 31
  vNextArea := vBttnH + 13
 }
Gui, Add, Button, y%vTop% x%vBttnX% ggsSbmtTtl vvBttnMv, Calculate
GuiControl, Move, vBttnMv, y%vTop% x%vBttnX% h%vBttnH%
ControlGetPos, , , vWb, , Button1, GoFundMe Calculator
Gui, Font, s14 cRed, Segoe UI
Gui, Add, Text, x%vLeft% y%vNextArea% w200, You'll Receive:
Gui, Font, s11 cBlack, Segoe UI
Gui, Add, Button,  x%vBttnX% yp w%vWb% vvBttnMvb, Info
ControlGetPos, , vYc, ,vHc, Button2, GoFundMe Calculator
Gui, Font, s14 cRed, Segoe UI
Gui, Add, Text, x%vLeft% y%vYc% w200 vvFnl,
ControlGetPos, , , ,vHd, Static3, GoFundMe Calculator
ControlGetPos, , , ,vHe, Static4, GoFundMe Calculator
vNfoH := vHd + vHe
GuiControl, Move, vBttnMvb, h%vNfoH%
Gui, Font, s11 cBlack, Segoe UI
Gui, Add, DropDownList, w200 vvCntrChc, US/Canada||United Kingdom|Australia Only|Charities|International (VAT 17`%)|International (VAT 19`%)|International (VAT 20`%)|International (VAT 21`%)|International (VAT 22`%)|International (VAT 23`%)|International (VAT 24`%)
Gui, Font, s7 cBlack, Segoe UI
vLnkMrgn := vBttnX + 8
Gui, Add, Link, x%vLnkMrgn% yp, My Deviant
Gui, Add, Link, x%vLnkMrgn% yp+16, Microcosm
Gui, Show, Autosize, GoFundMe Calculator

Return

; Functions
MouseOver(vXa, vYa, vXb, vYb)
 {
  MouseGetPos, vPx, vPy
  vDtct := vPx >= vXa AND vPx <= vXb AND vPy >= vYa AND vPy <= vYb
  Return vDtct
 }
WM_MOUSEMOVE(){
 If MouseOver("19", "218", "219", "247") Or MouseOver("16", "61", "216", "89") Or MouseOver("16", "125", "216", "153")
  {
   If MouseOver("19", "218", "219", "247")
    ToolTip % "Select your region here."
   If MouseOver("16", "61", "216", "89")
    ToolTip % "Enter donation total here..."
   If MouseOver("16", "125", "216", "153")
    ToolTip % "Enter donation count here. Not needed for charities."
  }
 Else
  ToolTip
}

WM_MOUSELEAVE(){
 ToolTip
}
WM_MOVE(wParam, lParam){
 IfWinExist, GoFundMe Calculator Info
  Gosub, gsChckMsgBx
 IfWinExist, GoFundMe Calculator Error
  Gosub, gsChckErr
}
fncCalcDonation(va,vb,vc){
 If !va
  {
   SetTimer, gsChckErr, -201
     
   MsgBox, 16, GoFundMe Calculator Error, % "Donation Total not provided..."
   Return
  }
 If (vc = "US/Canada")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl :=Round(va - ((va * .079) + (vb * .30)), 2)
  }
 If (vc = "United Kingdom")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .064)+((vb * .20) + (vb * .20))), 2)
  }
 If (vc = "Australia Only")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .0675)+(vb * .30)), 2)
  }
 If (vc = "Charities")
  {
   If vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Charities does not need Donation Count..."
     Return    
    }
   vTtl := Round(va - (va * .0925), 2)
  }
 If (vc = "International (VAT 17%)")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .079)+((vb * .25) + (vb * .17))), 2)
  }
 If (vc = "International (VAT 19%)")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .079)+((vb * .25) + (vb * .19))), 2)
  }
 If (vc = "International (VAT 20%)")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .079)+((vb * .25) + (vb * .20))), 2)
  }
 If (vc = "International (VAT 21%)")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .079)+((vb * .25) + (vb * .21))), 2)
  }
 If (vc = "International (VAT 22%)")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .079)+((vb * .25) + (vb * .22))), 2)
  }
 If (vc = "International (VAT 23%)")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .079)+((vb * .25) + (vb * .23))), 2)
  }
 If (vc = "International (VAT 24%)")
  {
   If !vb
    {
     SetTimer, gsChckErr, -201      
     MsgBox, 16, GoFundMe Calculator Error, % "Enter both numbers and try again..."
     Return
    }
   vTtl := Round(va - ((va * .079)+((vb * .25) + (vb * .24))), 2)
  }
 If vTtl Contains -
  vTtl = 0
 Return vTtl
}
fncMvMsgBx(vPTitle, vCTitle, vTtMtchMd := "Fast"){
 SetTitleMatchMode, % vTtMtchMd
 IfWinExist, % vCTitle
  {
   WinGetPos, vCx, vCy, vCw, vCh, % vPTitle
   WinGetPos, , , vDw, vDh, % vCTitle
   vMy := vCy + vCh + 13
   If (vCw < vDw)
    vNx := vCx - ((vDw - vCw) / 2)
   Else
    vNx := vCx + ((vCw - vDw) / 2)
   WinMove, % vCTitle, , %vNx% ,%vMy%
  }
 WinActivate, GoFundMe Calculator
 SetTitleMatchMode, Fast

}
fncInfo(){
 SetTimer, gsChckMsgBx, -201
 Sleep, 1
 Gui, Info: New
 nf("12")
 Gui, Info: Add, Text, xm ym, % "Information about GoFundMe pricing can be found here:"
 Gui, Info: Show, , GoFundMe Calculator Info
 ControlGetPos, , , , vHg, Static1, GoFundMe Calculator Info
 Gui, Info: Add, Link, xp yp+%vHg% , GoFundMe Pricing Page
 Gui, Info: Show, , GoFundMe Calculator Info
 ControlGetPos, , , ,vHf , SysLink1, GoFundMe Calculator Info
 Gui, Info: Add, Text, xp yp+%vHf%, % "Select your region and enter the Donations Total and"
          . "`nthe Donations Count and click the [Calculate] button."
          . "`nPrices vary per country."
          . "`n`nNote: This calculator should be accurate within a cent"
          . "`nor two as it is rounded to the closest cent. If you have"
          . "`nany errors, questions, or any feedback in general, please"
          . "`nsend any inqueries to:"
 Gui, Info: Show, , GoFundMe Calculator Info
 ControlGetPos, , vYe, ,vHe , Static2, GoFundMe Calculator Info
 Gui, Info: Add, Link, xp yp+%vHe%, faithnomoread@yahoo.com
 Gui, Info: Show, Autosize, GoFundMe Calculator Info
}
nf(vs := "11",vc := "Black",vf := "Segoe UI"){
 Gui, Info: Font, s%vs% c%vc%, %vf%
}

; Gosubs
ButtonInfo:
 SetTimer, gsChckMsgBx, -201
 Sleep, 1
 fncInfo()
Return
gsChckMsgBx:
 fncMvMsgBx("GoFundMe Calculator", "GoFundMe Calculator Info", "3")
Return
gsChckErr:
 fncMvMsgBx("GoFundMe Calculator", "GoFundMe Calculator Error", "3")
Return
gsSbmtTtl:
 Gui, Submit, NoHide
 GuiControl, , vFnl, % fncCalcDonation(vTotal, vDCount, vCntrChc)
Return
GuiClose:
 ExitApp