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:
64
extensions/ki_changebillable/templates/index.php
Normal file
64
extensions/ki_changebillable/templates/index.php
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
<div class="CSSTableGenerator" >
|
||||
|
||||
<p>
|
||||
<?php
|
||||
try {
|
||||
$con = new PDO('mysql:host=localhost;port=3306;dbname=kimai', "kimai", "kimai");
|
||||
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
//ALTER TABLE `kimai15_pct`
|
||||
//ADD COLUMN `pct_billable` TINYINT(1) NOT NULL DEFAULT '0' AFTER `pct_internal`;
|
||||
$query = <<<EOD
|
||||
select DISTINCT
|
||||
k.knd_name as 'Company Name',
|
||||
p.pct_name as 'Project',
|
||||
CASE
|
||||
WHEN p.pct_billable = 0 THEN CONCAT("<input type='radio' name='",p.pct_ID, "' value='0' checked='checked'/>")
|
||||
ELSE CONCAT("<input type='radio' name='",p.pct_ID, "' value='0'/>")
|
||||
END as 'Billabale',
|
||||
CASE
|
||||
WHEN p.pct_billable = 1 THEN CONCAT("<input type='radio' name='",p.pct_ID, "' value='1' checked='checked'/>")
|
||||
ELSE CONCAT("<input type='radio' name='",p.pct_ID, "' value='1'/>")
|
||||
END as 'Non-billable',
|
||||
CASE
|
||||
WHEN p.pct_billable = 2 THEN CONCAT("<input type='radio' name='",p.pct_ID, "' value='2' checked='checked'/>")
|
||||
ELSE CONCAT("<input type='radio' name='",p.pct_ID, "' value='2'/>")
|
||||
END as 'Unproductive'
|
||||
from kimai15_pct p
|
||||
inner join kimai15_knd k on p.pct_kndID=k.knd_ID
|
||||
where p.pct_visible = 1
|
||||
order by k.knd_name, p.pct_name
|
||||
EOD;
|
||||
|
||||
echo "<form method='post'>";
|
||||
//first pass just gets the column names
|
||||
echo '<table id="myTable" border="1" cellpadding="3" cellspacing="0">';
|
||||
$result = $con->query($query);
|
||||
//return only the first row (we only need field names)
|
||||
$row = $result->fetch(PDO::FETCH_ASSOC);
|
||||
echo " <tr> \n";
|
||||
foreach ($row as $field => $value) {
|
||||
echo " <th>$field</th> \n";
|
||||
} // end foreach
|
||||
echo " </tr> \n";
|
||||
//second query gets the data
|
||||
$data = $con->query($query);
|
||||
$data->setFetchMode(PDO::FETCH_ASSOC);
|
||||
foreach ($data as $row) {
|
||||
echo " <tr> \n";
|
||||
foreach ($row as $name => $value) {
|
||||
echo " <td>$value</td> \n";
|
||||
} // end field loop
|
||||
echo " </tr> \n";
|
||||
} // end record loop
|
||||
echo "</table> \n";
|
||||
echo "<input type='submit' name='changebillable_submit' value='SUBMIT'/>";
|
||||
echo "<form>";
|
||||
} catch (PDOException $e) {
|
||||
echo 'ERROR: ' . $e->getMessage();
|
||||
} // end try
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
22
extensions/ki_changebillable/templates/index.tpl
Normal file
22
extensions/ki_changebillable/templates/index.tpl
Normal file
@@ -0,0 +1,22 @@
|
||||
{* IMPORTANT NOTE:
|
||||
Javascript or jQuery stuff that should run when your extension *has finished loading*
|
||||
should sit in an special onload function like this:
|
||||
*}
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
changebillable_ext_onload();
|
||||
});
|
||||
</script>
|
||||
|
||||
{/literal}
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="changebillable_ext_wrap" width="100%">
|
||||
<div id ="changebillable_ext" width="100%">
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user