Skip to content

S3nS3IW00/working-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Working statistics - Work wage tracker app

I made this Flutter app when I was working as a student (2021) to track my wage from month to month by logging my shifts. I just started learning Flutter when I wrote this code. I learned much since then.

The app stores the data locally. The stored data is a JSON array with serialized instances of the Work (lib/models/work.dart) class as JSON objects in it.

It uses hardcoded numbers as hourly wages and VAT (15%). The default hourly wage is 1500Ft that grows between 6pm and 10pm with 30% and between 10pm and 6am with 40%. On red-letter days the whole wage for the shift being multiplied by 2.

It uses the following method to calculate wage for a shift with the specifications above:

Salary _calculateSalary() {
    int perHour = 1500; // TODO: add to settings

    // TODO: add them to settings
    int after18 = (perHour * 1.3).toInt();
    int after22 = (perHour * 1.4).toInt();

    int salary = 0;
    DateTime temp = _fromDate;
    while (temp.isBefore(_toDate)) {
      if (temp.hour >= 22 || temp.hour < 6) {
        salary += after22;
      } else if (temp.hour >= 18 && temp.hour < 22) {
        salary += after18;
      } else {
        salary += perHour;
      }
      temp = temp.add(Duration(hours: 1));
    }
    return Salary(_celebrationDay ? salary * 2 : salary);
  }

lib/widgets/add_day.dart | line 265

The Salary (lib/models/salary.dart) class has a salary and a withoutVAT field. The withoutVAT is being multiplied by 0.85 (VAT is 15%) in the constructor.

Screenshots

It has a minimal UI design aswell. The data is shown for the selected month, but you can add shifts to any month with the add button or with editing a current shift's month.

Libraries used in the app

About

Work wage tracker Flutter app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published