Subversion Repositories public

Compare Revisions

Regard whitespace Rev 3 → Rev 4

/pm/trunk/verrmist.php
0,0 → 1,385
<?php
require_once('version.inc');
require_once('dbaccess.inc');
require_once('language.inc');
 
$onLoad = GetAddIst();
require_once('header.inc');
require_once('crypt.inc');
require_once('settings.inc');
require_once('helper.inc');
 
$drm = array(true, false, false, false, true, true, true, true);
 
require_once('menu.inc');
 
$func = $_REQUEST['func'];
 
function GetAddIst() {
$minum = $_REQUEST['minum'];
$pr_num = $_REQUEST['pr_num'];
$ta_num = $_REQUEST['ta_num'];
$datum = $_REQUEST['datum'];
 
$script = " onLoad=\"javascript:";
$hidden = "vr_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "v=CheckTrue(window.opener.document.ist.$hidden.value);document.addist.wd_verr.checked=v;document.addist.wd_verr.value=v;";
$hidden = "rk_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "v=CheckTrue(window.opener.document.ist.$hidden.value);document.addist.wd_rk.checked=v;document.addist.wd_rk.value=v;";
$hidden = "am_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_amount.value=FormatNum(window.opener.document.ist.$hidden.value,2);";
$hidden = "wh_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_whg.value=window.opener.document.ist.$hidden.value;";
$hidden = "tx_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.wd_text.value=window.opener.document.ist.$hidden.value;";
$hidden = "ds_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_date_start.value=window.opener.document.ist.$hidden.value;";
$hidden = "de_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_date_end.value=window.opener.document.ist.$hidden.value;";
$hidden = "ts_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_time_start.value=window.opener.document.ist.$hidden.value;";
$hidden = "te_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_time_end.value=window.opener.document.ist.$hidden.value;";
$hidden = "ta_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_target.value=window.opener.document.ist.$hidden.value;";
$hidden = "pu_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_purpose.value=window.opener.document.ist.$hidden.value;";
$hidden = "pn_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "v=CheckTrue(window.opener.document.ist.$hidden.value);document.addist.dr_pnightr.checked=v;document.addist.dr_pnightr.value=v;";
$hidden = "ni_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_nightr.value=FormatNum(window.opener.document.ist.$hidden.value,2);";
$hidden = "mc_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_kmcar.value=window.opener.document.ist.$hidden.value;";
$hidden = "kf_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_kfzkenn.value=window.opener.document.ist.$hidden.value;";
$hidden = "md_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_kmdrain.value=window.opener.document.ist.$hidden.value;";
$hidden = "pp_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "v=CheckTrue(window.opener.document.ist.$hidden.value);document.addist.dr_pkmplain.checked=v;document.addist.dr_pkmplain.value=v;";
$hidden = "mp_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_kmplain.value=FormatNum(window.opener.document.ist.$hidden.value,2);";
$hidden = "cl_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_costloc.value=window.opener.document.ist.$hidden.value;";
$hidden = "rm_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "document.addist.dr_remark.value=window.opener.document.ist.$hidden.value;";
$script .= "if (document.addist.wd_rk.checked) st = false; else st = true;".
"document.addist.dr_date_start.disabled = st;".
"document.addist.dr_date_end.disabled = st;".
"document.addist.dr_time_start.disabled = st;".
"document.addist.dr_time_end.disabled = st;".
"document.addist.dr_target.disabled = st;".
"document.addist.dr_purpose.disabled = st;".
"document.addist.dr_pnightr.disabled = st;".
"document.addist.dr_nightr.disabled = st;".
"document.addist.dr_kmcar.disabled = st;".
"document.addist.dr_kfzkenn.disabled = st;".
"document.addist.dr_kmdrain.disabled = st;".
"document.addist.dr_pkmplain.disabled = st;".
"document.addist.dr_kmplain.disabled = st;".
"document.addist.dr_remark.disabled = st;".
"if (document.addist.dr_pnightr.checked) document.addist.dr_nightr.disabled = true;".
"if (document.addist.dr_pkmplain.checked) document.addist.dr_kmplain.disabled = true;\"";
 
return $script;
}
 
function SaveAddIst() {
$minum = $_REQUEST['minum'];
$pr_num = $_REQUEST['pr_num'];
$ta_num = $_REQUEST['ta_num'];
$datum = $_REQUEST['datum'];
 
$hidden = "vr_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script = "window.opener.document.ist.$hidden.value = document.addist.wd_verr.checked;";
$hidden = "rk_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.wd_rk.checked;";
$hidden = "am_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_amount.value.replace(/,/, '.');";
$hidden = "nu_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_num.value;";
$hidden = "wh_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_whg.value;";
$hidden = "tx_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.wd_text.value;";
$hidden = "ds_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_date_start.value;";
$hidden = "de_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_date_end.value;";
$hidden = "ts_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_time_start.value;";
$hidden = "te_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_time_end.value;";
$hidden = "ta_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_target.value;";
$hidden = "pu_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_purpose.value;";
$hidden = "pn_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_pnightr.checked;";
$hidden = "ni_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_nightr.value.replace(/,/, '.');";
$hidden = "mc_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_kmcar.value;";
$hidden = "kf_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_kfzkenn.value;";
$hidden = "md_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_kmdrain.value;";
$hidden = "pp_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_pkmplain.checked;";
$hidden = "mp_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_kmplain.value.replace(/,/, '.');";
$hidden = "cl_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_costloc.value;";
$hidden = "rm_" . $minum . "_" . $pr_num . "_" . $ta_num . "_" . $datum;
$script .= "window.opener.document.ist.$hidden.value = document.addist.dr_remark.value;";
$script .= "window.opener.document.getElementById('message').style.visibility = 'visible';";
$script .= "window.opener.DocChanged = true;";
 
return $script;
}
 
function AddIst() {
global $stdwhg;
global $pmlight;
 
$menu = $_REQUEST['menu'];
$headline = $_REQUEST['headline'];
$minum = $_REQUEST['minum'];
$pr_num = $_REQUEST['pr_num'];
$ta_num = $_REQUEST['ta_num'];
$datum = $_REQUEST['datum'];
 
if (!isset($minum) || $minum <= 0) {
Error("AddIst: Interner Fehler: Mitarbeiternummer fehlt!");
return;
}
 
if (!isset($pr_num) || $pr_num <= 0) {
Error("AddIst: Interner Fehler: Projektnummer fehlt!");
return;
}
 
if (!isset($ta_num) || $ta_num <= 0) {
Error("AddIst: Interner Fehler: Tasknummer fehlt!");
return;
}
 
if (!isset($wd_verr))
$wd_verr = true;
 
if (!isset($dr_whg) || $dr_whg <= 0)
$dr_whg = $stdwhg;
 
if (!isset($dr_amount))
$dr_amount = 0.0;
 
$script = "if (this.checked) st = false; else st = true;".
"document.addist.dr_date_start.disabled = st;".
"document.addist.dr_date_end.disabled = st;".
"document.addist.dr_time_start.disabled = st;".
"document.addist.dr_time_end.disabled = st;".
"document.addist.dr_target.disabled = st;".
"document.addist.dr_purpose.disabled = st;".
"document.addist.dr_pnightr.disabled = st;".
"document.addist.dr_nightr.disabled = st;".
"document.addist.dr_kmcar.disabled = st;".
"document.addist.dr_kfzkenn.disabled = st;".
"document.addist.dr_kmdrain.disabled = st;".
"document.addist.dr_pkmplain.disabled = st;".
"document.addist.dr_kmplain.disabled = st;".
"document.addist.dr_remark.disabled = st;".
"if (document.addist.dr_pnightr.checked) document.addist.dr_nightr.disabled = true;".
"else document.addist.dr_nightr.disabled = false;".
"if (document.addist.dr_pkmplain.checked) document.addist.dr_kmplain.disabled = true;".
"else document.addist.dr_kmplain.disabled = false;";
 
$db = OpenDB();
?>
<form name="addist" action="verrmist.php" method="post">
<input type="hidden" name="menu" value="<? echo "$menu"; ?>">
<input type="hidden" name="headline" value="<? echo "$headline"; ?>">
<input type="hidden" name="minum" value="<? echo "$minum"; ?>">
<input type="hidden" name="pr_num" value="<? echo "$pr_num"; ?>">
<input type="hidden" name="ta_num" value="<? echo "$ta_num"; ?>">
<input type="hidden" name="datum" value="<? echo "$datum"; ?>">
<input type="hidden" name="dr_num" value="<? echo "$dr_num"; ?>">
<table class="input">
<tr>
<th class="sel" colspan=2>Zusatzdaten zum IST-Aufwand</th>
</tr>
<tr>
<td>Zeitaufwand ist verrechenbar:</td>
<td><input type="checkbox" name="wd_verr" value="false"></td>
</tr>
<tr>
<td>Reisekosten angefallen:</td>
<td><input type="checkbox" name="wd_rk" value="false" onChange="javascript:<? echo "$script"; ?>"></td>
</tr>
<tr>
<td>Sonderkosten, Spesen, etc.:</td>
<td><input type="text" name="dr_amount" size=16 maxlength=16></td>
</tr>
<tr>
<td valign="top">Bemerkung zum IST-Aufwand:</td>
<td><textarea name="wd_text" cols=60 rows=5></textarea>
</td>
</tr>
<tr>
<th class="sel" colspan=2>Allgemeines</th>
</tr>
<tr>
<td>Kostenstelle</td>
<td><select name="dr_costloc">
<?
$query = "select kc_num, kc_costloc from key_costloc order by kc_num";
 
if (!($result = QueryDB($db, $query))) {
closeDB($db);
return;
}
 
$rows = numrowsDB($result);
$j = 0;
 
while ($j < $rows) {
$data = fetchDB($result, $j);
$kc_num = $data[0];
$kc_costloc = $data[1];
echo "<option value=\"$kc_num\"";
 
if ($kc_num == $dr_costloc)
echo " selected";
 
echo ">$kc_num: $kc_costloc</option>\n";
$j++;
}
?>
</select>
</td>
</tr>
<tr>
<td>W&auml;hrung:</td>
<td><select name="dr_whg">
<?
$query = "select wh_num, wh_whg, wh_bez from key_whg order by wh_num";
 
if (!($result = QueryDB($db, $query))) {
closeDB($db);
return;
}
 
$rows = numrowsDB($result);
$j = 0;
 
while ($j < $rows) {
$data = fetchDB($result, $j);
$wh_num = $data[0];
$wh_whg = $data[1];
$wh_bez = $data[2];
echo "<option value=\"$wh_num\"";
 
if ($wh_num == $dr_whg)
echo " selected";
 
echo ">$wh_whg $wh_bez</option>\n";
$j++;
}
?>
</select>
</td>
</tr>
<tr>
<th class="sel" colspan=2>Reisekostenabrechnung</th>
</tr>
<tr>
<td>Beginndatum der Reise:</td>
<td><input type="text" class="inputmust" name="dr_date_start" size=10 maxlength=10 <? if (!$pmlight) echo "readOnly"; ?>></td>
</tr>
<tr>
<td>Uhrzeit des Reiseantritts:</td>
<td><input type="text" class="inputmust" name="dr_time_start" size=5 maxlength=5 onChange="javascript:CheckTime(this)"></td>
</tr>
<tr>
<td>R&uuml;ckkehrdatum der Reise:</td>
<td><input type="text" class="inputmust" name="dr_date_end" size=10 maxlength=10 onChange="javascript:CheckDate(this)"></td>
</tr>
<tr>
<td>Uhrzeit der R&uuml;ckkehr:</td>
<td><input type="text" class="inputmust" name="dr_time_end" size=5 maxlength=5 onChange="javascript:CheckTime(this)"></td>
</tr>
<tr>
<td>Zielort / Land der Reise:</td>
<td><input type="text" class="inputmust" name="dr_target" size=40 maxlength=60></td>
</tr>
<tr>
<td>Grund der Reise:</td>
<td><input type="text" class="inputmust" name="dr_purpose" size=40 maxlength=60></td>
</tr>
<tr>
<td>N&auml;chtigungspauschale verwenden:</td>
<td><input type="checkbox" name="dr_pnightr" value="false" onChange="javascript:if (this.checked) st = true; else st = false;document.addist.dr_nightr.disabled = st;"></td>
<tr>
<tr>
<td>N&auml;chtigungbetrag (Hotelrechnung):</td>
<td><input type="text" name="dr_nightr" size=16 maxlength=16></td>
</tr>
<tr>
<td>Anzahl gefahrene Kilometer (PKW):</td>
<td><input type="text" name="dr_kmcar" size=4 maxlength=4></td>
</tr>
<tr>
<td>KFZ Kennzeichen:</td>
<td><input type="text" name="dr_kfzkenn" size=16 maxlength=16></td>
</tr>
<tr>
<td>Anzahl gefahrene Kilometer (Zug):</td>
<td><input type="text" name="dr_kmdrain" size=4 maxlength=4></td>
</tr>
<tr>
<td>Flugpauschale verwenden:</td>
<td><input type="checkbox" name="dr_pkmplain" value="false" onChange="javascript:if (this.checked) st = true; else st = false;document.addist.dr_kmplain.disabled = st;"></td>
</tr>
<tr>
<td>Angefallene Flugkosten:</td>
<td><input type="text" name="dr_kmplain" size=16 maxlength=16></td>
</tr>
<tr>
<td valign="top">Bemerkung zu den Reisekosten:</td>
<td><textarea name="dr_remark" cols=60 rows=5></textarea>
</td>
</tr>
</table>
<table class="indent"><tr><td>
<?
$script = SaveAddIst();
?>
<table class="button" cellpadding=0 cellspacing=0>
<tr>
<td><img src="nav/button_left.png" height="24px" alt=""></td>
<td class="button">
<?
echo "<a href=\"#\" class=\"menu\" onClick=\"javascript:$script document.addist.submit();window.close()\">Merken</a>\n";
?>
<td><img src="nav/button_right.png" height="24px" alt=""></td>
<td>&nbsp;&nbsp;</td>
<td><img src="nav/button_left.png" height="24px" alt=""></td>
<td class="button">
<a href="#" class="menu" onClick="javascript:document.addist.reset()">Zur&uuml;cksetzen</a>
</td>
<td><img src="nav/button_right.png" height="24px" alt=""></td>
<td>&nbsp;&nbsp;</td>
<td><img src="nav/button_left.png" height="24px" alt=""></td>
<td class="button">
<a href="#" class="menu" onClick="javascript:window.close()">Fenster schlie&szlig;en</a>
</td>
<td><img src="nav/button_right.png" height="24px" alt=""></td>
</tr>
</table>
<?
}
 
if ($func == "AddIst")
AddIst();
 
require_once('footer.inc');
?>