Xbrowse best way to change browse cols realtime

Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 9:30 am

Hello,

I have a Xbrowse where I show this month with several fields related to this month.

Local nPeriod = 8 (August)

Xbrowse :

___August___
C1 C2 C3 C4

C1 = data T1_1 in database
C2 = data T1_2
C3 = data T1_3
....

Now when we become Sept. Parameter set (cPeriod = 9) The browse should show september data

_September__
C1 C2 C3 C4

C1 = data T9_1 in database
C2 = data T9_2
C3 = data T9_3
....

At this point, the data is all in 1 database : Id,Name,..., T1_1,T1_2,T1_3,T1_4,T2_1,....,T12_1,T12_2 until T12,4

What is the best approach for this way of showing Xbrowses ?
Invoicing software also has to change this views every year ?
Maybe a better system in data structure of dbf/oRs?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse best way to change browse cols realtime

Postby ukoenig » Tue Aug 01, 2017 10:39 am

Marc,

I have a solution to show / refresh the xbrowse month-values on button-action.
As well I have to change the year if the selected month > month of date.
Is that the solution You are looking for ?

Image

defined files :

Jan_16.dbf
Feb_16.dbf
...
Jan_17.dbf
Feb_17.dbf
...

regards
Uwe :?:
Last edited by ukoenig on Tue Aug 01, 2017 4:43 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 10:59 am

Uwe,

Yes, That is the solution.

You use a new dbf for each Month/year ?

I suppose
1 file = general data like, name, tel, adres... and ID

Year/Month files with

ID, and datacoloms for xbrowse.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse best way to change browse cols realtime

Postby ukoenig » Tue Aug 01, 2017 11:17 am

Marc,
Yes the data of each month are included in a extra dbf because it is possible to select month of different years.

< cMName > is a var related to the month-dbf You want to open.

using only ONE browser with < cMName > = month on button-change

ALIAS cMName UPDATE

Code: Select all  Expand view  RUN

DBSELECTAREA(cMName)
DBSETORDER ( cMName )

REDEFINE XBROWSE oBrw1 ID 110 OF oFld:aDialogs[ 1 ] AUTOSORT  FASTEDIT ;
COLUMNS { "NACHNAME", "VORNAME", "KD_NR", "RTYP", "PFLSTUFE", ;
                        "KOST_RZH", "KOST_BEI", "KOST_PRI", ;
                        "KRK", "KRX", "LEER", ;
            "PFK1", "PFX1", "PFK2", "PFX2", "PFK3", "PFX3", "PFK4", "PFX4", "PFK5", "PFX5", "LEER", ;
                        "B2K", "B2X", "PBK", "B1K", "B1X", "PBX", "LEER", ;
                "VPK", "VPX",  "PRA", "PRI", "BERG", "LEER", "SUMME", "PKT_SUMME", "LEER", "RECH_DATUM"} ;  
ALIAS cMName UPDATE
 


regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 12:11 pm

Also data like Name, vorname,rtyp, .... are in every single dbf.

How do you maintain the names then ? They should be on 1 place not ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse best way to change browse cols realtime

Postby ukoenig » Tue Aug 01, 2017 12:20 pm

Marc,

there is a customer-dbf with the customer names ( can change at any time ).
Writing bills, I add the names from the customer file to the month-dbf
That means the month-dbf*s are not equal and can include different names.

The way I'm adding data

On top the customer.dbf
on bottom the selected month-dbf

A new record adds the selected names from the customer-dbf
There is a relation on customer names
( the names are not visible in the month-dbf only the performances )

Image

regards
Uwe :?:
Last edited by ukoenig on Tue Aug 01, 2017 1:17 pm, edited 6 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 12:43 pm

Every Logic is interesting, so yes, do so.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse best way to change browse cols realtime

Postby ukoenig » Tue Aug 01, 2017 12:53 pm

Marc,

if You need more infos about the program-structure
I can explain.

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 1:19 pm

Uwe,

You put the names in the month dbf, only for purpose of browse like the top picture ? so that you dont have to make a relation ?
Otherwise it is not nessesary.

Xbrowse can't browse two dbf's in one xbrowse I believe, else we could browse partial the customer, and data in one browse.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 1:21 pm

Uwe,

I'm also interested in how you browse the changing month and day's (calender look) in the last browse.
This also in dynamic.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse best way to change browse cols realtime

Postby ukoenig » Tue Aug 01, 2017 1:26 pm

Marc,

have a look at the new picture for the logic.

I need a seperate customer.dbf because of changes ( adding / delete ).
The customers inside the month-dbf's are the same at the time, the month-dbf is created.

Showing the results, the customer.dbf ( only for creation to include the name in the month-dbf )
is not needed and the selected names are visible

I'm also interested in how you browse the changing month and day's (calender look) in the last browse.
This also in dynamic.


That was the most complicated part ! :(

I will try to extract this part.

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 1:42 pm

Uwe,

I see the logic.

Only, when browsing older data's, you could sometimes have changes in names. For that browse it probably does not matter.

I'm interested in the code of building the Xbrowse, where you show the dates/months, depending on the active month of selected button.
How the headers are created.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse best way to change browse cols realtime

Postby ukoenig » Tue Aug 01, 2017 1:55 pm

Marc,

I'm interested in the code of building the Xbrowse, where you show the dates/months, depending on the active month of selected button.
How the headers are created


There is still more :

Saturday, Sunday and other special days are detected and the columns have a different color.
As well the total days of a month is detected and the non needed columns are disabled.

There is a solution to jump after adding a value to the next cell without return.

regards
Uwe :D
Last edited by ukoenig on Tue Aug 01, 2017 1:58 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse best way to change browse cols realtime

Postby nageswaragunupudi » Tue Aug 01, 2017 1:58 pm

What is the best approach for this way of showing Xbrowses ?

Please try this sample.
Code: Select all  Expand view  RUN
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   OpenData()
   BrowseData()

return nil

function BrowseData()

   local oDlg, oFont, oCbx, oBrw
   local nMonth   := 1
   local aMonths[ 12 ]
   local nOffSet

   AEval( aMonths, { |c,i| aMonths[ i ] := NtoCMonth( i ) } )
   nOffSet     := MARCV->( FIELDPOS( "T1_1" ) ) - 4

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
   DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 COMBOBOX oCbx VAR nMonth SIZE 200,400 PIXEL OF oDlg ;
      ITEMS aMonths ON CHANGE oBrw:Refresh()

   @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "MARCV" ;
      COLUMNS "ID", "Name", ;
         { || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet ) ) }, ;
         { || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet + 1 ) ) }, ;
         { || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet + 2 ) ) }, ;
         { || ( oBrw:cAlias )->( FieldGet( nMonth * 4 + nOffSet + 3 ) ) }  ;
      HEADERS nil, nil, "C1", "C2", "C3", "C4" ;
      PICTURES nil, nil, "9999", "9999", "9999", "9999" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

function OpenData()

   CreateData()

   USE MARCV NEW SHARED VIA "DBFCDX"

return nil

function CreateData()

   local aCols    := { { "ID",  "+", 4, 0 }, { "NAME", "C", 6, 0 } }
   local i, j, c, a

   for i := 1 to 12
      for j := 1 to 4
         c  := "T" + LTrim( Str( i ) ) + "_" + Str( j, 1 )
         AAdd( aCols, { c, "N", 4, 0 } )
      next
   next

   DBCREATE( "MARCV", aCols, "DBFCDX", .T., "DB" )

   for i := 1 to 10
      APPEND BLANK
      FIELD->NAME    := "Name" + StrZero( i, 2 )
      for j := 3 to FCOUNT()
         FieldPut( j, HB_RandomInt( 10,9999 ) )
      next
   next
   CLOSE DATA

return nil
 


Maybe a better system in data structure of dbf/oRs?


ID, Name, ..., MONTHNUM, C1, C2, C3, C4
Regards

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

Re: Xbrowse best way to change browse cols realtime

Postby Marc Venken » Tue Aug 01, 2017 3:04 pm

Mr. Rao,

Very interesting sample !! Works like wanted. Will study it some more.

Thanks.

Btw : Mr. Rao, do you have also commercial software in FWH ? Ex. Invoicing

Marc
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 49 guests