Initial commit: Kimai TMS

Kimai time management system (PHP 5.6 / MySQL) with custom extensions:
- Budget tracking (ki_budget)
- Change request form (ki_changerequest)
- Invoice generation (ki_invoice)
- Expense tracking (ki_expenses)
- Flexi time (ki_flexitime)
- Export, admin panel, timesheets, tasks, summary

Database: ~900K time entries, 2,000+ users, 439 projects.
Config: includes/autoconf.php — localhost/kimai/kimai
This commit is contained in:
TMS
2026-06-18 21:20:26 +00:00
commit eb299c9131
1099 changed files with 359817 additions and 0 deletions

145
core/example.php Normal file
View File

@@ -0,0 +1,145 @@
<?php
$hostname = "localhost";
$username = "kimai";
$password = "kimai";
$dbname = "kimai";
$con = mysqli_connect($hostname, $username, $password, $dbname) or die("<html><script language='JavaScript'>alert('Unable to connect to database! Please try again later.')</script></html>");
//============================================================+
// File name : example_007.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 007 for TCPDF class
// Two independent columns with WriteHTMLCell()
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Two independent columns with WriteHTMLCell()
* @author Nicola Asuni
* @since 2008-03-04
*/
// Include the main TCPDF library (search for installation path).
require_once('../extensions/ki_changerequest/templates/tcpdf/tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 028');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(10, PDF_MARGIN_TOP, 10);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
$pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone');
// set font
$pdf->SetFont('times', 'B', 20);
$pdf->AddPage('P', 'A4');
$column_company_name = "<h1>Company Name</h1>";
$query = "select k.knd_name as 'company_name' from kimai15_knd k where k.knd_trash = 0 order by k.knd_name";
$result = mysqli_query($con, $query);
if (mysqli_num_rows($result) != 0) {
while ($row = mysqli_fetch_array($result)) {
$column_company_name .= '<input type="checkbox" value="' . $row['company_name'] . '" name="' . $row['company_name'] . '"' . ">" . $row['company_name'] . "<br/>" . "\n";
}
}
$column_project_name = "<h1>Project Name</h1>";
$query = "select DISTINCT right(p.pct_name,CHAR_LENGTH(p.pct_name) - 8 ) as 'project_name' from kimai15_pct p
where p.pct_trash = 0
order by project_name";
$result = mysqli_query($con, $query);
if (mysqli_num_rows($result) != 0) {
while ($row = mysqli_fetch_array($result)) {
$column_project_name .= '<input type="checkbox" value="' . $row['project_name'] . '" name="' . $row['project_name'] . '"' . ">" . $row['project_name'] . "<br/>" . "\n";
}
}
$column_division_name = "<h1>Divisions</h1>";
$query = "select DISTINCT left(p.pct_name,3) as 'pdivision_name' from kimai15_pct p
where p.pct_trash = 0
order by division_name";
$result = mysqli_query($con, $query);
if (mysqli_num_rows($result) != 0) {
while ($row = mysqli_fetch_array($result)) {
$column_division_name .= '<input type="checkbox" value="' . $row['division_name'] . '" name="' . $row['division_name'] . '"' . ">" . $row['division_name'] . "<br/>" . "\n";
}
}
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// get current vertical position
$y = $pdf->getY();
// write the first column
$pdf->writeHTMLCell(30, '', '', $y, $column_company_name, 1, 0, 0, false, 'L', true);
// write the second column
$pdf->writeHTMLCell(30, '', '', '', $column_project_name, 1, 0, 0, false, 'L', false);
// write the third column
$pdf->writeHTMLCell(45, '', '', '', $column_division_name, 1, 1, 0, false, 'L', false);
$pdf->AddPage('L', 'A4');
$pdf->writeHTMLCell(45, '', '', '', $column_task_name, 1, 1, 0, false, 'L', true);
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_028.pdf', 'I');