<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同评审价格界面查询">
<query id="frmOrderReviewPrice.CoreOrderReviewPriceQuery" desc="合同价格评审信息">
        <![CDATA[
                SELECT B3.ORDER_NO,B3.CUSTM_ORDER_NO,B3.REVIEW_F_RS,B3.ORD_PK,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.ORDER_TYP) ORDER_TYP,
            B3.SALE_AREA_DESC SALE_AREA_NO,
            B3.ORDER_YEAR,B3.SIGN_DATE,B3.SIGN_ADDRESS,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.SUPPLY_UNIT) SUPPLY_UNIT,
            (SELECT CUSTOMER_NM FROM SLM_BASE_CUSTOMER  WHERE  CUSTOMER_NO = B3.STLMT_UNIT_NO) STLMT_UNIT_NO,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.MNY_ASK_TYP) MNY_ASK_TYP,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.CURRENCY) CURRENCY,
      (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.ORDER_STS) ORDER_STS,CLOSE_TIME,
      B3.EFFECT_TIME,B3.APPROVAL_TIME,B3.DELETE_TIME,B3.DELETE_NAME,B3.UPDATE_TIME,B3.UPDATE_NAME,
      B3.CREATE_TIME,B3.CREATE_NAME,
      decode(B3.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
      B3.ORDER_MODEL_DESC ORDER_MODEL_NO,
            B3.MNY_ASK_DESC,B3.MANAG_NO,
            B3.CUSTOMER_NM CUSTOMER_NO,
             B3.MEMO,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
            (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = B3.PRICE_FL) PRICE_FL,
            B3.CUSTOMER_MODEL_FL,B3.REVIEW_ITM,B3.REVIEW_STATUS
            FROM (SELECT B1.REVIEW_F_RS,B1.REVIEW_ITM, B1.REVIEW_STATUS, B.*
            FROM SLM_ORDER_HEAD B, SLM_ORDER_REVIEW_ITEM_LIST B1
           WHERE 1 = 1
             AND B.ord_pk = B1.LIST_PK_VAL
             AND B1.REVIEW_ITM = 'P'
             and b1.is_curt_review = '1') B3,
    (select t4.ord_pk from (select  t3.ord_pk from (SELECT t2.ord_pk, COUNT(*) COUNT1
        FROM SLM_ORDER_REVIEW_ITEM_LIST T1, SLM_ORDER_HEAD T2
       WHERE t2.ord_pk = t1.list_pk_val
         AND T1.Review_Status = 'S'
         AND T1.REVIEW_ITM = 'D' group by t2.ord_pk) t3 where t3.count1 > 0) t4,
         (select  t3.ord_pk from (SELECT t2.ord_pk, COUNT(*) COUNT1
        FROM SLM_ORDER_REVIEW_ITEM_LIST T1, SLM_ORDER_HEAD T2
       WHERE T1.LIST_PK_VAL = T2.ord_pk
         AND T1.Review_Status = 'S'
         AND T1.REVIEW_ITM = 'T' group by t2.ord_pk) t3 where t3.count1 > 0) t5 where t4.ord_pk = t5.ord_pk) B4
         where B3.ord_pk = B4.ord_pk
        ]]>
    </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.PRODUCNAME,
       t.SPEC_NAME,
       t.MODEL_DESC,
       t.STD_NAME,
       t.LEN_DESC,
       t.ORDER_QTY,
       '﹣'||t.DELVRY_RANGE_MIN ||'~' ||
       t.DELVRY_RANGE_MAX || t.DELVRY_RANGE_TPE DELVRY_RANGE,
       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_pk = t1.ord_pk
   and t.ord_pk = ?
        ]]>
    </query>
    <query id="frmOrderReviewPrice.appPriceAdd" desc="合同价格评审合同头信息">
        <![CDATA[
            update SLM_ORDER_HEAD set order_sts = '12020208',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 = '12020209',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>
</queryMap>
