/// <summary> /// 전표와 연결된 모든 전표리스트를 담음 /// </summary> /// <param name="전표">담을 전표</param> /// <param name="list">담을 전표리스트</param> private void Fill_InAll_LinkedTo전표(out 전표 전표, out List <전표리스트> list) { 전표 = new 전표(); 전표.입력날짜 = input.Date; 전표.전표번호 = dgv전표.CurrentRow.Cells[2].Value.ToString(); 전표.품의내역 = dgv전표.CurrentRow.Cells[3].Value.ToString(); 전표.형 = dgv전표.CurrentRow.Cells[4].Value.ToString(); 전표.기표번호 = dgv전표.CurrentRow.Cells[5].Value.ToString(); 전표.승인상태 = dgv전표.CurrentRow.Cells[6].Value.ToString(); 전표.승인자 = dgv전표.CurrentRow.Cells[7].Value.ToString(); if (dgv전표.CurrentRow.Cells[8].Value != null) { 전표.대차차액 = int.Parse(dgv전표.CurrentRow.Cells[8].Value.ToString()); } 전표.작업자 = dgv전표.CurrentRow.Cells[9].Value.ToString(); list = DB.전표리스트.SearchList(전표.입력날짜, 전표.전표번호); }
private void Dgv전표리스트_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { e.SuppressKeyPress = true; int column = dgv전표리스트.CurrentCell.ColumnIndex; int row = dgv전표리스트.CurrentCell.RowIndex; 전표리스트Index = row; if (column == (dgv전표리스트.Columns.Count - 1)) { if ((dgv전표리스트.Rows.Count - 1 == row) && (dgv전표리스트.Rows[전표리스트Index].Cells[dgv전표리스트.Columns.Count - 1].Value != null)) { dgv전표리스트.Rows.Add(); dgv전표리스트.CurrentCell = dgv전표리스트[0, row + 1]; } } else { dgv전표리스트.CurrentCell = dgv전표리스트[column + 1, row]; } } if (e.KeyData == Keys.Escape) { 전표리스트 전표리스트 = new 전표리스트(); 전표리스트.전표리스트ID = int.Parse(dgv전표리스트.CurrentRow.Cells[0].Value.ToString()); 전표리스트.구분 = dgv전표리스트.CurrentRow.Cells[1].Value.ToString(); 전표리스트.계정과목코드번호 = int.Parse(dgv전표리스트.CurrentRow.Cells[2].Value.ToString()); if (dgv전표리스트.CurrentRow.Cells[4].Value != null) { 전표리스트.거래처코드번호 = dgv전표리스트.CurrentRow.Cells[4].Value.ToString(); } 전표리스트.금액 = int.Parse(dgv전표리스트.CurrentRow.Cells[7].Value.ToString()); 전표리스트.적요명 = dgv전표리스트.CurrentRow.Cells[8].Value.ToString(); dgv전표.Focus(); dgv전표.CurrentCell = dgv전표.Rows[전표Index].Cells[2]; int year = int.Parse(lbl회계년도.Text); int month = int.Parse(cbb월.Text); int day = int.Parse(txb일.Text); DateTime dateTime = new DateTime(year, month, day); 전표 전표 = new 전표(); 전표.입력날짜 = dateTime; 전표.전표번호 = int.Parse(dgv전표.CurrentRow.Cells[1].Value.ToString()); 전표.품의내역 = dgv전표.CurrentRow.Cells[1].Value.ToString(); dgv전표.CurrentRow.Cells[5].Value = $"{dateTime}" + "-" + $"000{dgv전표.CurrentRow.Index}"; dgv전표.CurrentRow.Cells[6].Value = "승인"; 전표.형 = dgv전표.CurrentRow.Cells[4].Value.ToString(); 전표.기표번호 = dgv전표.CurrentRow.Cells[5].Value.ToString(); 전표.승인상태 = dgv전표.CurrentRow.Cells[6].Value.ToString(); 전표.승인자 = loginMember.Name; 전표.작업자 = loginMember.Name; // DB.전표.Insert(전표); // DB.전표리스트.Insert(전표리스트); } }