How Do i calculate & Update each single column after selling a product from the inventory
i dont know if the calculation is by item number or something else so i show the 2 tables of inventory and the cashregister
cash register form in named " FrmCashRegister " ,Inventory name form is "FrmInventory"
this are the values in the DB
Now senior @Doogle Helped me with this Update code but i was wrong
i told him i want to calculate all the profit instead of a single row
this is the update code:
if any more info is needed (to prevent 1000 posts by me ;) i will add)
regards salsa
Gracias Amigos
i dont know if the calculation is by item number or something else so i show the 2 tables of inventory and the cashregister
cash register form in named " FrmCashRegister " ,Inventory name form is "FrmInventory"
this are the values in the DB
Code:
Table name - CashBox
Values:
CashID
CashNameEmp
CashDate
CashDay
CashTime
CashCust
CashItem
CashPartNumber
CashQuantity
CashPrice
CashDiscount
CashTotal
CashMethod
CashPayments
CashProfit " Here i need to display the total profit of the item"
CashRemarks
Code:
Table name - Inventory
Values:
InvID
InvDate
InvItem
InvQuantity
InvBeforeTax
InvInvoice
InvSupplier
InvEmail
InvPhone
InvBranch
InvFax
InvCompany
InvPaymentMethod
InvPayments
InvParts
InvExpire
InvTax
InvAfterTax
InvForCust
InvTotal
InvPhoto
InvStatus
InvSold
InvRemain
InvRemarks
Now senior @Doogle Helped me with this Update code but i was wrong
i told him i want to calculate all the profit instead of a single row
this is the update code:
Code:
Dim NewID As Long
NewID = NextID("CashID", "CashBox")
Dim strSQL As String
strSQL = "INSERT INTO CashBox "
strSQL = strSQL & "(CashID, CashNameEmp, CashDate, CashDay, CashTime, CashCust, CashItem, CashPartNumber, CashQuantity, CashPrice, CashDiscount, CashTotal, CashMethod, CashPayments, CashProfit, CashRemarks) "
strSQL = strSQL & "VALUES("
strSQL = strSQL & NewID & ","
strSQL = strSQL & "'" & RplS(CmbName.text) & "',"
strSQL = strSQL & "#" & MyDate(PickDate.Value) & "#,"
strSQL = strSQL & "'" & RplS(Txt(1).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(2).text) & "',"
strSQL = strSQL & "'" & RplS(TxtDesc.text) & "',"
strSQL = strSQL & "'" & RplS(Txt(4).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(5).text) & "',"
strSQL = strSQL & CCur(Txt(6).text) & ","
strSQL = strSQL & CCur(Txt(7).text) & ","
strSQL = strSQL & CCur(Txt(8).text) & ","
strSQL = strSQL & CCur(Txt(9).text) & ","
strSQL = strSQL & "'" & CmbMethod.text & "',"
strSQL = strSQL & CCur(CmbPay.text) & ","
strSQL = strSQL & CCur(FrmCashRegister.LblProfit.Caption) & ","
strSQL = strSQL & "'" & RplS(Txt(10).text) & "'"
strSQL = strSQL & ")"
CN.Execute strSQL
strSQL = "Update Inventory set InvSold = InvSold + " & Txt(6).text & ","
strSQL = strSQL & " InvRemain = InvRemain - " & Txt(6).text
strSQL = strSQL & " where InvParts = '" & RplS(Txt(5).text) & "'"
CN.Execute strSQL
regards salsa
Gracias Amigos