> 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
```
