select a month

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

select a month

Post by ROBROS »

Hi friends,
I'm working on a prog that prints the monthly salary a driver gets as a receipt. So,the month and year has to be set. For selecting the month I think a grid with the names of the 12 months would be the appropriate tool, the year should be typed in a textbox, with the current year as default.
Would you agree or is there a better choice?

TIA
Robert
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: select a month

Post by mol »

Listbox should be better and easier to select month
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: select a month

Post by franco »

I have a browse procedure I send parameters to so I can search on the temporary index key.
Browse is faster then grid for larger files.
All The Best,
Franco
Canada
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: select a month

Post by ROBROS »

@ mol:
I tried listbox, but I didn't find a way how to assign the selected month to variable cMon. As value I was always given the Item number.So, should I refer to that number in the array?
Thx for answering.

@Franco:
thx for your reply,
I have heard the weakness of GRID with huge files but 12 entries in a grid just work fine.

Robert
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: select a month

Post by dragancesu »

Try with DATE field, if you have date it's simple extract day, month or year
ROBROS
Posts: 256
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Location: D 83071 Stephanskirchen

Re: select a month

Post by ROBROS »

@ dragan
the default year is the current year, so I extract:

cYear:=left(dtos(date()),4)
Can be changed by the user,of course

But concerning months the user should be able to have the choice of all 12 months.Meantime my grid is working correctly.

Thank you for all replies

Robert
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: select a month

Post by AUGE_OHR »

hi,

it doesn't matter if you use a Listbox or a GRID ( Browse IS a GRID ) but my Question is about "Name of Month" :idea:
the German Name is different from US Name or Chinese Name for Month but i like to use what used OS give me.

so how to do it with harbour / HMG :?:
have fun
Jimmy
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: select a month

Post by dragancesu »

Control with SPINNER?
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: select a month

Post by mol »

If you want to get selected item of listbox (I think you want month's name) you can use listbox.displayvalue
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: select a month

Post by franco »

Not sure what you are looking for but for selecting date between 2 dates This is what I use.
I define 2 datepickers on my form
datepicker date_1 has start value of date() - day(date())+1
datepicker date_2 has value of date()
to start these dates are all days of current month but can be set from here to what you want.
you will know what table and so select it
Then I use index on a field for a dateintable > date_1-1 and dateintable < date_2 +1 and employee = emplyeecode to temp
This creates an index that only has the records from the table you want.
Also you could then create a second index for table month = tabledatemonth.
Then you can show them in a grid. browse, or listbox. Then delete temp indexs.
All The Best,
Franco
Canada
Post Reply