REMARK
\
*****************************************************************************
                                                      
 Bezeichnung:  Datenbank TEAMBAU
 Dateiname:    teamup.wts
 Sprache:      Gupta-Datenbankscript zum Update auf die Datenbank
 Ersteller:    U. Prose
 Erstellt am:  09.10.2013
 Version:      20.13.01

 Aenderungen:
    wann    | wer | was
------------+-----+------------------------------------------------------------
                                teamBAU 8.0.01
------------+-----+------------------------------------------------------------
 28.10.2008 | ag  | Views neu aufbereitet
 17.12.2008 | ag  | Version 8.0.01 gesetzt
------------+-----+------------------------------------------------------------
                                teamBAU 8.0.02
------------+-----+------------------------------------------------------------
 09.01.2009 | ew  | Berechnungsfeld in pe_lpo ist jetzt LONG
------------+-----+------------------------------------------------------------
                                teamBAU 8.0.03
------------+-----+------------------------------------------------------------
 12.01.2009 | ag  | tb_user ist nun ein Querdruck
------------+-----+------------------------------------------------------------
                                teamBAU 8.1.01
------------+-----+------------------------------------------------------------
 15.04.2009 | up  | Tabellen und Änderungen für die mobile Mitschreibung
 28.04.2009 | ag  | SMS-Tabellen mit hinzu
 14.05.2009 | ew  | TE_DRUCK erweitert
 15.05.2009 | ag  | Adress-Eportdruck entfernt
 20.05.2009 | up  | ie_trigger erweitert
 02.06.2009 | ag  | Reportnamen in Grossbuchstaben
------------+-----+------------------------------------------------------------
                                 teamBAU 8.1.02 (Version 8.1)
------------+-----+------------------------------------------------------------
 18.06.2009 | up  | AE_PALM c_palm_mobilversion hinzu
 03.12.2009 | up  | PE_AUFT i_auft_import hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.2.01 (Version 8.2)
------------+-----+------------------------------------------------------------
 09.12.2009 | ew  | ie_ral diverse Spalten für Gutschrift-Assistent hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.2.02 
------------+-----+------------------------------------------------------------
 21.12.2009 | ew  | pe_app erweitert, Mengen-Lock-Mechanismus
 09.03.2010 | up  | ae_korb und ab_korb_art hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.2.03 
------------+-----+------------------------------------------------------------
 09.03.2010 | ew  | Drucke 295,296 hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.2.04 
------------+-----+------------------------------------------------------------
 09.03.2010 | ew  | Mita-View verändert, Index auf pb_lpo_auft
 09.03.2010 | up  | ae_korb und ab_korb_art hinzu
 20.04.2010 | ag  | Indizes für ie_sms und ib_user_sms hinzu  
------------+-----+------------------------------------------------------------
                                 teamBAU 8.2.05
------------+-----+------------------------------------------------------------
 27.04.2010 | ew  | Fibu-Key in ae_korb
------------+-----+------------------------------------------------------------
                                 teamBAU 8.3.01 (Version 8.3)
------------+-----+------------------------------------------------------------
 28.04.2010 | ew  | pe_ger ergänzt mit i_ger_status
 21.05.2010 | up  | pe_apk mit c_app_gruppe ergänzt
 27.05.2010 | up  | Druck TB_UMS.RPT hinzu
 07.06.2010 | ag  | se_adr: Felder für Koordinaten hinzu
 09.06.2010 | up  | Druck TB_PARA.RPT hinzu
 17.06.2010 | up  | Druck PC_MIST1.RPT, PC_FIST1.RPT hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.3.02
------------+-----+------------------------------------------------------------
 17.08.2010 | up  | Spalte ie_msollnp.i_msollnp-kaldaten hinzu
 19.08.2010 | up  | Spalte ie_proj.r_proj_mlohn hinzu
 16.09.2010 | ag  | EFB 221-Formular hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.3.04
------------+-----+------------------------------------------------------------
 15.10.2010 | up  | Tabelle ae_tbb neu hinzu
 13.11.2010 | ag  | Indizes für ae_ -Tabellen hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.4.01 (teamBAU Version 8.4)
------------+-----+------------------------------------------------------------
 22.11.2010 | ew  | Tabelle pe_var neu hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.4.02
------------+-----+------------------------------------------------------------
 12.01.2011 | up  | Tabelle te_druck neu hinzu
 20.01.2011 | up  | Druck PA_PS1A3.RPT, PA_PS3A3.RPT hinzu
------------+-----+------------------------------------------------------------
                                 teamBAU 8.4.03
------------+-----+------------------------------------------------------------
 18.03.2011 | ew  | Druck PA_0305.RPT hinzu, 501-3 auf 306-8 umgemufft
------------+-----+------------------------------------------------------------
                                 teamBAU 8.5.01 (teamBAU Version 8.5)
------------+-----+------------------------------------------------------------
 18.04.2011 | ew  | Tabelle ib_proj_adr hinzu, Drucke
------------+-----+------------------------------------------------------------
                                 teamBAU 8.5.02
------------+-----+------------------------------------------------------------
 06.07.2011 | ew  | Tabelle pe_lvn mit Werktage versehen
------------+-----+------------------------------------------------------------
                                 teamBAU 8.5.03
------------+-----+------------------------------------------------------------
 06.07.2011 | ew  | Tabelle ie_svk mit Spalte CODE versehen
------------+-----+------------------------------------------------------------
                                 teamBAU 8.5.04
------------+-----+------------------------------------------------------------
 04.11.2011 | up  | Druck PA_PRS7.RPT neu hinzu
------------+-----+------------------------------------------------------------
                                teamBAU 8.5.05
------------+-----+------------------------------------------------------------
 23.11.2011 | up  | Druck PZ_ALEIN.RPT neu hinzu
------------+-----+------------------------------------------------------------
                                teamBAU 8.6.01 (teamBAU Version 8.6)
------------+-----+------------------------------------------------------------
 29.11.2011 | ew  | Freistelldatum in se_adr und pe_lvs
 07.12.2011 | ew  | i_lpo_nummer in Tabelle pe_auft hinzu
------------+-----+------------------------------------------------------------
                                teamBAU 8.6.02
------------+-----+------------------------------------------------------------
 10.02.2012 | ew  | Dialog für VGL-Stammdatendrucke (Nr. 19)
 -----------+-----+------------------------------------------------------------
                                teamBAU 8.6.03
------------+-----+------------------------------------------------------------
 27.02.2012 | ew  | Tabelle te_lpos hinzu
 29.03.2012 | ew  | FIBU-Spalte in pe_kst hinzu
 -----------+-----+------------------------------------------------------------
                                teamBAU 8.7.01 (teamBAU Version 8.7)
------------+-----+------------------------------------------------------------
 06.06.2012 | ew  | aenddat in ie_msollp-Tabellen, Erweiterungen ie_term
------------+-----+------------------------------------------------------------
                                teamBAU 8.8.01 (teamBAU Version 8.8)
------------+-----+------------------------------------------------------------
 27.09.2012 | ew  | ie_proj,se_vgl wegen Kostenstruktur erweitert
 17.12.2012 | ew  | Drucke, Auslieferungsversion
------------+-----+------------------------------------------------------------
                                teamBAU 8.8.05 
------------+-----+------------------------------------------------------------
 25.04.2013 | ew  | Erweiterung se_mita, abteilung char(50)
------------+-----+------------------------------------------------------------
                    teamBAU 20.13.01 (teamBAU Version 20.13 TD 6.2)
------------+-----+------------------------------------------------------------
 09.10.2013 | ew  | ProPlan Leistungsbilder in PParam
 09.10.2013 | ew  | c_proj_leibild in ie_proj
------------+-----+------------------------------------------------------------
                    teamBAU 20.14.01 (teamBAU Version 20.14 TD 6.2)
------------+-----+------------------------------------------------------------
 27.06.2014 | ew  | Druckzuordnung für Blankettverteilung FrmBlankVerteil
------------+-----+------------------------------------------------------------
                    teamBAU 20.14.02/03 (teamBAU Version 20.14.2 TD 6.2)
------------+-----+------------------------------------------------------------
 26.09.2014 | up  | GroupId in ae_mits hinzu
 28.11.2014 | ew  | diverse ae-Spalten, Beginn, Ende in pe_apk
 04.02.2015 | ew  | neuer Druck ProWoche (pw_monli.rpt), Version 20.14.04
 11.02.2015 | ew  | c_tbb_notiz hinzu, Druck pc_mvob.rpt Version 20.14.05
 13.04.2015 | ew  | pe_prjan für Bedarfspos. erweitert Version 20.14.07
 08.05.2015 | ew  | ATS-Funktion und Drucker erweitert Version 20.14.08/09
 03.07.2015 | ew  | Funktion zum Umschaufeln der VGL Merkmale
------------+-----+------------------------------------------------------------
                    teamBAU 20.15.01 (teamBAU Version 20.15 TD 6.2)
------------+-----+------------------------------------------------------------
 27.07.2015 | ew  | Index auf LPO-Beziehungstabellen mit PROJ-Nummer vorne
------------+-----+------------------------------------------------------------
                    teamBAU 20.15.02
------------+-----+------------------------------------------------------------
 01.09.2015 | ew  | pe_auva, Spalte i_auva_inaktiv hinzu
------------+-----+------------------------------------------------------------
                    teamBAU 20.15.03
------------+-----+------------------------------------------------------------
 08.10.2015 | up  | ie_man, Spalte c_man_db, c_man_kundennr hinzu
------------+-----+------------------------------------------------------------
                    teamBAU 20.15.04
------------+-----+------------------------------------------------------------
 27.11.2015 | ew  | ie_proj, Spalte i_proj_reb91 hinzu, pe_pap -> i_pap_inaktiv
 01.03.2016 | ew  | neue Drucke Preis-Index-Grafik pr_krv,1,2
------------+-----+------------------------------------------------------------
                    teamBAU 20.16.01 (teamBAU Version 20.16.1)
------------+-----+------------------------------------------------------------
 27.04.2016 | ew  | pe_raum
 24.08.2016 | ew  | Funktion INS_RECHNZA
 29.08.2016 | ew  | Drucke Programm-Parameter und Locks
 07.09.2016 | ew  | pb_mang_pic, c_mpic_tbdatei
 04.10.2016 | ew  | Reziprok für Fremdleistungsbeziehungen hinzu
****************************************************************************

[VERSION]
LetzteVersionsNummer=20.16.06

*****************************************************************************
/

REMARK
\
*****************************************************************************
DB-VERSION: 7.0.01
*****************************************************************************
/
REMARK
\
*****************************************************************************
Funktionsaufruf zum Erstellen eines unique Index in der ie_file
FUNCTION#UNIQUE_IE_FILE
*****************************************************************************
/
UPDATE version SET c_vers_version = '7.0.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.0.02
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (268);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
268,"W",13,"Differenzliste für die Stempelzeitverteilung","A4hoch",1,"TblMitaProjUebersicht_Auftrag","PZ_DZEIT.RPT",0,0,34816,0,"","2006-08-30-08.08.05.200000"
/;

ALTER TABLE pe_ikst MODIFY c_ikst_kstart CHAR(40);
ALTER TABLE pe_din ADD i_din_abgerechnet INTEGER NOT NULL WITH DEFAULT;

CREATE TABLE se_fetag (
  k_i_fetag_nummer      INTEGER NOT NULL, 
    c_fetag_bezeich     CHAR(60),
    d_fetag_tag         DATE,
    i_fetag_vfetag      INTEGER NOT NULL WITH DEFAULT,
    i_fetag_allebdl     INTEGER NOT NULL WITH DEFAULT,
    i_bdl_nummer        INTEGER NOT NULL,
    d_fetag_aenddat     DATETIME
 ) PCTFREE 10;
DROP INDEX ui_fetag1;
CREATE UNIQUE INDEX ui_fetag1 on se_fetag (k_i_fetag_nummer);
DROP INDEX ui_fetag2;
CREATE UNIQUE INDEX ui_fetag2 on se_fetag (c_fetag_bezeich,d_fetag_tag,i_bdl_nummer);
DROP INDEX i_fetag3;
CREATE INDEX  i_fetag3 on se_fetag (d_fetag_tag,i_bdl_nummer);

CREATE TABLE se_bdl (
  k_i_bdl_nummer        INTEGER NOT NULL, 
    c_bdl_bezeich       CHAR(60),
    i_bdl_ostwest       INTEGER NOT NULL WITH DEFAULT,
    d_bdl_aenddat       DATETIME
 ) PCTFREE 10;

CREATE TABLE se_kal (
  k_i_kal_nummer        INTEGER NOT NULL, 
  k_i_pers_nummer       INTEGER NOT NULL, 
    c_kal_art           CHAR(5),
    c_kal_bezeich       CHAR(60),
    d_kal_von           DATE,
    d_kal_bis           DATE,
    c_kal_grund         CHAR(250),
    d_kal_eintrag       DATETIME,
    c_kal_eintrager     CHAR(20),
    i_kal_persist       INTEGER  NOT NULL WITH DEFAULT,
    i_kal_perssoll      INTEGER  NOT NULL WITH DEFAULT,
    i_kal_persazv       INTEGER  NOT NULL WITH DEFAULT,
    r_kal_taganz        DOUBLE PRECISION NOT NULL WITH DEFAULT,
    i_kal_ereignis      INTEGER NOT NULL WITH DEFAULT,
    i_kal_plan          INTEGER NOT NULL WITH DEFAULT,
    d_kal_aenddat       DATETIME
 ) PCTFREE 10;
CREATE UNIQUE INDEX ui_kal on se_kal (k_i_kal_nummer);
CREATE INDEX in_kal1 on se_kal (d_kal_von);
CREATE INDEX in_kal2 on se_kal (d_kal_bis);
CREATE INDEX in_kal3 on se_kal (k_i_pers_nummer, c_kal_art, d_kal_von, d_kal_bis);
CREATE INDEX in_kal4 ON se_kal ( k_i_pers_nummer, d_kal_von, d_kal_bis );


UPDATE version SET c_vers_version = '7.0.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.0.03
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (269,270);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
269,"L",6,"Gutschrift m. Aufträgen","A4hoch",1,"FrmRechnungBF","GUTS0.RLV",0,0,771,0,"","2007-02-22-11.00.00.000000"
270,"W",20,"Preisspiegel Titelsummen-Vergleich","A4hoch",1,"TblPrsBieter","PA_PRS20.RPT",0,0,256,0,"","2007-02-26-11.00.00.000000"
/;

ALTER TABLE te_lpo ADD l_lpo_lohnansatz LONG;
DROP INDEX ui_fetag2;
CREATE UNIQUE INDEX ui_fetag2 on se_fetag (c_fetag_bezeich,d_fetag_tag,i_bdl_nummer);

UPDATE version SET c_vers_version = '7.0.03', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 7.0.04
*****************************************************************************
/

ALTER TABLE pe_auft ADD i_auft_kenn INTEGER  NOT NULL WITH DEFAULT;
UPDATE pe_auft SET i_auft_kenn = 1 WHERE i_auft_kenn < 1;

UPDATE version SET c_vers_version = '7.0.04', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 7.1.01
*****************************************************************************
/

DROP VIEW pv_apkart;
CREATE VIEW pv_apkart ( k_i_proj_nummer, k_i_apk_nummer, k_i_art_nummer, c_art_kurztext,
       r_smenge, r_imenge) 
AS SELECT 
  pe_app.k_i_proj_nummer, pe_app.i_apk_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext,
  SUM( @ROUND( R_APP_SMENGE * @ROUND( R_LPO_ART_MENGE* R_LPO_ART_FAKTOR, 3), 3)),
  SUM( @ROUND( R_APP_IMENGE * @ROUND( R_LPO_ART_MENGE* R_LPO_ART_FAKTOR, 3), 3))
FROM pe_app, pe_lpo, pb_lpo_art, pe_art
WHERE pe_app.i_lpo_nummer = pe_lpo.k_i_lpo_nummer
  AND pe_lpo.k_i_lpo_nummer = pb_lpo_art.k_i_lpo_nummer
  AND pb_lpo_art.k_i_art_nummer = pe_art.k_i_art_nummer
  AND c_lpo_art NOT LIKE '___A%'
  AND c_lpo_art NOT LIKE '__E%'
  AND pe_app.k_i_proj_nummer = pe_lpo.k_i_proj_nummer
  AND pe_lpo.k_i_proj_nummer = pb_lpo_art.k_i_proj_nummer
  AND pb_lpo_art.k_i_proj_nummer = pe_art.k_i_proj_nummer
GROUP BY pe_app.k_i_proj_nummer, pe_app.i_apk_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext;


DROP VIEW pv_projart;
CREATE VIEW pv_projart ( k_i_proj_nummer, k_i_art_nummer, c_art_kurztext, r_menge) 
AS SELECT pe_lpo.k_i_proj_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext,
  SUM( @ROUND( @IF( R_LPO_SLVMENGE, R_LPO_SLVMENGE, R_LPO_BLANKMENGE) * @ROUND( R_LPO_ART_MENGE* R_LPO_ART_FAKTOR, 3), 3))
FROM pe_lpo, pb_lpo_art, pe_art
WHERE pe_lpo.k_i_lpo_nummer = pb_lpo_art.k_i_lpo_nummer
  AND pb_lpo_art.k_i_art_nummer = pe_art.k_i_art_nummer
  AND c_lpo_art NOT LIKE '___A%'
  AND c_lpo_art NOT LIKE '__E%'
  AND pe_lpo.k_i_proj_nummer = pb_lpo_art.k_i_proj_nummer
  AND pb_lpo_art.k_i_proj_nummer = pe_art.k_i_proj_nummer
GROUP BY pe_lpo.k_i_proj_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext;

ALTER TABLE pe_mang ADD l_mang_bemerk long;
ALTER TABLE pe_mang ADD c_mang_gemeldet CHAR(250);
ALTER TABLE pe_din ADD r_din_user DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE pe_din ADD r_din_n_user DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE se_art ADD i_lief_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_art ADD i_lief_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_lvs MODIFY c_lvs_buergnr CHAR(40);

ALTER TABLE pe_pap ADD i_pap_notsum INTEGER NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (271,272,273,274);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
271,"W",2,"Bieterliste einfach Differenz nach Skonto","A4quer",1,"TblPrsBieter","PA_BIETA.RPT",0,0,256,0,"","2007-05-29-11.00.00.000000"
272,"W",2,"Positionsstatistik, Jahres-Auswertung","A4quer",1,"FrmPosStatistik","PC_PSTJ.RPT",0,0,256,0,"",2007-05-29-12.01.10.364000
273,"W",1,"Mängelrüge ausführlich","A4hoch",1,"TblRuegeAL","PA_RUEGX.RPT",0,0,256,0,"",2007-05-29-12.01.10.364000
274,"W",17,"Bieterliste (komprimiert/mit Abweichung)","A4hoch",1,"TblPrsBieter","PA_BIET1.RPT",0,0,256,0,"","2007-06-06-11.00.00.000000"
/;

UPDATE version SET c_vers_version = '7.1.01', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 7.1.02
*****************************************************************************
/

CREATE TABLE se_zu (
    k_i_zu_nummer    INTEGER          NOT NULL WITH DEFAULT,
    k_i_man_nummer   INTEGER          NOT NULL WITH DEFAULT,
    i_zu_lfd         INTEGER          NOT NULL WITH DEFAULT,
    c_zu_nummer      CHAR(4),
    c_zu_kennung     CHAR(10),
    c_zu_text        CHAR(50),
    r_zu_zuschlag    DOUBLE PRECISION NOT NULL WITH DEFAULT,
    d_zu_aenddat     DATETIME         NOT NULL WITH DEFAULT
) PCTFREE 10;

ALTER TABLE se_zu ADD r_zu_zuschlag DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE se_zu ADD c_zu_kennung CHAR(10);

UPDATE ie_piv SET d_piv_datum = @DATE(@IF(i_piv_jahr,i_piv_jahr,1970), @IF(i_piv_monat,i_piv_monat,1), 15);
ALTER TABLE ie_proj ADD i_proj_mobil INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_obj ADD l_obj_auftrag LONG;

UPDATE version SET c_vers_version = '7.1.02', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 7.1.03
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (275);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
275,"W",3,"Objektbogen mit Bild - Einzeldruck","A4hoch",1,"TblVglObjAL","PR_BLT1",0,0,256,0,"","2007-07-05-11.00.00.000000"
/;

ALTER TABLE se_pos ADD l_pos_lohnansatz LONG VARCHAR;
ALTER TABLE pe_lpo ADD r_lpo_nlpreis DOUBLE PRECISION NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '7.1.03', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 7.1.04
*****************************************************************************
/

ALTER TABLE pe_apk ADD c_apk_bemerkung CHAR(250);
ALTER TABLE pe_apk ADD c_apk_zusatz CHAR(60);

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (111,137,238,276,1050,1064,1069,1070,1085);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
111,"W",3,"Materialliste für Arbeitspakete","A4hoch",1,"TblArbeitspaketeAL","PC_MATAH.RPT",0,0,256,0,"","2007-07-25-11.00.00.000000"
137,"W",1,"Projektinterne Auftragsabrechnung","A4hoch",1,"TblArbeitspaketeAL","PC_APAUF.RPT",0,0,256,0,"","2007-07-25-11.00.00.000000"
238,"W",2,"Kostenvoranschlag, Arbeitspaket","A4hoch",1,"TblArbeitspaketeAL","PC_POSAV.RPT",0,0,270,0,"","2007-07-25-11.00.00.000000"
276,"W",8,"Arbeitspaketliste mit Zusatz-Info","A4hoch",1,"TblArbeitspaketeAL","PC_ARBZ.RPT",0,0,0,0,"","2007-07-25-11.00.00.000000"
1050,"W",4,"Arbeitspaketeliste","A4hoch",1,"TblArbeitspaketeAL","PC_ARBP.RPT",0,0,0,0,"","2007-07-25-11.00.00.000000"
1064,"W",5,"Materialliste für Arbeitspakete","A4quer",2,"TblArbeitspaketeAL","PC_MATAP.RPT",0,0,0,0,"","2007-07-25-11.00.00.000000"
1069,"W",6,"Gerätelliste für Arbeitspakete","A4quer",2,"TblArbeitspaketeAL","PC_GERAP.RPT",0,0,256,0,"","2007-07-25-11.00.00.000000"
1070,"W",7,"Fremdleistungsliste für Arbeitspakete","A4quer",2,"TblArbeitspaketeAL","PC_FREAP.RPT",0,0,256,0,"","2007-07-25-11.00.00.000000"
1085,"W",10,"Standardmengen Arbeitspakete","A4quer",2,"TblArbeitspaketeAL","PS_MSAPK.RPT",0,0,4,0,"","2007-07-25-11.00.00.000000"
/;

UPDATE version SET c_vers_version = '7.1.04', d_vers_aenddat = SYSDATETIME;



REMARK
\
*****************************************************************************
DB-VERSION: 7.1.05
*****************************************************************************
/

DROP VIEW pv_apkart;
CREATE VIEW pv_apkart (
  k_i_proj_nummer, k_i_apk_nummer, k_i_art_nummer, c_art_kurztext,
    r_smenge, r_imenge) AS
SELECT 
  pe_app.k_i_proj_nummer, pe_app.i_apk_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext,
  SUM( @ROUND( R_APP_SMENGE * @ROUND( R_LPO_ART_MENGE* R_LPO_ART_FAKTOR, 3), 3)),
  SUM( @ROUND( R_APP_IMENGE * @ROUND( R_LPO_ART_MENGE* R_LPO_ART_FAKTOR, 3), 3))
FROM pe_app, pe_lpo, pb_lpo_art, pe_art
WHERE pe_app.i_lpo_nummer = pe_lpo.k_i_lpo_nummer
  AND pe_lpo.k_i_lpo_nummer = pb_lpo_art.k_i_lpo_nummer
  AND pb_lpo_art.k_i_art_nummer = pe_art.k_i_art_nummer
  AND c_lpo_art NOT LIKE '___A%'
  AND c_lpo_art NOT LIKE '__E%'
  AND pe_app.k_i_proj_nummer = pe_lpo.k_i_proj_nummer
  AND pe_lpo.k_i_proj_nummer = pb_lpo_art.k_i_proj_nummer
  AND pb_lpo_art.k_i_proj_nummer = pe_art.k_i_proj_nummer
GROUP BY pe_app.k_i_proj_nummer, pe_app.i_apk_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext;

DROP VIEW pv_projart;
CREATE VIEW pv_projart (
  k_i_proj_nummer, k_i_art_nummer, c_art_kurztext,
    r_menge) AS
SELECT 
  pe_lpo.k_i_proj_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext,
  SUM( @ROUND( @IF( r_lpo_ilvmenge, r_lpo_ilvmenge, @IF( r_lpo_slvmenge, r_lpo_slvmenge, r_lpo_blankmenge)) *
         @ROUND( r_lpo_art_menge* r_lpo_art_faktor, 3), 3))
FROM pe_lpo, pb_lpo_art, pe_art
WHERE pe_lpo.k_i_lpo_nummer = pb_lpo_art.k_i_lpo_nummer
  AND pb_lpo_art.k_i_art_nummer = pe_art.k_i_art_nummer
  AND c_lpo_art NOT LIKE '___A%'
  AND c_lpo_art NOT LIKE '__E%'
  AND pe_lpo.k_i_proj_nummer = pb_lpo_art.k_i_proj_nummer
  AND pb_lpo_art.k_i_proj_nummer = pe_art.k_i_proj_nummer
GROUP BY pe_lpo.k_i_proj_nummer, pe_art.i_art_stanr, pe_art.c_art_kurztext;

DROP VIEW sv_artl_labe;
CREATE VIEW sv_artl_labe (
  k_i_labe_nummer,
  k_i_man_nummer,
    i_artl_labe_lfd,
    r_artl_labe_menge,
    c_lagart_ort,
    c_lagart_zeile,
    c_lagart_zone,
    c_lagart_fach,
    c_artl_kurztext,
    c_artl_dn_bez1,
    c_artl_dn_bez2,
    c_artl_einheit,
    r_artl_lpreis)
AS SELECT 
    sb_artl_labe.k_i_labe_nummer, sb_artl_labe.k_i_man_nummer,
    sb_artl_labe.i_artl_labe_lfd, sb_artl_labe.r_artl_labe_menge,
    se_lagart.c_lagart_ort,
    se_lagart.c_lagart_zeile, se_lagart.c_lagart_zone, se_lagart.c_lagart_fach,
    se_artl.c_artl_kurztext, se_artl.c_artl_dn_bez1, se_artl.c_artl_dn_bez2,
    se_artl.c_artl_einheit, se_artl.r_artl_lpreis
FROM sb_artl_labe, se_lagart, se_artl
WHERE sb_artl_labe.k_i_man_nummer  = se_lagart.k_i_man_nummer(+)
  AND sb_artl_labe.k_i_man_nummer  = se_artl.k_i_man_nummer
  AND sb_artl_labe.i_lagart_nummer = se_lagart.k_i_lagart_nummer(+)
  AND sb_artl_labe.k_i_artl_nummer  = se_artl.k_i_artl_nummer;


CREATE TABLE ae_zeit (
  k_i_mita_nummer    INTEGER           NOT NULL,
  k_i_palm_nummer    INTEGER           NOT NULL,
  k_i_proj_nummer    INTEGER           NOT NULL WITH DEFAULT,
  k_i_auft_nummer    INTEGER           NOT NULL WITH DEFAULT,
    c_zeit_zulage    CHAR(20),
    i_zeit_stempel   INTEGER           NOT NULL WITH DEFAULT,
    c_zeit_stempel   CHAR(20),
    d_zeit_datum     DATE              NOT NULL WITH DEFAULT,
    d_zeit_von       TIME,
    d_zeit_bis       TIME,
    i_zeit_pause     INTEGER           NOT NULL WITH DEFAULT,
    r_zeit_ges       DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_zeit_ges_old   DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    c_zeit_notiz     CHAR (254),
    i_zeit_pruef     INTEGER           NOT NULL WITH DEFAULT,
    c_zeit_proof     CHAR(20),
    d_zeit_proofdat  DATETIME,
    d_zeit_sync      DATETIME,
    d_zeit_aenddat   DATETIME          NOT NULL WITH DEFAULT
) PCTFREE 10;

DROP INDEX in_aez1;
CREATE INDEX in_aez1 ON ae_zeit(d_zeit_datum, k_i_proj_nummer, k_i_mita_nummer, k_i_palm_nummer);

CREATE TABLE ae_tkm (
  k_i_ger_nummer     INTEGER           NOT NULL,
  k_i_man_nummer     INTEGER           NOT NULL,
  k_i_mita_nummer    INTEGER           NOT NULL,
  k_i_proj_nummer    INTEGER           NOT NULL,
  k_i_auft_nummer    INTEGER           NOT NULL,
    i_tkm_lfd        INTEGER           NOT NULL WITH DEFAULT,
    d_tkm_datum      DATE              NOT NULL WITH DEFAULT,
    r_tkm_begin      DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_tkm_ende       DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    c_tkm_bemerkung  CHAR(250),
    d_tkm_aenddat    DATETIME          NOT NULL WITH DEFAULT
) PCTFREE 10;

DROP INDEX in_aetk1;
CREATE INDEX in_aetk1 ON ae_tkm(d_tkm_datum, k_i_auft_nummer, k_i_proj_nummer, k_i_mita_nummer, k_i_ger_nummer);

ALTER TABLE se_ger ADD r_ger_kmstand DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE se_ger ADD i_ger_mobil INTEGER NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (277);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
277,"W",6,"Auftrags-Soll-Ist-Vergleich","A4quer",1,"TblAuftragAL","PC_ASIV.RPT",0,0,256,0,"","2007-08-21-11.00.00.000000"
/;


UPDATE version SET c_vers_version = '7.1.05', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 7.1.06
*****************************************************************************
/

ALTER TABLE se_ger ADD c_ger_zaehler CHAR(40);
ALTER TABLE se_ger ADD c_ger_kfzknz CHAR(40);
ALTER TABLE ae_palm ADD c_palm_besitzer CHAR(40);
ALTER TABLE ae_palm ADD i_palm_status INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_mita ADD i_mita_mobil INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_mita ADD i_mita_pwdreset INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_mita ADD i_mita_usermits INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_mang MODIFY c_mang_art CHAR(40);
ALTER TABLE pe_mang MODIFY c_mang_status CHAR(40);
ALTER TABLE pe_merg MODIFY c_merg_verweise CHAR(250);
ALTER TABLE pe_mirg MODIFY c_mirg_verweise CHAR(250);
ALTER TABLE pe_mes MODIFY c_mes_verweise_1 CHAR(250);
ALTER TABLE pe_mes MODIFY c_mes_verweise_2 CHAR(250);
ALTER TABLE pe_mes MODIFY c_mes_verweise_3 CHAR(250);
ALTER TABLE ae_zeit ADD i_zeit_status INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD i_zeit_pause2 INTEGER NOT NULL WITH DEFAULT;

CREATE TABLE ie_msollw (
  k_i_msollw_nummer     int not null,
    i_mita_nummer       int not null with default,
    r_msollw_jan        double precision not null with default,
    r_msollw_feb        double precision not null with default,
    r_msollw_mrz        double precision not null with default,
    r_msollw_apr        double precision not null with default,
    r_msollw_mai        double precision not null with default,
    r_msollw_jun        double precision not null with default,
    r_msollw_jul        double precision not null with default,
    r_msollw_aug        double precision not null with default,
    r_msollw_sep        double precision not null with default,
    r_msollw_okt        double precision not null with default,
    r_msollw_nov        double precision not null with default,
    r_msollw_dez        double precision not null with default,
    i_msollw_jahr       int,
    d_msollw_aenddat    datetime not null with default
 ) PCTFREE 10;

DROP INDEX ui1_msollw;
CREATE UNIQUE INDEX ui1_msollw ON ie_msollw (
  k_i_msollw_nummer
 ) PCTFREE 10;

DROP INDEX in1_msollw;
CREATE        INDEX in1_msollw ON ie_msollw (
  i_mita_nummer, i_msollw_jahr
 ) PCTFREE 10;

DROP INDEX ui_aepalm1;
CREATE UNIQUE INDEX ui_aepalm1 ON ae_palm (k_i_palm_nummer) PCTFREE 10;

DROP INDEX ui_aepalm2;
CREATE UNIQUE INDEX ui_aepalm2 ON ae_palm (c_palm_liz) PCTFREE 10;

DROP VIEW sv_mitaadr;
CREATE VIEW sv_mitaadr AS 
   SELECT k_i_adr_nummer, k_i_mita_nummer, c_adr_vorname, c_mita_name, c_mita_persnr, i_mita_status, i_mita_mobil, i_mita_pwdreset 
   FROM se_adr, se_mita WHERE k_i_adr_nummer (+) = i_adr_nummer;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (278,279);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
278,"W",3,"Kostenstruktur - Variante 1","A4quer",2,"TblKostenstruktur","PA_KSTSI.RPT",0,0,256,0,"","2007-10-08-11.00.00.000000"
279,"W",4,"Kostenstruktur - Variante 2","A4quer",2,"TblKostenstruktur","PA_KSTSI.RPT",0,0,256,0,"","2007-10-08-11.00.00.000000"
/;

ALTER TABLE se_mita ADD c_mita_passwort CHAR(16);
UPDATE version SET c_vers_version = '7.1.06', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.1.07
*****************************************************************************
/
REMARK
\
*****************************************************************************
Funktionsaufruf zum Erstellen eines unique Index in der ie_file
FUNCTION#UPDATE_IB_MIZE
*****************************************************************************
/

UPDATE version SET c_vers_version = '7.1.07', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.1.08
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (272,280);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
272,"W",3,"Positionsstatistik, Jahres-Auswertung","A4quer",1,"FrmPosStatistik","PC_PSTJ.RPT",0,0,256,0,"",2007-05-29-12.01.10.364000
280,"W",11,"Geräte-Zählerstände","A4hoch",2,"TblGerLiAL","PD_GERK.RPT",0,0,256,0,"","2007-11-27-11.00.00.000000"
/;

ALTER TABLE se_ein ADD i_ein_dez INTEGER NOT NULL WITH DEFAULT;
UPDATE se_ein SET i_ein_dez = 3 WHERE i_ein_dez < 1;

DROP VIEW sv_projauft;
CREATE VIEW sv_projauft AS 
   SELECT ie_proj.k_i_proj_nummer, pe_auft.k_i_auft_nummer, c_proj_projdb, c_proj_name, c_auft_kuerzel, c_auft_bezeich 
   FROM ie_proj, pe_auft WHERE ie_proj.k_i_proj_nummer = pe_auft.k_i_proj_nummer(+);


UPDATE version SET c_vers_version = '7.1.08', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.2.01
*****************************************************************************
/
REMARK
\
*****************************************************************************
Funktionsaufruf zum Datenabgleich der ie_urpt
FUNCTION#UPDATE_IE_URPT
*****************************************************************************
/

UPDATE version SET c_vers_version = '7.2.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.2.02
*****************************************************************************
/
ALTER TABLE se_ger ADD i_tkm_status INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_ger ADD i_ger_znachkom INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_ger ADD c_tkm_status CHAR(50);
DROP VIEW sv_mitaadr;
CREATE VIEW sv_mitaadr AS 
   SELECT k_i_adr_nummer, k_i_mita_nummer, c_adr_vorname, c_mita_name, c_mita_persnr, i_mita_status, i_mita_mobil, i_mita_pwdreset, i_phase_nummer, i_mita_usermits 
   FROM se_adr, se_mita WHERE i_adr_nummer = k_i_adr_nummer(+);

DROP VIEW sv_bet;
CREATE VIEW sv_bet (
  k_i_ger_nummer,
  k_i_man_nummer,
    i_bet_lfd,
    c_bet_bezeich,
    r_bet_preis,
    c_bet_einheit,
    r_ger_bet_menge) AS
SELECT k_i_ger_nummer, k_i_man_nummer, i_bet_lfd, c_bet_bezeich, r_bet_preis, c_bet_einheit, r_ger_bet_menge
FROM sb_ger_bet, se_bet WHERE se_bet.k_i_bet_nummer = sb_ger_bet.k_i_bet_nummer
GROUP BY k_i_man_nummer, k_i_ger_nummer, i_bet_lfd, c_bet_bezeich, r_bet_preis, c_bet_einheit, r_ger_bet_menge;


DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (281);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
281,"W",12,"auftragsbez. Geräte-Zähler Monatsauswertung","A4hoch",2,"TblGerLiAL","PD_GMON.RPT",0,0,256,0,"","2008-02-05-11.00.00.000000"
/;

UPDATE version SET c_vers_version = '7.2.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.2.03
*****************************************************************************
/
REMARK
\
*****************************************************************************
Funktionsaufruf zur Erzeugung von TE_Druck-Tabellen
FUNCTION#Create_TE_DRUCK
*****************************************************************************
/

UPDATE version SET c_vers_version = '7.2.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 7.2.04
*****************************************************************************
/

CREATE TABLE pe_kd (
  k_i_kd_nummer        INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
    i_kd_lfd           INTEGER           NOT NULL,
    i_kd_lohnart       INTEGER           NOT NULL WITH DEFAULT,
    i_kd_ebene         INTEGER           NOT NULL WITH DEFAULT,
    i_kd_kw            INTEGER           NOT NULL WITH DEFAULT,
    i_kd_erledigt      INTEGER           NOT NULL WITH DEFAULT,
    i_mita_techniker   INTEGER           NOT NULL WITH DEFAULT,
    i_user_erfasst     INTEGER           NOT NULL WITH DEFAULT,
    i_adr_sub          INTEGER           NOT NULL WITH DEFAULT,
    i_adr_kunde        INTEGER           NOT NULL WITH DEFAULT,
    i_kd_verweis       INTEGER           NOT NULL WITH DEFAULT,
    i_kd_verweis2      INTEGER           NOT NULL WITH DEFAULT,
    i_kd_afb           INTEGER           NOT NULL WITH DEFAULT,
    i_kd_trag          INTEGER           NOT NULL WITH DEFAULT,
    i_kd_rechnung      INTEGER           NOT NULL WITH DEFAULT,
    i_kd_abgerechnet   INTEGER           NOT NULL WITH DEFAULT,
    c_kd_subname       CHAR(40),
    c_kd_bezeich       CHAR(60),
    c_kd_delphi        CHAR(40),
    c_kd_sap           CHAR(40),
    c_kd_bestell       CHAR(40),
    c_kd_vertrag       CHAR(40),
    c_kd_regio         CHAR(40),
    c_kd_aufm          CHAR(10),
    c_kd_pegel         CHAR(100),
    l_kd_bemerkung     LONG VARCHAR,
    l_kd_ag            LONG VARCHAR,
    l_kd_formular      LONG VARCHAR,
    r_kd_aufsumme      DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kd_kosten        DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kd_afbmenge      DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kd_tragmenge     DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    d_kd_beginn        DATE,
    d_kd_ende          DATE,
    d_kd_auftrag       DATE,
    d_kd_erfdat        DATE,
    d_kd_wvdat         DATE,
    d_kd_aenddat       DATETIME          NOT NULL WITH DEFAULT
) PCTFREE 10;


CREATE TABLE pe_kdk (
  k_i_proj_nummer     INTEGER   NOT NULL,
  k_i_kdk_nummer      INTEGER   NOT NULL,
  k_i_kd_nummer       INTEGER   NOT NULL,
    d_kdk_datum       DATETIME,
    c_kdk_art         CHAR(40),
    c_kdk_ansprech    CHAR(80),
    c_kdk_kuerzel     CHAR(20),
    c_kdk_datei       CHAR(250),
    l_kdk_bemerk      LONG VARCHAR
) PCTFREE 10;

CREATE TABLE pe_kdm (
  k_i_proj_nummer     INTEGER   NOT NULL,
  k_i_kdm_nummer      INTEGER   NOT NULL,
    i_kd_nummer       INTEGER   NOT NULL,
    i_art_nummer      INTEGER   NOT NULL,
    r_kdm_menge       DOUBLE PRECISION  NOT NULL WITH DEFAULT
) PCTFREE 10;

CREATE TABLE pe_kdo (
  k_i_proj_nummer     INTEGER   NOT NULL,
  k_i_kdo_nummer      INTEGER   NOT NULL,
  k_i_kd_nummer       INTEGER   NOT NULL,
    c_kdo_ort         CHAR(60),
    c_kdo_plan        CHAR(60),
    c_kdo_bemerk      CHAR(60),
    d_kdo_datumauf    DATE,
    d_kdo_datumfert   DATE,
    c_kdo_grund       CHAR(30),
    c_kdo_lage        CHAR(20),
    c_kdo_komplett    CHAR(50),
    i_kdo_afb         INTEGER           NOT NULL WITH DEFAULT,
    i_kdo_trag        INTEGER           NOT NULL WITH DEFAULT,
    r_kdo_bitu        DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_verbund     DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_platte      DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_gross       DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_klein       DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_mosaik      DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_bord        DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_ungeb       DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_kdo_unbef       DOUBLE PRECISION  NOT NULL WITH DEFAULT
) PCTFREE 10;

DROP VIEW sv_mitaadr;
CREATE VIEW sv_mitaadr AS 
   SELECT k_i_adr_nummer, k_i_mita_nummer, c_adr_vorname, c_mita_name, c_mita_persnr, i_mita_status, i_mita_mobil,
          i_mita_pwdreset, i_phase_nummer, i_mita_usermits, r_mita_prodkst, i_mita_lohnart
     FROM se_adr, se_mita WHERE i_adr_nummer = k_i_adr_nummer(+);

DROP VIEW sv_kundadr;
CREATE VIEW sv_kundadr AS 
   SELECT k_i_adr_nummer, k_i_kund_nummer, c_adr_vorname, c_kund_name, c_kund_nummer, i_kund_status,
          c_adr_name1, c_adr_name2, c_adr_strasse, c_adr_plz, c_adr_ort, c_adr_tel1
     FROM se_adr, ie_kund WHERE i_adr_nummer = k_i_adr_nummer(+);

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (282, 283, 284, 285, 286, 287);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
282,"W",1,"Wiederherstellung Flächen","A4hoch",1,"TblApkKDAL","PC_KD01.RPT",0,0,0,0,"",2007-05-29-12.01.10.364000
283,"W",2,"Übersicht Aufträge","A4quer",1,"TblApkKDAL","PC_KD02.RPT",0,0,0,0,"",2007-05-29-12.01.10.364000
284,"L",10,"Baustellenmeldung","A4hoch",1,"FrmKDAPBF","bmeld.rlv",0,0,0,0,"",1997-04-18-11.01.05.100000
285,"W",1,"Rechnungsaufmaß","A4hoch",1,"FrmKDAPBF","PC_KDRA.RPT",0,0,0,0,"",2007-05-29-12.01.10.364000
286,"W",3,"Aufbruchorte Flächen","A4quer",1,"TblApkKDAL","PC_KD03.RPT",0,0,0,0,"",2007-05-29-12.01.10.364000
287,"W",4,"Anzahl Entstörungspauschale","A4hoch",1,"TblApkKDAL","PC_KD04.RPT",0,0,0,0,"",2007-05-29-12.01.10.364000
/;

UPDATE pe_prjan SET r_prjan_skonto = r_prjan_skonto * -1 WHERE r_prjan_skonto > 0;
ALTER TABLE pe_kd ADD i_kd_verweis2 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_kd ADD c_kd_regio CHAR(40);
ALTER TABLE pe_kd ADD c_kd_aufm CHAR(10);
ALTER TABLE pe_kd ADD c_kd_pegel CHAR(100);
DROP INDEX ui_kd;
CREATE UNIQUE INDEX ui_kd on pe_kd(k_i_kd_nummer,k_i_proj_nummer) PCTFREE 10;
DROP INDEX ui_kd1;
CREATE UNIQUE INDEX ui_kd1 on pe_kd(i_kd_lfd,k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_kd1;
CREATE INDEX in_kd1 on pe_kd(i_kd_kw,i_kd_ebene,i_kd_erledigt,i_mita_techniker,k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_kdk;
CREATE INDEX in_kdk ON pe_kdk (k_i_proj_nummer, k_i_kd_nummer, k_i_kdk_nummer) PCTFREE 10;
DROP INDEX in_kdo;
CREATE INDEX in_kdo ON pe_kdo (k_i_proj_nummer, k_i_kd_nummer, k_i_kdo_nummer) PCTFREE 10;
DROP INDEX ui_kdm;
CREATE UNIQUE INDEX ui_kdm ON pe_kdm (k_i_proj_nummer, k_i_kdm_nummer) PCTFREE 10;
DROP INDEX in1_kdm;
CREATE INDEX in1_kdm ON pe_kdm (k_i_proj_nummer, k_i_kdm_nummer, i_kd_nummer) PCTFREE 10;


UPDATE version SET c_vers_version = '7.2.04', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 7.3.01
*****************************************************************************
/

ALTER TABLE pe_kd ADD l_kd_kunde LONG VARCHAR;
ALTER TABLE pe_kd ADD c_kd_kommentar CHAR(50);
ALTER TABLE pe_kd ADD c_kd_techniker CHAR(40);

DROP INDEX ui_kd;
CREATE UNIQUE INDEX ui_kd on pe_kd(k_i_kd_nummer,k_i_proj_nummer) PCTFREE 10;
DROP INDEX ui_kd1;
CREATE UNIQUE INDEX ui_kd1 on pe_kd(i_kd_lfd,k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_kd1;
CREATE INDEX in_kd1 on pe_kd(i_kd_kw,i_kd_ebene,i_kd_erledigt,i_mita_techniker,k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_kd2;
CREATE INDEX in_kd2 on pe_kd(@LICS(c_kd_subname),@LICS(c_kd_bezeich),@LICS(c_kd_kommentar),k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_kd3;
CREATE INDEX in_kd3 on pe_kd(@LICS(c_kd_delphi),@LICS(c_kd_sap),@LICS(c_kd_bestell),@LICS(c_kd_vertrag),@LICS(c_kd_techniker),k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_kd4;
CREATE INDEX in_kd4 on pe_kd(c_kd_techniker,k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_kdk;
CREATE INDEX in_kdk ON pe_kdk (k_i_proj_nummer, k_i_kd_nummer, k_i_kdk_nummer) PCTFREE 10;
DROP INDEX in_kdo;
CREATE INDEX in_kdo ON pe_kdo (k_i_proj_nummer, k_i_kd_nummer, k_i_kdo_nummer) PCTFREE 10;
DROP INDEX ui_kdm;
CREATE UNIQUE INDEX ui_kdm ON pe_kdm (k_i_proj_nummer, k_i_kdm_nummer) PCTFREE 10;
DROP INDEX in1_kdm;
CREATE INDEX in1_kdm ON pe_kdm (k_i_proj_nummer, k_i_kdm_nummer, i_kd_nummer) PCTFREE 10;

DROP INDEX in_ikst;
CREATE INDEX in_ikst ON pe_ikst ( k_i_proj_nummer, i_lvs_nummer, i_apk_nummer) PCTFREE 10;

DROP INDEX in_mkst1;
CREATE INDEX in_mkst1 ON pe_mkst ( k_i_proj_nummer, i_lvs_nummer, i_apk_nummer) PCTFREE 10;

DROP INDEX ui_mkst;
CREATE UNIQUE INDEX ui_mkst ON pe_mkst ( k_i_proj_nummer, k_i_mkst_nummer) PCTFREE 10;

DROP INDEX in_gkst1;
CREATE INDEX in_gkst1 ON pe_gkst ( k_i_proj_nummer, i_lvs_nummer, i_apk_nummer) PCTFREE 10;

DROP INDEX ui_gkst;
CREATE UNIQUE INDEX ui_gkst ON pe_gkst ( k_i_proj_nummer, k_i_gkst_nummer) PCTFREE 10;

DROP INDEX in_fkst1;
CREATE INDEX in_fkst1 ON pe_fkst ( k_i_proj_nummer, i_lvs_nummer, i_apk_nummer) PCTFREE 10;

DROP INDEX ui_fkst;
CREATE UNIQUE INDEX ui_fkst ON pe_fkst ( k_i_proj_nummer, k_i_fkst_nummer) PCTFREE 10;

ALTER TABLE pe_pap ADD i_pap_resanzahl INTEGER;
UPDATE pe_pap SET i_pap_resanzahl = 1;
ALTER TABLE PE_APK ADD i_apk_resanzahl INTEGER;
UPDATE pe_apk SET i_apk_resanzahl = 1;

ALTER TABLE pe_prjan ADD c_prjan_bits CHAR(32);
UPDATE pe_prjan SET c_prjan_bits = '00000000000000000000000000000000' WHERE @LENGTH(c_prjan_bits) = 0;

ALTER TABLE pe_app ADD r_app_skdmenge DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_app ADD r_app_ikdmenge DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_app ADD r_app_rkdmenge DOUBLE PRECISION  NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '7.3.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.0.01
*****************************************************************************
/

ALTER TABLE se_bdl ADD c_bdl_kurz CHAR(2);

ALTER TABLE se_adr ADD i_adr_import INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_adr ADD d_adr_impneu DATETIME;

UPDATE ie_para SET i_para_inummer = i_para_inummer + 1000 WHERE i_para_nummer = 107 AND i_para_inummer < 1000;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer IN (288, 289);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
288,"L",17,"Bürgschaftserklärung NK","A4hoch",1,"TblNUKonto","buergun.rlv",0,0,0,0,"",2008-07-14-08.08.05.200000
289,"L",13,"Auszahlung Sicherheitseinbehalt NK","A4hoch",1,"TblNUKonto","azsichn.rlv",0,0,768,0,"",2008-07-14-11.01.05.200000
/;

UPDATE pe_prjan SET c_prjan_bits = @left(c_prjan_bits || '00000000000000000000000000000000',32) WHERE @LENGTH(c_prjan_bits) < 32;
ALTER TABLE pe_lpo ADD c_lpo_meansatz CHAR(250);

DROP VIEW plus.pv_lpoart;
CREATE VIEW pv_lpoart (
  k_i_proj_nummer,
    i_lvs_nummer,
    i_agr_nummer,
  k_i_art_nummer,
    c_art_kurztext, c_art_dn_bez1, c_art_dn_bez2, r_art_preis, c_art_einheit,
    r_lpo_art_faktor, r_lpo_art_menge,
    r_lpo_slvmenge, r_lpo_ilvmenge,  r_lpo_blankmenge, c_lpo_art) AS
SELECT 
   pe_lpo.k_i_proj_nummer,
   pe_lpo.i_lvs_nummer,
   pe_art.i_agr_nummer,
   pe_art.k_i_art_nummer,
   c_art_kurztext, c_art_dn_bez1, c_art_dn_bez2, r_art_preis, c_art_einheit,
   r_lpo_art_faktor, r_lpo_art_menge,
   r_lpo_slvmenge, r_lpo_ilvmenge,  r_lpo_blankmenge, c_lpo_art
FROM pe_lpo, pb_lpo_art, pe_art
WHERE pe_lpo.k_i_lpo_nummer  = pb_lpo_art.k_i_lpo_nummer
AND   pe_lpo.k_i_proj_nummer = pb_lpo_art.k_i_proj_nummer
AND   pb_lpo_art.k_i_art_nummer  = pe_art.k_i_art_nummer
AND   pb_lpo_art.k_i_proj_nummer = pe_art.k_i_proj_nummer;
  
DROP VIEW sv_lagp;
CREATE VIEW sv_lagp (
  k_i_lag_nummer,
  k_i_man_nummer,
    c_proj_name,
    c_proj_projdb)
AS SELECT
  se_lag.k_i_lag_nummer, se_lag.k_i_man_nummer,
  ie_proj.c_proj_name, ie_proj.c_proj_projdb
FROM se_lag, ie_proj
WHERE se_lag.i_proj_nummer = ie_proj.k_i_proj_nummer(+);

ALTER TABLE ie_stat ADD c_stat_bemerk CHAR(150);

UPDATE version SET c_vers_version = '8.0.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.0.02
*****************************************************************************
/

REMARK
\
*****************************************************************************
Funktionsaufruf zur Umsetzung der Mengenansatz-Spalte in der pe_lpo
FUNCTION#UPDATE_PE_LPO_ANSATZ
*****************************************************************************
/

UPDATE version SET c_vers_version = '8.0.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.0.03
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer = 1046;
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
\
1046,"W",1,"Benutzerliste","A4quer",1,"TblBenutzerAL","TB_USER.RPT",0,0,0,"",SYSDATETIME
/;

DROP VIEW sv_userp;
CREATE VIEW sv_userp (
  k_i_user_nummer,
    c_user_name2,
    k_i_proj_nummer)
AS SELECT
  k_i_user_nummer,
  c_user_name, k_i_proj_nummer
FROM ie_user, ie_proj
WHERE i_proj_user2 = k_i_user_nummer(+);

UPDATE version SET c_vers_version = '8.0.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.0.04
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer = 290;
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)
\
290,"W",14,"Einzel-Leistungsnachweis, Jahresbegrenzung","A4hoch",1,"TblMitaProjUebersicht_Auftrag","PZ_ALEI.RPT",0,0,10,"","2009-03-25-00.00.00.000000"
/;
UPDATE version SET c_vers_version = '8.0.04', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.1.01
*****************************************************************************
/
DROP VIEW sv_mitaadr;
CREATE VIEW sv_mitaadr AS
SELECT k_i_adr_nummer, k_i_mita_nummer, c_adr_vorname, c_mita_name, c_mita_persnr, i_mita_status, i_mita_mobil, i_mita_pwdreset, i_phase_nummer,
       i_mita_usermits, r_mita_prodkst, i_mita_lohnart, c_adr_tel1, c_adr_btx, c_mita_qualif, c_mita_notiz1, c_mita_notiz2, c_mita_notiz3,
       c_adr_strasse, c_adr_plz, c_adr_ort
FROM se_mita, se_adr
WHERE i_adr_nummer = k_i_adr_nummer(+);

REMARK
\
*****************************************************************************
Inhalt: die folgenden ae_ Tabellen werden für den Abgleich Blackberry benutzt
*****************************************************************************
ae_palm  : Kolonnen-Definition mit und ohne zugeordnetem Mobilgerät
ae_proj  : Projekte, die einer Kolonne / Mobilgerät zugeordnet sind
ae_mita  : Mitarbeiter, die einer Kolonne / Mobilgerät zugeordnet sind
ae_ger   : Geräte, die einer Kolonne / Mobilgerät zugeordnet sind
ae_tbp   : Tagesbericht, Hauptdatensatz mit Projektinformationen
ae_tbm   : Tagesbericht, Mitarbeiter-bezogene Daten je Projekt
ae_tba   : Tagesbericht, Arbeitspaketmengen an diesem Tag geleistet
ae_tbg   : Tagesbericht, Geräteeinsatzstunden an diesem Tag
ae_mits  : Mitschreibungsdaten für einen Mitarbeiter auf AP-Basis, Geräte
ae_text  : Vorschlagstexte für den Blackberry zur Eingabe von Bemerkungen
*****************************************************************************
/
ALTER TABLE ae_palm ADD k_i_man_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD k_i_mita_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD i_user_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD i_palm_vt INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD i_palm_version INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD c_palm_bauleiter CHAR(40);
ALTER TABLE ae_palm ADD c_palm_webname CHAR(40);
ALTER TABLE ae_palm ADD c_palm_webpass CHAR(40);
ALTER TABLE ae_palm ADD i_palm_webstat INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD i_palm_inaktiv INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD r_palm_maxh DOUBLE PRECISION  NOT NULL WITH DEFAULT;

CREATE TABLE ae_tbp(
  k_i_tbp_nummer       INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
  k_i_palm_nummer      INTEGER           NOT NULL,
  k_i_mita_nummer      INTEGER           NOT NULL,
  c_proj_wetter        CHAR(60),
  c_proj_wind          CHAR(60),
  c_proj_temp1         CHAR(10),
  c_proj_temp2         CHAR(10),
  c_tbp_apliste        CHAR(100),
  l_proj_bb_bemerk     LONG,
  l_proj_pc_bemerk     LONG,
  l_proj_einbauort     LONG,
  i_proj_status        INTEGER           NOT NULL WITH DEFAULT,
  i_proj_mobil         INTEGER           NOT NULL WITH DEFAULT,
  d_proj_datum         DATETIME,
  c_proj_proof         CHAR(60),
  d_proj_proofdat      DATETIME,
  d_proj_aenddat       DATETIME
) PCTFREE 10;


CREATE TABLE ae_tbm (
  k_i_mita_nummer      INTEGER           NOT NULL,
  k_i_tbp_nummer       INTEGER           NOT NULL,
  c_mita_afp           CHAR(10),
  i_mita_fahrgeld      INTEGER           NOT NULL WITH DEFAULT,
  i_mita_verpflegung   INTEGER           NOT NULL WITH DEFAULT,
  d_mita_von           TIME,
  d_mita_bis           TIME,
  i_mita_pause         INTEGER           NOT NULL WITH DEFAULT,
  i_mita_pause2        INTEGER           NOT NULL WITH DEFAULT,
  d_mita_aenddat       DATETIME
) PCTFREE 10;

CREATE TABLE ae_tba (
  k_i_tbp_nummer       INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
  k_i_apk_nummer       INTEGER           NOT NULL,
    r_apk_dmenge       DOUBLE PRECISION  NOT NULL WITH DEFAULT
) PCTFREE 10;


CREATE TABLE ae_ger (
  k_i_ger_nummer       INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
  k_i_palm_nummer      INTEGER           NOT NULL
) PCTFREE 10;

CREATE TABLE ae_tbg (
  k_i_ger_nummer       INTEGER           NOT NULL,
  k_i_tbp_nummer       INTEGER           NOT NULL,
    r_ger_stunden      DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    d_ger_von          TIME,
    d_ger_bis          TIME,
    i_ger_pause        INTEGER           NOT NULL WITH DEFAULT,
    i_ger_zaehl        INTEGER           NOT NULL WITH DEFAULT,
    d_ger_aenddat      DATETIME
) PCTFREE 10;

CREATE TABLE ae_tbl (
  k_i_tbp_nummer       INTEGER          NOT NULL,
  k_i_proj_nummer      INTEGER          NOT NULL,
  k_i_app_nummer       INTEGER          NOT NULL,
    r_app_dmenge       DOUBLE PRECISION NOT NULL WITH DEFAULT
) PCTFREE 10;

REMARK
\
*****************************************************************************
Mitschreibung (zum Eingeben und Zurückübertragen)
Jeder Satz enthält die mitgeschriebenen Stunden eines Tages,
eines Mitarbeiters und für ein Arbeitspaket, Gerätereparatur, Zuschlag
*****************************************************************************
/

ALTER TABLE ae_mits ADD k_i_tbp_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_mits ADD k_i_zu_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_mits ADD k_i_ger_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_mits ADD d_mits_aenddat DATETIME;
DROP INDEX UI_AEMITS;
CREATE UNIQUE INDEX ui_aemits ON ae_mits (k_i_tbp_nummer, k_i_proj_nummer,k_i_apk_nummer,k_i_mita_nummer,k_i_palm_nummer,d_mits_datum);

REMARK
\
*****************************************************************************
Erweiterungen pe_apk für Leistungsmitschreibung auf Positionsebene
innerhalb der mobilen Datenerfassung
*****************************************************************************
/
ALTER TABLE pe_apk ADD i_apk_regie INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_apk ADD r_apk_smenge DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_apk ADD r_apk_imenge DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_apk ADD c_apk_einh CHAR(4);

REMARK
\
*****************************************************************************
Inhalt: Blackberry Vorschlagstexte
*****************************************************************************
/
CREATE TABLE ae_text (
  k_i_text_nummer        INTEGER NOT NULL, 
    i_text_lfd           INTEGER NOT NULL WITH DEFAULT, 
    k_i_palm_nummer      INTEGER NOT NULL WITH DEFAULT, 
    i_text_group         INTEGER,
    c_text_vorschlag     CHAR(200),
    d_text_aenddat       DATETIME
  ) PCTFREE 10;

CREATE TABLE ie_trigger (
       c_trigger_table CHAR(20),
       c_trigger_key   CHAR(254),
       i_trigger_key   INTEGER,
       c_trigger_rtn   CHAR(254),
       d_trigger_time DATETIME NOT NULL WITH DEFAULT
);

ALTER TABLE version ADD i_vers_sumvalid INTEGER NOT NULL WITH DEFAULT;

CREATE TABLE ie_sms (
  k_i_sms_nummer       INTEGER        NOT NULL,
    i_user_sender      INTEGER        NOT NULL WITH DEFAULT,
    c_sms_text         CHAR(250)      ,
    d_sms_aenddat      DATETIME       NOT NULL WITH DEFAULT
) PCTFREE 10;

CREATE TABLE ib_user_sms (
  k_i_sms_nummer       INTEGER        NOT NULL,
    i_user_empf        INTEGER        NOT NULL WITH DEFAULT,
    i_user_sms_gelesen INTEGER        ,
    d_user_sms_aenddat DATETIME       
) PCTFREE 10;

ALTER TABLE ib_mize ADD d_mize_azb DATETIME;
ALTER TABLE ib_mize ADD d_mize_aze DATETIME;
ALTER TABLE ib_mize ADD i_mize_pause INTEGER NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (291, 292, 1020);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
291,"W",1,"Kolonnen-Tagesbericht","A4quer",1,"TblBerichteAL","PW_TBER.RPT",0,0,0,0,"","2009-05-13-00.00.00.000000"
292,"W",3,"Bautagebuch","A4hoch",1,"TblBerichteAL","PW_TBAU.RPT",0,0,0,0,"","2009-05-13-00.00.00.000000"
/;

ALTER TABLE te_druck ADD c_druck_40_13 char(40);
ALTER TABLE te_druck ADD c_druck_40_14 char(40);
ALTER TABLE te_druck ADD c_druck_40_15 char(40);
ALTER TABLE te_druck ADD c_druck_40_16 char(40);
ALTER TABLE te_druck ADD c_druck_40_17 char(40);
ALTER TABLE te_druck ADD c_druck_40_18 char(40);
ALTER TABLE te_druck ADD c_druck_40_19 char(40);
ALTER TABLE te_druck ADD c_druck_40_20 char(40);
ALTER TABLE te_druck ADD c_druck_50_14 char(100);
ALTER TABLE te_druck ADD c_druck_50_15 char(100);
ALTER TABLE te_druck ADD c_druck_50_16 char(100);
ALTER TABLE te_druck ADD c_druck_50_17 char(100);
ALTER TABLE te_druck ADD c_druck_50_18 char(100);
ALTER TABLE te_druck ADD c_druck_50_19 char(100);
ALTER TABLE te_druck ADD c_druck_50_20 char(100);

UPDATE ie_file SET c_file_name    = @UPPER(c_file_name);
UPDATE ie_rpt  SET c_rpt_filename = @UPPER(c_rpt_filename);

UPDATE version SET c_vers_version = '8.1.01', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 8.1.02
*****************************************************************************
/
ALTER TABLE ae_palm ADD c_palm_mobversion CHAR(50);

ALTER TABLE pe_lvs ADD d_lvs_tats_b DATE;
ALTER TABLE pe_lvs ADD d_lvs_tats_e DATE;

ALTER TABLE ie_ral ADD r_ral_nlproz DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD r_ral_nlbetrag DOUBLE PRECISION  NOT NULL WITH DEFAULT;

ALTER TABLE pe_auft ADD i_auft_mobil INTEGER NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (293,294);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
293,"W",1,"Projektkostenaufstellung","A4hoch",1,"TblAuswertungAL","PC_PKST.RPT",0,0,256,0,"","2009-05-13-00.00.00.000000"
294,"W",11,"Monatsmitschreibung Mitarbeiter/Auftrag/Tag","A4quer",2,"TblMitaProjUebersicht_Auftrag","PZ_MOMIA.RPT",0,0,10,0,"","2009-11-20-00.00.00.000000"
/;

ALTER TABLE pe_auft ADD i_auft_import INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_auft ADD d_auft_import DATETIME;
UPDATE version SET c_vers_version = '8.1.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.2.01
*****************************************************************************
/
ALTER TABLE ie_ral ADD c_ral_statustext1 CHAR(250);
ALTER TABLE ie_ral ADD c_ral_statustext2 CHAR(250);
ALTER TABLE ie_ral ADD c_ral_stornogrund CHAR(250);
ALTER TABLE ie_ral ADD i_ral_assistat INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD i_ral_storno INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD i_ral_ustat1 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD i_ral_ustat2 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD i_ral_ustat3 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD i_ral_ustat4 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD i_ral_ustorno INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD d_ral_dstat1 DATETIME;
ALTER TABLE ie_ral ADD d_ral_dstat2 DATETIME;
ALTER TABLE ie_ral ADD d_ral_dstat3 DATETIME;
ALTER TABLE ie_ral ADD d_ral_dstat4 DATETIME;
ALTER TABLE ie_ral ADD d_ral_storno DATETIME;

UPDATE version SET c_vers_version = '8.2.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.2.02
*****************************************************************************
/
ALTER TABLE pe_app ADD i_app_lockral INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_app ADD d_app_lockdate DATETIME;
ALTER TABLE pe_app ADD c_app_lockname CHAR(40);

UPDATE version SET c_vers_version = '8.2.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.2.03
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (295,296);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
295,"W",2,"Aufmass-Auftragszuwächse akt. Gutschrift","A4hoch",1,"TblGutschriftAL","PC_GRAZ.RPT",0,0,0,0,"",2010-03-09-00.00.00.000000
296,"W",1,"Gutschriften-Liste","A4quer",2,"TblGutschriftAL","PC_GUTNR.RPT",0,0,256,0,"",2010-03-09-00.00.00.000000
/;

ALTER TABLE pe_auft ADD i_auft_nurauft INTEGER NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '8.2.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.2.04
*****************************************************************************
/

DROP INDEX in_lpoauft1;
DROP INDEX ui_lpoauft1;
CREATE UNIQUE INDEX ui_lpoauft1 ON pb_lpo_auft (
  k_i_proj_nummer, k_i_auft_nummer, k_i_lpo_nummer)
  PCTFREE 10;
  
DROP VIEW sv_mitaadr;
CREATE VIEW sv_mitaadr (k_i_adr_nummer, k_i_mita_nummer, c_adr_vorname, c_mita_name, c_mita_persnr, i_mita_status, i_mita_mobil, i_mita_pwdreset, i_phase_nummer,
       i_mita_usermits, r_mita_prodkst, i_mita_lohnart, c_adr_tel1, c_adr_btx, c_mita_qualif, c_mita_notiz1, c_mita_notiz2, c_mita_notiz3,
       c_adr_strasse, c_adr_plz, c_adr_ort, c_mita_komplett) AS
SELECT k_i_adr_nummer, k_i_mita_nummer, c_adr_vorname, c_mita_name, c_mita_persnr, i_mita_status, i_mita_mobil, i_mita_pwdreset, i_phase_nummer,
       i_mita_usermits, r_mita_prodkst, i_mita_lohnart, c_adr_tel1, c_adr_btx, c_mita_qualif, c_mita_notiz1, c_mita_notiz2, c_mita_notiz3,
       c_adr_strasse, c_adr_plz, c_adr_ort, c_mita_name || ', ' || c_adr_vorname || ' [' || c_mita_persnr || ']'
FROM se_mita, se_adr
WHERE i_adr_nummer = k_i_adr_nummer(+);

CREATE TABLE ae_korb (
  k_i_korb_nummer       INTEGER        NOT NULL,
  k_i_palm_nummer       INTEGER        NOT NULL,
  k_i_mita_nummer       INTEGER        NOT NULL,
  k_i_man_nummer        INTEGER        NOT NULL,
  d_korb_datum          DATETIME       NOT NULL WITH DEFAULT,
  d_korb_kasse          DATETIME,
  i_user_nummer         INTEGER        NOT NULL WITH DEFAULT,
  i_korb_offen          INTEGER        NOT NULL,
  i_korb_art            INTEGER        NOT NULL,
  i_korb_mobil          INTEGER        NOT NULL,
  i_korb_export         INTEGER        NOT NULL WITH DEFAULT,
  d_korb_export         DATETIME,
  d_korb_aenddat        DATETIME       
) PCTFREE 10;

CREATE TABLE ab_korb_art (
  k_i_korb_nummer       INTEGER        NOT NULL,
  k_i_man_nummer        INTEGER        NOT NULL,
  k_i_proj_nummer       INTEGER        NOT NULL,
  k_i_auft_nummer       INTEGER        NOT NULL,
  k_i_apk_nummer        INTEGER        NOT NULL,
  k_i_art_nummer        INTEGER        NOT NULL,
  r_art_anzahl          DOUBLE PRECISION  NOT NULL WITH DEFAULT,
  d_korb_art_aenddat    DATETIME       
) PCTFREE 10;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (500,1045);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
500,"W",1,"Material-Entnahme/Rückgabe-Schein","A4hoch",1,"FrmWarenkorb","SVB_MAT1.RPT",0,0,0,0,"",2010-03-23-00.00.00.000000
1045,"W",2,"Projektberechnungsarten","A4hoch",1,"FrmVglKstUeb","PR_PBART.RPT",0,0,256,0,"",2010-03-23-00.00.00.000000
/;

CREATE TABLE ie_global (
  c_global_key          CHAR(200),
  c_global_file         CHAR(200),
  c_global_user         CHAR(20),
  l_global_inhalt       LONG,
  i_global_intern       INTEGER NOT NULL WITH DEFAULT,
  d_global_aenddat      DATETIME       
) PCTFREE 10;

DROP INDEX ui_global;
DROP INDEX in_sms;
DROP INDEX in_usersms;

CREATE INDEX ui_global ON ie_global (c_global_key);

CREATE INDEX in_sms ON ie_sms (
  k_i_sms_nummer )
  PCTFREE 10;

CREATE INDEX  in_usersms ON ib_user_sms (
  k_i_sms_nummer, i_user_empf )
  PCTFREE 10;
  
ALTER TABLE pe_kst ADD d_kst_anweisung DATE;
ALTER TABLE pe_kst ADD i_kst_schluss INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_kstn ADD d_kstn_anweisung DATE;
ALTER TABLE pe_kstn ADD i_kstn_schluss INTEGER NOT NULL WITH DEFAULT;


UPDATE version SET c_vers_version = '8.2.04', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.2.05
*****************************************************************************
/

ALTER TABLE ae_korb ADD c_korb_identfibu char(100);

UPDATE version SET c_vers_version = '8.2.05', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.3.01
*****************************************************************************
/
ALTER TABLE se_ger ADD i_ger_status INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_ger ADD i_ger_status INTEGER NOT NULL WITH DEFAULT;

ALTER TABLE ie_svk ADD l_svk_inhalt LONG;
ALTER TABLE ie_svk ADD i_svk_intern INTEGER NOT NULL WITH DEFAULT;

DROP INDEX in_svk1;
CREATE INDEX in_svk1 ON ie_svk (c_svk_edtpara) PCTFREE 10;

ALTER TABLE pe_apk ADD c_apk_gruppe CHAR(50);
CREATE INDEX in_apk1 ON pe_apk (c_apk_gruppe) PCTFREE 10;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (275, 297, 298, 299, 300, 301, 302, 303);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
275,"W",3,"Objektbogen mit Bild - Einzeldruck","A4hoch",1,"TblVglObjAL","PR_BLT1.RPT",0,0,256,0,"","2007-07-05-11.00.00.000000"
297,"W",1,"Umsatzliste","A4hoch",1,"FrmKundenBF","TB_UMS.RPT",0,0,256,0,"",2010-03-23-00.00.00.000000
298,"W",1,"Programmparameter","A4hoch",1,"TblParam","TB_PPAR.RPT",0,0,0,0,"",2010-03-23-00.00.00.000000
299,"W",22,"Rangfolge Bieter nach Pos.-Wertigkeit","A4quer",2,"TblPrsBieter","PA_PRS1.RPT",0,0,256,0,"","2010-06-07-00.00.00.000000"
300,"W",2,"Benutzerparameter","A4hoch",1,"TblBenutzerAL","TB_PARA.RPT",0,0,0,0,"",1997-07-24-17.38.10.364000
301,"W",2,"Abfuhrmengen","A4hoch",1,"TblFIstKostenAL","PC_FIST1.RPT",0,0,0,0,"",1997-07-24-17.38.10.364000
302,"W",2,"Lieferscheinliste","A4hoch",1,"TblMIstKostenAL","PC_MIST1.RPT",0,0,0,0,"",1997-07-24-17.38.10.364000
303,"W",1,"Stundenmitschreibung Woche","A4quer",2,"TblAuswertungAL","PC_MITW1.RPT",0,0,0,0,"",2010-06-17-00.00.00.000000
/;

CREATE TABLE ie_pparam (
   i_pparam_lfd   INTEGER NOT NULL WITH DEFAULT,
   c_pparam_modul CHAR(20),
   c_pparam_var   CHAR(40),
   c_pparam_value CHAR(120),
   c_pparam_bem   CHAR(250)
   ) PCTFREE 10;

ALTER TABLE se_adr ADD r_adr_lat DOUBLE PRECISION;
ALTER TABLE se_adr ADD r_adr_lon DOUBLE PRECISION;

ALTER TABLE pe_mkst ADD c_mkst_lieferant CHAR(100);
ALTER TABLE pe_mkst ADD c_mkst_lsnummer  CHAR(50);

ALTER TABLE pe_fkst ADD c_fkst_lieferant CHAR(100);
ALTER TABLE pe_fkst ADD c_fkst_lsnummer  CHAR(50);

UPDATE version SET c_vers_version = '8.3.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.3.02
*****************************************************************************
/
ALTER TABLE ie_msollnp ADD i_msollnp_kaldaten INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_proj ADD r_proj_mlohn DOUBLE PRECISION NOT NULL WITH DEFAULT;


UPDATE version SET c_vers_version = '8.3.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.3.03
*****************************************************************************
/
ALTER TABLE ae_korb ADD i_korb_storno INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_korb ADD i_korb_delete INTEGER NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (304);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
304,"W",1,"EFB-221 - Preisermittlung bei Zuschlagskalkulation","A4hoch",1,"FrmAngebot","PC_EF221.RPT",0,0,256,0,"",2006-05-24-15.04.05.200000
/;

UPDATE version SET c_vers_version = '8.3.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.3.04
*****************************************************************************
/
CREATE TABLE ae_tbb(
  k_i_tbb_nummer      INTEGER           NOT NULL,
  k_i_tbp_nummer      INTEGER           NOT NULL,
  d_tbb_zeit          TIME              NOT NULL WITH DEFAULT,
  c_tbb_wetter        CHAR(60),
  c_tbb_wind          CHAR(60),
  c_tbb_ltemp         CHAR(10),
  c_tbb_lfeu          CHAR(10),
  c_tbb_tau           CHAR(10),
  c_tbb_btemp         CHAR(10)
) PCTFREE 10;

DROP INDEX ui_tbp1;
CREATE UNIQUE INDEX ui_tbp1 on ae_tbp (k_i_tbp_nummer) PCTFREE 10;
DROP INDEX in_tba1;
CREATE INDEX in_tba1 on ae_tba (k_i_tbp_nummer) PCTFREE 10;
DROP INDEX in_mits1;
CREATE INDEX in_mits1 on ae_mits (k_i_tbp_nummer) PCTFREE 10;
DROP INDEX in_tbp1;
CREATE INDEX in_tbp1 on ae_tbp (k_i_tbp_nummer, i_proj_status, d_proj_datum) PCTFREE 10;
DROP INDEX in_tbp;
CREATE INDEX in_tbp ON ae_tbp ( k_i_palm_nummer, k_i_tbp_nummer);
DROP INDEX ui_bm;
CREATE UNIQUE index ui_bm ON ae_tbm ( k_i_mita_nummer, k_i_tbp_nummer);
DROP INDEX ui_tbg;
CREATE UNIQUE index ui_tbg ON ae_tbg ( k_i_ger_nummer, k_i_tbp_nummer);

UPDATE version SET c_vers_version = '8.3.04', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.4.01
*****************************************************************************
/

REMARK
\
**************************************************************************
Inhalt: Variablen
  k_i_var_nummer  = eigener KI (muß)
  k_i_proj_nummer = Verweis auf Projekt (muß)
    c_var_name    = Name der Variablen (eindeutig im Projekt)
    c_var_ansatz  = Rechenansatz, Formel der Variablen
    c_var_bemerk  = Bemerkung, Beschreibung
    r_var_wert    = Wert der Variablen
    d_var_aenddat = Änderungsdatum
**************************************************************************
/
CREATE TABLE pe_var (
  k_i_var_nummer       INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
    c_var_name         CHAR(20),
    c_var_ansatz       CHAR(250),
    c_var_bemerk       CHAR(250),
    r_var_wert         DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    d_var_aenddat      DATETIME          NOT NULL WITH DEFAULT
) PCTFREE 10;


DROP INDEX ui_var;
CREATE UNIQUE INDEX ui_var      ON pe_var (
  k_i_proj_nummer, k_i_var_nummer
) PCTFREE 10;

DROP INDEX ui_var1;
CREATE UNIQUE INDEX ui_var1     ON pe_var (
   k_i_proj_nummer, @UPPER( c_var_name)
) PCTFREE 10;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (305);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
305,"L",1,"Materialblatt","A4hoch",1,"FrmAuftragMatBF","SWRMAT.RLV",0,0,256,0,"",2010-12-06-00.00.00.000000
/;

ALTER TABLE pe_auft ADD i_user_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_auft ADD i_adr_ag1 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_auft ADD i_adr_ag2 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_auft ADD i_lvs_memikalk INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_auft ADD r_auft_lohnkst DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_kst ADD r_kst_korr DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_lpo ADD r_lpo_bietlohn DOUBLE PRECISION  NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '8.4.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.4.02
*****************************************************************************
/
ALTER TABLE te_druck ADD r_druck_32 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD r_druck_33 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD r_druck_34 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD r_druck_35 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD r_druck_36 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD r_druck_37 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD i_druck_7 INTEGER  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD i_druck_8 INTEGER  NOT NULL WITH DEFAULT;
ALTER TABLE te_druck ADD i_druck_9 INTEGER  NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (501, 502, 503);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
501,"W",23,"Rangfolge alle Bieter","A3quer",2,"TblPrsBieter","PA_PS1A3.RPT",0,0,256,0,"",2011-01-19-00.00.00.000000
502,"W",24,"Titelsummen aller Bieter","A3quer",2,"TblPrsBieter","PA_PS3A3.RPT",0,0,256,0,"",2011-01-19-00.00.00.000000
503,"W",25,"Rangfolge Bieter nach Pos.-Wertigkeit","A3quer",2,"TblPrsBieter","PA_PS1A3.RPT",0,0,256,0,"",2011-01-19-00.00.00.000000
/;

ALTER TABLE pe_kst ADD i_kst_skonto INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_kst ADD i_kst_sicher INTEGER NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '8.4.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.4.03
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (306, 307, 308, 501, 502, 503, 309, 310);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark , D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
306,"W",23,"Rangfolge alle Bieter","A3quer",2,"TblPrsBieter","PA_PS1A3.RPT",0,0,256,0,"",2011-01-19-00.00.00.000000
307,"W",24,"Titelsummen aller Bieter","A3quer",2,"TblPrsBieter","PA_PS3A3.RPT",0,0,256,0,"",2011-01-19-00.00.00.000000
308,"W",25,"Rangfolge Bieter nach Pos.-Wertigkeit","A3quer",2,"TblPrsBieter","PA_PS1A3.RPT",0,0,256,0,"",2011-01-19-00.00.00.000000
309,"W",2,"Änderungsanzeigen u. Entscheidungsvorlagen","A4quer",1,"FrmLVAL","PA_0305.RPT",0,0,273,0,"",2011-03-18-00.00.00.000000
310,"W",5,"Auftragspositionen-Gesamt (mit Brutto)","A4hoch",1,"TblAuftragAL","PC_LVVP2.RPT",0,0,256,16,"",2011-03-25-00.00.00.000000
/;

ALTER TABLE pe_lpo ADD c_lpo_meansatz CHAR(250);

UPDATE version SET c_vers_version = '8.4.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.5.01
*****************************************************************************
/

CREATE TABLE ib_proj_adr (
  k_i_adr_nummer       INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
    c_padr_bezeich     CHAR(50),
    c_padr_bits        CHAR(20),
    i_user_nummer      INTEGER           NOT NULL WITH DEFAULT,
    c_padr_bemerk      char(250),
    d_padr_aenddat     DATETIME          NOT NULL WITH DEFAULT
) PCTFREE 10;

DROP INDEX ui_padr;
CREATE UNIQUE INDEX ui_padr ON ib_proj_adr (k_i_proj_nummer, k_i_adr_nummer) PCTFREE 10;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 80);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark , d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
311,"W",1,"Telefonliste, nach Kürzel sortiert","A4hoch",1,"FrmProjektBF","TB_ADRTK.RPT",0,0,0,0,"","2011-04-27-00.00.00.000000"
312,"W",1,"Adress-Etiketten, Zweckform-Nr. 3659","A4hoch",1,"FrmProjektBF","tb_3659.rpt",0,0,0,0,"","2011-04-27-00.00.00.000000"
313,"L",2,"teamBAU Serienbrief","A4hoch",1,"FrmProjektBF","SERIEP.RLV",0,0,0,0,"","2011-04-27-00.00.00.000000"
314,"W",1,"Adress-Etiketten, Zweckform-Nr. 3658","A4hoch",1,"FrmProjektBF","tb_3658.rpt",0,0,0,0,"","2011-04-27-00.00.00.000000"
315,"W",1,"Anschriften","A4quer",2,"FrmProjektBF","TB_ADR.RPT",0,0,0,0,"","2011-04-27-00.00.00.000000"
316,"W",1,"Adress-Etiketten, Zweckform-Nr. 3477","A4hoch",1,"FrmProjektBF","TB_3477.RPT",0,0,0,0,"","2011-04-27-00.00.00.000000"
317,"W",1,"Adressen, ausführlich","A4hoch",1,"FrmProjektBF","TB_ADRA.RPT",0,0,0,0,"","2011-04-27-00.00.00.000000"
318,"W",1,"Telefonliste","A4hoch",1,"FrmProjektBF","TB_ADRTL.RPT",0,0,0,0,"","2011-04-27-00.00.00.000000"
319,"W",1,"Adressen-Übersicht","A4quer",2,"FrmProjektBF","TB_ADRUE.RPT",0,0,0,0,"","2011-04-27-00.00.00.000000"
320,"W",25,"Positionsliste mit Preis-Spanne","A4hoch",1,"FrmPosAL","PC_POSMM.RPT",0,0,274,0,"",2011-06-14-00.00.00.000000
80,"W",1,"Leistungsstand","A4quer",1,"FrmLeistungsstand","PC_LEIST.RPT",0,0,256,0,"","2011-05-19-00.00.00.000000"
/;

ALTER TABLE ie_lei ADD i_lei_kw INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_lei ADD i_lei_istk INTEGER NOT NULL WITH DEFAULT;
UPDATE ie_lei SET d_lei_datum = @DATE(i_lei_jahr,i_lei_monat,1) WHERE d_lei_datum = NULL;
ALTER TABLE pe_din ADD i_din_hide INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_lvs ADD c_lvs_zahlbits CHAR(32);
ALTER TABLE pe_lvs ADD c_lvs_werktage CHAR(40);
ALTER TABLE ie_kund ADD c_kund_zahlbits CHAR(32);
ALTER TABLE ie_kund ADD c_kund_werktage CHAR(40);

UPDATE ie_proj SET i_adr_aufnummer = 0 WHERE NOT EXISTS (SELECT * FROM se_adr WHERE k_i_adr_nummer = i_adr_aufnummer);
UPDATE pe_lvs SET c_lvs_zahlbits = '0000' WHERE @LENGTH(c_lvs_zahlbits) = 0;
UPDATE pe_lvs SET c_lvs_werktage = 'SA=1;SO=0;FE=0' WHERE @LENGTH(c_lvs_werktage) = 0;
UPDATE ie_kund SET c_kund_zahlbits = '0000' WHERE @LENGTH(c_kund_zahlbits) = 0;
UPDATE ie_kund SET c_kund_werktage = 'SA=1;SO=0;FE=0' WHERE @LENGTH(c_kund_werktage) = 0;

UPDATE version SET c_vers_version = '8.5.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.5.02
*****************************************************************************
/

ALTER TABLE pe_lvn ADD c_lvn_zahlbits CHAR(32);
ALTER TABLE pe_lvn ADD c_lvn_werktage CHAR(40);
UPDATE pe_lvn SET c_lvn_zahlbits = '0000' WHERE @LENGTH(c_lvn_zahlbits) = 0;
UPDATE pe_lvn SET c_lvn_werktage = 'SA=1;SO=0;FE=0' WHERE @LENGTH(c_lvn_werktage) = 0;

UPDATE version SET c_vers_version = '8.5.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.5.03
*****************************************************************************
/
ALTER TABLE ie_svk ADD c_svk_CODE CHAR(20);
ALTER TABLE pe_lvs ADD i_lvs_advstruk INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_lvs ADD c_lvs_titeltext4 CHAR(40);
ALTER TABLE pe_lvs ADD c_lvs_titeltext5 CHAR(40);
ALTER TABLE pe_lvs ADD c_lvs_titeltext6 CHAR(40);
ALTER TABLE ie_proj ADD l_proj_pblattjpg LONG;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (1116, 321);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark , d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
1116,"L",12,"Projekte, ausführlich (mit Foto)","A4hoch",1,"TblProjektAL","PBLATT2.RLV",0,0,0,0,"",2011-09-28-00.00.00.000000
321,"W",1,"Projektbeteiligtenliste","A4quer",2,"FrmProjektBF","TB_ADRBE.RPT",0,0,0,0,"","2011-09-29-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '8.5.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.5.04
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (322);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark , d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
322,"W",26,"Rangfolge der ersten 3 Bieter ausführlich","A4quer",2,"TblPrsBieter","PA_PRS7.RPT",0,0,256,0,"","2011-11-29-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '8.5.04', d_vers_aenddat = SYSDATETIME;


REMARK
\
*****************************************************************************
DB-VERSION: 8.5.05
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (323, 324);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark , d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
323,"W",8,"Mitarbeiter Einzel-Leistungsnachweis mit Notizen","A4hoch",1,"TblMitaProjUebersicht","PZ_ALEIN.RPT",0,0,10,0,"","2011-11-29-00.00.00.000000"
324,"W",12,"Mitarbeiter Einzel-Leistungsnachweis mit Notizen","A4hoch",1,"TblPWMitaProjUebersicht","PZ_ALEIN.RPT",0,0,10,0,"","2011-11-29-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '8.5.05', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.6.01
*****************************************************************************
/
ALTER TABLE pe_lvs ADD d_lvs_freistell DATE;
ALTER TABLE se_adr ADD i_adr_freistell INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_adr ADD d_adr_freistell DATE;
ALTER TABLE pe_auft ADD i_lpo_nummer INTEGER NOT NULL WITH DEFAULT;

CREATE UNIQUE INDEX ui_pparam ON ie_pparam(c_pparam_modul, c_pparam_var) PCTFREE 10;
REMARK
\
IGNORE#805
/
INSERT INTO ie_pparam(c_pparam_modul, c_pparam_var, c_pparam_value, c_pparam_bem )
VALUES(:1,:2,:3,:4)
\
"TB_KalFrist", "Werk", "Werktage", "Bezeichnung der Werktage für Zahlungsfristen"
"TB_KalFrist", "Kalender", "Kalendertage", "Bezeichnung der Kalendertage für Zahlungsfristen"
"TB_KalFrist", "Monat Einzahl", "Monat", "Bezeichnung des Monats "
"TB_KalFrist", "Monat Mehrzahl", "Monate", "Bezeichnung der Monate"
"TBAdressPara", "AG", "Auftraggeber", "Auftraggeber-Bezeichnung für Projekt-Adressen-Typ"
"TBAdressPara", "AN", "Auftragnehmer", "Auftragnehmer-Bezeichnung für Projekt-Adressen-Typ"
"TBAdressPara", "BH", "Bauherr", "Bauherren-Bezeichnung für Projekt-Adressen-Typ"
"ProPlan", "TagesArbeitsstunden", "8", "Std.-Satz zur Umrechnung von Stunden in Arbeitstage"
"ProWoche", "TagesArbeitsstunden", "8", "Std.-Satz zur Umrechnung von Stunden in Arbeitstage"
/;

UPDATE version SET c_vers_version = '8.6.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.6.02
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (29,275,1014,325);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
275,"W",3,"Objektbogen mit Bild - Einzeldruck","A4hoch",1,"TblVglObjAL","PR_BLT1.RPT",0,0,275,0,"","2012-02-10-11.00.00.000000"
1014,"L",10,"Vergleichsobjekte, ausführlich","A4hoch",1,"TblVglObjAL","VGLOBJ.RLV",0,0,275,0,"","2012-02-10-11.00.00.000000"
29,"W",1,"Objektbogen","A4hoch",1,"TblVglObjAL","PR_BLATT.RPT",0,0,275,0,"","2012-02-10-11.00.00.000000"
325,"W",1,"Schriftverkehr mit WV und Adresse","A4quer",1,"TblSchriftverkehrAL","TB_SVAJ.RPT",0,0,0,0,"","2012-03-19-00.00.00.000000"
/;
UPDATE version SET c_vers_version = '8.6.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.6.03
*****************************************************************************
/

CREATE TABLE te_lpos (
  k_i_proj_nummer      INTEGER           NOT NULL,
  k_i_lvs_nummer       INTEGER           NOT NULL,
    i_lvs_lfd          INTEGER           NOT NULL,
    c_lpo_ordnung      char(50), 
    c_lpo_ktext01      char(50),
    c_lpo_ktext02      char(50),
    c_lpo_ktext03      char(50),
    c_lpo_ktext04      char(50),
    c_lpo_ktext05      char(50),
    c_lpo_ktext06      char(50),
    c_lpo_ktext07      char(50),
    c_lpo_ktext08      char(50),
    c_lpo_ktext09      char(50),
    c_lpo_ktext10      char(50),
    r_lpo_blankmenge   DOUBLE PRECISION NOT NULL WITH DEFAULT,
    r_lpo_rlvmenge     DOUBLE PRECISION NOT NULL WITH DEFAULT,
    r_lpo_vstd         DOUBLE PRECISION NOT NULL WITH DEFAULT,
    l_lpo_bemerk       LONG,
    i_man_nummer       INTEGER           NOT NULL,
    d_proj_baubeginn   DATE,
    d_proj_bauende     DATE,
    c_proj_projdb      char(50),
    c_proj_name        char(100),
    d_proj_aenddat     DATE,
    i_proj_status      INTEGER           NOT NULL,
    c_proj_status      char(50),
    i_proj_abrjahr     INTEGER           NOT NULL,
    c_bwa_text         char(60),
    c_bge_text         char(60), 
    c_proj_kstelle     char(50),
    c_proj_ktraeger    char(50),
    c_user_name        char(50),
    c_lpos_where       char(250),
    d_lpos_create      DATETIME
) PCTFREE 10;

ALTER TABLE pe_kst ADD r_kst_fibu DOUBLE PRECISION  NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '8.6.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.7.01
*****************************************************************************
/
ALTER TABLE ie_term ADD i_term_art INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_term ADD d_term_ende DATETIME;
UPDATE ie_term SET d_term_ende = d_term_termin WHERE d_term_ende IS NULL AND i_term_art = 0;
ALTER TABLE te_lpos ADD l_lpo_langtext LONG;
ALTER TABLE te_lpos ADD c_lpos_where1 char(250);
ALTER TABLE te_lpos ADD r_lpo_preis DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE te_lpos ADD k_i_lpo_nummer INTEGER NOT NULL;
ALTER TABLE te_lpos ADD i_lpos_kenn INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_msollp ADD d_msollp_aenddat DATETIME;
ALTER TABLE ie_msollnp ADD d_msollnp_aenddat DATETIME;
UPDATE ie_msollp SET d_msollp_aenddat = SYSDATETIME WHERE d_msollp_aenddat IS NULL;
UPDATE ie_msollnp SET d_msollnp_aenddat = SYSDATETIME WHERE d_msollnp_aenddat IS NULL;
ALTER TABLE ie_msollp MODIFY d_msollp_aenddat NOT NULL WITH DEFAULT;
ALTER TABLE ie_msollnp MODIFY d_msollnp_aenddat NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '8.7.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.7.02
*****************************************************************************
/
ALTER TABLE pe_zuab MODIFY c_zuab_text CHAR(120);

UPDATE version SET c_vers_version = '8.7.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.8.01
*****************************************************************************
/
ALTER TABLE ie_proj ADD r_proj_preistec DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE pe_din ADD r_din_pprog DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE pe_din ADD i_din_kstfest INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_vgl ADD r_vgl_teckst DOUBLE PRECISION  NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (183,326,327,328);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
183,"W",2,"Preis-Statistik Überregional - Grafik","A4quer",1,"FrmPreisIndex","PR_KRV.RPT",0,0,0,0,"","2002-12-16-14.27.05.200000"
326,"W",1,"Gutschriften-Auftragsliste ausführlich","A4quer",2,"TblGutschriftAL","PC_GUTAU.RPT",0,0,256,0,"",2012-12-05-00.00.00.000000
327,"W",2,"Umsatzliste ausführlich","A4quer",1,"FrmKundenBF","TB_UMSA.RPT",0,0,256,0,"",2012-12-05-00.00.00.000000
328,"W",2,"Preis-Statistik Regional - Grafik","A4quer",1,"FrmPreisIndex","PR_KRVR.RPT",0,0,0,0,"","2012-12-13-00.00.00.000000"
/;
    
UPDATE version SET c_vers_version = '8.8.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.8.02
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (1038);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
1038,"L",10,"Projekt-Kostenbestimmung","A4hoch",1,"FrmProRechBF","VGLKST.RLV",0,0,275,0,"",2013-02-11-12.00.00.000000
/;

ALTER TABLE se_vgl ADD r_vgl_nebenkst DOUBLE PRECISION NOT NULL WITH DEFAULT;    
ALTER TABLE ie_proj ADD r_proj_erloes DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE ie_proj ADD r_proj_nebenkst DOUBLE PRECISION NOT NULL WITH DEFAULT;
    
UPDATE version SET c_vers_version = '8.8.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.8.03
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (329);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
329,"W",1,"Projektbeteiligtenliste m. Ansprechpartner","A4quer",2,"FrmProjektBF","TB_ADRBA.RPT",0,0,0,0,"","2013-02-26-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '8.8.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.8.04
*****************************************************************************
/

REMARK
\
*****************************************************************************
Funktionsaufruf zur Umsetzung des Betriebsstoffpreises in die Bez.-Liste Proj.
FUNCTION#BET_BEZ
*****************************************************************************
/

UPDATE version SET c_vers_version = '8.8.04', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.8.05
*****************************************************************************
/
ALTER TABLE se_mita ADD c_mita_abteilung CHAR(50);

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (330,331,332,333,334);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
330,"W",1,"nichtproduktive Tätigkeiten, ausgew. Monat","A4quer",1,"FrmGruppenPlaner","PP_NPRO.RPT",0,0,0,0,"","2013-05-07-00.00.00.000000"
331,"W",2,"nichtproduktive Tätigkeiten, ausgew. Jahr","A4quer",1,"FrmGruppenPlaner","PP_NPRO.RPT",0,0,0,0,"","2013-05-07-00.00.00.000000"
332,"W",1,"Telefonliste m. Ansprechpartner","A4hoch",1,"FrmProjektBF","TB_ADTLA.RPT",0,0,0,0,"","2013-05-08-00.00.00.000000"
333,"W",1,"Telefonliste m. Ansprechpartner","A4hoch",1,"TblAdressAL","TB_ADTLA.RPT",0,0,0,0,"","2013-05-08-00.00.00.000000"
334,"W",1,"Materialliste mit Barcode(128)","A4hoch",1,"TblAPArtikelAL","PC_BAR1.RPT",0,0,0,0,"","2013-05-17-00.00.00.000000"
/;


DELETE FROM pe_ruegk WHERE k_i_proj_nummer NOT IN (SELECT k_i_proj_nummer FROM ie_proj);
DROP INDEX in_ruegk;
DROP INDEX ui_ruegk;
CREATE UNIQUE INDEX ui_ruegk ON pe_ruegk ( k_i_proj_nummer, k_i_rueg_nummer, k_i_ruegk_nummer) PCTFREE 10;

UPDATE version SET c_vers_version = '8.8.05', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.8.06
*****************************************************************************
/
ALTER TABLE se_adr ADD c_adr_iban CHAR(50);
ALTER TABLE se_adr ADD c_adr_bic CHAR(50);
ALTER TABLE se_adr ADD c_adr_homepage CHAR(250);
ALTER TABLE se_adr ADD c_adr_staat CHAR(2);

UPDATE version SET c_vers_version = '8.8.06', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 8.8.07
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (247,304,335,336);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
247,"W",1,"EFB 222 Preisermittlung Kalkulation ü. Endsumme","A4hoch",1,"FrmAngebot","PC_EFB1B.RPT",0,0,256,0,"",2006-05-24-15.04.05.200000
304,"W",1,"EFB 221 Preisermittlung bei Zuschlagskalkulation","A4hoch",1,"FrmAngebot","PC_EF221.RPT",0,0,256,0,"",2006-05-24-15.04.05.200000
335,"W",1,"EFB 223 Aufgliederung der Einheitspreise","A4quer",2,"FrmPosAL","PC_EF223.RPT",0,0,256,0,"","2013-08-06-00.00.00.000000"
336,"W",1,"EFB 223 Aufgliederung der Einheitspreise","A4quer",1,"FrmAngebot","PC_EF223.RPT",0,0,256,0,"",2013-08-06-00.00.00.000000
/;

ALTER TABLE pe_lvs ADD c_lvs_biban CHAR(50);
ALTER TABLE pe_lvs ADD c_lvs_bbic CHAR(50);
ALTER TABLE pe_lvs ADD c_lvs_bstaat CHAR(2);
ALTER TABLE pe_lvs ADD i_lvs_sepa INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_lvn ADD c_lvn_biban CHAR(50);
ALTER TABLE pe_lvn ADD c_lvn_bbic CHAR(50);
ALTER TABLE pe_lvn ADD c_lvn_bstaat CHAR(2);
ALTER TABLE pe_lvn ADD i_lvn_sepa INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE se_adr ADD i_adr_sepa INTEGER NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '8.8.07', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.13.01
*****************************************************************************
/

DELETE FROM ie_pparam WHERE (@EXACT(c_pparam_modul, 'ProPlan') = 1) AND (c_pparam_var LIKE 'LB-%');
INSERT INTO ie_pparam (c_pparam_modul, c_pparam_var, c_pparam_value, c_pparam_bem)
VALUES(:1,:2,:3,:4)
\
"ProPlan","LB-Versionen","Gebäude;Innenräume;Freianlagen;Ingenieurbauwerke;Verkehrsanlagen;Tragwerksplanung;Technische Ausrüstung","Leistungsbilder zur Auswahl in ProPlan"
"ProPlan","LB-Phase-1","Grundlagenermittlung","Bezeichnung Leistungsphase 1"
"ProPlan","LB-Phase-2","Vorplanung","Bezeichnung Leistungsphase 2"
"ProPlan","LB-Phase-3","Entwurfsplanung","Bezeichnung Leistungsphase 3"
"ProPlan","LB-Phase-4","Genehmigungsplanung","Bezeichnung Leistungsphase 4"
"ProPlan","LB-Phase-5","Ausführungsplanung","Bezeichnung Leistungsphase 5"
"ProPlan","LB-Phase-6","Vorbereitung der Vergabe","Bezeichnung Leistungsphase 6"
"ProPlan","LB-Phase-7","Mitwirkung bei der Vergabe","Bezeichnung Leistungsphase 7"
"ProPlan","LB-Phase-8","Objektüberwachung","Bezeichnung Leistungsphase 8"
"ProPlan","LB-Phase-9","Objektbetreuung","Bezeichnung Leistungsphase 9"
"ProPlan","LB-Gebäude-1","2","Prozentwert Gebäude Leistungsphase 1"
"ProPlan","LB-Gebäude-2","7","Prozentwert Gebäude Leistungsphase 2"
"ProPlan","LB-Gebäude-3","15","Prozentwert Gebäude Leistungsphase 3"
"ProPlan","LB-Gebäude-4","3","Prozentwert Gebäude Leistungsphase 4"
"ProPlan","LB-Gebäude-5","25","Prozentwert Gebäude Leistungsphase 5"
"ProPlan","LB-Gebäude-6","10","Prozentwert Gebäude Leistungsphase 6"
"ProPlan","LB-Gebäude-7","4","Prozentwert Gebäude Leistungsphase 7"
"ProPlan","LB-Gebäude-8","32","Prozentwert Gebäude Leistungsphase 8"
"ProPlan","LB-Gebäude-9","2","Prozentwert Gebäude Leistungsphase 9"
"ProPlan","LB-Innenräume-1","2","Prozentwert Innenräume Leistungsphase 1"
"ProPlan","LB-Innenräume-2","7","Prozentwert Innenräume Leistungsphase 2"
"ProPlan","LB-Innenräume-3","15","Prozentwert Innenräume Leistungsphase 3"
"ProPlan","LB-Innenräume-4","2","Prozentwert Innenräume Leistungsphase 4"
"ProPlan","LB-Innenräume-5","30","Prozentwert Innenräume Leistungsphase 5"
"ProPlan","LB-Innenräume-6","7","Prozentwert Innenräume Leistungsphase 6"
"ProPlan","LB-Innenräume-7","3","Prozentwert Innenräume Leistungsphase 7"
"ProPlan","LB-Innenräume-8","32","Prozentwert Innenräume Leistungsphase 8"
"ProPlan","LB-Innenräume-9","2","Prozentwert Innenräume Leistungsphase 9"
"ProPlan","LB-Freianlagen-1","3","Prozentwert Freianlagen Leistungsphase 1"
"ProPlan","LB-Freianlagen-2","10","Prozentwert Freianlagen Leistungsphase 2"
"ProPlan","LB-Freianlagen-3","16","Prozentwert Freianlagen Leistungsphase 3"
"ProPlan","LB-Freianlagen-4","4","Prozentwert Freianlagen Leistungsphase 4"
"ProPlan","LB-Freianlagen-5","25","Prozentwert Freianlagen Leistungsphase 5"
"ProPlan","LB-Freianlagen-6","7","Prozentwert Freianlagen Leistungsphase 6"
"ProPlan","LB-Freianlagen-7","3","Prozentwert Freianlagen Leistungsphase 7"
"ProPlan","LB-Freianlagen-8","30","Prozentwert Freianlagen Leistungsphase 8"
"ProPlan","LB-Freianlagen-9","2","Prozentwert Freianlagen Leistungsphase 9"
"ProPlan","LB-Ingenieurbauwerke-1","2","Prozentwert Ingenieurbauwerke Leistungsphase 1"
"ProPlan","LB-Ingenieurbauwerke-2","20","Prozentwert Ingenieurbauwerke Leistungsphase 2"
"ProPlan","LB-Ingenieurbauwerke-3","25","Prozentwert Ingenieurbauwerke Leistungsphase 3"
"ProPlan","LB-Ingenieurbauwerke-4","5","Prozentwert Ingenieurbauwerke Leistungsphase 4"
"ProPlan","LB-Ingenieurbauwerke-5","15","Prozentwert Ingenieurbauwerke Leistungsphase 5"
"ProPlan","LB-Ingenieurbauwerke-6","13","Prozentwert Ingenieurbauwerke Leistungsphase 6"
"ProPlan","LB-Ingenieurbauwerke-7","4","Prozentwert Ingenieurbauwerke Leistungsphase 7"
"ProPlan","LB-Ingenieurbauwerke-8","15","Prozentwert Ingenieurbauwerke Leistungsphase 8"
"ProPlan","LB-Ingenieurbauwerke-9","1","Prozentwert Ingenieurbauwerke Leistungsphase 9"
"ProPlan","LB-Verkehrsanlagen-1","2","Prozentwert Verkehrsanlagen Leistungsphase 1"
"ProPlan","LB-Verkehrsanlagen-2","20","Prozentwert Verkehrsanlagen Leistungsphase 2"
"ProPlan","LB-Verkehrsanlagen-3","25","Prozentwert Verkehrsanlagen Leistungsphase 3"
"ProPlan","LB-Verkehrsanlagen-4","8","Prozentwert Verkehrsanlagen Leistungsphase 4"
"ProPlan","LB-Verkehrsanlagen-5","15","Prozentwert Verkehrsanlagen Leistungsphase 5"
"ProPlan","LB-Verkehrsanlagen-6","10","Prozentwert Verkehrsanlagen Leistungsphase 6"
"ProPlan","LB-Verkehrsanlagen-7","4","Prozentwert Verkehrsanlagen Leistungsphase 7"
"ProPlan","LB-Verkehrsanlagen-8","15","Prozentwert Verkehrsanlagen Leistungsphase 8"
"ProPlan","LB-Verkehrsanlagen-9","1","Prozentwert Verkehrsanlagen Leistungsphase 9"
"ProPlan","LB-Tragwerksplanung-1","3","Prozentwert Tragwerksplanung Leistungsphase 1"
"ProPlan","LB-Tragwerksplanung-2","10","Prozentwert Tragwerksplanung Leistungsphase 2"
"ProPlan","LB-Tragwerksplanung-3","15","Prozentwert Tragwerksplanung Leistungsphase 3"
"ProPlan","LB-Tragwerksplanung-4","30","Prozentwert Tragwerksplanung Leistungsphase 4"
"ProPlan","LB-Tragwerksplanung-5","40","Prozentwert Tragwerksplanung Leistungsphase 5"
"ProPlan","LB-Tragwerksplanung-6","2","Prozentwert Tragwerksplanung Leistungsphase 6"
"ProPlan","LB-Tragwerksplanung-7","0","Prozentwert Tragwerksplanung Leistungsphase 7"
"ProPlan","LB-Tragwerksplanung-8","0","Prozentwert Tragwerksplanung Leistungsphase 8"
"ProPlan","LB-Tragwerksplanung-9","0","Prozentwert Tragwerksplanung Leistungsphase 9"
"ProPlan","LB-Technische Ausrüstung-1","2","Prozentwert Technische Ausrüstung Leistungsphase 1"
"ProPlan","LB-Technische Ausrüstung-2","9","Prozentwert Technische Ausrüstung Leistungsphase 2"
"ProPlan","LB-Technische Ausrüstung-3","17","Prozentwert Technische Ausrüstung Leistungsphase 3"
"ProPlan","LB-Technische Ausrüstung-4","2","Prozentwert Technische Ausrüstung Leistungsphase 4"
"ProPlan","LB-Technische Ausrüstung-5","22","Prozentwert Technische Ausrüstung Leistungsphase 5"
"ProPlan","LB-Technische Ausrüstung-6","7","Prozentwert Technische Ausrüstung Leistungsphase 6"
"ProPlan","LB-Technische Ausrüstung-7","5","Prozentwert Technische Ausrüstung Leistungsphase 7"
"ProPlan","LB-Technische Ausrüstung-8","35","Prozentwert Technische Ausrüstung Leistungsphase 8"
"ProPlan","LB-Technische Ausrüstung-9","1","Prozentwert Technische Ausrüstung Leistungsphase 9"
/;

DELETE FROM ie_pparam WHERE (@EXACT(c_pparam_modul, 'Options') = 1) AND (@EXACT(c_pparam_var, 'ComboMitaSave') = 1);
DELETE FROM ie_pparam WHERE (@EXACT(c_pparam_modul, 'Options') = 1) AND (@EXACT(c_pparam_var, 'ComboProjSave') = 1);
INSERT INTO ie_pparam (c_pparam_modul, c_pparam_var, c_pparam_value, c_pparam_bem)
VALUES(:1,:2,:3,:4)
\
"Options","ComboMitaSave","1","1=Sichern und Wiederherstellen des Mitarbeiternamens in einer Mitarbeitercombobox"
"Options","ComboProjSave","1","1=Sichern und Wiederherstellen des Projektes in einer Projektcombobox"
/;

ALTER TABLE ie_proj ADD c_proj_leibild CHAR(40);

UPDATE version SET c_vers_version = '20.13.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.13.02
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (337);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
337,"W",1,"Adress-Etiketten, Zweckform-Nr. 3424","A4hoch",1,"TblAdressAL","tb_3424.rpt",0,0,0,0,"","2013-12-19-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '20.13.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.01
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (1063, 338);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
1063,"W",1,"Mengenübersicht Arbeitspakete","A4hoch",1,"FrmBlankVerteil","PC_MEAP.RPT",0,0,256,0,"",2014-06-27-00.00.00.000000
338,"W",1,"Mangel mit Bildern","A4hoch",1,"TblMangel","PA_MANGX.rpt",0,0,0,0,"","2014-07-15-00.00.00.000000"
/;

CREATE TABLE pb_mang_pic (
  k_i_mpic_nummer      INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
  k_i_mang_nummer      INTEGER           NOT NULL,
    i_mpic_fit         INTEGER           NOT NULL WITH DEFAULT,
    c_mpic_datei       CHAR(250),
    c_mpic_bemerk      CHAR(250),
    l_mpic_bild        LONG              NOT NULL WITH DEFAULT,
    d_mpic_aenddat     DATETIME          NOT NULL WITH DEFAULT
) PCTFREE 10;

CREATE UNIQUE INDEX ui_mpic1 ON pb_mang_pic ( k_i_proj_nummer, k_i_mpic_nummer) PCTFREE 10;

UPDATE version SET c_vers_version = '20.14.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.02
*****************************************************************************
/
ALTER TABLE ae_mits ADD i_mits_groupid INTEGER NOT NULL WITH DEFAULT;

DROP INDEX ui_aemits;
CREATE UNIQUE INDEX ui_aemits ON ae_mits (k_i_proj_nummer,k_i_apk_nummer,k_i_mita_nummer,k_i_palm_nummer,d_mits_datum, c_mits_zeitvon, c_mits_zeitbis) PCTFREE 10;

DROP INDEX ui_tbg;
CREATE UNIQUE INDEX ui_tbg ON ae_tbg (k_i_tbp_nummer, k_i_ger_nummer, d_ger_von, d_ger_bis) PCTFREE 10;

UPDATE version SET c_vers_version = '20.14.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.03
*****************************************************************************
/
	   
ALTER TABLE ae_tbl ADD k_i_apk_nummer INTEGER NOT NULL;
ALTER TABLE ae_tbl ADD r_apk_fertig DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbl ADD i_tbl_dirty INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbl ADD d_tbl_aenddat DATETIME;
ALTER TABLE ae_tbl ADD c_tbl_bemerk CHAR (254);
ALTER TABLE ae_zeit ADD k_i_apk_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD i_zeit_mobil INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_zeit ADD i_apk_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD i_zeit_groupid INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD k_i_tbp_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD k_i_apk_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD k_i_zu_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD i_modul_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD i_zeit_dirty INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbp ADD i_tbp_dirty INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbg ADD i_tbg_dirty INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_palm ADD i_palm_dirty INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbb ADD i_tbb_dirty INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbb ADD d_tbb_aenddat DATETIME;
ALTER TABLE ae_tbm ADD c_mita_bemerk CHAR (254);

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (339, 340, 341);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
339,"L",11,"Rücksendung Bürgschaft","A4hoch",1,"FrmLVAL","RUECKB.RLV",0,0,0,0,"","2014-09-30-00.00.00.000000"
340,"L",12,"Enthaftungserklärung","A4hoch",1,"FrmLVAL","ENTHAFT.RLV",0,0,0,0,"","2014-09-30-00.00.00.000000"
341,"W",1,"Arbeitspaket-Statistik","A4hoch",1,"TblAPKStatistik","TB_APKST.rpt",0,0,0,0,"","2014-11-24-00.00.00.000000"
/;

ALTER TABLE ie_term MODIFY c_term_user CHAR(250);
UPDATE ie_term SET c_term_user = '[' || c_term_user || ']' where @length(c_term_user ) > 0 And @scan(c_term_user,'[') = -1;

ALTER TABLE pe_apk ADD d_apk_beginn DATETIME;
ALTER TABLE pe_apk ADD d_apk_ende DATETIME;
ALTER TABLE pe_apk ADD r_apk_zusatz DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE version ADD c_vers_kundennr CHAR(50);
DROP INDEX in_apkdate;
CREATE INDEX in_apkdate ON pe_apk (k_i_proj_nummer, d_apk_beginn, d_apk_ende) PCTFREE 10;
DELETE FROM ie_dru;
DELETE FROM ie_ldru;

UPDATE version SET c_vers_version = '20.14.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.04
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (342);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
342,"W",1,"Monatsstunden Mitarbeiter","A4hoch",1,"TblPruefMonatMA","PW_MONLI.rpt",0,0,0,0,"","2015-02-04-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '20.14.04', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.05
*****************************************************************************
/
ALTER TABLE ae_tbb ADD c_tbb_notiz CHAR(254);
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (343);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
343,"W",1,"Mehr-Mindermengen mit Geschäftskostenkorrektur","A4quer",1,"FrmAngebot","PC_MVOB.RPT",0,0,0,0,"","2015-03-10-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '20.14.05', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.06
*****************************************************************************
/
ALTER TABLE pe_biet ADD i_biet_kst INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_zuab ADD i_zuab_ats INTEGER NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '20.14.06', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.07
*****************************************************************************
/
ALTER TABLE pe_prjan ADD r_prjan_bgeslohn   DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgesschal  DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgesstoff  DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgesmasch  DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgesfremd1 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgesfremd2 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgesfremd3 DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgesprod   DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_prjan ADD r_prjan_bgespreis  DOUBLE PRECISION  NOT NULL WITH DEFAULT;

ALTER TABLE pe_lvs ADD c_lvs_bedarftext CHAR(40);

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (344);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
344,"W",1,"Arbeitspaket-Statistik m. Auftragnehmer","A4hoch",1,"TblAPKStatistik","TB_APKS1.rpt",0,0,0,0,"","2015-04-15-00.00.00.000000"
/;

UPDATE version SET c_vers_version = '20.14.07', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.08
*****************************************************************************
/

REMARK
\
*****************************************************************************
Funktionsaufruf zur Vorbelegung der ATS-Kennzeichen in Zulagen/Abzügen
FUNCTION#UPDATE_ZUAB_ATS
*****************************************************************************
/

UPDATE version SET c_vers_version = '20.14.08', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.09
*****************************************************************************
/
ALTER TABLE se_din ADD i_din_nurindex INTEGER  NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (160,345,346,347,1045);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
160,"W",1,"Positionsstatistik","A4hoch",1,"FrmPosStatistik","PC_PSTAT.RPT",0,0,256,0,"",2001-12-20-14.39.10.364000
1045,"W",2,"Projektberechnungsarten","A4hoch",1,"FrmVglKstUeb","PR_PBART.RPT",0,0,275,0,"",2015-05-08-00.00.00.000000
345,"W",3,"Bietervorschlagsliste","A4quer",1,"TblAdressAL","TB_ADRBI.RPT",0,0,276,0,"","2015-06-03-00.00.00.000000"
346,"W",1,"Kostenarten-Summen Positionsliste","A4quer",2,"FrmAngebot","PM_AUFK.RPT",0,0,256,0,"","2015-06-24-00.00.00.000000"
347,"W",4,"Mitarbeiter-Stundennachweis (MiLoG)","A4hoch",2,"TblPWMitaProjUebersicht","PW_MILO.RPT",0,0,10,0,"","2015-07-01-00.00.00.000000"
/;

DROP VIEW sv_adr_fkz;
CREATE VIEW sv_adr_fkz (
  c_fkz_kennz, 
  c_fkz_system_m, 
  k_i_adr_nummer, 
  k_i_fkz_nummer) AS 
SELECT g.c_fkz_kennz, g.c_fkz_system_m, b.k_i_adr_nummer, b.k_i_fkz_nummer
  FROM sb_adr_fkz b,se_fkz g
 WHERE b.k_i_fkz_nummer=g.k_i_fkz_nummer;
 
UPDATE version SET c_vers_version = '20.14.09', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.14.10
*****************************************************************************
/

REMARK
\
*****************************************************************************
Funktionsaufruf zum Umschaufeln der Merkmale in se_vgl
FUNCTION#ALTER_SEVGL
*****************************************************************************
/
UPDATE version SET c_vers_version = '20.14.10', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.15.01
*****************************************************************************
/

DROP INDEX fi_lpo_fre1;
CREATE       INDEX fi_lpo_fre1 ON pb_lpo_fre (
  k_i_proj_nummer, k_i_lpo_nummer, k_i_fre_nummer
) PCTFREE 10;

DROP INDEX fi_lpo_ger;
CREATE INDEX fi_lpo_ger ON pb_lpo_ger (
    k_i_proj_nummer, k_i_lpo_nummer, k_i_ger_nummer
) PCTFREE 10;

DROP INDEX fi_lpo_art;
CREATE INDEX fi_lpo_art ON pb_lpo_art (
    k_i_proj_nummer, k_i_lpo_nummer, k_i_art_nummer
) PCTFREE 10;

DROP INDEX in_tlpoart;
CREATE INDEX in_tlpoart ON te_lpoart(k_i_pid,k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_tlpoger;
CREATE INDEX in_tlpoger ON te_lpoger(k_i_pid,k_i_proj_nummer) PCTFREE 10;
DROP INDEX in_tlpofre;
CREATE INDEX in_tlpofre ON te_lpofre(k_i_pid,k_i_proj_nummer) PCTFREE 10;

UPDATE version SET c_vers_version = '20.15.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.15.02
*****************************************************************************
/
ALTER TABLE pe_auva ADD i_auva_inaktiv INTEGER NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '20.15.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.15.03
*****************************************************************************
/
ALTER TABLE ae_korb ADD c_korb_bemerk CHAR(100);

UPDATE version SET c_vers_version = '20.15.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.15.04
*****************************************************************************
/
ALTER TABLE ie_proj ADD i_proj_reb91 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_pap ADD i_pap_inaktiv INTEGER NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '20.15.04', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.15.05
*****************************************************************************
/

UPDATE pe_lvs SET i_lvs_textlen = @LENGTH(l_lvs_vorwort);
ALTER TABLE ie_zeit ADD i_zeit_pause2 INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_zeit ADD i_modul_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_zeit ADD k_i_zeit_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ie_zeit ADD k_i_tbp_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_zeit ADD k_i_zeit_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbl ADD k_i_tbl_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE ae_tbg ADD k_i_tbg_nummer INTEGER NOT NULL WITH DEFAULT;

DROP INDEX ui_tbl1;
CREATE UNIQUE INDEX ui_tbl1 ON ae_tbl (k_i_tbl_nummer) PCTFREE 10;
DROP INDEX ui_tbg1;
CREATE UNIQUE INDEX ui_tbg1 ON ae_tbg (k_i_tbg_nummer) PCTFREE 10;
DROP INDEX ui_tbb1;
CREATE UNIQUE INDEX ui_tbb1 ON ae_tbb (k_i_tbb_nummer) PCTFREE 10;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (1117);
INSERT INTO ie_rpt (k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich, c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename, i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark, d_rpt_aenddat)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
1117,"W",14,"Mengenermittlung - REB","A4quer",2,"TblMengeREB91AL","PS_MEREB.RPT",0,0,4,0,"",2016-02-15-00.00.00.000000
/;

UPDATE version SET c_vers_version = '20.15.05', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.15.06
*****************************************************************************
/

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (183,328,348,349);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
183,"W",2,"Preis-Statistik Amt/Überregional - Grafik","A4quer",1,"FrmPreisIndex","PR_KRV.RPT",0,0,0,0,"","2002-12-16-14.27.05.200000"
348,"W",3,"Preis-Statistik Amt/Regional - Grafik","A4quer",1,"FrmPreisIndex","PR_KRV1.RPT",0,0,0,0,"","2002-12-16-14.27.05.200000"
349,"W",4,"Preis-Statistik Amt/Regional/Überregional - Grafik","A4quer",1,"FrmPreisIndex","PR_KRV2.RPT",0,0,0,0,"","2002-12-16-14.27.05.200000"
/;

UPDATE version SET c_vers_version = '20.15.06', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.16.01
*****************************************************************************
/

CREATE TABLE pe_raum (
  k_i_raum_nummer         INTEGER           NOT NULL,
  k_i_proj_nummer         INTEGER           NOT NULL,
    i_apk_nummer          INTEGER           NOT NULL WITH DEFAULT,
    i_raum_ebene          INTEGER           NOT NULL WITH DEFAULT,
    i_raum_parent         INTEGER           NOT NULL WITH DEFAULT,
    i_raum_childs         INTEGER           NOT NULL WITH DEFAULT,
    i_raum_vor            INTEGER           NOT NULL WITH DEFAULT,
    i_raum_nach           INTEGER           NOT NULL WITH DEFAULT,
    c_raum_text           CHAR(100),
    c_raum_code           CHAR(100),
    d_raum_aenddat        DATETIME          NOT NULL WITH DEFAULT
);

DROP INDEX ui_raum1;
CREATE UNIQUE INDEX ui_raum1 ON pe_raum (k_i_proj_nummer, k_i_raum_nummer) PCTFREE 10;
DROP INDEX ie_raum1;
CREATE INDEX ie_raum1 ON pe_raum (k_i_proj_nummer, i_apk_nummer) PCTFREE 10;

CREATE TABLE pe_dinh (
  k_i_dinh_nummer      INTEGER           NOT NULL,
  k_i_proj_nummer      INTEGER           NOT NULL,
    i_din_nummer       INTEGER           NOT NULL WITH DEFAULT,
    i_dinh_lfd         INTEGER           NOT NULL WITH DEFAULT,
    i_dinh_kw          INTEGER           NOT NULL WITH DEFAULT,
    i_dinh_jahr        INTEGER           NOT NULL WITH DEFAULT,
    d_dinh_datum       DATE,
	c_dinh_text        char(100),
    r_dinh_vertrag     DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_nachtrag    DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_prognose    DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_zahlung     DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_user        DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_n_vertrag   DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_n_nachtrag  DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_n_prognose  DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_n_zahlung   DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    r_dinh_n_user      DOUBLE PRECISION  NOT NULL WITH DEFAULT,
    d_dinh_aenddat     DATETIME          NOT NULL WITH DEFAULT
) PCTFREE 10;

DROP INDEX ui_dinh1;
CREATE UNIQUE INDEX ui_dinh1 ON pe_dinh (k_i_proj_nummer, k_i_dinh_nummer) PCTFREE 10;
DROP INDEX ie_dinh1;
CREATE INDEX ie_dinh1 ON pe_dinh (k_i_proj_nummer, i_din_nummer, i_dinh_lfd, i_dinh_kw, i_dinh_jahr) PCTFREE 10;

ALTER TABLE pe_mer ADD i_raum_nummer INTEGER NOT NULL WITH DEFAULT;
ALTER TABLE pe_ikst ADD d_ikst_redatum DATETIME;
ALTER TABLE pe_ikst ADD c_ikst_renr CHAR(50);
ALTER TABLE pe_ikst ADD c_ikst_lieferant CHAR(100);
ALTER TABLE pe_ikst ADD c_ikst_konto CHAR(50);
ALTER TABLE pe_ikst MODIFY c_ikst_bemerk CHAR(100);
ALTER TABLE pe_lvs ADD r_lvs_rueck DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_lvn ADD r_lvn_rueck DOUBLE PRECISION  NOT NULL WITH DEFAULT;
ALTER TABLE pe_auft ADD i_auft_man_nummer INTEGER    NOT NULL WITH DEFAULT;
ALTER TABLE ie_ral ADD l_ral_protokoll LONG;
ALTER TABLE pe_raum ADD i_apk_nummer INTEGER NOT NULL WITH DEFAULT;
UPDATE ie_urpt SET c_urpt_filename = @UPPER(c_urpt_filename);
UPDATE ie_rpt SET c_rpt_filename = @UPPER(c_rpt_filename);
UPDATE ie_urpt SET c_urpt_filename = 'RECH_NZA.RLV' WHERE i_rpt_nummer=204 AND c_urpt_filename = 'RECH_NZ.RLV';

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (204,350,351,352,1118);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
204,"L",11,"Rechnung auf AP-Basis","A4hoch",1,"FrmRechnungBF","RECH_NZA.RLV",0,0,771,0,"",2016-07-14-00.00.00.000000
350,"W",1,"Aufmaß A-E","A4hoch",1,"TblRaumMengenEL","PC_SHK1.RPT",0,0,21,0,"",2016-06-27-00.00.00.000000
351,"W",2,"Mengenverteilung Position / Raum","A4hoch",1,"TblRaumMengenEL","PC_SHK2.RPT",0,0,21,0,"",2016-06-27-00.00.00.000000
352,"W",3,"Mengenermittlung SHK komprimiert","A4hoch",1,"TblRaumMengenEL","PC_SHK3.RPT",0,0,21,0,"",2016-06-27-00.00.00.000000
1118,"W",2,"Projekt-IST-Kosten ausführlich","A4quer",1,"TblIstKostenAL","PC_IKSTQ.RPT",0,0,256,0,"",2016-05-04-00.00.00.000000
/;

UPDATE version SET c_vers_version = '20.16.01', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.16.02
*****************************************************************************
/

REMARK
\
*****************************************************************************
Funktionsaufruf zum Kopieren des Druckes RECH_NZA
FUNCTION#INS_RECHNZA
*****************************************************************************
/
UPDATE version SET c_vers_version = '20.16.02', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.16.03
*****************************************************************************
/
DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (18,298);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
18,"W",2,"Datenbank-Zugriffe","A4quer",2,"FrmStatus","LOCK.RPT",0,0,0,0,"","1997-04-18-11.01.05.050000"
298,"W",1,"Programmparameter","A4hoch",1,"FrmStatus","TB_PPAR.RPT",0,0,0,0,"",2010-03-23-00.00.00.000000
/;

UPDATE version SET c_vers_version = '20.16.03', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.16.04
*****************************************************************************
/
ALTER TABLE pb_mang_pic ADD c_mpic_tbdatei CHAR(250);
ALTER TABLE pb_mang_pic ADD i_mpic_lfd INTEGER NOT NULL WITH DEFAULT;

UPDATE version SET c_vers_version = '20.16.04', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.16.05
*****************************************************************************
/
DROP INDEX ie_raum1;
DROP INDEX ui_raum2;
CREATE UNIQUE INDEX ui_raum2 ON pe_raum (k_i_proj_nummer, i_apk_nummer, c_raum_code) PCTFREE 10;

UPDATE version SET c_vers_version = '20.16.05', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.16.06
*****************************************************************************
/

UPDATE ie_rpt SET C_RPT_ITEMNAME = 'TblStundenMitschreibungAuftrag' WHERE C_RPT_ITEMNAME = 'TblStundenMitschreibung_Auftrag';
UPDATE ie_rpt SET C_RPT_ITEMNAME = 'TblMitaProjUebersichtAuftrag' WHERE C_RPT_ITEMNAME = 'TblMitaProjUebersicht_Auftrag';

UPDATE version SET c_vers_version = '20.16.06', d_vers_aenddat = SYSDATETIME;

REMARK
\
*****************************************************************************
DB-VERSION: 20.16.07
*****************************************************************************
/
ALTER TABLE pb_lpo_fre ADD r_lpo_fre_faktor DOUBLE PRECISION ;
UPDATE pb_lpo_fre SET r_lpo_fre_faktor = 1 WHERE r_lpo_fre_faktor IS NULL;
ALTER TABLE pb_lpo_fre MODIFY r_lpo_fre_faktor NOT NULL WITH DEFAULT;
ALTER TABLE pb_lpo_fre ADD c_lpo_fre_rezi CHAR(1);
ALTER TABLE te_lpofre ADD r_lpo_fre_faktor DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE te_lpofre ADD c_lpo_fre_rezi CHAR(1);


ALTER TABLE sb_pos_fre ADD r_pos_fre_faktor DOUBLE PRECISION ;
UPDATE sb_pos_fre SET r_pos_fre_faktor = 1 where r_pos_fre_faktor IS NULL;
ALTER TABLE sb_pos_fre MODIFY r_pos_fre_faktor NOT NULL WITH DEFAULT;
ALTER TABLE sb_pos_fre ADD c_pos_fre_rezi CHAR(1);

ALTER TABLE ie_ral ADD r_ral_nsicher DOUBLE PRECISION NOT NULL WITH DEFAULT;
ALTER TABLE ie_proj ADD i_proj_pp_nachweis INTEGER NOT NULL WITH DEFAULT;

ALTER TABLE pe_kst ADD i_kst_sperr INTEGER NOT NULL WITH DEFAULT;

DELETE FROM ie_rpt WHERE k_i_rpt_nummer in (353,354,355);
INSERT INTO ie_rpt ( k_i_rpt_nummer, c_rpt_kz, i_rpt_variante, c_rpt_bezeich,  c_rpt_format, i_ldru_nummer, c_rpt_itemname, c_rpt_filename,  i_rpt_status, i_rpt_user, i_rpt_dialog, i_rpt_module, c_rpt_remark ,D_RPT_AENDDAT)
VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14)
\
353,"W",12,"Mitarbeiter Monatssummen Kalenderjahr","A4quer",0,"TblMitaProjUebersicht","PZ_AAPS.RPT",0,0,10,0,"",2016-11-09-00.00.00.000000
354,"W",1,"Leistungsnachweis nicht abgerechnete Mitschreibungen","A4hoch",0,"FrmNachweisProj","PZ_NACH1.RPT",0,0,0,0,"",2016-11-09-00.00.00.000000
355,"L",2,"Honorar-Rechnung zum Nachweis","A4hoch",0,"FrmNachweisProj","HONRNACH.RTX",0,0,0,0,"",2016-11-23-00.00.00.000000
/;

UPDATE version SET c_vers_version = '20.16.07', d_vers_aenddat = SYSDATETIME;

