using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 具体账户利息测算
    /// 通过账号计算账户利息
    /// </summary>
    public class AccountInterestCalculation : TFOutput
    {
        #region Output
        /// <summary>
        /// 应付利息 102P
        /// (null)
        /// </summary>
        public string YFLX { get; internal set; }

        /// <summary>
        /// 利息税 102Q
        /// (null)
        /// </summary>
        public string LXS { get; internal set; }

        /// <summary>
        /// 保值利息 102R
        /// (null)
        /// </summary>
        public string BZLX { get; internal set; }

        /// <summary>
        /// 本息合计 102S
        /// (null)
        /// </summary>
        public string BXHJ { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 账号 0300
            /// (null) 
            /// </summary>
            public string ZH { get; set; }

            /// <summary>
            /// 账户序号 0340
            /// (null) 
            /// </summary>
            public string ZHXH { get; set; }

            /// <summary>
            /// 支取金额 0400
            /// (null) 
            /// </summary>
            public string ZQJE { get; set; }

            /// <summary>
            /// 交易日期 0440
            /// (null) 
            /// </summary>
            public string JYRQ { get; set; }

            /// <summary>
            /// 支取方式 0700
            /// 定期账户支取方式：1:销户，2:部提 活期(不销户，不计息) 空值默认:销户 
            /// </summary>
            public string ZQFS { get; set; }

            /// <summary>
            /// 是否有教育证明 0710
            /// 1:有 0:没有，空值默认没有 
            /// </summary>
            public string SFJYZM { get; set; }
            /// <summary>
            /// 执行利率标志（通知存款特殊要求）
            /// 0: 活期利率, 1:一天通知存款利率,2:七天通知存款利率,3:系统计算利率,空值默认没有 
            /// </summary>
            public string ZXLLBZ { get; set; }

            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new AccountInterestCalculation();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K026";
                MessageData.Fd20 = ZXLLBZ;
                MessageData.Fd30 = ZH;
                MessageData.Fd34 = ZHXH;
                MessageData.Fd40 = ZQJE;
                MessageData.Fd44 = JYRQ;
                MessageData.Fd70 = ZQFS;
                MessageData.Fd71 = SFJYZM;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.YFLX = (MessageData.Fd102_P);
                output.LXS = (MessageData.Fd102_Q);
                output.BZLX = (MessageData.Fd102_R);
                output.BXHJ = (MessageData.Fd102_S);

                return output;
            }
        }
        #endregion
    }
}
