zoukankan      html  css  js  c++  java
  • 时间差值

    alter procedure Asset_spQueryAlertInfomation
    (
     @pi_Action VARCHAR(100),
     @pi_InfoId BIGINT,
     @pi_pageIndex INT,
     @pi_pageSize INT,
     @po_recordCount BIGINT OUTPUT
    )
    as
     DECLARE @pt_StartRowIndex INT
     DECLARE @pt_EndRowIndex INT
     
     SET @pt_StartRowIndex = (@pi_pageIndex - 1) * @pi_pageSize + 1
     SET @pt_EndRowIndex = @pi_pageIndex * @pi_PageSize

    IF @pi_Action = 'getlist'
     BEGIN
    SELECT * FROM
      (
    SELECT   Asset_ReceiptDetail.InfoId,  Asset_Subject.SubjectCode, Asset_Subject.SubjectName, Asset_Contract_ChargePlan.CostStartDate, Asset_Contract_ChargePlan.CostEndDate,
             Asset_Contract_ChargePlan.ShouldGetDate, Asset_Contract_ChargePlan.SumMoney, Asset_ReceiptMain.ContractCode,
             Asset_Contract_ChargePlan.ChargePlanCode, Asset_ReceiptDetail.IsReceipt,
    ROW_NUMBER() OVER (ORDER BY Asset_Contract_ChargePlan.InfoId DESC) AS RowIndex,
    'IsReceipts' = (
       CASE
       WHEN IsReceipt = 0 THEN '否'
                            when IsReceipt is null then '否'
       ELSE
        '是'
       End)
    FROM     Asset_ChargedItems INNER JOIN
             Asset_Contract_ChargePlan ON Asset_ChargedItems.ChargedItemCode = Asset_Contract_ChargePlan.ChargedItemCode INNER JOIN
             Asset_Subject ON Asset_ChargedItems.SubjectCode = Asset_Subject.SubjectCode INNER JOIN
             Asset_ReceiptMain ON Asset_Contract_ChargePlan.ContractCode = Asset_ReceiptMain.ContractCode LEFT JOIN
             Asset_ReceiptDetail ON Asset_Contract_ChargePlan.ChargePlanCode = Asset_ReceiptDetail.ChagePlanCode
    WHERE datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)<=30 and  datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)>=0

    --应收日期与当前日期差值小于30天的记录同时是正值

    )tba
      WHERE RowIndex BETWEEN @pt_StartRowIndex AND @pt_EndRowIndex

    SELECT @po_recordCount = COUNT(*)
    FROM     Asset_ChargedItems INNER JOIN
             Asset_Contract_ChargePlan ON Asset_ChargedItems.ChargedItemCode = Asset_Contract_ChargePlan.ChargedItemCode INNER JOIN
             Asset_Subject ON Asset_ChargedItems.SubjectCode = Asset_Subject.SubjectCode INNER JOIN
             Asset_ReceiptMain ON Asset_Contract_ChargePlan.ContractCode = Asset_ReceiptMain.ContractCode LEFT JOIN
             Asset_ReceiptDetail ON Asset_Contract_ChargePlan.ChargePlanCode = Asset_ReceiptDetail.ChagePlanCode
    WHERE datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)<=30 and  datediff(day,getdate(),Asset_Contract_ChargePlan.ShouldGetDate)>=0

    end

  • 相关阅读:
    一个生成随机颜色的js函数
    实战vue代码
    vue练习用免费开源api大全
    vue-resource插件使用
    专题 查找与排序的Java代码实现(一)
    十字链表的画法
    20162322 朱娅霖 作业009 堆和优先队列
    20162322 朱娅霖 作业008 二叉查找树
    20162322 朱娅霖 实验报告二 树
    20162322 朱娅霖 作业007 树
  • 原文地址:https://www.cnblogs.com/howie/p/2471396.html
Copyright © 2011-2022 走看看