| 1 |
nino.borges |
596 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
SOW_Automator
|
| 4 |
|
|
Created by
|
| 5 |
|
|
Emanuel Borges
|
| 6 |
|
|
12.07.2015
|
| 7 |
|
|
|
| 8 |
|
|
Class to help automate the process of making and editing those SOWs.
|
| 9 |
nino.borges |
597 |
This program is windows only, since it automates Word and Excel.
|
| 10 |
|
|
(also it uses Spinbutton instead of spinControl, which is win only.)
|
| 11 |
nino.borges |
596 |
|
| 12 |
|
|
|
| 13 |
|
|
"""
|
| 14 |
|
|
|
| 15 |
|
|
import RelativityLib,os,shutil,time,WordLib, wx
|
| 16 |
nino.borges |
597 |
import wx.lib.agw.pybusyinfo as PBI
|
| 17 |
nino.borges |
596 |
#from win32com.client import Dispatch
|
| 18 |
|
|
|
| 19 |
|
|
|
| 20 |
|
|
class CreateSOW(object):
|
| 21 |
nino.borges |
598 |
version = "1.03"
|
| 22 |
nino.borges |
596 |
|
| 23 |
|
|
def __init__(self,salesPersonLastName, clientName, clientOffice, projectName, contractType,workflow):
|
| 24 |
|
|
"""lastname of the sales person"""
|
| 25 |
|
|
#self.salesPersonFirstName = salesPersonFirstName
|
| 26 |
|
|
self.contractType = contractType
|
| 27 |
|
|
self.workflow = workflow
|
| 28 |
|
|
self.salesPersonLastName = salesPersonLastName
|
| 29 |
|
|
self.GetAddress()
|
| 30 |
|
|
self.salesPersonFullName = "%s, %s"%(salesPersonLastName,self.salesPersonFirstName)
|
| 31 |
|
|
self.clientName = clientName
|
| 32 |
|
|
self.clientOffice = clientOffice
|
| 33 |
|
|
self.projectName = projectName
|
| 34 |
|
|
self.tempDir = os.getenv('TEMP')
|
| 35 |
|
|
self.userName = os.getenv('USERNAME')
|
| 36 |
|
|
if self.userName == "Emanual Borges":
|
| 37 |
|
|
self.sowFinalPath = r"C:\Users\Emanual Borges\OneDrive - Advanced Discovery\Documents\SOW"
|
| 38 |
|
|
self.sowTemplatePath = r"C:\Users\Emanual Borges\OneDrive - Advanced Discovery\Documents\SOW\_Template"
|
| 39 |
|
|
else:
|
| 40 |
|
|
self.sowFinalPath = self.userName = os.path.join(os.getenv('USERPROFILE'),'Desktop')
|
| 41 |
|
|
self.sowTemplatePath = os.getcwd()
|
| 42 |
|
|
#self.proposalTemplateFileName = r"Proposal2.docx"
|
| 43 |
|
|
if contractType == "SOW":
|
| 44 |
|
|
self.sowTemplateFileName = r"SOW Template2.docx"
|
| 45 |
|
|
else:
|
| 46 |
|
|
self.sowTemplateFileName = r"Proposal2.docx"
|
| 47 |
|
|
#self.wordApp = Dispatch('Word.Application')
|
| 48 |
nino.borges |
597 |
## some in the init paren and some here?
|
| 49 |
|
|
self.dataCollectionCost = None
|
| 50 |
|
|
self.consultingServicesCost = None
|
| 51 |
|
|
self.forensicAnalysisCost = None
|
| 52 |
|
|
self.ecaProcessingCost = None
|
| 53 |
|
|
self.nativePromotionCost = None
|
| 54 |
|
|
self.ocrCost = None
|
| 55 |
|
|
self.flocrCost = None
|
| 56 |
|
|
self.analyticsProcessingCost = None
|
| 57 |
|
|
self.projectManagementCost = None
|
| 58 |
|
|
self.monthlyHostingCost = None
|
| 59 |
|
|
self.monthlyUserCost = None
|
| 60 |
nino.borges |
596 |
|
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
def GetAddress(self):
|
| 64 |
|
|
"""Returns the full address for the sales person"""
|
| 65 |
|
|
#test = RelativityLib.Relativity_Connection()
|
| 66 |
|
|
db = RelativityLib.CustomObjectTable('BORGES_01_DEMO','Sales_People')
|
| 67 |
|
|
for num, name in db.itemMatrix.iteritems():
|
| 68 |
|
|
if self.salesPersonLastName == str(name):
|
| 69 |
|
|
salesPersonID = num
|
| 70 |
|
|
db.LoadSingleItem(salesPersonID)
|
| 71 |
|
|
for i in db.currentItems:
|
| 72 |
|
|
self.salesPersonDisplayName = i['Sales_Person_DisplayName']
|
| 73 |
|
|
self.salesPersonTitle = i['Title']
|
| 74 |
|
|
self.salesPersonStreetAddress = i['Street_Address']
|
| 75 |
|
|
self.salesPersonCity = i['City']['Name']
|
| 76 |
|
|
self.salesPersonState = i['State']['Name']
|
| 77 |
|
|
self.salesPersonZipcode = i['Zipcode']
|
| 78 |
|
|
self.salesPersonPhoneNumber = i['Phone_Number']
|
| 79 |
|
|
self.salesPersonEmailAddress = i['Email_Address']
|
| 80 |
|
|
self.salesPersonFirstName = i['Sales_Person_FirstName']
|
| 81 |
|
|
|
| 82 |
|
|
def ProcessSOW(self):
|
| 83 |
|
|
"""Once everything is ready, this is called to create the actual work"""
|
| 84 |
|
|
## Copy and rename the template, after checking if it already exists.
|
| 85 |
|
|
newFileName = "%s%s%s_%s-%s_%s.docx"%(self.salesPersonFirstName[0],
|
| 86 |
|
|
self.salesPersonLastName[0],
|
| 87 |
|
|
time.strftime("%m%d%Y"),
|
| 88 |
|
|
self.clientName,
|
| 89 |
|
|
self.clientOffice,
|
| 90 |
|
|
self.projectName)
|
| 91 |
|
|
if os.path.isfile(os.path.join(self.sowFinalPath,newFileName)):
|
| 92 |
|
|
print "ERROR: File Already Exists."
|
| 93 |
|
|
else:
|
| 94 |
|
|
#shutil.copyfile(os.path.join(self.sowTemplatePath,self.sowTemplateFileName),os.path.join(self.sowFinalPath,newFileName))
|
| 95 |
|
|
shutil.copyfile(os.path.join(self.sowTemplatePath,self.sowTemplateFileName),os.path.join(self.tempDir,newFileName))
|
| 96 |
|
|
#self.GetAddress()
|
| 97 |
|
|
print self.salesPersonDisplayName
|
| 98 |
|
|
print self.salesPersonTitle
|
| 99 |
|
|
print self.salesPersonStreetAddress
|
| 100 |
|
|
print self.salesPersonCity
|
| 101 |
|
|
print self.salesPersonState
|
| 102 |
|
|
print self.salesPersonZipcode
|
| 103 |
|
|
print self.salesPersonPhoneNumber
|
| 104 |
|
|
print self.salesPersonEmailAddress
|
| 105 |
|
|
#self.search_replace_all(os.path.join(self.sowFinalPath,newFileName), "<<ProjectName>>", self.projectName)
|
| 106 |
|
|
## Open document and start finding and replacing.
|
| 107 |
|
|
wa = WordLib.WordConnection(os.path.join(self.tempDir,newFileName))
|
| 108 |
|
|
wa.search_replace_all("<<Client>>",self.clientName)
|
| 109 |
|
|
wa.search_replace_all("<<ProjectName>>",self.projectName)
|
| 110 |
|
|
wa.search_replace_all("<<SalesPersonName>>",self.salesPersonDisplayName)
|
| 111 |
|
|
wa.search_replace_all("<<SalesPersonTitle>>",self.salesPersonTitle)
|
| 112 |
|
|
wa.search_replace_all("<<SalesPersonAddress>>",self.salesPersonStreetAddress)
|
| 113 |
|
|
wa.search_replace_all("<<SalesPersonCityStateZip>>","%s, %s %s"%(self.salesPersonCity, self.salesPersonState, self.salesPersonZipcode))
|
| 114 |
|
|
wa.search_replace_all("<<SalesPersonPhone>>",self.salesPersonPhoneNumber)
|
| 115 |
|
|
wa.search_replace_all("<<SalesPersonEmail>>",self.salesPersonEmailAddress)
|
| 116 |
|
|
wa.search_replace_all("<<FileName>>",os.path.splitext(newFileName)[0])
|
| 117 |
|
|
if self.workflow == "Xpress":
|
| 118 |
|
|
wa.table_row_delete(2,9)
|
| 119 |
|
|
wa.table_row_delete(2,9)
|
| 120 |
|
|
wa.table_row_delete(2,9)
|
| 121 |
|
|
wa.table_row_delete(3,9)
|
| 122 |
|
|
wa.table_row_delete(3,9)
|
| 123 |
|
|
wa.table_row_delete(3,9)
|
| 124 |
|
|
else:
|
| 125 |
|
|
wa.table_row_delete(2,7)
|
| 126 |
|
|
wa.table_row_delete(2,7)
|
| 127 |
|
|
|
| 128 |
|
|
wa.table_row_delete(3,7)
|
| 129 |
|
|
wa.table_row_delete(3,7)
|
| 130 |
nino.borges |
597 |
wa.search_replace_all("<<DataCollectionCost>>",self.dataCollectionCost)
|
| 131 |
|
|
wa.search_replace_all("<<ConsultingServicesCost>>",self.consultingServicesCost)
|
| 132 |
|
|
wa.search_replace_all("<<ForensicAnalysisCost>>",self.forensicAnalysisCost)
|
| 133 |
|
|
wa.search_replace_all("<<EcaProcessingCost>>",self.ecaProcessingCost)
|
| 134 |
|
|
wa.search_replace_all("<<NativePromotionCost>>",self.nativePromotionCost)
|
| 135 |
|
|
wa.search_replace_all("<<OcrCost>>",self.ocrCost)
|
| 136 |
|
|
wa.search_replace_all("<<FlocrCost>>",self.flocrCost)
|
| 137 |
|
|
wa.search_replace_all("<<AnalyticsProcessingCost>>",self.analyticsProcessingCost)
|
| 138 |
|
|
wa.search_replace_all("<<ProjectManagementCost>>",self.projectManagementCost)
|
| 139 |
|
|
wa.search_replace_all("<<MonthlyHostingCost>>",self.monthlyHostingCost)
|
| 140 |
|
|
wa.search_replace_all("<<MonthlyUserCost>>",self.monthlyUserCost)
|
| 141 |
nino.borges |
596 |
wa.Save()
|
| 142 |
|
|
wa.Close()
|
| 143 |
|
|
os.rename(os.path.join(self.tempDir,newFileName),os.path.join(self.sowFinalPath,newFileName))
|
| 144 |
|
|
|
| 145 |
|
|
|
| 146 |
|
|
class MyFrame(wx.Frame):
|
| 147 |
|
|
def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
|
| 148 |
|
|
print "CWD is %s"%os.getcwd()
|
| 149 |
nino.borges |
597 |
wx.Frame.__init__(self, parent, ID, title, pos, size =(400,550))#(550,580))
|
| 150 |
nino.borges |
596 |
self.panel = wx.Panel(self,-1)
|
| 151 |
nino.borges |
597 |
self.notebook = wx.Notebook(self.panel)
|
| 152 |
|
|
|
| 153 |
|
|
self.tab1 = MainPage(self.notebook)
|
| 154 |
|
|
self.tab2 = PricingPage(self.notebook)
|
| 155 |
|
|
|
| 156 |
|
|
self.notebook.AddPage(self.tab1, "Required")
|
| 157 |
|
|
self.notebook.AddPage(self.tab2, "Pricing")
|
| 158 |
|
|
|
| 159 |
|
|
sizer = wx.BoxSizer()
|
| 160 |
|
|
sizer.Add(self.notebook, 1, wx.EXPAND)
|
| 161 |
|
|
self.panel.SetSizer(sizer)
|
| 162 |
|
|
|
| 163 |
|
|
self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.tab1.cancelButton)
|
| 164 |
|
|
self.Bind(wx.EVT_BUTTON, self.OnProcess, self.tab1.oKButton)
|
| 165 |
|
|
|
| 166 |
|
|
|
| 167 |
|
|
def CloseWindow(self, event):
|
| 168 |
|
|
self.Close(True)
|
| 169 |
|
|
|
| 170 |
|
|
def OnProcess(self, event):
|
| 171 |
|
|
print self.tab1.clientNameTextBox.GetValue()
|
| 172 |
|
|
print self.tab1.projectNameTextBox.GetValue()
|
| 173 |
|
|
print self.tab1.officeLocationTextBox.GetValue()
|
| 174 |
|
|
print self.tab1.salesPersonChoice.GetStringSelection()
|
| 175 |
|
|
if self.tab1.hostedRadio1.GetValue():
|
| 176 |
|
|
print "Xpress Selected"
|
| 177 |
|
|
workflow = "Xpress"
|
| 178 |
|
|
elif self.tab1.hostedRadio2.GetValue():
|
| 179 |
|
|
print "NonHosted Selected"
|
| 180 |
|
|
workflow = "Non-Hosted"
|
| 181 |
|
|
if self.tab1.sowOrProposalRadio1.GetValue():
|
| 182 |
|
|
print "SOW Selected"
|
| 183 |
|
|
contractType= "SOW"
|
| 184 |
|
|
elif self.tab1.sowOrProposalRadio2.GetValue():
|
| 185 |
|
|
print "Proposal Selected"
|
| 186 |
|
|
contractType = "Proposal"
|
| 187 |
|
|
|
| 188 |
|
|
print "Creating SOW ..."
|
| 189 |
|
|
message = "Creating your SOW. One moment please..."
|
| 190 |
|
|
busy = PBI.PyBusyInfo(message, parent=self, title="System Busy.")
|
| 191 |
|
|
|
| 192 |
|
|
|
| 193 |
|
|
|
| 194 |
|
|
t = CreateSOW(self.tab1.salesPersonChoice.GetStringSelection(),
|
| 195 |
|
|
self.tab1.clientNameTextBox.GetValue(),
|
| 196 |
|
|
self.tab1.officeLocationTextBox.GetValue(),
|
| 197 |
|
|
self.tab1.projectNameTextBox.GetValue(), contractType, workflow)
|
| 198 |
|
|
|
| 199 |
|
|
t.dataCollectionCost = self.tab2.dataCollectionSpin.GetValue()
|
| 200 |
|
|
t.consultingServicesCost = self.tab2.consultingServicesSpin.GetValue()
|
| 201 |
|
|
t.forensicAnalysisCost = self.tab2.forensicAnalysisSpin.GetValue()
|
| 202 |
|
|
t.ecaProcessingCost = self.tab2.ecaProcessingSpin.GetValue()
|
| 203 |
|
|
t.nativePromotionCost = self.tab2.nativePromotionSpin.GetValue()
|
| 204 |
|
|
t.ocrCost = self.tab2.ocrSpin.GetValue()
|
| 205 |
|
|
t.flocrCost = self.tab2.flocrSpin.GetValue()
|
| 206 |
|
|
t.analyticsProcessingCost = self.tab2.analyticsProcessingSpin.GetValue()
|
| 207 |
|
|
t.projectManagementCost = self.tab2.projectManagementSpin.GetValue()
|
| 208 |
|
|
t.monthlyHostingCost = self.tab2.monthlyHostingSpin.GetValue()
|
| 209 |
|
|
t.monthlyUserCost = self.tab2.userFeesSpin.GetValue()
|
| 210 |
|
|
|
| 211 |
|
|
|
| 212 |
|
|
|
| 213 |
|
|
self.Show(False)
|
| 214 |
|
|
t.ProcessSOW()
|
| 215 |
|
|
del busy
|
| 216 |
|
|
print "SOW Created."
|
| 217 |
|
|
finishedDlg = wx.MessageDialog(self, "A new SOW has been created.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
|
| 218 |
|
|
finishedDlg.ShowModal()
|
| 219 |
|
|
self.Destroy()
|
| 220 |
|
|
|
| 221 |
|
|
class MainPage(wx.Panel):
|
| 222 |
|
|
''' The main notebook tab'''
|
| 223 |
|
|
def __init__(self,parent):
|
| 224 |
|
|
wx.Panel.__init__(self, parent)
|
| 225 |
|
|
self.parent = parent
|
| 226 |
nino.borges |
596 |
print "Connecting to Relativity..."
|
| 227 |
|
|
db = RelativityLib.CustomObjectTable('BORGES_01_DEMO','Sales_People')
|
| 228 |
|
|
#print db.itemMatrix.values()
|
| 229 |
|
|
salesPersonList = db.itemMatrix.values()
|
| 230 |
nino.borges |
597 |
clientNameLabel = wx.StaticText(self, -1, "Client Name: ")
|
| 231 |
|
|
self.clientNameTextBox = wx.TextCtrl(self, -1, "", wx.DefaultPosition, (90,-1))
|
| 232 |
|
|
projectNameLabel = wx.StaticText(self, -1, "Project Name: ")
|
| 233 |
|
|
self.projectNameTextBox = wx.TextCtrl(self, -1, "", wx.DefaultPosition, (90,-1))
|
| 234 |
|
|
officeLocationLabel = wx.StaticText(self, -1, "Office Location: ")
|
| 235 |
|
|
self.officeLocationTextBox = wx.TextCtrl(self, -1, "", wx.DefaultPosition, (90,-1))
|
| 236 |
|
|
salesPersonLabel = wx.StaticText(self, -1, "Sales Person: ",wx.DefaultPosition)
|
| 237 |
|
|
self.salesPersonChoice = wx.Choice(self, -1, wx.DefaultPosition, choices=salesPersonList)
|
| 238 |
nino.borges |
596 |
self.CreateBoxesSection()
|
| 239 |
nino.borges |
597 |
self.sowOrProposalRadio1 = wx.RadioButton(self, -1, 'SOW',style=wx.RB_GROUP)
|
| 240 |
|
|
self.sowOrProposalRadio2 = wx.RadioButton(self, -1, 'Proposal')
|
| 241 |
|
|
self.hostedRadio1 = wx.RadioButton(self, -1, 'Hosted Using Xpress',style=wx.RB_GROUP)
|
| 242 |
|
|
self.hostedRadio2 = wx.RadioButton(self, -1, 'Non-Hosted')
|
| 243 |
nino.borges |
596 |
|
| 244 |
nino.borges |
597 |
sowOrProposalStaticBox = wx.StaticBox(self, -1, 'SOW or Proposal:')
|
| 245 |
nino.borges |
596 |
sowOrProposalStaticBoxSizer = wx.StaticBoxSizer(sowOrProposalStaticBox, wx.HORIZONTAL)
|
| 246 |
|
|
|
| 247 |
|
|
|
| 248 |
|
|
requiredSectionSizer = wx.GridBagSizer(10,2)
|
| 249 |
|
|
requiredSectionSizer.Add(clientNameLabel,pos = (0,0))
|
| 250 |
|
|
requiredSectionSizer.Add(self.clientNameTextBox,pos = (0,1),span=(1,4), flag = wx.EXPAND)
|
| 251 |
|
|
requiredSectionSizer.Add(projectNameLabel,pos = (1,0))
|
| 252 |
|
|
requiredSectionSizer.Add(self.projectNameTextBox,pos = (1,1))
|
| 253 |
|
|
requiredSectionSizer.Add(officeLocationLabel,pos = (2,0))
|
| 254 |
|
|
requiredSectionSizer.Add(self.officeLocationTextBox,pos = (2,1))
|
| 255 |
|
|
requiredSectionSizer.Add(salesPersonLabel,pos = (3,0))
|
| 256 |
|
|
requiredSectionSizer.Add(self.salesPersonChoice,pos = (3,1))
|
| 257 |
|
|
|
| 258 |
|
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 259 |
|
|
sowOrProposalStaticBoxSizer.Add(self.sowOrProposalRadio1, 0, wx.ALL|wx.ALIGN_LEFT,20)
|
| 260 |
|
|
sowOrProposalStaticBoxSizer.Add(self.sowOrProposalRadio2, 0, wx.ALL|wx.ALIGN_LEFT,20)
|
| 261 |
|
|
mainSizer.Add(sowOrProposalStaticBoxSizer,0,wx.ALL, 20)
|
| 262 |
|
|
mainSizer.Add(requiredSectionSizer,0, wx.ALL, 20)
|
| 263 |
|
|
|
| 264 |
nino.borges |
597 |
hostedStaticBox = wx.StaticBox(self, -1, 'Hosted or Non-Hosted:')
|
| 265 |
nino.borges |
596 |
hostedStaticBoxSizer = wx.StaticBoxSizer(hostedStaticBox, wx.HORIZONTAL)
|
| 266 |
|
|
hostedStaticBoxSizer.Add(self.hostedRadio1, 0, wx.ALL|wx.ALIGN_LEFT,20)
|
| 267 |
|
|
hostedStaticBoxSizer.Add(self.hostedRadio2, 0, wx.ALL|wx.ALIGN_LEFT,20)
|
| 268 |
|
|
mainSizer.Add(hostedStaticBoxSizer,0,wx.ALL, 20)
|
| 269 |
nino.borges |
597 |
|
| 270 |
nino.borges |
596 |
|
| 271 |
|
|
mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
|
| 272 |
|
|
|
| 273 |
nino.borges |
597 |
self.SetSizer(mainSizer)
|
| 274 |
nino.borges |
596 |
|
| 275 |
nino.borges |
597 |
#self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
|
| 276 |
|
|
|
| 277 |
nino.borges |
596 |
|
| 278 |
|
|
def CreateBoxesSection(self):
|
| 279 |
nino.borges |
597 |
self.oKButton = wx.Button(self, wx.ID_OK)
|
| 280 |
nino.borges |
596 |
self.oKButton.SetDefault()
|
| 281 |
|
|
self.oKButton.SetSize(self.oKButton.GetBestSize())
|
| 282 |
nino.borges |
597 |
self.cancelButton = wx.Button(self, wx.ID_CANCEL)
|
| 283 |
nino.borges |
596 |
self.cancelButton.SetSize(self.cancelButton.GetBestSize())
|
| 284 |
|
|
self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 285 |
|
|
self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
|
| 286 |
|
|
self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
|
| 287 |
|
|
|
| 288 |
nino.borges |
597 |
|
| 289 |
nino.borges |
596 |
|
| 290 |
nino.borges |
597 |
class PricingPage(wx.Panel):
|
| 291 |
|
|
'''The settings notebook tab'''
|
| 292 |
|
|
def __init__(self,parent):
|
| 293 |
|
|
wx.Panel.__init__(self, parent)
|
| 294 |
|
|
## Replace this with values from Excel
|
| 295 |
|
|
dataCollectionCost = 300
|
| 296 |
nino.borges |
598 |
self.dataCollectionCostLow = 225
|
| 297 |
nino.borges |
597 |
consultingServicesCost = 300
|
| 298 |
nino.borges |
598 |
self.consultingServicesCostLow = 225
|
| 299 |
nino.borges |
597 |
forensicAnalysisCost = 300
|
| 300 |
nino.borges |
598 |
self.forensicAnalysisCostLow = 225
|
| 301 |
nino.borges |
597 |
ecaProcessingCost = 100
|
| 302 |
nino.borges |
598 |
self.ecaProcessingCostLow = 45
|
| 303 |
nino.borges |
597 |
nativePromotionCost = 275
|
| 304 |
nino.borges |
598 |
self.nativePromotionCostLow = 185
|
| 305 |
nino.borges |
597 |
ocrCost = .08
|
| 306 |
nino.borges |
598 |
self.ocrCostLow = .06
|
| 307 |
nino.borges |
597 |
flocrCost = .15
|
| 308 |
nino.borges |
598 |
self.flocrCostLow = .10
|
| 309 |
nino.borges |
597 |
analyticsProcessingCost = 100
|
| 310 |
nino.borges |
598 |
self.analyticsProcessingCostLow = 50
|
| 311 |
nino.borges |
597 |
projectManagementCost = 175
|
| 312 |
nino.borges |
598 |
self.projectManagementCostLow = 150
|
| 313 |
nino.borges |
597 |
monthlyHostingCost = 20
|
| 314 |
nino.borges |
598 |
self.monthlyHostingCostLow = 18
|
| 315 |
nino.borges |
597 |
monthlyUserCost = 100
|
| 316 |
nino.borges |
598 |
self.monthlyUserCostLow = 89
|
| 317 |
nino.borges |
597 |
|
| 318 |
|
|
dataCollectionLabel = wx.StaticText(self, -1, "Onsite/Remote Data Collection: ")
|
| 319 |
|
|
dataCollectionUnitLabel = wx.StaticText(self, -1, "Hour")
|
| 320 |
|
|
self.dataCollectionSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 321 |
|
|
self.dataCollectionSpin.SetRange(1, 1000)
|
| 322 |
|
|
self.dataCollectionSpin.SetValue(dataCollectionCost)
|
| 323 |
|
|
consultingServicesLabel = wx.StaticText(self, -1, "Consulting Services: ")
|
| 324 |
|
|
consultingServicesUnitLabel = wx.StaticText(self, -1, "Hour")
|
| 325 |
|
|
self.consultingServicesSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 326 |
|
|
self.consultingServicesSpin.SetRange(1, 1000)
|
| 327 |
|
|
self.consultingServicesSpin.SetValue(consultingServicesCost)
|
| 328 |
|
|
forensicAnalysisLabel = wx.StaticText(self, -1, "Forensic Analysis: ")
|
| 329 |
|
|
forensicAnalysisUnitLabel = wx.StaticText(self, -1, "Hour")
|
| 330 |
|
|
self.forensicAnalysisSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 331 |
|
|
self.forensicAnalysisSpin.SetRange(1, 1000)
|
| 332 |
|
|
self.forensicAnalysisSpin.SetValue(forensicAnalysisCost)
|
| 333 |
nino.borges |
596 |
|
| 334 |
nino.borges |
597 |
ecaProcessingLabel = wx.StaticText(self, -1, "ECA Processing: ")
|
| 335 |
|
|
ecaProcessingUnitLabel = wx.StaticText(self, -1, "GB")
|
| 336 |
nino.borges |
598 |
self.ecaProcessingSpin = wx.SpinCtrl(self,-1, "TEST", wx.DefaultPosition, (80, -1))
|
| 337 |
nino.borges |
597 |
self.ecaProcessingSpin.SetRange(1, 1000)
|
| 338 |
|
|
self.ecaProcessingSpin.SetValue(ecaProcessingCost)
|
| 339 |
|
|
nativePromotionLabel = wx.StaticText(self, -1, "Native Review Promotion: ")
|
| 340 |
|
|
nativePromotionUnitLabel = wx.StaticText(self, -1, "GB")
|
| 341 |
|
|
self.nativePromotionSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 342 |
|
|
self.nativePromotionSpin.SetRange(1, 1000)
|
| 343 |
|
|
self.nativePromotionSpin.SetValue(nativePromotionCost)
|
| 344 |
|
|
ocrLabel = wx.StaticText(self, -1, "Optical Character Recog.: ")
|
| 345 |
|
|
ocrUnitLabel = wx.StaticText(self, -1, "Document")
|
| 346 |
|
|
self.ocrSpin = wx.SpinCtrlDouble(self,-1, "", wx.DefaultPosition, (80, -1),inc = .01)
|
| 347 |
|
|
self.ocrSpin.SetRange(.01, 10)
|
| 348 |
|
|
self.ocrSpin.SetValue(ocrCost)
|
| 349 |
|
|
flocrLabel = wx.StaticText(self, -1, "OCR Foreign Language: ")
|
| 350 |
|
|
flocrUnitLabel = wx.StaticText(self, -1, "Document")
|
| 351 |
|
|
self.flocrSpin = wx.SpinCtrlDouble(self,-1, "", wx.DefaultPosition, (80, -1),inc = .01)
|
| 352 |
|
|
self.flocrSpin.SetRange(.01, 10)
|
| 353 |
|
|
self.flocrSpin.SetValue(flocrCost)
|
| 354 |
|
|
analyticsProcessingLabel = wx.StaticText(self, -1, "Analytics Processing: ")
|
| 355 |
|
|
analyticsProcessingUnitLabel = wx.StaticText(self, -1, "GB")
|
| 356 |
|
|
self.analyticsProcessingSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 357 |
|
|
self.analyticsProcessingSpin.SetRange(1, 1000)
|
| 358 |
|
|
self.analyticsProcessingSpin.SetValue(analyticsProcessingCost)
|
| 359 |
|
|
|
| 360 |
|
|
projectManagementLabel = wx.StaticText(self, -1, "Project Management: ")
|
| 361 |
|
|
projectManagementUnitLabel = wx.StaticText(self, -1, "Hour")
|
| 362 |
|
|
self.projectManagementSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 363 |
|
|
self.projectManagementSpin.SetRange(1, 1000)
|
| 364 |
|
|
self.projectManagementSpin.SetValue(projectManagementCost)
|
| 365 |
|
|
monthlyHostingLabel = wx.StaticText(self, -1, "Monthly Hosting : ")
|
| 366 |
|
|
monthlyHostingUnitLabel = wx.StaticText(self, -1, "GB/Month")
|
| 367 |
|
|
self.monthlyHostingSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 368 |
|
|
self.monthlyHostingSpin.SetRange(1, 1000)
|
| 369 |
|
|
self.monthlyHostingSpin.SetValue(monthlyHostingCost)
|
| 370 |
|
|
userFeesLabel = wx.StaticText(self, -1, "Monthly User Fee : ")
|
| 371 |
|
|
userFeesUnitLabel = wx.StaticText(self, -1, "User/Month")
|
| 372 |
|
|
self.userFeesSpin = wx.SpinCtrl(self,-1, "", wx.DefaultPosition, (80, -1))
|
| 373 |
|
|
self.userFeesSpin.SetRange(1, 1000)
|
| 374 |
|
|
self.userFeesSpin.SetValue(monthlyUserCost)
|
| 375 |
nino.borges |
596 |
|
| 376 |
nino.borges |
597 |
|
| 377 |
|
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 378 |
|
|
forensicsServicesSizer = wx.GridBagSizer(3,3)
|
| 379 |
|
|
forensicsServicesSizer.Add(dataCollectionLabel, pos = (0,0))
|
| 380 |
|
|
forensicsServicesSizer.Add(self.dataCollectionSpin, pos = (0,1))
|
| 381 |
|
|
forensicsServicesSizer.Add(dataCollectionUnitLabel, pos = (0,2))
|
| 382 |
nino.borges |
596 |
|
| 383 |
nino.borges |
597 |
forensicsServicesSizer.Add(consultingServicesLabel, pos = (1,0))
|
| 384 |
|
|
forensicsServicesSizer.Add(self.consultingServicesSpin, pos = (1,1))
|
| 385 |
|
|
forensicsServicesSizer.Add(consultingServicesUnitLabel, pos = (1,2))
|
| 386 |
|
|
|
| 387 |
|
|
forensicsServicesSizer.Add(forensicAnalysisLabel, pos = (2,0))
|
| 388 |
|
|
forensicsServicesSizer.Add(self.forensicAnalysisSpin, pos = (2,1))
|
| 389 |
|
|
forensicsServicesSizer.Add(forensicAnalysisUnitLabel, pos = (2,2))
|
| 390 |
|
|
|
| 391 |
|
|
processingSizer = wx.GridBagSizer(5,3)
|
| 392 |
|
|
processingSizer.Add(ecaProcessingLabel, pos = (0,0))
|
| 393 |
|
|
processingSizer.Add(self.ecaProcessingSpin, pos = (0,1))
|
| 394 |
|
|
processingSizer.Add(ecaProcessingUnitLabel, pos = (0,2))
|
| 395 |
|
|
processingSizer.Add(nativePromotionLabel, pos = (1,0))
|
| 396 |
|
|
processingSizer.Add(self.nativePromotionSpin, pos = (1,1))
|
| 397 |
|
|
processingSizer.Add(nativePromotionUnitLabel, pos = (1,2))
|
| 398 |
|
|
processingSizer.Add(ocrLabel, pos = (2,0))
|
| 399 |
|
|
processingSizer.Add(self.ocrSpin, pos = (2,1))
|
| 400 |
|
|
processingSizer.Add(ocrUnitLabel, pos = (2,2))
|
| 401 |
|
|
processingSizer.Add(flocrLabel, pos = (3,0))
|
| 402 |
|
|
processingSizer.Add(self.flocrSpin, pos = (3,1))
|
| 403 |
|
|
processingSizer.Add(flocrUnitLabel, pos = (3,2))
|
| 404 |
|
|
processingSizer.Add(analyticsProcessingLabel, pos = (4,0))
|
| 405 |
|
|
processingSizer.Add(self.analyticsProcessingSpin, pos = (4,1))
|
| 406 |
|
|
processingSizer.Add(analyticsProcessingUnitLabel, pos = (4,2))
|
| 407 |
|
|
|
| 408 |
|
|
recurringFeesSizer = wx.GridBagSizer(3,3)
|
| 409 |
|
|
recurringFeesSizer.Add(projectManagementLabel, pos = (0,0))
|
| 410 |
|
|
recurringFeesSizer.Add(self.projectManagementSpin, pos = (0,1))
|
| 411 |
|
|
recurringFeesSizer.Add(projectManagementUnitLabel, pos = (0,2))
|
| 412 |
|
|
recurringFeesSizer.Add(monthlyHostingLabel, pos = (1,0))
|
| 413 |
|
|
recurringFeesSizer.Add(self.monthlyHostingSpin, pos = (1,1))
|
| 414 |
|
|
recurringFeesSizer.Add(monthlyHostingUnitLabel, pos = (1,2))
|
| 415 |
|
|
recurringFeesSizer.Add(userFeesLabel, pos = (2,0))
|
| 416 |
|
|
recurringFeesSizer.Add(self.userFeesSpin, pos = (2,1))
|
| 417 |
|
|
recurringFeesSizer.Add(userFeesUnitLabel, pos = (2,2))
|
| 418 |
|
|
|
| 419 |
|
|
|
| 420 |
|
|
forensicsStaticBox = wx.StaticBox(self, -1, 'Forensics Services')
|
| 421 |
|
|
forensicsStaticBoxSizer = wx.StaticBoxSizer(forensicsStaticBox, wx.HORIZONTAL)
|
| 422 |
|
|
processingStaticBox = wx.StaticBox(self, -1, 'Processing/Review Services')
|
| 423 |
|
|
processingStaticBoxSizer = wx.StaticBoxSizer(processingStaticBox, wx.HORIZONTAL)
|
| 424 |
|
|
recurringFeesStaticBox = wx.StaticBox(self, -1, 'Recurring Fees')
|
| 425 |
|
|
recurringFeesStaticBoxSizer = wx.StaticBoxSizer(recurringFeesStaticBox, wx.HORIZONTAL)
|
| 426 |
|
|
|
| 427 |
|
|
forensicsStaticBoxSizer.Add(forensicsServicesSizer, 0, wx.ALL|wx.ALIGN_LEFT,18)
|
| 428 |
|
|
processingStaticBoxSizer.Add(processingSizer, 0, wx.ALL|wx.ALIGN_LEFT,18)
|
| 429 |
|
|
recurringFeesStaticBoxSizer.Add(recurringFeesSizer, 0, wx.ALL|wx.ALIGN_LEFT,18)
|
| 430 |
|
|
|
| 431 |
|
|
mainSizer.Add(forensicsStaticBoxSizer,0,wx.ALL, 5)
|
| 432 |
|
|
mainSizer.Add(processingStaticBoxSizer,0,wx.ALL, 5)
|
| 433 |
|
|
mainSizer.Add(recurringFeesStaticBoxSizer,0,wx.ALL, 5)
|
| 434 |
|
|
|
| 435 |
|
|
|
| 436 |
|
|
self.SetSizer(mainSizer)
|
| 437 |
nino.borges |
598 |
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.dataCollectionSpin)
|
| 438 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.consultingServicesSpin)
|
| 439 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.forensicAnalysisSpin)
|
| 440 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.ecaProcessingSpin)
|
| 441 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.nativePromotionSpin)
|
| 442 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.ocrSpin)
|
| 443 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.flocrSpin)
|
| 444 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.analyticsProcessingSpin)
|
| 445 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.projectManagementSpin)
|
| 446 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.monthlyHostingSpin)
|
| 447 |
|
|
self.Bind(wx.EVT_TEXT, self.OnPriceChange, self.userFeesSpin)
|
| 448 |
nino.borges |
597 |
|
| 449 |
nino.borges |
598 |
def OnPriceChange(self,evt):
|
| 450 |
|
|
## Test all pricing values and compare to high low.
|
| 451 |
|
|
|
| 452 |
|
|
if self.dataCollectionSpin.GetValue() < self.dataCollectionCostLow:
|
| 453 |
|
|
self.dataCollectionSpin.SetBackgroundColour("Red")
|
| 454 |
|
|
else:
|
| 455 |
|
|
self.dataCollectionSpin.SetBackgroundColour("White")
|
| 456 |
|
|
|
| 457 |
|
|
if self.consultingServicesSpin.GetValue() < self.consultingServicesCostLow:
|
| 458 |
|
|
self.consultingServicesSpin.SetBackgroundColour("Red")
|
| 459 |
|
|
else:
|
| 460 |
|
|
self.consultingServicesSpin.SetBackgroundColour("White")
|
| 461 |
|
|
if self.forensicAnalysisSpin.GetValue() < self.forensicAnalysisCostLow:
|
| 462 |
|
|
self.forensicAnalysisSpin.SetBackgroundColour("Red")
|
| 463 |
|
|
else:
|
| 464 |
|
|
self.forensicAnalysisSpin.SetBackgroundColour("White")
|
| 465 |
|
|
if self.ecaProcessingSpin.GetValue()<self.ecaProcessingCostLow:
|
| 466 |
|
|
self.ecaProcessingSpin.SetBackgroundColour("Red")
|
| 467 |
|
|
else:
|
| 468 |
|
|
self.ecaProcessingSpin.SetBackgroundColour("White")
|
| 469 |
|
|
if self.nativePromotionSpin.GetValue()<self.nativePromotionCostLow:
|
| 470 |
|
|
self.nativePromotionSpin.SetBackgroundColour("Red")
|
| 471 |
|
|
else:
|
| 472 |
|
|
self.nativePromotionSpin.SetBackgroundColour("White")
|
| 473 |
|
|
if self.ocrSpin.GetValue()<self.ocrCostLow:
|
| 474 |
|
|
self.ocrSpin.SetBackgroundColour("Red")
|
| 475 |
|
|
else:
|
| 476 |
|
|
self.ocrSpin.SetBackgroundColour("White")
|
| 477 |
|
|
if self.flocrSpin.GetValue()< self.flocrCostLow:
|
| 478 |
|
|
self.flocrSpin.SetBackgroundColour("Red")
|
| 479 |
|
|
else:
|
| 480 |
|
|
self.flocrSpin.SetBackgroundColour("White")
|
| 481 |
|
|
if self.analyticsProcessingSpin.GetValue()<self.analyticsProcessingCostLow:
|
| 482 |
|
|
self.analyticsProcessingSpin.SetBackgroundColour("Red")
|
| 483 |
|
|
else:
|
| 484 |
|
|
self.analyticsProcessingSpin.SetBackgroundColour("White")
|
| 485 |
|
|
if self.projectManagementSpin.GetValue()<self.projectManagementCostLow:
|
| 486 |
|
|
self.projectManagementSpin.SetBackgroundColour("Red")
|
| 487 |
|
|
else:
|
| 488 |
|
|
self.projectManagementSpin.SetBackgroundColour("White")
|
| 489 |
|
|
if self.monthlyHostingSpin.GetValue()<self.monthlyHostingCostLow:
|
| 490 |
|
|
self.monthlyHostingSpin.SetBackgroundColour("Red")
|
| 491 |
|
|
else:
|
| 492 |
|
|
self.monthlyHostingSpin.SetBackgroundColour("White")
|
| 493 |
|
|
if self.userFeesSpin.GetValue()<self.monthlyUserCostLow:
|
| 494 |
|
|
self.monthlyHostingSpin.SetBackgroundColour("Red")
|
| 495 |
|
|
else:
|
| 496 |
|
|
self.monthlyHostingSpin.SetBackgroundColour("White")
|
| 497 |
|
|
|
| 498 |
|
|
#print evt.EventObject.GetValue()
|
| 499 |
|
|
#evt.EventObject.SetForegroundColour("Red")
|
| 500 |
|
|
#evt.EventObject.SetBackgroundColour("Red")
|
| 501 |
|
|
#print evt.EventObject.GetLabelText()
|
| 502 |
|
|
|
| 503 |
|
|
|
| 504 |
|
|
class MyApp(wx.App):
|
| 505 |
nino.borges |
596 |
def OnInit(self):
|
| 506 |
|
|
self.frame = MyFrame(None, -1, "SOW Creator v %s"%CreateSOW.version)
|
| 507 |
|
|
self.frame.Show(True)
|
| 508 |
|
|
self.SetTopWindow(self.frame)
|
| 509 |
|
|
return True
|
| 510 |
|
|
|
| 511 |
|
|
|
| 512 |
|
|
if __name__ == '__main__':
|
| 513 |
|
|
app = MyApp(0)
|
| 514 |
|
|
app.MainLoop() |