> For the complete documentation index, see [llms.txt](https://kythuat.dtechvn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kythuat.dtechvn.com/effect/bao-cao.md).

# BÁO CÁO

## 1. CODE PROC F1 ĐỂ ENTER CHI TIẾT

<pre><code>// Some code
dynamic f = Cls_Common_Functions.GetAOpenForm("FOR0024");
DataView dv = f.dg.DataSource as DataView;

string colName = "";
string cmm = "";
int thang = 0, nam = 0;
// Lấy tên cột đang click 
colName = dv.Table.Columns[f.dg.CurrentCell.ColumnIndex].ColumnName;
<strong>
</strong><strong>// lấy điều kiện ngày ở giao diện xem báo cáo
</strong>string tro = "_thu_tien.ngay_thc>='"+ Cls_VariGlobal.MdiParentForm.p_ngay_thc1 + "' and _thu_tien.ngay_thc&#x3C;='" + Cls_VariGlobal.MdiParentForm.p_ngay_thc2 + "'";

// lấy điều kiện id bophan,khoanmuc trên báo cáo, dòng đang click		
string bophan = f.dg.CurrentRow.Cells["bophan"].Value.ToString().Trim();
string khoanmuc = f.dg.CurrentRow.Cells["khoanmuc"].Value.ToString().Trim();

if(colName.StartsWith("thang_"))		{
	thang = Convert.ToInt32(colName.Split('_')[1].ToString());
	nam = Convert.ToInt32(colName.Split('_')[2].ToString());			cmm = @"
	Select distinct _thu_tien.* 
	from _thu_tien  
	INNER JOIN _tkhoan ON _tkhoan.ma = _thu_tien.ma_tk0 or _tkhoan.ma = _thu_tien.ma_tk1 
	where _thu_tien.dvcs=1 and _thu_tien.loaidl IN(0) 
	and (left(_thu_tien.ma_tk0,3)&#x3C;>'911' and left(_thu_tien.ma_tk1,3)&#x3C;>'911') 
	and ((Select _tkhoan.ma) like N'6%' or (Select _tkhoan.ma) like N'811%') and (_thu_tien.ma_tk0&#x3C;'N') 
	and _thu_tien.bo_phan=" + bophan + @"
	and _thu_tien.khoanmuc=" + khoanmuc + @"
	and (_thu_tien.ngay_thc>= '" + new DateTime(nam,thang, 01).ToString("MM/dd/yyyy")+"'"+ @" and _thu_tien.ngay_thc&#x3C;= '"+ new DateTime(nam,thang, 01).AddMonths(1).AddDays(-1).ToString("MM/dd/yyyy") +@"')
	Order by _thu_tien.ngay_thc
	";		
	}		
	else		
	{	
	cmm = @"
		Select distinct _thu_tien.* 
		from _thu_tien  
		INNER JOIN _tkhoan ON _tkhoan.ma = _thu_tien.ma_tk0 or _tkhoan.ma = _thu_tien.ma_tk1 
		where _thu_tien.dvcs=1 and _thu_tien.loaidl IN(0) 
		and (left(_thu_tien.ma_tk0,3)&#x3C;>'911' and left(_thu_tien.ma_tk1,3)&#x3C;>'911') 
		and ((Select _tkhoan.ma) like N'6%' or (Select _tkhoan.ma) like N'811%') and (_thu_tien.ma_tk0&#x3C;'N') 
		and _thu_tien.bo_phan=" + bophan + @"
		and _thu_tien.khoanmuc=" + khoanmuc + @"
		and " + tro + @"
		Order by _thu_tien.ngay_thc
		";		}
//Cls_Common_Functions.EditCode(cmm);	

// select thành bảng dữ liệu. và view dữ liệu lên
DataTable dt = Cls_Common_Functions.SQLSelect(cmm);
string[] btnlist = { "F12", "F4", "F5", "F3", "Ctrl_F3", "Ctrl_I", "F8", "F7", "F6", "F2", "F1", "F10", "F9", "Freeze", "Ctrl_P" };
this.AddATable("_thu_tien", dt);
Cls_Common_Functions.FormFit(dt, "", "", "f_identity", "Dữ liệu tìm thấy ", true, false, btnlist, false, false);
</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kythuat.dtechvn.com/effect/bao-cao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
