Một số form khỏc

Một phần của tài liệu xây dựng phần mềm kế toán bán hàng tại công ty cổ phần thép và vật tư công nghiệp simco (Trang 66 - 96)

- Form bảng phõn loại hàng húa

Việt Nam trong quỏ trỡnh phỏt triển nền kinh tế, đặc biệt là trong hơn 10 năm trở lại đõy ngành cụng nghệ thụng tin đó gúp phần quan trọng trong hoạt động của tất cả cỏc lĩnh vực kinh tế, chớnh trị, văn húa, xó hội…đặc biệt gúp phần đỏng kể vào quỏ trỡnh thỳc đẩy sản xuất và tốc độ truyền nhận thụng tin, cụng tỏc quản lý ngày càng gọn nhẹ và được tự động húa ở nhiều khõu. Tuy nhiờn, đõy vẫn là một ngành mới do vậy sự phổ biến ỏp dụng cũn gặp nhiều khú khăn, đặc biệt là yếu tố kỹ thuật và đội ngũ nhõn viờn cũn thiếu do đú khụng thể trỏnh khỏi những vướng mắc ban đầu khi ỏp dụng rộng rói những thành tựu của ngành cụng nghệ thụng tin vào phỏt triển kinh tế cũng như cỏc lĩnh vực khỏc. Điều đú đũi hỏi cỏc doanh nghiệp cựng cỏc cơ quan chức năng của nhà nước cựng hợp tỏc cố gắng để thỳc đẩy ngành cụng nghệ thong tin phỏt triển nhanh, mạnh hơn nữa, hội nhập được với cỏc nước trong khu vực và trờn thế giới.

Qua thời gian thực tập tại Cụng ty cổ Phần thộp và vật tư cụng nghiệp

SIMCO em nhận thấy rằng: đõy là khoảng thời gian để em tiếp thu một phần kiến thức

thực tập về chuyờn mụn của mỡnh, trong suốt thời gian qua em khụng ngừng học hỏi cỏc anh chị trong toàn cụng ty, mong rằng đú là những bài học thực tế bổ ớch, để em chuẩn bị cho cụng việc về chuyờn ngành tin của mỡnh sau khi ra trường.

Trong gian thực tập em đó nhận được sự quan tõm giỳp đỡ của cỏc anh cỏc chị trong Cụng ty đặc biệt là sự hướng dẫn tận tỡnh của thầy Phựng Tiến Hải để em cú thể hoàn thiện đề tài “Xõy dựng phần meemg kế toỏn bỏn hàng tại Cụng ty cổ phần thộp

và vật tư cụng nghiệp SIMCO” này.

Song do thời gian cú hạn và sự hạn chế về tư liệu cựng với sự hạn chế về kiến thức của bản thõn nờn phiờn bản đề mụ “Kế Toỏn Bỏn Hàng tại cụng ty Cổ Phần

thộp và vật tư cụng nghiệp SIMCO ” chưa thể đỏp ứng được đầy đủ những mong

muốn của nhà quản lý. Mặt khỏc đõy là lần đầu tiờn em tiếp cận với thực tế nờn em khụng thể khụng trỏnh khỏi những sai sút, nờn em rất mong sự quan tõm hơn nữa của thầy cụ trong trường, giỳp đỡ em để em cú thể hoàn thành chương trỡnh của mỡnh một

cỏch hiệu quả nhất. Em hi vọng nú sẽ được sử dụng và ứng dụng vào quỏ trỡnh làm việc của thực tế.

Một lần nữa em xin chõn thành cảm ơn sự giỳp đỡ của thầy Phựng Tiến Hải, cỏc thầy cụ giỏo trong khoa, cựng cỏc anh cỏc chị trong toàn Cụng ty cổ phần thộp và

vật tư cụng nghiệp SIMCO. Trong quỏ trỡnh “Xõy dựng đề tài kế toỏn bỏn hàng

em đó cố gắng thực hiện đầy đủ cỏc mục tiờu chớnh của đề tài nhằm đỏp ứng được yờu cầu của thực tế. Song chương trỡnh cũn nhiều khuyết điểm cần khắc phục và nõng cấp để đề tài này cú thể được ỏp dụng vào thực tế.

Em xin chõn thành cảm ơn!

Sinh viờn thực hiện Mai

Vũ Thị Mai

1. Giỏo trỡnh cơ sở dữ liệu _Thầy Trương Ngọc Chõu_ Đại học Bỏch khoa 2. Giỏo trỡnh VB6_ Đại học FPT

3. Nhập mụn cơ sở dữ liệu quan hệ - Lờ Tiến Vương, Nhà xuất bản khoa học kỹ thuật Benjamin S.Blanchard Wolter J.Fabrycky, System Engineering and Analysis, Pren Hall, Australia, 1990.

Cộng hũa xó hội chủ nghĩa Việt Nam Độc lập- Tự do- hạnh phỳc

***

XÁC NHẬN CỦA GIÁO VIấN HƯỚNG DẪN

Kớnh gửi: Khoa Tin Học Kinh Tế, Trường Đại học Kinh tế Quốc dõn

Họ tờn GVHD:……… Đơn vị cụng tỏc: ……….

Xỏc nhận:

Sinh viờn:………

Lớp:………. Đó thực tập tốt nghiệp trong thời gian từ:………đến………... Về tinh thần, ý thức, thỏi độ:……… ……… ….……… Về trỡnh độ, năng lực học tập và nghiờn cứu:……… ……… ………

Hà Nội, ngày … thỏng … năm 2014 Giỏo viờn hướng dẫn

PHỤ LỤC

Code một số form chớnh

- Form danh mục khỏch hàng (adsbygoogle = window.adsbygoogle || []).push({});

Dim dem As Integer Dim book As String Private Sub cmdin_Click()

Connection.OpenData ("Select TenKH,MaKH,DiaChi,TaiKhoan,SoDT,Fax from Khachhang ") rptdmkh.ReportFileName = App.Path & "\reports\DMkhachhang.rpt"

rptdmkh.WindowState = crptMaximized rptdmkh.SetTablePrivateData 0, 3, Myrs rptdmkh.PrintReport

Connection.CloseData End Sub

Private Sub cmdluu_Click() cmdthoat.Enabled = True Command1.Enabled = True Dim i As Integer Form_Load cmdthem.Caption = "&Them" cmdsua.Enabled = True cmdxoa.Enabled = True cmdluu.Enabled = False For i = 0 To 5 Picture1(i).Enabled = False Next For i = 0 To 3 txt(i).Enabled = True Next cmdtim.Enabled = True End Sub

Private Sub cmdsua_Click() dem = 1

Dim i As Integer cmdxoa.Enabled = False cmdsua.Enabled = False cmdluu.Enabled = True For i = 0 To 5 Picture1(i).Enabled = True Next For i = 0 To 3 txt(i).Enabled = False Next cmdtim.Enabled = False txtmakh.SetFocus cmdthem.Caption = "&Luu" End Sub

Private Sub cmdthem_Click() dem = 0

Dim i As Integer

If cmdthem.Caption = "&Them" Then For i = 0 To 5 Picture1(i).Enabled = True Next For i = 0 To 3 txt(i).Enabled = False Next cmdtim.Enabled = False Command1.Enabled = False cmdthoat.Enabled = False cmdsua.Enabled = False cmdxoa.Enabled = False cmdluu.Enabled = True txtmakh.SetFocus Adodc1.Recordset.AddNew cmdthem.Caption = "&Luu" Else If txtmakh.Text = "" Then

MsgBox "Chua nhap ma khach hang", vbOKOnly + vbExclamation, "Thong bao" txtmakh.SetFocus

Adodc1.Recordset.Update cmdsua.Enabled = True cmdxoa.Enabled = True cmdluu.Enabled = False cmdthem.Caption = "&Them" For i = 0 To 5 Picture1(i).Enabled = False Next For i = 0 To 3 txt(i).Enabled = True Next cmdtim.Enabled = True Command1.Enabled = True cmdthoat.Enabled = True End If End If End Sub

Private Sub cmdthoat_Click() Unload Me

End Sub

Private Sub cmdtim_Click() Form_Load txt(0) = "" txt(1) = "" txt(2) = "" txt(3) = "" End Sub

Private Sub cmdxoa_Click()

If MsgBox("Ban muon xoa khach hang nay khong?", vbYesNo + vbCritical, "Xac nhan") = vbYes Then Adodc1.Recordset.Delete

Adodc1.Recordset.MovePrevious End If

End Sub

Private Sub Command1_Click() Unload Me

Load MDIForm1 End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\KTBH.mdb;Persist Security Info=False"

Adodc1.RecordSource = "KhachHang" Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1 DataGrid1.Columns(0).Caption = "Mã KH" DataGrid1.Columns(0).Width = 1000 DataGrid1.Columns(1).Caption = "Tên khách hàng" DataGrid1.Columns(1).Width = 3300 DataGrid1.Columns(2).Caption = "địa chỉ" DataGrid1.Columns(2).Width = 3300 DataGrid1.Columns(3).Caption = "Số ĐT" DataGrid1.Columns(3).Width = 1000 DataGrid1.Columns(4).Caption = "Số TK" DataGrid1.Columns(4).Width = 1000 DataGrid1.Columns(5).Caption = "Fax" DataGrid1.Columns(5).Width = 1000 Set txtmakh.DataSource = Adodc1 txtmakh.DataField = "MaKH" Set txttenkh.DataSource = Adodc1 txttenkh.DataField = "TenKH" Set txtdiachi.DataSource = Adodc1 txtdiachi.DataField = "DiaChi" Set txtsodt.DataSource = Adodc1 txtsodt.DataField = "SoDT" Set txttk.DataSource = Adodc1 txttk.DataField = "TaiKhoan" Set txtfax.DataSource = Adodc1 txtfax.DataField = "Fax" End Sub

Private Sub Form_Paint() vekhung frmdmkh, 1, 20

End Sub

Private Sub txt_Change(Index As Integer) Dim st As String

If Trim(txt(0).Text) = "" And Trim(txt(1).Text = "") And Trim(txt(2).Text = "") And Trim(txt(3).Text = "") Then Adodc1.Refresh

Set DataGrid1.DataSource = Adodc1 DataGrid1.Columns(0).Caption = "Ma KH" DataGrid1.Columns(0).Width = 1000 DataGrid1.Columns(1).Caption = "Ten KH" DataGrid1.Columns(1).Width = 3300 DataGrid1.Columns(2).Caption = "Dia Chi" DataGrid1.Columns(2).Width = 3300 DataGrid1.Columns(3).Caption = "So DT" DataGrid1.Columns(3).Width = 1000 DataGrid1.Columns(4).Caption = "So TK" DataGrid1.Columns(4).Width = 1000 DataGrid1.Columns(5).Caption = "Fax" DataGrid1.Columns(5).Width = 1000 Else st = "" If Trim(Right(txt(0).Text, 1)) <> "" Then (adsbygoogle = window.adsbygoogle || []).push({});

st = st + "MaKH like '" + Trim(txt(0).Text) + "*'" End If

If Trim(txt(1).Text) <> "" Then If st <> "" Then

st = st + " and " + "TenKH like '" + Trim(txt(1).Text) + "*'" Else

st = "TenKH like '" + Trim(txt(1).Text) + "*'" End If

End If

If Trim(txt(2).Text) <> "" Then If st <> "" Then

st = st + " and " + "DiaChi like '" + Trim(txt(2).Text) + "*'" Else

st = "DiaChi like '" + Trim(txt(2).Text) + "*'" End If

If Trim(txt(3).Text) <> "" Then If st <> "" Then

st = st + " and " + "SoDT like '" + Trim(txt(3).Text) + "*'" Else

st = "SoDT like '" + Trim(txt(3).Text) + "*'" End If End If Adodc1.Recordset.Filter = st DataGrid1.Refresh End If End Sub

Private Sub txtmakh_GotFocus() txtmakh.BackColor = vbWhite End Sub

Private Sub txtmakh_LostFocus() txtmakh.Text = UCase(txtmakh.Text) If txtmakh.Text = "" Then

txtmakh.BackColor = vbYellow End If

Connection.OpenData ("Select * From KhachHang") Do Until Myrs.EOF

If Trim(txtmakh.Text) = Myrs!MaKH And dem <> 1 Then MsgBox " Trung ma ", vbOKOnly + vbExclamation, "Thong bao" txtmakh.SetFocus End If Myrs.MoveNext Loop Connection.CloseData If dem = 1 Then

If txtmakh.Text <> book Then

Connection.OpenData ("Select * From KhachHang") Do Until Myrs.EOF

If Trim(txtmakh.Text) = Myrs!MaKH Then

MsgBox "Trung ma ", vbOKOnly + vbExclamation, "Thong bao" txtmakh.SetFocus

End If Myrs.MoveNext Loop Connection.CloseData End If End If End Sub

Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

SendKeys "{TAB}" KeyAscii = 0 End If End Sub

Private Sub txtsodt_KeyPress(KeyAscii As Integer) If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = vbKeyBack

End If End Sub

Private Sub txttk_KeyPress(KeyAscii As Integer) If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = vbKeyBack

End If End Sub

Private Sub txtfax_KeyPress(KeyAscii As Integer) If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = vbKeyBack

End If End Sub

- Form phiếu nhập (adsbygoogle = window.adsbygoogle || []).push({});

Dim chay As Integer, dem As Integer, tong As Integer, dem1 As Integer Dim chay1 As Integer, tong1 As Integer

Dim book As String Dim sua1 As String

Private Sub cbomancc_Change() laymancc1

Private Sub cbomancc_Click() laymancc1

End Sub

Private Sub cbomancc_KeyPress(KeyAscii As Integer) KeyAscii = 0

End Sub

Private Sub cbomanv_Change() laymanv1

End Sub

Private Sub cbomanv_Click() laymanv1

End Sub

Private Sub cbomanv_KeyPress(KeyAscii As Integer) KeyAscii = 0

End Sub

Private Sub cbomanvl_Change() laythongtinbangNVL

End Sub

Private Sub cbomanvl_Click() laythongtinbangNVL End Sub

Private Sub cbomanvl_KeyPress(KeyAscii As Integer) KeyAscii = 0

End Sub

Private Sub cmd1cuoi_Click() Adodc1.Recordset.MoveLast layhoadon layadodc2 veluoi laychitiethoadon laysohh chay = tong End Sub

Private Sub cmd1dau_Click() laysohh

Adodc1.Recordset.MoveFirst layhoadon

veluoi

chay = 1 End Sub

Private Sub cmd1sau_Click() If chay < tong Then

Adodc1.Recordset.MoveNext layhoadon layadodc2 veluoi laychitiethoadon chay = chay + 1 laysohh Else

MsgBox "Day la phieu cuoi cung", vbOKOnly + vbExclamation, "Thong bao" End If

End Sub

Private Sub cmd1thoat_Click() Unload Me

End Sub

Private Sub cmd1truoc_Click() If chay > 1 Then Adodc1.Recordset.MovePrevious layhoadon layadodc2 veluoi laychitiethoadon chay = chay - 1 laysohh End If End Sub (adsbygoogle = window.adsbygoogle || []).push({});

Private Sub cmdhuy_Click() Adodc1.Refresh Adodc2.Refresh Form_Load cmd1thoat.Enabled = True cmdsua.Enabled = True cmdxoa.Enabled = True cmdthem.Enabled = True cmdhuy.Enabled = False cmdluu.Enabled = False

Connection.OpenData ("TrungGian1") sqlluu = "delete from TrungGian1" Connection.cn.Execute sqlluu Connection.CloseData Adodc3.Refresh End Sub

Private Sub cmdhuy1_Click() cmdthem1.Enabled = True cmdxoa1.Enabled = True cmdsua1.Enabled = True cmdluu1.Enabled = False cmdhuy1.Enabled = False Adodc3.Refresh xoachitiet veluoi End Sub

Private Sub cmdin_Click()

Connection.OpenData ("SELECT NVL.TenNVL, ChiTietHDNNVL.MaNVL,NVL.DonVi, ChiTietHDNNVL.SoLuong, ChiTietHDNNVL.DonGia,SoLuong*DonGia FROM NVL INNER JOIN (HoaDonNhapNVL INNER JOIN ChiTietHDNNVL ON HoaDonNhapNVL.SoHHD = ChiTietHDNNVL.SoHHD) ON NVL.MaNVL = ChiTietHDNNVL.MaNVL WHERE HoaDonNhapNVL.SoHHD='" & txtsohd.Text & "'")

rptnhapnvl.ReportFileName = App.Path & "\reports\PhieuNhapNVL.rpt" rptnhapnvl.WindowState = crptMaximized

rptnhapnvl.SetTablePrivateData 0, 3, Myrs

rptnhapnvl.Formulas(0) = "SoPhieu='" & txtsohd.Text & "'" rptnhapnvl.Formulas(1) = "Ngay='" & txtngay.Text & "'" rptnhapnvl.PrintReport

Connection.CloseData End Sub

Private Sub cmdluu_Click() Dim sqlluu As String

If Adodc3.Recordset.PageCount <> 0 Then If dem1 = 1 Then

Connection.OpenData ("HoaDonNhapNVL")

sqlluu = "delete from HoaDonNhapNVl where SoHHD='" & book & "'" Connection.cn.Execute sqlluu

End If

Connection.OpenData ("HoaDonNhapNVL")

sqlluu = "insert into HoaDonNhapNVL values ( '" & txtsohd.Text & "','" & cbomancc.Text & "','" & cbomanv.Text & "','" & txtngay.Text & "','" & txtghichu.Text & "','" & txtthue.Text & "')"

Connection.cn.Execute sqlluu Connection.CloseData Connection.OpenData ("TrungGian1") Do Until Myrs.EOF s1 = Myrs!MaNVL s2 = Myrs!SoLuong s3 = Myrs!DonGia s4 = Myrs!ChietKhau s5 = Myrs!KhuyenMai Module1.OpenData ("NVL") Do Until rs.EOF If rs!MaNVL = s1 Then

rs!luongton = rs!luongton + Val(s2) End If

rs.MoveNext Loop

Module1.CloseData

sqlluu = "insert into ChiTietHDNNVL values ( '" & txtsohd.Text & "','" & s1 & "','" & s2 & "','" & s3 & "','" & s4 & "','" & s5 & "')" Connection.cn.Execute sqlluu Myrs.MoveNext Loop Connection.CloseData Connection.OpenData ("TrungGian1") sqlluu = "delete from TrungGian1" Connection.cn.Execute sqlluu Connection.CloseData Adodc1.Refresh Adodc2.Refresh Form_Load cmdthem.Enabled = True cmdsua.Enabled = True cmdxoa.Enabled = True cmd1thoat.Enabled = True cmdhuy.Enabled = False

cmdluu.Enabled = False Else

MsgBox "Ban phai nhap nguyen vat lieu truoc khi luu", vbOKOnly + vbInformation, "Thong bao" End If

End Sub

Private Sub cmdsua_Click() dem1 = 1 book = txtsohd.Text laymanvl cmdluu1.Enabled = False cmdsua1.Enabled = True cmdxoa1.Enabled = True cmdhuy1.Enabled = False cmdxoa.Enabled = False cmdluu.Enabled = True cmd1thoat.Enabled = False cmdsua.Enabled = False cmdthem.Enabled = False cmdhuy.Enabled = True Frame1.Enabled = True Frame2.Enabled = True Frame3.Enabled = True Frame4.Enabled = False txtsohd.SetFocus

Dim s1 As String, s2 As String, s3 As String, s4 As String, s5 As String Dim sqls As String

Connection.OpenData ("Select MaNVL,SoLuong,DonGia,ChietKhau,KhuyenMai from ChiTietHDNNVL where SoHHD='" & txtsohd.Text & "' ")

Do Until Myrs.EOF s1 = Myrs!MaNVL s2 = Myrs!SoLuong s3 = Myrs!DonGia s4 = Myrs!ChietKhau s5 = Myrs!KhuyenMai

sqls = "insert into TrungGian1 values('" & txtsohd.Text & "','" & cbomancc.Text & "','" & cbomanv.Text & "','" & txtngay.Text & "','" & txtghichu.Text & "','" & txtthue.Text & "','" & s1 & "','" & s2 & "','" & s3 & "','" & s4 & "','" & s5 & "')"

Myrs.MoveNext Loop (adsbygoogle = window.adsbygoogle || []).push({});

Connection.CloseData Adodc3.Refresh

Set DataGrid1.DataSource = Adodc3 DataGrid1.Refresh

veluoi End Sub

Private Sub cmdsua1_Click() dem = 10 cmdthem1.Enabled = False cmdxoa1.Enabled = False cmdluu1.Enabled = True cmdhuy1.Enabled = True If Adodc3.Recordset.PageCount <> 0 Then sua1 = Adodc3.Recordset.Fields("MaNVL") cbomanvl.Text = Adodc3.Recordset.Fields("MaNVL") txtsl.Text = Adodc3.Recordset.Fields("SoLuong") txtdongia.Text = Adodc3.Recordset.Fields("DonGia") txtck.Text = Adodc3.Recordset.Fields("ChietKhau") txtkm.Text = Adodc3.Recordset.Fields("KhuyenMai") veluoi Else

MsgBox " Khong co ma NVL nao ", vbOKOnly + vbInformation, "thong bao" End If

End Sub

Private Sub cmdthem_Click() Frame1.Enabled = True Frame3.Enabled = True Frame4.Enabled = False cmdsua1.Enabled = False cmdxoa1.Enabled = False cmdhuy1.Enabled = False cmdluu1.Enabled = False cmdsua.Enabled = False cmdxoa.Enabled = False cmdluu.Enabled = True

cmdthem.Enabled = False cmd1thoat.Enabled = False cmdhuy.Enabled = True xoahoadon xoachitiet laymanvl txtsohd.SetFocus

Set DataGrid1.DataSource = Adodc3 DataGrid1.Refresh

veluoi End Sub

Private Sub xoahoadon() txtsohd.Text = "" cbomancc.Text = "" cbomanv.Text = "" txtthue.Text = "0" txtngay.Text = Date lblmancc.Caption = "" lblmanv.Caption = "" txtghichu.Text = "" End Sub

Private Sub xoachitiet() cbomanvl.Text = "" lbltennvl.Text = "" txtsl.Text = "" txtdongia.Text = "" txtck.Text = "0" txtkm.Text = "0" lbldonvi.Caption = "" lblluongton.Caption = "" End Sub

Private Sub cmdthem1_Click()

If txtsohd.Text = "" Or cbomancc.Text = "" Or cbomanv.Text = "" Then MsgBox "Ban can nhap du thong tin", vbOKOnly + vbInformation, "Thong bao" txtsohd.SetFocus

Else

Frame2.Enabled = True cmdxoa1.Enabled = False cmdsua1.Enabled = False

cmdhuy1.Enabled = True cmdluu1.Enabled = True cmdthem1.Enabled = False xoachitiet cbomanvl.SetFocus End If End Sub

Private Sub cmdxoa_Click()

If MsgBox("Phieu nay se bi xoa???", vbOKCancel + vbCritical, "Xac nhan") = vbOK Then Adodc1.Recordset.Delete Adodc1.Recordset.MovePrevious Adodc1.Refresh Adodc2.Refresh Form_Load End If End Sub

Private Sub cmdxoa1_Click()

If Adodc3.Recordset.PageCount <> 0 Then

cbomanvl.AddItem (Adodc3.Recordset.Fields("MaNVL")) ss = Adodc3.Recordset.Fields("MaNVL")

Connection.OpenData ("TrungGian1")

sql2 = "delete from TrungGian1 where SoHHD='" & txtsohd & "' and MaNVL='" & ss & "'" Connection.cn.Execute sql2

Connection.CloseData Adodc3.Refresh veluoi

Else

MsgBox " Khong co HH nao bi xoa ! ", vbOKOnly + vbExclamation, "Thong bao" End If

End Sub

Private Sub cmdluu1_Click() Dim sqltg1 As String

If cbomanvl.Text = "" Or txtsl.Text = "" Or txtdongia.Text = "" Then (adsbygoogle = window.adsbygoogle || []).push({});

MsgBox "Ban chua nhap du thong tin", vbOKOnly + vbInformation, "Thong bao" cbomanvl.SetFocus

Else

Module1.OpenData ("NVL") Do Until rs.EOF

If cbomanvl.Text = rs!MaNVL Then 'If rs!LuongTon > Val(txtsl.Text) Then If dem <> 10 Then

Connection.OpenData ("TrungGian1")

sqltg1 = "Insert into TrungGian1 values ( '" & txtsohd.Text & "','" & cbomancc.Text & "','" & cbomanv.Text & "','" & txtngay.Text & "','" & txtghichu.Text & "','" & txtthue.Text & "','" & cbomanvl.Text & "','" & txtsl.Text & "','" & txtdongia.Text & "','" & txtck.Text & "','" & txtkm.Text & "') "

'sqltg1 = "Update TrungGian1 set SoHHD= '" & txtsohd.Text & "',MaNCC='" & cbomancc.Text & "',MaCB='" & cbomanv.Text & "',Ngay='" & txtngay.Text & "',GhiChu='" & txtghichu.Text & "',MaNVL='" & cbomanvl.Text & "',SoLuong='" & txtsl.Text & "',DonGia='" & txtdongia.Text & "',ChietKhau='" & txtck.Text & "',KhuyenMai='" & txtkm.Text & "' where SoHHD='" & txtsohd & "'"

Connection.cn.Execute sqltg1

'rs!luongton = rs!luongton + Val(txtsl.Text) Connection.CloseData

Else

If dem1 <> 1 Then

Connection.OpenData ("TrungGian1")

'sqltg1 = "Insert into TrungGian1 values ( '" & txtsohd.Text & "','" & cbomancc.Text & "','" & cbomanv.Text & "','" & txtngay.Text & "','" & txtghichu.Text & "','" & txtthue.Text & "','" & cbomanvl.Text & "','" & txtsl.Text & "','" & txtdongia.Text & "','" & txtck.Text & "','" & txtkm.Text & "') "

sqltg1 = "Update TrungGian1 set SoHHD= '" & txtsohd.Text & "',MaNCC='" & cbomancc.Text & "',MaCB='" & cbomanv.Text & "',Ngay='" & txtngay.Text & "',GhiChu='" & txtghichu.Text & "',MaNVL='" & cbomanvl.Text & "',SoLuong='" & txtsl.Text & "',DonGia='" & txtdongia.Text & "',ChietKhau='" & txtck.Text & "',KhuyenMai='" & txtkm.Text & "' where SoHHD='" & txtsohd & "' and MaNVL='" & sua1 & "'"

Connection.cn.Execute sqltg1

'rs!luongton = rs!luongton + Val(txtsl.Text) Connection.CloseData

Else

Connection.OpenData ("TrungGian1")

'sqltg1 = "Insert into TrungGian1 values ( '" & txtsohd.Text & "','" & cbomancc.Text & "','" & cbomanv.Text & "','" & txtngay.Text & "','" & txtghichu.Text & "','" & txtthue.Text & "','" & cbomanvl.Text & "','" & txtsl.Text & "','" & txtdongia.Text & "','" & txtck.Text & "','" & txtkm.Text & "') "

sqltg1 = "Update TrungGian1 set SoHHD= '" & txtsohd.Text & "',MaNCC='" & cbomancc.Text & "',MaCB='" & cbomanv.Text & "',Ngay='" & txtngay.Text & "',GhiChu='" & txtghichu.Text & "',MaNVL='" & cbomanvl.Text & "',SoLuong='" & txtsl.Text & "',DonGia='" & txtdongia.Text & "',ChietKhau='" & txtck.Text & "',KhuyenMai='" & txtkm.Text & "' where SoHHD='" & book & "' and MaNVL='" & sua1 & "'"

Connection.cn.Execute sqltg1 Connection.CloseData

End If End If Adodc3.Refresh cmdthem1.Enabled = True cmdluu1.Enabled = False cmdsua1.Enabled = True cmdxoa1.Enabled = True cmdhuy1.Enabled = False xoachitiet veluoi 'Else

'MsgBox "Lượng tồn trong kho khụng đủ để bỏn ", vbOKOnly + vbExclamation, "Thông báo" 'txtsl.SetFocus 'End If End If rs.MoveNext Loop Connection.CloseData End If End Sub

Private Sub Command1_Click() Adodc2.Recordset.MoveLast laychitiethoadon

chay1 = tong1 End Sub

Private Sub Command2_Click() Adodc2.Recordset.MoveFirst laychitiethoadon

chay1 = 0 End Sub

Private Sub Command3_Click() If chay1 > 0 Then Adodc2.Recordset.MovePrevious laychitiethoadon chay1 = chay1 - 1 End If End Sub

Private Sub Command4_Click() If chay1 < tong1 - 1 Then Adodc2.Recordset.MoveNext

(adsbygoogle = window.adsbygoogle || []).push({});

Một phần của tài liệu xây dựng phần mềm kế toán bán hàng tại công ty cổ phần thép và vật tư công nghiệp simco (Trang 66 - 96)