<html>
 <head><title>Werte sichern</title></head>
 <body>

<?php
   include("config/constants.inc");

   include("classes/class.sql.inc");
   include("classes/class.save.inc");

   include("config/sqlconnect.inc");


   $abfrage = new saveValues();

   $abfrage->table  = "nbz";
   $abfrage->db     = &$db;

   $abfrage->structure = array("Betrieb","Kst","Bez_Id");

   $abfrage->format = array(
                         'Jan'         => "float",
                         'Feb'         => "float",
                         'März'        => "float",
                         'Apr'         => "float",
                         'Mai'         => "float",
                         'Juni'        => "float",
                         'Juli'        => "float",
                         'Aug'         => "float",
                         'Sept'        => "float",
                         'Okt'         => "float",
                         'Nov'         => "float",
                         'Dez'         => "float",
                         'Betrag_Jahr' => "float"
                      );

   $abfrage->link   = $_POST['link'];

   $abfrage->defaults = array(
                         'IST_PLAN' => $_POST['IST_PLAN'],
                         'Jahr'     => $_POST['Jahr']
                        );

   $abfrage->primary = "Id";

   $abfrage->where = "IST_PLAN = '{$_POST['IST_PLAN']}' AND Jahr = {$_POST['Jahr']}";

   $abfrage->decategorize($_POST['value']);

   $abfrage->perform(0);

   $table = $_POST['table'];

   $sql = "TRUNCATE {$table}";
   $erg = $db->sql_exec($sql);

   $sql = "INSERT INTO {$table} SELECT *,'' FROM {$abfrage->table}";
   $erg = $db->sql_exec($sql);


   $db->sqlbox_anzeigen();

   $abfrage->linkup();
?>
 </body>
</html>