using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using freetrain.world.accounting;
using freetrain.util;
using freetrain.world;
using freetrain.framework;
using freetrain.controllers;

namespace freetrain.views.bank
{
	/// <summary>
	/// Form1 の概要の説明です。
	/// </summary>
	public class BankCounterForm : AbstractControllerImpl
	{
		#region generated by form editor
		private System.Windows.Forms.TabPage pgLoan;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TabPage pgDeposit;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.TabPage pgRepay;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label15;
		private System.Windows.Forms.Label label17;
		private System.Windows.Forms.Label label22;
		private System.Windows.Forms.Label label20;
		private System.Windows.Forms.Label label23;
		private System.Windows.Forms.Label label24;
		private System.Windows.Forms.Label label25;
		private System.Windows.Forms.Label label27;
		private System.Windows.Forms.Label label29;
		private System.Windows.Forms.Label label31;
		private System.Windows.Forms.Label label32;
		private System.Windows.Forms.TabPage pgCancel;
		private System.Windows.Forms.Label label33;
		private System.Windows.Forms.Label label38;
		private System.Windows.Forms.Button btn_loan_set;
		private System.Windows.Forms.Button btn_loan_max;
		private System.Windows.Forms.RadioButton rb_loan1;
		private System.Windows.Forms.TextBox tb_loan;
		private System.Windows.Forms.Label tl_loan1;
		private System.Windows.Forms.Label tl_loan_max;
		private System.Windows.Forms.Label tl_loan3;
		private System.Windows.Forms.Label tl_loan5;
		private System.Windows.Forms.RadioButton rb_loan3;
		private System.Windows.Forms.RadioButton rb_loan5;
		private System.Windows.Forms.Button btn_repay_set;
		private System.Windows.Forms.Button btn_repay_max;
		private System.Windows.Forms.TextBox tb_repay;
		private System.Windows.Forms.Button btn_deposit_set;
		private System.Windows.Forms.Button btn_deposit95;
		private System.Windows.Forms.TextBox tb_deposit;
		private System.Windows.Forms.RadioButton rb_deposit1;
		private System.Windows.Forms.Label tl_deposit1;
		private System.Windows.Forms.Label tl_deposit3;
		private System.Windows.Forms.Label tl_deposit5;
		private System.Windows.Forms.RadioButton rb_deposit3;
		private System.Windows.Forms.RadioButton rb_deposit5;
		private System.Windows.Forms.Button btn_deposit75;
		private System.Windows.Forms.Button btn_deposit50;
		private System.Windows.Forms.Button btn_deposit25;
		private System.Windows.Forms.Label tl_intr_now;
		private System.Windows.Forms.Button btn_cancel_maturity;
		private System.Windows.Forms.ListView list_cancel;
		private System.Windows.Forms.Label tl_intr_mature;
		private System.Windows.Forms.Label tl_tot_capital;
		private System.Windows.Forms.Button btn_cancel_now;
		private System.Windows.Forms.ListView list_deposit;
		private System.Windows.Forms.ListView list_repay;
		private System.Windows.Forms.ListView list_loan;
		private System.Windows.Forms.TabControl tab_main;
		private System.Windows.Forms.Label mlabel2;
		private System.Windows.Forms.Label mlabel3;
		private System.Windows.Forms.Label mlabel4;
		private System.Windows.Forms.Label mlabel5;
		private System.Windows.Forms.Label mlabel6;
		private System.Windows.Forms.Label mlabel1;
		private System.Windows.Forms.Label mlabel7;
		/// <summary>
		/// 必要なデザイナ変数です。
		/// </summary>
		#endregion
		private System.ComponentModel.Container components = null;
		private long maxRepay=0;
		private AccountListener listener = null;

		static private ClockHandler creator = null;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label tl_tot_debt;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.Label mlabel8;
		static private BankCounterForm theInstance = null;

		static private AccountManager manager { get { return World.world.account; } }
		static private Clock clock { get { return World.world.clock; } }
		static private BankModule bank { get { return BankModule.theInstance; } }

		// After waiting for entering business hour, indicates form. 
		static public void ShowBankCounter()
		{
			if( theInstance != null ) 
			{
				theInstance.Activate();
				return;
			}
			TimeLength span = BankConfig.spanToOpen;
			if( span.totalMinutes <= 0 )
				createForm();
			else
			{
				MainWindow.showError("営業開始までお待ちください");
				if( creator == null ) {
					creator = new ClockHandler(createForm);
					clock.registerOneShot(creator,span);
				}				
			}
		}

		static private void createForm() {
			theInstance = new BankCounterForm();
			theInstance.Show();
			//form.MdiParent = MainWindow.mainWindow;
			creator = null;
		}

		public BankCounterForm()
		{
			//
			// Windows フォーム デザイナ サポートに必要です。
			//
			InitializeComponent();

			InitializeComponent2();
			listener = new AccountListener(onAccountChanged);
			AccountManager.onAccountChange += listener;
			onAccountChanged();
		}

		/// <summary>
		/// 使用されているリソースに後処理を実行します。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			if( listener!=null )
				AccountManager.onAccountChange -= listener;
			BankbookListHelper.RemoveList(list_loan);
			BankbookListHelper.RemoveList(list_repay);
			BankbookListHelper.RemoveList(list_deposit);
			BankbookListHelper.RemoveList(list_cancel);
			base.Dispose( disposing );
			theInstance = null;
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
		/// コード エディタで変更しないでください。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(BankCounterForm));
			this.tab_main = new System.Windows.Forms.TabControl();
			this.pgLoan = new System.Windows.Forms.TabPage();
			this.list_loan = new System.Windows.Forms.ListView();
			this.btn_loan_set = new System.Windows.Forms.Button();
			this.btn_loan_max = new System.Windows.Forms.Button();
			this.rb_loan1 = new System.Windows.Forms.RadioButton();
			this.tb_loan = new System.Windows.Forms.TextBox();
			this.tl_loan1 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.tl_loan_max = new System.Windows.Forms.Label();
			this.mlabel2 = new System.Windows.Forms.Label();
			this.mlabel3 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label11 = new System.Windows.Forms.Label();
			this.label15 = new System.Windows.Forms.Label();
			this.tl_loan3 = new System.Windows.Forms.Label();
			this.label17 = new System.Windows.Forms.Label();
			this.tl_loan5 = new System.Windows.Forms.Label();
			this.label22 = new System.Windows.Forms.Label();
			this.rb_loan3 = new System.Windows.Forms.RadioButton();
			this.rb_loan5 = new System.Windows.Forms.RadioButton();
			this.pgRepay = new System.Windows.Forms.TabPage();
			this.list_repay = new System.Windows.Forms.ListView();
			this.btn_repay_set = new System.Windows.Forms.Button();
			this.btn_repay_max = new System.Windows.Forms.Button();
			this.tb_repay = new System.Windows.Forms.TextBox();
			this.mlabel4 = new System.Windows.Forms.Label();
			this.label20 = new System.Windows.Forms.Label();
			this.pgDeposit = new System.Windows.Forms.TabPage();
			this.list_deposit = new System.Windows.Forms.ListView();
			this.btn_deposit_set = new System.Windows.Forms.Button();
			this.btn_deposit95 = new System.Windows.Forms.Button();
			this.tb_deposit = new System.Windows.Forms.TextBox();
			this.mlabel5 = new System.Windows.Forms.Label();
			this.label31 = new System.Windows.Forms.Label();
			this.rb_deposit1 = new System.Windows.Forms.RadioButton();
			this.tl_deposit1 = new System.Windows.Forms.Label();
			this.label23 = new System.Windows.Forms.Label();
			this.label24 = new System.Windows.Forms.Label();
			this.label25 = new System.Windows.Forms.Label();
			this.tl_deposit3 = new System.Windows.Forms.Label();
			this.label27 = new System.Windows.Forms.Label();
			this.tl_deposit5 = new System.Windows.Forms.Label();
			this.label29 = new System.Windows.Forms.Label();
			this.rb_deposit3 = new System.Windows.Forms.RadioButton();
			this.rb_deposit5 = new System.Windows.Forms.RadioButton();
			this.label32 = new System.Windows.Forms.Label();
			this.btn_deposit75 = new System.Windows.Forms.Button();
			this.btn_deposit50 = new System.Windows.Forms.Button();
			this.btn_deposit25 = new System.Windows.Forms.Button();
			this.pgCancel = new System.Windows.Forms.TabPage();
			this.btn_cancel_maturity = new System.Windows.Forms.Button();
			this.btn_cancel_now = new System.Windows.Forms.Button();
			this.label33 = new System.Windows.Forms.Label();
			this.tl_intr_now = new System.Windows.Forms.Label();
			this.mlabel6 = new System.Windows.Forms.Label();
			this.list_cancel = new System.Windows.Forms.ListView();
			this.mlabel7 = new System.Windows.Forms.Label();
			this.tl_intr_mature = new System.Windows.Forms.Label();
			this.label38 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.tl_tot_capital = new System.Windows.Forms.Label();
			this.mlabel1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.tl_tot_debt = new System.Windows.Forms.Label();
			this.mlabel8 = new System.Windows.Forms.Label();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.tab_main.SuspendLayout();
			this.pgLoan.SuspendLayout();
			this.pgRepay.SuspendLayout();
			this.pgDeposit.SuspendLayout();
			this.pgCancel.SuspendLayout();
			this.SuspendLayout();
			// 
			// tab_main
			// 
			this.tab_main.Alignment = System.Windows.Forms.TabAlignment.Bottom;
			this.tab_main.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tab_main.Controls.AddRange(new System.Windows.Forms.Control[] {
																				   this.pgLoan,
																				   this.pgRepay,
																				   this.pgDeposit,
																				   this.pgCancel});
			this.tab_main.Location = new System.Drawing.Point(0, 48);
			this.tab_main.Name = "tab_main";
			this.tab_main.SelectedIndex = 0;
			this.tab_main.Size = new System.Drawing.Size(360, 272);
			this.tab_main.TabIndex = 2;
			this.tab_main.SelectedIndexChanged += new System.EventHandler(this.tab_main_SelectedIndexChanged);
			// 
			// pgLoan
			// 
			this.pgLoan.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.list_loan,
																				 this.btn_loan_set,
																				 this.btn_loan_max,
																				 this.rb_loan1,
																				 this.tb_loan,
																				 this.tl_loan1,
																				 this.label1,
																				 this.label3,
																				 this.tl_loan_max,
																				 this.mlabel2,
																				 this.mlabel3,
																				 this.label8,
																				 this.label11,
																				 this.label15,
																				 this.tl_loan3,
																				 this.label17,
																				 this.tl_loan5,
																				 this.label22,
																				 this.rb_loan3,
																				 this.rb_loan5});
			this.pgLoan.Location = new System.Drawing.Point(4, 4);
			this.pgLoan.Name = "pgLoan";
			this.pgLoan.Size = new System.Drawing.Size(352, 247);
			this.pgLoan.TabIndex = 0;
			this.pgLoan.Text = "借入";
			// 
			// list_loan
			// 
			this.list_loan.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.list_loan.FullRowSelect = true;
			this.list_loan.GridLines = true;
			this.list_loan.HideSelection = false;
			this.list_loan.Location = new System.Drawing.Point(4, 115);
			this.list_loan.Name = "list_loan";
			this.list_loan.Size = new System.Drawing.Size(344, 128);
			this.list_loan.TabIndex = 9;
			this.list_loan.View = System.Windows.Forms.View.Details;
			// 
			// btn_loan_set
			// 
			this.btn_loan_set.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_loan_set.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_loan_set.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
			this.btn_loan_set.Location = new System.Drawing.Point(304, 80);
			this.btn_loan_set.Name = "btn_loan_set";
			this.btn_loan_set.Size = new System.Drawing.Size(40, 24);
			this.btn_loan_set.TabIndex = 8;
			this.btn_loan_set.Text = "決定";
			this.btn_loan_set.Click += new System.EventHandler(this.btn_loan_set_Click);
			// 
			// btn_loan_max
			// 
			this.btn_loan_max.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_loan_max.Location = new System.Drawing.Point(168, 56);
			this.btn_loan_max.Name = "btn_loan_max";
			this.btn_loan_max.Size = new System.Drawing.Size(40, 24);
			this.btn_loan_max.TabIndex = 7;
			this.btn_loan_max.Text = "MAX";
			this.btn_loan_max.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
			this.btn_loan_max.Click += new System.EventHandler(this.btn_loan_max_Click);
			// 
			// rb_loan1
			// 
			this.rb_loan1.Appearance = System.Windows.Forms.Appearance.Button;
			this.rb_loan1.Checked = true;
			this.rb_loan1.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
			this.rb_loan1.Location = new System.Drawing.Point(8, 32);
			this.rb_loan1.Name = "rb_loan1";
			this.rb_loan1.Size = new System.Drawing.Size(40, 20);
			this.rb_loan1.TabIndex = 3;
			this.rb_loan1.TabStop = true;
			this.rb_loan1.Text = "１年";
			this.rb_loan1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.rb_loan1.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			// 
			// tb_loan
			// 
			this.tb_loan.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tb_loan.Location = new System.Drawing.Point(184, 31);
			this.tb_loan.Name = "tb_loan";
			this.tb_loan.Size = new System.Drawing.Size(120, 19);
			this.tb_loan.TabIndex = 6;
			this.tb_loan.Text = "0";
			this.tb_loan.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			this.tb_loan.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numelicEdit_KeyPress);
			// 
			// tl_loan1
			// 
			this.tl_loan1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_loan1.Location = new System.Drawing.Point(56, 33);
			this.tl_loan1.Name = "tl_loan1";
			this.tl_loan1.Size = new System.Drawing.Size(40, 18);
			this.tl_loan1.TabIndex = 2;
			this.tl_loan1.Text = "5";
			this.tl_loan1.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(48, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(64, 16);
			this.label1.TabIndex = 1;
			this.label1.Text = "借入利率：";
			this.label1.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(136, 8);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 16);
			this.label3.TabIndex = 1;
			this.label3.Text = "限度額：";
			this.label3.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// tl_loan_max
			// 
			this.tl_loan_max.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tl_loan_max.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_loan_max.Location = new System.Drawing.Point(184, 7);
			this.tl_loan_max.Name = "tl_loan_max";
			this.tl_loan_max.Size = new System.Drawing.Size(120, 18);
			this.tl_loan_max.TabIndex = 2;
			this.tl_loan_max.Text = "500,000,000";
			this.tl_loan_max.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// mlabel2
			// 
			this.mlabel2.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel2.Location = new System.Drawing.Point(304, 8);
			this.mlabel2.Name = "mlabel2";
			this.mlabel2.Size = new System.Drawing.Size(44, 16);
			this.mlabel2.TabIndex = 1;
			this.mlabel2.Text = "千円";
			this.mlabel2.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// mlabel3
			// 
			this.mlabel3.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel3.Location = new System.Drawing.Point(304, 32);
			this.mlabel3.Name = "mlabel3";
			this.mlabel3.Size = new System.Drawing.Size(44, 16);
			this.mlabel3.TabIndex = 1;
			this.mlabel3.Text = "千円";
			this.mlabel3.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(136, 32);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(48, 16);
			this.label8.TabIndex = 1;
			this.label8.Text = "借入額：";
			this.label8.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label11
			// 
			this.label11.Location = new System.Drawing.Point(96, 34);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(18, 16);
			this.label11.TabIndex = 1;
			this.label11.Text = "％";
			this.label11.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label15
			// 
			this.label15.Location = new System.Drawing.Point(96, 58);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(18, 16);
			this.label15.TabIndex = 1;
			this.label15.Text = "％";
			this.label15.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// tl_loan3
			// 
			this.tl_loan3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_loan3.Location = new System.Drawing.Point(56, 57);
			this.tl_loan3.Name = "tl_loan3";
			this.tl_loan3.Size = new System.Drawing.Size(40, 18);
			this.tl_loan3.TabIndex = 2;
			this.tl_loan3.Text = "5";
			this.tl_loan3.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label17
			// 
			this.label17.Location = new System.Drawing.Point(96, 82);
			this.label17.Name = "label17";
			this.label17.Size = new System.Drawing.Size(18, 16);
			this.label17.TabIndex = 1;
			this.label17.Text = "％";
			this.label17.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// tl_loan5
			// 
			this.tl_loan5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_loan5.Location = new System.Drawing.Point(56, 81);
			this.tl_loan5.Name = "tl_loan5";
			this.tl_loan5.Size = new System.Drawing.Size(40, 18);
			this.tl_loan5.TabIndex = 2;
			this.tl_loan5.Text = "5";
			this.tl_loan5.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label22
			// 
			this.label22.Location = new System.Drawing.Point(8, 8);
			this.label22.Name = "label22";
			this.label22.Size = new System.Drawing.Size(40, 16);
			this.label22.TabIndex = 1;
			this.label22.Text = "期限：";
			this.label22.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// rb_loan3
			// 
			this.rb_loan3.Appearance = System.Windows.Forms.Appearance.Button;
			this.rb_loan3.Location = new System.Drawing.Point(8, 56);
			this.rb_loan3.Name = "rb_loan3";
			this.rb_loan3.Size = new System.Drawing.Size(40, 20);
			this.rb_loan3.TabIndex = 4;
			this.rb_loan3.Text = "３年";
			this.rb_loan3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.rb_loan3.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			// 
			// rb_loan5
			// 
			this.rb_loan5.Appearance = System.Windows.Forms.Appearance.Button;
			this.rb_loan5.Location = new System.Drawing.Point(8, 80);
			this.rb_loan5.Name = "rb_loan5";
			this.rb_loan5.Size = new System.Drawing.Size(40, 20);
			this.rb_loan5.TabIndex = 5;
			this.rb_loan5.Text = "５年";
			this.rb_loan5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.rb_loan5.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			// 
			// pgRepay
			// 
			this.pgRepay.Controls.AddRange(new System.Windows.Forms.Control[] {
																				  this.list_repay,
																				  this.btn_repay_set,
																				  this.btn_repay_max,
																				  this.tb_repay,
																				  this.mlabel4,
																				  this.label20});
			this.pgRepay.Location = new System.Drawing.Point(4, 4);
			this.pgRepay.Name = "pgRepay";
			this.pgRepay.Size = new System.Drawing.Size(352, 247);
			this.pgRepay.TabIndex = 3;
			this.pgRepay.Text = "返済";
			// 
			// list_repay
			// 
			this.list_repay.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.list_repay.FullRowSelect = true;
			this.list_repay.GridLines = true;
			this.list_repay.HideSelection = false;
			this.list_repay.Location = new System.Drawing.Point(4, 43);
			this.list_repay.Name = "list_repay";
			this.list_repay.Size = new System.Drawing.Size(344, 200);
			this.list_repay.TabIndex = 13;
			this.list_repay.View = System.Windows.Forms.View.Details;
			this.list_repay.SelectedIndexChanged += new System.EventHandler(this.list_repay_SelectedIndexChanged);
			// 
			// btn_repay_set
			// 
			this.btn_repay_set.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_repay_set.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_repay_set.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
			this.btn_repay_set.Location = new System.Drawing.Point(304, 8);
			this.btn_repay_set.Name = "btn_repay_set";
			this.btn_repay_set.Size = new System.Drawing.Size(40, 24);
			this.btn_repay_set.TabIndex = 12;
			this.btn_repay_set.Text = "決定";
			this.btn_repay_set.Click += new System.EventHandler(this.btn_repay_set_Click);
			// 
			// btn_repay_max
			// 
			this.btn_repay_max.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_repay_max.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_repay_max.Location = new System.Drawing.Point(224, 8);
			this.btn_repay_max.Name = "btn_repay_max";
			this.btn_repay_max.Size = new System.Drawing.Size(40, 24);
			this.btn_repay_max.TabIndex = 11;
			this.btn_repay_max.Text = "MAX";
			this.btn_repay_max.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
			this.btn_repay_max.Click += new System.EventHandler(this.btn_repay_max_Click);
			// 
			// tb_repay
			// 
			this.tb_repay.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tb_repay.Location = new System.Drawing.Point(56, 10);
			this.tb_repay.Name = "tb_repay";
			this.tb_repay.Size = new System.Drawing.Size(120, 19);
			this.tb_repay.TabIndex = 10;
			this.tb_repay.Text = "0";
			this.tb_repay.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			this.tb_repay.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numelicEdit_KeyPress);
			// 
			// mlabel4
			// 
			this.mlabel4.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel4.Location = new System.Drawing.Point(176, 11);
			this.mlabel4.Name = "mlabel4";
			this.mlabel4.Size = new System.Drawing.Size(44, 16);
			this.mlabel4.TabIndex = 6;
			this.mlabel4.Text = "千円";
			this.mlabel4.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label20
			// 
			this.label20.Location = new System.Drawing.Point(8, 11);
			this.label20.Name = "label20";
			this.label20.Size = new System.Drawing.Size(48, 16);
			this.label20.TabIndex = 7;
			this.label20.Text = "返済額：";
			this.label20.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// pgDeposit
			// 
			this.pgDeposit.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.list_deposit,
																					this.btn_deposit_set,
																					this.btn_deposit95,
																					this.tb_deposit,
																					this.mlabel5,
																					this.label31,
																					this.rb_deposit1,
																					this.tl_deposit1,
																					this.label23,
																					this.label24,
																					this.label25,
																					this.tl_deposit3,
																					this.label27,
																					this.tl_deposit5,
																					this.label29,
																					this.rb_deposit3,
																					this.rb_deposit5,
																					this.label32,
																					this.btn_deposit75,
																					this.btn_deposit50,
																					this.btn_deposit25});
			this.pgDeposit.Location = new System.Drawing.Point(4, 4);
			this.pgDeposit.Name = "pgDeposit";
			this.pgDeposit.Size = new System.Drawing.Size(352, 247);
			this.pgDeposit.TabIndex = 2;
			this.pgDeposit.Text = "定期預金";
			// 
			// list_deposit
			// 
			this.list_deposit.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.list_deposit.FullRowSelect = true;
			this.list_deposit.GridLines = true;
			this.list_deposit.HideSelection = false;
			this.list_deposit.Location = new System.Drawing.Point(4, 115);
			this.list_deposit.Name = "list_deposit";
			this.list_deposit.Size = new System.Drawing.Size(344, 128);
			this.list_deposit.TabIndex = 23;
			this.list_deposit.View = System.Windows.Forms.View.Details;
			// 
			// btn_deposit_set
			// 
			this.btn_deposit_set.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_deposit_set.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_deposit_set.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
			this.btn_deposit_set.Location = new System.Drawing.Point(304, 80);
			this.btn_deposit_set.Name = "btn_deposit_set";
			this.btn_deposit_set.Size = new System.Drawing.Size(40, 24);
			this.btn_deposit_set.TabIndex = 22;
			this.btn_deposit_set.Text = "決定";
			this.btn_deposit_set.Click += new System.EventHandler(this.btn_deposit_set_Click);
			// 
			// btn_deposit95
			// 
			this.btn_deposit95.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_deposit95.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_deposit95.Location = new System.Drawing.Point(208, 32);
			this.btn_deposit95.Name = "btn_deposit95";
			this.btn_deposit95.Size = new System.Drawing.Size(32, 20);
			this.btn_deposit95.TabIndex = 18;
			this.btn_deposit95.Text = "95%";
			this.btn_deposit95.Click += new System.EventHandler(this.btn_deposit95_Click);
			// 
			// tb_deposit
			// 
			this.tb_deposit.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tb_deposit.Location = new System.Drawing.Point(184, 8);
			this.tb_deposit.Name = "tb_deposit";
			this.tb_deposit.Size = new System.Drawing.Size(120, 19);
			this.tb_deposit.TabIndex = 17;
			this.tb_deposit.Text = "0";
			this.tb_deposit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			this.tb_deposit.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.numelicEdit_KeyPress);
			// 
			// mlabel5
			// 
			this.mlabel5.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel5.Location = new System.Drawing.Point(304, 9);
			this.mlabel5.Name = "mlabel5";
			this.mlabel5.Size = new System.Drawing.Size(44, 16);
			this.mlabel5.TabIndex = 16;
			this.mlabel5.Text = "千円";
			this.mlabel5.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label31
			// 
			this.label31.Location = new System.Drawing.Point(136, 9);
			this.label31.Name = "label31";
			this.label31.Size = new System.Drawing.Size(48, 16);
			this.label31.TabIndex = 17;
			this.label31.Text = "預入額：";
			this.label31.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// rb_deposit1
			// 
			this.rb_deposit1.Appearance = System.Windows.Forms.Appearance.Button;
			this.rb_deposit1.Checked = true;
			this.rb_deposit1.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
			this.rb_deposit1.Location = new System.Drawing.Point(8, 32);
			this.rb_deposit1.Name = "rb_deposit1";
			this.rb_deposit1.Size = new System.Drawing.Size(40, 20);
			this.rb_deposit1.TabIndex = 14;
			this.rb_deposit1.TabStop = true;
			this.rb_deposit1.Text = "１年";
			this.rb_deposit1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.rb_deposit1.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			// 
			// tl_deposit1
			// 
			this.tl_deposit1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_deposit1.Location = new System.Drawing.Point(56, 33);
			this.tl_deposit1.Name = "tl_deposit1";
			this.tl_deposit1.Size = new System.Drawing.Size(40, 18);
			this.tl_deposit1.TabIndex = 11;
			this.tl_deposit1.Text = "5";
			this.tl_deposit1.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label23
			// 
			this.label23.Location = new System.Drawing.Point(48, 8);
			this.label23.Name = "label23";
			this.label23.Size = new System.Drawing.Size(64, 16);
			this.label23.TabIndex = 9;
			this.label23.Text = "預金利率：";
			this.label23.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label24
			// 
			this.label24.Location = new System.Drawing.Point(96, 34);
			this.label24.Name = "label24";
			this.label24.Size = new System.Drawing.Size(18, 16);
			this.label24.TabIndex = 5;
			this.label24.Text = "％";
			this.label24.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label25
			// 
			this.label25.Location = new System.Drawing.Point(96, 58);
			this.label25.Name = "label25";
			this.label25.Size = new System.Drawing.Size(18, 16);
			this.label25.TabIndex = 6;
			this.label25.Text = "％";
			this.label25.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// tl_deposit3
			// 
			this.tl_deposit3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_deposit3.Location = new System.Drawing.Point(56, 57);
			this.tl_deposit3.Name = "tl_deposit3";
			this.tl_deposit3.Size = new System.Drawing.Size(40, 18);
			this.tl_deposit3.TabIndex = 12;
			this.tl_deposit3.Text = "5";
			this.tl_deposit3.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label27
			// 
			this.label27.Location = new System.Drawing.Point(96, 82);
			this.label27.Name = "label27";
			this.label27.Size = new System.Drawing.Size(18, 16);
			this.label27.TabIndex = 7;
			this.label27.Text = "％";
			this.label27.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// tl_deposit5
			// 
			this.tl_deposit5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_deposit5.Location = new System.Drawing.Point(56, 81);
			this.tl_deposit5.Name = "tl_deposit5";
			this.tl_deposit5.Size = new System.Drawing.Size(40, 18);
			this.tl_deposit5.TabIndex = 10;
			this.tl_deposit5.Text = "5";
			this.tl_deposit5.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label29
			// 
			this.label29.Location = new System.Drawing.Point(8, 8);
			this.label29.Name = "label29";
			this.label29.Size = new System.Drawing.Size(40, 16);
			this.label29.TabIndex = 8;
			this.label29.Text = "満期：";
			this.label29.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// rb_deposit3
			// 
			this.rb_deposit3.Appearance = System.Windows.Forms.Appearance.Button;
			this.rb_deposit3.Location = new System.Drawing.Point(8, 56);
			this.rb_deposit3.Name = "rb_deposit3";
			this.rb_deposit3.Size = new System.Drawing.Size(40, 20);
			this.rb_deposit3.TabIndex = 15;
			this.rb_deposit3.Text = "３年";
			this.rb_deposit3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.rb_deposit3.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			// 
			// rb_deposit5
			// 
			this.rb_deposit5.Appearance = System.Windows.Forms.Appearance.Button;
			this.rb_deposit5.Location = new System.Drawing.Point(8, 80);
			this.rb_deposit5.Name = "rb_deposit5";
			this.rb_deposit5.Size = new System.Drawing.Size(40, 20);
			this.rb_deposit5.TabIndex = 16;
			this.rb_deposit5.Text = "５年";
			this.rb_deposit5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			this.rb_deposit5.CheckedChanged += new System.EventHandler(this.CheckedChanged);
			// 
			// label32
			// 
			this.label32.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.label32.Location = new System.Drawing.Point(160, 32);
			this.label32.Name = "label32";
			this.label32.Size = new System.Drawing.Size(48, 16);
			this.label32.TabIndex = 17;
			this.label32.Text = "対資金";
			this.label32.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// btn_deposit75
			// 
			this.btn_deposit75.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_deposit75.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_deposit75.Location = new System.Drawing.Point(240, 32);
			this.btn_deposit75.Name = "btn_deposit75";
			this.btn_deposit75.Size = new System.Drawing.Size(32, 20);
			this.btn_deposit75.TabIndex = 19;
			this.btn_deposit75.Text = "75%";
			this.btn_deposit75.Click += new System.EventHandler(this.btn_deposit75_Click);
			// 
			// btn_deposit50
			// 
			this.btn_deposit50.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_deposit50.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_deposit50.Location = new System.Drawing.Point(272, 32);
			this.btn_deposit50.Name = "btn_deposit50";
			this.btn_deposit50.Size = new System.Drawing.Size(32, 20);
			this.btn_deposit50.TabIndex = 20;
			this.btn_deposit50.Text = "50%";
			this.btn_deposit50.Click += new System.EventHandler(this.btn_deposit50_Click);
			// 
			// btn_deposit25
			// 
			this.btn_deposit25.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_deposit25.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_deposit25.Location = new System.Drawing.Point(304, 32);
			this.btn_deposit25.Name = "btn_deposit25";
			this.btn_deposit25.Size = new System.Drawing.Size(32, 20);
			this.btn_deposit25.TabIndex = 21;
			this.btn_deposit25.Text = "25%";
			this.btn_deposit25.Click += new System.EventHandler(this.btn_deposit25_Click);
			// 
			// pgCancel
			// 
			this.pgCancel.Controls.AddRange(new System.Windows.Forms.Control[] {
																				   this.btn_cancel_maturity,
																				   this.btn_cancel_now,
																				   this.label33,
																				   this.tl_intr_now,
																				   this.mlabel6,
																				   this.list_cancel,
																				   this.mlabel7,
																				   this.tl_intr_mature,
																				   this.label38});
			this.pgCancel.Location = new System.Drawing.Point(4, 4);
			this.pgCancel.Name = "pgCancel";
			this.pgCancel.Size = new System.Drawing.Size(352, 247);
			this.pgCancel.TabIndex = 4;
			this.pgCancel.Text = "定期解約";
			// 
			// btn_cancel_maturity
			// 
			this.btn_cancel_maturity.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_cancel_maturity.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_cancel_maturity.Location = new System.Drawing.Point(256, 31);
			this.btn_cancel_maturity.Name = "btn_cancel_maturity";
			this.btn_cancel_maturity.Size = new System.Drawing.Size(80, 24);
			this.btn_cancel_maturity.TabIndex = 25;
			this.btn_cancel_maturity.Text = "満期日解約";
			this.btn_cancel_maturity.Click += new System.EventHandler(this.btn_cancel_maturity_Click);
			// 
			// btn_cancel_now
			// 
			this.btn_cancel_now.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.btn_cancel_now.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btn_cancel_now.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
			this.btn_cancel_now.Location = new System.Drawing.Point(256, 5);
			this.btn_cancel_now.Name = "btn_cancel_now";
			this.btn_cancel_now.Size = new System.Drawing.Size(80, 24);
			this.btn_cancel_now.TabIndex = 24;
			this.btn_cancel_now.Text = "即日解約";
			this.btn_cancel_now.Click += new System.EventHandler(this.btn_cancel_now_Click);
			// 
			// label33
			// 
			this.label33.Location = new System.Drawing.Point(8, 9);
			this.label33.Name = "label33";
			this.label33.Size = new System.Drawing.Size(72, 16);
			this.label33.TabIndex = 22;
			this.label33.Text = "現在利息：";
			this.label33.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// tl_intr_now
			// 
			this.tl_intr_now.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tl_intr_now.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_intr_now.Location = new System.Drawing.Point(80, 8);
			this.tl_intr_now.Name = "tl_intr_now";
			this.tl_intr_now.Size = new System.Drawing.Size(128, 18);
			this.tl_intr_now.TabIndex = 23;
			this.tl_intr_now.Text = "0";
			this.tl_intr_now.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// mlabel6
			// 
			this.mlabel6.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel6.Location = new System.Drawing.Point(208, 9);
			this.mlabel6.Name = "mlabel6";
			this.mlabel6.Size = new System.Drawing.Size(44, 16);
			this.mlabel6.TabIndex = 21;
			this.mlabel6.Text = "千円";
			this.mlabel6.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// list_cancel
			// 
			this.list_cancel.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.list_cancel.FullRowSelect = true;
			this.list_cancel.GridLines = true;
			this.list_cancel.HideSelection = false;
			this.list_cancel.Location = new System.Drawing.Point(4, 67);
			this.list_cancel.Name = "list_cancel";
			this.list_cancel.Size = new System.Drawing.Size(344, 176);
			this.list_cancel.TabIndex = 26;
			this.list_cancel.View = System.Windows.Forms.View.Details;
			this.list_cancel.SelectedIndexChanged += new System.EventHandler(this.list_cancel_SelectedIndexChanged);
			// 
			// mlabel7
			// 
			this.mlabel7.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel7.Location = new System.Drawing.Point(208, 35);
			this.mlabel7.Name = "mlabel7";
			this.mlabel7.Size = new System.Drawing.Size(44, 16);
			this.mlabel7.TabIndex = 21;
			this.mlabel7.Text = "千円";
			this.mlabel7.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// tl_intr_mature
			// 
			this.tl_intr_mature.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tl_intr_mature.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_intr_mature.Location = new System.Drawing.Point(80, 34);
			this.tl_intr_mature.Name = "tl_intr_mature";
			this.tl_intr_mature.Size = new System.Drawing.Size(128, 18);
			this.tl_intr_mature.TabIndex = 23;
			this.tl_intr_mature.Text = "0";
			this.tl_intr_mature.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label38
			// 
			this.label38.Location = new System.Drawing.Point(8, 35);
			this.label38.Name = "label38";
			this.label38.Size = new System.Drawing.Size(72, 16);
			this.label38.TabIndex = 22;
			this.label38.Text = "満期日利息：";
			this.label38.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(8, 0);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(64, 16);
			this.label5.TabIndex = 8;
			this.label5.Text = "資金総額：";
			this.label5.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// tl_tot_capital
			// 
			this.tl_tot_capital.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tl_tot_capital.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_tot_capital.Location = new System.Drawing.Point(80, -1);
			this.tl_tot_capital.Name = "tl_tot_capital";
			this.tl_tot_capital.Size = new System.Drawing.Size(136, 18);
			this.tl_tot_capital.TabIndex = 9;
			this.tl_tot_capital.Text = "500,000,000";
			this.tl_tot_capital.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// mlabel1
			// 
			this.mlabel1.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel1.Location = new System.Drawing.Point(216, 0);
			this.mlabel1.Name = "mlabel1";
			this.mlabel1.Size = new System.Drawing.Size(48, 16);
			this.mlabel1.TabIndex = 7;
			this.mlabel1.Text = "千円";
			this.mlabel1.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 25);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(64, 16);
			this.label2.TabIndex = 11;
			this.label2.Text = "負債総額：";
			this.label2.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// tl_tot_debt
			// 
			this.tl_tot_debt.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.tl_tot_debt.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
			this.tl_tot_debt.Location = new System.Drawing.Point(80, 24);
			this.tl_tot_debt.Name = "tl_tot_debt";
			this.tl_tot_debt.Size = new System.Drawing.Size(136, 18);
			this.tl_tot_debt.TabIndex = 12;
			this.tl_tot_debt.Text = "500,000,000";
			this.tl_tot_debt.TextAlign = System.Drawing.ContentAlignment.BottomRight;
			// 
			// mlabel8
			// 
			this.mlabel8.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.mlabel8.Location = new System.Drawing.Point(216, 25);
			this.mlabel8.Name = "mlabel8";
			this.mlabel8.Size = new System.Drawing.Size(48, 16);
			this.mlabel8.TabIndex = 10;
			this.mlabel8.Text = "千円";
			this.mlabel8.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
			// 
			// pictureBox1
			// 
			this.pictureBox1.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
			this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(320, 8);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(32, 32);
			this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
			this.pictureBox1.TabIndex = 13;
			this.pictureBox1.TabStop = false;
			// 
			// BankCounterForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
			this.ClientSize = new System.Drawing.Size(360, 325);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.pictureBox1,
																		  this.label2,
																		  this.tl_tot_debt,
																		  this.mlabel8,
																		  this.label5,
																		  this.tl_tot_capital,
																		  this.mlabel1,
																		  this.tab_main});
			this.MaximizeBox = false;
			this.MaximumSize = new System.Drawing.Size(480, 520);
			this.MinimizeBox = false;
			this.MinimumSize = new System.Drawing.Size(324, 240);
			this.Name = "BankCounterForm";
			this.ShowInTaskbar = false;
			this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
			this.Text = "銀行窓口";
			this.tab_main.ResumeLayout(false);
			this.pgLoan.ResumeLayout(false);
			this.pgRepay.ResumeLayout(false);
			this.pgDeposit.ResumeLayout(false);
			this.pgCancel.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void InitializeComponent2()
		{
			String unit = "円";
			mlabel1.Text=unit;
			mlabel2.Text=unit;
			mlabel3.Text=unit;
			mlabel4.Text=unit;
			mlabel5.Text=unit;
			mlabel6.Text=unit;
			mlabel7.Text=unit;
			mlabel8.Text=unit;

			BankbookListHelper.buildDebtList(list_loan);
			BankbookListHelper.buildDebtList(list_repay);
			BankbookListHelper.buildDepositList(list_deposit);
			BankbookListHelper.buildDepositList(list_cancel);

			tl_loan_max.Text = CurrencyUtil.format(bank.getDebtLimit());
			tl_loan1.Text = 
				(100*bank.GetDebtInterest(TimeLength.fromMinutes(Time.YEAR))).ToString();
			tl_loan3.Text = 
				(100*bank.GetDebtInterest(TimeLength.fromMinutes(Time.YEAR*3))).ToString();
			tl_loan5.Text = 
				(100*bank.GetDebtInterest(TimeLength.fromMinutes(Time.YEAR*5))).ToString();
			tl_deposit1.Text = 
				(100*bank.GetDepositInterest(TimeLength.fromMinutes(Time.YEAR))).ToString();
			tl_deposit3.Text = 
				(100*bank.GetDepositInterest(TimeLength.fromMinutes(Time.YEAR*3))).ToString();
			tl_deposit5.Text = 
				(100*bank.GetDepositInterest(TimeLength.fromMinutes(Time.YEAR*5))).ToString();

			tb_loan.Focus();
			tb_loan.SelectAll();

			if(!BankConfig.canBorrow) tab_main.Controls.Remove(pgLoan);
			if(!BankConfig.canRepay||!BankConfig.canBorrow) tab_main.Controls.Remove(pgRepay);
			if(!BankConfig.canDeposit) tab_main.Controls.Remove(pgDeposit);
			if(!BankConfig.canCancel||!BankConfig.canDeposit) tab_main.Controls.Remove(pgCancel);
		}

		public override LocationDisambiguator disambiguator {
			get {
				return NullDisambiguator.theInstance;
			}
		}

		// Handler called when any radio button checked.
		private void CheckedChanged(object sender, System.EventArgs e) {
			Font bold = new Font(this.Font.FontFamily,9,FontStyle.Bold);
			Font regular = new Font(this.Font.FontFamily,9,FontStyle.Regular);
			rb_deposit1.Font = rb_deposit1.Checked?bold:regular;
			rb_deposit3.Font = rb_deposit3.Checked?bold:regular;
			rb_deposit5.Font = rb_deposit5.Checked?bold:regular;
			rb_loan1.Font = rb_loan1.Checked?bold:regular;
			rb_loan3.Font = rb_loan3.Checked?bold:regular;
			rb_loan5.Font = rb_loan5.Checked?bold:regular;
		}

		private TimeLength loanSpan {
			get	{
				if( rb_loan5.Checked )
					return TimeLength.fromMinutes(Time.YEAR*5);
				if( rb_loan3.Checked )
					return TimeLength.fromMinutes(Time.YEAR*3);
				else
					return TimeLength.fromMinutes(Time.YEAR);
			}
		}

		private TimeLength depositSpan {
			get	{
				if( rb_deposit5.Checked )
					return TimeLength.fromMinutes(Time.YEAR*5);
				if( rb_deposit3.Checked )
					return TimeLength.fromMinutes(Time.YEAR*3);
				else
					return TimeLength.fromMinutes(Time.YEAR);
			}
		}

		private void onAccountChanged() {
			tl_tot_capital.Text = CurrencyUtil.format(manager.liquidAssets);
			tl_tot_debt.Text = CurrencyUtil.format(manager.totalDebts);
		}

		private void btn_loan_max_Click(object sender, System.EventArgs e) {
			tb_loan.Text = bank.getDebtLimit().ToString();
		}

		private void btn_loan_set_Click(object sender, System.EventArgs e) {
			long v = long.Parse(tb_loan.Text);
			if( v>bank.getDebtLimit() ) {
				MainWindow.showError("限度額一杯まで借り入れます");
				v = bank.getDebtLimit();
			}
			if( v>0 ) bank.borrow(v,loanSpan);
			// update available loan amount;
			tl_loan_max.Text = CurrencyUtil.format(bank.getDebtLimit());
		}

		// Allow numerical keys only for the Editbox
		private void numelicEdit_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {
			char key = e.KeyChar;
			if( '0' <= key && '9' >= key ) return;
			if( '\b' == key ) return;
			e.Handled = true;														   
		}

		private void btn_repay_max_Click(object sender, System.EventArgs e)	{
			tb_repay.Text = maxRepay.ToString();
		}

		private void btn_repay_set_Click(object sender, System.EventArgs e)
		{
			if( list_repay.SelectedItems.Count == 0 ) {
				MainWindow.showError("対象リスト行を選択してください");
				return;
			}
			IEnumerator en = list_repay.SelectedItems.GetEnumerator();
			long amount = long.Parse(tb_repay.Text);
			if( amount>maxRepay ) {
				MainWindow.showError("返済額以上の額は支払われません");
				amount = maxRepay;
			}
			while(en.MoveNext())
			{
				FloatingAsset asset = (FloatingAsset)(((ListViewItem)en.Current).Tag);
				long v = asset.amountToday;
				if( v < amount ) {
					amount -= v;
					bank.repay(	asset, v);
				}
				else {
					bank.repay(	asset, amount);
					break;
				}
			}
		}

		private void list_repay_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			IEnumerator en = list_repay.SelectedItems.GetEnumerator();
			maxRepay = 0;
			while(en.MoveNext()) {
				FloatingAsset asset = (FloatingAsset)(((ListViewItem)en.Current).Tag);
				maxRepay += asset.amountToday;
			}
		}

		private void btn_deposit95_Click(object sender, System.EventArgs e)	{
			long n = manager.liquidAssets*95/100;
			tb_deposit.Text = n.ToString();
		}
		private void btn_deposit75_Click(object sender, System.EventArgs e)	{
			long n = manager.liquidAssets*75/100;
			tb_deposit.Text = n.ToString();
		}
		private void btn_deposit50_Click(object sender, System.EventArgs e)	{
			long n = manager.liquidAssets*50/100;
			tb_deposit.Text = n.ToString();
		}
		private void btn_deposit25_Click(object sender, System.EventArgs e)	{
			long n = manager.liquidAssets*25/100;
			tb_deposit.Text = n.ToString();
		}

		private void btn_deposit_set_Click(object sender, System.EventArgs e)
		{
			long v = long.Parse(tb_deposit.Text);
			if( v>manager.liquidAssets ) {
				MainWindow.showError("全資金を預金します");
				v = manager.liquidAssets;
			}
			if( v>0 ) bank.deposit(v,depositSpan);
		}

		private void btn_cancel_now_Click(object sender, System.EventArgs e)
		{
			if( list_cancel.SelectedItems.Count == 0 ) 
			{
				MainWindow.showError("対象リスト行を選択してください");
				return;
			}
			IEnumerator en = list_cancel.SelectedItems.GetEnumerator();
			while(en.MoveNext())
			{
				FloatingAsset asset = (FloatingAsset)(((ListViewItem)en.Current).Tag);
				bank.cancelDeposit(asset,true);
			}		
		}

		private void btn_cancel_maturity_Click(object sender, System.EventArgs e)
		{
			if( list_cancel.SelectedItems.Count == 0 ) {
				MainWindow.showError("対象リスト行を選択してください");
				return;
			}
			IEnumerator en = list_cancel.SelectedItems.GetEnumerator();
			while(en.MoveNext()) {
				FloatingAsset asset = (FloatingAsset)(((ListViewItem)en.Current).Tag);
				bank.cancelDeposit(asset,false);
			}				
		}

		private void list_cancel_SelectedIndexChanged(object sender, System.EventArgs e) {
			IEnumerator en = list_cancel.SelectedItems.GetEnumerator();
			long intrDue = 0;
			long intrToday =0;
			while(en.MoveNext()) 
			{
				FloatingAsset asset = (FloatingAsset)(((ListViewItem)en.Current).Tag);
				intrToday += asset.interestToday;
				intrDue += asset.interestDue;
			}
			tl_intr_now.Text = CurrencyUtil.format(intrToday);
			tl_intr_mature.Text = CurrencyUtil.format(intrDue);
		}

		private void tab_main_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			switch(tab_main.SelectedIndex) {
				case 0://pg_loan
					tb_loan.Focus();
					tb_loan.SelectAll();
					break;
				case 1://pg_repay
					tb_repay.Focus();
					tb_repay.SelectAll();
					break;
				case 2://pg_deposit
					tb_deposit.Focus();
					tb_deposit.SelectAll();
					break;
			}		
		}

		internal class NullDisambiguator : LocationDisambiguator
		{
			static public NullDisambiguator theInstance = new NullDisambiguator();

			protected NullDisambiguator(){}

			public bool isSelectable( Location loc ){ return false; }
		}
	}
}
