Package Gnumed :: Package wxpython :: Module gmBillingWidgets
[frames] | no frames]

Source Code for Module Gnumed.wxpython.gmBillingWidgets

 1  """GNUmed billing handling widgets. 
 2  """ 
 3  #================================================================ 
 4  __author__ = "Karsten Hilbert <Karsten.Hilbert@gmx.net>" 
 5   
 6  import logging 
 7  import sys 
 8  #os.path 
 9   
10   
11  import wx 
12   
13   
14  if __name__ == '__main__': 
15          sys.path.insert(0, '../../') 
16  from Gnumed.pycommon import gmTools 
17  #from Gnumed.pycommon import gmDispatcher, gmCfg, gmShellAPI, gmTools, gmDateTime 
18  #from Gnumed.pycommon import gmMatchProvider, gmI18N, gmPrinting, gmCfg2, gmNetworkTools 
19   
20  from Gnumed.business import gmBilling 
21  #from Gnumed.business import gmPerson, gmATC, gmSurgery, gmMedication, gmForms, gmStaff 
22   
23  from Gnumed.wxpython import gmListWidgets 
24  #from Gnumed.wxpython import gmGuiHelpers, gmRegetMixin, gmAuthWidgets, gmEditArea, gmMacro 
25  #from Gnumed.wxpython import gmCfgWidgets, gmListWidgets, gmPhraseWheel, gmFormWidgets 
26   
27   
28  _log = logging.getLogger('gm.ui') 
29   
30  #================================================================ 
31 -def manage_billables(parent=None):
32 33 if parent is None: 34 parent = wx.GetApp().GetTopWindow() 35 #------------------------------------------------------------ 36 # def edit(substance=None): 37 # return edit_consumable_substance(parent = parent, substance = substance, single_entry = (substance is not None)) 38 #------------------------------------------------------------ 39 # def delete(substance): 40 # if substance.is_in_use_by_patients: 41 # gmDispatcher.send(signal = 'statustext', msg = _('Cannot delete this substance. It is in use.'), beep = True) 42 # return False 43 # 44 # return gmMedication.delete_consumable_substance(substance = substance['pk']) 45 #------------------------------------------------------------ 46 def refresh(lctrl): 47 billables = gmBilling.get_billables() 48 items = [ [ 49 b['billable_code'], 50 b['billable_description'], 51 u'%s %s' % (b['raw_amount'], b['currency']), 52 u'%s (%s)' % (b['catalog_short'], b['catalog_version']), 53 gmTools.coalesce(b['comment'], u''), 54 b['pk_billable'] 55 ] for b in billables ] 56 lctrl.set_string_items(items) 57 lctrl.set_data(billables)
58 #------------------------------------------------------------ 59 msg = _('\nThese are the items for billing registered with GNUmed.\n') 60 61 gmListWidgets.get_choices_from_list ( 62 parent = parent, 63 msg = msg, 64 caption = _('Showing billable items.'), 65 columns = [_('Code'), _('Description'), _('Value'), _('Catalog'), _('Comment'), u'#'], 66 single_selection = True, 67 #new_callback = edit, 68 #edit_callback = edit, 69 #delete_callback = delete, 70 refresh_callback = refresh 71 ) 72