コード例 #1
0
ファイル: tz_tags.py プロジェクト: dslowikowski/logistics
def last_report_elem(elem, supply_point, year, month, format=True):
    cell_template = '<%(elem)s class="%(classes)s">%(msg)s</%(elem)s>'
    state = soh_reported_on_time(supply_point, year, month)
    classes = "insufficient_data"
    msg = _("Waiting for reply")
    if state == OnTimeStates.NO_DATA or state == OnTimeStates.INSUFFICIENT_DATA:
        if format:
            return cell_template % {
                "classes": classes,
                "msg": msg,
                "elem": elem
            }
        else:
            return msg

    # check from business day to business day
    last_bd_of_the_month = get_business_day_of_month(year, month, -1)
    last_report = last_stock_on_hand_before(supply_point, last_bd_of_the_month)
    msg = defaultfilters.date(last_report.report_date, "d M Y")

    if not format: return msg

    if state == OnTimeStates.LATE:
        classes = "warning_icon iconified"
    elif state == OnTimeStates.ON_TIME:
        classes = "good_icon iconified"

    return cell_template % {"classes": classes, "msg": msg, "elem": elem}
コード例 #2
0
ファイル: tables.py プロジェクト: dslowikowski/logistics
def _ontime_class(cell):
    state = soh_reported_on_time(cell.object, cell.row.table.year,
                                 cell.row.table.month)
    if state == OnTimeStates.LATE:
        return "last_reported warning_icon iconified"
    elif state == OnTimeStates.ON_TIME:
        return "last_reported good_icon iconified"
コード例 #3
0
ファイル: tz_tags.py プロジェクト: andile2012/logistics
def last_report_elem(elem, supply_point, year, month, format=True):
    cell_template = '<%(elem)s class="%(classes)s">%(msg)s</%(elem)s>'
    state = soh_reported_on_time(supply_point, year, month)
    classes = "insufficient_data"
    msg = _("Waiting for reply")
    if state == OnTimeStates.NO_DATA or state == OnTimeStates.INSUFFICIENT_DATA:
        if format:
            return cell_template % {"classes": classes, "msg": msg, "elem": elem}
        else:
            return msg

    # check from business day to business day
    last_bd_of_the_month = get_business_day_of_month(year, month, -1)
    last_report = last_stock_on_hand_before(supply_point, last_bd_of_the_month)
    msg = defaultfilters.date(last_report.report_date, "d M Y")

    if not format: return msg

    if state == OnTimeStates.LATE:
        classes = "warning_icon iconified"
    elif state == OnTimeStates.ON_TIME:
        classes = "good_icon iconified"

    return cell_template % {"classes": classes, "msg": msg, "elem": elem}
コード例 #4
0
 def soh_not_responding(self):
     return filter(
         lambda sp: soh_reported_on_time(sp, self.year, self.month) in
         (OnTimeStates.NO_DATA, OnTimeStates.INSUFFICIENT_DATA),
         self.facilities)
コード例 #5
0
 def soh_late(self):
     return filter(
         lambda sp: soh_reported_on_time(sp, self.year, self.month) ==
         OnTimeStates.LATE, self.facilities)
コード例 #6
0
ファイル: tables.py プロジェクト: andile2012/logistics
def _ontime_class(cell):
    state = soh_reported_on_time(cell.object, cell.row.table.year, cell.row.table.month)
    if state == OnTimeStates.LATE:
        return "last_reported warning_icon iconified"
    elif state == OnTimeStates.ON_TIME:
        return "last_reported good_icon iconified"
コード例 #7
0
ファイル: reports.py プロジェクト: andile2012/logistics
 def soh_not_responding(self):
     return filter(lambda sp: soh_reported_on_time(sp, self.year, self.month) in (OnTimeStates.NO_DATA, OnTimeStates.INSUFFICIENT_DATA), self.facilities)
コード例 #8
0
ファイル: reports.py プロジェクト: andile2012/logistics
 def soh_late(self):
     return filter(lambda sp: soh_reported_on_time(sp, self.year, self.month) == OnTimeStates.LATE, self.facilities)