VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code archives & edits the items in the database. Then generates a report as an invoice. PROBLE

by DRISC (1 Submission)
Category: OLE/COM/DCOM/Active-X
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 17th April 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code archives & edits the items in the database. Then generates a report as an invoice. PROBLEM THE REPORT KEEPS SHOWING THE FIRST ITEM

API Declarations


Dim B
Dim m As Integer
Dim k
Dim j
Dim P


Rate This code archives & edits the items in the database. Then generates a report as an invoice. PROBLE




Private Sub CmdAdd1_Click()

A = InputBox("please enter name")
dtTable.Recordset.FindFirst "STOCK_CODE ='" & A & "'"
Do Until dtTable.Recordset.NoMatch = False
    MsgBox "NO MATCH FOUND...", vbOK, "!!!"
    A = InputBox("please enter name")
    dtTable.Recordset.FindFirst "STOCK_CODE ='" & A & "'"
Loop

txtQuantity.SetFocus

End Sub




Private Sub CmdOk_Click()



If CmdOk.Caption = "Ok" Then
    m = InputBox("AMOUNT RECIEVED", "Request")
    lblchange.Caption = (m - txtTotal.Text)
    CmdOk.Caption = "Print"
Else
   'reportinv.Refresh
   'reportinv.Show
   adoTemp.Recordset.MoveFirst
   Do Until adoTemp.Recordset.EOF
        adoTemp.Recordset.Delete
        adoTemp.Recordset.MoveNext
    Loop
CmdOk.Caption = "Ok"
Frame1.Visible = False
cmdSales.Visible = True
Unload Me
frmTaxInvoice.Show
End If

End Sub

Private Sub cmdRefresh_Click()

adoTemp.Recordset.MoveFirst
Do Until adoTemp.Recordset.EOF
        adoTemp.Recordset.Delete
        adoTemp.Recordset.MoveNext
Loop

'---DELETES SALES ACCORDING TO INVOICE NO---

Data1.Recordset.MoveFirst
k = txtInvNO.Text
Do While Data1.Recordset!INV_NO = k
        Data1.Recordset.Delete
        Data1.Recordset.MoveNext
Loop
txtTotal.Text = "0"
txtvat.Text = "0"
txtsubtotal.Text = "0"

End Sub



Private Sub cmdSales_Click()


'--- INVOICING---
dtsales.Recordset.MoveLast
txtInvNO.Text = dtsales.Recordset!INV_NO + 1
'---

j = InputBox("ENTER USER NUMBER...", "!!!")
If j = "001" Then
    cmdSales.Visible = False
    Frame1.Visible = True
Else
    If j = "002" Then
        cmdSales.Visible = False
        Frame1.Visible = True
    Else
        If j = "003" Then
            cmdSales.Visible = False
            Frame1.Visible = True
         Else
            MsgBox "WRONG!...TRY AGAIN", vbCritical, "MESSAGE"
        End If
    End If
End If
txtUser.Text = j
txtTotal.Text = "0"
txtvat = "0"
txtsubtotal = "0"

End Sub

Private Sub Command1_Click()
Unload Me
FrmMain.Show
End Sub

Private Sub Form_Load()
'---

'---

txtDate = Date
txtTotal.Text = "0"
txtvat = "0"
txtsubtotal = "0"




End Sub

Private Sub txtQuantity_lostfocus()


'---
Dim s As Integer
Dim t As Integer
Dim f As Integer
Dim g As Integer
Dim h As Integer
Dim j As Integer


'---calaculate final price---

txtFinalPrice.Text = dtTable.Recordset!Retail * txtQuantity.Text


'---write 2 temp db & display info. on grid----
adoTemp.Recordset.AddNew
adoTemp.Recordset!CODE = txtCode.Text
adoTemp.Recordset!DISCRIP = txtDescripton.Text
adoTemp.Recordset!QUANTITY = txtQuantity.Text
adoTemp.Recordset!PRICE = txtPrice
adoTemp.Recordset!RET_COST = txtFinalPrice.Text
adoTemp.Recordset!INV_NO = txtInvNO.Text
adoTemp.Recordset!User = txtUser.Text
'adoTemp.Recordset!SUB_TOTAL = txtsubtotal2.Text
'adoTemp.Recordset!VAT = txtvat2.Text
adoTemp.Recordset.Update

'---WRITE TO DAILY SALES
Data1.Recordset.AddNew
Data1.Recordset!CODE = txtCode.Text
Data1.Recordset!DISCRIP = txtDescripton.Text
Data1.Recordset!QUANTITY = txtQuantity.Text
Data1.Recordset!PRICE = txtPrice
Data1.Recordset!RET_COST = txtFinalPrice.Text
Data1.Recordset!INV_NO = txtInvNO.Text
Data1.Recordset!Date = txtDate.Text
Data1.Recordset!User = txtUser.Text
Data1.Recordset.Update

'---
dtsales.Recordset.AddNew
dtsales.Recordset!CODE = txtCode.Text
dtsales.Recordset!DISCRIP = txtDescripton.Text
dtsales.Recordset!QUANTITY = txtQuantity.Text
dtsales.Recordset!PRICE = txtPrice
dtsales.Recordset!RET_COST = txtFinalPrice.Text
dtsales.Recordset!INV_NO = txtInvNO.Text
dtsales.Recordset!Date = txtDate.Text
dtsales.Recordset.Update
'---calculate the total---

s = txtTotal.Text
t = txtFinalPrice.Text
txtTotal.Text = s + t

'---DEDUCT STOCK---

    dtTable.Recordset.Edit
     P = dtTable.Recordset!INSTOCK - txtQuantity
      dtTable.Recordset!INSTOCK = P
    dtTable.Recordset.Update

'---calculate vat & subtotal---
txtsubtotal2.Text = (0.14 / 1.14) * txtFinalPrice.Text
txtvat2.Text = txtFinalPrice.Text / 1.14
f = txtvat2.Text
g = txtvat.Text
h = txtsubtotal2.Text
j = txtsubtotal.Text
txtsubtotal = h + j
txtvat.Text = f + g

CmdAdd1.SetFocus

End Sub





Download this snippet    Add to My Saved Code

This code archives & edits the items in the database. Then generates a report as an invoice. PROBLE Comments

No comments have been posted about This code archives & edits the items in the database. Then generates a report as an invoice. PROBLE. Why not be the first to post a comment about This code archives & edits the items in the database. Then generates a report as an invoice. PROBLE.

Post your comment

Subject:
Message:
0/1000 characters