昆仑会员此打印方式只针对用会员卡结账的消费,放开限制解决方案

在这个function里面

function PrintDialog()
    {
        var print_card_fee = "<%=print_card_fee %>"
        //alert(print_card_fee)
        var balance=JStrToMoney(form1.net.value);
        var last_balance=parseFloat(balance)+parseFloat(print_card_fee);
        this.ReturnValue = "0";
        this.card_no = "<%=rs_his("card_no")%>" ;
        this.member_name = form1.chname.value;
        this.card_type = form1.card_type.value ;
        this.expirydate=form1.expiry_date.value ;
        this.trade_type = "<%=f_glo("SH01135")%>";

        this.fee = JStrToMoney(form1.total_rev.value);

        this.last_balance = JStrToMoney(last_balance);
        this.balance = JStrToMoney(balance);
        this.check_Date = new Date(<%=year(dt)%>,<%=month(dt)-1%>,<%=day(dt)%>,<%=hour(dt)%>,<%=minute(dt)%>) ;
        this.operator = "<%=session("user_code")%>";
        this.user_code = "<%=session("user_code")%>";
          this.print_time = form1.print_time.value;
        this.place_code = "<%=place_name %>";
        this.room_number="<%=room_number %>";
        if (form1.payment.value=="<%=pay_svc%>")
        {
            var url = "../m_fee/print.asp?type_flag=R";
            showModalDialog(url,this,"dialogWidth:320px;dialogHeight:500px;help:no;scroll:yes;status:no;");
        }
        else
        {
            alert("<%=f_glo("SH01134")%>");
        }
    }

把下面这段修改一下

if (form1.payment.value=="<%=pay_svc%>")
        {
            var url = "../m_fee/print.asp?type_flag=R";
            showModalDialog(url,this,"dialogWidth:320px;dialogHeight:500px;help:no;scroll:yes;status:no;");
        }
        else
        {
            alert("<%=f_glo("SH01134")%>");
        }

修改结果如下,别问我为毛在else里面又写一次,这个锅是IE的,哈哈哈哈。

if (form1.payment.value=="<%=pay_svc%>")
        {
            var url = "../m_fee/print.asp?type_flag=R";
            showModalDialog(url,this,"dialogWidth:320px;dialogHeight:500px;help:no;scroll:yes;status:no;");
        }
        else
        {
        var url = "../m_fee/print.asp?type_flag=R";
            showModalDialog(url,this,"dialogWidth:320px;dialogHeight:500px;help:no;scroll:yes;status:no;");

        }

svc\m_history\his_room_detail.asp

<%Option Explicit%>
<!--#include file = '../../include/conn.asp'-->
<%
dim whether_bucket                                          '是否决定用子账单结帐
whether_bucket=trim(fn_get_param_value("WHETHER_BUCKET",""))'子账单结帐标志(Y:是,N:否)

dim user_code
dim continue_do
dim templet_id                      '打印模板
templet_id=trim(request("templet_id"))

continue_do= trim(request("continue_do"))

dim detail_id,sql_del_detail
detail_id=trim(request("detail_id"))
if detail_id<>"" then
    sql_del_detail="delete member_history_svc_pms_detail where id='" & detail_id & "'"
    conn.execute(sql_del_detail)
end if

user_code=session("user_code")
dim rs,rs_his,sql,sqlstr1,rs1
dim id,show
id=trim(request("id"))
show=trim(request("show"))
dim overdraft_mod
'透支额度按照主持卡人还是使用者有效
overdraft_mod=fn_get_param_value("OVERDRAFT_MOD","")
if overdraft_mod="" or overdraft_mod="null" then
    overdraft_mod="MAIN"
end if

    dim gh_no,membership,sub_name,balance,deposit,overdraft_spend,payment_name,dt,card_points,his_points,net
    dim arrival,departure,room_type,room_number,rate_code,room_rate,booker_no,booker_name,special
    dim room_rev,fb_rev,other_rev,total_rev,payment,discount,discount_real
    dim old_total_rev,from,operator_no,operator,check_no,check_no_spend,sweep_flag,sweep_code,entry,points,credit_no,place_name
    dim card_password,expiry_date,card_type,sql_temp,rs_temp,total_tax
    dim channel_code,market_code,source_code
    dim fee_id                  '此笔消费记录的卡值ID
    dim remark
    dim main_card_no            '主账单的卡号
    dim is_complete             '子账单是否结完
    dim promotion_code          '促销代码
    dim trace_code              '客人得知促销的渠道
    dim guests
    sql_temp="select code,name from dic_card_membership order by sort_id"
    set rs_temp=conn.execute(sql_temp)

    sql="select h.guests,s.id as fee_id,isnull(m.card_no,x.card_no) as card_no,isnull(m.card_password,x.card_password) as card_password,dp.name as place_name,"
    sql=sql &" h.gh_no,h.points as his_points,isnull(h.dt,getdate()) as dt,h.points,"
    sql=sql &" convert(varchar(10),h.arrival,120) as arrival,isnull(m.expiry_date,x.expiry_date) as expiry_date,"
    sql=sql &" convert(varchar(10),h.departure,120) as departure,"
    sql=sql &" h.nights,h.room_number,h.room_rate,h.room_type,h.rate_code,"
    sql=sql &" h.channel_code,h.market_code,h.source_code,"
    sql=sql &" h.total_rev,h.room_rev,h.fb_rev,h.other_rev,h.total_tax,h.special,h.payment,isnull(d.name,'') as payment_name,"
    sql=sql &" isnull(m.points,x.points) as card_points,isnull(m.balance,x.balance) as balance,isnull(m.deposit,x.deposit) as deposit,"
    sql=sql &" h.discount,isnull(m.membership_type,x.membership_type) as membership,isnull(m.sub_type,x.sub_type) as entry ,"
    sql=sql &" h.booker_card_no as booker_no,isnull(m1.chname,'') as booker_name,"
    sql=sql &" h.sub_name,h.remark,h.is_complete,"
    if overdraft_mod="MAIN" then
        sql= sql & " isnull(e.overdraft_spend,0) as overdraft_spend ,"
    else
        sql= sql & " isnull(sub.overdraft_spend,0) as overdraft_spend ,"
    end if
    sql=sql &" h.operator_id,isnull(a.name,'') as username, "
    sql=sql &" h.check_no,h.check_no_spend,(case h.sweep_flag when '1' then '" & f_glo("SH00142") & "' else '" & f_glo("SH00143") & "'"
    sql=sql &" end) as sweep_flag,h.sweep_flag as sweep_code,h.credit_no as credit_no,"
    sql=sql &" isnull(s.last_balance,isnull(m.balance,x.balance)) as last_balance,"
    sql=sql &" isnull(s.this_balance,isnull(m.balance,x.balance)) as this_balance,h.promotion_code,dm.private_info,h.trace_code "
    sql=sql &" from member_history_svc h left join member_Card_fee s on cast(h.id as varchar)=s.from_id and h.his_type=s.from_type and h.card_no=s.card_no"
    sql=sql &" left join member_info_sub sub on h.gh_no=sub.parent_gh_no and h.sub_name=sub.sub_name"
    sql=sql &" left join member_info_svc m1 on h.booker_card_no=m1.card_no left join dic_payment d on h.payment=d.code,"
    sql=sql &" member_info_svc x left join member_info_svc m on x.main_gh_no=m.gh_no,users a,dic_card_membership dm,dic_place dp,"
    sql=sql &" (select parent_gh_no,overdraft_spend from member_info_sub where main_flag='1') e "
    sql=sql &" where h.gh_no=isnull(m.gh_no,x.gh_no) and h.card_no=x.card_no and a.code=h.operator_id and dp.code=h.place_code "
    sql=sql &" and x.gh_no=e.parent_gh_no and dm.code=x.membership_type"
    sql=sql &" and h.id=" & id

    set rs_his=conn.execute(sql)
    if rs_his.recordcount>0 then
        rs_his.movefirst
        fee_id=trim(rs_his("fee_id"))
        membership=trim(rs_his("membership"))
        entry=trim(rs_his("entry"))
        gh_no=trim(rs_his("gh_no"))
        sub_name=trim(rs_his("sub_name"))
        balance=trim(rs_his("balance"))
        deposit=trim(rs_his("deposit"))
        overdraft_spend=trim(rs_his("overdraft_spend"))
        dt=trim(rs_his("dt"))
        payment=trim(rs_his("payment"))
        payment_name=trim(rs_his("payment_name"))
        card_points=trim(rs_his("card_points"))
        his_points=trim(rs_his("his_points"))
        old_total_rev=trim(rs_his("total_rev"))
        main_card_no=trim(rs_his("card_no"))

        operator_no=trim(rs_his("operator_id"))
        operator=trim(rs_his("username"))
        check_no=trim(rs_his("check_no"))
        check_no_spend=trim(rs_his("check_no_spend"))
        sweep_flag=trim(rs_his("sweep_flag"))
        sweep_code=trim(rs_his("sweep_code"))
        points=trim(rs_his("points"))
        credit_no = trim(rs_his("credit_no"))
        is_complete = trim(rs_his("is_complete"))
        if check_no_spend = null then
           check_no_spend = 0
        end if
        booker_no=trim(rs_his("booker_no"))
        card_password=trim(rs_his("card_password"))
        expiry_date=rs_his("expiry_date")
        remark=trim(rs_his("remark"))
        place_name=trim(rs_his("place_name"))
        if rs_temp.recordcount>0 then
              do while not rs_temp.EOF
                if trim(rs_his("membership"))=trim(rs_temp("code")) then
                    card_type=rs_temp("name")
                end if
               rs_temp.movenext
               loop
        end if
        arrival=trim(rs_his("arrival"))
        departure=trim(rs_his("departure"))
        room_type=trim(rs_his("room_type"))
        room_number=trim(rs_his("room_number"))
        rate_code=trim(rs_his("rate_code"))
        if isnull(rate_code) then
            rate_code=""
        end if
        room_rate=trim(rs_his("room_rate"))
        special=trim(rs_his("special"))
        room_rev=trim(rs_his("room_rev"))
        fb_rev=trim(rs_his("fb_rev"))
        other_rev=trim(rs_his("other_rev"))
        total_tax=trim(rs_his("total_tax"))
        total_rev=trim(rs_his("total_rev"))
        booker_no=trim(rs_his("booker_no"))
        booker_name=trim(rs_his("booker_name"))
        discount_real=trim(rs_his("discount"))
        channel_code=trim(rs_his("channel_code"))
        market_code=trim(rs_his("market_code"))
        source_code=trim(rs_his("source_code"))
        promotion_code=trim(rs_his("promotion_code"))
        trace_code=trim(rs_his("trace_code"))
        guests=trim(rs_his("guests"))
    else
        %>
        <script type="text/javascript">
              alert("未查询到相关记录,请联系管理员");
              window.history.go(-1);
        </script>
        <%
        response.End
    end if
    'response.Write is_complete
    from = trim(request("from"))
    if from="discount" then'由计算折扣,刷新界面迩来
        arrival=trim(request("arrival"))
        departure=trim(request("departure"))
        room_type=trim(request("room_type"))
        room_number=trim(request("room_number"))
        rate_code=trim(request("rate_code"))
        room_rate=trim(request("room_rate"))
        special=trim(request("special"))
        room_rev=trim(request("room_rev"))
        fb_rev=trim(request("fb_rev"))
        other_rev=trim(request("other_rev"))
        total_tax=trim(request("total_tax"))
        total_rev=trim(request("total_rev"))
        booker_no=trim(request("booker_no"))
        booker_name=trim(request("booker_name"))
        discount_real=trim(request("discount_real"))
        channel_code=trim(request("channel_code"))
        market_code=trim(request("market_code"))
        source_code=trim(request("source_code"))
        promotion_code=trim(request("promotion_code"))
        trace_code=trim(request("trace_code"))
        '得到扣率
           if discount_real=0 then
                '得到扣率
                sql="exec sp_get_discount_by_rule '11','" & membership & "','','',0"
                set rs=conn.execute(sql)
                if not rs.eof then
                    discount=cdbl(rs("discount"))
                else
                    discount =0
                end if
                if discount=0 then
                    discount_real=0
                else
                    discount_real=Round((discount)*cdbl(room_rev),2)
                    room_rev=Round((1-discount)*cdbl(room_rev),2)
                end if
                total_rev=cdbl(room_rev) + cdbl(fb_rev) + cdbl(other_rev)+ cdbl(total_tax)
           end if
    end if

    if room_rate="" then
        room_rate=0
    end if
    if room_rev="" then
        room_rev=0
    end if
    if fb_rev="" then
        fb_rev=0
    end if
    if other_rev="" then
        other_rev=0
    end if
    if total_tax="" then
        total_tax=0
    end if
    if total_rev="" then
        total_rev=0
    end if
    if discount_real="" then
        discount_real=0
    end if

    dim sql_merge,rs_merge
    sql_merge="select promotion_trace_code from [dbo].[fn_promotion_trace_merge]('"&promotion_code&"','"&trace_code&"')"
    set rs_merge=conn.execute(sql_merge)

    '从sysparam取得CASH所对应的付款方式
    dim sql_sys,rs_sys,pay_svc,pay_cash,v_param,n
    pay_svc=fn_get_param_value("PAY_SVC","")
    pay_cash=fn_get_param_value("PAY_CASH","")
    dim prt_type
    prt_type=fn_get_param_value("PRT_TYPE",session("hotel_code"))             '打印单据的选择方式

    '补打用的fee
    dim rs_fee,print_card_fee
    sql= " select distinct f.fee from member_card_fee f "
    sql=sql & " inner join member_history_svc h on f.gh_no=h.gh_no "
    sql=sql & " left join member_history_svc_pms_detail d on h.id= d.his_id "
    sql=sql & " left join member_info_svc m on m.card_no=d.card_no and m.gh_no=f.gh_no "
    sql=sql & " where f.from_id=cast(h.id as varchar) and f.gh_no='"&gh_no&"' "
    sql=sql & "  and h.id='"&id&"' "
    'response.Write sql
    set rs_fee = conn.execute(sql)
    if rs_fee.recordcount>0 then
        print_card_fee = 0-cdbl(rs_fee("fee"))
    end if
    if print_card_fee="" then
        print_card_fee=0
    end if
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" type="text/css" href="../../include/main.css" />
<script language="javascript">
  var vRoot='<%=Application("vroot")%>';
</script>
<script type="text/javascript" src="../../include/cele_date.js"></script>
<script type="text/javascript" src="../../include/checkinfo.js"></script>
<script type="text/javascript" src="../../include/prototype/prototype.js"></script>
<%include_jquery() ' 引入jquery.js%>
<script type="text/javascript">
init();
function get_s_date(t1,t2)
{
    show_cele_date (t1,"1900-1-1","<%=calendar_end_year%>-12-31",t2,'',0, 15) ;
}
function fn_valid()
{
    var ok_flag=true;
     if (form1.arrival.value=="")
     {
        ok_flag=false;
       alert("<%=f_glo("SH00128")%>");
       return false;
     }

     if (form1.departure.value=="")
     {
        ok_flag=false;
       alert("<%=f_glo("SH00129")%>");
       return false;
     }

     if (form1.room_rate.value=="")
     {
        ok_flag=false;
       alert("<%=f_glo("SH00130")%>");
       return false;
     }

      if (form1.total_rev.value=="" ||form1.total_rev.value==0)
     {
        ok_flag=false;
       alert("<%=f_glo("SH00131")%>");
       return false;
     }

     if (form1.payment.value=="<%=pay_svc%>") //结帐方式=卡,查询余额是否够。若不够,则跳到查询余额页进行续费操作
     {

        var v_net=parseFloat(form1.net.value);//帐户余额
        var v_rev=parseFloat(form1.total_rev.value);//总消费
        var v_overdraft_spend=parseFloat(form1.overdraft_spend.value);//透支额度
        var v_used_sum=parseFloat(form1.used_sum.value);//可用款=帐户余额+透支额度

        var old_total_rev=parseFloat(form1.old_total_rev.value);//原总消费
        var v_old_net=v_net+old_total_rev;
        var v_old_used_sum=v_used_sum+old_total_rev;

        if ((v_old_net<v_rev) && (v_old_used_sum<v_rev))
        {
            ok_flag=false;
            alert("<%=f_glo("SH00133")%>"+v_rev+"<%=f_glo("SH00134")%>"+v_old_used_sum+"<%=f_glo("SH00135")%>")
            form1.action="../m_fee/fee_topup_input.asp";
            form1.submit();
        }
        else
        {
            if (v_old_net<v_rev)
            {
                if(window.confirm("<%=f_glo("SH00133")%>"+v_rev.toString(10)+"<%=f_glo("SH00136")%>"+v_old_net.toString(10)+"<%=f_glo("SH00139")%>"+v_old_used_sum.toString(10)+"<%=f_glo("SH00137")%>"))
                {
                    form1.action="his_detail_save.asp";
                    form1.submit();
                }
                else
                {
                    ok_flag=false;
                    return false;
                }
            }
        }
     }
     fn_get_totalrev(form1.room_rev);
     if (ok_flag==true)
    {
        form1.action="his_detail_save.asp";
        form1.submit();
    }

}
function fn_get_totalrev(obj)
{
    var room_rev=form1.room_rev.value;
    var fb_rev=form1.fb_rev.value;
    var other_rev=form1.other_rev.value;
    var total_tax=form1.total_tax.value;
    var total_rev=0;

    if (room_rev=="")
    {
        room_rev=0;
        form1.room_rev.value=0;
    }
    if (fb_rev=="")
    {
        fb_rev=0;
        form1.fb_rev.value=0;
    }
    if (other_rev=="")
    {
        other_rev=0;
        form1.other_rev.value=0;
    }
    if (total_tax=="")
    {
        total_tax=0;
        form1.total_tax.value=0;
    }
    if(obj.value!="")
      fn_toMoney(obj);
    total_rev=parseFloat(room_rev)+parseFloat(fb_rev)+parseFloat(other_rev)+parseFloat(total_tax);
    form1.total_rev.value =JStrToMoney(total_rev.toString());

}
function fn_zero(txt)
{
    var obj=eval(txt);
    var v=obj.value;

    if (v=="")
        obj.value="0.00";
    else
        fn_toMoney(obj);
    fn_count_room_rev();
       fn_get_totalrev(obj);
}
function fn_get_discount()
{
    if (form1.gh_no.value=="")
     {
        alert("<%=f_glo("SH00138")%>");
        return false;
     }
     if (form1.total_rev.value=="" || form1.total_rev.value==0)
     {
         return false;
     }
    form1.action="his_room_detail.asp?from=discount";
    form1.submit();
}
function fn_sweep()
{
    if(window.confirm("<%=f_glo("SH00150")%>"))
    {
        form1.action ="his_sweep_save.asp";
        form1.submit();
    }
    else
    {
        return false;
    }

}
function fn_goto_consumable()
{
    form1.action ="../m_info/card_history_consumable.asp";
    form1.submit();
}

function fn_print_new()
{
     var print_ret=0;
    <%if prt_type="H" then%>
        form1.form_action.value="../m_history/his_room_detail.asp";
        if (form1.payment.value=="<%=pay_svc%>")
        {
            form1.action="../m_fee/print_com_interface.asp";
            form1.submit();
        }
        else
        {
            alert("<%=f_glo("SH01134")%>");
        }
        //fn_print();
    <%elseif prt_type="D" then %>
        PrintDialog();
    <%end if %>
}
function PrintDialog()
    {
        var print_card_fee = "<%=print_card_fee %>"
        //alert(print_card_fee)
        var balance=JStrToMoney(form1.net.value);
        var last_balance=parseFloat(balance)+parseFloat(print_card_fee);
        this.ReturnValue = "0";
        this.card_no = "<%=rs_his("card_no")%>" ;
        this.member_name = form1.chname.value;
        this.card_type = form1.card_type.value ;
        this.expirydate=form1.expiry_date.value ;
        this.trade_type = "<%=f_glo("SH01135")%>";

        this.fee = JStrToMoney(form1.total_rev.value);

        this.last_balance = JStrToMoney(last_balance);
        this.balance = JStrToMoney(balance);
        this.check_Date = new Date(<%=year(dt)%>,<%=month(dt)-1%>,<%=day(dt)%>,<%=hour(dt)%>,<%=minute(dt)%>) ;
        this.operator = "<%=session("user_code")%>";
        this.user_code = "<%=session("user_code")%>";
          this.print_time = form1.print_time.value;
        this.place_code = "<%=place_name %>";
        this.room_number="<%=room_number %>";
        if (form1.payment.value=="<%=pay_svc%>")
        {
            var url = "../m_fee/print.asp?type_flag=R";
            showModalDialog(url,this,"dialogWidth:320px;dialogHeight:500px;help:no;scroll:yes;status:no;");
        }
        else
        {
            alert("<%=f_glo("SH01134")%>");
        }
    }
function fn_return()
{
    window.history.back(-1);
}

function fn_save_remark()
{
    form1.action="his_detail_remark_save.asp";
    form1.submit();
}
function fn_get_amount()
{
    var price_per_unit=form1.price_per_unit_detail.value;
    var quantity=form1.quantity_detail.value;
    var total_rev=0;
    var total_rev_str;

    if (price_per_unit=="")
    {
        price_per_unit=0;
    }

    if (quantity=="")
    {
        quantity=1;
        form1.quantity_detail.value=1;
    }
    total_rev=parseFloat(price_per_unit)*parseFloat(quantity);
    total_rev_str = total_rev.toString();
    form1.price_per_unit_detail.value=JStrToMoney(price_per_unit);
    form1.amount_detail.value = JStrToMoney(total_rev_str);
}
//动态添加表格行
function fn_add_his_trans()
{
     if (form1.trans_code_detail.value=="")
     {
        alert("<%=f_glo("SH01139")%>")
        return false;
     }
     if (form1.rate_code_detail.value=="")
     {
        alert("<%=f_glo("SH01140")%>")
        return false;
     }
     if (form1.post_date_detail.value=="")
     {
        alert("<%=f_glo("SH01141")%>")
        return false;
     }
     if (form1.price_per_unit_detail.value=="" || form1.price_per_unit_detail.value=="0.00")
     {
        alert("<%=f_glo("SH01142")%>")
        return false;
     }

     if (fn_valide_amount_card_value()==false)
     {
        return false;
     }
     //对于balance transfer,把正值当作消费品,把负值当作支付方式。
     if (form1.trans_item.value=="FC")
     {
        form1.trans_payment_total.value=(parseFloat(form1.trans_payment_total.value)+parseFloat(form1.amount_detail.value)).toFixed(2);
     }else if(form1.trans_item.value=="BT" && parseFloat(form1.amount_detail.value)<0){
         form1.trans_payment_total.value=(parseFloat(form1.trans_payment_total.value)-parseFloat(form1.amount_detail.value)).toFixed(2);
     }else if(form1.trans_item.value=="BT" && parseFloat(form1.amount_detail.value)>=0){
         form1.trans_item_total.value=(parseFloat(form1.trans_item_total.value)+parseFloat(form1.amount_detail.value)).toFixed(2);
     }
     else
     {
        form1.trans_item_total.value=(parseFloat(form1.trans_item_total.value)+parseFloat(form1.amount_detail.value)).toFixed(2);
     }
     var txtTRLastIndex = fn_findObj("tr_lastIndex",document);
     var rowID = parseInt(txtTRLastIndex.value);
     var signFrame = fn_findObj("table_his_detail",document);
     //添加行
     var newTR = signFrame.insertRow(signFrame.rows.length);
     newTR.id = "SignItem" + rowID;
     //添加列:交易代码
     var newTransNoTD=newTR.insertCell(0);

     var trans_item_name;
     if(form1.trans_item.value=="FC")
     {
         trans_item_name="支付方式";
         newTransNoTD.innerHTML = "<input name='txtTransNo" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtTransNo" + rowID + "' value='"+form1.trans_name_detail.value+"' style='width:100%'/> <input type='hidden' class='classpayment' name='hidTransNo" + rowID + "' value='"+form1.trans_code_detail.value+"'/>";
     }
     else if(form1.trans_item.value=="PK"){
         trans_item_name="Package";
         newTransNoTD.innerHTML = "<input name='txtTransNo" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtTransNo" + rowID + "' value='"+form1.trans_name_detail.value+"' style='width:100%'/> <input type='hidden' name='hidTransNo" + rowID + "' value='"+form1.trans_code_detail.value+"'/>";
     }
     else if(form1.trans_item.value=="BT"){
         trans_item_name="Balance Transfer";
         newTransNoTD.innerHTML = "<input name='txtTransNo" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtTransNo" + rowID + "' value='"+form1.trans_name_detail.value+"' style='width:100%'/> <input type='hidden' name='hidTransNo" + rowID + "' value='"+form1.trans_code_detail.value+"'/>";
     }
     else
     {
         trans_item_name="消费品";
         newTransNoTD.innerHTML = "<input name='txtTransNo" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtTransNo" + rowID + "' value='"+form1.trans_name_detail.value+"' style='width:100%'/> <input type='hidden' name='hidTransNo" + rowID + "' value='"+form1.trans_code_detail.value+"'/>";
     }

     //添加列:交易类型
     var newTransTypeTD=newTR.insertCell(1);
     newTransTypeTD.innerHTML = "<input name='txtTransType" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtTransType" + rowID + "' value='"+trans_item_name+"' style='width:100%'/><input type='hidden' name='hidTransType" + rowID + "' value='"+form1.trans_item.value+"'/>";

     //添加列:交易时间
     var newPostDateTD=newTR.insertCell(2);
     newPostDateTD.innerHTML = "<input name='txtPostDate" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtPostDate" + rowID + "' value='"+form1.post_date_detail.value+"' style='width:100%'/>";

     //添加列:房价代码
     var newRateCodeTD=newTR.insertCell(3);
     newRateCodeTD.innerHTML = "<input name='txtRateCode" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtRateCode" + rowID + "' value='"+form1.rate_name_detail.value+"' style='width:100%'/> <input type='hidden' name='hidRateCode" + rowID + "' value='"+form1.rate_code_detail.value+"'/>";

     //添加列:房间号
     var newRoomNoTD=newTR.insertCell(4);
     newRoomNoTD.innerHTML = "<input name='txtRoomNo" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtRoomNo" + rowID + "' value='"+form1.room_no_detail.value+"' style='width:100%'/> <input type='hidden' name='hidPayment" + rowID + "' value='"+document.getElementById('payment_detail').value+"' />";

     //添加列:支付方式
     // var newPaymentTD=newTR.insertCell(4);
     // newPaymentTD.innerHTML = "<input type='hidden' name='hidPayment" + rowID + "' value='"+document.getElementById('payment_detail').value+"' />";

     //添加列:卡号
     //var newCardnoTD=newTR.insertCell(4);
     //newCardnoTD.innerHTML = "<input name='txtCardNo" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtCardNo" + rowID + "' value='"+form1.cardno_detail.value+"' size='8'/>";

     //添加列:单价
     var newPricePerUnitTD=newTR.insertCell(5);
     newPricePerUnitTD.innerHTML = "<input name='txtPricePerUnit" + rowID + "' style='border:0;background-color:#f3f3f3' style='border:0;background-color:#f3f3f3' readonly id='txtPricePerUnit" + rowID + "' value='"+form1.price_per_unit_detail.value+"' style='width:100%'/> <input type='hidden' name='hidSource" + rowID + "'  id='hidSource" + rowID + "' value='"+form1.source_detail.value+"'  />";

     //添加列:消费数量
     var newQuantityTD=newTR.insertCell(6);
     newQuantityTD.innerHTML = "<input  name='txtQuantity" + rowID + "' style='border:0;background-color:#f3f3f3' id='txtQuantity" + rowID + "' value='"+form1.quantity_detail.value+"' style='width:100%'/> <input type='hidden' name='hidMarket" + rowID + "' id='hidMarket" + rowID + "' value='"+form1.market_detail.value+"' />";

     //添加列:总收入
     var newAmountTD=newTR.insertCell(7);
     newAmountTD.innerHTML = "<input name='txtAmount" + rowID + "' style='border:0;background-color:#f3f3f3' readonly id='txtAmount" + rowID + "' value='"+form1.amount_detail.value+"' style='width:100%'/>";

    //添加列:市场
   //  var newMarketTD=newTR.insertCell(7);
    // newMarketTD.innerHTML = "<input name='hidMarket" + rowID + "' id='hidMarket" + rowID + "' value='"+form1.market_detail.value+"' />";

    //添加列:来源
    // var newSourceTD=newTR.insertCell(8);
    // newSourceTD.innerHTML = "<input name='hidSource" + rowID + "'  id='hidSource" + rowID + "' value='"+form1.source_detail.value+"'  />";

    //添加列:删除按钮
     var newDeleteTD=newTR.insertCell(8);
     newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' onclick=\"fn_deleteRow('SignItem" + rowID + "',"+rowID+")\">删除</a></div>";
    //alert("test");
     //将行号推进下一行
     txtTRLastIndex.value = (rowID + 1).toString();
}
function fn_findObj(theObj,theDoc)
{
     var p,i,foundObj;
     if(!theDoc) theDoc = document;
     if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
     {
        theDoc = parent.frames[theObj.substring(p+1)].document;
        theObj = theObj.substring(0,p);
     }
     if(!(foundObj = theDoc[theObj]) && theDoc.all)
        foundObj = theDoc.all[theObj];
        for (i=0; !foundObj && i < theDoc.forms.length; i++)
        foundObj = theDoc.forms[i][theObj];
        for(i=0; !foundObj && theDoc.layers && i<theDoc.layers.length;i++)
        foundObj = fn_findObj(theObj,theDoc.layers[i].document);
        if(!foundObj && document.getElementById)
        foundObj = document.getElementById(theObj);
        return foundObj;
}
function o(obj)
{
    return document.getElementById(obj);
}
//删除指定行
function fn_deleteRow(signItem,rowid){
     var signFrame = fn_findObj("table_his_detail",document);
     var signItem = fn_findObj(signItem,document);
     //alert(form1.payment_detail.value)
     //获取将要删除的行的Index
     var rowIndex = signItem.rowIndex;

     //删除指定Index的行
     var paymentRowId;
     paymentRowId=o("hidPayment"+rowid).value;
     //将总限制金额减去此笔子账单的消费金额
     if (paymentRowId=="<%=pay_svc%>")
     {
        var v_limit=parseFloat(form1.pay_svc_limit.value);
        var v_limit_total=v_limit-v_rev;
        if (v_limit>0)
        {
            form1.pay_svc_limit.value=v_limit_total;
        }
     }
     //form1.tr_lastIndex.value = (form1.tr_lastIndex.value - 1).toString();         

     var TransType=o("hidTransType"+rowid).value;
     var v_rev=o("txtAmount"+rowid).value;
    //对于balance transfer,把正值当作消费品,把负值当作支付方式。
     if (TransType=="C" || TransType=="BT" && parseFloat(v_rev)>=0)
     {
        form1.trans_item_total.value=(parseFloat(form1.trans_item_total.value)-parseFloat(v_rev)).toFixed(2);
     }else if(TransType=="BT" && parseFloat(v_rev)<0){
         form1.trans_payment_total.value=(parseFloat(form1.trans_payment_total.value)+parseFloat(v_rev)).toFixed(2);
     }
     else
     {
        form1.trans_payment_total.value=(parseFloat(form1.trans_payment_total.value)-parseFloat(v_rev)).toFixed(2);
     }
     signFrame.deleteRow(rowIndex);
 }
function fn_save_trans()
{
    // 判断支付方式
    var isPaymentRepeat = false;
    var arrPaymentValue = new Array();
    $(".classpayment").each(function (index, item) {
        // 判断重复
        if ($.inArray($(item).val(), arrPaymentValue) != -1) {
            isPaymentRepeat = true;
        }
        arrPaymentValue.push($(item).val());
    })
    if (isPaymentRepeat) {
        alert("支付方式重复,请重新选择");
        return false;
    }

    if (form1.tr_lastIndex.value==1)
    {
        alert("<%=f_glo("SH01143")%>");
        return false;
    }
    if (parseFloat(form1.trans_item_total.value)!=parseFloat(form1.trans_payment_total.value))
    {
        alert("<%=f_glo("SH01167")%>");
        return false;
    }
    if(parseFloat(form1.trans_payment_total.value)<0)
    {
        alert("支付总金额不能为负值");
        return false;
    }
    form1.action="his_room_detail_save.asp";
    form1.submit();
}
function fn_display_card_no_detail(v)
{
    //暂时注释掉用多卡结帐的功能
    //if (v=="<%=pay_svc %>")
    //{
    //    document.getElementById("cardno_detail").style.display="block";
    //    document.getElementById("img_0").style.display="block";
    //    document.getElementById("card_no_text").style.display="block";
    //}else
    //{
        document.getElementById("cardno_detail").style.display="none";
        document.getElementById("img_0").style.display="none";
        document.getElementById("card_no_text").style.display="none";
    //}
    form1.cardno_detail.value="";
}
function fn_valide_amount_card_value()
{
    //var card_balance_detail=from1.card_balance_detail.value;
    //var card_overdraft_detail=from1.card_overdraft_detail.value;
    var card_used_sum_detail=form1.card_used_sum_detail.value;
    var amount_detail= form1.amount_detail.value;
    if (form1.cardno_detail.value != "")
    {
        if (parseFloat(amount_detail)>parseFloat(card_used_sum_detail))
        {
            alert("<%=f_glo("SH00133")%>"+amount_detail+"<%=f_glo("SH00134")%>"+card_used_sum_detail+"<%=f_glo("SH00135")%>")
            return false;
        }
    }else if (form1.cardno_detail.value == "" && document.getElementById("cardno_detail").style.display=="block")
    {
        alert("<%=f_glo("SH01168")%>");
        return false;
    }
    return true;
}
function fn_select_card(a,b,c,d,e)
{}
function fn_save_trans_complete()
{
    // 判断支付方式
    var isPaymentRepeat = false;
    var arrPaymentValue = new Array();
    $(".classpayment").each(function (index, item) {
        // 判断重复
        if ($.inArray($(item).val(), arrPaymentValue) != -1) {
            isPaymentRepeat = true;
        }
        arrPaymentValue.push($(item).val());
    })
    if (isPaymentRepeat) {
        alert("支付方式重复,请重新选择");
        return false;
    }

    if (form1.trans_item_total.value!=form1.trans_payment_total.value)
    {
        alert("<%=f_glo("SH01167")%>");
        return false;
    }
    form1.is_complete.value="Y";
    form1.action="his_room_detail_save.asp";
    form1.submit();
}
function fn_deleteHistoryRow(detail_id)
{
    if (window.confirm("确认要删除?"))
    {
        form1.action="his_room_detail.asp?detail_id="+detail_id;
        form1.submit();
    }
}
</script>
</head>
<body onclick="h_cele_date();">
<center>
<h2><%=f_glo("SH00100")%></h2>
<form name="form1" method="post" action="his_detail_save.asp" class="input-9-frm">
  <table border="0" cellPadding="1" cellSpacing="1" width="100%" class="input-9-tb" align="center">
   <tr>
    <td width="20%"><%=f_glo("SH00101")%></td>
    <td width="30%">
        <%if gh_no<>""  then  '姓名屏蔽%>
            <%if fn_check_private_value(rs_his("private_info"),"NAME") then %>
                ******
            <%else%>
                <b><font size="2" color="#0000ff"><a class="link1" title="<%=f_glo("SH00140")%>" href="../m_info/memberinfo_sub_detail.asp?gh_no=<%=gh_no%>&amp;sub_name=<%=sub_name%>"><%=sub_name%></a></font></b>
            <%end if%>
        <%end if %>
    </td>
    <td><%=f_glo("SH00141")%></td>
    <td><font color="#00ccff"><b><%=sweep_flag%></b></font></td>
   </tr>
    <tr>
    <td width="20%"><font color="#808080"><%=f_glo("SH00102")%></font></td>
    <td width="30%">
        <input name="net" style="width:100%" readonly="readonly"
            <%if gh_no<>""  then  '余额屏蔽%>
                <%if fn_check_private_value(rs_his("private_info"),"FEE") then %>
                    value="******"
                <%else%>
                    value="<%=StrToMoney(CStr(cDbl(balance)-cDbl(deposit)))%>"
                <%end if%>
            <%end if %>
            />
    </td>
    <td width="20%"><font color="#808080"><%=f_glo("SH00103")%></font></td>
    <td width="30%"><input name="deposit" style="width :100%" value="<%=StrToMoney(deposit)%>" readonly></td>
  </tr>
   <tr>
    <td width="20%"><font color="#808080"><%=f_glo("SH00104")%></font></td>
    <td width="30%"><input name="overdraft_spend" style="width :100%" value="<%=StrToMoney(overdraft_spend)%>" readonly></td>
    <td width="20%"><font color="#808080"><%=f_glo("SH00105")%> = <br><%=f_glo("SH00102")%> + <%=f_glo("SH00104")%></font></td>
    <td width="30%">
        <input name="used_sum" style="width :100%" readonly="readonly"
            <%if gh_no<>""  then  '余额屏蔽%>
                <%if fn_check_private_value(rs_his("private_info"),"FEE") then %>
                    value="******"
                <%else%>
                    value="<%=StrToMoney(CStr(cDbl(balance)-cDbl(deposit)+cDbl(overdraft_spend)))%>"
                <%end if%>
            <%end if %>
            />
    </td>
   </tr>
   <tr>
    <td width="20%"><font color="#808080"><%=f_glo("SH00144")%></font></td>
    <td width="30%"><input name="his_points" style="width :100%" value="<%=his_points%>" readonly></td>
    <td width="20%"><font color="#808080"><%=f_glo("SH00145")%></font></td>
    <td width="30%">
        <input name="card_points" style="width :100%" readonly="readonly"
            <%if gh_no<>""  then  '积分屏蔽%>
                <%if fn_check_private_value(rs_his("private_info"),"POINT") then %>
                    value="******"
                <%else%>
                    value="<%=card_points%>"
                <%end if%>
            <%end if %>
            />
    </td>
  </tr>
  <tr>
    <td colspan="4" background="../../images/login_line5.gif" height="10"></td>
 </tr>
  <tr>
    <td width="20%"><%=f_glo("SH00106")%><font color="red">*</font></td>
    <td width="30%"><input style="width:100%" name="arrival" value="<%=arrival%>" onClick="get_s_date(form1.arrival,form1.arrival  );" language="javascript"></td>
    <td width="20%"><%=f_glo("SH00107")%><font color="red">*</font></td>
    <td width="30%"><input style="width:100%" name="departure" value="<%=departure%>" onClick="get_s_date(form1.departure,form1.departure  );" language="javascript"></td>
  </tr>
  <tr>
    <td width="20%"><%=f_glo("SH00108")%></td>
    <td width="30%">
        <%
            dim room_type_name

            sql="select code,name from dic_roomtype where code='"& room_type &"' order by code"
            set rs=conn.execute(sql)
            if rs.recordcount>0 then
                room_type_name=rs("name")
            else
                room_type_name=""
            end if
        %>
        <input name="room_type" id="room_type" type="hidden" value="<%=room_type%>" />
        <input name="room_type_name" id="room_type_name" style="width:100%" value="[<%=room_type%>]<%=room_type_name%>" readonly="readonly"/>
    </td>
    <td width="20%"><%=f_glo("SH00109")%></td>
    <td width="30%"><input style="width :100%" name="room_number" value="<%=room_number%>" readonly="readonly"/></td>
  </tr>
  <tr>
    <td width="20%"><%=f_glo("SH00110")%></td>
    <td width="30%">
        <%
            dim rate_name

            sql="select code,name from V_dic_rate where code='"& rate_code &"' order by code"
            set rs=conn.execute(sql)
            if rs.recordcount>0 then
                rate_name=f_spl_name(rs("name"))
            else
                rate_name=""
            end if
        %>
        <input name="rate_code" id="rate_code" type="hidden" value="<%=rate_code%>">
        <input name="rate_name" id="rate_name" style="width:100%" value="[<%=rate_code%>]<%=rate_name%>" readonly>
    </td>
    <td width="20%"><%=f_glo("SH00111")%></td>
    <td width="30%"><input style="width :100%" name="room_rate" value="<%=StrToMoney(room_rate)%>" onKeyPress="checkMoney(this.value,this.Tabindex)"  readonly></td>
  </tr>
  <tr>
    <td width="20%"><%=f_glo("SH00112")%></td>
    <td width="30%"><input style="width :100%" name="booker_name" readonly value="<%=booker_name%>"></td>
    <td width="20%"><%=f_glo("SH00113")%></td>
    <td width="30%"><input style="width :100%" name="special" value="<%=special%>" readonly></td>
  </tr>
  <tr>
    <td width="20%"><%=f_glo("SH00114")%></td>
    <td width="30%"><input name="room_rev" style="width:100%" value="<%=StrToMoney(room_rev)%>" onKeyPress="checkMoney(this.value,this.Tabindex)" readonly></td>
    <td width="20%"><%=f_glo("SH00115")%></td>
    <td width="30%"><input style="width :100%" name="fb_rev" value="<%=StrToMoney(fb_rev)%>" onKeyPress="checkMoney(this.value,this.Tabindex)" readonly></td>
  </tr>
 <tr>
    <td width="20%"><%=f_glo("SH00116")%></td>
    <td width="30%"><input name="other_rev" style="width:100%" value="<%=StrToMoney(other_rev)%>" onKeyPress="checkMoney(this.value,this.Tabindex)" readonly></td>
       <td width="20%">总税费金额</td>
    <td width="30%"><input name="total_tax" style="width:100%" value="<%=StrToMoney(total_tax)%>" onKeyPress="checkMoney(this.value,this.Tabindex)" readonly></td>
  </tr>
   <tr>
<td width="20%"><font color="#808080"><%=f_glo("SH00117")%></font></td>
<td width="30%"><input name="total_rev" style="width:100%" value="<%=StrToMoney(total_rev)%>" readonly></td>
  </tr>
  <tr>
  <td width="20%"><font color="#808080"><%=f_glo("SH00118")%></font></td>
  <td width="30%"><input name="discount_real" style="width:100%" onKeyPress="checkMoney(this.value,this.Tabindex)" value="<%=discount_real%>" readonly></td>
    <td width="20%"><%=f_glo("SH00120")%></td>
    <td width="30%"><input name="check_no" style="width:100%" value="<%=check_no%>" readonly></td>
  </tr>
  <tr>
    <td width="20%"><%=f_glo("SH00146")%></td>
    <td width="30%"><%=dt%></td>
    <td width="20%"><%=f_glo("SH00122")%></td>
    <td width="30%"><%=payment_name%></td>
  </tr>
  <tr>
    <td width="20%" style="display:none"><%=f_glo("SH00123")%></td>
  <% if payment <> pay_cash then %>
    <td width="30%" style="display:none"><input style="width :100%" name="credit_no" value="<%=credit_no%>" readonly></td>
  <%else%>
    <td width="30%"></td>
  <%end if %>
    <td width="20%"><%=f_glo("SH00151")%></td>
    <%
        sqlstr1="select * from dic_channel where code='"& channel_code &"'"
        set rs1 = conn.execute(sqlstr1)
    if rs1.recordcount>0 then%>
    <td width="30%">[<%=trim(rs1("code"))%>]...<%=trim(rs1("name"))%></td>
    <%else%>
    <td width="30%"></td>
    <%end if %>
  </tr>
  <tr>
    <td width="20%"><%=f_glo("SH00152")%></td>
      <%
        sqlstr1="select * from dic_segment where code='"& market_code &"'"
        set rs1 = conn.execute(sqlstr1)
    if rs1.recordcount>0 then%>
    <td width="30%">[<%=trim(rs1("code"))%>]...<%=trim(rs1("name"))%></td>
    <%else%>
    <td width="30%"></td>
    <%end if %>
    <td width="20%"><%=f_glo("SH00153")%></td>
    <%
        sqlstr1="select * from dic_source where code='"& source_code &"'"
        set rs1 = conn.execute(sqlstr1)
    if rs1.recordcount>0 then%>
    <td width="30%">[<%=trim(rs1("code"))%>]...<%=trim(rs1("name"))%></td>
    <%else%>
    <td width="30%"></td>
    <%end if %>
  </tr>
  <tr>
    <td><%=f_glo("SH00124")%></td>
    <td><input style="width :100%" name="operator" value="<%=operator%>" readonly="readonly" /></td>
    <%
            dim prt_chit,prt_right
            '打印单据的选择方式
            prt_chit=fn_get_param_value("PRT_CHIT",session("hotel_code"))
            prt_right=fn_check_right(user_code,"S311")
            if prt_chit="" or prt_chit="null" then
               prt_chit="N"
            end if
            if prt_chit="Y" and prt_right=true then
                  if prt_type="H" then
     %>
    <td style="width:20%"><%=f_glo("SF00735")%></td>
    <td style="width:30%">
        <select id="print_templet" name="print_templet" style="width:100%">

            <%dim sql_templet,rs_templet
              sql_templet=" select id,name from email_templet where templet_type='G' and valid='1' "
              set rs_templet=conn.execute(sql_templet)
              if rs_templet.recordcount>0 then
                do while not rs_templet.eof
             %>
            <option value="<%=rs_templet("id") %>" <%if templet_id=trim(rs_templet("id")) then %> selected <%end if %> ><%=rs_templet("name") %></option>
            <%
                rs_templet.movenext
                loop
            else %>
            <option value=""></option>
            <%end if %>
        </select>
    </td>
    <%          else
    %>
    <td ></td>
     <td ></td>
    <%          end if
    else%>
    <td ></td>
     <td ></td>
    <% end if%>
  </tr>
    <tr>
        <td width="20%">促销代码</td>
        <td width="30%"><input style="width :100%" name="promotion_code" value="<%=rs_merge("promotion_trace_code")%>" readonly="readonly" /></td>
        <td  width="20%">入住总人数(成人+小孩)</td>
        <td width="30%"><input name="guests" style="width :100%" value="<%=guests%>" readonly="readonly"></td>
    </tr>
   <tr>
    <td style="width:20%"><%=f_glo("SF00024")%></td>
    <td colspan="3">
        <textarea rows="3" cols="20" id="m_history_remark" name="m_history_remark" style="width:100%;"><%=remark%></textarea>
    </td>
   </tr>
 </table>
  <br>
  <p>
    <input type="hidden" name="operator_id" value="<%=operator_no%>"/>
    <input type="hidden" name="points" value="<%=points%>"/>
    <input type="hidden" name="id" value="<%=id%>"/>
    <input type="hidden" name="booker_no" value="<%=booker_no%>"/>
    <input type="hidden" name="gh_no" value="<%=gh_no%>"/>
    <input type="hidden" name="old_total_rev" value="<%=old_total_rev%>"/>
    <input type="hidden" name="payment" value="<%=payment%>"/>
    <input type="hidden" name="membership" value="<%=membership%>"/>
    <input type="hidden" name="entry" value="<%=entry%>"/>
    <input type="hidden" name="chname" value="<%=sub_name%>"/>
    <input type="hidden" name="last_net" value="<%=balance-deposit%>"/>
    <input type="hidden" name="last_deposit" value="<%=deposit%>"/>
    <input type="hidden" name="card_type" value="<%=card_type%>" />
    <input type="hidden" name="expiry_date" value="<%=expiry_date %>"/>
    <input type="hidden" name="channel_code" value="<%=channel_code%>"/>
    <input type="hidden" name="market_code" value="<%=market_code %>"/>
    <input type="hidden" name="source_code" value="<%=source_code %>"/>
    <input type="hidden" name="b_balance"/>
    <input type="hidden" name="b_points"/>
    <input type="hidden" name="his_type" value="R"/>
    <input type="hidden" name="his_id" value="<%=id%>"/>
    <input type="hidden" name="print_time" value="<%=date & chr(32) & FormatDateTime(time,vbShortTime)%>" />

    <input type="hidden" id="fee_id" name="fee_id" value="<%=fee_id %>" />
    <input type="hidden" id="form_action" name="form_action" />
    </p>
    <%if is_complete="Y" then  %>
    <%if fn_check_right(user_code,"S302") then  '修改权限%>     
    <input type="button" name="button" value="<%=f_glo("SH00125")%>" class="buttonface" onclick="fn_save_remark()" />&nbsp;&nbsp;
    <%end if %>
    <%if fn_check_right(user_code,"S310") then  '补打控制%>
    <input type="button" name="print" value="<%=f_glo("SH01081")%>" onclick="fn_print_new()" class="buttonface" />&nbsp;&nbsp;
    <%end if%>
    <%end if %>
    <input type="button" name="cancel" value="<%=f_glo("SH00126")%>" class="buttonface" onclick="fn_return()" />
<br />
<%if whether_bucket="Y" then %>
<h2><%=f_glo("SH01144")%></h2>
<%dim sql_dic_child,rs_dic_child
if is_complete="N" then
%>
<table width="100%"  class="input-9-tb" cellpadding=1 cellspacing=1>
    <tr>
        <td style="width:20%"><%=f_glo("SH01145")%><font color="red">*</font></td>
        <td style="width:30%">
            <input type="hidden" name="source_detail" value="<%=source_code %>"/>
            <input type="hidden" name="market_detail" value="<%=market_code %>"/>
            <input type="text" name="post_date_detail" style="width:100%" value="<%=date() %>" onClick="get_s_date(form1.post_date_detail,form1.post_date_detail);" />
        </td>

        <td style="width:2%"><%=f_glo("SH01147")%><font color="red">*</font></td>
        <td style="width:30%">
            <input type="hidden" name="trans_item" id="trans_item" />
            <input type="hidden" name="payment_detail" id="payment_detail" />
            <input name="trans_code_detail" id="trans_code_detail" type="hidden">
            <input name="trans_name_detail" id="trans_name_detail" style="width:85%" onClick="ShowFinder_trans_code('form1.trans_code_detail','form1.trans_name_detail','form1.trans_item','form1.payment_detail');">
            <a href="javascript:ShowFinder_trans_code('form1.trans_code_detail','form1.trans_name_detail','form1.trans_item','form1.payment_detail');">
            <img src="../../images/imgbtn_Date.jpg" align="absMiddle" border="0"></a>
        </td>
    </tr>
    <tr>
        <td style="width:20%"><%=f_glo("SH01148")%></td>
        <td style="width:30%">
            <input type="text" name="room_no_detail" value="<%=room_number %>" style="width:100%" />
        </td>
        <td style="width:20%"><%=f_glo("SH01150")%><font color="red">*</font></td>
        <td style="width:30%">
            <input name="rate_code_detail" id="rate_code_detail" type="hidden" value="<%=rate_code %>" >
            <input name="rate_name_detail" id="rate_name_detail" style="width:85%" value="<%=rate_name %>"  onClick="ShowFinder_rate('form1.rate_code_detail','form1.rate_name_detail');">
            <a href="javascript:ShowFinder_rate('form1.rate_code_detail','form1.rate_name_detail');">
            <img src="../../images/imgbtn_Date.jpg" align="absMiddle" border="0"></a>
        </td>
    </tr>
     <tr>
        <td style="width:20%"><%=f_glo("SH01151")%><font color="red">*</font></td>
        <td style="width:30%">
            <input type="text" name="price_per_unit_detail" style="width:100%" onKeyPress="checkMoneyNew(this.value,this.Tabindex)"  onBlur="fn_get_amount()" />
        </td>
        <td style="width:20%"><%=f_glo("SH01152")%></td>
        <td style="width:30%">
            <input type="text" name="quantity_detail" style="width:100%" onBlur="fn_get_amount()"/>
        </td>

    </tr>
    <tr>
        <td style="width:20%"><%=f_glo("SH01154")%><font color="red">*</font></td>
        <td style="width:30%">
            <input type="text" name="amount_detail" style="width:100%" readonly />
        </td>
        <td style="width:20%"><p id="card_no_text" style="display:none;float: left;"><%=f_glo("SH00805") %><font color="red">*</font></p></td>
        <td style="width:30%">
            <input style="width :85%;display:none;float: left;" name="cardno_detail" id="cardno_detail"
            readonly
            onclick="javascript:ShowFinder_card_more_his('form1.cardno_detail','form1.card_balance_detail','form1.card_overdraft_detail','form1.card_used_sum_detail','');"/>
            <a href="javascript:ShowFinder_card_more_his('form1.cardno_detail','form1.card_balance_detail','form1.card_overdraft_detail','form1.card_used_sum_detail','');">
            <img src="../../images/imgbtn_Date.jpg" align="absMiddle" border="0" id="img_0" style="display:none;float: left;"/></a>
            <input type="hidden" name="card_balance_detail" id="card_balance_detail" />
            <input type="hidden" name="card_overdraft_detail" id="card_overdraft_detail" />
            <input type="hidden" name="card_used_sum_detail" id="card_used_sum_detail" />
        </td>

    </tr>
    <tr>
        <td colspan="3"></td>
        <td align="right">
            <input style="width:30%" type="button" name="new_his_trans" value="<%=f_glo("SH01155")%>" class="buttonface" onclick="fn_add_his_trans()" />
        </td>
    </tr>
</table>
<%end if %>
<br />
<table class="input-9-tb" align="center" cellpadding=2 cellspacing=1 width="100%" id="table_his_detail">
    <tr>
        <th><%=f_glo("SH01156")%></th>
        <th><%=f_glo("Z0000874")%></th>
        <th><%=f_glo("SH01157")%></th>
        <th><%=f_glo("SH01158")%></th>
        <th><%=f_glo("SH01159")%></th>
        <th><%=f_glo("SH01151")%></th>
        <th><%=f_glo("SH01152")%></th>
        <th><%=f_glo("SH01163")%></th>
    </tr>
    <%
    dim sql_his_detail,rs_his_detail
    sql_his_detail = " select tc.code as transaction_code,tc.name transaction_name,s.name as source,m.name as market, " & _
                     " isnull(p.name,'') as payment,r.name as rate_name," & _
                     " case when hpd.transaction_type='FC' then '支付方式' when hpd.transaction_type='C'" & _
                     " then '消费品' when hpd.transaction_type='BT' then 'Balance Transfer'  else 'package' end as transaction_type," & _
                     " hpd.id,hpd.post_date,hpd.amount,hpd.room_no,hpd.quantity,hpd.price_per_unit,hpd.card_no " & _
                     " from member_history_svc_pms_detail hpd" & _
                     " inner join dic_transaction_code tc on hpd.transaction_code=tc.code " & _
                     " left join dic_source s on hpd.source=s.code " & _
                     " left join dic_segment m on hpd.market=m.code" & _
                     " left join dic_payment p on hpd.payment=p.code" & _
                     " left join V_dic_rate r on hpd.rate_code=r.code and r.hotel_code=hpd.hotel_code" & _
                     " where hpd.his_id='"&id&"' " & _
                     " order by hpd.post_date"

    set rs_his_detail = conn.execute(sql_his_detail)

    dim trans_payment_total,trans_item_total
    trans_payment_total=0
    trans_item_total=0
    if rs_his_detail.recordcount>0 then
        do while not rs_his_detail.eof
    %>
        <tr>
            <td><%=rs_his_detail("transaction_name") %>[<%=rs_his_detail("transaction_code")%>]
                <%if rs_his_detail("transaction_type")="支付方式" then %>
                    <input type="hidden" class='classpayment' value="<%=rs_his_detail("transaction_code") %>" />
                <%end if %>
            </td>
            <td><%=rs_his_detail("transaction_type") %></td>
            <td><%=rs_his_detail("post_date") %></td>
            <td><%=rs_his_detail("rate_name") %></td>
            <td><%=rs_his_detail("room_no") %></td>
            <td><%=StrToMoney(rs_his_detail("price_per_unit")) %></td>
            <td><%=rs_his_detail("quantity") %></td>
            <td><%=StrToMoney(rs_his_detail("amount")) %></td>
            <td align='center' style='width:40px'><a href='javascript:;' onclick="fn_deleteHistoryRow(<%=rs_his_detail("id") %>)">删除</a></td>
        </tr>
    <%
        if rs_his_detail("transaction_type")="支付方式" then
            trans_payment_total=trans_payment_total+StrToMoney(cdbl(rs_his_detail("amount")))
        else
            trans_item_total=trans_item_total+StrToMoney(cdbl(rs_his_detail("amount")))
        end if

        rs_his_detail.movenext
        loop
    end if
    %>
</table>

<br />
<%if is_complete="N" then %>
<input type=button name="btnSaveTrans" value="<%=f_glo("SH01166")%>" class="buttonface" onclick="fn_save_trans()" />
<%end if %>
<%if rs_his_detail.recordcount>0 and is_complete="N" then  %>
<input type=button name="btnSaveTrans" value="<%=f_glo("S00267")%>" class="buttonface" onclick="fn_save_trans_complete()" />
<%end if %>
<%end if %>
<input type="hidden" name="tr_lastIndex" value="1" id="tr_lastIndex" />
<input type="hidden" name="pay_svc_limit" value="0" id="pay_svc_limit" />
<input type="hidden" name="trans_item_total" value="<%=trans_item_total %>" id="trans_item_total" />
<input type="hidden" name="trans_payment_total" value="<%=trans_payment_total %>" id="trans_payment_total" />
<input type="hidden" name="main_card_no" value="<%=main_card_no %>" />
<input type="hidden" name="templet_id" value="<%=templet_id %>" />
<input type="hidden" name="is_complete" value="<%=is_complete %>" />
<input type="hidden" name="trace_code" value="<%=trace_code %>" />
</form>
</center>
</body>
</html>
<script type="text/javascript" language="javascript">
<%if is_complete="N" then %>
    fn_get_amount();
<%end if %>
</script>
<!--#include file = '../../include/close.asp'-->
02-12 04:20