Changeset 397

Show
Ignore:
Timestamp:
Fri May 16 22:58:27 2008
Author:
Brian
Message:

Added actual and baseline plan bars

Files:

Legend:

Unmodified
Added
Removed
Modified
  • ganttpv/trunk/GanttReport.py

    r395 r397  
    93 93 # 080513 - Alexander - add first names to resource assignment dialog, changed the default name for new rows  
    94 94 # 080516 - Alexander - added search box to assignment dialog  
      95 # 080516 - Brian - added actual and baseline plan bars  
    95 96  
    96 97 import wx, wx.grid  
     
    436 437             if isSelected:  
    437 438                 plancolor = o.get('PlanBarSelected', wx.GREEN)  
    438                   # actualcolor = o.get('ActualBarSelected', wx.GREEN)  
    439                   # basecolor = o.get('BaseBarSelected', wx.GREEN)  
      439                 actualcolor = o.get('ActualBarSelected', wx.BLUE)  
      440                 basecolor = o.get('BaseBarSelected', wx.LIGHT_GREY)  
      441                 completioncolor = o.get('CompletionBarSelected', wx.BLACK)  
    440 442             else:  
    441 443                 plancolor = o.get('PlanBar', wx.GREEN)  
    442                   # actualcolor = o.get('ActualBar', wx.GREEN)  
    443                   # basecolor = o.get('BaseBar', wx.GREEN)  
      444                 actualcolor = o.get('ActualBar', wx.BLUE)  
      445                 basecolor = o.get('BaseBar', wx.LIGHT_GREY)  
      446                 completioncolor = o.get('CompletionBar', wx.BLACK)  
    444 447  
    445 448             override = rr.get('PlanBarColor')  
     
    468 471                 drawbar(es, ef, plancolor, 6, (rect.height-12)//2)  # half-height bar  
    469 472             else:  
    470                   drawbar(es, ef, plancolor, 6, rect.height-12)  
    471    
    472               # asd = task.get('ActualStartDate')  
    473               # aed = task.get('ActualEndDate') or Data.Today()  
    474               # if asd: drawbar(DateInfo[DateConv[asd]][1], DateInfo[DateConv[ase]][1], actualcolor, 4, 4)  
    475    
    476               # bsd = task.get('BaseStartDate')  
    477               # bed = task.get('BaseEndDate')  
    478               # if asd: drawbar(DateInfo[DateConv[asd]][1], DateInfo[DateConv[ase]][1], actualcolor, 20, 4)  
      473                 reportid = rr.get('ReportID')  
      474                 bars = Data.Database['Report'][reportid].get('Bars') or 'Cab'  # could be 'pab'  
      475                  
      476                 if len(bars) == 3:  # 'pab'  p  
      477                     bar_height = (rect.height-12) // 3  
      478                     y_offset = gap = 3  
      479                 elif len(bars) == 2:  
      480                     bar_height = (rect.height-12) // 2  
      481                     y_offset = gap = 4  
      482                 else:  # == 1  
      483                     bar_height = (rect.height-12)  
      484                     y_offset = gap = 6  
      485  
      486                 if 'p' in bars or 'c' in bars or 'C' in bars:  
      487                     drawbar(  
      488                         es, ef, plancolor,  
      489                         y_offset, bar_height)  
      490                     if 'c' in bars or 'C' in bars:  # completion percent  
      491                         if task.get("ActualEndDate"):  
      492                             pc = 100  
      493                             position = ef  
      494                         elif task.get("PercentComplete"):  # is this cell end past current position in task  
      495                             pc = task.get("PercentComplete")  
      496                             position = es + (pc * (ef-es) / 100) # current position of task  
      497                         else:  
      498                             pc = 0  
      499                         if pc > 0:  
      500                             if 'c' in bars:  # half height completion bar  
      501                                 drawbar(  
      502                                     es, position, completioncolor,  
      503                                     y_offset + bar_height//2, bar_height//2)  
      504                             elif 'C' in bars:  # full height completion bar  
      505                                 drawbar(  
      506                                     es, position, completioncolor,  
      507                                     y_offset, bar_height)  
      508                     y_offset += bar_height + gap  
      509  
      510                 asd = task.get('ActualStartDate')  
      511                 if 'a' in bars:  
      512                     if asd:  
      513                         ash = task.get('ActualStartHour') or 0  
      514                         aed = task.get('ActualEndDate') or Data.TodayString()  
      515                         aeh = task.get('ActualEndHour') or 0  
      516                         drawbar(  
      517                             Data.DateInfo[Data.DateConv[asd]][1] + ash,  
      518                             Data.DateInfo[Data.DateConv[aed]][1] + aeh, actualcolor,  
      519                             y_offset, bar_height)  
      520                     y_offset += bar_height + gap  
      521  
      522                 bsd = task.get('BaseStartDate')  
      523                 if 'b' in bars and bsd:  
      524                     bsh = task.get('BaseStartHour') or 0  
      525                     bed = task.get('BaseEndDate') or bad  
      526                     beh = task.get('BaseEndHour') or 0  
      527                     drawbar(  
      528                         Data.DateInfo[Data.DateConv[bsd]][1] + bsh,  
      529                         Data.DateInfo[Data.DateConv[bed]][1] + beh, basecolor,  
      530                         y_offset, bar_height)  
    479 531  
    480 532         # firstdate = table.reportcolumn[table.columns[col]]['FirstDate']