> 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/danh-muc/update-chitiettheo.md).

# UPDATE CHITIETTHEO

* update nhanh tài khoản cần quản lý chi tiết theo.
* Ví dụ: Tài khoản 641 cần quản lý theo khoản mục

```sql
// Some code
update taikhoan 
set chitiettheo=chitiettheo+ (case when chitiettheo<>'' then ',KhoanMuc#1' else 'KhoanMuc#1' end)
, chitiettheotext = chitiettheotext + (case when chitiettheotext<>'' then N', Khoản mục<Bắt buộc>' else  N'Khoản mục<Bắt buộc>' end)
, modidate=getdate()
where ma like '64%'
```

```sql
// khách hàng
update taikhoan 
set chitiettheo=chitiettheo+ (case when chitiettheo<>'' then ',KhachHang#1' else 'KhachHang#1' end)
, chitiettheotext = chitiettheotext 
+ (case when chitiettheotext<>'' then N', Đối tượng công nợ<Bắt buộc>' else  N'Đối tượng công nợ<Bắt buộc>' end)
, modidate=getdate()
where ma like '131%' and CHARINDEX(N'khachhang',chitiettheo)=0
```

```sql
// ngân hàng
update taikhoan 
set chitiettheo=chitiettheo+ (case when chitiettheo<>'' then ',BankAccount#1' else 'BankAccount#1' end)
, chitiettheotext = chitiettheotext 
+ (case when chitiettheotext<>'' then N', Ngân hàng<Bắt buộc>' else  N'Ngân hàng<Bắt buộc>' end)
, modidate=getdate()
where ma like '112%' and CHARINDEX(N'BankAccount',chitiettheo)=0
```

```sql
// Kho
update taikhoan 
set chitiettheo=chitiettheo+ (case when chitiettheo<>'' then ',Kho#1,SanPham#1' else 'Kho#1,SanPham#1' end)
, chitiettheotext = chitiettheotext 
+ (case when chitiettheotext<>'' then N', Kho<Bắt buộc>, Sản phẩm<Bắt buộc>' else  N'Kho<Bắt buộc>, Sản phẩm<Bắt buộc>' end)
, modidate=getdate()
where ma like '15%' and ma not like '154%' and CHARINDEX(N'sanpham',chitiettheo)=0
```

```sql
// Tài sản
update taikhoan 
set chitiettheo=chitiettheo+ (case when chitiettheo<>'' then ',TaiSan#1' else 'TaiSan#1' end)
, chitiettheotext = chitiettheotext 
+ (case when chitiettheotext<>'' then N', Tài sản<Bắt buộc>' else  N'Tài sản<Bắt buộc>' end)
, modidate=getdate()
where ma like '21%' and CHARINDEX(N'taisan',chitiettheo)=0
```

```sql
// phân bổ
update taikhoan 
set chitiettheo=chitiettheo+ (case when chitiettheo<>'' then ',PhanBo#1' else 'PhanBo#1' end)
, chitiettheotext = chitiettheotext 
+ (case when chitiettheotext<>'' then N', Chi phí chờ phân bổ<Bắt buộc>' else  N'Chi phí chờ phân bổ<Bắt buộc>' end)
, modidate=getdate()
where ma like '242%' and CHARINDEX(N'phanbo',chitiettheo)=0
```
