Example #1
0
 def click_all_stages(self, event): # wxGlade: MainFrame.<event_handler>
     # main process loop
     question = 'Process period {0}?'.format(period.yyyymm())
     if not long_calc(self, question): return
 
     self.text_output.SetValue("")
     self.text_output.Refresh()
     princ('Started: ' + str(datetime.datetime.now()))
     wx.SetCursor ( wx.StockCursor ( wx.CURSOR_WAIT ) ) 
     try:
         self.cache = pydra.main()
         princ('Finished: ' + str(datetime.datetime.now()))
     finally:
         #princ('Entered finally')
         wx.SetCursor ( wx.StockCursor ( wx.CURSOR_ARROW ) )
         
     wx.MessageBox('Finished', 'Info')
Example #2
0
 def OnOpen(self, event):
     if not self.IsShown(): return # this func is called on both opening and closing
     princ('OnShow - TODO: import from database tblCamelExpenses')
Example #3
0
 def OnClose(self, event):
     princ('OnClose - TODO maybe export to database')
     self.Hide()
Example #4
0
File: wip.py Project: blippy/pypms
    # output the totals for each job code
    for wip in wips:
        line = create_wip_line(wip, data["auto_invoices"])
        output.append(line)
    total = common.summate_cols(output)
    total[0] = "TOTAL"
    total[4] = ""
    output.append(total)

    return output


###########################################################################


def create_wip_report(data, output_text=True):
    output = create_wip_lines(data)
    if output_text:
        period.create_text_report("wip.txt", output)
    else:
        # TODO Consider zapping Excel output option if considered unecessary
        excel.create_report("Wip", output, [2, 3, 4, 5, 6, 7])


###########################################################################

if __name__ == "__main__":
    data = db.load_state()
    create_wip_report(data)
    princ("Finish")
Example #5
0
    output = [['Job', 'Amount', 'Period', '', 'Name', '', 'Desc']]
    
    xs = filter(lambda x: x['Amount'] != 0, sorted_expenses)
    for x in xs:
        desc = x['Desc']
        desc_upper = desc.upper()
        if 'ACCOM' in desc_upper: desc += ' - Munros'
        if 'FLIGHT' in desc_upper: desc += ' - Munros'
        if 'TAXI' in desc_upper: desc += ' - Rainbow'        
        output.append([ x['JobCode'], x['Amount'], x['Period'], '', x['Name'], '', desc])

    output.append([])
    total = common.summate_lod(sorted_expenses, 'Amount')
    output.append(['TOTAL', total])
    
    if output_text:
        period.create_text_report("expenses.txt", output)
    else:
        # TODO Consider zapping Excel output option if considered unecessary
        excel.create_report("expenses", output, [2, 3 ,4, 5, 6, 7])

            

    
###########################################################################
if  __name__ == "__main__":
    debug = True
    process({})
    princ("Finished")

Example #6
0
def CreateJobsheet(jobcode, job_times, d, title, outdir):
    out = rtf.Rtf()
    common.assert_job(d, jobcode, "In tblTimeItems, but not jobs")
    job = d['jobs'][jobcode]         
    sheets = aggregate(job_times, lambda x: (x['Task'], x['Person']))
    last_key = sheets[-1][0]
    for key, values in sheets:
        task, initials = key
        taskTitle = task + ' - ' + db.task_desc(d, jobcode, task)
        person_name = db.initials_to_name(d, initials)
        AddHeader(title, jobcode, job['title'], taskTitle, person_name, out)
        #pdb.set_trace()
        AddPersonToJobsheet(initials, values, out)
        out.annotation(job)
        if key != last_key: out.page()
    out.save(outdir, jobcode + ".rtf" )

###########################################################################


def create_timesheets(d):
    title = 'Timesheet: ' + period.mmmmyyyy()
    outdir = period.perioddir() + '\\timesheets'
    for jobKey, job_items in aggregate(d['timeItems'], common.mkKeyFunc('JobCode')):
        #pdb.set_trace()
        CreateJobsheet(jobKey, job_items, d, title, outdir)

if  __name__ == "__main__":
    princ("Didn't do anything")
Example #7
0
File: test.py Project: blippy/pypms
import itertools
import timeit
import pdb
import adodbapi

from common import princ

class Struct:
    pass

    
def test():
    raise KeyError (1, 23, 3)

if  __name__ == "__main__": 
    test()
    princ('Finished')
Example #8
0
    'Print workstatements'
    pattern = '{0}\\statements\\*.rtf'.format(period.perioddir())
    files = glob.glob(pattern)
    files.sort()
    for fname in files:
        
        # bail out on special files
        fname0 = os.path.basename(fname)[0]
        if fname0 in ['0','5']: 
            continue
        
        print_file(fname)
    
def timesheets(debug = False):
    "Print timesheets"
    jobs = [x['job'] for x in db.GetJobs().values() if x['Autoprint']]
    jobs.sort()
    for job in jobs:
        fname = '{0}\\timesheets\\{1}.rtf'.format(period.perioddir(), job)
        if not os.path.isfile(fname):
            continue
        if debug:
            print fname
        else: print_file(fname)

    
if  __name__ == "__main__":
    work_statements()
    timesheets(debug = True)
    common.princ("Finished xls")
Example #9
0
def describe():
    princ(pformat('YEAR: {0}, MONTH: {1}'))
Example #10
0
 def OnClose(self, event):        
     if self.jobs_frame.IsShown() or self.expenses_frame.IsShown():
         wx.MessageBox("Close other open forms first", "Error")
     else:
         princ("Going down")
         self.Destroy()
Example #11
0
 def cbox_change_event(self, event):
     princ("cbox_change_event")
     set_binary_reg_value(self.registry_key, self.checkbox.GetValue())