def merger_douban_target(): targets = [k for k in OutSourceTarget.all() if k.otype in [1, None]] personal_targets = [k for k in OutSourceTarget.all() if k.otype == 2] return tpl('merger_douban_target.html', targets=targets, personal_targets=personal_targets, OUTSOURCE_STATUS_APPLY_MONEY=OUTSOURCE_STATUS_APPLY_MONEY, OUTSOURCE_STATUS_PAIED=OUTSOURCE_STATUS_PAIED, OUTSOURCE_STATUS_PASS=OUTSOURCE_STATUS_PASS)
def douban_index(): if not g.user.is_finance(): abort(404) targets = [{ 'id': k.id, 'name': k.name, 'type_cn': k.type_cn, 'bank': k.bank, 'card': k.card, 'alipay': k.alipay, 'contract': k.contract, 'unpay': len(k.merger_douban_order_outsources_by_status(2)), 'pay': len(k.merger_douban_order_outsources_by_status(0))} for k in OutSourceTarget.all() if k.otype in [1, None]] personal_targets = {'unpay': MergerDoubanPersonalOutSource.query.filter_by(status=2).count(), 'pay': MergerDoubanPersonalOutSource.query.filter_by(status=0).count()} targets = sorted(targets, key=operator.itemgetter('unpay'), reverse=True) return tpl('/finance/outsource/pay/douban_index.html', targets=targets, personal_targets=personal_targets)
def __init__(self, *args, **kwargs): super(DoubanOutsourceForm, self).__init__(*args, **kwargs) self.target.choices = [(ost.id, ost.name) for ost in OutSourceTarget.all()] self.type.choices = OUTSOURCE_TYPE_CN.items() self.subtype.choices = OUTSOURCE_SUBTYPE_CN.items()
def targets(): targets = OutSourceTarget.all() if request.values.get('action') == 'excel': return write_target_info(targets) return tpl('targets.html', targets=targets)