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(); //현 잔액 }
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(); //이월금액 }