#include "util.h"
#include "preDefine.h"

QString Penny2Dollar(int penny)
{
    double dollar = (double)penny/100;
    return QString::number(dollar,'f',2);
}

QString GetOperByStatus(int status, bool bRefuse)
{
    switch(status)
    {
    case 1:
        if(bRefuse)
        {
            return OPERATION_REFUSE;
        }
        return OPERATION_GETDELIVERS;
        break;
    case 2:
        if(bRefuse)
        {
            return OPERATION_REFUNDORDER;
        }
        return OPERATION_SENDOUT;
        break;
    case 5:
    case 4:
        if(bRefuse)
        {
            return OPERATION_REFUNDORDER;
        }
        return OPERATION_COMPLETE;
        break;
    case 6:
    case 200:
        return "NULL";
        break;
    case 20:
        if(bRefuse)
        {
            return OPERATION_REFUSEREFUND;
        }
        return OPERATION_REFUNDORDER;
        break;
    default:
        return "NULL";
        break;
    }
}

QString GetOperNameByStatus(int status, bool bRefuse)
{
    switch(status)
    {
    case 1:
        if(bRefuse)
        {
            return OPERATIONNAME_REFUSE;
        }
        return OPERATIONNAME_GETDELIVERS;
        break;
    case 2:
        if(bRefuse)
        {
            return OPERATIONNAME_REFUNDORDER;
        }
        return OPERATIONNAME_SENDOUT;
        break;
    case 5:
    case 4:
        if(bRefuse)
        {
            return  OPERATIONNAME_REFUNDORDER;;
        }
        return OPERATIONNAME_COMPLETE;
        break;
    case 6:
    case 200:
        return "NULL";
        break;
    case 20:
        if(bRefuse)
        {
            return OPERATIONNAME_REFUSEREFUND;
        }
        return OPERATIONNAME_REFUNDORDER;
        break;
    default:
        return "NULL";
        break;
    }
}
