emaduddeen
Programmer
Hi.
I have a browse on an abc form procedure. This form is the first window the user sees when the application starts. The procedure initially calls a browse to allow the selection of a custumer when the form procedure will use. After the customer is selected the application calls the update procedure in non-stop batch add mode to fill in the browse which is on a child table. On the form is a button to allow further selections of a new customer to complete transactions.
Here is the problem. Selecting a customer and adding several child table rows works fine. The problem starts when I use a filter and ResetSort to clear the browse prior to selecting the new customer. The update procedur get called after selecting the customer and when I click "Ok" to save the transaction detail, nothing shows up in the browse.
I am sure I am not using the correct code. Can you help me correct the code? Thank you so much for the time everyone has been giving me.
Truly,
Emad
In the "Init" embed:
In the "open window" embed:
In the button that saves the transaction and transaction details. This is in the "Acepted" embed:
In the button that allows the user to select a new customer. This is in the "Acepted" embed:
I have a browse on an abc form procedure. This form is the first window the user sees when the application starts. The procedure initially calls a browse to allow the selection of a custumer when the form procedure will use. After the customer is selected the application calls the update procedure in non-stop batch add mode to fill in the browse which is on a child table. On the form is a button to allow further selections of a new customer to complete transactions.
Here is the problem. Selecting a customer and adding several child table rows works fine. The problem starts when I use a filter and ResetSort to clear the browse prior to selecting the new customer. The update procedur get called after selecting the customer and when I click "Ok" to save the transaction detail, nothing shows up in the browse.
I am sure I am not using the correct code. Can you help me correct the code? Thank you so much for the time everyone has been giving me.
Truly,
Emad
In the "Init" embed:
Code:
! Tell the form to go into insert mode & fill dropdowns.
!-------------------------------------------------------
GlobalRequest = InsertRecord
Access:TransactionHeader.PrimeAutoInc
! Fill Payment Type queue for the Payment Type dropdown.
!-------------------------------------------------------
Clear (PaymentTypeQue)
LOC:SortNumberCounter = 1
Set (PaymentTypes, PAY:KeyPaymentType)
! Stay here until the end of file.
!---------------------------------
Loop Until Access:PaymentTypes.Next()
PaymentTypeQue:PaymentType = PAY:PaymentType
PaymentTypeQue:SortNumber = LOC:SortNumberCounter
Add (PaymentTypeQue)
LOC:SortNumberCounter = LOC:SortNumberCounter + 1
End
In the "open window" embed:
Code:
! Get the preferences values.
!----------------------------
PRE:Id = 1
Get (Preferences, PRE:PreferencesKey)
! Set defaults.
!--------------
TranHed:TransactionType = 'Sale'
TranHed:PaymentType = ''
Display()
! Display the screen to select a customer.
!-----------------------------------------
GlobalRequest = SelectRecord
! Disable these.
!---------------
Toolbar11.SetEnabled (ID11_btnInsert, False)
Toolbar11.SetEnabled (ID11_btnChange, False)
Toolbar11.SetEnabled (ID11_btnDelete, False)
SelectCustomer
If GlobalResponse = RequestCompleted |
Then
! Populate Point of Sale screen header information.
!--------------------------------------------------
TranHed:DateOfSale = today()
TranHed:TimeOfSale = clock()
LOC:CustomerName = Clip (CUS:Forename) & ' ' & CUS:Surname
LOC:CityStatePostcode = Clip (CUS:City) & ', ' & Clip (CUS:StateProvence) & ' ' & CUS:Postcode
LOC:AlternateCityStatePostcode = Clip (CUS:AlternateCity) & ', ' & Clip (CUS:AlternateStateProvence) & ' ' & CUS:AlternatePostcode
TranHed:CustNumber = CUS:CustNumber
GLO:CustNumber = CUS:CustNumber
If CUS:AlternateAddressLine1 <> '' |
Then
LOC:ShippingAddressLabel = ' Shipping Address '
Else
LOC:ShippingAddressLabel = ''
End
! Enable these.
!---------------
Toolbar11.SetEnabled (ID11_btnInsert, True)
?Insert {PROP:Disable} = False
! Click on the Insert button.
!----------------------------
Post (EVENT:Accepted, ?Insert)
Else
! The user canceled the search customer window.
!----------------------------------------------
If TranHed:CustNumber = '' |
Then
! Make sure the user can't do anything until a customer is chosen.
!-----------------------------------------------------------------
?SalesItemsList {PROP:Disable} = True
?TranHed:PaymentType {PROP:Disable} = True
?TranHed:PaymentAmount {PROP:Disable} = True
?CancelOrder {PROP:Disable} = True
?SaveAndPrint {PROP:Disable} = True
End
End
Display()
In the button that saves the transaction and transaction details. This is in the "Acepted" embed:
Code:
Message ('Your sales receipt has been saved.', 'Sales Receipt')
Erase (?LOC:CustomerName, ?TranHed:PaymentAmount)
! Erase the data in the browse.
!------------------------------
SalesItemsList.SetFilter('1=0','9Z')
SalesItemsList.ResetSort(True)
Access:TransactionHeader.PrimeAutoInc
! Reset browse so it will allow inserts.
!---------------------------------------
SalesItemsList.SetFilter('')
SalesItemsList.ResetSort(True)
In the button that allows the user to select a new customer. This is in the "Acepted" embed:
Code:
Display (?TranHed:TransactionNumber)
! Redisplay the browse.
!----------------------
SalesItemsList.ResetSort(True)
DISPLAY(?SalesItemsList)
! Display the screen to select a customer.
!-----------------------------------------
GlobalRequest = SelectRecord
! Disable these.
!---------------
Toolbar11.SetEnabled (ID11_btnInsert, False)
Toolbar11.SetEnabled (ID11_btnChange, False)
Toolbar11.SetEnabled (ID11_btnDelete, False)
TranHed:TransactionType = 'Sale'
TranHed:PaymentType = 'MC / Visa'
SelectCustomer
If GlobalResponse = RequestCompleted |
Then
! Populate Point of Sale screen header information.
!--------------------------------------------------
TranHed:DateOfSale = today()
TranHed:TimeOfSale = clock()
LOC:CustomerName = Clip (CUS:Forename) & ' ' & CUS:Surname
LOC:CityStatePostcode = Clip (CUS:City) & ', ' & Clip (CUS:StateProvence) & ' ' & CUS:Postcode
LOC:AlternateCityStatePostcode = Clip (CUS:AlternateCity) & ', ' & Clip (CUS:AlternateStateProvence) & ' ' & CUS:AlternatePostcode
TranHed:CustNumber = CUS:CustNumber
GLO:CustNumber = CUS:CustNumber
If CUS:AlternateAddressLine1 <> '' |
Then
LOC:ShippingAddressLabel = ' Shipping Address '
Else
LOC:ShippingAddressLabel = ''
End
! Enable these.
!---------------
Toolbar11.SetEnabled (ID11_btnInsert, True)
?Insert {PROP:Disable} = False
! Click on the Insert button.
!----------------------------
Post (EVENT:Accepted, ?Insert)
Else
! The user canceled the search customer window.
!----------------------------------------------
If TranHed:CustNumber = '' |
Then
! Make sure the user can't do anything until a customer is chosen.
!-----------------------------------------------------------------
?SalesItemsList {PROP:Disable} = True
?TranHed:PaymentType {PROP:Disable} = True
?TranHed:PaymentAmount {PROP:Disable} = True
?CancelOrder {PROP:Disable} = True
?SaveAndPrint {PROP:Disable} = True
End
End
Display()