FasOnline Kontoverwaltung

This commit is contained in:
Andreas Österreicher
2007-05-15 15:07:31 +00:00
parent c1e79d0bf7
commit b854c80a49
11 changed files with 766 additions and 29 deletions
+1
View File
@@ -226,6 +226,7 @@ function onVerbandSelect(event)
StudentDetailReset();
StudentDetailDisableFields(true);
StudentPrestudentDisableFields(true);
StudentKontoDisableFields(true);
}
catch(e)
{
+151
View File
@@ -40,6 +40,7 @@ require_once('../../include/student.class.php');
require_once('../../include/prestudent.class.php');
require_once('../../include/studiengang.class.php');
require_once('../../include/akte.class.php');
require_once('../../include/konto.class.php');
$user = get_uid();
@@ -656,6 +657,156 @@ if(!$error)
$errormsg = 'Fehlerhafte Parameteruebergabe'.$_POST['akte_id'];
}
}
elseif(isset($_POST['type']) && $_POST['type']=='savebuchung') // ***** KONTO *****
{
//Speichert eine Buchung
if(isset($_POST['buchungsnr']) && is_numeric($_POST['buchungsnr']))
{
$buchung = new konto($conn, null, true);
if($buchung->load($_POST['buchungsnr']))
{
$buchung->betrag = $_POST['betrag'];
$buchung->buchungsdatum = $_POST['buchungsdatum'];
$buchung->buchungstext = $_POST['buchungstext'];
$buchung->mahnspanne = $_POST['mahnspanne'];
$buchung->buchungstyp_kurzbz = $_POST['buchungstyp_kurzbz'];
$buchung->new = false;
$buchung->updateamum = date('Y-m-d H:i:s');
$buchung->updatevon = $user;
if($buchung->save())
{
$return = true;
}
else
{
$return = false;
$errormsg = 'Fehler beim Speicher:'.$buchung->errormsg;
}
}
else
{
$errormsg = 'Buchung wurde nicht gefunden:'.$_POST['buchungsnr'];
$return = false;
}
}
else
{
$return = false;
$errormsg = 'Fehlerhafte Parameteruebergabe'.$_POST['buchungsnr'];
}
}
elseif(isset($_POST['type']) && $_POST['type']=='savegegenbuchung')
{
//Speichert eine Buchung
if(isset($_POST['buchungsnr']) && is_numeric($_POST['buchungsnr']))
{
$buchung = new konto($conn, null, true);
if($buchung->load($_POST['buchungsnr']))
{
if($buchung->buchungsnr_verweis=='')
{
$buchung->betrag = $buchung->betrag*(-1);
$buchung->buchungsdatum = date('Y-m-d');
$buchung->mahnspanne = '0';
$buchung->buchungsnr_verweis = $buchung->buchungsnr;
$buchung->new = true;
$buchung->insertamum = date('Y-m-d H:i:s');
$buchung->insertvon = $user;
if($buchung->save())
{
$return = true;
}
else
{
$return = false;
$errormsg = 'Fehler beim Speichern:'.$buchung->errormsg;
}
}
else
{
$return = false;
$errormsg = 'Gegenbuchungen koennen nur auf die obersten Buchungen getaetigt werden';
}
}
else
{
$errormsg = 'Buchung wurde nicht gefunden:'.$_POST['buchungsnr'];
$return = false;
}
}
else
{
$return = false;
$errormsg = 'Fehlerhafte Parameteruebergabe'.$_POST['buchungsnr'];
}
}
elseif(isset($_POST['type']) && $_POST['type']=='deletebuchung')
{
//Loescht eine Buchung
if(isset($_POST['buchungsnr']) && is_numeric($_POST['buchungsnr']))
{
$buchung = new konto($conn, null, true);
if($buchung->delete($_POST['buchungsnr']))
{
$return = true;
}
else
{
$errormsg = $buchung->errormsg;
$return = false;
}
}
else
{
$return = false;
$errormsg = 'Fehlerhafte Parameteruebergabe'.$_POST['buchungsnr'];
}
}
elseif(isset($_POST['type']) && $_POST['type']=='neuebuchung')
{
//Speichert eine neue Buchung
//Gleichzeitiges speichern mehrerer Personen ist moeglich
//Personen werden durch ';' getrennt
$person_ids = explode(';',$_POST['person_ids']);
$errormsg = '';
foreach ($person_ids as $person_id)
{
if($person_id!='')
{
$buchung = new konto($conn, null, true);
$buchung->person_id = $person_id;
$buchung->studiengang_kz = $_POST['studiengang_kz'];
$buchung->studiensemester_kurzbz = $semester_aktuell;
$buchung->buchungsnr_verweis='';
$buchung->betrag = $_POST['betrag'];
$buchung->buchungsdatum = $_POST['buchungsdatum'];
$buchung->buchungstext = $_POST['buchungstext'];
$buchung->mahnspanne = $_POST['mahnspanne'];
$buchung->buchungstyp_kurzbz = $_POST['buchungstyp_kurzbz'];
$buchung->insertamum = date('Y-m-d H:i:s');
$buchung->insertvon = $user;
$buchung->new = true;
if($buchung->save())
{
$data = $buchung->buchungsnr;
}
else
{
$errormsg .= "Fehler bei $person_id: $buchung->errormsg\n";
}
}
}
if($errormsg=='')
$return = true;
else
$return = false;
}
else
{
$return = false;
+1
View File
@@ -57,6 +57,7 @@ echo '<?xul-overlay href="'.APP_ROOT.'content/student/studentkontooverlay.xul.ph
<!--<toolbarbutton id="student-toolbar-neu" label="Neuer Student" oncommand="StudentNeu();" disabled="true" image="../skin/images/NeuDokument.png" tooltiptext="Student neu anlegen" />-->
<!--<toolbarbutton id="student-toolbar-del" label="Löschen" oncommand="StudentDelete();" disabled="true" image="../skin/images/DeleteIcon.png" tooltiptext="Student löschen"/>-->
<toolbarbutton id="student-toolbar-refresh" label="Aktualisieren" oncommand="StudentTreeRefresh()" disabled="false" image="../skin/images/refresh.png" tooltiptext="Liste neu laden"/>
<toolbarbutton id="student-toolbar-buchung" label="Neue Buchung" oncommand="StudentKontoNeu()" disabled="false" tooltiptext="neue Buchung anlegen"/>
<spacer flex="1"/>
<label id="student-toolbar-label-anzahl"/>
</toolbar>
@@ -0,0 +1,82 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program 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; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
require_once('../../vilesci/config.inc.php');
require_once('../../include/functions.inc.php');
$conn = pg_pconnect(CONN_STRING);
$user = get_uid();
loadVariables($conn, $user);
?>
var studiengang_kz=''; // enthaelt die Studiengangskennzahl
var person_ids=''; // enthaelt eine durch ';' getrennte Liste an Personen_ids
// ****
// * Ermittelt die markierten Personen und den aktuellen Studiengang
// ****
function StudentKontoNeuInit()
{
var tree = window.opener.document.getElementById('student-tree')
var start = new Object();
var end = new Object();
var numRanges = tree.view.selection.getRangeCount();
var paramList= '';
var anzahl=0;
//alle markierten personen holen
for (var t = 0; t < numRanges; t++)
{
tree.view.selection.getRangeAt(t,start,end);
for (var v = start.value; v <= end.value; v++)
{
col = tree.columns ? tree.columns["student-treecol-person_id"] : "student-treecol-person_id";
uid = tree.view.getCellText(v,col);
paramList += ';'+uid;
anzahl +=1;
}
}
//Studiengang holen
var tree=window.opener.document.getElementById('tree-verband');
col = tree.columns ? tree.columns["stg_kz"] : "stg_kz";
studiengang_kz=tree.view.getCellText(tree.currentIndex,col);
person_ids = paramList;
if(anzahl>1)
document.getElementById('student-konto-neu-label').value='Anzahl Studenten: '+anzahl;
}
// ****
// * Speichern der Buchung
// * Hierzu wird eine Funktion vom Aufrufenden Fenster gestartet weil
// * es dann nicht zu Problemen mit den Zugriffen auf die anderen Fkt
// * kommt.
// ****
function StudentKontoNeuSpeichern()
{
if(window.opener.StudentKontoNeuSpeichern(document, person_ids, studiengang_kz))
window.close();
}
@@ -0,0 +1,99 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program 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; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
header("Cache-Control: no-cache");
header("Cache-Control: post-check=0, pre-check=0",false);
header("Expires Mon, 26 Jul 1997 05:00:00 GMT");
header("Pragma: no-cache");
header("Content-type: application/vnd.mozilla.xul+xml");
include('../../vilesci/config.inc.php');
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
echo '<?xml-stylesheet href="'.APP_ROOT.'skin/tempus.css" type="text/css"?>';
?>
<window id="student-konto-neu-dialog" title="Neu"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="StudentKontoNeuInit()"
>
<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/student/studentkontoneudialog.js.php" />
<vbox>
<groupbox id="student-konto-neu-groupbox" flex="1">
<caption label="Details"/>
<label id="student-konto-neu-label"/>
<grid id="student-konto-neu-grid-detail" style="overflow:auto;margin:4px;" flex="1">
<columns >
<column flex="1"/>
<column flex="5"/>
</columns>
<rows>
<row>
<label value="Betrag" control="student-konto-neu-textbox-betrag"/>
<hbox>
<textbox id="student-konto-neu-textbox-betrag" value="-0.0" maxlength="9" size="9"/>
<spacer flex="1" />
</hbox>
</row>
<row>
<label value="Buchungsdatum" control="student-konto-neu-textbox-buchungsdatum"/>
<hbox>
<textbox id="student-konto-neu-textbox-buchungsdatum" value="<?php echo date('Y-m-d');?>" maxlength="10" size="10"/>
<spacer flex="1" />
</hbox>
</row>
<row>
<label value="Buchungstext" control="student-konto-neu-textbox-buchungstext"/>
<textbox id="student-konto-neu-textbox-buchungstext" maxlength="256"/>
</row>
<row>
<label value="Mahnspanne" control="student-konto-neu-textbox-mahnspanne"/>
<hbox>
<textbox id="student-konto-neu-textbox-mahnspanne" value="30" maxlength="4" size="4"/>
<spacer flex="1" />
</hbox>
</row>
<row>
<label value="Typ" control="student-konto-neu-menulist-buchungstyp"/>
<menulist id="student-konto-neu-menulist-buchungstyp"
datasources="<?php echo APP_ROOT ?>rdf/buchungstyp.rdf.php" flex="1"
ref="http://www.technikum-wien.at/buchungstyp/liste" >
<template>
<menupopup>
<menuitem value="rdf:http://www.technikum-wien.at/buchungstyp/rdf#buchungstyp_kurzbz"
label="rdf:http://www.technikum-wien.at/buchungstyp/rdf#beschreibung"
uri="rdf:*"/>
</menupopup>
</template>
</menulist>
</row>
</rows>
</grid>
<hbox>
<spacer flex="1" />
<button id="student-konto-neu-button-speichern" oncommand="StudentKontoNeuSpeichern()" label="Speichern" />
</hbox>
</groupbox>
</vbox>
</window>
+15 -6
View File
@@ -38,7 +38,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
<vbox id="student-konto" style="margin:0px;" flex="1">
<popupset>
<popup id="student-konto-tree-popup">
<menuitem label="Entfernen" oncommand="StudentKontoDel();" id="student-konto-tree-popup-kontodel" hidden="false"/>
<menuitem label="Entfernen" oncommand="StudentKontoDelete();" id="student-konto-tree-popup-kontodel" hidden="false"/>
</popup>
</popupset>
<hbox flex="1">
@@ -51,7 +51,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
<row>
<hbox>
<spacer flex="1" />
<button id="student-konto-button-filter" label="offene" disabled="true"/>
<button id="student-konto-button-filter" value="alle" oncommand="StudentKontoFilter()" label="offene" disabled="true"/>
</hbox>
<spacer />
</row>
@@ -83,6 +83,10 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
class="sortDirectionIndicator"
sort="rdf:http://www.technikum-wien.at/konto/rdf#studiensemester_kurzbz" />
<splitter class="tree-splitter"/>
<treecol id="student-konto-tree-buchungstyp_kurzbz" label="Typ" flex="2" hidden="true"
class="sortDirectionIndicator"
sort="rdf:http://www.technikum-wien.at/konto/rdf#buchungstyp_kurzbz" />
<splitter class="tree-splitter"/>
<treecol id="student-konto-tree-buchungsnr" label="buchungs_nr" flex="2" hidden="true"
class="sortDirectionIndicator"
sort="rdf:http://www.technikum-wien.at/konto/rdf#buchungsnr" />
@@ -97,6 +101,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
<treecell label="rdf:http://www.technikum-wien.at/konto/rdf#buchungstext"/>
<treecell label="rdf:http://www.technikum-wien.at/konto/rdf#betrag"/>
<treecell label="rdf:http://www.technikum-wien.at/konto/rdf#studiensemester_kurzbz"/>
<treecell label="rdf:http://www.technikum-wien.at/konto/rdf#buchungstyp_kurzbz"/>
<treecell label="rdf:http://www.technikum-wien.at/konto/rdf#buchungsnr"/>
</treerow>
</treeitem>
@@ -105,10 +110,14 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
</tree>
<vbox>
<hbox>
<button id="student-konto-button-neu" label="Neu" disabled="true"/>
<button id="student-konto-button-gegenbuchung" label="Gegenbuchung" disabled="true"/>
<button id="student-konto-button-loeschen" label="Loeschen" disabled="true"/>
<button id="student-konto-button-neu" label="Neu" oncommand="StudentKontoNeu();" disabled="true"/>
<button id="student-konto-button-gegenbuchung" label="Gegenbuchung" oncommand="StudentKontoGegenbuchung();" disabled="true"/>
<button id="student-konto-button-loeschen" label="Loeschen" oncommand="StudentKontoDelete();" disabled="true"/>
</hbox>
<vbox hidden="true">
<label value="Buchungsnr" control="student-konto-textbox-buchungsnr"/>
<textbox id="student-konto-textbox-buchungsnr" disabled="true"/>
</vbox>
<groupbox id="student-konto-groupbox" flex="1">
<caption label="Details"/>
<grid id="student-konto-grid-detail" style="overflow:auto;margin:4px;" flex="1">
@@ -160,7 +169,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
</grid>
<hbox>
<spacer flex="1" />
<button id="student-konto-button-speichern" label="Speichern" disabled="true"/>
<button id="student-konto-button-speichern" oncommand="StudentKontoDetailSpeichern()" label="Speichern" disabled="true"/>
</hbox>
</groupbox>
</vbox>
+342 -5
View File
@@ -30,6 +30,8 @@ loadVariables($conn, $user);
?>
// *********** Globale Variablen *****************//
var StudentSelectUid=null; //Student der nach dem Refresh markiert werden soll
var StudentKontoSelectBuchung=null; //Buchung die nach dem Refresh markiert werden soll
var StudentKontoTreeDatasource;
// ********** Observer und Listener ************* //
@@ -67,6 +69,39 @@ var StudentTreeListener =
}
};
// ****
// * Observer fuer Konto Tree
// * startet Rebuild nachdem das Refresh
// * der datasource fertig ist
// ****
var StudentKontoTreeSinkObserver =
{
onBeginLoad : function(pSink) {},
onInterrupt : function(pSink) {},
onResume : function(pSink) {},
onError : function(pSink, pStatus, pError) {},
onEndLoad : function(pSink)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
document.getElementById('student-konto-tree').builder.rebuild();
}
};
// ****
// * Nach dem Rebuild wird die Buchung wieder
// * markiert
// ****
var StudentKontoTreeListener =
{
willRebuild : function(builder) { },
didRebuild : function(builder)
{
//timeout nur bei Mozilla notwendig da sonst die rows
//noch keine values haben. Ab Seamonkey funktionierts auch
//ohne dem setTimeout
window.setTimeout(StudentKontoTreeSelectBuchung,10);
}
};
// ***************** KEY Events ************************* //
// ****
@@ -144,6 +179,50 @@ function StudentTreeSelectStudent()
document.getElementById('student-toolbar-label-anzahl').value='Anzahl: '+items;
}
// ****
// * Selectiert die Buchung nachdem der Tree
// * rebuildet wurde.
// ****
function StudentKontoTreeSelectBuchung()
{
var tree=document.getElementById('student-konto-tree');
if(tree.view)
var items = tree.view.rowCount; //Anzahl der Zeilen ermitteln
else
return false;
//In der globalen Variable ist die zu selektierende Buchung gespeichert
if(StudentKontoTreeSelectBuchung!=null)
{
//Alle subtrees oeffnen weil rowCount nur die Anzahl der sichtbaren
//Zeilen zurueckliefert
for(var i=items-1;i>=0;i--)
{
if(!tree.view.isContainerOpen(i))
tree.view.toggleOpenState(i);
}
//Jetzt die wirkliche Anzahl (aller) Zeilen holen
items = tree.view.rowCount;
for(var i=0;i<items;i++)
{
//buchungsnr der row holen
col = tree.columns ? tree.columns["student-konto-tree-buchungsnr"] : "student-konto-tree-buchungsnr";
buchungsnr=tree.view.getCellText(i,col);
//wenn dies die zu selektierende Zeile
if(buchungsnr == StudentKontoTreeSelectBuchung)
{
//Zeile markieren
tree.view.selection.select(i);
//Sicherstellen, dass die Zeile im sichtbaren Bereich liegt
tree.treeBoxObject.ensureRowIsVisible(i);
return true;
}
}
}
}
// ****
// * Student loeschen
// ****
@@ -454,6 +533,7 @@ function StudentAuswahl()
//loeschen button aktivieren
StudentDetailDisableFields(false);
StudentPrestudentDisableFields(false);
StudentKontoDisableFields(false);
document.getElementById('student-detail-button-save').disabled=false;
}
else
@@ -637,9 +717,10 @@ function StudentAuswahl()
var datasource = rdfService.GetDataSource(url);
rollentree.database.AddDataSource(datasource);
//Zeugnis
//Konto
kontotree = document.getElementById('student-konto-tree');
url='<?php echo APP_ROOT;?>rdf/konto.rdf.php?person_id='+person_id+"&"+gettimestamp();
filter = document.getElementById('student-konto-button-filter').value;
url='<?php echo APP_ROOT;?>rdf/konto.rdf.php?person_id='+person_id+"&filter="+filter+"&"+gettimestamp();
//Alte DS entfernen
var oldDatasources = kontotree.database.GetDataSources();
@@ -651,8 +732,12 @@ function StudentAuswahl()
kontotree.builder.rebuild();
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
var datasource = rdfService.GetDataSource(url);
kontotree.database.AddDataSource(datasource);
StudentKontoTreeDatasource = rdfService.GetDataSource(url);
StudentKontoTreeDatasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
StudentKontoTreeDatasource.QueryInterface(Components.interfaces.nsIRDFXMLSink);
kontotree.database.AddDataSource(StudentKontoTreeDatasource);
StudentKontoTreeDatasource.addXMLSinkObserver(StudentKontoTreeSinkObserver);
kontotree.builder.addListener(StudentKontoTreeListener);
//Zeugnis
zeugnistree = document.getElementById('student-zeugnis-tree');
@@ -880,6 +965,8 @@ function StudentKontoAuswahl()
var tree = document.getElementById('student-konto-tree');
if (tree.currentIndex==-1) return;
StudentKontoDetailDisableFields(false);
//Ausgewaehlte Nr holen
var col = tree.columns ? tree.columns["student-konto-tree-buchungsnr"] : "student-konto-tree-buchungsnr";
@@ -914,9 +1001,259 @@ function StudentKontoAuswahl()
document.getElementById('student-konto-textbox-buchungstext').value=buchungstext;
document.getElementById('student-konto-textbox-mahnspanne').value=mahnspanne;
document.getElementById('student-konto-menulist-buchungstyp').value=buchungstyp_kurzbz;
document.getElementById('student-konto-textbox-buchungsnr').value=buchungsnr;
}
function StudentKontoDisableFields(val)
// ****
// * Aendert den Filter fuer den Konto Tree und Refresht ihn dann
// ****
function StudentKontoFilter()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
filter = document.getElementById('student-konto-button-filter');
if(filter.value=='offene')
{
filter.value='alle';
filter.label='offene';
}
else
{
filter.value='offene';
filter.label='alle';
}
//Konto Tree mit neuem Filter laden
kontotree = document.getElementById('student-konto-tree');
person_id = document.getElementById('student-prestudent-textbox-person_id').value
url='<?php echo APP_ROOT;?>rdf/konto.rdf.php?person_id='+person_id+"&filter="+filter.value+"&"+gettimestamp();
//Alte DS entfernen
var oldDatasources = kontotree.database.GetDataSources();
while(oldDatasources.hasMoreElements())
{
kontotree.database.RemoveDataSource(oldDatasources.getNext());
}
//Refresh damit die entfernten DS auch wirklich entfernt werden
kontotree.builder.rebuild();
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
StudentKontoTreeDatasource = rdfService.GetDataSource(url);
StudentKontoTreeDatasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
StudentKontoTreeDatasource.QueryInterface(Components.interfaces.nsIRDFXMLSink);
kontotree.database.AddDataSource(StudentKontoTreeDatasource);
StudentKontoTreeDatasource.addXMLSinkObserver(StudentKontoTreeSinkObserver);
kontotree.builder.addListener(StudentKontoTreeListener);
}
// ****
// * Aktiviert / Deaktiviert die Konto Felder
// ****
function StudentKontoDisableFields(val)
{
document.getElementById('student-konto-button-filter').disabled=val;
document.getElementById('student-konto-button-neu').disabled=val;
document.getElementById('student-konto-button-gegenbuchung').disabled=val;
document.getElementById('student-konto-button-loeschen').disabled=val;
StudentKontoDetailDisableFields(true);
}
// ****
// * Aktiviert / Deaktiviert die Kontodetail Felder
// ****
function StudentKontoDetailDisableFields(val)
{
document.getElementById('student-konto-textbox-betrag').disabled=val;
document.getElementById('student-konto-textbox-buchungsdatum').disabled=val;
document.getElementById('student-konto-textbox-buchungstext').disabled=val;
document.getElementById('student-konto-textbox-mahnspanne').disabled=val;
document.getElementById('student-konto-menulist-buchungstyp').disabled=val;
document.getElementById('student-konto-button-speichern').disabled=val;
}
// ****
// * Speichert die Buchung
// ****
function StudentKontoDetailSpeichern()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
betrag = document.getElementById('student-konto-textbox-betrag').value;
buchungsdatum = document.getElementById('student-konto-textbox-buchungsdatum').value;
buchungstext = document.getElementById('student-konto-textbox-buchungstext').value;
mahnspanne = document.getElementById('student-konto-textbox-mahnspanne').value;
buchungstyp_kurzbz = document.getElementById('student-konto-menulist-buchungstyp').value;
buchungsnr = document.getElementById('student-konto-textbox-buchungsnr').value;
var url = '<?php echo APP_ROOT ?>content/student/studentDBDML.php';
var req = new phpRequest(url,'','');
req.add('type', 'savebuchung');
req.add('betrag', betrag);
req.add('buchungsdatum', buchungsdatum);
req.add('buchungstext', buchungstext);
req.add('mahnspanne', mahnspanne);
req.add('buchungstyp_kurzbz', buchungstyp_kurzbz);
req.add('buchungsnr', buchungsnr);
var response = req.executePOST();
var val = new ParseReturnValue(response)
if (!val.dbdml_return)
{
if(val.dbdml_errormsg=='')
alert(response)
else
alert(val.dbdml_errormsg)
}
else
{
StudentSelectUid=document.getElementById('student-detail-textbox-uid').value;
StudentTreeDatasource.Refresh(false); //non blocking
SetStatusBarText('Daten wurden gespeichert');
}
}
// ****
// * Legt eine Gegenbuchung zu einer Buchung an
// ****
function StudentKontoGegenbuchung()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var tree = document.getElementById('student-konto-tree');
if (tree.currentIndex==-1) return;
StudentKontoDetailDisableFields(false);
//Ausgewaehlte Nr holen
var col = tree.columns ? tree.columns["student-konto-tree-buchungsnr"] : "student-konto-tree-buchungsnr";
var buchungsnr=tree.view.getCellText(tree.currentIndex,col);
var url = '<?php echo APP_ROOT ?>content/student/studentDBDML.php';
var req = new phpRequest(url,'','');
req.add('type', 'savegegenbuchung');
req.add('buchungsnr', buchungsnr);
var response = req.executePOST();
var val = new ParseReturnValue(response)
if (!val.dbdml_return)
{
if(val.dbdml_errormsg=='')
alert(response)
else
alert(val.dbdml_errormsg)
}
else
{
StudentSelectUid=document.getElementById('student-detail-textbox-uid').value;
StudentTreeDatasource.Refresh(false); //non blocking
SetStatusBarText('Daten wurden gespeichert');
}
}
// ****
// * Loescht eine Buchung
// ****
function StudentKontoDelete()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var tree = document.getElementById('student-konto-tree');
if (tree.currentIndex==-1) return;
StudentKontoDetailDisableFields(false);
//Ausgewaehlte Nr holen
var col = tree.columns ? tree.columns["student-konto-tree-buchungsnr"] : "student-konto-tree-buchungsnr";
var buchungsnr=tree.view.getCellText(tree.currentIndex,col);
if(confirm('Diese Buchung wirklich loeschen?'))
{
var url = '<?php echo APP_ROOT ?>content/student/studentDBDML.php';
var req = new phpRequest(url,'','');
req.add('type', 'deletebuchung');
req.add('buchungsnr', buchungsnr);
var response = req.executePOST();
var val = new ParseReturnValue(response)
if (!val.dbdml_return)
{
if(val.dbdml_errormsg=='')
alert(response)
else
alert(val.dbdml_errormsg)
}
else
{
StudentSelectUid=document.getElementById('student-detail-textbox-uid').value;
StudentTreeDatasource.Refresh(false); //non blocking
SetStatusBarText('Daten wurden gespeichert');
}
}
}
// ****
// * Ruft einen Dialog zum Anlegen von Buchungen auf
// ****
function StudentKontoNeu()
{
window.open("<?php echo APP_ROOT; ?>content/student/studentkontoneudialog.xul.php","","chrome, status=no, width=500, height=350, centerscreen, resizable");
}
// ****
// * Speichert die Daten aus dem BuchungenDialog
// ****
function StudentKontoNeuSpeichern(dialog, person_ids, studiengang_kz)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var url = '<?php echo APP_ROOT ?>content/student/studentDBDML.php';
var req = new phpRequest(url,'','');
//Daten aus dem Dialog holen
betrag = dialog.getElementById('student-konto-neu-textbox-betrag').value;
buchungsdatum = dialog.getElementById('student-konto-neu-textbox-buchungsdatum').value;
buchungstext = dialog.getElementById('student-konto-neu-textbox-buchungstext').value;
mahnspanne = dialog.getElementById('student-konto-neu-textbox-mahnspanne').value;
buchungstyp_kurzbz = dialog.getElementById('student-konto-neu-menulist-buchungstyp').value;
req.add('type', 'neuebuchung');
req.add('person_ids', person_ids);
req.add('studiengang_kz', studiengang_kz);
req.add('betrag', betrag);
req.add('buchungsdatum', buchungsdatum);
req.add('buchungstext', buchungstext);
req.add('mahnspanne', mahnspanne);
req.add('buchungstyp_kurzbz', buchungstyp_kurzbz);
var response = req.executePOST();
var val = new ParseReturnValue(response)
if (!val.dbdml_return)
{
if(val.dbdml_errormsg=='')
alert(response)
else
alert(val.dbdml_errormsg)
return false;
}
else
{
StudentKontoTreeDatasource.Refresh(false);
return true;
}
}
+61 -13
View File
@@ -132,8 +132,39 @@ class konto
// * Prueft die Variablen auf gueltigkeit
// * @return true wenn ok, false im Fehlerfall
// *******************************************
function checkvars()
function validate()
{
$this->betrag = str_replace(',','.',$this->betrag);
if(!is_numeric($this->betrag))
{
$this->errormsg = 'Betrag ist ungueltig';
return false;
}
if(!is_numeric($this->studiengang_kz))
{
$this->errormsg = 'Studiengang_kz is ungueltig';
return false;
}
if($this->buchungstyp_kurzbz=='')
{
$this->errormsg = 'Typ muss angegeben werden';
return false;
}
if(!is_numeric($this->person_id))
{
$this->errormsg = 'Person_id ist ungueltig';
return false;
}
if(!is_numeric($this->mahnspanne))
{
$this->errormsg = 'Mahnspanne muss eine gueltige Zahl sein';
return false;
}
return true;
}
@@ -158,7 +189,7 @@ class konto
function save($new=null)
{
//Variablen pruefen
if(!$this->checkvars())
if(!$this->validate())
return false;
if($new==null)
@@ -201,7 +232,8 @@ class konto
' updatevon='.$this->addslashes($this->updatevon).','.
' insertamum='.$this->addslashes($this->insertamum).','.
' insertvon='.$this->addslashes($this->insertvon).','.
' ext_id='.$this->addslashes($this->ext_id).';';
' ext_id='.$this->addslashes($this->ext_id).
" WHERE buchungsnr='".addslashes($this->buchungsnr)."';";
}
//echo $qry;
@@ -241,18 +273,18 @@ class konto
}
}
/**
* Loescht den Datenensatz mit der ID die uebergeben wird
* @param buchungsnr ID die geloescht werden soll
* @return true wenn ok, false im Fehlerfall
*/
// ********************************************************
// * Loescht den Datenensatz mit der ID die uebergeben wird
// * @param buchungsnr ID die geloescht werden soll
// * @return true wenn ok, false im Fehlerfall
// ********************************************************
function delete($buchungsnr)
{
//Pruefen ob Verweise auf diese Buchung Vorhanden sind
$qry = "SELECT count(*) as anzahl FROM public.tbl_konto WHERE buchungsnr_verweis='".addslashes($buchungsnr)."'";
if($result = pg_query($this->conn, $qry))
{
if($row = pg_fetch_object($this->conn, $qry))
if($row = pg_fetch_object($result))
{
if($row->anzahl>0)
{
@@ -262,7 +294,7 @@ class konto
else
{
//Wenn keine Verweise Vorhanden sind, dann die Buchung loeschen
$qry = "DELETE FROM public.tbl_konto WHERE buchungsnr_verweis='".addslashes($buchungsnr)."'";
$qry = "DELETE FROM public.tbl_konto WHERE buchungsnr='".addslashes($buchungsnr)."'";
if(pg_query($this->conn, $qry))
return true;
else
@@ -288,10 +320,10 @@ class konto
// ******************************************
// * Laedt alle Buchungen einer Person
// * und legt diese geordnet in ein Array
// * @param person_id
// * @param person_id, filter
// * @return true wenn ok, false wenn fehler
// ******************************************
function getBuchungen($person_id)
function getBuchungen($person_id, $filter='alle')
{
if(!is_numeric($person_id))
{
@@ -299,7 +331,23 @@ class konto
return false;
}
$qry = "SELECT * FROM public.tbl_konto WHERE person_id='".$person_id."' ORDER BY buchungsdatum";
if($filter=='offene')
{
//Alle Buchungen und 'darunterliegende' holen die noch offen sind
$qry = "SELECT * FROM public.tbl_konto
WHERE buchungsnr in (SELECT buchungsnr FROM public.tbl_konto as konto_a WHERE
betrag*(-1)>(SELECT CASE WHEN sum(betrag) is null THEN 0
ELSE sum(betrag) END
FROM public.tbl_konto WHERE buchungsnr_verweis=konto_a.buchungsnr)
AND person_id='$person_id') OR
buchungsnr_verweis in (SELECT buchungsnr FROM public.tbl_konto as konto_a WHERE
betrag*(-1)>(SELECT CASE WHEN sum(betrag) is null THEN 0
ELSE sum(betrag) END
FROM public.tbl_konto WHERE buchungsnr_verweis=konto_a.buchungsnr)
AND person_id='$person_id') ORDER BY buchungsdatum";
}
else
$qry = "SELECT * FROM public.tbl_konto WHERE person_id='".$person_id."' ORDER BY buchungsdatum";
if($result = pg_query($this->conn, $qry))
{
+6 -1
View File
@@ -53,6 +53,11 @@ if(isset($_GET['person_id']) && is_numeric($_GET['person_id']))
else
$person_id='';
if(isset($_GET['filter']))
$filter=$_GET['filter'];
else
$filter='alle';
if(isset($_GET['buchungsnr']) && is_numeric($_GET['buchungsnr']))
{
$buchungsnr = $_GET['buchungsnr'];
@@ -64,7 +69,7 @@ $konto = new konto($conn, null, true);
if($person_id!='')
{
$konto->getBuchungen($person_id);
$konto->getBuchungen($person_id, $filter);
}
elseif($buchungsnr!='')
{
+4 -4
View File
@@ -353,12 +353,12 @@ h4
img.testtoolfrage
{
max-width:300px;
max-height:200px;
max-width:400px;
max-height:300px;
}
img.testtoolvorschlag
{
max-width:50px;
max-height:40px;
max-width:200px;
max-height:150px;
}
+4
View File
@@ -25,6 +25,10 @@ menubar,menupopup,toolbar,tabpanels,tabbox,iframe,box,hbox,vbox,tree,label,descr
padding-left: 0px;
padding-right: 0px;
}
menupopup
{
border: 1px solid black;
}
grid.lvaStundenplan
{
font-size: x-small;