select date(payment_date),
sum(case when period = 1 and overdue_long>8 then month_capital else null end )/sum(month_capital) mob1; --账龄1期sum(case when (period = 1 and overdue_long>15) or (period=2 and overdue_long>8) then month_capital else null end)
/sum(month_capital) mob2; -- 账龄2期sum(case when (period = 1 and overdue_long >22) or (period =2 and overdue_long>15) or(period = 3 and overdue_long >8)
then month_capital else null)/sum(month_capital) mob3; --账龄3期sum(case when (period =1 and overdue_long>29) or (period = 2 and overdue_long>22) or (period =3 and overdue_long>1)
or (period =4 and overdue_long>8) then month_capital else null end)/sum(month_capital) mob4; --账龄4期from
(select *
case when e.repay_status =1 then datediff(date(now()),date(e.repay_time))when e.repay_status =2 and remind_end_date is null then 0when e.repay_status =2 and remind_end_date is not null then datediff(date(remind_end_date),date(e.repay_time))else null end overdue_long --逾期天数计算from
# 合同表
(select * from bor_contract where create_time >='2019-08-01 00:00:00' and period =4)a
# 还款计划表
left join
(select * from bor_installment_plan as bip) d on a.apply_id = d.apply_id
# 实际还款表
left join
(select * from huankuan) e on a.apply_id= e.apply_id and d.period=e.period
# 催收表
left join
(select * from cuishou) f on a.contract_id =f.contract_id and date(d.repay_time) = date_add(date(f.overdue_date),interval-1 day)
where b.apply = 'dd' -- 产品
and b.first_again = 2 --新户,老户
and b.create_time>='2019-06-01 00:00:00' --借款时间限制
)bb
group by
date(payment_date)
order by
date(payment_date);

vintage账龄报表代码相关推荐

  1. 库存账龄报表开发总结——Sqlserver LAG()的使用

    库存账龄报表开发总结--Sqlserver LAG()的使用 开发需求 根据出入库流水明细,查询对应产品库存状态:包含库龄.库存量及其金额等. 注意:出库按照先入先出的规则进行. 例如: 物品 数量 ...

  2. 到期日计算,账龄报表

    到期日计算: 到期日是表示该应收应付是否已经到期,根据凭证产生时的基限日期(baseline date)和OME2定义的付款条件的日期计算而来. 应收应付账龄报表也是按此计算和出具. 系统标准的账龄分 ...

  3. 如何在BW中做账龄的动态显示

    通常在BW报表中 账龄都是做死的,首先计算查询日期与过账日期(或者截至日期)的天数,通过布尔值 计算是否显示这个金额. 问题是新来一个妹子提出了这个要求: 账龄时间段:灵活查询设置 ,比如可输入字段一 ...

  4. easyui datagrid不是相邻的能合并单元格吗_介绍一种划分账龄的方法,要不了半个小时就能完成...

    有小朋友叫我讲讲往来款,那我就先讲讲怎么划分账龄吧.有些小朋友觉得划分账龄是一件非常耗时的事. 我觉得吧,没那么复杂,简单得很,只要你学会了这种方法. 以应收账款为例. 如上图,在J9单元格写下这个公 ...

  5. 【MM系列】SAP库龄报表逻辑理解

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP库龄报表逻辑理解 前言部分 大 ...

  6. 【MM系列】SAP SAP库龄报表逻辑理解

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP SAP库龄报表逻辑理解 前言 ...

  7. SAP库龄报表逻辑理解

     SAP库龄报表逻辑理解 https://blog.csdn.net/SAPmatinal/article/details/65936087 第一篇 存货帐龄和呆滞料分析 通常库存周转率高,则帐龄 ...

  8. oracle erp 库存账龄,系统管理、年结后,新年度做账龄分析,原来几年的账龄-用友U8...

    文章摘要:本文提供在用友U8V8.72erp软件财务会计管理的总账模块中系统管理.年结后,新年度做账龄分析,原来几年的账龄现在都在30-60天了,是什么原因?的解决办法. 问题现象:在用友U8V8.7 ...

  9. 骨龄预测代码学习(一)

    骨龄预测代码学习(一) 代码/数据来源: 代码详解: 运行结果: 总结: 代码/数据来源: 数据集:RSNA. 代码:github. 代码详解: 从GitHub里下载的代码....完全看不懂,所以今天 ...

最新文章

  1. dialog监听点击空白关闭_为什么App Store打开一片空白?尝试这样解决
  2. flink dataset api使用及原理
  3. php入门时间,PHP入门(8)日期和时间
  4. python pp模块_Python模块--Pexpect
  5. Android 物联网 传感器
  6. Xshell连接Linux下Oracle无法回退的解决办法
  7. TCP和UDP报文头格式(转)
  8. 【R语言】R是现在最好的数据科学语言吗?
  9. Atitit 架构之道 之 可读性可维护性架构之道 提升效率架构之道 attilax著 艾龙 著 1.1. Hybrid架构 1 1.2. 分层架构是使用最多的架构模式 Layers模式 也称Tie
  10. fpga烧写bin文件_FPGA烧写的方式和具体过程分析
  11. 调用百度地图API实现连线高铁线路的调用示例
  12. 【emoji大全宝典】
  13. python 数学公式显示_python 数学公式·
  14. EagleEye:一种用模型剪枝的快速衡量子网络性能的方法
  15. android老人机桌面,孝敬父母哪家强?老人桌面大横评
  16. 【AI视野·今日NLP 自然语言处理论文速览 第三期】Tue, 8 Jun 2021
  17. 【C++学习笔记】函数基础和参数传递
  18. 与Zeynep Tufekci讨论社交媒体驱动的抗议的未来
  19. 人工智能起源| 阿兰·图灵的《计算机器与智能》
  20. python自动化(三)web自动化:2.web自动化工具selenium讲解

热门文章

  1. [转载] 七龙珠第一部——第107话 孙悟空大发雷霆
  2. 游戏耳机什么牌子好?2022年高性价比蓝牙耳机推荐
  3. c语言和python区别
  4. MATLAB只randint函数
  5. 2016年10月1日--国庆日晚上
  6. 聊聊(学历低、非科班、培训)真的进不去大厂吗?
  7. mysql int字段 被转成Long问题解决
  8. liunx新服务器安装------------node,jdk,mongodb,redis,activemq,mysql,face-recognition
  9. 视错觉升级版:多个视错觉效果实现
  10. 只做最好 2014款Jeep指南者