// Price
oLbxB:aCols[8]:nEditType := EDIT_GET
oLbxB:aCols[8]:bOnPostEdit := {|o,p| _GetPrice( p,oLbxB,oRsDetail,oRsRepair,lTaxable,oTaxable,;
oLabor,oParts,oMisc,oTax,oTotal,cTaxSet) }
// extention
ADD oCol TO oLbxB AT 9 DATA {|x| x := _CalcExt( oRsDetail:Fields("Qty"):Value,;
oRsDetail:Fields("Price"):Value )} HEADER 'Ext' size 65
oLbxB:aCols[9]:nEditType := EDIT_NONE
oLbxB:aCols[9]:nDataStrAlign := AL_RIGHT
oLbxB:aCols[8]:nHeadStrAlign := AL_RIGHT
//--------------------------------
Static Func _GetPrice( nP,oLbxMain,oRsDetail,oRsRepair,lTaxable,oTaxable,;
oLabor,oParts,oMisc,oTax,oTotal,cTaxSet)
Local nOldPrice,nQ,Saying
msginfo(nP) // nP should be 69.95 .. not 69.00
If oRsDetail:Fields("IsLabor"):Value = .t.
Saying := "Sorry .. you can not EDIT this Price because there is Itemization"+chr(10)
Saying += "under the Labor Column. In order to Change this Price you must go"+chr(10)
Saying += "back to the Labor column and Edit or Delete your Changes there"+chr(10)
MsgInfo( Saying )
oLbxMain:GoLeftMost()
oLbxMain:nColSel(2)
Return(.f.)
Endif
nOldPrice := oRsDetail:Fields("Price"):Value
nQ := oRsDetail:Fields("Qty"):Value
If nP = nOldPrice
oLbxMain:ReFresh()
oLbxMain:nColSel(2)
oLbxMain:SetFocus()
Return(.t.)
Endif
oRsDetail:Fields("Price"):Value := nP
oRsDetail:Update()
_ReCalcTotals( oRsDetail,oRsRepair,@lTaxable,oTaxable, ,oLbxMain,;
oLabor,oParts,oMisc,oTax,oTotal,cTaxSet )
oLbxMain:ReFresh()
oLbxMain:nColSel(2)
oLbxMain:SetFocus()
Return(.T.)
//--------------------------------------
Static Func _CalcExt( nQuantity,nPrice )
//recalcs ext to paint listbox
Local nExtension
nExtension := Round((nQuantity * nPrice),2)
Return( nExtension )