<%@ Page Language="C#" %>
<%@ Register TagPrefix="aspxform" Namespace="XFormDesigner.Framework.Web.UI" Assembly="XFormDesigner.Framework" %>
<script runat="server">

    // Insert page code here
    //

</script>
<html xmlns:xform="xmlns:xform">
<head runat="server">
    <link href="/Oimec/Styles/css/StyleSheet.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <title>BPM Form</title> <style>
    BODY {FONT-SIZE: 12px; FONT-FAMILY: verdana}
    TABLE {border-collapse: collapse; FONT-SIZE: 12px; FONT-FAMILY: verdana}
    P {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-SIZE: 12px; FONT-FAMILY: verdana}
    TD {PADDING-RIGHT: 0px; PADDING-LEFT: 2px; PADDING-BOTTOM: 0px}
    TD.NoPadding {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px}
    INPUT {HEIGHT: 20px}
    INPUT.UL {BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: #33ff33 1px solid}
    TEXTAREA {FONT-SIZE:12px}
    #td1 {border-right:#b2bcc6 1px solid}
    </style>
    <script type="text/javascript">
        function GetDateTimeMothe(DateTime) {
            DateTime = DateTime.replace(/-/g, "/");
            var date = new Date(DateTime);
            var month = date.getMonth()+1;
            return month;
        }
   
        agent.on('beforeSubmit', function () {
            var ZhuangTai = agent.Eles[document.getElementById("XTextBox145").getAttribute("xform_xele_index")].getValue();
            if (ZhuangTai == "汇率维护岗维护") {
                var tableObj = document.getElementById('tablenew');
                for (var i = 2; i < tableObj.rows.length ; i++) {
                    var ForeignCurrency = agent.Eles[tableObj.rows[i].cells[0].children[0].getAttribute("xform_xele_index")].getValue();
                    var ThisCurrency = agent.Eles[tableObj.rows[i].cells[1].children[0].getAttribute("xform_xele_index")].getValue();
                    var ExchangeRate = agent.Eles[tableObj.rows[i].cells[2].children[0].getAttribute("xform_xele_index")].getValue();
                    var Coefficient = agent.Eles[tableObj.rows[i].cells[3].children[0].getAttribute("xform_xele_index")].getValue();
                    var ComputeRate = agent.Eles[tableObj.rows[i].cells[3].children[1].getAttribute("xform_xele_index")].getValue();
                    var ValidStartDate = agent.Eles[tableObj.rows[i].cells[4].children['XDateTimePicker1'].getAttribute("xform_xele_index")].getValue();
                    var Dateline = agent.Eles[tableObj.rows[i].cells[2].children[1].getAttribute("xform_xele_index")].getValue();
                    var Operator = agent.Eles[tableObj.rows[i].cells[2].children[2].getAttribute("xform_xele_index")].getValue();
                    
                    YZSoft.Ajax.request({
                        url: YZSoft.$url('Oimec/ApiServices/SalesAPIHandler.ashx'),
                        method: 'POST',
                        //外币，本币，汇率，有效起始时间，当前时间，操作人，系数，汇率*系数
                        params: {
                            method: 'ExchangeRate',
                            ForeignCurrency: ForeignCurrency,
                            ThisCurrency: ThisCurrency,
                            ExchangeRate: ExchangeRate,
                            Coefficient: Coefficient,
                            ComputeRate: ComputeRate,
                            ValidStartDate: ValidStartDate,
                            Dateline: Dateline,
                            Operator: Operator
                        },
                        success: function () {
                        }
                    });
                }
            }
        });
    </script>
</head>
<body>
    <form runat="server">
        <!-- Insert content here -->
        <table width="1200" align="center" class="head" border="0" cellspacing="0" cellpadding="0">
            <tbody>
                <tr>
                    <td class="logo">
                    </td>
                    <td width="1000" class="biaoti">
                        <asp:Label id="XLabel1" runat="server" Value ValueToDisplayText Text="汇率维护"></asp:Label>
                    </td>
                    <td width="400" class="formno">
                        <asp:Label id="XLabel2" runat="server" Value ValueToDisplayText Text="表单号："></asp:Label>
                        <aspxform:XLabel id="XLabel3" BackColor="#8AB3DF" runat="server" Value ValueToDisplayText XDataBind="DF_SA_SS_ExchangeRateMain1.SerialNum">--系统自动生成--</aspxform:XLabel>
                    </td>
                </tr>
            </tbody>
        </table>
        <table width="1200" class="table" align="center" id="tablenew" border="0" cellspacing="0" cellpadding="0" xdatasource="TableName:DF_SA_SS_ExchangeRate" datamap="ForeignCurrency->DF_SA_SS_ExchangeRateMain.ForeignCurrency;ThisCurrency->DF_SA_SS_ExchangeRateMain.ThisCurrency;ExchangeRate->DF_SA_SS_ExchangeRateMain.ExchangeRate;ValidStartDate->DF_SA_SS_ExchangeRateMain.ValidStartDate" menudock="Left" dynamicarea="2,1" multiselect="True">
            <tbody>
                <tr>
                    <td class="title1" colspan="5">
                        <asp:Label id="XLabel4" runat="server" Value ValueToDisplayText Text="维护信息"></asp:Label>
                        <aspxform:XTextBox id="XTextBox145" runat="server" Express="Global.StepName" Width="20px" BorderColor="#DCDCDC" BorderWidth="1" HiddenExpress="1"></aspxform:XTextBox>
                    </td>
                </tr>
                <tr>
                    <td width="22%" height="14" align="center" class="tds">
                        <asp:Label id="XLabel5" runat="server" Value ValueToDisplayText text="外币"></asp:Label>
                    </td>
                    <td width="22%" align="center" class="tds">
                        <asp:Label id="XLabel6" runat="server" Value ValueToDisplayText text="本币"></asp:Label>
                    </td>
                    <td width="22%" align="center" class="tds">
                        <asp:Label id="XLabel7" runat="server" Value ValueToDisplayText text="汇率"></asp:Label>
                    </td>
                    <td width="12%" align="center" class="tds">
                        <asp:Label id="XLabel9" runat="server" Value ValueToDisplayText text="系数"></asp:Label>
                    </td>
                    <td width="22%" align="center" class="tds" id="td1">
                        <asp:Label id="XLabel8" runat="server" Value ValueToDisplayText text="有效起始日期"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="center" class="tds1">
                        <aspxform:XDropDownList id="XDropDownList1" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.ForeignCurrency" Width="100%" XDataSource PromptText="--请选择--">
                            <asp:ListItem>USD</asp:ListItem>
                            <asp:ListItem>JPY</asp:ListItem>
                            <asp:ListItem>HKD</asp:ListItem>
                            <asp:ListItem>EUR</asp:ListItem>
                            <asp:ListItem>CHF</asp:ListItem>
                            <asp:ListItem>GBP</asp:ListItem>
                            <asp:ListItem>CAD</asp:ListItem>
                            <asp:ListItem>CNY</asp:ListItem>
                        </aspxform:XDropDownList>
                    </td>
                    <td align="center" class="tds1">
                        <aspxform:XDropDownList id="XDropDownList4" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.ThisCurrency" Width="100%" DisableExpress="1">
                            <asp:ListItem Selected="True">CNY</asp:ListItem>
                        </aspxform:XDropDownList>
                    </td>
                    <td align="center" class="tds1">
                        <aspxform:XTextBox id="XTextBox1" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.ExchangeRate" BorderColor="#DCDCDC" BorderWidth="1" Format="type:number;.4" width="90%"></aspxform:XTextBox>
                        <aspxform:XTextBox id="XTextBox4" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.Dateline" BorderColor="#DCDCDC" BorderWidth="1" HiddenExpress="1" width="5px"></aspxform:XTextBox>
                        <aspxform:XTextBox id="XTextBox5" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.Operator" BorderColor="#DCDCDC" BorderWidth="1" HiddenExpress="1" width="5px"></aspxform:XTextBox>
                    </td>
                    <td align="center" class="tds1">
                        <aspxform:XTextBox id="XTextBox2" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.Coefficient" BorderColor="#DCDCDC" BorderWidth="1" Format="type:number;.4" width="90%"></aspxform:XTextBox>
                        <aspxform:XTextBox id="XTextBox3" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.ComputeRate" Express="DF_SA_SS_ExchangeRateMain.Coefficient*DF_SA_SS_ExchangeRateMain.ExchangeRate" BorderColor="#DCDCDC" BorderWidth="1" HiddenExpress="1" Format="type:number;.4" width="5px" HiddenInput="True"></aspxform:XTextBox>
                    </td>
                    <td align="center" class="xjtds1">
                        <aspxform:XDateTimePicker id="XDateTimePicker1" runat="server" XDataBind="DF_SA_SS_ExchangeRateMain.ValidStartDate" Width="90%" BorderColor="#DCDCDC" BorderWidth="1"></aspxform:XDateTimePicker>
                    </td>
                </tr>
            </tbody>
        </table>
        <p>
        </p>
        <p>
        </p>
        <table width="1200" align="center">
            <tbody>
                <tr>
                    <td>
                        <aspxform:XProcessButtonList id="XProcessButtonList2" runat="server" PositionSelectVisible="False" SaveAsTemplateButtonVisible="False" SaveButtonVisible="False"></aspxform:XProcessButtonList>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                </tr>
            </tbody>
        </table>
        <p>
        </p>
    </form>
</body>
</html>
