Beispiel #1
0
    def init_data(my):

        sobject = my.get_current_sobject()
        value = sobject.get_value(my.due_date_col)
        if not value:
            my.mode = ""
            return

        status = sobject.get_value("status")

        due_date = parser.parse(value)

        # get today's date
        from pyasm.common import SPTDate
        today = SPTDate.start_of_today()

        # get the difference
        delta = due_date - today
        diff = delta.days


        if diff < 0:
            if status.lower() in ["approved", "complete", "done"]:
                mode = "done"
            else:
                mode = "critical"
        elif diff >= 0 and diff < 1:
            mode = "today"
        else:
            mode = "due"
        
        my.mode = mode
        my.diff = diff
Beispiel #2
0
    def init_data(my):

        sobject = my.get_current_sobject()
        value = sobject.get_value(my.due_date_col)
        if not value:
            my.mode = ""
            return

        status = sobject.get_value("status")

        due_date = parser.parse(value)

        # get today's date
        from pyasm.common import SPTDate
        today = SPTDate.start_of_today()

        # get the difference
        delta = due_date - today
        diff = delta.days

        if diff < 0:
            if status.lower() in ["approved", "complete", "done"]:
                mode = "done"
            else:
                mode = "critical"
        elif diff >= 0 and diff < 1:
            mode = "today"
        else:
            mode = "due"

        my.mode = mode
        my.diff = diff
Beispiel #3
0
    def get_display(my):

        div = DivWdg()

        sobject = my.get_current_sobject()
        value = sobject.get_value("bid_end_date")
        if not value:
            return div

        status = sobject.get_value("status")

        due_date = parser.parse(value)

        # get today's date
        from pyasm.common import SPTDate
        today = SPTDate.start_of_today()

        # get the difference
        delta = due_date - today
        diff = delta.days


        if diff < 0:
            if status.lower() in ["approved", "complete", "done"]:
                mode = "done"
            else:
                mode = "critical"
        elif diff >= 0 and diff < 1:
            mode = "today"
        else:
            mode = "due"

        if mode == "critical":
            div.add_style("background: #F00")
            div.add_style("color: #FFF")
            msg = "%s Days" % (-diff)
            div.add_attr("title", msg)
            if diff == -1:
                div.add("Yesterday")
            else:
                div.add(msg)
        elif mode == "today":
            div.add_style("background: #00F")
            div.add_style("color: #FFF")
            div.add_attr("title", "Due today")
            div.add("Today")
        elif mode == "done":
            #div.add_style("background: #0F0")
            #div.add_style("color: #000")
            #div.add_attr("title", "Done")
            #div.add("Done")
            pass
        else:
            div.add_style("background: #FFF")
            div.add_style("color: #000")
            div.add_attr("title", "Due in %s days" % diff)
            if diff == 1:
                div.add("Tomorrow")
            else:
                div.add("%s Days" % diff)


        div.add_style("padding: 3px")
        div.add_style("text-align: center")
        div.add_style("margin: -3px")

        return div
Beispiel #4
0
    def get_display(my):

        div = DivWdg()

        sobject = my.get_current_sobject()
        value = sobject.get_value("bid_end_date")
        if not value:
            return div

        status = sobject.get_value("status")

        due_date = parser.parse(value)

        # get today's date
        from pyasm.common import SPTDate
        today = SPTDate.start_of_today()

        # get the difference
        delta = due_date - today
        diff = delta.days

        if diff < 0:
            if status.lower() in ["approved", "complete", "done"]:
                mode = "done"
            else:
                mode = "critical"
        elif diff >= 0 and diff < 1:
            mode = "today"
        else:
            mode = "due"

        if mode == "critical":
            div.add_style("background: #F00")
            div.add_style("color: #FFF")
            msg = "%s Days" % (-diff)
            div.add_attr("title", msg)
            if diff == -1:
                div.add("Yesterday")
            else:
                div.add(msg)
        elif mode == "today":
            div.add_style("background: #00F")
            div.add_style("color: #FFF")
            div.add_attr("title", "Due today")
            div.add("Today")
        elif mode == "done":
            #div.add_style("background: #0F0")
            #div.add_style("color: #000")
            #div.add_attr("title", "Done")
            #div.add("Done")
            pass
        else:
            div.add_style("background: #FFF")
            div.add_style("color: #000")
            div.add_attr("title", "Due in %s days" % diff)
            if diff == 1:
                div.add("Tomorrow")
            else:
                div.add("%s Days" % diff)

        div.add_style("padding: 3px")
        div.add_style("text-align: center")
        div.add_style("margin: -3px")

        return div