Beruflich Dokumente
Kultur Dokumente
Next Hello tyrodeveloper's, here is my first english publication, i hope that you like. Requirements: Microsoft Visual Studio 2010 Microsoft Access 2007/2010
Data Base Design We need to create a database like is showed in the picture:
We have three folders. Add two forms to the Forms folder and a module in the Modules folder like is showed in the picture. Login Form (frmLogin) Add this Imports directives:
Imports System.Data Imports System.Data.OleDb
Protected _idSale As Integer = 0 Public ReadOnly Property IdSale As Integer Get Return _idSale End Get End Property Public Property TotalSale As Double Get Return varTotal End Get Set(ByVal value As Double) varTotal = value End Set End Property Dim varTotal As Double = 0
''Update the Stock cmd.CommandText = "UPDATE PRODUCTS " & _ " INNER JOIN SALE_DETAIL_TMP " & _ " ON PRODUCTS.ID_PRODUCT = " & _ " SALE_DETAIL_TMP.ID_PRODUCT " & _ " SET PRODUCTS.STOCK = " & _ " PRODUCTS.STOCK-SALE_DETAIL_TMP.QUANTITY" + " WHERE ((SALE_DETAIL_TMP.USER_LOGIN= @USER_LOGIN));" cmd.Parameters.Add("@USER_LOGIN", _ OleDbType.VarChar, 50).Value = frmLogin.UserLogin cmd.ExecuteNonQuery() cmd.Parameters.Clear() ''Clear Params ''delete the temp table cmd.CommandText = "DELETE FROM SALE_DETAIL_TMP " & _ "WHERE USER_LOGIN=@USER_LOGIN" cmd.Parameters.Add("@USER_LOGIN", _ OleDbType.VarChar, 50).Value = frmLogin.UserLogin cmd.ExecuteNonQuery() _idSale = varFolioVenta ''set the ID tran.Commit() Return True Catch ex1 As OleDb.OleDbException tran.Rollback() Throw (ex1) End Try Catch ex As Exception Throw (ex) Finally cnn.Close() End Try End Function
End Sub
The "Form_Load";
Private Sub frmPayment_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Try txtTotal.Text = String.Format("{0:C}", varTotal) txtTotal.Enabled = False txtChange.Enabled = False txtCash.Text = varTotal.ToString() Catch ex As Exception MessageBox.Show(ex.Message, "System Information", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub
5. 6.
11. 12.
End While dr.Close() lblTotal.Text = String.Format("{0:C}", varTotal) Catch ex As Exception Throw (ex) Finally cnn.Close() End Try End Sub
It is the end of the Sales process. After we do the reports using the Visual Studio Reporting options (rdlc reports). Thanks...