> 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/du-lieu-ke-toan/cap-nhat-dien-giai-ban-hang.md).

# CẬP NHẬT DIỄN GIẢI BÁN HÀNG

## Ý nghĩa

* Người dùng muốn trường diễn giải được cập nhật lại theo format = "Bán hàng cho @khachhang.ten theo hoá đơn @sohd"
* Nghiepvu
  * thông tư 88: 301, 1079
  * thông tư 200, 133:&#x20;

## Hướng dẫn

```sql
-- code cho bản 88
-- update diengiai của dòng chính và dòng phụ
update T1 set T1.diengiai = 
case when t1.psco<>0 then substring(T1.diengiai,1, charindex(']',T1.diengiai)) + N' Bán hàng cho '+ t2.ten + N' theo hoá đơn '+ t1.sohd
else N'Bán hàng cho '+ t2.ten + N' theo hoá đơn '+ t1.sohd end
from
(
select * from dulieuketoan 
where nghiepvu in (301,1079)
)T1 inner join 
(select * from khachhang where khachhang>0)T2
on T1.khachhang = T2.khachhang
```


---

# 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, and the optional `goal` query parameter:

```
GET https://kythuat.dtechvn.com/du-lieu-ke-toan/cap-nhat-dien-giai-ban-hang.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
