Xbrowse with Ads

Xbrowse with Ads

Postby ryugarai27 » Sat May 02, 2009 1:29 am

Dear Rao,

I have a display problem with Xbrowse using ADS, I can't figured out why, hope you could help me:

I have 4 xbrowses, and the display of three xbrowses will depend on what record number is pointing to by the first XBrowse. I tried using AdsAOF to set the filter on the 3 xbrowses and refresh them:



REDEFINE XBROWSE oMOXBrow OF oBrowDlg ID 1001 FONT oBrowFont UPDATE; // browse for transact
Alias cAlias_TRANSDB FASTEDIT ;
HEADERS 'M.O. Number','Project Name','Project Amount';
COLUMNS 'PONUM','PROJNAME','POPRICE'


WITH OBJECT oMOXBrow

:nRowHeight := oBrowFont:nHeight + 14
:bChange := {|| (cAlias_PAYDB)->(AdsClearAOF()), uCreateAOF( cAlias_PAYDB, 'FIELD->PONUM == "'+(cAlias_TRANSDB)->PONUM+'"'),;
(cAlias_SHIPDB)->(AdsClearAOF()), oHXBrow:Refresh(), uCreateAOF( cAlias_SHIPDB, 'FIELD->PONUM == "'+(cAlias_TRANSDB)->PONUM+'"'),;
(cAlias_PAYSHIPDB)->(AdsClearAOF()), uCreateAOF( cAlias_PAYSHIPDB, 'FIELD->PONUM == "'+(cAlias_TRANSDB)->PONUM+'"'),;
IF( (cAlias_TRANSDB)->HASSHIP , oPayBtn:Disable(), oPayBtn:Enable() ), oTransBtn:Enable(),;
oXbrow:Refresh(), oHXBrow:Refresh(), oHXPayBrow:Refresh() }

END

AEval (oMOXbrow:aCols, { |o| o:bPopup := {|o| ColMenu(o, oMOXBrow) } } )

oMOXBrow:bClrStd := {|| {iif((cAlias_TRANSDB)->Paid, RGB( 255, 255, 0 ), CLR_BLACK ), iif((cAlias_TRANSDB)->Paid, RGB( 155, 48, 255 ), CLR_WHITE ) } }

REDEFINE XBROWSE oXbrow OF oBrowDlg ID 1002 FONT oBrowFont UPDATE; // browse for payment
Alias cAlias_PAYDB FASTEDIT;
HEADERS 'P.O. Number','Project Name','Batch Number','PO Currency','PO Price','P.O. Date','Payment Terms',;
'Payment Date','Accumulated Payment','Payment Currency','Amount','Total Payment','Total Balance',;
'Beneficiary Name','Beneficiary Address','Country','Account #','Bank Name','Bank Address','Debit Acct No.',;
'Debit Charges Acct #','Other Charges Acct #','Remarks';
COLUMNS 'PONUM','PPONAME','PBATCH','PPOCURR','PPOPRICE','PPODATE','PTERMS','PDATE','PACCUPAY','PCURRENCY','PAMOUNT',;
'PTOTALPAY','PTOTALBAL','PBENNAME','PBENADD','PBENCTY','PBENBKACT','PBENBKNAM','PBENBKADD','PDEBITNO',;
'PDEBITCH','POTHERS','PREMARKS'

WITH OBJECT oXBrow

:nRowHeight := oBrowFont:nHeight + 12
:bGotFocus := {|| lShip := FALSE, oTransBtn:Disable(), oPayBtn:Enable() }

END

oXBrow:aCols[4]:nDataStrAlign := 2 // center align
oXBrow:aCols[3]:nDataStrAlign := 2
oXBrow:aCols[7]:nDataStrAlign := 2
oXBrow:aCols[10]:nDataStrAlign := 2


AEval (oXbrow:aCols, { |o| o:bPopup := {|o| ColMenu(o, oXbrow) } } )

REDEFINE XBROWSE oHXBrow OF oBrowDlg ID 1004 FONT oBrowFont UPDATE; // browse for shipments...
Alias cAlias_SHIPDB;
HEADERS 'P.O. Number','Shipment Number','Project Name','Currency','PO Date','Req. Ship. Date','P.O. Amount',;
'Shipment Amount','Ord. FX Rate ($)',;
'Ord. FX Rate (Y)','Invoice Value','Freight','Insurance','Dutiable Value','Dut. Value %',;
'Taxes & Duties','Brokerage Charges','Subtotal','VAT % #','Est. Vat Comput.','Local Marine','Remittance($)',;
'Bank / LC Open.','Est. Landed Cost w/ VAT','This FX Date','This FX Rate ($)','This FX Rate (Y)',;
'This Freight','This Insurance','This Inv. value','This Dut. Value','This Dut. Val. %','This Tax','This Broker',;
'This Subtotal','This VAT %','This Est. Vat.','This Loc. Marine','This Remit.($)','This Bank LC','This ELC VAT',;
'Paid Status','Remarks';
COLUMNS 'PONUM','SHIPNUM','PROJNAME','CURRENCY','PODATE','REQSHIP','POPRICE','SHIPAMT','OFXRATED','OFXRATEY','OINVVAL',;
'OFREIGHT','OINSURE',;
'ODVALUE','ODVPCNT','OTAXDUTY','OBROKER','OSUBT','OVATPCNT','OESTVAT','OLOCMAR','OREMITCH',;
'OBKLCOP','OELCVAT','TFXDATE','TFXRATED','TFXRATEY','TFREIGHT','TINSURE','TINVVAL','TDVALUE','TDVPCNT','TTAXDUTY',;
'TBROKER','TSUBST','TVATPCNT','TESTVAT','TLOCMAR','TREMITCH','TBKLCOP','TELCVAT','PAID','REMARKS';
FASTEDIT

WITH OBJECT oHXBrow

:nRowHeight := oBrowFont:nHeight + 12
:bGotFocus := {|| oHXBrow:Refresh(TRUE), lShip := TRUE, oPayBtn:Enable(), oTransBtn:Disable() }
:nRowSel := 1
:bClrStd := {|| {iif((cAlias_SHIPDB)->Paid, RGB( 255, 255, 0 ), CLR_BLACK ), iif((cAlias_SHIPDB)->Paid, RGB( 155, 48, 255 ), CLR_WHITE ) } }

END



AEval (oHXbrow:aCols, { |o| o:bPopup := {|o| ColMenu(o, oXbrow) } } )


REDEFINE XBROWSE oHXPayBrow OF oBrowDlg ID 1012 FONT oBrowFont UPDATE; // browse for payment
Alias cAlias_PAYSHIPDB FASTEDIT;
HEADERS 'P.O. Number','Shipment Number','Batch Number','Project Name','PO Currency','PO Price','P.O. Date','Payment Terms',;
'Payment Date','Accumulated Payment','Payment Currency','Amount','Total Payment','Total Balance',;
'Beneficiary Name','Beneficiary Address','Country','Account #','Bank Name','Bank Address','Debit Acct No.',;
'Debit Charges Acct #','Other Charges Acct #','Remarks';
COLUMNS 'PONUM','PSHIPNUM','PBATCH','PPONAME','PPOCURR','PPOPRICE','PPODATE','PTERMS','PDATE','PACCUPAY','PCURRENCY','PAMOUNT',;
'PTOTALPAY','PTOTALBAL','PBENNAME','PBENADD','PBENCTY','PBENBKACT','PBENBKNAM','PBENBKADD','PDEBITNO',;
'PDEBITCH','POTHERS','PREMARKS'

WITH OBJECT oHXPayBrow

:nRowHeight := oBrowFont:nHeight + 12
:bGotFocus := {|| lShip := TRUE, oTransBtn:Disable(), oPayBtn:Enable() }

END

oHXPayBrow:aCols[4]:nDataStrAlign := 2 // center align
oHXPayBrow:aCols[3]:nDataStrAlign := 2
oHXPayBrow:aCols[7]:nDataStrAlign := 2
oHXPayBrow:aCols[10]:nDataStrAlign := 2


I wonder why on oHXBrow, other records display correctly while on some records, the row selector moves one down thus making the first and second record same in display though they are actually different records.. I tried issuing all the necessary refresh but still unable to get the desired display. But when i moved the cursor to oHXBrow, the display will be OK again, and when i moved back again the cursor to oMOXBrow, the display is wrong again. Could it be on the Ads AOF?

Thanks.

ryugarai
User avatar
ryugarai27
 
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines

Re: Xbrowse with Ads

Postby nageswaragunupudi » Tue May 05, 2009 11:20 am

i have experienced this problem too.
XBrowse uses Round( AdsGerRelKeyPos() * AdsGetKeyCount(,,1) , 0 ) to know the current AdsKeyNo.
This gives an approximate result and at times goes wrong by one row.

After defining xbrowse try overriding the default codeblock like this :

oBrw:bKeyNo := { || (youralias)->( AdsKeyNo( ,, .t. ) ) }
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 115 guests