Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                KBDatabase kdb = new KBDatabase();
                string[] stDate, edDate;
                DateTime sDate, eDate, wkDate;

                this.lbl_totalincome.Text = "0 円";
                this.lbl_totalpayment.Text = "0 円";
                this.lbl_cashpayment.Text = "0 円";
                this.lbl_creditpayment.Text = "0 円";
                lbl_in.Text = "0 円";
                lbl_out.Text = "0 円";
                updateBalance();

                account_lst = kdb.getAccountRec();
                cmb_massaccount.Items.Clear();
                cmb_massaccount.Items.Add("");

                kbDatList1.setAccountList(account_lst);

                string str = "";
                foreach (AccountRec rec in account_lst)
                {
                    str = String.Format("{0, 3}:{1}", rec.id, rec.name);
                    balance.Items.Add(str);
                    cmb_massaccount.Items.Add(str);
                }
                this.Text += " Ver 0.0.4";
                cmb_massaccount.SelectedIndex = 0;
                this.Location = new Point(Location.X, 0);
                stDate = kdb.getMinDate().Split('-');
                edDate = kdb.getMaxDate().Split('-');
                sDate = new DateTime(int.Parse(stDate[0]), int.Parse(stDate[1]), 1);
                eDate = new DateTime(int.Parse(edDate[0]), int.Parse(edDate[1]) + 1, 1);
                wkDate = sDate;
                while (!wkDate.Equals(eDate))
                {
                    cmbBalanceMonth.Items.Add(String.Format("{0}-{1:D2}", wkDate.Year, wkDate.Month));
                    wkDate = wkDate.AddMonths(1);
                }

                cmbBalanceMonth.SelectedItem = String.Format("{0}-{1:D2}", DateTime.Today.Year, DateTime.Today.Month);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                KBDatabase kdb = new KBDatabase();
                string[] stDate, edDate;
                DateTime sDate, eDate, wkDate;

                this.lbl_totalincome.Text = "0 円";
                this.lbl_totalpayment.Text = "0 円";
                this.lbl_cashpayment.Text = "0 円";
                this.lbl_creditpayment.Text = "0 円";
                lbl_in.Text = "0 円";
                lbl_out.Text = "0 円";
                updateBalance();

                account_lst = kdb.getAccountRec();
                cmb_massaccount.Items.Clear();
                cmb_massaccount.Items.Add("");
                cmbAccount_src.Items.Add("");

                kbDatList_src.setAccountList(account_lst);
                kbDatList_reg.setAccountList(account_lst);

                string str = "";
                foreach (AccountRec rec in account_lst)
                {
                    str = String.Format("{0, 3}:{1}", rec.id, rec.name);
                    cmb_massaccount.Items.Add(str);
                    cmbAccount_src.Items.Add(str);
                }

                this.Text += _VERSION_NO_;
                cmb_massaccount.SelectedIndex = 0;
                this.Location = new Point(Location.X, 0);
                stDate = kdb.getMinDate().Split('-');
                edDate = kdb.getMaxDate().Split('-');
                sDate = new DateTime(int.Parse(stDate[0]), int.Parse(stDate[1]), 1);
                eDate = new DateTime(int.Parse(edDate[0]), int.Parse(edDate[1]) + 1, 1);
                wkDate = sDate;
                while (!wkDate.Equals(eDate))
                {
                    cmbBalanceMonth.Items.Add(String.Format("{0}-{1:D2}", wkDate.Year, wkDate.Month));
                    wkDate = wkDate.AddMonths(1);
                }

                cmbBalanceMonth.SelectedItem = String.Format("{0}-{1:D2}", DateTime.Today.Year, DateTime.Today.Month);

                // ウィンドウサイズを取得して画面の中心にウィンドウを設定する
                int w = 0, h = 0;
                w = Screen.AllScreens[0].Bounds.Width;
                h = Screen.AllScreens[0].Bounds.Height;
                this.SetBounds((w - this.Width) / 2, (h - this.Height) / 2, this.Width, this.Height);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }