private void BtnSum_Click(object sender, EventArgs e) { List <전표리스트> list = new List <전표리스트>(); bool isChecked; for (int i = 0; i < dgv전표리스트.RowCount; i++) { isChecked = Convert.ToBoolean(dgv전표리스트.Rows[i].Cells[0].Value); if (isChecked == true) { // list.Add((전표리스트)dgv전표리스트.Rows[i].DataBoundItem); list.Add(전표리스트s[i]); } } if (전표리스트s == null) { return; } if (list.Count == 0) { list = 전표리스트s; } 계정합계Control = new 계정합계Control(); 계정합계Control.SendList(list); 계정합계Control.Recieve전표출력(this); CodeHelperForm form = new CodeHelperForm(계정합계Control); form.ShowDialog(); }
private void BtnCodeHelper_Click(object sender, EventArgs e) { 관할세무서구분Control = new 관할세무서구분Control(); CodeHelperForm menuForm = new CodeHelperForm(관할세무서구분Control); menuForm.ShowDialog(); txb관할세무서코드.Text = 관할세무서단위.CompetentTaxOfficeCode; txb관할세무서명.Text = 관할세무서단위.CompetentTaxOfficeName; }
private void Txb관할세무서코드_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.F2) { 관할세무서구분Control = new 관할세무서구분Control(); CodeHelperForm menuForm = new CodeHelperForm(관할세무서구분Control); menuForm.ShowDialog(); txb관할세무서코드.Text = 관할세무서단위.CompetentTaxOfficeCode; txb관할세무서명.Text = 관할세무서단위.CompetentTaxOfficeName; } }
private void Txb관련계정코드_KeyDown(object sender, KeyEventArgs e) { // F2 코드도움 팝업 if (e.KeyData == Keys.F2) { 계정코드구분Control control = new 계정코드구분Control(); CodeHelperForm menuForm = new CodeHelperForm(control); menuForm.SetFormLocation(); menuForm.ShowDialog(); txb관련계정코드.Text = 계정과목단위.AccountCode; txb관련계정명.Text = 계정과목단위.AccountName; } }
private void TextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; Button1_Click(null, null); } if (e.KeyData == Keys.F2) { 제품번호구분control = new 제품번호구분Control(); //제품단위.SendCode = textBox1.Text; 제품번호구분control.txbSearch.Text = textBox1.Text; CodeHelperForm menuForm = new CodeHelperForm(제품번호구분control); menuForm.ShowDialog(); textBox1.Text = 제품단위.Code; } }
private void Dgv부서_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.F2) { if (dgv부서.CurrentCell.ColumnIndex == 2 || dgv부서.CurrentCell.ColumnIndex == 3) { e.SuppressKeyPress = true; 사업장구분Control = new 사업장구분Control(); CodeHelperForm form = new CodeHelperForm(사업장구분Control); form.ShowDialog(); dgv부서.CurrentRow.Cells[2].Value = 사업장단위.WorkPlaceCode; dgv부서.CurrentRow.Cells[3].Value = 사업장단위.WorkPlaceName; dgv부서.CurrentCell = dgv부서.CurrentRow.Cells[4]; } if (dgv부서.CurrentCell.ColumnIndex == 4 || dgv부서.CurrentCell.ColumnIndex == 5) { e.SuppressKeyPress = true; 부문구분Control = new 부문구분Control(); CodeHelperForm form = new CodeHelperForm(부문구분Control); form.ShowDialog(); dgv부서.CurrentRow.Cells[4].Value = 부문단위.SectorCode; dgv부서.CurrentRow.Cells[5].Value = 부문단위.SectorName; dgv부서.CurrentCell = dgv부서.CurrentRow.Cells[6]; } } if (e.KeyData == Keys.Enter) { e.SuppressKeyPress = true; if (dgv부서.CurrentCell.ColumnIndex == (dgv부서.Columns.Count - 1)) { // 마지막행의 여섯번째 열까지 입력이 끝나면 다음 행을 추가하고 다음 행의 첫번째 열로 이동 if ((dgv부서.Rows.Count - 1 == dgv부서.CurrentCell.RowIndex) && (dgv부서.Rows[dgv부서.CurrentRow.Index] .Cells[dgv부서.Columns.Count - 2].Value != null)) { //dgv부서.Rows.Add(); dgv부서.CurrentCell = dgv부서[0, dgv부서.CurrentRow.Index + 1]; } // 현재 행의 여섯번째 열에 데이터가 있으면 다음 행의 첫번째 열로 이동 else if (dgv부서.Rows[dgv부서.CurrentRow.Index].Cells[dgv부서.Columns.Count - 2].Value != null) { dgv부서.CurrentCell = dgv부서[0, dgv부서.CurrentRow.Index + 1]; } } // 엔터키 입력시 다음 셀로 이동 else { dgv부서.CurrentCell = dgv부서[dgv부서.CurrentCell.ColumnIndex + 1, dgv부서.CurrentRow.Index]; } } if (e.KeyData == Keys.Delete) { e.SuppressKeyPress = true; if (DialogResult.Yes == MessageBox.Show("선택한 부서를 삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo)) { DB.부서.Delete(FillInDepartment(dgv부서.CurrentCell.RowIndex)); } dgv부서.DataSource = DB.부서.GetAll(); } }
private void Dgv전표리스트_KeyDown(object sender, KeyEventArgs e) { // Enter 입력시 다음 셀로 이동, 마지막 셀에서 데이터가 없으면 개행추가 금지 if (e.KeyData == Keys.Enter) { e.SuppressKeyPress = true; 전표리스트단위.ColumnIndex = dgv전표리스트.CurrentCell.ColumnIndex; 전표리스트단위.RowIndex = dgv전표리스트.CurrentCell.RowIndex; 전표리스트단위.Index = dgv전표리스트.CurrentRow.Index; 전표리스트단위.ColumnCnt = dgv전표리스트.Columns.Count; 전표리스트단위.RowCnt = dgv전표리스트.Rows.Count; // 마지막 열 체크 if (전표리스트단위.ColumnIndex == (전표리스트단위.ColumnCnt - 1)) { // 마지막 행 체크 및 그 행의 마지막 열에 데이터가 있을 경우 행 추가 if ((전표리스트단위.RowCnt - 1 == 전표리스트단위.RowIndex) && (dgv전표리스트.Rows[전표리스트단위.Index].Cells[전표리스트단위.ColumnCnt - 1].Value != null)) { bool check = IsPossibleToAddByStatementList(); if (check == true) { dgv전표리스트.Rows.Add(); } } // 그 행의 마지막 열에 데이터가 있을 경우 행 추가 else if (dgv전표리스트.Rows[전표리스트단위.Index].Cells[전표리스트단위.ColumnCnt - 1].Value != null) { dgv전표리스트.CurrentCell = dgv전표리스트[0, 전표리스트단위.RowIndex + 1]; } } // 마지막 열이 아닐 경우 다음 열로 이동 else { dgv전표리스트.CurrentCell = dgv전표리스트[전표리스트단위.ColumnIndex + 1, 전표리스트단위.RowIndex]; } } // 전표로 돌아감, Insert, Update if (e.KeyData == Keys.Escape) { e.SuppressKeyPress = true; 전표단위.RowCnt = dgv전표.RowCount; 전표리스트단위.RowCnt = dgv전표리스트.RowCount; 전표리스트단위.Index = dgv전표리스트.CurrentRow.Index; List <전표리스트> 전표리스트s = new List <전표리스트>(); List <전표> 전표s = new List <전표>(); string number = null; List <int> resultIndex1 = new List <int>(); List <int> resultIndex2 = new List <int>(); // 불러온 데이터 수가 현재 Dgv전표리스트의 행보다 적으면 기존데이터에 해당 if (전표리스트단위.LoadCnt > 0) { DB.전표리스트.FillIn전표리스트List(input.Date, dgv전표리스트, 전표리스트s, number, 전표리스트단위.LoadCnt); if (dgv전표.Rows[전표단위.Index].Cells[2].Value != null) { number = dgv전표.Rows[전표단위.Index].Cells[2].Value.ToString(); } var listForCheck2 = DB.전표리스트.GetAllMatchedNumber(number); if (listForCheck2.Count == 전표리스트s.Count) { DB.전표리스트.UpdateNonOverlapList(전표리스트s, listForCheck2, 전표리스트단위.LoadCnt, out resultIndex2); } } // 불러온 데이터 수가 현재 Dgv전표의 행보다 적으면 기존데이터에 해당 if (전표단위.LoadCnt > 0) { DB.전표.FillIn전표List(input.Date, dgv전표, 전표s, 전표단위.LoadCnt); var listForCheck = DB.전표.GetAllMatchedDay(input.Date); if (listForCheck.Count == 전표s.Count) { DB.전표.UpdateNonOverlapList(전표s, listForCheck, 전표단위.LoadCnt, out resultIndex1); } } // 불러온 데이터 개수보다 현재 행 개수가 더 많으면 추가할 데이터 if (전표단위.LoadCnt < 전표단위.RowCnt) { if (dgv전표.Rows[전표단위.Index].Cells[2].Value == null) { SetDefaultBy전표(); for (int i = 전표단위.LoadCnt + 1; i < 전표단위.RowCnt; i++) { Insert전표(i); } for (int i = 전표리스트단위.LoadCnt; i < 전표리스트단위.RowCnt; i++) { if (dgv전표리스트.Rows[전표리스트단위.Index].Cells[0].Value != null) { 전표리스트 전표리스트 = new 전표리스트(); 전표리스트.순번 = int.Parse(dgv전표리스트.Rows[i].Cells[0].Value.ToString()); if (dgv전표리스트.Rows[i].Cells[1].Value != null) { 전표리스트.구분 = dgv전표리스트.Rows[i].Cells[1].Value.ToString(); } if (dgv전표리스트.Rows[i].Cells[2].Value != null) { 전표리스트.계정과목코드번호 = dgv전표리스트.Rows[i].Cells[2].Value.ToString(); } if (dgv전표리스트.Rows[i].Cells[4].Value != null) { 전표리스트.거래처코드번호 = dgv전표리스트.Rows[i].Cells[4].Value.ToString(); } if (dgv전표리스트.Rows[i].Cells[7].Value != null) { 전표리스트.금액 = int.Parse(dgv전표리스트.Rows[i].Cells[7].Value.ToString()); } if (dgv전표리스트.Rows[i].Cells[8].Value != null) { 전표리스트.적요명 = dgv전표리스트.Rows[i].Cells[8].Value.ToString(); } 전표리스트.입력날짜 = input.Date; 전표리스트.전표번호 = dgv전표.Rows[전표단위.Index].Cells[2].Value.ToString();; DB.전표리스트.Insert(전표리스트); } } } } // 일치하지 않은 데이터가 있을 경우 메시지 경고박스를 띄움 if (resultIndex1.Count > 0 || resultIndex2.Count > 0) { if (DialogResult.Yes == MessageBox.Show("수정된 내용이 있습니다.\n변경사항을 저장하시겠습니까?", "저장", MessageBoxButtons.YesNo)) { if (resultIndex1.Count > 0) { foreach (int i in resultIndex1) { DB.전표.Update(전표s[i]); } } if (resultIndex2.Count > 0) { foreach (int i in resultIndex2) { DB.전표리스트.Update(전표리스트s[i]); } } } } dgv전표.CurrentCell = dgv전표.Rows[전표단위.Index].Cells[2]; dgv전표.Focus(); if ((dgv전표.Rows.Count - 1 == 전표단위.RowIndex) && (dgv전표.Rows[전표단위.Index].Cells[전표단위.ColumnCnt - 1].Value != null)) { dgv전표.Rows.Add(); } } // F2 코드 도움창 열기 if (e.KeyData == Keys.F2) { if (dgv전표리스트.CurrentCell.ColumnIndex == 2) { e.SuppressKeyPress = true; 계정코드구분Control control = new 계정코드구분Control(); CodeHelperForm menuForm = new CodeHelperForm(control); menuForm.ShowDialog(); dgv전표리스트.Rows[전표리스트단위.Index].Cells[2].Value = 전표리스트단위.AccountCode; dgv전표리스트.Rows[전표리스트단위.Index].Cells[3].Value = 전표리스트단위.AccountName; dgv전표리스트.CurrentCell = dgv전표리스트.Rows[xPoint].Cells[4]; } if (dgv전표리스트.CurrentCell.ColumnIndex == 4) { string comparer = dgv전표리스트.Rows[전표리스트단위.Index].Cells[1].Value.ToString(); if (comparer == "출금" || comparer == "입금") { 금융거래처구분Control control = new 금융거래처구분Control(); CodeHelperForm form = new CodeHelperForm(control); form.ShowDialog(); dgv전표리스트.Rows[전표리스트단위.Index].Cells[4].Value = 전표리스트단위.FinanceCustomerCode; dgv전표리스트.Rows[전표리스트단위.Index].Cells[5].Value = 전표리스트단위.FinanceCustomerName; dgv전표리스트.Rows[전표리스트단위.Index].Cells[6].Value = 전표리스트단위.FinanceCorporateRegistrationNumber; } if (comparer == "차변" || comparer == "대변") { 일반거래처구분Control control = new 일반거래처구분Control(); CodeHelperForm form = new CodeHelperForm(control); form.ShowDialog(); dgv전표리스트.Rows[전표리스트단위.Index].Cells[4].Value = 전표리스트단위.GeneralCustomerCode; dgv전표리스트.Rows[전표리스트단위.Index].Cells[5].Value = 전표리스트단위.GeneralCustomerName; dgv전표리스트.Rows[전표리스트단위.Index].Cells[6].Value = 전표리스트단위.GeneralCorporateRegistrationNumber; } //dgv전표리스트.CurrentCell = dgv전표리스트.Rows[xPoint].Cells["dataGridViewTextBoxColumn8"]; } } // 한 줄 삭제 if (e.KeyData == Keys.Delete) { Fill전표리스트ForDelete(out 전표리스트 전표리스트); if (DialogResult.Yes == MessageBox.Show("현재 행을 삭제하시겠습니까?", "삭제", MessageBoxButtons.YesNo)) { DB.전표리스트.Delete(전표리스트); } } }