Beispiel #1
0
def diagnoseFinish(diagnoseId):
    diagnosePayStats = DiagnosePayStats()
    diagnose = Diagnose.getDiagnoseById(diagnoseId)
    diagnosePayStats.diagnoseId = diagnoseId
    diagnosePayStats.diagnoseSeriesNumber = diagnose.diagnoseSeriesNumber
    diagnosePayStats.userId = session["user_id"]
    diagnosePayStats.finishDate = datetime.now()
    diagnosePayStats.money = diagnose.money
    diagnosePayStats.status = constant.DiagnosePayStatsConstant.Ongoing
    DiagnosePayStats.save(diagnosePayStats)
    resultJson = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg)
    return json.dumps(resultJson.__dict__, ensure_ascii=False)
def applyRefund(diagnoseId):
    userId = session['user_id']
    diagoseLog=DiagnoseLog(userId,diagnoseId,constant.DiagnoseLogAction.DiagnoseRefund)
    DiagnoseLog.save(session,diagoseLog)

    diagnose = Diagnose.getDiagnoseById(diagnoseId)
    if diagnose.status == constant.DiagnoseStatus.Diagnosed:
        diagnosePayStats = DiagnosePayStats.getPayStatsByDiagnoseId(diagnoseId)
        for payStats in diagnosePayStats:
            payStats.status = constant.DiagnosePayStatsConstant.Refund
        DiagnosePayStats.updatePayStats(diagnosePayStats)

    return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
Beispiel #3
0
def applyRefund(diagnoseId):
    userId = session['user_id']
    diagoseLog = DiagnoseLog(userId, diagnoseId,
                             constant.DiagnoseLogAction.DiagnoseRefund)
    DiagnoseLog.save(session, diagoseLog)

    diagnose = Diagnose.getDiagnoseById(diagnoseId)
    if diagnose.status == constant.DiagnoseStatus.Diagnosed:
        diagnosePayStats = DiagnosePayStats.getPayStatsByDiagnoseId(diagnoseId)
        for payStats in diagnosePayStats:
            payStats.status = constant.DiagnosePayStatsConstant.Refund
        DiagnosePayStats.updatePayStats(diagnosePayStats)

    return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
def diagnoseFinish(diagnoseId):
    diagnosePayStats = DiagnosePayStats()
    diagnose = Diagnose.getDiagnoseById(diagnoseId)
    diagnosePayStats.diagnoseId = diagnoseId
    diagnosePayStats.diagnoseSeriesNumber = diagnose.diagnoseSeriesNumber
    diagnosePayStats.userId = session["user_id"]
    diagnosePayStats.finishDate = datetime.now()
    diagnosePayStats.money = diagnose.money
    diagnosePayStats.status = constant.DiagnosePayStatsConstant.Ongoing
    DiagnosePayStats.save(diagnosePayStats)
    resultJson=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg)
    return  json.dumps(resultJson.__dict__,ensure_ascii=False)
Beispiel #5
0
    def testGetPayStats(self):
        rs = DiagnosePayStats.getDetailPayStats(1, 0)
        for row in rs:
            print 'usable'
            print row.id, row.finishDate
            print 'finish usable'

        rs = DiagnosePayStats.getDetailPayStats(1, 3)
        for row in rs:
            print 'payable'
            print row.id, row.finishDate
            print 'finish payable'

        rs = DiagnosePayStats.getDetailPayStats(1, 2)
        for row in rs:
            print 'paid'
            print row.id, row.finishDate
            print 'paid'
def getPayStatsSummary():
    user = session['user_id']
    summary = DiagnosePayStats.getSummaryPayStats(user)
    dict={}
    dict['ongoing']=float(summary[0])
    dict['payable']=float(summary[1])
    dict['paid']=float(summary[2])
    dict['lastMonthRevenue']= float(summary[3])

    resultJson=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,dict)
    return  json.dumps(resultJson.__dict__,default=json_encode_decimal)
Beispiel #7
0
def getPayStatsSummary():
    user = session['user_id']
    summary = DiagnosePayStats.getSummaryPayStats(user)
    dict = {}
    dict['ongoing'] = float(summary[0])
    dict['payable'] = float(summary[1])
    dict['paid'] = float(summary[2])
    dict['lastMonthRevenue'] = float(summary[3])

    resultJson = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, dict)
    return json.dumps(resultJson.__dict__, default=json_encode_decimal)
def pay(statsOldStatus, statsNewStatus, logStatus):
    user = session['user_id']
    if user is None:
        result=rs.ResultStatus(rs.FAILURE.status,rs.FAILURE.msg)
        return  json.dumps(result.__dict__,ensure_ascii=False)
    result = DiagnosePayStats.updatePaidStatsStatus(user,statsOldStatus, statsNewStatus)
    log = DiagnosePayStatsLog.insertNewItem(logStatus,user,result[0])
    DiagnosePayStatsLogRel.insertNewItem(result[1],log)
    dict = {}
    dict['money'] = float(result[0])
    resultJson=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,dict)
    return  json.dumps(resultJson.__dict__,ensure_ascii=False)
Beispiel #9
0
def pay(statsOldStatus, statsNewStatus, logStatus):
    user = session['user_id']
    if user is None:
        result = rs.ResultStatus(rs.FAILURE.status, rs.FAILURE.msg)
        return json.dumps(result.__dict__, ensure_ascii=False)
    result = DiagnosePayStats.updatePaidStatsStatus(user, statsOldStatus,
                                                    statsNewStatus)
    log = DiagnosePayStatsLog.insertNewItem(logStatus, user, result[0])
    DiagnosePayStatsLogRel.insertNewItem(result[1], log)
    dict = {}
    dict['money'] = float(result[0])
    resultJson = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, dict)
    return json.dumps(resultJson.__dict__, ensure_ascii=False)
Beispiel #10
0
 def testGetSummary(self):
     summary = DiagnosePayStats.getSummaryPayStats(1)
     print summary[0], summary[1], summary[2], summary[3]
Beispiel #11
0
    def testAddPayStats(self):
        payStats = DiagnosePayStats()
        payStats.id = 1
        payStats.diagnoseId = 1
        payStats.userId = 1
        payStats.diagnoseId = 'SC000001'
        payStats.finishDate = datetime.datetime.strptime('2014-10-19', '%Y-%m-%d')
        payStats.money = 150
        payStats.status = 0
        DiagnosePayStats.save(payStats)

        payStats = DiagnosePayStats()
        payStats.id = 2
        payStats.diagnoseId = 1
        payStats.userId = 1
        payStats.diagnoseId = 'SC000002'
        payStats.finishDate = datetime.datetime.strptime('2014-11-07', '%Y-%m-%d')
        payStats.money = 150
        payStats.status = 0
        DiagnosePayStats.save(payStats)

        payStats = DiagnosePayStats()
        payStats.id = 3
        payStats.diagnoseId = 1
        payStats.userId = 1
        payStats.diagnoseId = 'SC000002'
        payStats.finishDate = datetime.datetime.strptime('2014-10-19', '%Y-%m-%d')
        payStats.money = 150
        payStats.status = 2
        DiagnosePayStats.save(payStats)

        payStats = DiagnosePayStats()
        payStats.id = 4
        payStats.diagnoseId = 1
        payStats.userId = 1
        payStats.diagnoseId = 'SC000002'
        payStats.finishDate = datetime.datetime.strptime('2014-10-19', '%Y-%m-%d')
        payStats.money = 150
        payStats.status = 3
        DiagnosePayStats.save(payStats)

        payStats = DiagnosePayStats()
        payStats.id = 5
        payStats.diagnoseId = 1
        payStats.userId = 1
        payStats.diagnoseId = 'SC000002'
        payStats.finishDate = datetime.datetime.strptime('2014-10-19', '%Y-%m-%d')
        payStats.money = 151
        payStats.status = 2
        DiagnosePayStats.save(payStats)
def getRecordList(stats, paginate, pageIndex, pageSize):
    user = session['user_id']
    return getList(user, DiagnosePayStats.getDetailPayStats(user, stats,paginate,pageIndex,pageSize))
Beispiel #13
0
def getRecordList(stats, paginate, pageIndex, pageSize):
    user = session['user_id']
    return getList(
        user,
        DiagnosePayStats.getDetailPayStats(user, stats, paginate, pageIndex,
                                           pageSize))