ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/MCP_ViewEdit_UI.py
Revision: 489
Committed: Thu Dec 5 16:36:56 2013 UTC (12 years, 3 months ago) by nino.borges
Content type: text/x-python
File size: 44341 byte(s)
Log Message:
Adding support for adding a case in the console UI.

File Contents

# Content
1 """
2
3 MCP_ViewEdit_UI
4
5 Created by
6 Emanuel Borges
7 03.17.2011
8
9 This is the UI for viewing or editing case info
10
11 """
12
13
14 import wx, MCP_Lib, MCP_Console,os,CurrentProductionsDialog,CaseUploadsDialog,AddDocumentProductionDialog,CasePathsDialog,NinoGenTools,EditVendorFolderDialog,StorageUploadCostsDialog,DisclosureLetterDialog,AddEditCaseNameDialog,AddNewCaseDialog
15 import wx.lib.agw.pybusyinfo as PBI
16 class MyFrame(wx.Frame):
17 def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
18 self.console = MCP_Console.MainConsole()
19
20 wx.Frame.__init__(self, parent, ID, title, pos, size =(550,580))
21 self.panel = wx.Panel(self,-1)
22
23 #self.panel.SetBackgroundColour("yellow green")
24 casesListStaticText = wx.StaticText(self.panel, -1, "Select Case: ",wx.DefaultPosition)
25 #casesList,casesDir = MCP_Lib.GetCaseList()
26 ## TODO: Why are we calling MCP_lib here. self.console already did that and got this.
27 self.myCases, self.myActiveCases, self.officeCases, self.allCases, casesDir,self.casePathStyleMatrix = MCP_Lib.GetCaseList(accessConnectionObj=self.console.accessDB)
28 self.casesListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=self.myCases)
29 self.casesListChoice.SetSelection(0)
30
31 self.uploadCostStaticText = wx.StaticText(self.panel, -1, "", (300, 70), (60, -1), wx.ALIGN_RIGHT)#"Upload:$20", (300, 70), (60, -1), wx.ALIGN_RIGHT)
32 self.storageCostStaticText = wx.StaticText(self.panel, -1, "", (300, 70), (65, -1), wx.ALIGN_RIGHT)#"Storage:$30", (300, 70), (65, -1), wx.ALIGN_RIGHT)
33 self.uploadCostStaticText.SetBackgroundColour('Dark Green')
34 self.uploadCostStaticText.SetForegroundColour('White')
35 self.storageCostStaticText.SetBackgroundColour('Dark Green')
36 self.storageCostStaticText.SetForegroundColour('White')
37
38 self.disclosureLetterReminderText = wx.StaticText(self.panel, -1, "", (50, 55), (65, -1), wx.ALIGN_LEFT)
39 self.disclosureLetterReminderText.SetForegroundColour('Red')
40
41 self.chargeableCheckBox = wx.CheckBox(self.panel,-1,"Chargeable?")
42 responsibleAttnyStaticText = wx.StaticText(self.panel, -1, "Responsible Attorney: ",wx.DefaultPosition)
43 self.responsibleAttnyTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
44 responsibleParalegalStaticText = wx.StaticText(self.panel, -1, "Responsible Paralegal: ",wx.DefaultPosition)
45 self.responsibleParalegalTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
46 platformChoicesList = ["",'Concordance DIS','Concordance LN','Relativity']
47 reviewPlatformStaticText = wx.StaticText(self.panel, -1, "Platform: ",wx.DefaultPosition)
48 self.reviewPlatformChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=platformChoicesList)
49 responsibleProcessingVendorStaticText = wx.StaticText(self.panel, -1, "Processing Vendor: ",wx.DefaultPosition)
50 self.responsibleProcessingVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
51 responsibleScanningVendorStaticText = wx.StaticText(self.panel, -1, "Scanning Vendor: ",wx.DefaultPosition)
52 self.responsibleScanningVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
53 responsibleHostingVendorStaticText = wx.StaticText(self.panel, -1, "Hosting Vendor: ",wx.DefaultPosition)
54 self.responsibleHostingVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
55 responsibleTPMStaticText = wx.StaticText(self.panel, -1, "TPM: ",wx.DefaultPosition)
56 #self.responsibleTPMTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
57 self.responsibleTPMComboBox = wx.ComboBox(self.panel,-1,"",wx.DefaultPosition, (140,-1),self.console.fullTPMMatrix.keys(),wx.CB_DROPDOWN|wx.CB_SORT)
58 responsibleOfficeStaticText = wx.StaticText(self.panel, -1, "Office: ",wx.DefaultPosition)
59 self.responsibleOfficeTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (140,-1))
60 caseStatusStaticText = wx.StaticText(self.panel, -1, "Case Status: ",wx.DefaultPosition)
61 statusChoicesList = ['Active','Dormant','Closed','Archived']## Selecting archived automatically unchecks chareable.
62 self.caseStatusChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=statusChoicesList)
63 casePathStyleStaticText = wx.StaticText(self.panel, -1, "Path Style: ",wx.DefaultPosition)
64 casePathStyleChoiceList = ['','NEW','OLD']
65 self.casePathStyleChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=casePathStyleChoiceList)
66
67
68 self.SetFields(self.myCases[0])
69
70 self.CreateBoxesSection()
71
72 costSizer = wx.BoxSizer(wx.HORIZONTAL)
73 costSizer.Add(self.uploadCostStaticText,0,wx.ALL,5)
74 costSizer.Add(self.storageCostStaticText,0,wx.ALL,5)
75
76 casesSizer = wx.BoxSizer(wx.HORIZONTAL)
77 casesSizer.Add(casesListStaticText,0,wx.ALL,5)
78 casesSizer.Add(self.casesListChoice,0,wx.ALL,5)
79 #casesSizer.Add(costSizer,0,wx.ALL,5)
80
81 secondHalfSizer = wx.GridBagSizer(5,5)
82 secondHalfSizer.Add(reviewPlatformStaticText, pos=(0,0))
83 secondHalfSizer.Add(self.reviewPlatformChoice, pos=(0,1))
84 secondHalfSizer.Add(self.chargeableCheckBox,pos=(0,3))
85 #secondHalfSizer.Add(self.chargeableCheckBox,pos=(0,2), span=(1,2), flag = wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL)
86 secondHalfSizer.Add(responsibleAttnyStaticText, pos=(1,0))
87 secondHalfSizer.Add(self.responsibleAttnyTextCtrl, pos=(1,1))
88 secondHalfSizer.Add(responsibleTPMStaticText, pos = (1,2),flag=wx.ALIGN_RIGHT)
89 #secondHalfSizer.Add(self.responsibleTPMTextCtrl, pos = (1,3))
90 secondHalfSizer.Add(self.responsibleTPMComboBox, pos = (1,3))
91 secondHalfSizer.Add(responsibleParalegalStaticText, pos=(2,0))
92 secondHalfSizer.Add(self.responsibleParalegalTextCtrl, pos=(2,1))
93 secondHalfSizer.Add(responsibleOfficeStaticText, pos=(2,2),flag=wx.ALIGN_RIGHT)
94 secondHalfSizer.Add(self.responsibleOfficeTextCtrl, pos=(2,3))
95 secondHalfSizer.Add(caseStatusStaticText, pos=(3,0))
96 secondHalfSizer.Add(self.caseStatusChoice, pos=(3,1))
97 secondHalfSizer.Add(casePathStyleStaticText, pos=(3,2),flag=wx.ALIGN_RIGHT)
98 secondHalfSizer.Add(self.casePathStyleChoice, pos=(3,3))
99
100 respVendorsStaticBox = wx.StaticBox(self.panel, -1, 'Responsible Vendors:')
101 respVendorsStaticBoxSizer = wx.StaticBoxSizer(respVendorsStaticBox, wx.VERTICAL)
102 respVendorsFlexGridSizer = wx.FlexGridSizer(3,2,10,10)
103 respVendorsFlexGridSizer.Add(responsibleProcessingVendorStaticText,5)
104 respVendorsFlexGridSizer.Add(self.responsibleProcessingVendorTextCtrl,5)
105 respVendorsFlexGridSizer.Add(responsibleScanningVendorStaticText,5)
106 respVendorsFlexGridSizer.Add(self.responsibleScanningVendorTextCtrl,5)
107 respVendorsFlexGridSizer.Add(responsibleHostingVendorStaticText,5)
108 respVendorsFlexGridSizer.Add(self.responsibleHostingVendorTextCtrl,5)
109 respVendorsStaticBoxSizer.Add(respVendorsFlexGridSizer,0,wx.ALL,20)
110
111 mainSizer = wx.BoxSizer(wx.VERTICAL)
112 mainSizer.Add(costSizer,0,wx.RIGHT|wx.ALIGN_RIGHT,10)
113 mainSizer.Add(casesSizer,0,wx.BOTTOM|wx.LEFT|wx.RIGHT, 20)
114 mainSizer.Add(secondHalfSizer,0,wx.ALL,20)
115 mainSizer.Add(respVendorsStaticBoxSizer,0,wx.ALL,20)
116 #mainSizer.Add(self.chargeableCheckBox,0,wx.ALL,5)
117 #mainSizer.Add(self.reviewPlatformChoice,0,wx.ALL,5)
118 #mainSizer.Add(self.responsibleAttnyTextCtrl,0,wx.ALL,5)
119 #mainSizer.Add(self.responsibleParalegalTextCtrl,0,wx.ALL,5)
120 #mainSizer.Add(self.responsibleProcessingVendorTextCtrl,0,wx.ALL,5)
121 #mainSizer.Add(self.responsibleScanningVendorTextCtrl,0,wx.ALL,5)
122 #mainSizer.Add(self.responsibleHostingVendorTextCtrl,0,wx.ALL,5)
123 #mainSizer.Add(workDirSizer,0,wx.ALL, 10)
124 #mainSizer.Add(copyUpTypeStaticBoxSizer, 0, wx.ALL, 10)
125 mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
126
127 self.oKButton.Disable()
128
129 #self.chargeableCheckBox.Disable() ## Remove me.
130
131 self.panel.SetSizer(mainSizer)
132
133 self.CreateStatusBar()
134 self.SetStatusText("Ready.")
135 self.CreateMenuBar()
136
137 self.Bind(wx.EVT_CHOICE, self.OnSetFields, self.casesListChoice)
138 self.Bind(wx.EVT_CHOICE, self.OnPlatformChosen, self.casePathStyleChoice)
139 self.Bind(wx.EVT_CHOICE, self.OnPlatformChosen, self.reviewPlatformChoice)
140 self.Bind(wx.EVT_CHOICE, self.OnFormChanged, self.caseStatusChoice)
141 self.Bind(wx.EVT_CHECKBOX, self.OnFormChanged, self.chargeableCheckBox)
142 self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleAttnyTextCtrl)
143 #self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleTPMTextCtrl)
144 self.Bind(wx.EVT_TEXT, self.OnTransferConfirm, self.responsibleTPMComboBox)
145 self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleParalegalTextCtrl)
146 self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleOfficeTextCtrl)
147 self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleProcessingVendorTextCtrl)
148 self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleScanningVendorTextCtrl)
149 self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleHostingVendorTextCtrl)
150
151 self.Bind(wx.EVT_BUTTON, self.OnProcess, self.oKButton)
152 self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
153
154 def NothingYet(self,event):
155 """ A simple place holder function that is used to be a PASS statment when I'm creating controls"""
156 diag = wx.MessageDialog(self,"Nothing here yet!", "Disabled...",wx.OK | wx.ICON_INFORMATION)
157 diag.ShowModal()
158 diag.Destroy()
159
160 def MenuData(self):
161 return(("Case",
162 ("Edit Case &Name","Allows you to edit the case name.",self.OnEditCaseName,""),
163 ("Change Negotiated &Price","Allows you to edit the negotiated prices for hosting and uploading.",self.OnChangePricing,""),
164 ("Disclosure &Letter ...","Allows you to load and link your disclosure letter to this case.",self.OnChangeDisclosureLetter,""),
165 ("","","",""),
166 ("&Transfer Case","Allows you to transfer a case to another TPM.",self.NothingYet,"DISABLED"),
167 ("","","",""),
168 ("&Add New Case","Adds a new case to the system.",self.OnAddNewCase,"")),
169 ("View",
170 ("My Cases", "Chooses from your assigned cases.",self.OnChangeCaseView,"RADIO"),
171 ("My Active Cases", "Chooses from your assigned cases, filtered by Active Cases.",self.OnChangeCaseView,"RADIO"),
172 ("My Office Cases", "Chooses from cases assigned to everyone in your office.",self.OnChangeCaseView,"RADIO"),
173 ("All Cases", "Chooses from all cases.",self.OnChangeCaseView,"RADIO"),
174 ("","","",""),
175 ("Case &Uploads", "Displays the Case Uploads for this case.",self.OnViewCaseUploads,""),
176 ("&Production History", "Displays the Production History for this case.",self.OnViewDocProduction,""),
177 ("","","",""),
178 ("My Case &Notes","Opens the case notes file for the current selected case.",self.OnViewCaseNotes,""),
179 ("My Production &Spec","Opens the production specifications file for the current selected case.",self.OnViewProdSpec,""),
180 ("&Alternate Media Folder","Opens the alternate media path for the current selected case.",self.OnOpenAlternateMediaFolder,""),
181 ("Open Case &Folder","Opens the case folder for the current selected case.",self.OnOpenCaseFolder,"")),
182 ("Production",
183 ("&Add Production Entry","Adds a new production to the matter database.",self.OnAddDocProduction,"")),
184 ("Settings",
185 ("Linked &Vendor Folders","Allows you to link vendor folders to this case for copy ups.",self.OnEditVendorFolders,""),
186 ("&Case Paths","Allows you to set or change the alternate media path.",self.OnCasePathsSettings,"")),
187 ("Reporting",
188 ("Create &Produciton Report","Creates or updates the Production Report Page.",self.OnCreateProductionReport,""),
189 ("&Managerial","Managerial reports.",self.NothingYet,"DISABLED")),
190 ("&Help",
191 ("&About", "Displays the About Window.", self.OnAbout,"")))
192
193 def CreateMenuBar(self):
194 menuBar = wx.MenuBar()
195 count = 1
196 for eachMenuData in self.MenuData():
197 menuLabel = eachMenuData[0]
198 menuItems = eachMenuData[1:]
199 menuBar.Append(self.CreateMenu(menuItems), menuLabel)
200 count = count + 1
201 self.SetMenuBar(menuBar)
202
203
204 def CreateMenu(self, menuData):
205 menu = wx.Menu()
206 for eachLabel, eachStatus, eachHandler, eachType in menuData:
207 if not eachLabel:
208 menu.AppendSeparator()
209 continue
210 if eachType == "RADIO":
211 menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
212 else:
213 menuItem = menu.Append(-1, eachLabel, eachStatus)
214 if eachType == 'DISABLED':
215 menuItem.Enable(False)
216 self.Bind(wx.EVT_MENU, eachHandler, menuItem)
217 return menu
218
219
220 def OnFormChanged(self,event):
221 self.oKButton.Enable()
222
223 def OnPlatformChosen(self,event):
224 """Captures the platform selection and also asks if this case will use the new case path style"""
225 ## Ask about usign new vs old case path style. Dont do this if the selection is dis.
226
227 caseName = self.casesListChoice.GetStringSelection()
228 CLM = caseName.split("_(")[1]
229 CLM = CLM[:-1]
230 CLM = CLM.replace('-','.')
231
232 currentRevPlatform = self.reviewPlatformChoice.GetStringSelection()
233 if currentRevPlatform == "Concordance DIS":
234 self.casePathStyleChoice.SetStringSelection("")
235 elif currentRevPlatform == "":
236 self.casePathStyleChoice.SetStringSelection("")
237 else:
238 dlg = wx.SingleChoiceDialog(
239 self, """Please choose between using the old case path style\nor the new case path style below.\n\nIf you select the New case path style,\nyour folders on IDS will be created automatically.""", 'Case Path Style',
240 ['New Case Path Style', 'Old Case Path Style'],
241 wx.CHOICEDLG_STYLE
242 )
243 #dlg.SetSize(wx.Size(10,10))
244 if dlg.ShowModal() == wx.ID_OK:
245 #print "DEBUG: you chose %s"%dlg.GetStringSelection()
246 if dlg.GetStringSelection()[:3] == "New":
247 self.casePathStyleChoice.SetStringSelection("NEW")
248 if currentRevPlatform == "Concordance LN":
249 currentRevPlatform = "Concordance"
250 print "new selected, making folders..."
251 message = "Please wait while the standard folder structure is created on IDS..."
252 busy = PBI.PyBusyInfo(message, parent=self, title="MCP: System Busy.")
253 MCP_Lib.CreateCasePathStyleFolders(currentRevPlatform,CLM)
254 print "folders made."
255 del busy
256 doneDlg = wx.MessageDialog(self, "MCP: The standard case folders have been created.\nRemember to hit save to save your case changes to the mater database.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
257 doneDlg.ShowModal()
258 doneDlg.Destroy()
259 elif dlg.GetStringSelection()[:3] == "Old":
260 self.casePathStyleChoice.SetStringSelection("OLD")
261
262 dlg.Destroy()
263 ## If they select new, create new folder structure.
264 ## Then set the path style choice to what htey selected.
265 self.OnFormChanged(event)
266
267
268 def OnTransferConfirm(self,event):
269 tpmTargetName = self.responsibleTPMComboBox.GetValue()
270 tpmTargetFirstName = tpmTargetName.split(", ")[1]
271 currentChargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,respTPM,respOffice,caseStatus,uploadCost,storageCost,disclosureLetterBool,casePathStyle = self.console.GetCaseData(self.casesListChoice.GetStringSelection())
272 diag = wx.MessageDialog(self,"Please confirm that you do want to transfer this case to %s. " %tpmTargetFirstName, "Case Transfer Request",wx.OK |wx.CANCEL| wx.ICON_INFORMATION)
273 if diag.ShowModal() == wx.ID_OK:
274 #diag.ShowModal()
275 message = "Please wait while your case file is moved and your case is reassigned. Working..."
276 busy = PBI.PyBusyInfo(message, parent=self, title="MCP: System busy.")
277 transferStatusError = self.console.TransferCase(self.casesListChoice.GetStringSelection(),respTPM,tpmTargetName)
278 #print "Would have been transfered to %s. " %tpmTargetName
279 del busy
280 self.OnSetFields(event)
281 self.ResetCasesLists()
282 diag.Destroy()
283 if transferStatusError:
284 dlg =wx.MessageDialog(self, "MCP: An error occurred and this case was not transferred.", "MCP: ERROR",wx.OK|wx.ICON_ERROR, wx.DefaultPosition)
285 else:
286 dlg = wx.MessageDialog(self, "MCP: This case has been transferred sucessfully to %s."% tpmTargetFirstName, "MCP: Process Complete",wx.OK, wx.DefaultPosition)
287 dlg.ShowModal()
288 dlg.Destroy()
289
290 def ResetCasesLists(self):
291 """This resets the various cases lists i.e. when you move or mark as dormant, etc"""
292 self.myCases, self.myActiveCases, self.officeCases, self.allCases, casesDir, self.casePathStyleMatrix = MCP_Lib.GetCaseList(accessConnectionObj=self.console.accessDB)
293
294
295 def OnSetFields(self,event):
296 #print self.casesListChoice.GetStringSelection()
297 self.SetFields(self.casesListChoice.GetStringSelection())
298 self.oKButton.Disable()
299
300 def SetFields(self, case):
301 currentChargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,respTPM,respOffice,caseStatus,uploadCost,storageCost,disclosureLetterBool,casePathStyle = self.console.GetCaseData(case)
302 if currentChargeableBool:
303 self.chargeableCheckBox.SetValue(True)
304 else:
305 self.chargeableCheckBox.SetValue(False)
306 if currentRevPlatform == 'Concordance':
307 ## Make an assumption
308 currentRevPlatform = "Concordance DIS"
309 if currentRevPlatform:
310 #print currentRevPlatform
311 self.reviewPlatformChoice.SetStringSelection(currentRevPlatform)
312 else:
313 self.reviewPlatformChoice.SetStringSelection('')
314 if currentRespAttorney:
315 self.responsibleAttnyTextCtrl.SetValue(currentRespAttorney)
316 else:
317 self.responsibleAttnyTextCtrl.SetValue('')
318 if currentRespParalegal:
319 self.responsibleParalegalTextCtrl.SetValue(currentRespParalegal)
320 else:
321 self.responsibleParalegalTextCtrl.SetValue('')
322 if currentRespVendorTpl[0]:
323 self.responsibleProcessingVendorTextCtrl.SetValue(currentRespVendorTpl[0])
324 else:
325 self.responsibleProcessingVendorTextCtrl.SetValue("")
326 if currentRespVendorTpl[1]:
327 self.responsibleScanningVendorTextCtrl.SetValue(currentRespVendorTpl[1])
328 else:
329 self.responsibleScanningVendorTextCtrl.SetValue('')
330 if currentRespVendorTpl[2]:
331 self.responsibleHostingVendorTextCtrl.SetValue(currentRespVendorTpl[2])
332 else:
333 self.responsibleHostingVendorTextCtrl.SetValue('')
334 if respTPM:
335 #self.responsibleTPMTextCtrl.SetValue(respTPM)
336 self.responsibleTPMComboBox.SetValue(respTPM)
337
338 else:
339 #self.responsibleTPMTextCtrl.SetValue('')
340 self.responsibleTPMComboBox.SetValue('')
341
342 if respOffice:
343 self.responsibleOfficeTextCtrl.SetValue(respOffice)
344 else:
345 self.responsibleOfficeTextCtrl.SetValue('')
346 if currentRevPlatform != "Concordance DIS":
347 self.casePathStyleChoice.Enable(True)
348 if casePathStyle:
349 self.casePathStyleChoice.SetStringSelection(casePathStyle)
350 else:
351 self.casePathStyleChoice.SetStringSelection('')
352 else:
353 self.casePathStyleChoice.SetStringSelection('')
354 self.casePathStyleChoice.Enable(False)
355 if caseStatus:
356 self.caseStatusChoice.SetStringSelection(caseStatus)
357 else:
358 self.caseStatusChoice.SetStringSelection('')
359 if storageCost:
360 self.storageCostStaticText.SetLabel(" Storage:$%s "%str(storageCost))
361 else:
362 self.storageCostStaticText.SetLabel(' Storage:$0 ')
363 if uploadCost:
364 self.uploadCostStaticText.SetLabel(" Upload:$%s "%str(uploadCost))
365 else:
366 self.uploadCostStaticText.SetLabel(' Upload:$0 ')
367 if currentChargeableBool:
368 if currentRevPlatform:
369 if disclosureLetterBool:
370 self.disclosureLetterReminderText.SetLabel('')
371 else:
372 self.disclosureLetterReminderText.SetLabel('WARNING: There is no disclosure letter for this case on file!')
373 else:
374 self.disclosureLetterReminderText.SetLabel('')
375 else:
376 self.disclosureLetterReminderText.SetLabel('')
377
378 def OnProcess(self, event):
379 caseName = self.casesListChoice.GetStringSelection()
380 if self.chargeableCheckBox.GetValue():
381 chargeableBool = True
382 else:
383 chargeableBool = False
384 currentRevPlatform = self.reviewPlatformChoice.GetStringSelection()
385 caseStatus = self.caseStatusChoice.GetStringSelection()
386 currentRespAttorney = self.responsibleAttnyTextCtrl.GetValue()
387 currentRespParalegal = self.responsibleParalegalTextCtrl.GetValue()
388 currentRespVendorTpl = (self.responsibleProcessingVendorTextCtrl.GetValue(),self.responsibleScanningVendorTextCtrl.GetValue(),
389 self.responsibleHostingVendorTextCtrl.GetValue())
390 #respTPM = self.responsibleTPMTextCtrl.GetValue()
391 respTPM = self.responsibleTPMComboBox.GetValue()
392 respOffice = self.responsibleOfficeTextCtrl.GetValue()
393 casePathStyle = self.casePathStyleChoice.GetStringSelection()
394 print "Updating Access DB..."
395 self.console.EditCaseData(caseName,chargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,
396 respTPM,respOffice, caseStatus, casePathStyle)
397 print "Complete!"
398 finishedDlg = wx.MessageDialog(self, "MCP: Your settings have been saved to the Matter Management database.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
399 finishedDlg.ShowModal()
400 finishedDlg.Destroy()
401 self.oKButton.Disable()
402
403 def CreateBoxesSection(self):
404 self.oKButton = wx.Button(self.panel, wx.ID_OK,'Save')
405 self.oKButton.SetDefault()
406 self.oKButton.SetSize(self.oKButton.GetBestSize())
407 self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL,'Close')
408 self.cancelButton.SetSize(self.cancelButton.GetBestSize())
409 self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
410 self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
411 self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
412
413 def CloseWindow(self, event):
414 self.Close(True)
415
416 def OnChangeCaseView(self,event):
417 self.casesListChoice.Clear()
418 eventID = event.GetId()
419 print eventID
420 if eventID == 105:
421 #change it to my cases
422 self.casesListChoice.SetItems(self.myCases)
423 self.casesListChoice.SetSelection(0)
424 self.SetFields(self.myCases[0])
425 if eventID == 106:
426 #change it to my active cases
427 self.casesListChoice.SetItems(self.myActiveCases)
428 self.casesListChoice.SetSelection(0)
429 self.SetFields(self.myActiveCases[0])
430 if eventID == 107:
431 #change it to office cases
432 self.casesListChoice.SetItems(self.officeCases)
433 self.casesListChoice.SetSelection(0)
434 self.SetFields(self.officeCases[0])
435 if eventID == 108:
436 #change it to all cases
437 self.casesListChoice.SetItems(self.allCases)
438 self.casesListChoice.SetSelection(0)
439 self.SetFields(self.allCases[0])
440
441
442 def OnAddNewCase(self,event):
443 """Main callback for adding a new case in view/edit"""
444 #caseName = self.casesListChoice.GetStringSelection()
445 office = self.responsibleOfficeTextCtrl.GetValue()
446 #CLM = caseName.split("_(")[1]
447 #CLM = CLM[:-1]
448 #CLM = CLM.replace('-','.')
449 dlg = AddNewCaseDialog.AddNewCaseDialog(self)
450 if dlg.ShowModal() == wx.ID_OK:
451 ## test to see if the case already exists and if it's assigned to somone else, or none.
452 caseName, clientNumb,matterNumb = dlg.GetValues()
453 fullList = self.console.GetFullCLMList()
454 if "%s.%s"%(clientNumb,matterNumb) in fullList:
455 print "Case already exists, take over?"
456 respTPM = self.console.accessDB.GetResponsibleTPM("%s.%s"%(clientNumb,matterNumb))
457 if respTPM:
458 respTPMFirstName = respTPM.split(", ")[1]
459 warningMessage = wx.MessageDialog(self,"This case already exists in the database and is assigned to %s. Would you like to take over this case?"% respTPMFirstName, "Transfer Case?",wx.OK |wx.CANCEL| wx.ICON_INFORMATION)
460 if warningMessage.ShowModal()==wx.ID_OK:
461 print "Transfering case..."
462 message = "Please wait while your case file is moved and your case is reassigned. Working..."
463 busy = PBI.PyBusyInfo(message, parent=self, title="MCP: System busy.")
464 transferStatusError = self.console.TransferCase("%s_(%s)"%(self.console.accessDB.GetCaseName("%s.%s"%(clientNumb,matterNumb)),"%s-%s"%(clientNumb,matterNumb)),respTPM,self.console.tPMName)
465 del busy
466 self.OnSetFields(event)
467 self.ResetCasesLists()
468 ## Use some list comprehension to edit all three case lists in place to update UI.
469 #print "you changed it so new value is %s_(%s)"%(newCaseName,newCLM)
470 #self.myCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.myCases]
471 #self.officeCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.officeCases]
472 #self.allCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.allCases]
473 #
474 #self.casesListChoice.SetItems(self.myCases)
475 #self.casesListChoice.SetSelection(0)
476 #self.SetFields(self.myCases[0])
477 else:
478 print "adding case..."
479 self.console.AddNewCase(caseName,"%s-%s"%(clientNumb,matterNumb))
480 finishedDlg = wx.MessageDialog(self, "A new case been added to the MCP.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
481 ## Use some list comprehension to edit all three case lists in place to update UI.
482 print "New case is %s_(%s)"%(caseName,"%s-%s"%(clientNumb,matterNumb))
483 self.myCases.append("%s_(%s)"%(caseName,"%s-%s"%(clientNumb,matterNumb)))
484 self.myCases.sort()
485 self.myActiveCases.append("%s_(%s)"%(caseName,"%s-%s"%(clientNumb,matterNumb)))
486 self.myActiveCases.sort()
487 self.officeCases.append("%s_(%s)"%(caseName,"%s-%s"%(clientNumb,matterNumb)))
488 self.officeCases.sort()
489 self.allCases.append("%s_(%s)"%(caseName,"%s-%s"%(clientNumb,matterNumb)))
490 #self.allCases.sort()
491
492 self.casesListChoice.SetItems(self.myCases)
493 self.casesListChoice.SetSelection(0)
494 self.SetFields(self.myCases[0])
495 finishedDlg.ShowModal()
496
497 def OnEditCaseName(self,event):
498 caseName = self.casesListChoice.GetStringSelection()
499 office = self.responsibleOfficeTextCtrl.GetValue()
500 CLM = caseName.split("_(")[1]
501 CLM = CLM[:-1]
502 CLM = CLM.replace('-','.')
503 dlg = AddEditCaseNameDialog.AddEditCaseNameDialog(self, CLM,caseName)
504 if dlg.ShowModal() == wx.ID_OK:
505 changed = False
506 newCaseName, clientNumb,matterNumb = dlg.GetValues()
507 newCLM = clientNumb + '.' + matterNumb
508 if caseName.split('_(')[0] != newCaseName:
509 changed = True
510 if newCLM != CLM:
511 changed = True
512 if changed:
513 self.console.ChangeCaseName(caseName,newCaseName,newCLM)
514 doneDlg = wx.MessageDialog(self, "MCP: Case name has been changed to %s_(%s)"%(newCaseName,newCLM), "MCP: Success",wx.OK, wx.DefaultPosition)
515 doneDlg.ShowModal()
516 doneDlg.Destroy()
517 ## Use some list comprehension to edit all three case lists in place to update UI.
518 print "you changed it so new value is %s_(%s)"%(newCaseName,newCLM)
519 self.myCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.myCases]
520 self.officeCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.officeCases]
521 self.allCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.allCases]
522
523 self.casesListChoice.SetItems(self.myCases)
524 self.casesListChoice.SetSelection(0)
525 self.SetFields(self.myCases[0])
526 dlg.Destroy()
527 #err = self.console.ViewCaseNotes(caseName,office)
528
529 def OnViewCaseNotes(self,event):
530 caseName = self.casesListChoice.GetStringSelection()
531 office = self.responsibleOfficeTextCtrl.GetValue()
532 err = self.console.ViewCaseNotes(caseName,office)
533 if err:
534 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
535 errDlg.ShowModal()
536 errDlg.Destroy()
537
538 def OnViewProdSpec(self,event):
539 caseName = self.casesListChoice.GetStringSelection()
540 office = self.responsibleOfficeTextCtrl.GetValue()
541 err = self.console.ViewProdSpec(caseName,office)
542 if err:
543 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
544 errDlg.ShowModal()
545 errDlg.Destroy()
546
547 def OnOpenAlternateMediaFolder(self,event):
548 caseName = self.casesListChoice.GetStringSelection()
549 office = self.responsibleOfficeTextCtrl.GetValue()
550 err = self.console.OpenAlternateMediaFolder(caseName,office)
551 if err:
552 errDlg = wx.MessageDialog(self, "MCP: There is no current alternate media folder for this case.\nYou can set this in Settings.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
553 errDlg.ShowModal()
554 errDlg.Destroy()
555
556 def OnOpenCaseFolder(self,event):
557 caseName = self.casesListChoice.GetStringSelection()
558 office = self.responsibleOfficeTextCtrl.GetValue()
559 err = self.console.OpenCaseFolder(caseName,office)
560 if err:
561 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
562 errDlg.ShowModal()
563 errDlg.Destroy()
564
565 def OnViewCaseUploads(self, event):
566 uploadList = self.console.GetUploadData(self.casesListChoice.GetStringSelection())
567 numberOfRows = len(uploadList)
568 uploadTotal = self.console.GetUploadTotal(uploadList)
569 caseName = self.casesListChoice.GetStringSelection()
570 CLM = caseName.split("_(")[1]
571 CLM = CLM[:-1]
572 CLM = CLM.replace('-','.')
573 #print CLM
574 if numberOfRows == 0:
575 dlg = wx.MessageDialog(self, "MCP: There are no case uploads for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
576 else:
577 dlg = CaseUploadsDialog.CaseUploadsDialog(self,numberOfRows, uploadList, uploadTotal,CLM)
578 #dlg.Show(True)
579 dlg.ShowModal()
580 dlg.Destroy()
581
582 def OnViewDocProduction(self,event):
583 prodMatrix = self.console.GetProductionData(self.casesListChoice.GetStringSelection())
584 prodList = []
585 for key in prodMatrix.keys():
586 prodList.extend(prodMatrix[key])
587 numberOfRows = len(prodList)
588 prodTotals = self.console.GetProductionTotal(prodList)
589 caseName = self.casesListChoice.GetStringSelection()
590 CLM = caseName.split("_(")[1]
591 CLM = CLM[:-1]
592 CLM = CLM.replace('-','.')
593 #print CLM
594 if numberOfRows == 0:
595 dlg = wx.MessageDialog(self, "MCP: There are no current productions for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
596 else:
597 dlg = CurrentProductionsDialog.CaseUploadsDialog(self,numberOfRows, prodList,CLM, prodTotals)
598 #dlg.Show(True)
599 dlg.ShowModal()
600 dlg.Destroy()
601
602 def OnAddDocProduction(self, event):
603 caseName = self.casesListChoice.GetStringSelection()
604 caseDatabaseList = self.console.GetDatabaseList(caseName)
605 possibleProducedToEntities = self.console.GetPossibleProducedToEntities(caseName)
606 possibleProdReqByNames = self.console.GetPossibleProdReqByNames(caseName)
607 CLM = caseName.split("_(")[1]
608 CLM = CLM[:-1]
609 CLM = CLM.replace('-','.')
610 #print CLM
611 dlg = AddDocumentProductionDialog.AddDocumentProductionDialog(self,CLM, caseDatabaseList, possibleProducedToEntities,possibleProdReqByNames)
612 if dlg.ShowModal() == wx.ID_OK:
613 prodProcessedDate, begBates, endBates, prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword = dlg.GetValues()
614 #print prodDate
615 dateConverter = NinoGenTools.DateUtilities()
616 prodID = 'prod_' + str(dateConverter.ConvertDateFormat(prodProcessedDate, convertToFormat='computer'))
617 errRpt = self.console.AddProductionEntry(CLM,prodID,prodProcessedDate,begBates,endBates,prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword)
618 if errRpt:
619 doneDlg = wx.MessageDialog(self, "MCP: All fields need to be filled out.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
620 else:
621 doneDlg = wx.MessageDialog(self, "MCP: Production detail added successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
622 doneDlg.ShowModal()
623 doneDlg.Destroy()
624
625 def OnChangeDisclosureLetter(self,event):
626 office = self.responsibleOfficeTextCtrl.GetValue()
627 altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
628 disclosureLetterSet,disclosureLetterPath = self.console.GetDisclosureLetterData(self.casesListChoice.GetStringSelection())
629 if disclosureLetterPath:
630 disclosureLetterPath = str(disclosureLetterPath)
631 else:
632 disclosureLetterPath = ""
633 dlg = DisclosureLetterDialog.DisclosureLetterDialog(self, disclosureLetterSet, disclosureLetterPath, casePath)
634 if dlg.ShowModal() == wx.ID_OK:
635 newdisclosureLetterPath,errRpt = dlg.GetValues()
636 dlg.Destroy()
637 if errRpt:
638 doneDlg = wx.MessageDialog(self, "MCP: The Disclosure letter could NOT be loaded.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
639 else:
640 if newdisclosureLetterPath == disclosureLetterPath:
641 doneDlg = False
642 else:
643 self.console.SetDisclosureLetterData(self.casesListChoice.GetStringSelection(),newdisclosureLetterPath)
644 doneDlg = wx.MessageDialog(self, "MCP: Disclosure letter loaded successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
645 self.disclosureLetterReminderText.SetLabel('')
646 if doneDlg:
647 doneDlg.ShowModal()
648 doneDlg.Destroy()
649
650 def OnCasePathsSettings(self, event):
651 office = self.responsibleOfficeTextCtrl.GetValue()
652 altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
653 if altMediaPath:
654 pass
655 else:
656 altMediaPath = ""
657 dlg = CasePathsDialog.CasePathsDialog(self, altMediaPath, casePath)
658 if dlg.ShowModal() == wx.ID_OK:
659 newAltMediaPath,errRpt = dlg.GetValues()
660 dlg.Destroy()
661 if errRpt:
662 doneDlg = wx.MessageDialog(self, "MCP: The media path either does not exist, is local or references a drive letter, which is not allowed.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
663 else:
664 if newAltMediaPath == altMediaPath:
665 pass
666 else:
667 self.console.SetAlternateMediaFolder(self.casesListChoice.GetStringSelection(),newAltMediaPath)
668 doneDlg = wx.MessageDialog(self, "MCP: Alternate Media Path updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
669 if doneDlg:
670 doneDlg.ShowModal()
671 doneDlg.Destroy()
672
673 def OnChangePricing(self,event):
674 #StorageUploadCostsDialog
675 office = self.responsibleOfficeTextCtrl.GetValue()
676 currentStorageCosts = self.storageCostStaticText.Label
677 if currentStorageCosts:
678 currentStorageCosts = float(currentStorageCosts.replace(" Storage:$",""))
679 currentUploadCosts = self.uploadCostStaticText.Label
680 if currentUploadCosts:
681 currentUploadCosts = float(currentUploadCosts.replace(" Upload:$",""))
682 dlg = StorageUploadCostsDialog.StorageUploadCostsDialog(self, currentStorageCosts,currentUploadCosts)
683 if dlg.ShowModal() == wx.ID_OK:
684 newStorageCosts,newUploadCosts = dlg.GetValues()
685 dlg.Destroy()
686 self.console.SetUploadAndStorageCosts(self.casesListChoice.GetStringSelection(),str(newUploadCosts),str(newStorageCosts))
687 doneDlg = wx.MessageDialog(self, "MCP: Upload and Storage Pricing updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
688 doneDlg.ShowModal()
689 self.SetFields(self.casesListChoice.GetStringSelection())
690 doneDlg.Destroy()
691
692 def OnEditVendorFolders(self,event):
693 office = self.responsibleOfficeTextCtrl.GetValue()
694 currentVendorFolder = self.console.GetVendorFolders(self.casesListChoice.GetStringSelection())
695 if currentVendorFolder:
696 pass
697 else:
698 currentVendorFolder = "None"
699 vendorFolderList = self.console.GetVendorFoldersList()
700 dlg = EditVendorFolderDialog.EditVendorFolderDialog(self, currentVendorFolder,vendorFolderList)
701 if dlg.ShowModal() == wx.ID_OK:
702 newCurrentVendorFolder = dlg.GetValues()
703 if newCurrentVendorFolder == currentVendorFolder:
704 pass
705 else:
706 self.console.SetVendorFolders(self.casesListChoice.GetStringSelection(), newCurrentVendorFolder)
707 doneDlg = wx.MessageDialog(self, "MCP: Vendor Folder updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
708 doneDlg.ShowModal()
709 doneDlg.Destroy()
710
711 def OnCreateProductionReport(self,event):
712 """This method creates or updates the Produciton Reporting page."""
713 ## Check to see if a alternate media folder exists
714 caseName = self.casesListChoice.GetStringSelection()
715 office = self.responsibleOfficeTextCtrl.GetValue()
716 err = self.console.OpenAlternateMediaFolder(caseName,office,testOnly=True)
717 if err:
718 errDlg = wx.MessageDialog(self, "MCP: There is no current alternate media folder for this case. A media folder is necesary for this option.\nYou can set this in Settings.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
719 errDlg.ShowModal()
720 errDlg.Destroy()
721 else:
722 err2 = self.console.CreateProductionReport(caseName,office)
723 if err2:
724 err2Dlg = wx.MessageDialog(self, "MCP: There are no productions for this case..", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
725 err2Dlg.ShowModal()
726 err2Dlg.Destroy()
727 else:
728 sucessDlg = wx.MessageDialog(self, "MCP: The production report has been saved to the __MCP_data folder, in the alternate media folder.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
729 sucessDlg.ShowModal()
730 sucessDlg.Destroy()
731
732 def OnAbout(self, event):
733 """
734 OnAbout(self,event) Displays an about dialog with developer and bug reporting info
735 """
736 dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
737 "\n\n"
738 "For questions or comments about this program\n"
739 "or to report a bug, please email the program\n"
740 "creator at Nino.Borges@gmail.com\n\n"
741 "MCP is\n"
742 "Copyright (c) 2009 - 2013 Emanuel Borges.\n"
743 "All rights reserved.\n"
744 "(Nino.Borges@gmail.com)\n",
745 "About MCP", wx.OK | wx.ICON_INFORMATION)
746 dlg.ShowModal()
747 dlg.Destroy()
748
749
750 class MyApp(wx.App):
751 def OnInit(self):
752 image = wx.Image("DDSC-LTsmall_2.jpg", wx.BITMAP_TYPE_JPEG)
753 bmp = image.ConvertToBitmap()
754 wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_PARENT |wx.SPLASH_TIMEOUT, 2000, None, -1)
755 wx.Yield()
756 prgVersion = MCP_Lib.GetMCPVersion()
757 self.frame = MyFrame(None, -1, "View/Edit Case Information %s"%prgVersion)
758 self.frame.Show(True)
759 self.SetTopWindow(self.frame)
760 return True
761
762
763 if __name__ == '__main__':
764 app = MyApp(0)
765 app.MainLoop()