#coding=utf-8

class Formater():
    @staticmethod
    def formatStr(value):
        res = u''
        if value != None:
            try:
                res = str(value)
            except:
                pass
        return res

    @staticmethod
    def formatCount(value):
        return int(round(float(value or 0) * 100,0))

    @staticmethod
    def formatPrice(value):
        return int(round(float(value or 0) * 100,0))

    @staticmethod
    def formatCountShow(value):
        return '%.2f' % (float(value or 0)/100.0)

    @staticmethod
    def formatPriceShow(value):
        return '%.2f' % (float(value or 0)/100.0)

    @staticmethod
    def formatAmount(value):
        return int(round(float(value or 0) * 10000,0))

    @staticmethod
    def formatAmountShow(value):
        return '%.2f' % (float(value or 0) / 10000.0 + 0.0000001)

class CustomFormaterByUser():
    @staticmethod
    def formatEmptyStr(value,user):
        return Formater.formatEmptyStr(value)

    @staticmethod
    def formatEmptyFloat(value, user):
        #return round(value or 0, 2)
        return Formater.formatEmptyFloat(value)

    @staticmethod
    def formatTime(value,user):
        return Formater.formatTime(value)

    @staticmethod
    def formatDate(value, user):
        return Formater.formatDate(value)

    @staticmethod
    def formatCountShow(value,user):
        return Formater.formatCountShow(value)
    @staticmethod
    def formatPartAmountShow(value, user):
        return Formater.formatAmountShow(value)