<?xml version="1.0" encoding="UTF-8"?>
 <queryMap desc="合同评审价格界面查询">

  <query id="frmOrderReviewPrice.CoreOrderReviewPriceQuery" desc="合同价格评审信息">
        <![CDATA[
               SELECT B.ORDER_NO,B.CUSTM_ORDER_NO,B1.REVIEW_F_RS,B.ORD_PK,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.ORDER_TYP) ORDER_TYP,
            B.SALE_AREA_DESC SALE_AREA_NO,
            B.ORDER_YEAR,B.SIGN_DATE,B.SIGN_ADDRESS,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.SUPPLY_UNIT) SUPPLY_UNIT,
            (SELECT CUSTOMER_NM FROM SLM_BASE_CUSTOMER  WHERE  CUSTOMER_NO = B.STLMT_UNIT_NO) STLMT_UNIT_NO,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.MNY_ASK_TYP) MNY_ASK_TYP,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.CURRENCY) CURRENCY,
      		B.ORDER_STS,
     (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = ORDER_STS AND VALIDFLAG = '1' ) ORDER_STS_DESC,
      CLOSE_TIME,
      B.EFFECT_TIME,B.APPROVAL_TIME,B.DELETE_TIME,B.DELETE_NAME,B.UPDATE_TIME,B.UPDATE_NAME,
      B.CREATE_TIME,B.CREATE_NAME,
      decode(B.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
      B.ORDER_MODEL_NO,
      B.ORDER_MODEL_DESC,
            B.MNY_ASK_DESC,B.MANAG_NO,
            B.CUSTOMER_NM CUSTOMER_NO,
            B.SALE_ORG,
            B.MEMO,
            DECODE(LENGTH(B.PRICE_NO),15,B.PRICE_NO,'') PRICE_NO,
      	    DECODE(LENGTH(C.PRICE_NO),15,DECODE(C.PRICE_STATUS,'L','封锁','D','无效','W','待审','S','通过','F','不通过'),'') PRICE_STATUS,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.PRICE_FL) PRICE_FL,
            DECODE(B.CUSTOMER_MODEL_FL,'1','TRUE','FALSE') CUSTOMER_MODEL_FL, B1.REVIEW_ITM,B1.REVIEW_STATUS
            FROM  SLM_ORDER_HEAD B, SLM_ORDER_REVIEW_ITEM_LIST B1,SLM_ORDER_PRICE C
           WHERE 1 = 1
             AND B.VALIDFLAG='1'
             AND B.ord_pk = B1.LIST_PK_VAL
             AND B1.REVIEW_ITM = 'P'
             and b1.is_curt_review = '1'
             and B.ORDER_STS in ('12020224')
             AND B.PRICE_NO = C.PRICE_NO(+)
        ]]>
    </query>
    
     <query id="frmOrderReviewPrice.CoreOrderReviewPriceQueryPass" desc="合同价格评审信息">
        <![CDATA[
               SELECT B.ORDER_NO,B.CUSTM_ORDER_NO,B.ORD_PK,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.ORDER_TYP) ORDER_TYP,
            B.SALE_AREA_DESC SALE_AREA_NO,
            B.ORDER_YEAR,B.SIGN_DATE,B.SIGN_ADDRESS,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.SUPPLY_UNIT) SUPPLY_UNIT,
            (SELECT CUSTOMER_NM FROM SLM_BASE_CUSTOMER  WHERE  CUSTOMER_NO = B.STLMT_UNIT_NO) STLMT_UNIT_NO,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.MNY_ASK_TYP) MNY_ASK_TYP,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.CURRENCY) CURRENCY,
      		B.ORDER_STS,
     (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = ORDER_STS AND VALIDFLAG = '1' ) ORDER_STS_DESC,
      CLOSE_TIME,
      B.EFFECT_TIME,B.APPROVAL_TIME,B.DELETE_TIME,B.DELETE_NAME,B.UPDATE_TIME,B.UPDATE_NAME,
      B.CREATE_TIME,B.CREATE_NAME,
      decode(B.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
      B.ORDER_MODEL_NO,
      B.ORDER_MODEL_DESC,
            B.MNY_ASK_DESC,B.MANAG_NO,
            B.CUSTOMER_NM CUSTOMER_NO,
            B.SALE_ORG,
            B.MEMO,
            DECODE(LENGTH(B.PRICE_NO),15,B.PRICE_NO,'') PRICE_NO,
      	    DECODE(LENGTH(C.PRICE_NO),15,DECODE(C.PRICE_STATUS,'L','封锁','D','无效','W','待审','S','通过','F','不通过'),'') PRICE_STATUS,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.PRICE_FL) PRICE_FL,
            DECODE(B.CUSTOMER_MODEL_FL,'1','TRUE','FALSE') CUSTOMER_MODEL_FL
            FROM  SLM_ORDER_HEAD B,SLM_ORDER_PRICE C
           WHERE 1 = 1
             and B.ORDER_STS >='12020232'
             AND B.VALIDFLAG = '1'
             AND B.PRICE_NO = C.PRICE_NO(+)
             AND (SELECT TO_NUMBER(COUNT(1) -
             NVL(SUM(TO_NUMBER(A.BALNCE_PRICE_STS)), '0'))
               FROM SLM_ORDER_LINE A
              WHERE B.ORD_PK = A.ORD_PK
                AND A.VALIDFLAG = '1') >0
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.orderPriceQuery" desc="合同价格说明信息">
        <![CDATA[
            select PRICE_BASE from SLM_ORDER_PRICE where ord_pk = ?
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.orderPriceListQuery" desc="合同价格明细信息">
        <![CDATA[
            SELECT DISTINCT T.ORDER_SEQ,
                T.ORD_PK,
                T.PRODUCNAME,
                T.SPEC_NAME,
                T.MODEL_DESC,
                T.STD_NAME,
                T.LEN_DESC,
                T.ORDER_QTY,
                '(-' || TO_CHAR(DELVRY_RANGE_MIN) ||
                DECODE(DELVRY_RANGE_TPE, '%', '%', T.ORDER_UNIT) || ',' ||
                TO_CHAR(DELVRY_RANGE_MAX) ||
                DECODE(DELVRY_RANGE_TPE, '%', '%', T.ORDER_UNIT) || ')' DELVRY_RANGE,
                DELVRY_RANGE_MAX,
                DELVRY_RANGE_MIN,
                DELVRY_RANGE_TPE,
                T1.DELVRY_QTY,
                T.OUT_PRICE,
                T1.TRANSIT_MNY,
                (T.OUT_PRICE + T1.TRANSIT_MNY) SUMPRICE,
                (T.OUT_PRICE + T1.TRANSIT_MNY) * 1.13 SUMPRICEH,
                T.ORDER_QTY * (T.OUT_PRICE + T1.TRANSIT_MNY) SUMMANA,
                T.ORDER_QTY * (T.OUT_PRICE + T1.TRANSIT_MNY) * 1.13 SUMMANAH
				  FROM SLM_ORDER_LINE T, SLM_ORDER_LINE_DELIVERY T1
				 WHERE T.ORD_LN_PK = T1.ORD_LN_PK
				   AND T.ORD_PK = ?
				   AND T.VALIDFLAG = '1'
				   AND T1.VALIDFLAG = '1'
				   ORDER BY ORDER_SEQ

        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.appPriceAdd" desc="合同价格评审合同头信息">
        <![CDATA[
            UPDATE SLM_ORDER_HEAD SET ORDER_STS = '12020232',ORDER_STS_DESC = '价格评审通过',APPROVAL_MAN = ?,APPROVAL_TIME = SYSDATE,UPDATE_NAME= ? , UPDATE_TIME = SYSDATE WHERE ORD_PK = ?
        ]]>
    </query>
    
     <query id="frmOrderReviewPrice.appPriceAdd2" desc="合同价格评审评审主表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW SET REVIEW_STATUS = 'S',UPDATE_NAME = ?,UPDATE_TIME = SYSDATE WHERE ORD_PK = ?
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.appPriceAdd3" desc="合同价格评审评审项目表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW_ITEM SET REVIEW_STATUS = 'S',UPDATE_NAME= ?,CREATE_TIME = SYSDATE WHERE REVIEW_NO = 
            (SELECT T.REVIEW_NO FROM SLM_ORDER_REVIEW T WHERE T.ORD_PK = ?) AND REVIEW_ITM = 'P'
        ]]>
    </query>
    
     <query id="frmOrderReviewPrice.appPriceAdd4" desc="合同价格评审评审项目明细表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW_ITEM_LIST SET REVIEW_STATUS = 'S',REVIEW_F_RS = '',REVIEW_MAN = ?,UPDATE_NAME = ?,UPDATE_TIME = SYSDATE WHERE LIST_PK_VAL = ?
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.appPriceUpdate" desc="合同价格评审不通过业务修改合同主表">
        <![CDATA[
            UPDATE SLM_ORDER_HEAD SET ORDER_STS = '12020231',ORDER_STS_DESC = '价格评审失败',APPROVAL_MAN = '',APPROVAL_TIME = '',UPDATE_NAME= '' , UPDATE_TIME = '' WHERE ORD_PK = ?
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.appPriceUpdate2" desc="合同价格评审不通过业务填写不合格原因">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW_ITEM_LIST SET REVIEW_F_RS = ?,REVIEW_STATUS = 'F',REVIEW_MAN = '',UPDATE_NAME = '',UPDATE_TIME = ''  WHERE LIST_PK_VAL = ? AND REVIEW_ITM = 'P'
        ]]>
    </query>
    
     <query id="frmOrderReviewPrice.appPriceUpdate3" desc="合同价格评审不通过写评审主表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW SET REVIEW_STATUS = 'F',UPDATE_NAME = '',UPDATE_TIME = '' WHERE ORD_PK = ?
        ]]>
    </query>
    
     <query id="frmOrderReviewPrice.appPriceUpdate4" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
            UPDATE SLM_ORDER_REVIEW_ITEM SET REVIEW_STATUS = 'F',UPDATE_NAME= '',CREATE_TIME = '' WHERE REVIEW_NO = 
            (SELECT T.REVIEW_NO FROM SLM_ORDER_REVIEW T WHERE T.ORD_PK = ?) AND REVIEW_ITM = 'P'
        ]]>
    </query>
    
     <query id="frmOrderReviewPrice.updateOutBalPrice" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
        
    UPDATE SLM_ORDER_LINE A
   SET A.OUT_PRICE           =
       (SELECT B.OUT_PRICE
          FROM SLM_ORDER_PRICE_LIST B
         WHERE B.PRICE_NO = (SELECT C.PRICE_NO
                               FROM SLM_ORDER_HEAD C
                              WHERE C.ORD_PK = A.ORD_PK)
           AND B.ORD_LN_PK = A.ORD_LN_PK),
       A.BALNCE_PRICE        =
       (SELECT B.BLA_PRICE
          FROM SLM_ORDER_PRICE_LIST B
         WHERE B.PRICE_NO = (SELECT C.PRICE_NO
                               FROM SLM_ORDER_HEAD C
                              WHERE C.ORD_PK = A.ORD_PK)
           AND B.ORD_LN_PK = A.ORD_LN_PK),
       A.BALNCE_PRICE_STS     = '0',
       A.BALNCE_PRICE_ORG_STS = '0'
      WHERE A.ORD_PK = ?
    
             
        ]]>
    </query>
    
    <!-- //////////////////////////////ChPrice销售钢贸 价格变更    国贸价格维护     ////////////、、、、、、、、。。。 -->
    
     <query id="frmOrderReviewPrice.ChgeOrderPriceQueryXSAndGM" desc="销售和钢贸合同价格变更信息查询">
        <![CDATA[
          SELECT B.ORDER_NO,
       B.CUSTM_ORDER_NO,
       B1.REVIEW_F_RS,
       B.ORD_PK,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.ORDER_TYP) ORDER_TYP,
       B.SALE_AREA_DESC SALE_AREA_NO,
       B.ORDER_YEAR,
       B.SIGN_DATE,
       B.SIGN_ADDRESS,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.SUPPLY_UNIT) SUPPLY_UNIT,
       (SELECT CUSTOMER_NM
          FROM SLM_BASE_CUSTOMER
         WHERE CUSTOMER_NO = B.STLMT_UNIT_NO) STLMT_UNIT_NO,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.MNY_ASK_TYP) MNY_ASK_TYP,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.CURRENCY) CURRENCY,
       B.ORDER_STS,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = ORDER_STS
           AND VALIDFLAG = '1') ORDER_STS_DESC,
       CLOSE_TIME,
       B.EFFECT_TIME,
       B.APPROVAL_TIME,
       B.DELETE_TIME,
       B.DELETE_NAME,
       B.UPDATE_TIME,
       B.UPDATE_NAME,
       B.CREATE_TIME,
       B.CREATE_NAME,
       DECODE(B.VALIDFLAG, '1', '有效', '0', '无效') VALIDFLAG,
       B.ORDER_MODEL_NO,
       B.ORDER_MODEL_DESC,
       B.MNY_ASK_DESC,
       B.MANAG_NO,
       B.CUSTOMER_NM CUSTOMER_NO,
       B.SALE_ORG,
       B.MEMO,
       DECODE(LENGTH(B.PRICE_NO), 15, B.PRICE_NO, '') PRICE_NO,
       DECODE(LENGTH(C.PRICE_NO),
              15,
              DECODE(C.PRICE_STATUS,
                     'L',
                     '封锁',
                     'D',
                     '无效',
                     'W',
                     '待审',
                     'S',
                     '通过',
                     'F',
                     '不通过'),
              '') PRICE_STATUS,
       DECODE((SELECT TO_NUMBER(COUNT(1) -
              NVL(SUM(TO_NUMBER(A.BALNCE_PRICE_STS)), '0'))
                FROM SLM_ORDER_LINE A
               WHERE B.ORD_PK = A.ORD_PK
                 AND B.VALIDFLAG = '1'),
              '0',
              '确认',
              '未确认') BAL_PRICE_STATUS,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = B.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.PRICE_FL) PRICE_FL,
       DECODE(B.CUSTOMER_MODEL_FL, '1', 'TRUE', 'FALSE') CUSTOMER_MODEL_FL,
       B1.REVIEW_ITM,
       B1.REVIEW_STATUS
  FROM SLM_ORDER_HEAD B, SLM_ORDER_REVIEW_ITEM_LIST B1, SLM_ORDER_PRICE C
  WHERE 1 = 1
   AND B.ORD_PK = B1.LIST_PK_VAL
   AND B1.REVIEW_ITM = 'P'
   AND B1.IS_CURT_REVIEW = '1'
   AND B.ORDER_STS >= '12020232'
   AND B.VALIDFLAG = '1'
   AND B.CREATE_NAME IS NOT NULL
   AND B.PRICE_NO = C.PRICE_NO(+)
        ]]>
    </query>
    
    
      <query id="frmOrderReviewPrice.ChgeOrderPriceQueryIE" desc="国贸合同价格变更信息查询">
        <![CDATA[
       SELECT B.ORDER_NO,
       B.CUSTM_ORDER_NO,
       '' REVIEW_F_RS,
       B.ORD_PK,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.ORDER_TYP) ORDER_TYP,
       B.SALE_AREA_DESC SALE_AREA_NO,
       B.ORDER_YEAR,
       B.SIGN_DATE,
       B.SIGN_ADDRESS,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.SUPPLY_UNIT) SUPPLY_UNIT,
       (SELECT CUSTOMER_NM
          FROM SLM_BASE_CUSTOMER
         WHERE CUSTOMER_NO = B.STLMT_UNIT_NO) STLMT_UNIT_NO,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.MNY_ASK_TYP) MNY_ASK_TYP,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.CURRENCY) CURRENCY,
       B.ORDER_STS,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = ORDER_STS
           AND VALIDFLAG = '1') ORDER_STS_DESC,
       CLOSE_TIME,
       B.EFFECT_TIME,
       B.APPROVAL_TIME,
       B.DELETE_TIME,
       B.DELETE_NAME,
       B.UPDATE_TIME,
       B.UPDATE_NAME,
       B.CREATE_TIME,
       B.CREATE_NAME,
       DECODE(B.VALIDFLAG, '1', '有效', '0', '无效') VALIDFLAG,
       B.ORDER_MODEL_NO,
       B.ORDER_MODEL_DESC,
       B.MNY_ASK_DESC,
       B.MANAG_NO,
       B.CUSTOMER_NM CUSTOMER_NO,
       B.SALE_ORG,
       B.MEMO,
       DECODE(LENGTH(B.PRICE_NO), 15, B.PRICE_NO, '') PRICE_NO,
       DECODE(LENGTH(C.PRICE_NO),
              15,
              DECODE(C.PRICE_STATUS,
                     'L',
                     '封锁',
                     'D',
                     '无效',
                     'W',
                     '待审',
                     'S',
                     '通过',
                     'F',
                     '不通过'),
              '') PRICE_STATUS,
         DECODE((SELECT TO_NUMBER(COUNT(1) -
              NVL(SUM(TO_NUMBER(A.BALNCE_PRICE_STS)), '0'))
                FROM SLM_ORDER_LINE A
               WHERE B.ORD_PK = A.ORD_PK
                 AND B.VALIDFLAG = '1'),
              '0',
              '确认',
              '未确认') BAL_PRICE_STATUS,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = B.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.PRICE_FL) PRICE_FL,
       DECODE(B.CUSTOMER_MODEL_FL, '1', 'TRUE', 'FALSE') CUSTOMER_MODEL_FL,
       '' REVIEW_ITM,
       '' REVIEW_STATUS
  FROM SLM_ORDER_HEAD B, SLM_ORDER_PRICE C
  WHERE B.SALE_ORG = '100102'
   AND B.ORDER_STS >= '12020301'
   AND B.VALIDFLAG = '1'
   AND B.CREATE_NAME IS NOT NULL
   AND B.PRICE_NO = C.PRICE_NO(+)
        ]]>
    </query>
    
   <query id="frmOrderReviewPrice.queryPrice" desc="合同价格说明信息">
        <![CDATA[
             SELECT A.ORD_PK,
       A.MANAG_NO,
       A.ORDER_NO,
       A.CUSTM_ORDER_NO,
       A.REVW_RPT_NO,
       A.ORDER_TYP,
       A.ORDER_TYP_DESC,
       A.PROTCL_NO,
       A.CUSTOMER_NO,
       A.CUSTOMER_NM,
       A.ABRVITION,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = A.SUPPLY_UNIT) SUPPLY_UNIT,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = A.PRICE_FL) PRICE_FL,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = A.CURRENCY) CURRENCY,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = A.MNY_ASK_TYP) MNY_ASK_TYP,
       A.STLMT_UNIT_NO,
       A.STLMT_UNIT_NM,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = A.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
       A.MNY_ASK_DESC,
       A.SALE_ORG,
       A.SALE_ORG_DESC,
       A.SALE_AREA_NO,
       A.SALE_AREA_DESC,
       A.ORDER_STS,
       A.ORDER_STS_DESC,
       A.CREATE_NAME,
       A.CREATE_TIME,
       A.PRICE_NO,
       TO_CHAR(A.PASS_TIME, 'YYYY-MM-DD') PASS_TIME,
       TO_CHAR(A.CONFIRM_TIME, 'YYYY-MM-DD') CONFIRM_TIME,
       B.ORD_LN_PK,
       B.ORDER_SEQ,
       A.ORDER_NO || '/' || B.ORDER_SEQ ORDER_NO_SEQ,
       B.PSC,
       B.PSC_DESC,
       B.MSC,
       B.MSC_DESC,
       B.MSC_STYLE,
       B.USE_CODE,
       B.USE_DESC,
       B.PRODUCCODE,
       B.PRODUCNAME,
       B.STD_CODE,
       B.STD_NAME,
       B.STEELCODE,
       B.STEELNAME,
       B.STD_STYLE,
       B.STD_STYLE_DESC,
       B.ORDER_SPEC_CODE,
       B.ORDER_SPEC_DESC,
       B.SPEC_CODE,
       B.SPEC_NAME,
       B.DIMATER,
       B.HEIGHT,
       B.MODEL_CODE,
       B.MODEL_DESC,
       B.LEN_DESC,
       B.LEN_UNIT,
       B.LEN_MIN,
       B.LEN_MAX,
       B.SHRT_LEN_RATO,
       B.SHORTEST,
       B.LONG_LEN_RATO,
       B.LONGEST,
       B.SHRT_STOVE,
       B.AVG_LEN_MIN,
       B.DIFRNC_LEN_MAX,
       B.ENDLEN_SPECSTD,
       B.SIGL_LEN,
       B.ORDER_UNIT,
       B.ORDER_QTY,
       B.ORD_ENSU_TOTL_LEN,
       ('(-' || TO_CHAR(B.DELVRY_RANGE_MIN) ||
       DECODE(B.DELVRY_RANGE_TPE, '%', '%', '') || ',' ||
       TO_CHAR(B.DELVRY_RANGE_MAX) ||
       DECODE(B.DELVRY_RANGE_TPE, '%', '%', '') || ')') DELVRY_RANGE_TPE,
       B.FINAL_USER,
       B.FINAL_USER_DESC,
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B.OUTS_BILLET_FL) OUTS_BILLET_FL,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = B.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_FL,
       DECODE(B.ASSEL_FL, '1', '是', '否') ASSEL_FL,
       B.ORDER_ADD_DESC,
       B.ORDER_SPECIAL_DESC,
       ROUND(C.TRS_PRICE, 4) TRANS_PRICE,
       ROUND(C.OUT_PRICE, 4) OUT_PRICE,
       ROUND(C.BLA_PRICE, 4) BALNCE_PRICE,
       DECODE(B.BALNCE_PRICE_STS,'1','确认','未确认') BALNCE_PRICE_STS,
       ROUND(C.PAK_PRICE, 4) PAK_PRICE,
       ROUND(C.TON_PRICE, 4) TON_PRICE,
       B.AW,
       DECODE(B.KEEP_TYPE,'1','保总价','0','保单价') KEEP_TYPE,
       DECODE(A.CONTAIN_TAX,'1','含税','不含税') CONTAIN_TAX ,
       C.BLA_PRICE_ORG,
       ROUND(C.DDZY, 4) DDZY

  FROM SLM_ORDER_HEAD A, SLM_ORDER_LINE B, SLM_ORDER_PRICE_LIST C
 WHERE A.ORD_PK = B.ORD_PK
   AND A.VALIDFLAG = '1'
   AND B.VALIDFLAG = '1'
      AND A.PRICE_NO = C.PRICE_NO(+)
   AND B.ORD_LN_PK = C.ORD_LN_PK
   AND A.ORDER_STS >= '12020232'
   --AND A.SALE_ORG = ?
   AND A.ORDER_NO LIKE '%' || ? || '%'
   --AND A.CREATE_NAME IS NOT NULL
  --AND B.CREATE_NAME IS NOT NULL
   AND (SELECT TO_NUMBER(COUNT(1) -
                         NVL(SUM(TO_NUMBER(D.BALNCE_PRICE_STS)), '0'))
          FROM SLM_ORDER_LINE D
         WHERE A.ORD_PK = D.ORD_PK
           AND D.VALIDFLAG = '1') ##ASK##
             
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.getOrderPriceStatus" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
            SELECT T.PRICE_STATUS FROM SLM_ORDER_PRICE  T
            WHERE T.PRICE_NO = (SELECT A.PRICE_NO FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = ?)
        ]]>
    </query>
    
   <query id="frmOrderReviewPrice.getBalPriceStatus" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
            SELECT NVL(SUM(T.BALNCE_PRICE_STS),'0') FROM SLM_ORDER_LINE T 
            WHERE T.ORD_PK = ?  AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.updateOrderPriceStatus" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
           UPDATE SLM_ORDER_PRICE  T
           SET T.PRICE_STATUS = 'D'
           WHERE T.PRICE_NO = (SELECT A.PRICE_NO 
           FROM SLM_ORDER_HEAD A  WHERE A.ORD_PK = ? AND A.VALIDFLAG = '1')
        ]]>
    </query>
    
   <query id="frmOrderReviewPrice.updateBalPriceStatus" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
          UPDATE SLM_ORDER_LINE T 
          SET T.BALNCE_PRICE_STS = '0' 
          WHERE T.ORD_PK = ?  AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.updateOrderPassTime" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
          UPDATE SLM_ORDER_HEAD T 
          SET T.PASS_TIME = SYSDATE
          WHERE T.ORD_PK = ?  AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    <query id="frmOrderReviewPrice.updateOrderConfirmTime" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
          UPDATE SLM_ORDER_HEAD T 
          SET T.CONFIRM_TIME = SYSDATE
          WHERE T.ORD_PK = ?  AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
     <query id="frmOrderReviewPrice.UndoOrderConfirmTime" desc="合同价格评审不通过写评审项目表">
        <![CDATA[
          UPDATE SLM_ORDER_HEAD T 
          SET T.CONFIRM_TIME = ''
          WHERE T.ORD_PK = ?  AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    
   
    
</queryMap>
