Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Shaheryar Rashed
  Where is Shaheryar Rashed?
 Multan
 Pakistan
 Shaheryar Rashed
 To: David Mustakim
  Where is David Mustakim?
 Jakarta
 Indonesia
 David Mustakim
 Tags
Subject: RE: time totals
Thread ID: 395497 Message ID: 395507 # Views: 42 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Wednesday, January 15, 2014 3:13:41 PM         
   


> > it calculates but rounds the result
> > and if i change fields to datetime, i should change all the project :(
>
>
> nhour=0
> scan 
>   nhour=nhour+val(substr(tablename.lastcolumn,1,2)+val(substr(tablename.lastcolumn,4,2)) / 60  && or without dividing with 60 ??
> endscan   && I can't guess if you have to present them in just hours + fraction or hours + minutes
> 

> .CMIIW whereever, that's just the idea

Sir, i changed data as below kindly check it and correct it
Create Cursor test ( ariv c(10), dis c(10) )
Create Cursor t2 ( ariv c(10), dis c(10), labour c(10), part1 c(10), part2 c(10))
Create Cursor t3 (hour1 N(12), minut1 n(12))

Insert into test values ('08:00a', '08:30p')
Insert into test values ('08:00a', '09:40p')
Insert into test values ('08:00a', '10:45p')

SELECT test
SCAN
	SELECT t2
	APPEND BLANK
	REPLACE t2.ariv WITH test.ariv, t2.dis WITH test.dis, t2.labour WITH ;
			Transform( Right( Ttoc( Ctot(test.dis) - ( Ctot(test.ariv) - Ctot('0')), 1 ), 6), '@R 99:99' ) IN t2
	LOCAL lcLBR
			lcLBR = ALLTRIM(t2.labour)
	REPLACE part1 WITH ALLTRIM(left(lcLBR,2)), part2 WITH ALLTRIM(right(LcLBR,2))		
	ENDSCAN
SELECT t2
brow


SELECT t2
SUM VAL((t2.part1)) TO lnJ1
lnJ1 = lnJ1*60
SUM VAL((t2.part2)) TO lnJ2
IF lnJ2 => 60
	lnJ3 = lnJ2-60
	lnJ2 = 00
endif	
SELECT t3
APPEND blank
REPLACE t3.hour1 WITH (lnJ1+lnJ3)/60, t3.minut1 WITH lnj2
brow


ENTIRE THREAD

time totals Posted by Shaheryar Rashed @ 1/15/2014 1:58:56 PM
RE: time totals Posted by David Mustakim @ 1/15/2014 2:18:45 PM
RE: time totals Posted by Shaheryar Rashed @ 1/15/2014 2:30:23 PM
RE: time totals Posted by David Mustakim @ 1/15/2014 2:47:42 PM
RE: time totals Posted by Shaheryar Rashed @ 1/15/2014 3:13:41 PM
RE: time totals Posted by Tore Bleken @ 1/15/2014 3:22:29 PM
RE: time totals Posted by Shaheryar Rashed @ 1/16/2014 7:36:37 AM
RE: time totals Posted by Anders Altberg @ 1/15/2014 4:51:39 PM
RE: time totals Posted by Cetin Basoz @ 1/15/2014 5:51:36 PM
RE: time totals Posted by Shaheryar Rashed @ 1/17/2014 6:51:16 AM
RE: time totals Posted by Cetin Basoz @ 1/17/2014 1:24:20 PM
RE: time totals Posted by Shaheryar Rashed @ 1/18/2014 6:45:09 AM
RE: time totals Posted by Anders Altberg @ 1/18/2014 11:50:19 PM