Everytime the following script is run it seems to cause an issue with alpha. When the application is closed a memory error appears. And the program acts strange. Runs slowly. The purpose of the script is to grab the calculated totals on the form and put them into the table (tblwksht) fields according to what combination the client is being billed or paid. The options are for the bill/pay type field , 1-Bill Hours/ Pay Units, 2-Bill Hours/Pay Hours, 3-Bill Units/Pay Units.
The script runs on the following actions
-The "Bill/pay type" field is changed
-The "OnSave" event for the worksheet form (frmWksht)
-The "onExit" event for the worksheet form (frmWksht)
-And on a button on the form.
Here is the script and some pictures of the form and set behind it to help you understand.
The script runs on the following actions
-The "Bill/pay type" field is changed
-The "OnSave" event for the worksheet form (frmWksht)
-The "onExit" event for the worksheet form (frmWksht)
-And on a button on the form.
Here is the script and some pictures of the form and set behind it to help you understand.
Code:
DIM vTotCost as n DIM vTotBill as n DIM vTotPaid as n DIM tbl as p DIm vMode as l DIM vWO as c DIM vType as c DIM vBillTruck as l DIM vBillable as l DIM vfrmMode as c 'vfrmMode = parentform.Mode_Get() 'if vfrmMode = "Enter" .or. vfrmMode = "Change" then ' parentform.Commit() 'end if frmWksht.Commit() vType = frmWksht:bill_type.value vType = alltrim(vtype) 'T/F will the truck be billed? vBillTruck = frmWksht:bill_trks.value ' cost of trucks vTotCost = cTot_Trk_cost.value 'parentform.Commit() vWO = frmWksht:wo_num.value 'tbl = table.open("tblwksht") 'tbl.fetch_find(vWO) if left(vtype,1) = "1" then 'if statement for bill type = 1 which is bill items / pay hours vTotBill = cBI_tot.value vTotPaid = cTotal_paid.value else if left(vtype,1) = "2" then 'bill hours / pay hours vTotBill = cTotal_bill_emp.value vTotPaid = cTotal_paid.value else if left(vtype,1) = "3" then 'bill items / pay items vTotBill = cBI_tot.value vTotPaid = cItems_paid.value end if 'if the user wants to bill the use of trucks to the customer then add to total billed if vBillTruck = .t. then frmWksht:total_billed.value = vTotbill + cTot_trk_bill.value else frmWksht:total_billed.value = vTotbill end if vBillable = frmWksht:billable.value if vBillable = .f. then frmWksht:total_billed.value = 0 end if frmWksht:total_paid.value = vTotPaid frmWksht:total_units_paid.value = cpi_tot.value frmWksht:total_cost.value = vTotCost
Comment