zoukankan      html  css  js  c++  java
  • SQL-005验证门店收货单没有完成的

    /* Formatted on 2020/12/08 17:31:50 (QP5 v5.326) */
      SELECT DISTINCT head.VBILLCODE         AS 单据号,
                      head.DBILLDATE         AS 单据日期,
                      head.CBILLTYPECODE     AS 业务类型,
                      head.cothercorpid,
                      bcb.BODYNAME           AS 库存组织,
                      bsd.STORNAME           AS 门店
        FROM ic_general_h head
             LEFT JOIN ic_general_b body ON head.cgeneralhid = body.cgeneralhid
             LEFT JOIN ic_general_bb3 bb3
                 ON body.cgeneralbid = bb3.cgeneralbid AND bb3.dr = 0
             LEFT JOIN to_bill tobill ON body.cfirstbillhid = tobill.cbillid
             LEFT JOIN bd_calbody bcb ON head.cothercalbodyid = bcb.PK_CALBODY
             LEFT JOIN bd_stordoc bsd ON head.cotherwhid = bsd.PK_STORDOC
       WHERE     head.dr = 0
             AND body.dr = 0
             AND (head.fbillflag = 3 OR head.fbillflag = 4)
             AND NVL (head.dr, 0) = 0
             AND NVL (body.dr, 0) = 0
             AND head.cbilltypecode = '4Y'
             AND NVL (bb3.dr, 0) = 0
             AND body.isok = 'N'
             AND body.noutnum IS NOT NULL
             AND NVL (body.btou8rm, 'N') = 'N'
             AND NOT EXISTS
                     (SELECT 1
                        FROM ic_general_b
                       WHERE     csourcetype = '4Y'
                             AND ic_general_b.csourcebillbid = body.cgeneralbid
                             AND NVL (dr, 0) = 0)
             AND head.cbilltypecode = '4Y'
             AND (head.dbilldate >= '2014-01-01')
             -- AND (head.dbilldate <= '2022-10-27')
             AND (cbilltypecode = '4Y')
    ORDER BY 单据日期 DESC
  • 相关阅读:
    SQL的update from 理解
    JS自动合并表格
    完全备份ORACLE数据库 并在另一台电脑上恢复
    cmd 连接到指定路径
    oracle 11g 64位安装sqldeveloper打开不了
    oracle 11g卸载方法
    sql的游标使用(转)
    JQEUERY案例
    sessionStorage实现note的功能
    Web Worker模拟抢票
  • 原文地址:https://www.cnblogs.com/Chengjr/p/14103809.html
Copyright © 2011-2022 走看看