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:
11
extensions/ki_invoice/TinyButStrong/README
Normal file
11
extensions/ki_invoice/TinyButStrong/README
Normal file
@@ -0,0 +1,11 @@
|
||||
Patched tinyDoc.class.php:
|
||||
===========================================
|
||||
function deltree ~ line 435:
|
||||
// if (realpath($dir) == realpath(DIRECTORY_SEPARATOR))
|
||||
if (realpath($dir) == DIRECTORY_SEPARATOR)
|
||||
|
||||
|
||||
function setProcessDir ~ line 900:
|
||||
// if (realpath($processDir) == realpath(DIRECTORY_SEPARATOR))
|
||||
if (realpath($processDir) == DIRECTORY_SEPARATOR)
|
||||
|
||||
5694
extensions/ki_invoice/TinyButStrong/pclzip.lib.php
Normal file
5694
extensions/ki_invoice/TinyButStrong/pclzip.lib.php
Normal file
File diff suppressed because it is too large
Load Diff
3335
extensions/ki_invoice/TinyButStrong/tinyButStrong.class.php
Normal file
3335
extensions/ki_invoice/TinyButStrong/tinyButStrong.class.php
Normal file
File diff suppressed because it is too large
Load Diff
1283
extensions/ki_invoice/TinyButStrong/tinyDoc.class.php
Normal file
1283
extensions/ki_invoice/TinyButStrong/tinyDoc.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
<?php /* Smarty version 2.6.20, created on 2015-01-18 19:30:02
|
||||
compiled from timespan.tpl */ ?>
|
||||
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
|
||||
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'date_format', 'timespan.tpl', 1, false),array('modifier', 'escape', 'timespan.tpl', 1, false),)), $this); ?>
|
||||
<?php echo $this->_tpl_vars['kga']['lang']['ext_invoice']['invoiceTimePeriod']; ?>
|
||||
<b><?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['in'])) ? $this->_run_mod_handler('date_format', true, $_tmp, $this->_tpl_vars['kga']['date_format']['2']) : smarty_modifier_date_format($_tmp, $this->_tpl_vars['kga']['date_format']['2'])))) ? $this->_run_mod_handler('escape', true, $_tmp, 'html') : smarty_modifier_escape($_tmp, 'html')); ?>
|
||||
- <?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['out'])) ? $this->_run_mod_handler('date_format', true, $_tmp, $this->_tpl_vars['kga']['date_format']['2']) : smarty_modifier_date_format($_tmp, $this->_tpl_vars['kga']['date_format']['2'])))) ? $this->_run_mod_handler('escape', true, $_tmp, 'html') : smarty_modifier_escape($_tmp, 'html')); ?>
|
||||
</b>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php /* Smarty version 2.6.20, created on 2018-11-07 16:18:14
|
||||
compiled from main.tpl */ ?>
|
||||
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
|
||||
smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', 'main.tpl', 25, false),array('modifier', 'replace', 'main.tpl', 41, false),array('modifier', 'escape', 'main.tpl', 41, false),)), $this); ?>
|
||||
<?php echo '
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
iv_ext_onload();
|
||||
$(\'#editVatLink\').click(function () {
|
||||
this.blur();
|
||||
floaterShow(iv_ext_path + "floaters.php","editVat",0,0,250,100);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
'; ?>
|
||||
|
||||
|
||||
<div id="iv_ext_header">
|
||||
<strong><?php echo $this->_tpl_vars['kga']['lang']['ext_invoice']['invoiceTitle']; ?>
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div id="iv_ext_wrap">
|
||||
<div id ="iv_ext">
|
||||
|
||||
<form id="iv_ext_form" method="post" action="../extensions/ki_invoice/print.php" target="_blank">
|
||||
<div id="iv_ext_advanced">
|
||||
<div id="iv_ext_form">
|
||||
<?php echo $this->_tpl_vars['kga']['lang']['ext_invoice']['invoiceProject']; ?>
|
||||
|
||||
<select id="iv_pct_ID" name="pct_ID" class="formfield">
|
||||
<?php echo smarty_function_html_options(array('values' => $this->_tpl_vars['sel_pct_IDs'],'output' => $this->_tpl_vars['sel_pct_names'],'selected' => $this->_tpl_vars['pres_pct']), $this);?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div id="iv_timespan">
|
||||
<?php echo $this->_tpl_vars['timespan_display']; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<!--Work in Progress: Select box for form type-->
|
||||
Invoice Form:
|
||||
<select id="iv_form_docs" name="ivform_file" class="formfield">
|
||||
<?php echo smarty_function_html_options(array('values' => $this->_tpl_vars['sel_form_files'],'output' => $this->_tpl_vars['sel_form_files'],'selected' => $this->_tpl_vars['pres_form']), $this);?>
|
||||
|
||||
</select><br/><br/>
|
||||
|
||||
|
||||
<!-- Some boxes below are checked by default. Delete "checked" to set default to unchecked condition -->
|
||||
|
||||
<?php echo $this->_tpl_vars['kga']['lang']['ext_invoice']['defaultVat']; ?>
|
||||
: <span id="defaultVat"><?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['kga']['conf']['defaultVat'])) ? $this->_run_mod_handler('replace', true, $_tmp, '.', $this->_tpl_vars['kga']['conf']['decimalSeparator']) : smarty_modifier_replace($_tmp, '.', $this->_tpl_vars['kga']['conf']['decimalSeparator'])))) ? $this->_run_mod_handler('escape', true, $_tmp, 'html') : smarty_modifier_escape($_tmp, 'html')); ?>
|
||||
</span> % <a id="editVatLink" href="#">(<?php echo $this->_tpl_vars['kga']['lang']['change']; ?>
|
||||
)</a> <br/>
|
||||
<input type=checkbox name="short" checked> <?php echo $this->_tpl_vars['kga']['lang']['ext_invoice']['invoiceOptionShort']; ?>
|
||||
<br/>
|
||||
<input type=checkbox name="round" checked> <?php echo $this->_tpl_vars['kga']['lang']['ext_invoice']['invoiceOptionRound']; ?>
|
||||
|
||||
<select id="iv_round_ID" name="pct_round" class="formfield">
|
||||
<?php echo smarty_function_html_options(array('values' => $this->_tpl_vars['sel_round_IDs'],'output' => $this->_tpl_vars['sel_round_names'],'selected' => $this->_tpl_vars['pres_round']), $this);?>
|
||||
|
||||
</select>
|
||||
|
||||
<div id="iv_button">
|
||||
<input type="submit" class="btn_ok" value=<?php echo $this->_tpl_vars['kga']['lang']['ext_invoice']['invoiceButton']; ?>
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php /* Smarty version 2.6.20, created on 2019-01-29 12:08:53
|
||||
compiled from editVat.tpl */ ?>
|
||||
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
|
||||
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'replace', 'editVat.tpl', 49, false),array('modifier', 'escape', 'editVat.tpl', 49, false),)), $this); ?>
|
||||
<?php echo '
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$(\'#iv_ext_editVat\').ajaxForm(function() {
|
||||
floaterClose();
|
||||
});
|
||||
|
||||
// prepare Options Object
|
||||
var options = {
|
||||
success: function(response) {
|
||||
if (response == 1) {
|
||||
$(\'#defaultVat\').html($(\'#vat\').val());
|
||||
}
|
||||
floaterClose();
|
||||
}
|
||||
};
|
||||
|
||||
// pass options to ajaxForm
|
||||
$(\'#iv_ext_editVat\').ajaxForm(options);
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
'; ?>
|
||||
|
||||
|
||||
<div id="floater_innerwrap">
|
||||
|
||||
<div id="floater_handle">
|
||||
<span id="floater_title"><?php echo $this->_tpl_vars['kga']['lang']['editVat']; ?>
|
||||
</span>
|
||||
<div class="right">
|
||||
<a href="#" class="close" onClick="floaterClose();"><?php echo $this->_tpl_vars['kga']['lang']['close']; ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="floater_content">
|
||||
|
||||
|
||||
<form id="iv_ext_editVat" action="../extensions/ki_invoice/processor.php" method="post">
|
||||
<input name="id" type="hidden" value="0" />
|
||||
<input name="axAction" type="hidden" value="editVat" />
|
||||
<fieldset>
|
||||
|
||||
|
||||
|
||||
|
||||
<label for="vat"><?php echo $this->_tpl_vars['kga']['lang']['vat']; ?>
|
||||
</label>
|
||||
<input size="4" name="vat" id="vat" type="text" value="<?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['kga']['conf']['defaultVat'])) ? $this->_run_mod_handler('replace', true, $_tmp, '.', $this->_tpl_vars['kga']['conf']['decimalSeparator']) : smarty_modifier_replace($_tmp, '.', $this->_tpl_vars['kga']['conf']['decimalSeparator'])))) ? $this->_run_mod_handler('escape', true, $_tmp, 'html') : smarty_modifier_escape($_tmp, 'html')); ?>
|
||||
"/> %
|
||||
|
||||
<div id="formbuttons">
|
||||
<input class='btn_norm' type='button' value='<?php echo $this->_tpl_vars['kga']['lang']['cancel']; ?>
|
||||
' onClick='floaterClose(); return false;' />
|
||||
<input class='btn_ok' type='submit' value='<?php echo $this->_tpl_vars['kga']['lang']['submit']; ?>
|
||||
'/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
16
extensions/ki_invoice/config.ini
Normal file
16
extensions/ki_invoice/config.ini
Normal file
@@ -0,0 +1,16 @@
|
||||
EXTENSION_NAME = "Invoice"
|
||||
EXTENSION_KEY = "ki_invoice"
|
||||
EXTENSION_INIT_FILE = "ki_invoice/init.php"
|
||||
EXTENSION_DIR = "ki_invoice"
|
||||
|
||||
ADMIN_ALLOWED = "1"
|
||||
GROUP_LEADER_ALLOWED = "1"
|
||||
USER_ALLOWED = "1"
|
||||
CUSTOMER_ALLOWED = "0"
|
||||
|
||||
JS_INCLUDE_FILES[] = "../extensions/ki_invoice/js/iv_init.js"
|
||||
JS_INCLUDE_FILES[] = "../extensions/ki_invoice/js/iv_func.js"
|
||||
CSS_INCLUDE_FILES = "../extensions/ki_invoice/css/styles.css.php"
|
||||
|
||||
TAB_CHANGE_TRIGGER = "iv_ext_triggerchange();"
|
||||
TIMESPACE_CHANGE_TRIGGER = "iv_ext_triggerTSS();"
|
||||
50
extensions/ki_invoice/css/styles.css.php
Normal file
50
extensions/ki_invoice/css/styles.css.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
header('Content-type: text/css');
|
||||
$table_header = "../../../skins/standard/grfx/g3_table_header.png";
|
||||
?>
|
||||
|
||||
#iv_ext_wrap {
|
||||
border:1px solid #000;
|
||||
border-top:none;
|
||||
position:absolute;
|
||||
overflow:hidden;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
#iv_ext {
|
||||
padding:10px;
|
||||
font-size: 20px;
|
||||
background-color: #eee;
|
||||
color:#000;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
|
||||
#iv_ext_header {
|
||||
background-image: url('<?php echo $table_header; ?>');
|
||||
border:1px solid #000;
|
||||
color:#fff;
|
||||
padding:5px 10px;
|
||||
height:20px;
|
||||
overflow:hidden;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
#iv_ext_advanced {
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
#iv_timespan {
|
||||
padding: 20px 0px;
|
||||
}
|
||||
|
||||
|
||||
#iv_button {
|
||||
padding: 20px 0px;
|
||||
}
|
||||
|
||||
#iv_screenshot
|
||||
{
|
||||
float:left;
|
||||
margin-right:10px;
|
||||
}
|
||||
40
extensions/ki_invoice/floaters.php
Normal file
40
extensions/ki_invoice/floaters.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// insert KSPI
|
||||
$isCoreProcessor = 0;
|
||||
$dir_templates = "templates/floaters/";
|
||||
require("../../includes/kspi.php");
|
||||
|
||||
switch ($axAction) {
|
||||
|
||||
case "editVat":
|
||||
if (isset($kga['customer'])) die();
|
||||
|
||||
$tpl->assign('kga',$kga);
|
||||
|
||||
$tpl->display("editVat.tpl");
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
BIN
extensions/ki_invoice/grfx/OpenOffice.png
Normal file
BIN
extensions/ki_invoice/grfx/OpenOffice.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
75
extensions/ki_invoice/init.php
Normal file
75
extensions/ki_invoice/init.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
// ==================================
|
||||
// = implementing standard includes =
|
||||
// ==================================
|
||||
include('../../includes/basics.php');
|
||||
|
||||
// libs TinyButStrong
|
||||
include_once('TinyButStrong/tinyButStrong.class.php');
|
||||
include_once('TinyButStrong/tinyDoc.class.php');
|
||||
|
||||
$usr = checkUser();
|
||||
|
||||
// set smarty config
|
||||
require_once('../../libraries/smarty/Smarty.class.php');
|
||||
$tpl = new Smarty();
|
||||
$tpl->template_dir = 'templates/';
|
||||
$tpl->compile_dir = 'compile/';
|
||||
|
||||
$tpl->assign('kga', $kga);
|
||||
|
||||
// get list of projects for select box
|
||||
$sel = makeSelectBox("pct",$kga['usr']['usr_grp']);
|
||||
$tpl->assign('sel_pct_names', $sel[0]);
|
||||
$tpl->assign('sel_pct_IDs', $sel[1]);
|
||||
|
||||
// Select values for Round Time option
|
||||
$tpl->assign('sel_round_names', array('0.1h', '0.25h', '0.5h', '1.0h') );
|
||||
$tpl->assign('sel_round_IDs', array(1, 2.5, 5, 10) );
|
||||
|
||||
// Get Invoice Template FileNames
|
||||
|
||||
$iv_tmp_arr = Array();
|
||||
$handle = opendir('templates/');
|
||||
while (false!== ($file = readdir($handle))) {
|
||||
if ($file!= "." && $file!= ".." &&!is_dir($file)) {
|
||||
$namearr = explode('.',$file);
|
||||
if ($namearr[count($namearr)-1] == 'odt') $iv_tmp_arr[] = $file;
|
||||
if ($namearr[count($namearr)-1] == 'ods') $iv_tmp_arr[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
sort($iv_tmp_arr);
|
||||
$tpl->assign('sel_form_files', $iv_tmp_arr);
|
||||
|
||||
|
||||
|
||||
// Retrieve start & stop times
|
||||
$timespace = get_timespace();
|
||||
$tpl->assign('in', $timespace[0]);
|
||||
$tpl->assign('out', $timespace[1]);
|
||||
|
||||
$tpl->assign('timespan_display', $tpl->fetch("timespan.tpl"));
|
||||
|
||||
$tpl->display('main.tpl');
|
||||
|
||||
?>
|
||||
54
extensions/ki_invoice/js/iv_func.js
Normal file
54
extensions/ki_invoice/js/iv_func.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
function iv_ext_onload() {
|
||||
|
||||
iv_ext_resize();
|
||||
$("#loader").hide();
|
||||
|
||||
}
|
||||
|
||||
function iv_ext_resize() {
|
||||
|
||||
scroller_width = 17;
|
||||
if (navigator.platform.substr(0,3)=='Mac') {
|
||||
scroller_width = 16;
|
||||
}
|
||||
pagew = pageWidth()-15;
|
||||
|
||||
$("#iv_ext_header").css("width", pagew-27);
|
||||
$("#iv_ext_header").css("top", headerHeight());
|
||||
$("#iv_ext_header").css("left", 10);
|
||||
|
||||
$("#iv_ext_wrap").css("top", headerHeight()+30);
|
||||
$("#iv_ext_wrap").css("left", 10);
|
||||
$("#iv_ext_wrap").css("width", pagew-7);
|
||||
$("#iv_ext").css("height", pageHeight()-headerHeight()-64);
|
||||
}
|
||||
|
||||
function iv_ext_triggerchange() {
|
||||
iv_ext_resize();
|
||||
}
|
||||
|
||||
function iv_ext_triggerTSS() {
|
||||
$.post(iv_ext_path + "processor.php", { axAction: "reload_timespan" },
|
||||
function(data) {
|
||||
$("#iv_timespan").html(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
26
extensions/ki_invoice/js/iv_init.js
Normal file
26
extensions/ki_invoice/js/iv_init.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// ===========
|
||||
// IV EXT init
|
||||
// ===========
|
||||
|
||||
// set path of extension
|
||||
var iv_ext_path = "../extensions/ki_invoice/";
|
||||
|
||||
var iv_tss_hook_flag = 0;
|
||||
205
extensions/ki_invoice/print.php
Normal file
205
extensions/ki_invoice/print.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
include_once('../../includes/basics.php');
|
||||
|
||||
// libs TinyButStrong
|
||||
include_once('TinyButStrong/tinyButStrong.class.php');
|
||||
include_once('TinyButStrong/tinyDoc.class.php');
|
||||
|
||||
include_once('private_db_layer_'.$kga['server_conn'].'.php');
|
||||
|
||||
/**
|
||||
* returns true if event is in the arrays
|
||||
*
|
||||
* @param $arrays
|
||||
* @return true if $event is in the array
|
||||
* @author AA
|
||||
*/
|
||||
function array_event_exists($arrays, $event) {
|
||||
$index = 0;
|
||||
foreach ($arrays as $array) {
|
||||
if ( in_array($event,$array) ) {
|
||||
return $index;
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function RoundValue( $value, $prec ) {
|
||||
$precision = $prec;
|
||||
|
||||
// suppress division by zero errror
|
||||
if ($precision == 0.0) {
|
||||
$precision = 1.0;
|
||||
}
|
||||
|
||||
return floor($value / $precision + 0.5)*$precision;
|
||||
}
|
||||
|
||||
// insert KSPI
|
||||
$isCoreProcessor = 0;
|
||||
$dir_templates = "templates/";
|
||||
$usr = checkUser();
|
||||
$timespace = get_timespace();
|
||||
$in = $timespace[0];
|
||||
$out = $timespace[1];
|
||||
|
||||
$timeArray = get_arr_zef($in, $out, null, null, array($_REQUEST['pct_ID']), 1);
|
||||
/* $timeArray now contains: zef_ID, zef_in, zef_out, zef_time, zef_rate, zef_pctID,
|
||||
zef_evtID, zef_usrID, pct_ID, knd_name, pct_kndID, evt_name, pct_comment,
|
||||
pct_name, zef_location, zef_trackingnr, zef_comment, zef_comment_type,
|
||||
usr_name, usr_alias, zef_cleared
|
||||
*/
|
||||
|
||||
$date = date("m-d-Y");
|
||||
$month = $kga['lang']['months'][date("n", $out)-1];
|
||||
$year = date("Y", $out );
|
||||
|
||||
if (count($timeArray) > 0) {
|
||||
// customer data
|
||||
$kndArray = get_entry_knd($timeArray[0]['knd_name']);
|
||||
$project = html_entity_decode($timeArray[0]['pct_name']);
|
||||
$customerName = html_entity_decode($timeArray[0]['knd_name']);
|
||||
$companyName = $kndArray['knd_company'];
|
||||
$customerStreet = $kndArray['knd_street'];
|
||||
$customerCity = $kndArray['knd_city'];
|
||||
$customerZip = $kndArray['knd_zipcode'];
|
||||
$customerComment = $kndArray['knd_comment'];
|
||||
$customerPhone = $kndArray['knd_tel'];
|
||||
$customerFax = $kndArray['knd_fax'];
|
||||
$customerMobile = $kndArray['knd_mobile'];
|
||||
$customerEmail = $kndArray['knd_mail'];
|
||||
$customerContact = $kndArray['knd_homepage']; //I'm using the "homepage" field to store client contact name
|
||||
$beginDate = date("F j, Y", $in);
|
||||
$endDate = date("F j, Y", $out);
|
||||
$invoiceID = $customerName. "-" . date("y", $in). "-" . date("m", $in);
|
||||
$today = date("F j, Y");
|
||||
$dueDate = date("F j, Y", mktime(0, 0, 0, date("m") + 1, date("d"), date("Y")));
|
||||
} else {
|
||||
echo '<script language="javascript">alert("'.$kga['lang']['ext_invoice']['noData'].'")</script>';
|
||||
return;
|
||||
}
|
||||
|
||||
// MERGE SORT
|
||||
$time_index = 0;
|
||||
$invoiceArray = array();
|
||||
|
||||
while ($time_index < count($timeArray)) {
|
||||
$wage = $timeArray[$time_index]['wage'];
|
||||
$time = $timeArray[$time_index]['zef_time']/3600;
|
||||
$event = html_entity_decode($timeArray[$time_index]['evt_name']);
|
||||
$comment = $timeArray[$time_index]['zef_comment'];
|
||||
$evtdt = date("m/d/Y", $timeArray[$time_index]['zef_in']);
|
||||
|
||||
// do we have to create a short form?
|
||||
if ( isset($_REQUEST['short']) ) {
|
||||
|
||||
$index = array_event_exists($invoiceArray,$event);
|
||||
if ( $index >= 0 ) {
|
||||
$totalTime = $invoiceArray[$index]['hour'];
|
||||
$totalAmount = $invoiceArray[$index]['amount'];
|
||||
$invoiceArray[$index] = array(
|
||||
'desc' => $event,
|
||||
'hour' => $totalTime+$time,
|
||||
"amount" => $totalAmount+$wage,
|
||||
'date' => $evtdt,
|
||||
'comment' => $comment
|
||||
);
|
||||
}
|
||||
else {
|
||||
$invoiceArray[] = array('desc'=>$event, 'hour'=>$time, 'amount'=>$wage, 'date'=>$evtdt, 'comment'=>$comment);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$invoiceArray[] = array('desc'=>$event, 'hour'=>$time, 'amount'=>$wage, 'date'=>$evtdt, 'comment'=>$comment);
|
||||
}
|
||||
$time_index++;
|
||||
}
|
||||
|
||||
$round = 0;
|
||||
// do we have to round the time ?
|
||||
if (isset($_REQUEST['round'])) {
|
||||
$round = $_REQUEST['pct_round'];
|
||||
$time_index = 0;
|
||||
$amount = count($invoiceArray);
|
||||
|
||||
while ($time_index < $amount) {
|
||||
$rounded = RoundValue( $invoiceArray[$time_index]['hour'], $round/10);
|
||||
|
||||
// Write a logfile entry for each value that is rounded.
|
||||
logfile("Round ". $invoiceArray[$time_index]['hour'] . " to " . $rounded . " with ". $round);
|
||||
|
||||
$rate = RoundValue($invoiceArray[$time_index]['amount']/$invoiceArray[$time_index]['hour'],0.05);
|
||||
$invoiceArray[$time_index]['hour'] = $rounded;
|
||||
$invoiceArray[$time_index]['amount'] = $invoiceArray[$time_index]['hour']*$rate;
|
||||
$time_index++;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate invoice sums
|
||||
$ttltime = 0;
|
||||
$gtotal = 0;
|
||||
while (list($id, $fd) = each($invoiceArray)) {
|
||||
$gtotal += $invoiceArray[$id]['amount'];
|
||||
$ttltime += $invoiceArray[$id]['hour'];
|
||||
}
|
||||
|
||||
$vat_rate = $kndArray['knd_vat'];
|
||||
if (!is_numeric($vat_rate)) {
|
||||
$vat_rate = $kga['conf']['defaultVat'];
|
||||
}
|
||||
|
||||
$vat = $vat_rate*$gtotal/100;
|
||||
$total = $gtotal-$vat;
|
||||
$doc = new tinyDoc();
|
||||
|
||||
// use zip extension if available
|
||||
if (class_exists('ZipArchive')) {
|
||||
$doc->setZipMethod('ziparchive');
|
||||
}
|
||||
else {
|
||||
$doc->setZipMethod('shell');
|
||||
try {
|
||||
$doc->setZipBinary('zip');
|
||||
$doc->setUnzipBinary('unzip');
|
||||
}
|
||||
catch (tinyDocException $e) {
|
||||
$doc->setZipMethod('pclzip');
|
||||
}
|
||||
}
|
||||
|
||||
$doc->setProcessDir('../../temporary');
|
||||
|
||||
//This is where the template is selected
|
||||
|
||||
$templateform = "templates/" . $_REQUEST['ivform_file'];
|
||||
$doc->createFrom($templateform);
|
||||
|
||||
$doc->loadXml('content.xml');
|
||||
|
||||
$doc->mergeXmlBlock('row', $invoiceArray);
|
||||
|
||||
$doc->saveXml();
|
||||
$doc->close();
|
||||
|
||||
// send and remove the document
|
||||
$doc->sendResponse();
|
||||
$doc->remove();
|
||||
43
extensions/ki_invoice/private_db_layer_mysql.php
Normal file
43
extensions/ki_invoice/private_db_layer_mysql.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* returns the data of a costumer
|
||||
*
|
||||
* @param integer $name name of costumer in table
|
||||
* @global array $kga kimai-global-array
|
||||
* @return array
|
||||
* @author sl
|
||||
*/
|
||||
function get_entry_knd($id) {
|
||||
global $kga, $conn;
|
||||
$p = $kga['server_prefix'];
|
||||
|
||||
$filter['knd_name'] = MySQL::SQLValue($id);
|
||||
|
||||
$result = $conn->SelectRows($kga['server_prefix'].'knd', $filter,null,null,true,1);
|
||||
|
||||
if (! $result)
|
||||
return false;
|
||||
|
||||
return $conn->RowArray(0,MYSQL_ASSOC);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
41
extensions/ki_invoice/private_db_layer_pdo.php
Normal file
41
extensions/ki_invoice/private_db_layer_pdo.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* returns the data of a costumer
|
||||
*
|
||||
* @param integer $name name of costumer in table
|
||||
* @global array $kga kimai-global-array
|
||||
* @return array
|
||||
* @author AA
|
||||
*/
|
||||
function get_entry_knd($id) {
|
||||
global $kga, $pdo_conn;
|
||||
$p = $kga['server_prefix'];
|
||||
|
||||
$pdo_query = $pdo_conn->prepare("SELECT * FROM ${p}knd
|
||||
WHERE knd_name = ? LIMIT 1;");
|
||||
|
||||
$pdo_query->execute(array($id));
|
||||
$row = $pdo_query->fetch(PDO::FETCH_ASSOC);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
64
extensions/ki_invoice/processor.php
Normal file
64
extensions/ki_invoice/processor.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of
|
||||
* Kimai - Open Source Time Tracking // http://www.kimai.org
|
||||
* (c) 2006-2009 Kimai-Development-Team
|
||||
*
|
||||
* Kimai is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; Version 3, 29 June 2007
|
||||
*
|
||||
* Kimai is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Kimai; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// =====================
|
||||
// = INVOICE PROCESSOR =
|
||||
// =====================
|
||||
|
||||
// insert KSPI
|
||||
$isCoreProcessor = 0;
|
||||
$dir_templates = "templates/";
|
||||
require("../../includes/kspi.php");
|
||||
|
||||
// ==================
|
||||
// = handle request =
|
||||
// ==================
|
||||
switch ($axAction) {
|
||||
|
||||
// =====================================
|
||||
// = Reload the timespan and return it =
|
||||
// =====================================
|
||||
case 'reload_timespan':
|
||||
|
||||
$timespace = get_timespace();
|
||||
$tpl->assign('in', $timespace[0]);
|
||||
$tpl->assign('out', $timespace[1]);
|
||||
|
||||
$tpl->display("timespan.tpl");
|
||||
break;
|
||||
|
||||
// ==========================
|
||||
// = Change the default vat =
|
||||
// ==========================
|
||||
case 'editVat':
|
||||
|
||||
$vat = str_replace($kga['conf']['decimalSeparator'],'.',$_REQUEST['vat']);
|
||||
|
||||
if (!is_numeric($vat)) {
|
||||
echo "0";
|
||||
return;
|
||||
}
|
||||
|
||||
var_edit(array('defaultVat'=>$vat));
|
||||
echo "1";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
BIN
extensions/ki_invoice/templates/01_Long_invoice_Gen.odt
Normal file
BIN
extensions/ki_invoice/templates/01_Long_invoice_Gen.odt
Normal file
Binary file not shown.
BIN
extensions/ki_invoice/templates/02_Short_invoice_Gen.odt
Normal file
BIN
extensions/ki_invoice/templates/02_Short_invoice_Gen.odt
Normal file
Binary file not shown.
BIN
extensions/ki_invoice/templates/03_Spreadsheet_Invoice.ods
Normal file
BIN
extensions/ki_invoice/templates/03_Spreadsheet_Invoice.ods
Normal file
Binary file not shown.
BIN
extensions/ki_invoice/templates/04_invoiceVAT.odt
Normal file
BIN
extensions/ki_invoice/templates/04_invoiceVAT.odt
Normal file
Binary file not shown.
61
extensions/ki_invoice/templates/floaters/editVat.tpl
Normal file
61
extensions/ki_invoice/templates/floaters/editVat.tpl
Normal file
@@ -0,0 +1,61 @@
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#iv_ext_editVat').ajaxForm(function() {
|
||||
floaterClose();
|
||||
});
|
||||
|
||||
// prepare Options Object
|
||||
var options = {
|
||||
success: function(response) {
|
||||
if (response == 1) {
|
||||
$('#defaultVat').html($('#vat').val());
|
||||
}
|
||||
floaterClose();
|
||||
}
|
||||
};
|
||||
|
||||
// pass options to ajaxForm
|
||||
$('#iv_ext_editVat').ajaxForm(options);
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
<div id="floater_innerwrap">
|
||||
|
||||
<div id="floater_handle">
|
||||
<span id="floater_title">{$kga.lang.editVat}</span>
|
||||
<div class="right">
|
||||
<a href="#" class="close" onClick="floaterClose();">{$kga.lang.close}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="floater_content">
|
||||
|
||||
|
||||
<form id="iv_ext_editVat" action="../extensions/ki_invoice/processor.php" method="post">
|
||||
<input name="id" type="hidden" value="0" />
|
||||
<input name="axAction" type="hidden" value="editVat" />
|
||||
<fieldset>
|
||||
|
||||
{* -------------------------------------------------------------------- *}
|
||||
|
||||
|
||||
<label for="vat">{$kga.lang.vat}</label>
|
||||
<input size="4" name="vat" id="vat" type="text" value="{$kga.conf.defaultVat|replace:'.':$kga.conf.decimalSeparator|escape:'html'}"/> %
|
||||
|
||||
<div id="formbuttons">
|
||||
<input class='btn_norm' type='button' value='{$kga.lang.cancel}' onClick='floaterClose(); return false;' />
|
||||
<input class='btn_ok' type='submit' value='{$kga.lang.submit}'/>
|
||||
</div>
|
||||
|
||||
{* -------------------------------------------------------------------- *}
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
BIN
extensions/ki_invoice/templates/invoice.odt
Normal file
BIN
extensions/ki_invoice/templates/invoice.odt
Normal file
Binary file not shown.
BIN
extensions/ki_invoice/templates/invoiceVAT.odt
Normal file
BIN
extensions/ki_invoice/templates/invoiceVAT.odt
Normal file
Binary file not shown.
55
extensions/ki_invoice/templates/main.tpl
Normal file
55
extensions/ki_invoice/templates/main.tpl
Normal file
@@ -0,0 +1,55 @@
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
iv_ext_onload();
|
||||
$('#editVatLink').click(function () {
|
||||
this.blur();
|
||||
floaterShow(iv_ext_path + "floaters.php","editVat",0,0,250,100);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
<div id="iv_ext_header">
|
||||
<strong>{$kga.lang.ext_invoice.invoiceTitle}</strong>
|
||||
</div>
|
||||
|
||||
<div id="iv_ext_wrap">
|
||||
<div id ="iv_ext">
|
||||
|
||||
<form id="iv_ext_form" method="post" action="../extensions/ki_invoice/print.php" target="_blank">
|
||||
<div id="iv_ext_advanced">
|
||||
<div id="iv_ext_form">
|
||||
{$kga.lang.ext_invoice.invoiceProject}
|
||||
<select id="iv_pct_ID" name="pct_ID" class="formfield">
|
||||
{html_options values=$sel_pct_IDs output=$sel_pct_names selected=$pres_pct}
|
||||
</select>
|
||||
</div>
|
||||
<div id="iv_timespan">
|
||||
{$timespan_display}
|
||||
</div>
|
||||
|
||||
<!--Work in Progress: Select box for form type-->
|
||||
Invoice Form:
|
||||
<select id="iv_form_docs" name="ivform_file" class="formfield">
|
||||
{html_options values=$sel_form_files output=$sel_form_files selected=$pres_form}
|
||||
</select><br/><br/>
|
||||
|
||||
|
||||
<!-- Some boxes below are checked by default. Delete "checked" to set default to unchecked condition -->
|
||||
|
||||
{$kga.lang.ext_invoice.defaultVat}: <span id="defaultVat">{$kga.conf.defaultVat|replace:'.':$kga.conf.decimalSeparator|escape:'html'}</span> % <a id="editVatLink" href="#">({$kga.lang.change})</a> <br/>
|
||||
<input type=checkbox name="short" checked> {$kga.lang.ext_invoice.invoiceOptionShort}<br/>
|
||||
<input type=checkbox name="round" checked> {$kga.lang.ext_invoice.invoiceOptionRound}
|
||||
<select id="iv_round_ID" name="pct_round" class="formfield">
|
||||
{html_options values=$sel_round_IDs output=$sel_round_names selected=$pres_round}
|
||||
</select>
|
||||
|
||||
<div id="iv_button">
|
||||
<input type="submit" class="btn_ok" value={$kga.lang.ext_invoice.invoiceButton}>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
1
extensions/ki_invoice/templates/timespan.tpl
Normal file
1
extensions/ki_invoice/templates/timespan.tpl
Normal file
@@ -0,0 +1 @@
|
||||
{$kga.lang.ext_invoice.invoiceTimePeriod} <b>{$in|date_format:$kga.date_format.2|escape:'html'} - {$out|date_format:$kga.date_format.2|escape:'html'}</b>
|
||||
Reference in New Issue
Block a user