File size: 2,887 Bytes
73805b4
 
 
 
 
 
 
 
 
 
 
 
 
2a2ef8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73805b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
title: Biweekly Invoice Generator
emoji: πŸ“Š
colorFrom: red
colorTo: gray
sdk: gradio
sdk_version: 5.44.1
app_file: app.py
pinned: false
license: mit
short_description: A Gradio web application that processes employee CSV
---

# 🧾 Invoice Generator for Launch27 Data

A Gradio web application that processes employee CSV files and booking data to generate invoices with automatic tip calculations.

## πŸš€ Quick Start

### For Hugging Face Spaces Deployment:
1. Upload `app.py` and `requirements.txt` to your Space
2. Set SDK to "Gradio"
3. The app will automatically launch

### Local Installation:
```bash
pip install -r requirements.txt
python app.py
```

### Requirements File (`requirements.txt`):
```
gradio
pandas
```

## πŸ“‹ Features

- βœ… **Flexible CSV Upload**: Works with 1-3 employee data files
- βœ… **Automatic Tip Processing**: Extracts and includes tips from booking data
- βœ… **Date Range Filtering**: Filter records by bi-weekly periods
- βœ… **Smart Date Parsing**: Handles DD/MM/YY and DD/MM/YYYY formats
- βœ… **Pivot Table Generation**: Creates summary report by employee
- βœ… **CSV Export**: Download processed invoice as CSV file

## πŸ“ File Requirements

### Required Files:
- **Bookings CSV**: Must contain booking data with tips
- **At least 1 Employee CSV**: Employee work data (1.csv, 2.csv, or 3.csv)

### CSV Format Expected:
- **Employee Files**: Date, Team, Name, Hourly Rate, Hours Worked, Total
- **Bookings File**: Date, Teams Assigned (without IDs), Tip

## 🎯 Usage

1. **Upload Files**: Add your employee CSV files and bookings CSV
2. **Set Date Range**: Enter start and end dates (YYYY-MM-DD format)
3. **Generate**: Click "Generate Invoice" button
4. **Download**: Get your processed invoice CSV

## πŸ“Š Output Format

The generated invoice includes:
- Employee summary with total hours and earnings
- Tips automatically added to respective employees
- Grand total calculations
- Matches Launch27 invoice format requirements

## 🌐 Deployment

### Local Development:
```bash
python app.py
```
Access at: `http://localhost:7860`

### Cloud Deployment:
- **Hugging Face Spaces**: Upload `app.py` and `requirements.txt`
- **Railway/Render**: Deploy with Python runtime
- **Docker**: Works with standard Python containers

## πŸ“ Notes

- Default date range: August 9-22, 2025
- Supports flexible employee file combinations
- Automatically handles name standardization
- Tips are processed from "Teams Assigned" field in bookings
- Output format matches expected Final-Invoice.csv structure

## πŸ”§ Technical Details

- **Framework**: Gradio for web interface
- **Data Processing**: Pandas for CSV manipulation
- **Date Handling**: Flexible parsing with dayfirst=True
- **File Management**: Temporary files for secure downloads


Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference