| 213 |
|
for ri, rid in enumerate(rlist):
|
| 214 |
|
rr = Data.ReportRow[rid]
|
| 215 |
|
rtable = rr.get('TableName')
|
| 216 |
|
tid = rr['TableID'] # was 'TaskID' -> changed to generic ID
|
| 217 |
|
if not show:
|
| 218 |
|
hidden = rr.get('Hidden', False)
|
| 219 |
|
active = rtable and tid and (Data.Database[rtable][tid].get('zzStatus', 'active') == 'active')
|
| 220 |
|
if hidden or not active: continue
|
| 221 |
|
fp.write("<tr>")
|
| 222 |
|
for ci, col in enumerate(columns):
|
| 223 |
|
of = coloffset[ci]
|
| 224 |
|
ct = Data.ColumnType[ctypes[ci]]
|
| 225 |
|
t = ct.get('T', 'X') # either "A" or "B"
|
| 226 |
|
ctable = Data.ReportType[rtid].get('Table' + t)
|
| 227 |
|
at = ct.get('AccessType')
|
| 228 |
|
if ri == 0:
|
| 229 |
|
wid = ' width="' + str(cwidth[ci]) + '" '
|
| 230 |
|
else:
|
| 231 |
|
wid = ''
|
| 232 |
|
if of == -1:
|
| 233 |
|
if rtable != ctable:
|
| 234 |
|
value = ''
|
| 235 |
|
elif at == 'd': # direct - value is in row
|
| 236 |
|
column = ct.get('Name')
|
| 237 |
|
value = Data.Database[rtable][tid].get(column, "")
|
| 238 |
|
elif at == 'i': # indirect - value in other table
|
| 239 |
|
it, ic = ct.get('Name').split('/') # indirect table & column
|
| 240 |
|
iid = Data.Database[rtable][tid].get(it+'ID')
|
| 241 |
|
value = Data.Database[it][iid].get(ic, "")
|
| 242 |
|
|
| 243 |
|
fp.write('<td class="body" ' + wid + wrap + ' >')
|
| 244 |
|
fp.write(MakeString(value))
|
| 245 |
|
fp.write("</td>")
|
| 246 |
|
else: # bar chart - decide on color of empty cell
|
| |
212 |
for ri, rid in enumerate(rlist):
|
| |
213 |
rr = Data.ReportRow[rid]
|
| |
214 |
rtable = rr.get('TableName')
|
| |
215 |
tid = rr['TableID'] # was 'TaskID' -> changed to generic ID
|
| |
216 |
if not show:
|
| |
217 |
hidden = rr.get('Hidden', False)
|
| |
218 |
active = rtable and tid and (Data.Database[rtable][tid].get('zzStatus', 'active') == 'active')
|
| |
219 |
if hidden or not active: continue
|
| |
220 |
fp.write("<tr>")
|
| |
221 |
for ci, col in enumerate(columns):
|
| |
222 |
of = coloffset[ci]
|
| |
223 |
ct = Data.ColumnType[ctypes[ci]]
|
| |
224 |
t = ct.get('T', 'X') # either "A" or "B"
|
| |
225 |
ctable = Data.ReportType[rtid].get('Table' + t)
|
| |
226 |
at = ct.get('AccessType')
|
| |
227 |
if ri == 0:
|
| |
228 |
wid = ' width="' + str(cwidth[ci]) + '" '
|
| |
229 |
else:
|
| |
230 |
wid = ''
|
| |
231 |
if of == -1:
|
| |
232 |
if rtable != ctable:
|
| |
233 |
value = ''
|
| |
234 |
elif at == 'd': # direct - value is in row
|
| |
235 |
column = ct.get('Name')
|
| |
236 |
value = Data.Database[rtable][tid].get(column, "")
|
| |
237 |
elif at == 'i': # indirect - value in other table
|
| |
238 |
it, ic = ct.get('Name').split('/') # indirect table & column
|
| |
239 |
iid = Data.Database[rtable][tid].get(it+'ID')
|
| |
240 |
value = Data.Database[it][iid].get(ic, "")
|
| |
241 |
|
| |
242 |
fp.write('<td class="body" ' + wid + wrap + ' >')
|
| |
243 |
fp.write(MakeString(value))
|
| |
244 |
fp.write("</td>")
|
| |
245 |
else: # bar chart - decide on color of empty cell
|
| 249 |
|
if rtable == "Task":
|
| 250 |
|
task = Data.Database['Task'][tid]
|
| 251 |
|
column = Data.Database['ReportColumn'][col]
|
| 252 |
|
es = task.get('hES', 0) # if not found don't display gantt chart
|
| 253 |
|
ef = task.get('hEF', 0)
|
| 254 |
|
ix = Data.DateConv[ column.get('FirstDate') or Data.GetToday() ]
|
| 255 |
|
if ctperiod == "Week":
|
| 256 |
|
ix -= Data.DateInfo[ ix ][2] # convert to beginning of week
|
| 257 |
|
dh, cumh, dow = Data.DateInfo[ix + of * 7]
|
| 258 |
|
dh2, cumh2, dow2 = Data.DateInfo[ix + (of + 1) * 7]
|
| 259 |
|
dh = cumh2 - cumh
|
| 260 |
|
else:
|
| 261 |
|
dh, cumh, dow = Data.DateInfo[ix + of]
|
| 262 |
|
|
| 263 |
|
if dh == 0:
|
| 264 |
|
cl = "off"
|
| 265 |
|
elif es < (dh + cumh) and ef > cumh:
|
| 266 |
|
# cl = "task"
|
| 267 |
|
if task.get("ActualEndDate"):
|
| 268 |
|
cl = "complete"
|
| 269 |
|
elif task.get("PercentComplete"): # is this cell end past current position in task
|
| 270 |
|
# if task.get("PercentComplete") >= (( cumh + dh - es )*100 / (ef-es)): # old formula
|
| 271 |
|
pc = task.get("PercentComplete")
|
| 272 |
|
position = es + (pc * (ef-es) / 100) # current position of task
|
| 273 |
|
if pc == 100 or position >= (cumh + dh):
|
| 274 |
|
cl = "complete"
|
| 275 |
|
else:
|
| 276 |
|
cl = "task"
|
| 277 |
|
else:
|
| 278 |
|
cl = "task"
|
| 279 |
|
# if es <= cumh: xof = 0
|
| 280 |
|
# else: xof = int( rect.width * (es - cumh)/dh)
|
| 281 |
|
# if ef >= (cumh + dh): wof = 0
|
| 282 |
|
# else: wof = int( rect.width * (cumh + dh - ef)/dh)
|
| 283 |
|
else:
|
| 284 |
|
cl = "non"
|
| |
248 |
if rtable == "Task":
|
| |
249 |
task = Data.Database['Task'][tid]
|
| |
250 |
column = Data.Database['ReportColumn'][col]
|
| |
251 |
es = task.get('hES', 0) # if not found don't display gantt chart
|
| |
252 |
ef = task.get('hEF', 0)
|
| |
253 |
ix = Data.DateConv[ column.get('FirstDate') or Data.GetToday() ]
|
| |
254 |
if ctperiod == "Week":
|
| |
255 |
ix -= Data.DateInfo[ ix ][2] # convert to beginning of week
|
| |
256 |
dh, cumh, dow = Data.DateInfo[ix + of * 7]
|
| |
257 |
dh2, cumh2, dow2 = Data.DateInfo[ix + (of + 1) * 7]
|
| |
258 |
dh = cumh2 - cumh
|
| |
259 |
else:
|
| |
260 |
dh, cumh, dow = Data.DateInfo[ix + of]
|
| |
261 |
|
| |
262 |
if dh == 0:
|
| |
263 |
cl = "off"
|
| |
264 |
elif es < (dh + cumh) and ef > cumh:
|
| |
265 |
# cl = "task"
|
| |
266 |
if task.get("ActualEndDate"):
|
| |
267 |
cl = "complete"
|
| |
268 |
elif task.get("PercentComplete"): # is this cell end past current position in task
|
| |
269 |
# if task.get("PercentComplete") >= (( cumh + dh - es )*100 / (ef-es)): # old formula
|
| |
270 |
pc = task.get("PercentComplete")
|
| |
271 |
position = es + (pc * (ef-es) / 100) # current position of task
|
| |
272 |
if pc == 100 or position >= (cumh + dh):
|
| |
273 |
cl = "complete"
|
| |
274 |
else:
|
| |
275 |
cl = "task"
|
| |
276 |
else:
|
| |
277 |
cl = "task"
|
| |
278 |
# if es <= cumh: xof = 0
|
| |
279 |
# else: xof = int( rect.width * (es - cumh)/dh)
|
| |
280 |
# if ef >= (cumh + dh): wof = 0
|
| |
281 |
# else: wof = int( rect.width * (cumh + dh - ef)/dh)
|
| |
282 |
else:
|
| |
283 |
cl = "non"
|