예제 #1
0
 public void load_data()
 {
     dbhand  = new DBHandling(filepath);
     connStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + ";";
     conn    = new OleDbConnection(connStr);
     i       = new OleDbDataAdapter(sql_i, conn);
     e       = new OleDbDataAdapter(sql_e, conn);
     ds1     = new DataSet();
     ds2     = new DataSet();
     i.Fill(ds1);
     e.Fill(ds2);
     dataGridView1.DataSource = ds1.Tables[0];
     income_date1.Value       = set_Sunday(today);
     income_date2.Value       = set_Sunday(today).AddDays(6);
     income_date2.Enabled     = false;
     between_date(income_date1.Value, income_date2.Value, ds1, dataGridView1);
     idv = new DataView(ds1.Tables[0]);
     dataGridView2.DataSource = ds2.Tables[0];
     expend_date1.Value       = set_Sunday(today);
     expend_date2.Value       = set_Sunday(today).AddDays(6);
     expend_date2.Enabled     = false;
     between_date(expend_date1.Value, expend_date2.Value, ds2, dataGridView2);
     edv = new DataView(ds2.Tables[0]);
     numberofsearch();
 }
예제 #2
0
        public void load_data()
        {
            currentDB = new DBHandling(strPath);
            connStr   = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strPath + ";";
            dsG       = new DataSet();
            dsH       = new DataSet();
            dsM       = new DataSet();
            conn      = new OleDbConnection(connStr);
            adp1      = new OleDbDataAdapter(sql1, conn);
            adp2      = new OleDbDataAdapter(sql2, conn);
            adp3      = new OleDbDataAdapter(sql3, conn);
            adp1.Fill(dsG);
            adp2.Fill(dsH);
            adp3.Fill(dsM);
            관data.DataSource = dsG.Tables[0];
            항data.DataSource = dsH.Tables[0];
            목data.DataSource = null;
            목data.DataSource = dsM.Tables[0];


            this.관data.Sort(this.관data.Columns[2], ListSortDirection.Ascending);

            /*this.관data.Columns[0].Visible = false;
            *  this.관data.Columns[2].Visible = false;*/
            this.항data.Sort(this.항data.Columns[2], ListSortDirection.Ascending);
            this.목data.Sort(this.목data.Columns[4], ListSortDirection.Ascending);
        }
        public Setting_budget_add(int code, int gCode, Setting_budget.cellContent content, string name, string path, Setting_budget sb)   // 관 추가,수정은 gCode가 0
        {
            InitializeComponent();

            strPath           = path;
            this.Text         = name;
            this.sortName     = name;
            this._sb          = sb;
            this.codeCount    = content.cellCount + 1;
            this.currentName  = content.cellName;
            this.currentOrder = content.cellOrder;
            this.inner_order  = code; // 관코드, 항코드
            this.db           = new DBHandling(strPath);
            this.hgCode       = gCode;

            if (sortName == "관 추가" || sortName == "항 추가")
            {
                order.Text = codeCount.ToString();
            }
            if (sortName == "항 수정")
            {
                name_text.Text = this.currentName;
                order.Text     = this.currentOrder.ToString();
                codeCount      = this._sb.sameGNumber();
            }
        }
예제 #4
0
 public void load_data()
 {
     dbhand  = new DBHandling(filepath);
     ds      = new DataSet();
     ds2     = new DataSet();
     connStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + ";";
     conn    = new OleDbConnection(connStr);
     adp     = new OleDbDataAdapter(sql, conn);
     adp.Fill(ds);
     dataGridView1.DataSource = ds.Tables[0];
     dataGridView1.Columns[4].DefaultCellStyle.Format = "c";
     dataGridView1.Columns[6].Visible = false;
     dataGridView1.Columns[7].Visible = false;
     dataGridView1.Columns[8].Visible = false;
     incom_rowcount = ds.Tables[0].Rows.Count;
     adp2           = new OleDbDataAdapter(sql2, conn);
     adp2.Fill(ds2);
     dataGridView2.DataSource = ds2.Tables[0];
     dataGridView2.Columns[2].DefaultCellStyle.Format = "c";
     dataGridView2.Columns[4].Visible = false;
     dataGridView2.Columns[5].Visible = false;
     dataGridView2.Columns[6].Visible = false;
     expen_rowcount    = ds2.Tables[0].Rows.Count;
     today_income.Text = dbhand.today_income_sum(today_date).ToString();          //금일수입금액
     today_expend.Text = dbhand.today_expend_sum(today_date).ToString();          //금일지출금액
     all_income.Text   = dbhand.all_income_sum(today_date).ToString();            //총 수입 금액
     all_expend.Text   = dbhand.all_expend_sum(today_date).ToString();            //총 지출 금액
     today_differ.Text = dbhand.today_difference(today_date).ToString();          //금일차액
     Now_differ.Text   = dbhand.all_difference(today_date).ToString();            //총 차액
     yesterday.Text    = dbhand.yesterday_sum(today_date.AddDays(-1)).ToString(); //이월금액
 }
예제 #5
0
 public void numberofsearch()   //검색건수, 합계금액 표시
 {
     dbhand = new DBHandling(filepath);
     sumi   = 0;
     sume   = 0;
     income_numberofsear.Text = dataGridView1.RowCount.ToString();
     for (int i = 0; i < dataGridView1.RowCount; i++)
     {
         sumi = sumi + Int64.Parse(dataGridView1.Rows[i].Cells["금액"].Value.ToString());
     }
     income_sumofsear.Text    = sumi.ToString();
     expend_numberofsear.Text = dataGridView2.RowCount.ToString();
     for (int i = 0; i < dataGridView2.RowCount; i++)
     {
         sume = sume + Int64.Parse(dataGridView2.Rows[i].Cells["금액"].Value.ToString());
     }
     expend_sumofsear.Text = sume.ToString();
     //------------수입------------
     income_carry.Text  = dbhand.yesterday_sum(income_date1.Value.AddDays(-1)).ToString();                   //이월금액
     income_income.Text = sumi.ToString();;                                                                  //수입금액
     income_expend.Text = sume.ToString();;                                                                  //지출금액
     income_differ.Text = (sumi - sume).ToString();;                                                         //현 차액
     income_now.Text    = (dbhand.yesterday_sum(income_date1.Value.AddDays(-1)) + (sumi - sume)).ToString(); //현 잔액
     //------------지출-------------------
     expend_carry.Text  = dbhand.yesterday_sum(expend_date1.Value.AddDays(-1)).ToString();                   //이월금액
     expend_income.Text = sumi.ToString();;                                                                  //수입금액
     expend_expend.Text = sume.ToString();;                                                                  //지출금액
     expend_differ.Text = (sumi - sume).ToString();;                                                         //현 차액
     expend_now.Text    = (dbhand.yesterday_sum(income_date1.Value.AddDays(-1)) + (sumi - sume)).ToString(); //현 잔액
 }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)   //저장버튼
        {
            DBHandling currentDB = new DBHandling(file);

            currentDB.add_modify(row, dateTimePicker1.Value, name1.Text, name2.Text, Int64.Parse(sum.Text.Replace(",", "")), note.Text);
            temp.load_data();
            this.Close();
        }
예제 #7
0
        public Setting_budget_delete(string name, string path, Setting_budget.cellContent content, Setting_budget sb)
        {
            InitializeComponent();

            strPath      = path;
            sortName     = name;
            this._db     = new DBHandling(strPath);
            this._sb     = sb;
            clickContent = content;

            this.Name        = name;
            this.label1.Text = "정말 " + content.cellName + " 을(를) 삭제하시겠습니까?";
        }
예제 #8
0
        public Setting_budget_add_m(int code, int gCode, int hCode, Setting_budget.cellContent content, String name, String path, Setting_budget sb)
        {
            InitializeComponent();

            this.inner_order  = code;
            this.mgCode       = gCode;
            this.mhCode       = hCode;
            this.codeCount    = content.cellCount + 1; // 추가는 1을 추가해야함
            this.currentOrder = content.cellOrder;
            this.currentName  = content.cellName;
            this.sortName     = name;
            this.strPath      = path;
            this._sb          = sb;
            this._db          = new DBHandling(strPath);

            this.Text  = name;
            order.Text = this.codeCount.ToString();
        }
예제 #9
0
        private void button3_Click(object sender, EventArgs e)   //수입 저장
        {
            DBHandling currentDB = new DBHandling(filepath);

            if (Sum.Text == String.Empty)
            {
                MessageBox.Show("금액을 입력해야합니다.", "오류");
            }
            else
            {
                if (Name1.Text == String.Empty)
                {
                    if (comboBox1.Text != "" && comboBox2.Text != "" && comboBox3.Text != "")
                    {
                        currentDB.add(incom_rowcount, today_date, "무명", Name2.Text, Int64.Parse(Sum.Text.Replace(",", "")), Note.Text, igcode, ihcode, imcode);
                        Name2.Text = "";
                        Sum.Text   = "";
                        Note.Text  = "";
                    }
                    else
                    {
                        MessageBox.Show("관, 항, 목을 선택해야합니다.", "오류");
                    }
                }
                else
                {
                    if (comboBox1.Text != "" && comboBox2.Text != "" && comboBox3.Text != "")
                    {
                        currentDB.add(incom_rowcount, today_date, Name1.Text, Name2.Text, Int64.Parse(Sum.Text.Replace(",", "")), Note.Text, igcode, ihcode, imcode);
                        Name1.Text = "";
                        Name2.Text = "";
                        Sum.Text   = "";
                        Note.Text  = "";
                    }
                    else
                    {
                        MessageBox.Show("관, 항, 목을 선택해야합니다.", "오류");
                    }
                }
                load_data();
            }
        }
예제 #10
0
        public Setting_budget_add(string name, Setting_budget.cellContent content, String path, Setting_budget sb)   // 관 수정 생성자
        {
            InitializeComponent();

            strPath           = path;
            this.Text         = name;
            sortName          = name;
            this._sb          = sb;
            this.inner_order  = content.cellCount;
            this.currentOrder = content.cellOrder;
            this.currentName  = content.cellName;
            this.codeCount    = this.inner_order;
            db = new DBHandling(strPath);

            if (name == "관 수정")
            {
                name_text.Text = this.currentName;
                order.Text     = this.currentOrder.ToString();
            }
        }
예제 #11
0
        private void button10_Click(object sender, EventArgs e)   //지출 저장
        {
            DBHandling currentDB = new DBHandling(filepath);

            if (Sum2.Text == String.Empty)
            {
                MessageBox.Show("금액을 입력해야합니다.", "오류");
            }
            else
            {
                if (comboBox4.Text != "" && comboBox5.Text != "" && comboBox6.Text != "")
                {
                    currentDB.exp(expen_rowcount, today_date, Int64.Parse(Sum2.Text.Replace(",", "")), Note2.Text, egcode, ehcode, emcode);
                    Sum2.Text  = "";
                    Note2.Text = "";
                    load_data();
                }
                else
                {
                    MessageBox.Show("관, 항, 목을 선택해야합니다.", "오류");
                }
            }
        }
예제 #12
0
 private void button8_Click(object sender, EventArgs e)   //지출 삭제 버튼
 {
     if (k_e == null)
     {
         MessageBox.Show("지정된 자료가 없습니다.", "오류");
     }
     else
     {
         if (MessageBox.Show("해당 자료를 삭제 하시겠습니까?", "주의", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             DBHandling currentDB = new DBHandling(filepath);
             currentDB.exp_delete(k_e.RowIndex);
             if (expen_rowcount != 0)   //1씩 코드 내리기
             {
                 for (int i = k_e.RowIndex + 1; i <= expen_rowcount; i++)
                 {
                     currentDB.exp_iterdel(i);
                 }
             }
             load_data();
             k_e = null;
         }
     }
 }
예제 #13
0
 public Setting_Carryover(String path)
 {
     InitializeComponent();
     currentDB          = new DBHandling(path);
     carryOverText.Text = currentDB.carryover().ToString();
 }