Subversion Repositories SmartDukaan

Rev

Rev 6188 | Rev 6196 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6188 Rev 6190
Line 3520... Line 3520...
3520
    currentOrders = {}
3520
    currentOrders = {}
3521
    amounts = {}
3521
    amounts = {}
3522
    
3522
    
3523
    sorders = session.query(RechargeOrder.status, func.count(RechargeOrder.status)).group_by(RechargeOrder.status).all()
3523
    sorders = session.query(RechargeOrder.status, func.count(RechargeOrder.status)).group_by(RechargeOrder.status).all()
3524
    for sorder in sorders:
3524
    for sorder in sorders:
3525
        statusCounts[sorder.status] = sorder.count
3525
        statusCounts[sorder[0]] = sorder[1]
3526
    
3526
    
3527
    oorders = session.query(MobileRechargeOrder.mobileOperatorId, func.count(MobileRechargeOrder.mobileOperatorId)).group_by(MobileRechargeOrder.mobileOperatorId).all()
3527
    oorders = session.query(MobileRechargeOrder.mobileOperatorId, func.count(MobileRechargeOrder.mobileOperatorId)).group_by(MobileRechargeOrder.mobileOperatorId).all()
3528
    for oorder in oorders:
3528
    for oorder in oorders:
3529
        operatorCounts[oorder.status] = oorder.count
3529
        operatorCounts[oorder[0]] = oorder[1]
3530
 
3530
 
3531
    oorders = session.query(DTHRechargeOrder.dthOperatorId, func.count(DTHRechargeOrder.dthOperatorId)).group_by(DTHRechargeOrder.dthOperatorId).all()
3531
    oorders = session.query(DTHRechargeOrder.dthOperatorId, func.count(DTHRechargeOrder.dthOperatorId)).group_by(DTHRechargeOrder.dthOperatorId).all()
3532
    for oorder in oorders:
3532
    for oorder in oorders:
3533
        operatorCounts[oorder.status] = oorder.count
3533
        operatorCounts[oorder[0]] = oorder[1]
3534
 
3534
 
3535
    forders = RechargeOrder.query.order_by(desc(RechargeOrder.id)).filter_by(status = RechargeOrderStatus.RECHARGE_FAILED).limit(10).all()
3535
    forders = RechargeOrder.query.order_by(desc(RechargeOrder.id)).filter_by(status = RechargeOrderStatus.RECHARGE_FAILED).limit(10).all()
3536
    currentOrders[RechargeOrderStatus._VALUES_TO_NAMES.get(RechargeOrderStatus.RECHARGE_FAILED)] = [order.to_thrift_object() for order in forders]
3536
    currentOrders[RechargeOrderStatus._VALUES_TO_NAMES.get(RechargeOrderStatus.RECHARGE_FAILED)] = [order.to_thrift_object() for order in forders]
3537
    sorders = RechargeOrder.query.order_by(desc(RechargeOrder.id)).filter_by(status = RechargeOrderStatus.RECHARGE_SUCCESSFUL).limit(20).all()
3537
    sorders = RechargeOrder.query.order_by(desc(RechargeOrder.id)).filter_by(status = RechargeOrderStatus.RECHARGE_SUCCESSFUL).limit(20).all()
3538
    currentOrders[RechargeOrderStatus._VALUES_TO_NAMES.get(RechargeOrderStatus.RECHARGE_SUCCESSFUL)] = [order.to_thrift_object() for order in forders]
3538
    currentOrders[RechargeOrderStatus._VALUES_TO_NAMES.get(RechargeOrderStatus.RECHARGE_SUCCESSFUL)] = [order.to_thrift_object() for order in forders]
3539
    
3539
    
3540
    amounts['Total Wallet Amount'] = session.query(func.sum(UserWallet.amount)).all()
3540
    twa = session.query(func.sum(UserWallet.amount)).one()
3541
    amounts['Recharge Amount'] = session.query(func.sum(RechargeOrder.totalAmount)).filter(RechargeOrder.status == RechargeOrderStatus.RECHARGE_SUCCESSFUL).scaler() 
3541
    tra = session.query(func.sum(RechargeOrder.totalAmount)).filter(RechargeOrder.status == RechargeOrderStatus.RECHARGE_SUCCESSFUL).one()
3542
    amounts['Gift Wallet Amount'] = session.query(func.sum(UserWalletHistory.amount)).filter(UserWalletHistory.orderId > 100000).all()
3542
    gwa = session.query(func.sum(UserWalletHistory.amount)).filter(UserWalletHistory.orderId > 100000).one()
3543
    amounts['Payment Amount'] = session.query(func.sum(UserWalletHistory.amount)).filter(UserWalletHistory.orderId < 100000).all()
3543
    tpa = session.query(func.sum(UserWalletHistory.amount)).filter(UserWalletHistory.orderId < 100000).one()
-
 
3544
    amounts['Total Wallet Amount'] = twa[0]
-
 
3545
    amounts['Total Recharge Amount'] = tra[0]
-
 
3546
    amounts['Gift Wallet Amount'] = gwa[0]
-
 
3547
    amounts['Total Payment Amount'] = tpa[0]
3544
    
3548
 
3545
    rs.statusCounts = statusCounts
3549
    rs.statusCounts = statusCounts
3546
    rs.operatorCounts = operatorCounts    
3550
    rs.operatorCounts = operatorCounts    
3547
    rs.currentOrders = currentOrders
3551
    rs.currentOrders = currentOrders
3548
    rs.amounts = amounts
3552
    rs.amounts = amounts
3549
    
3553