How to calculate time and charges in atomaticaly
Example: Per hours 10.00,
Name : Mano
Starting Time : 14:00
Finishing time : 16:45
Total Hrs : 2:45
Charges : 28
please help me if have any formula
Thank you
Remo
How to calculate time and charges in atomaticaly
Example: Per hours 10.00,
Name : Mano
Starting Time : 14:00
Finishing time : 16:45
Total Hrs : 2:45
Charges : 28
please help me if have any formula
Thank you
Remo
Good start from and useful direction from . The reliable approach is: parse times to Date/DateTime, subtract to get a TimeSpan, use TotalMinutes or TotalHours, multiply by the hourly rate, then apply whatever billing rule (exact, round to cents, round up to nearest minute/15-minute block, or always round up to the next hour). Handle end < start by adding a day (overnight jobs) and store times as real Date/DateTime values in the database (not strings).
Example VB.NET workflow (different from the DateDiff snippet already posted):
Dim startTime As DateTime = DateTime.Parse("14:00")
Dim endTime As DateTime = DateTime.Parse("16:45")
If endTime < startTime Then endTime = endTime.AddDays(1)
Dim span As TimeSpan = endTime - startTime
Dim totalHours As Double = span.TotalHours
Dim rate As Decimal = 10D
Dim chargeExact As Decimal = rate CDec(totalHours)
Dim chargeRoundCents As Decimal = Math.Round(chargeExact, 2)
Dim chargeRoundUpQuarter As Decimal = Math.Ceiling(span.TotalMinutes / 15.0) 15.0 / 60.0 * rate
2:45 is 2.75 hours -> exact charge 27.50; rounding to nearest cent stays 27.50; Math.Ceiling on minutes will force upward billing (ceil to next 15 min or hour) and explains a 28.00 result if that policy is used. TimeSpan.TotalHours docs for reference: TimeSpan.TotalHours.
For : compute GrandTotal = sum(subject scores); Percentage = GrandTotal / (numberOfSubjects maxPerSubject) 100. Save numeric totals/percentages into numeric fields and use parameterized INSERTs to avoid injection.
Jump to Post— QVeen72 104Hi,
Try This :
Dim T As Long Dim TAmt As Currency T = DateDiff("n", CDate("14:00:00"), CDate("16:45:00")) TAmt = (10 * T) / 60 MsgBox TAmtRefine the code according to your requirement...
Regards
Veena
Hi,
Try This :
Dim T As Long
Dim TAmt As Currency
T = DateDiff("n", CDate("14:00:00"), CDate("16:45:00"))
TAmt = (10 * T) / 60
MsgBox TAmt Refine the code according to your requirement...
Regards
Veena
how to calculate total and save in database sccess.
four user input in text box add total and save all fields in access data base.
for example...
student all subject result.
1- chemistry number = 50
2- math = 80
3- Physics = 90
4- Bio =85
Grand toal =?
total Percentage = ?
all value save in database code.
pleas help me if any code...
thanks.
Hadeeqa
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.