Location: PHPKode > projects > tbvs > tbvs-1.1/FinanzierungsantragEdit.php
<? // this section is managed by php-mgr : you may change / enhance the part with the program versions
//
//  This php section is being managed by php-mgr ver 1, 
//  If you make changes in this section then your changes will be overwritten in later releases of this file !
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  File          : ./FinanzierungsantragEdit.php ( 05/24/2010 )
//  Language      : php
//  Description   : Formular, um die Daten für einen vorhandenen Finanzierungsantrag zu editieren 
//  Project       : tbvs - Das Tiefbauverwaltungssystem
//  Project Site  : http://tbvs.sourceforge.net/
//  Project wiki  : http://scratchpad.wikia.com/wiki/Tbvs
//  Created by    : Rainer Stötter ( hide@address.com ), 03/02/2010
//  Copyright (c) : 2007 - 2010, Rainer Stötter, All rights reserved
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  License
//
//  This file has been released under GNU GENERAL PUBLIC LICENSE
//  (see http://www.gnu.org/licenses/gpl.html)
//
//
// * GNU General Public License (Version 3, June 2009 )
// *
// * 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 3 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. 
//   
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Requests]]
//
//
//		_GET['bk']
//		_GET['fan']
//		_GET['mandant']
//		_GET['prj']
//
//	[[End of requests]]
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Functions]]
//
//
//		function CheckParameters()
//		function FinanzierungsantragEditForm($mandant,$bk,$prj,$fan)
//		function jsPrepare()
//
//	[[End of functions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Classes]]
//
//
//	no classes were found
//
//	[[End of classes]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Versions of file ./FinanzierungsantragEdit.php]]
//
//	02.03.2010	Rainer Stötter (tbvs-1.08006)
//			Module created
//			a
//
//	[[End of versions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  CVS
//
//  $Log:…$
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 
// here ends the section which is managed by php-mgr ver 1
//

//{TOOLVER=01,00000}{OLSTART=00501}{OLLEN=00079}
?><?php

/*********************************************************************************
* FinanzierungsantragEdit.php
*
* Funktion :
*	&Auml;nderung der Daten einer Finanzierungsantrag
* Parameter : GET
*	$mandant 	ID des akuellen Mandanten
*       $bk             ID vom Buchungskreis
**********************************************************************************/

require_once("./functions/checkuser.inc.php");	//	Login ist erforderlich
require_once("./functions/prolog.inc.php");	//	Datei mit vorgestellten Routinen
require_once("./functions/debug.inc.php");	//	Debugging-Funktionen
require_once("./functions/tbvs.inc.php");	//	systemweite Konstanten und Funktionen
require_once("./functions/tbvs-db.inc.php");	// systemweite Datenbankfunktionen
require_once("./functions/tbvs-inout.inc.php");    //  systemweite Ein- Ausgabefunktionen

?>

<script type="text/javascript" src="js/tabber.js"></script>
<link rel="stylesheet" href="js/tabber.css" TYPE="text/css" MEDIA="screen">
<link rel="stylesheet" href="js/tabber-print.css" TYPE="text/css" MEDIA="print">

<script type = "text/javascript">
<!-- hide me from older browsers


function validateForm ( ) {
    var 
        error_string = "";

    // check the text field

    // check the selection box
    if ( window.document.FinanzierungsantragEditForm.Auftraege.value == "NA" ) {
        error_string += msgKeinAuftrag; 
    }

    if ( window.document.FinanzierungsantragEditForm.Bearbeiter.value == "NA" ) {
        error_string += msgKeinBearbeiter; 
    }

    if ( window.document.FinanzierungsantragEditForm.IstPlannummerVorgesehen.checked ) {
        if ( window.document.FinanzierungsantragEditForm.Plannummern.value == "NA" ) {
            error_string += msgKeinePlannummer; 
        }
    }

    // ----------------------------- Antragsnummer schon vergeben ?
    var 
        checkbox = window.document.FinanzierungsantragEditForm.Finanzierungsantraege;
    var
        input = window.document.FinanzierungsantragEditForm.Nummer;

    for (var x=0; x<checkbox.length; x++ ) {
        // NOTE : TODO : trim unter Javascript einsetzen !
        if ( input.value ==  checkbox[x].text ) {
            error_string += msgNummer + input.value + msgVergeben;
        }
    }

    // ----------------------------- 

    if ( error_string == "" ) {
        return true;
    } else {
        error_string = msgErrors + error_string;
        alert( error_string );
        return false;
    }

}   // function validateForm

function SelectAntragsnummer( event ) {

    var 
        checkbox = window.document.FinanzierungsantragEditForm.Finanzierungsantraege;
    var
        input = window.document.FinanzierungsantragEditForm.Nummer;
    var
        red = "#FF6A6A"; white = "#FFFFFF";

    input.style.backgroundColor = white;
    for (var x=0; x<checkbox.length; x++ ) {
        if ( input.value ==  checkbox[x].text.substring( 0, input.value.length  ))  {
            checkbox.options[x].selected = true;
        }
        if ( input.value ==  checkbox[x].text ) {
             input.style.backgroundColor = red;
        }
    }


}   // function SelectAntragsnummer

function limitTextarea (field, maxlimit) {
    if (field.value.length > maxlimit) {
        // if too long...trim it!
        field.value = field.value.substring(0, maxlimit);
        alert( msgTextZuLang);
   } else {
        // otherwise, update 'characters left' counter
        // countfield.value = maxlimit - field.value.length;
    }
} // function limitTextarea()


</script>

<?php
 
function jsPrepare() {


    $msgErrors = html_entity_decode  (id2msg( 8160 ));
    $msgKeinAuftrag = html_entity_decode  (id2msg( 9312 ));
    $msgKeinBearbeiter = html_entity_decode  (id2msg( 9083 ));
    $msgKeinePlannummer = html_entity_decode  (id2msg( 9227 ));
    $msgNummer = html_entity_decode  (id2msg( 8213 ));
    $msgVergeben = html_entity_decode  (id2msg( 8214 ));

    $msgTextZuLang = html_entity_decode  (id2msg( 9333 ));

    echo "<script type = 'text/javascript'>";

    echo "var msgErrors='$msgErrors'; ";
    echo "var msgKeinAuftrag='$msgKeinAuftrag'; ";
    echo "var msgKeinePlannummer='$msgKeinePlannummer'; ";
    echo "var msgKeinBearbeiter='$msgKeinBearbeiter'; ";

    echo "var msgTextZuLang='$msgTextZuLang'; ";

    echo "var msgNummer='$msgNummer'; ";
    echo "var msgVergeben='$msgVergeben'; ";

    echo "</script>";

}       // function jsPrepare( )

// Finanzierungsantrag
function FinanzierungsantragEditForm($mandant, $bk, $prj, $fan ) {

  $msgReset = id2msg( 2754 );
  $msgSaveData = id2msg( 9465 );


        $msgMandant = id2msg( 2590 );
        $msgBuchungskreis = id2msg( 2591 );


        $msgID = id2msg( 2972 );

       $msgNummer = id2msg( 9497 );

        $msgFinanzierungsantrag = id2msg( 9460 );

       
        $msgAuftrag = id2msg( 9220 );

        $msgIstNeubau = id2msg( 9483 );
        $msgIstUmbau = id2msg( 9484 );

        $msgIstErweiterung = id2msg( 9466 );
        $msgIstVerstaerkung = id2msg( 9467 );
        $msgIstUmlegung = id2msg( 9468 );

        $msgIstEigenanfertigung = id2msg( 9469 );
        $msgIstStrassenbau = id2msg( 9470 );
        $msgIstEigeneMassnahme = id2msg( 9471 );

        $msgPlannummer = id2msg( 8780 );
        $msgIstPlannummerVorgesehen = id2msg( 9482 );

        $msgIstFinanzierungsplanVorgesehen = id2msg( 9472 );
        $msgIstFreihaendigeVergabe = id2msg( 9473 );

        $msgIstAusschreibung = id2msg( 3591 );
        $msgProzentsatz = id2msg( 9474 );

        $msgIstNeufinanzierung = id2msg( 9475 );
        $msgIstFolgefinanzierung = id2msg( 9476 );
        $msgIstGeringwertig = id2msg( 9477 );
        $msgIstNachfinanzierung = id2msg( 9478 );

        $msgBearbeiter = id2msg( 8392 );

        $msgAntragGenehmigt = id2msg( 9479 );
        $msgAntragGestellt = id2msg( 9480 );

        $msgSummeEigenleistung = id2msg( 9481 );
        $msgBemerkung = id2msg( 4618 );


        $msgVerwendeteNummern = id2msg( 9498 );
        $msgZuDenFinanzierungsantragn = id2msg( 9464 );

        $msgZuDenProjekten = id2msg( 8357 );
        $msgZurProjektverwaltung = id2msg( 8358 );


        $row = GetFinanzierungsantrag( $mandant, $bk, $prj, $fan );

//        $prjTitel = hent ( ID2TitelProjekt( $mandant, $bk, $prj ) );
//        $prjnr = hent ( ID2PROJNRProjekt( $mandant, $bk, $prj ) );

    echo "<FORM 
                NAME=FinanzierungsantragEditForm 
                ACTION=FinanzierungsantragEditCheck.php 
                METHOD='post'
                OnSubmit = 'var the_result = validateForm( ); return the_result;'
                >"; 

     echo "<div class='tabber'>";
    echo "<div class='tabbertab' title='$msgFinanzierungsantrag'>";
    echo "<table>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE' > $msgNummer";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            echo "<INPUT TYPE='text' NAME='Nummer' VALUE='$row->Nummer' SIZE='21' MAXLENGTH='21' OnKeyUp='SelectAntragsnummer();' >";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgVerwendeteNummern";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            DisplaySelectAlleFinanzierungsantraege ( $mandant, $bk, 0, "", false, $row->Nummer );
            echo "</TD>";

            echo "</TR>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgBearbeiter *";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
                DisplaySelectBearbeiter ( $mandant, $bk,  $prj, $row->ID_BEARBEITER, "Bearbeiter", true);
            echo "</TD>";
            echo "</TR>";


            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgAuftrag *";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
                DisplaySelectAuftrag ( $mandant, $bk,  $prj, $row->ID_AUFTRAG, "Auftraege", true);
            echo "</TD>";
            echo "</TR>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgPlannummer *";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
                DisplaySelectPlannummer ( $mandant, $bk,  $row->ID_PLANNUMMER, "Plannummern", true);
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstPlannummerVorgesehen";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstPlannummerVorgesehen ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstPlannummerVorgesehen' VALUE='' $checked";
            echo "</TD>";
            echo "</TR>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgIstNeubau";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstNeubau ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstNeubau' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstUmbau";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstUmbau ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstUmbau' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgIstErweiterung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstErweiterung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstErweiterung' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstVerstaerkung";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstVerstaerkung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstVerstaerkung' VALUE='' $checked";
            echo "</TD>";
            echo "</TR>";

            echo "<TR>";

            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstUmlegung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstUmlegung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstUmlegung' VALUE='' $checked ";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgIstEigenanfertigung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstEigenanfertigung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstEigenanfertigung' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstStrassenbau";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstStrassenbau ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstStrassenbau' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstEigeneMassnahme";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstEigeneMassnahme ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstEigeneMassnahme' VALUE='' $checked ";
            echo "</TD>";
            echo "</TR>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgIstFinanzierungsplanVorgesehen";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstFinanzierungsplanVorgesehen ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstFinanzierungsplanVorgesehen' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstFreihaendigeVergabe";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstFreihaendigeVergabe ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstFreihaendigeVergabe' VALUE='' $checked";
            echo "</TD>";
            echo "</TR>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgIstAusschreibung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstAusschreibung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstAusschreibung' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgProzentsatz";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            echo "<INPUT TYPE='text' NAME='Prozentsatz' VALUE='$row->Prozentsatz' SIZE='6' MAXLENGTH='6'>";
            echo "</TD>";
            echo "</TR>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgIstNeufinanzierung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstNeufinanzierung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstNeufinanzierung' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstFolgefinanzierung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstFolgefinanzierung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstFolgefinanzierung' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstGeringwertig";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstGeringwertig ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstGeringwertig' VALUE='' $checked";
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'> $msgIstNachfinanzierung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            $checked = $row->IstNachfinanzierung ? "CHECKED" : "";
            echo "<INPUT TYPE=CHECKBOX NAME='IstNachfinanzierung' VALUE='' $checked";
            echo "</TD>";
            echo "</TR>";

            echo "</table>";
            echo "<table>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgAntragGestellt";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
                DisplaySelectCheckedDate(
                    ( $row->AntragGestellt != "0000-00-00" ),
                    "GESTELLT_CB",
                    "GESTELLT_M", 
                    "GESTELLT_D", 
                    "GESTELLT_Y", 
                    strtotime( $row->AntragGestellt  )  );
            echo "</TD>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgAntragGenehmigt";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
                DisplaySelectCheckedDate(
                    ( $row->AntragGenehmigt != "0000-00-00" ),
                    "GENEHMIGT_CB",
                    "GENEHMIGT_M", 
                    "GENEHMIGT_D", 
                    "GENEHMIGT_Y", 
                    strtotime( $row->AntragGenehmigt  )  );
            echo "</TD>";
            echo "</TR>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgSummeEigenleistung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            echo "<INPUT TYPE='text' NAME='SummeEigenleistung' VALUE='$row->SummeEigenleistung' SIZE='11' MAXLENGTH='11'>";
            echo "</TD>";
            echo "</TR>";
        echo "</table>";
        echo "<table>";
            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgBemerkung";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";
            echo "<textarea name='Bemerkung' cols='60' rows='2' onKeyUp='limitTextarea(Bemerkung,120);'>$row->Bemerkung</textarea>";
            echo "</TD>";
            echo "</TR>";
        echo "</table>";
    echo "</div>";

/*
    echo "<div class='tabbertab' title='$msgVetragsabteilung'>"; 
         echo "<table>";

            echo "<TR>";
            echo "<TD ALIGN='RIGHT' VALIGN='MIDDLE'>$msgDatum";
            echo "</TD>";
            echo "<TD ALIGN='LEFT'>";

                DisplaySelectCheckedDate(
                    ( $row->Datum != "0000-00-00" ),
                    "DATUM_CB",
                    "DATUM_M", 
                    "DATUM_D", 
                    "DATUM_Y", 
                    strtotime( $row->Datum  ) );

            echo "</TD>";
            echo "</TR>";

        echo "</table>";
    echo "</div>";

    echo "<div class='tabbertab' title='$msgAdressen'>"; 
         echo "<table>";


        echo "</table>";
    echo "</div>";
*/

    echo "</div>";

	echo "<INPUT TYPE='hidden' NAME='mandant' VALUE='$mandant'>";
	echo "<INPUT TYPE='hidden' NAME='bk' VALUE='$bk'>";
	echo "<INPUT TYPE='hidden' NAME='prj' VALUE='$prj'>";
    echo "<INPUT TYPE='hidden' NAME='fan' VALUE='$fan'>";

	echo "<p><INPUT TYPE='submit' VALUE='$msgSaveData'>";
	echo "<INPUT TYPE='reset'  VALUE='$msgReset'>";

	echo "<p><a href=FinanzierungsantragList.php?mandant=$mandant&bk=$bk&prj=$prj> $msgZuDenFinanzierungsantragn </a>  ";
    echo " <a href=ProjektList.php?mandant=$mandant&bk=$bk> $msgZuDenProjekten </a>  ";
    echo " <a href=ProjektverwaltungStamm.php?mandant=$mandant&bk=$bk&prj=$prj> $msgZurProjektverwaltung </a>  ";


// ===============================================================================

}	// function FinanzierungsantragEditForm



function CheckParameters() {
    if (! isset($_GET['mandant']) ) 
            die (id2msg( 1070 ));
    if (! isset($_GET['bk']) ) 
            die (id2msg( 1071 ));
    if (! isset($_GET['fan']) ) 
            die ( id2msg( 9445 ) );
    if (! isset($_GET['prj']) ) 
            die ( id2msg( 8371 ) );

}

//  ShowAllParameters();
jsPrepare();

CheckParameters();

$mandant=$_GET['mandant'];
$bk=$_GET['bk'];
$fan=$_GET['fan'];
$prj=$_GET['prj'];

// $prjtitel=ID2NameFinanzierungsantrag($mandant, $bk, $auflage, $prj );

$prjNr = hent( ID2PROJNRProjekt( $mandant, $bk, $prj ) );

display_title( sprintf( id2msg( 9907 ), $fan, $prjNr ) );
DisplayHeader();

FinanzierungsantragEditForm($mandant, $bk, $prj, $fan );


require_once("./functions/epilog.inc.php");	//	Datei mit nachgestellten Routinen

?>
Return current item: tbvs