G'day,

Just solved a problem for which previously I have
had only kludgy work arounds.   Since it took me
so long to come up with the right answer I wanted
to share it in case it saved someone else the pain.

I know one of you bright guys has solved this in
the past BUT WHERE HAVE YOU BEEN while I have been
beating my head against the brick wall? :-)

Objective:
To have a form for entering sales\order\invoicing
data that would accommodate different data input
requirements without major down sides.

Let's say a client wants to invoice four types
of items:
1. an individually serial numbered item, such as a camera,
2. one bar coded as to a line item, such as baked beans,
3. a lookup to a product description, such as a service item,
4. or he just wants to enter a customer assigned product code
    that is not barcoded.

I was formerly trying to handle it with variables
and fields based on those designed to handle the
data needing to be stored and running into all
sorts of problems - needing to clear the var on
moving from one line to another (meaning you could
not go back to edit an item without clearing all
the data stored in var for that line necessitating
reentry of that line) etc.

I mentioned a couple of weeks ago having problems
with the eep on entry to field one being called
on exit from a region.

If I used the field ProdServID on the form the last
item to solve was the ProdServID from the previous
row coming forward to the new row  because the column
ProdServID was set to the var vProdServID then the
display of the old ID in the new row was taking
precedence over the looked up value for a barcode.
GRRRRR!

Anyway, the solution is this.
1. Eschew the use of eeps in the region,
    use form var instead,
2. Do not place the ProdServID field on the form,
    use another field (must be a column, not a var)
    to hold the user entered data and set the column
    ProdServID to a var computed in the form.
3. Have a ProdServID 0 (zero) called [Custom Item]
    to display in the looked up description var place
    on the form  in lieu of a spurious description
    or the previous item.

In my case the column is called DetailNote, it is in
the TranDetail table and the Invoice form var look like this:

Table: TranDetail
   1. INTEGER  vDetailID = DetailID
   2. INTEGER  vPSID1 = ProdServID IN StockItems WHERE SerialNumb = 
DetailNote AND SerialNumb IS NOT NULL
   3. INTEGER  vPSID2 = ProdServID IN ProductsServices WHERE BarCodeNumb = 
DetailNote AND BarCodeNumb IS NOT NULL
   4. INTEGER  vPSID3 = 
(IFNULL(.vPSID1,(IFNULL(.vPSID2,NULL,.vPSID2)),.vPSID1))
   5. INTEGER  vPSID4 = ProdServID IN ProductsServices WHERE SitePSID = 
DetailNote AND SitePSID IS NOT NULL
   6. INTEGER  vProdServID = (IFNULL(.vPSID3,.vPSID4,.vPSID3))
   7. DOUBLE   vQOH = QtyOnHand IN ProductsServices WHERE ProdServID = 
.vProdServID
   8. TEXT     vProdServDescRSE = ProdServDesc IN ProductsServices WHERE 
ProdServID = .vProdServID
   9. CURRENCY vUnitCr1 = ItemSellAsk IN StockItems WHERE SerialNumb = 
DetailNote
  10. CURRENCY vUnitCr2 = TypePrice IN ItemPrices WHERE ProdServID = 
.vProdServID AND PriceTypeID = .vPriceLevel
  11. CURRENCY vUnitCr = (IFNULL(.vUnitCr2,.vUnitCr1,.vUnitCr2))
  12. CURRENCY vUnitDr1 = TotCost IN StockItems WHERE SerialNumb = DetailNote
  13. CURRENCY vUnitDr2 = AveCostSOH IN ProductsServices WHERE ProdServID = 
.vProdServID
  14. CURRENCY vUnitDr = (IFNULL(.vUnitDr2,.vUnitDr1,.vUnitDr2))
  15. INTEGER  vTaxCode = TaxRateCode IN ProductsServices WHERE ProdServID 
= .vProdServID
  16. DOUBLE   vTaxRate = TaxationRate IN C_TaxRatesProdServ WHERE 
TaxRateCode = .vTaxCode
  17. DOUBLE   vChargeRate = ChargeRate
  18. CURRENCY vExtCrNet = ((UnitQty * .vUnitCr) * ChargeRate)
  19. CURRENCY vExtCrGross = ((.vExtCrNet * .vTaxRate) + .vExtCrNet)
  20. INTEGER  ProdServID = .vProdServID
  21. CURRENCY UnitCr = .vUnitCr
  22. CURRENCY UnitDr = .vUnitDr
  23. CURRENCY ExtCrNet = .vExtCrNet
  24. CURRENCY ExtCrGross = .vExtCrGross
  25. INTEGER  GL_Code = .vGLACSalesRetail
  26. INTEGER  TDType = 121
  27. INTEGER  PersNumb = .vUserID
  28. DATE     TranDate = .vTBegDate

Hope this helps someone...


Warmest regards,


Tom Grimshaw
coy:    Just For You Software
tel:    612 9552 3311
fax:    612 9566 2164
mobile: 0414 675 903

post:   PO Box 470  Glebe  NSW  2037  Australia
street: 3/66 Wentworth Park Rd  Glebe  NSW  2037

email:  [EMAIL PROTECTED]
web: www.just4usoftware.com.au

"... the control of impulse -- is the first principle of civilization."-- 
Will Durant,
Pulitzer Prize winning philosopher, writer and historian

the most needed product in the world can be found at
www.thewaytohappiness.org

This email and any files transmitted with it are confidential to the 
intended recipient and may be privileged. If you have received this email 
inadvertently or you are not the intended recipient, you may not 
disseminate, distribute, copy or in any way rely on it. Further, you should 
notify the sender immediately and delete the email from your computer. 
Whilst we have taken precautions to alert us to the presence of computer 
viruses, we cannot guarantee that this email and any files transmitted with 
it are free from such viruses.

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to