![]() |
|
|
|
#1 |
|
no more than sympathy
![]() ![]() ![]() ![]() ![]() Location: lying on the floor
Posts: 14,826
|
Code:
set nocount on go use av_allg; if exists ( select * from sysobjects where name='VIE_HLP_LEI_AB' ) drop table VIE_HLP_LEI_AB go CREATE TABLE VIE_HLP_LEI_AB ( -- Allgemeine Felder HLP_Filter tinyint NULL , HLP_Zeile int NULL , HLP_AVPeriodeID varchar(30) NULL , HLP_StundenID numeric(9, 0) NULL , HLP_KostenID numeric(9, 0) NULL , HLP_AVBuchungID numeric(9, 0) NULL , HLP_Prefix numeric(2, 0) NULL , HLP_FakturaDetID numeric(9, 0) NULL , HLP_Status numeric(2, 0) NULL , LEI_LEISTUNGLFDNR numeric(15, 0) NULL , -- Felder für die GF-DÜ LEI_HONORARPOSNR numeric(15, 0) NULL , LEI_STORNO_HONORARPOSNR numeric(15, 0) NULL , LEI_UMBUVON_LEISTUNGLFDNR numeric(15, 0) NULL , LEI_UMBUAUF_LEISTUNGLFDNR numeric(15, 0) NULL , LEI_STORNO_LEISTUNGLFDNR numeric(15, 0) NULL , LEI_TAUSCH_LEISTUNGLFDNR numeric(15, 0) NULL , LEI_TRAK_LEISTUNGLFDNR numeric(15, 0) NULL , LEI_NEUBUCHUNGSTYP numeric(1, 0) NULL , LEI_LEISTUNGSSTATUS numeric(1, 0) NULL , LEI_ISTGUTSCHRIFT numeric(1, 0) NULL , LEI_ISTWERTGEBUEHR numeric(1, 0) NULL , LEI_ISTFREMDLEISTUNG numeric(1, 0) NULL , LEI_ISTAKONTO numeric(1, 0) NULL , LEI_ISTGESPERRT numeric(1, 0) NULL , LEI_ISTSPLITTLEISTUNG numeric(1, 0) NULL , LEI_ISTSTORNOBUCHUNG numeric(1, 0) NULL , LEI_HONORAR numeric(24, 9) NULL , LEI_ORGHONORAR numeric(24, 9) NULL , LEI_NACHLASS numeric(24, 9) NULL , LEI_ORG_FIRMENNR numeric(10, 0) NULL , LEI_ORG_MIT_FIRMENNR numeric(10, 0) NULL , LEI_ORG_MITARBEITERID varchar(16) NULL , LEI_ORG_PER_FIRMENNR numeric(10, 0) NULL , LEI_ORG_PERSONENID varchar(16) NULL , LEI_ORG_PRO_FIRMENNR numeric(10, 0) NULL , LEI_ORG_PROJEKTNR numeric(10, 0) NULL , LEI_ORG_PROJEKTTYP numeric(2, 0) NULL , LEI_TAUSCHART numeric(1, 0) NULL , LEI_LEIST_MENGE numeric(15, 5) NULL , LEI_LEIST_MENGE_VERRECHBAR numeric(15, 5) NULL , LEI_ISTKORREKT numeric(1, 0) NULL , -- Weitere Felder HLP_ERST_TST numeric(14, 0) NULL , HLP_SRC_GF varchar(30) NULL , LEI_HNPOS_JAHR numeric(4, 0) NULL , LEI_HNPOS_MONAT numeric(2, 0) NULL , LEI_HNPOS_UNTERPERIODE numeric(2, 0) NULL , LEI_ZEILENNR numeric(9, 0) NULL , LEI_AENDERUNGSDATUM datetime NULL , LEI_ERSTELLDATUM datetime NULL , LEI_LETZTERUSER varchar(10) NULL , LEI_ERSTELLUSER varchar(10) NULL , -- Sonstige Felder, die nicht verwendet werden LEI_MIT_AUSDRUCK_GRUPPE numeric(1, 0) NULL , LEI_RECHNUNGSGRUPPE numeric(4, 0) NULL , LEI_STZUGEHOER_FIRMENNR numeric(10, 0) NULL , LEI_STZUGEHOER_PERSONENID varchar(16) NULL , LEI_POSTITNR numeric(15, 0) NULL , LEI_LEI_SESSIONID numeric(15, 0) NULL , LEI_VZEIT datetime NULL , LEI_BZEIT datetime NULL ) ON [PRIMARY] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[VIE_HLP_HNP_AB]')) drop table VIE_HLP_HNP_AB go CREATE TABLE [VIE_HLP_HNP_AB] ( -- "Normale" HNP-Felder aus NTCS [HNP_ISTINARBEIT] [numeric](1, 0) NULL , [HNP_BEARBEITUNGSUSER] [varchar] (10) COLLATE Latin1_General_CI_AS NULL , [HNP_VONLEISTUNGSZEITRAUM] [datetime] NULL , [HNP_BISLEISTUNGSZEITRAUM] [datetime] NULL , [HNP_WAEHRUNGSCODE] [varchar] (4) COLLATE Latin1_General_CI_AS NULL , [HNP_TAGESKURS] [numeric](24, 9) NULL , [HNP_HONORARPOSNR] [numeric](15, 0) NOT NULL , [HNP_POSTITNR] [numeric](15, 0) NULL , [HNP_GEHOERT_FIRMENNR] [numeric](10, 0) NULL , [HNP_GEHOERTZU_HONORARPOSNR] [numeric](15, 0) NULL , [HNP_FKT_FIRMENNR] [numeric](10, 0) NULL , [HNP_FIRMENKATEGORIEKZ] [numeric](4, 0) NULL , [HNP_FIRMENKATEGORIELFDNR] [numeric](4, 0) NULL , [HNP_FRT_FIRMENNR] [numeric](10, 0) NULL , [HNP_FRT_FAKTURATYPNR] [numeric](4, 0) NULL , [HNP_PER_FIRMENNR] [numeric](10, 0) NULL , [HNP_PER_PERSONENID] [varchar] (16) COLLATE Latin1_General_CI_AS NULL , [HNP_GF_FIRMENNR] [numeric](10, 0) NULL , [HNP_GF_MITARBEITERID] [varchar] (16) COLLATE Latin1_General_CI_AS NULL , [HNP_AL_FIRMENNR] [numeric](10, 0) NULL , [HNP_AL_MITARBEITERID] [varchar] (16) COLLATE Latin1_General_CI_AS NULL , [HNP_SAP_FIRMENNR] [numeric](10, 0) NULL , [HNP_SAP_SAMMELPROJEKTNR] [numeric](10, 0) NULL , [HNP_WKT_FIRMENNR] [numeric](10, 0) NULL , [HNP_WKT_KONTENTABNR] [numeric](9, 0) NULL , [HNP_HONORARPOSTYP] [numeric](2, 0) NULL , [HNP_FAKTURAKZ] [numeric](2, 0) NULL , [HNP_BELEGNR] [numeric](9, 0) NULL , [HNP_BELEGDATUM] [datetime] NULL , [HNP_ERSTELLUNGSTYP] [numeric](2, 0) NULL , [HNP_VERSANDDATUM] [datetime] NULL , [HNP_BUCHUNGSJAHR] [numeric](4, 0) NULL , [HNP_BUCHUNGSMONAT] [numeric](2, 0) NULL , [HNP_ISTSTORNIERT] [numeric](1, 0) NULL , [HNP_BEARBEITUNGSSTATUS] [numeric](1, 0) NULL , [HNP_ISTFIBUVERBUCHT] [numeric](1, 0) NULL , [HNP_ZAHLSCHEIN_GEDRUCKT] [numeric](1, 0) NULL , [HNP_BANKEINZUG_ERSTELLT] [numeric](1, 0) NULL , [HNP_HONPOSTEXT] [varchar] (250) COLLATE Latin1_General_CI_AS NULL , [HNP_AENDERUNGSDATUM] [datetime] NULL , [HNP_ERSTELLDATUM] [datetime] NULL , [HNP_LETZTERUSER] [varchar] (10) COLLATE Latin1_General_CI_AS NULL , [HNP_ERSTELLUSER] [varchar] (10) COLLATE Latin1_General_CI_AS NULL, [HNP_SESSIONID] [numeric](15, 0) NULL , [HNP_KONTROLLNR] [numeric](15, 0) NULL , [HNP_HONORARBEZAHLT] [numeric](24, 9) NULL , [HNP_HONORAR] [numeric](24, 9) NOT NULL , [HNP_SELBSTKOSTEN] [numeric](24, 9) NOT NULL, [HNP_STORNOBELEGNR] [numeric](9, 0) NULL , [HNP_ISTAUFGELOEST] [numeric](1, 0) NULL , [HNP_TRABZUG] [numeric](1, 0) NULL , [HNP_HATTEILRECHNUNG] [numeric](1, 0) NULL , [HNP_EMPF_FIRMENNR] [numeric](10, 0) NULL , [HNP_EMPF_PERSONENID] [varchar] (16) COLLATE Latin1_General_CI_AS NULL , [HNP_EDIT_DOG] [varchar] (10) COLLATE Latin1_General_CI_AS NULL , [HNP_SHOW_DOG] [varchar] (10) COLLATE Latin1_General_CI_AS NULL , [HNP_BELEGSYMBOL] [varchar] (2) COLLATE Latin1_General_CI_AS NULL , [HNP_GUTVON_HONORARPOSNR] [numeric](15, 0) NULL , [HNP_UNTERPERIODE] [numeric](2, 0) NULL , [HNP_FIRMA_BANKINSTLFDNR] [numeric](15, 0) NULL , [HNP_SENT_JAHR] [numeric](4, 0) NULL , [HNP_SENT_MONAT] [numeric](2, 0) NULL , [HNP_FOLGE_HONORARPOSNR] [numeric](15, 0) NULL , [HNP_ISTINTERN] [numeric](1, 0) NULL , [HNP_IHR_ZEICHEN] [varchar] (25) COLLATE Latin1_General_CI_AS NULL , [HNP_UNSER_ZEICHEN] [varchar] (25) COLLATE Latin1_General_CI_AS NULL , [HNP_ADRESSARTNR] [numeric](4, 0) NULL , [HNP_HERSTELLKOSTEN] [numeric](24, 9) NULL, [HNP_TEILRECH_KUMULIERT] [numeric](1, 0) NULL , [HNP_ZAHLARTNR] [numeric](4, 0) NULL , [HNP_ZAHLART_ERSTELLT] [numeric](1, 0) NULL, -- Weitere Felder für die DÜ-Vorbereitung [HNP_HLP_AVPeriodeID] [varchar] (30) NULL, [HNP_HLP_FakturaId] [numeric] (9) NULL, [HNP_HLP_UmbuchungID] [numeric] (9) NULL, [HNP_HLP_GF] [varchar] (30) NULL, [HNP_HLP_AVBuchungID] [numeric] (9) NULL, [HNP_HLP_Status] [numeric](2,0) null ) ON [PRIMARY] GO declare @fakt_fdintfakturaid as numeric(9,0) declare @fakt_fdintfakturatypid as numeric (9,0) declare @fakt_fdchravperiodeid as varchar(30) declare @faktdet_fdchravperiodeid as varchar(30) declare @faktdet_fdintfakturadetid as numeric(9,0) declare @avb_fdintavbuchungid as numeric(9,0) declare @avb_fdchravbuchungsart as varchar(5) declare @avb_fdintbelegid as numeric(9,0) declare @avb_fdchreinavperiodeid as varchar(30) declare @avb_fdchrausavperiodeid as varchar(30) declare @avb_fdintstundenid as numeric(9,0) declare @avb_fdintkostenid as numeric(9,0) declare @aktr_faktdet_fdintfakturadetid as numeric(9,0) declare @aktr_fakt_fdintfakturaid as numeric(9,0) declare @aktr_fakt_fdintfakturatypid as numeric(9,0) declare @aktr_fakt_fddecbetragnetto as float declare @aktr_fakt_fdchravperiodeid as varchar(30) declare @old_faktdet_fdchravperiodeid as varchar(30) declare @old_fakt_fdintfakturaid as numeric(9,0) declare @old_faktdet_fdintfakturadetid as numeric(9,0) declare @cnt as numeric(1,0) declare @fkt_cnt as numeric(1,0) declare @fdt_cnt as numeric (2,0) declare @prd_cnt as numeric (2,0) set @cnt=0 set @fkt_cnt=0 set @fdt_cnt=0 set @prd_cnt=1 declare cur_ab cursor for select fakt.fdintfakturaid , faktdet.fdchravperiodeid , faktdet.fdintfakturadetid , avb.fdintavbuchungid , avb.fdchravbuchungsart , avb.fdintbelegid , avb.fdchreinavperiodeid , avb.fdchrausavperiodeid , avb.fdintstundenid , avb.fdintkostenid , aktr_faktdet.fdintfakturadetid , aktr_fakt.fdintfakturaid , aktr_fakt.fdintfakturatypid , isnull(aktr_fakt.fddecbetragnetto,0) , aktr_fakt.fdchravperiodeid , fakt.fdintfakturatypid , fakt.fdchravperiodeid from av_vie..tbfaktura fakt inner join av_vie..tbfakturadet faktdet on (faktdet.fdintfakturaid = fakt.fdintfakturaid) inner join av_vie..tbavbuchung avb on (faktdet.fdintfakturadetid = avb.fdintausbuchgrundid and avb.fdchrausbuchungsart='FAKT') left join av_vie..tbfakturadet as aktr_faktdet with (nolock) on (avb.fdintbelegid = aktr_faktdet.fdintfakturadetid) left join av_vie..tbfaktura as aktr_fakt with (nolock) on (aktr_faktdet.fdintfakturaid = aktr_fakt.fdintfakturaid) left join ( select fdintfakturaid from ( select distinct fdintfakturaid ,fdchravperiodeid from av_vie..tbfakturadet ) fdt group by fdintfakturaid having count(*) > 1 )tmp1 on tmp1.fdintfakturaid = fakt.fdintfakturaid where tmp1.fdintfakturaid is not null and (fakt.fdintstornofakturaid is null or fakt.fdintstornofakturaid = 0) and fakt.fdintfakturaart in (3,6) --and avb.fdchravbuchungsart='AK' order by 1,2,3 open cur_ab fetch next from cur_ab into @fakt_fdintfakturaid , @faktdet_fdchravperiodeid , @faktdet_fdintfakturadetid , @avb_fdintavbuchungid , @avb_fdchravbuchungsart , @avb_fdintbelegid , @avb_fdchreinavperiodeid , @avb_fdchrausavperiodeid , @avb_fdintstundenid , @avb_fdintkostenid , @aktr_faktdet_fdintfakturadetid , @aktr_fakt_fdintfakturaid , @aktr_fakt_fdintfakturatypid , @aktr_fakt_fddecbetragnetto , @aktr_fakt_fdchravperiodeid , @fakt_fdintfakturatypid , @fakt_fdchravperiodeid while (@@fetch_status <> -1) begin if (@@fetch_status <> -2) begin if (@old_fakt_fdintfakturaid = @fakt_fdintfakturaid) begin if (@old_faktdet_fdchravperiodeid = @faktdet_fdchravperiodeid) begin if (@avb_fdchravbuchungsart = 'STD' or @avb_fdchravbuchungsart='KST') begin --print 'stunden/kosten' insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , hlp_status ) values( null -- lei_erstelldatum , null -- lei_erstelluser , 10211000000000 + @fakt_fdintfakturaid -- lei_honorarposnr , 0 -- lei_istakonto , 0 -- lei_istgutschrift , 0 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , NULL -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchrausavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 1 -- hlp_prefix , null -- hlp_erst_tst , @faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_Org' -- hlp_src_gf , 0) end else begin if (@avb_fdchravbuchungsart = 'AK') begin --print 'AK' -- HNP_AK_Org insert into av_allg..vie_hlp_hnp_AB with (tablockx) ( hnp_bearbeitungsstatus , hnp_bisleistungszeitraum , hnp_fakturakz , hnp_folge_honorarposnr , hnp_frt_fakturatypnr , hnp_gehoertzu_honorarposnr , hnp_gutvon_honorarposnr , hnp_hatteilrechnung , hnp_herstellkosten , hnp_honorar , hnp_honorarposnr , hnp_honorarpostyp , hnp_honpostext , hnp_istaufgeloest , hnp_istintern , hnp_iststorniert , hnp_selbstkosten , hnp_stornobelegnr , hnp_trabzug , hnp_vonleistungszeitraum , hnp_hlp_avperiodeid , hnp_hlp_fakturaid , hnp_hlp_umbuchungid , hnp_hlp_gf , hnp_hlp_avbuchungid , hnp_hlp_status ) values( 4 -- hnp_bearbeitungsstatus , null -- hnp_bisleistungszeitraum (nzk , 3 -- hnp_fakturakz , null -- hnp_folge_honorarposnr , @aktr_fakt_fdintfakturatypid -- hnp_frt_fakturatypnr , 10211000000000 + @fakt_fdintfakturaid -- hnp_gehoertzu_honorarposnr , null -- hnp_gutvon_honorarposnr , 0 -- hnp_hatteilrechnung , 0 -- hnp_herstellkosten , @aktr_fakt_fddecbetragnetto -- hnp_honorar , 10231000000000 + @avb_fdintavbuchungid -- hnp_honorarposnr , 1 -- hnp_honorarpostyp , null -- hnp_honpostext , 0 -- hnp_istaufgeloest , 0 -- hnp_istintern , 0 -- hnp_iststorniert , 0 -- hnp_selbstkosten , null -- hnp_stornobelegnr , 0 -- hnp_trabzug , null -- hnp_vonleistungszeitraum (nzk) , @aktr_fakt_fdchravperiodeid -- hnp_hlp_avperiodeid , @aktr_fakt_fdintfakturaid -- hnp_hlp_fakturaid , null -- hnp_hlp_umbuchungid , 'AB_AB_HNP_AK_Org' -- hnp_hlp_gf , @avb_fdintavbuchungid -- hnp_hlp_avbuchungid , 0 ) --LEI_AK_St insert into av_allg..vie_hlp_lei_AB with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , HLP_Status ) values ( null -- lei_erstelldatum , null -- lei_erstelluser , 10211000000000 + @fakt_fdintfakturaid -- lei_honorarposnr , 1 -- lei_istakonto , 0 -- lei_istgutschrift , 0 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , 10131000000000 + @avb_fdintavbuchungid -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchrausavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 2 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_AK_St' -- hlp_src_gf , 0 ) --LEI_AK_Org insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , HLP_Status ) values ( null -- lei_erstelldatum , null -- lei_erstelluser , 10231000000000 + @avb_fdintavbuchungid -- lei_honorarposnr , 1 -- lei_istakonto , 0 -- lei_istgutschrift , 0 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , NULL -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchreinavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 1 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_AK_Org' -- hlp_src_gf ,0 ) end else begin --print 'TR' --LEI_TR_ORG insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , HLP_Status ) values( null -- lei_erstelldatum , null -- lei_erstelluser , 10231000000000 + @avb_fdintavbuchungid -- lei_honorarposnr , 0 -- lei_istakonto , 0 -- lei_istgutschrift , 1 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , NULL -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchreinavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 1 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_TR_Org' -- hlp_src_gf ,0 ) --HNP_TR_Org insert into av_allg..vie_hlp_hnp_ab with (tablockx) ( hnp_bearbeitungsstatus , hnp_bisleistungszeitraum , hnp_fakturakz , hnp_folge_honorarposnr , hnp_frt_fakturatypnr , hnp_gehoertzu_honorarposnr , hnp_gutvon_honorarposnr , hnp_hatteilrechnung , hnp_herstellkosten , hnp_honorar , hnp_honorarposnr , hnp_honorarpostyp , hnp_honpostext , hnp_istaufgeloest , hnp_istintern , hnp_iststorniert , hnp_selbstkosten , hnp_stornobelegnr , hnp_trabzug , hnp_vonleistungszeitraum , hnp_hlp_avperiodeid , hnp_hlp_fakturaid , hnp_hlp_umbuchungid , hnp_hlp_gf , hnp_hlp_avbuchungid , hnp_hlp_status ) values( 4 -- hnp_bearbeitungsstatus , null -- hnp_bisleistungszeitraum (nzk , 5 -- hnp_fakturakz , null -- hnp_folge_honorarposnr , @aktr_fakt_fdintfakturatypid -- hnp_frt_fakturatypnr , 10211000000000 + @fakt_fdintfakturaid -- hnp_gehoertzu_honorarposnr , null -- hnp_gutvon_honorarposnr , 0 -- hnp_hatteilrechnung , 0 -- hnp_herstellkosten , @aktr_fakt_fddecbetragnetto -- hnp_honorar , 10231000000000 + @avb_fdintavbuchungid -- hnp_honorarposnr , 1 -- hnp_honorarpostyp , null -- hnp_honpostext , 0 -- hnp_istaufgeloest , 0 -- hnp_istintern , 0 -- hnp_iststorniert , 0 -- hnp_selbstkosten , null -- hnp_stornobelegnr , 0 -- hnp_trabzug , null -- hnp_vonleistungszeitraum (nzk) , @aktr_fakt_fdchravperiodeid -- hnp_hlp_avperiodeid , @aktr_fakt_fdintfakturaid -- hnp_hlp_fakturaid , null -- hnp_hlp_umbuchungid , 'AB_AB_HNP_TR_Org' -- hnp_hlp_gf , @avb_fdintavbuchungid -- hnp_hlp_avbuchungid ,0 ) --Lei_TR_St insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , hlp_status ) values( null -- lei_erstelldatum , null -- lei_erstelluser , 10211000000000 + @fakt_fdintfakturaid -- lei_honorarposnr , 0 -- lei_istakonto , 0 -- lei_istgutschrift , 1 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , 10131000000000 + @avb_fdintavbuchungid -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchrausavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 2 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_TR_St' -- hlp_src_gf , 0 ) end end end else begin set @prd_cnt = @prd_cnt + 1 update vie_hlp_hnp_ab set hnp_hlp_status=2, hnp_iststorniert=1 where hnp_hlp_status=0 update vie_hlp_lei_ab set hlp_status=2, , lei_umbauf_leistunglfdnr =10130000000000 + @avb_fdintavbuchungid + (@prd_cnt * 1000000000) where hlp_status=0 --HNP_SR_St insert into av_allg..vie_hlp_hnp_ab with (tablockx) ( hnp_bearbeitungsstatus , hnp_bisleistungszeitraum , hnp_fakturakz , hnp_folge_honorarposnr , hnp_frt_fakturatypnr , hnp_gehoertzu_honorarposnr , hnp_gutvon_honorarposnr , hnp_hatteilrechnung , hnp_herstellkosten , hnp_honorar , hnp_honorarposnr , hnp_honorarpostyp , hnp_honpostext , hnp_istaufgeloest , hnp_istintern , hnp_iststorniert , hnp_selbstkosten , hnp_stornobelegnr , hnp_trabzug , hnp_vonleistungszeitraum , hnp_hlp_avperiodeid , hnp_hlp_fakturaid , hnp_hlp_umbuchungid , hnp_hlp_gf , hnp_hlp_status ) values( 4 -- hnp_bearbeitungsstatus , null -- hnp_bisleistungszeitraum (nzk , 4 -- hnp_fakturakz , null -- hnp_folge_honorarposnr , @fakt_fdintfakturatypid -- hnp_frt_fakturatypnr , 10210000000000 + @fakt_fdintfakturaid + ((@prd_cnt-1) * 1000000000) -- hnp_gehoertzu_honorarposnr , null -- hnp_gutvon_honorarposnr , 0 -- hnp_hatteilrechnung , -1 -- hnp_herstellkosten , -1 -- hnp_honorar , 10210000000000 + @fakt_fdintfakturaid + (@prd_cnt * 1000000000) -- hnp_honorarposnr , 1 -- hnp_honorarpostyp , null -- hnp_honpostext , 0 -- hnp_istaufgeloest , 0 -- hnp_istintern , 0 -- hnp_iststorniert , -1 -- hnp_selbstkosten , null -- hnp_stornobelegnr , 0 -- hnp_trabzug , null -- hnp_vonleistungszeitraum (nzk) , @faktdet_fdchravperiodeid -- hnp_hlp_avperiodeid , @fakt_fdintfakturaid -- hnp_hlp_fakturaid , null -- hnp_hlp_umbuchungid , 'AB_AB_HNP_SR_St' -- hnp_hlp_gf , 1) insert into av_allg..vie_hlp_hnp_ab with (tablockx) ( hnp_bearbeitungsstatus , hnp_bisleistungszeitraum , hnp_fakturakz , hnp_folge_honorarposnr , hnp_frt_fakturatypnr , hnp_gehoertzu_honorarposnr , hnp_gutvon_honorarposnr , hnp_hatteilrechnung , hnp_herstellkosten , hnp_honorar , hnp_honorarposnr , hnp_honorarpostyp , hnp_honpostext , hnp_istaufgeloest , hnp_istintern , hnp_iststorniert , hnp_selbstkosten , hnp_stornobelegnr , hnp_trabzug , hnp_vonleistungszeitraum , hnp_hlp_avperiodeid , hnp_hlp_fakturaid , hnp_hlp_umbuchungid , hnp_hlp_gf , hnp_hlp_status ) values ( 4 -- hnp_bearbeitungsstatus , null -- hnp_bisleistungszeitraum (nzk , 1 -- hnp_fakturakz , null -- hnp_folge_honorarposnr , @fakt_fdintfakturatypid -- hnp_frt_fakturatypnr , null -- hnp_gehoertzu_honorarposnr , null -- hnp_gutvon_honorarposnr , 0 -- hnp_hatteilrechnung , 0 -- hnp_herstellkosten , 0 -- hnp_honorar , 10210000000000 + @fakt_fdintfakturaid + ((@prd_cnt***) * 1000000000) -- hnp_honorarposnr , 1 -- hnp_honorarpostyp , null -- hnp_honpostext , 0 -- hnp_istaufgeloest , 0 -- hnp_istintern , 0 -- hnp_iststorniert , 0 -- hnp_selbstkosten , null -- hnp_stornobelegnr , 0 -- hnp_trabzug , null -- hnp_vonleistungszeitraum (nzk) , @faktdet_fdchravperiodeid -- hnp_hlp_avperiodeid , @fakt_fdintfakturaid -- hnp_hlp_fakturaid , null -- hnp_hlp_umbuchungid , 'AB_AB_HNP_Reb' -- hnp_hlp_gf , 0) --LEI_SR_St insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF ) select null -- lei_erstelldatum , null -- lei_erstelluser , 10210000000000 + @fakt_fdintfakturaid + (@prd_cnt * 1000000000) -- lei_honorarposnr , 0 -- lei_istakonto , 0 -- lei_istgutschrift , 0 -- lei_istsplittleistung , 1 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , -1 -- lei_leist_menge , -1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , 10131000000000 + @avb_fdintavbuchungid -- lei_storno_leistunglfdnr , NULL -- lei_trak_leistunglfdnr , null -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @faktdet_fdchravperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , @prd_cnt -- hlp_prefix , null -- hlp_erst_tst , @faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_SR_St' -- hlp_src_gf print 'neue periode' end end else begin -- NEUE FAKTURA --ALLE ALTEN DS MIT STATUS 'ZU UEBERNEHMEN' VERSEHEN update vie_hlp_hnp_ab set hnp_hlp_status=1 update vie_hlp_lei_ab set hlp_status=1 -- HNP_SR_NEU insert into av_allg..vie_hlp_hnp_ab with (tablockx) ( hnp_bearbeitungsstatus , hnp_bisleistungszeitraum , hnp_fakturakz , hnp_folge_honorarposnr , hnp_frt_fakturatypnr , hnp_gehoertzu_honorarposnr , hnp_gutvon_honorarposnr , hnp_hatteilrechnung , hnp_herstellkosten , hnp_honorar , hnp_honorarposnr , hnp_honorarpostyp , hnp_honpostext , hnp_istaufgeloest , hnp_istintern , hnp_iststorniert , hnp_selbstkosten , hnp_stornobelegnr , hnp_trabzug , hnp_vonleistungszeitraum , hnp_hlp_avperiodeid , hnp_hlp_fakturaid , hnp_hlp_umbuchungid , hnp_hlp_gf , hnp_hlp_status ) values ( 4 -- hnp_bearbeitungsstatus , null -- hnp_bisleistungszeitraum (nzk , 1 -- hnp_fakturakz , null -- hnp_folge_honorarposnr , @fakt_fdintfakturatypid -- hnp_frt_fakturatypnr , null -- hnp_gehoertzu_honorarposnr , null -- hnp_gutvon_honorarposnr , 0 -- hnp_hatteilrechnung , 0 -- hnp_herstellkosten , 0 -- hnp_honorar , 10211000000000 + @fakt_fdintfakturaid -- hnp_honorarposnr , 1 -- hnp_honorarpostyp , null -- hnp_honpostext , 0 -- hnp_istaufgeloest , 0 -- hnp_istintern , 1 -- hnp_iststorniert , 0 -- hnp_selbstkosten , null -- hnp_stornobelegnr , 0 -- hnp_trabzug , null -- hnp_vonleistungszeitraum (nzk) , @fakt_fdchravperiodeid -- hnp_hlp_avperiodeid , @fakt_fdintfakturaid -- hnp_hlp_fakturaid , null -- hnp_hlp_umbuchungid , 'AB_AB_HNP_Neu' -- hnp_hlp_gf , 0 ) if (@avb_fdchravbuchungsart = 'STD' or @avb_fdchravbuchungsart='KST') begin --LEI_Org insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , hlp_status ) values( null -- lei_erstelldatum , null -- lei_erstelluser , 10211000000000 + @fakt_fdintfakturaid -- lei_honorarposnr , 0 -- lei_istakonto , 0 -- lei_istgutschrift , 0 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , NULL -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchrausavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 1 -- hlp_prefix , null -- hlp_erst_tst , @faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_Org' -- hlp_src_gf , 0) end else if (@avb_fdchravbuchungsart = 'AK') begin -- HNP_AK_Org insert into av_allg..vie_hlp_hnp_AB with (tablockx) ( hnp_bearbeitungsstatus , hnp_bisleistungszeitraum , hnp_fakturakz , hnp_folge_honorarposnr , hnp_frt_fakturatypnr , hnp_gehoertzu_honorarposnr , hnp_gutvon_honorarposnr , hnp_hatteilrechnung , hnp_herstellkosten , hnp_honorar , hnp_honorarposnr , hnp_honorarpostyp , hnp_honpostext , hnp_istaufgeloest , hnp_istintern , hnp_iststorniert , hnp_selbstkosten , hnp_stornobelegnr , hnp_trabzug , hnp_vonleistungszeitraum , hnp_hlp_avperiodeid , hnp_hlp_fakturaid , hnp_hlp_umbuchungid , hnp_hlp_gf , hnp_hlp_avbuchungid , hnp_hlp_status ) values( 4 -- hnp_bearbeitungsstatus , null -- hnp_bisleistungszeitraum (nzk , 3 -- hnp_fakturakz , null -- hnp_folge_honorarposnr , @aktr_fakt_fdintfakturatypid -- hnp_frt_fakturatypnr , 10211000000000 + @fakt_fdintfakturaid -- hnp_gehoertzu_honorarposnr , null -- hnp_gutvon_honorarposnr , 0 -- hnp_hatteilrechnung , 0 -- hnp_herstellkosten , @aktr_fakt_fddecbetragnetto -- hnp_honorar , 10231000000000 + @avb_fdintavbuchungid -- hnp_honorarposnr , 1 -- hnp_honorarpostyp , null -- hnp_honpostext , 0 -- hnp_istaufgeloest , 0 -- hnp_istintern , 0 -- hnp_iststorniert , 0 -- hnp_selbstkosten , null -- hnp_stornobelegnr , 0 -- hnp_trabzug , null -- hnp_vonleistungszeitraum (nzk) , @aktr_fakt_fdchravperiodeid -- hnp_hlp_avperiodeid , @aktr_fakt_fdintfakturaid -- hnp_hlp_fakturaid , null -- hnp_hlp_umbuchungid , 'AB_AB_HNP_AK_Org' -- hnp_hlp_gf , @avb_fdintavbuchungid -- hnp_hlp_avbuchungid , 0 ) --LEI_AK_St insert into av_allg..vie_hlp_lei_AB with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , HLP_Status ) values ( null -- lei_erstelldatum , null -- lei_erstelluser , 10211000000000 + @fakt_fdintfakturaid -- lei_honorarposnr , 1 -- lei_istakonto , 0 -- lei_istgutschrift , 0 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , 10131000000000 + @avb_fdintavbuchungid -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchrausavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 2 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_AK_St' -- hlp_src_gf , 0 ) --LEI_AK_Org insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , HLP_Status ) values ( null -- lei_erstelldatum , null -- lei_erstelluser , 10231000000000 + @avb_fdintavbuchungid -- lei_honorarposnr , 1 -- lei_istakonto , 0 -- lei_istgutschrift , 0 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , NULL -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchreinavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 1 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_AK_Org' -- hlp_src_gf ,0 ) end else if (@avb_fdchravbuchungsart = 'TR') begin --LEI_TR_ORG insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , HLP_Status ) values( null -- lei_erstelldatum , null -- lei_erstelluser , 10231000000000 + @avb_fdintavbuchungid -- lei_honorarposnr , 0 -- lei_istakonto , 0 -- lei_istgutschrift , 1 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , NULL -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchreinavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 1 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_TR_Org' -- hlp_src_gf ,0 ) --HNP_TR_Org insert into av_allg..vie_hlp_hnp_ab with (tablockx) ( hnp_bearbeitungsstatus , hnp_bisleistungszeitraum , hnp_fakturakz , hnp_folge_honorarposnr , hnp_frt_fakturatypnr , hnp_gehoertzu_honorarposnr , hnp_gutvon_honorarposnr , hnp_hatteilrechnung , hnp_herstellkosten , hnp_honorar , hnp_honorarposnr , hnp_honorarpostyp , hnp_honpostext , hnp_istaufgeloest , hnp_istintern , hnp_iststorniert , hnp_selbstkosten , hnp_stornobelegnr , hnp_trabzug , hnp_vonleistungszeitraum , hnp_hlp_avperiodeid , hnp_hlp_fakturaid , hnp_hlp_umbuchungid , hnp_hlp_gf , hnp_hlp_avbuchungid , hnp_hlp_status ) values( 4 -- hnp_bearbeitungsstatus , null -- hnp_bisleistungszeitraum (nzk , 5 -- hnp_fakturakz , null -- hnp_folge_honorarposnr , @aktr_fakt_fdintfakturatypid -- hnp_frt_fakturatypnr , 10211000000000 + @fakt_fdintfakturaid -- hnp_gehoertzu_honorarposnr , null -- hnp_gutvon_honorarposnr , 0 -- hnp_hatteilrechnung , 0 -- hnp_herstellkosten , @aktr_fakt_fddecbetragnetto -- hnp_honorar , 10231000000000 + @avb_fdintavbuchungid -- hnp_honorarposnr , 1 -- hnp_honorarpostyp , null -- hnp_honpostext , 0 -- hnp_istaufgeloest , 0 -- hnp_istintern , 0 -- hnp_iststorniert , 0 -- hnp_selbstkosten , null -- hnp_stornobelegnr , 0 -- hnp_trabzug , null -- hnp_vonleistungszeitraum (nzk) , @aktr_fakt_fdchravperiodeid -- hnp_hlp_avperiodeid , @aktr_fakt_fdintfakturaid -- hnp_hlp_fakturaid , null -- hnp_hlp_umbuchungid , 'AB_AB_HNP_TR_Org' -- hnp_hlp_gf , @avb_fdintavbuchungid -- hnp_hlp_avbuchungid ,0 ) --Lei_TR_St insert into av_allg..vie_hlp_lei_ab with (tablockx) ( LEI_ERSTELLDATUM , LEI_ERSTELLUSER , LEI_HONORARPOSNR , LEI_ISTAKONTO , LEI_ISTGUTSCHRIFT , LEI_ISTSPLITTLEISTUNG , LEI_ISTSTORNOBUCHUNG , LEI_ISTWERTGEBUEHR , LEI_LEIST_MENGE , LEI_LEIST_MENGE_VERRECHBAR , LEI_LEISTUNGLFDNR , LEI_LEISTUNGSSTATUS , LEI_NEUBUCHUNGSTYP , LEI_STORNO_HONORARPOSNR , LEI_STORNO_LEISTUNGLFDNR , LEI_TRAK_LEISTUNGLFDNR , LEI_UMBUAUF_LEISTUNGLFDNR , LEI_UMBUVON_LEISTUNGLFDNR , HLP_AVPeriodeID , HLP_StundenID , HLP_KostenID , HLP_AVBuchungID , HLP_Prefix , HLP_Erst_TST , HLP_FakturaDetId , HLP_SRC_GF , hlp_status ) values( null -- lei_erstelldatum , null -- lei_erstelluser , 10211000000000 + @fakt_fdintfakturaid -- lei_honorarposnr , 0 -- lei_istakonto , 0 -- lei_istgutschrift , 1 -- lei_istsplittleistung , 0 -- lei_iststornobuchung , 0 -- lei_istwertgebuehr , 1 -- lei_leist_menge , 1 -- lei_leist_menge_verrechbar , 1013 -- lei_leistunglfdnr , 6 -- lei_leistungsstatus , 0 -- lei_neubuchungstyp , NULL -- lei_storno_honorarposnr , NULL -- lei_storno_leistunglfdnr , 10131000000000 + @avb_fdintavbuchungid -- lei_trak_leistunglfdnr , NULL -- lei_umbauf_leistunglfdnr , null -- lei_umbuvon_leistunglfdnr , @avb_fdchrausavperiodeid -- hlp_avperiodeid , @avb_fdintstundenid -- hlp_stundenid , @avb_fdintkostenid -- hlp_kostenid , @avb_fdintavbuchungid -- hlp_avbuchungid , 2 -- hlp_prefix , null -- hlp_erst_tst , @aktr_faktdet_fdintfakturadetid -- hlp_fakturadetid , 'AB_AB_LEI_TR_St' -- hlp_src_gf , 0 ) END if (@cnt=0) begin set @old_faktdet_fdchravperiodeid = @faktdet_fdchravperiodeid set @cnt=1 end set @prd_cnt=1 --print 'neue faktura' end end set @old_faktdet_fdchravperiodeid=@faktdet_fdchravperiodeid set @old_fakt_fdintfakturaid=@fakt_fdintfakturaid set @old_faktdet_fdintfakturadetid = @faktdet_fdintfakturadetid fetch next from cur_ab into @fakt_fdintfakturaid , @faktdet_fdchravperiodeid , @faktdet_fdintfakturadetid , @avb_fdintavbuchungid , @avb_fdchravbuchungsart , @avb_fdintbelegid , @avb_fdchreinavperiodeid , @avb_fdchrausavperiodeid , @avb_fdintstundenid , @avb_fdintkostenid , @aktr_faktdet_fdintfakturadetid , @aktr_fakt_fdintfakturaid , @aktr_fakt_fdintfakturatypid , @aktr_fakt_fddecbetragnetto , @aktr_fakt_fdchravperiodeid , @fakt_fdintfakturatypid , @fakt_fdchravperiodeid end close cur_ab deallocate cur_ab go set nocount off go
__________________
i once told a To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. that nothing really ends
|
|
|
|
|
#2 |
|
mental problems angel
![]() ![]() ![]() ![]() ![]() ![]() Location: i want u 2 caress me like a tropical priest
Posts: 20,594
|
|
|
|
|
|
#3 |
|
Minion of Satan
![]() ![]() ![]() ![]() ![]() Location: i am the terror that flaps in the night
Posts: 6,595
|
tl;dr
|
|
|
|
|
#4 |
|
no more than sympathy
![]() ![]() ![]() ![]() ![]() Location: lying on the floor
Posts: 14,826
|
i need something to take my mind of this script above....this post'll do:
a0502858 |
|
|
|
|
#5 |
|
Demi-God
![]() ![]() ![]() Location: gayville!hahahahaha
Posts: 424
|
|
|
|
|
|
#6 |
|
Immortal
![]() ![]() ![]() ![]() ![]() ![]()
Posts: 20,988
|
what a brainfuck...
|
|
|
|
|
#7 |
|
At the beginning
![]() ![]() ![]() ![]() ![]() Location: GJ 1214 b
Posts: 10,760
|
\\Rhodes.uchicago.edu\surveylab\Restricted\Proposa ls\Chapin Hall
|
|
|
|
|
#8 |
|
that person
![]() Location: LOL Party Centre
Posts: 35,608
|
BS! I listen to his album and I try to find out what songs I like and the positive side of things. I don't listen to his albums trying to find out what I hate about it. That is negative thinking. If you focus on the positive, you will have a better outlook on his music. He isn't perfect you know.
|
|
|
|
|
#9 |
|
mental problems angel
![]() ![]() ![]() ![]() ![]() ![]() Location: i want u 2 caress me like a tropical priest
Posts: 20,594
|
I'm seriously going to kill Joeri, I've bought a chainsaw and some rat poison, because he's just a big rat. He thinks this 'meetup' is going to be a big laugh, but let me tell you severin, it's not. PM me back if you managed to get those swords and the c4.
|
|
|
|
|
#10 |
|
Apocalyptic Poster
![]() ![]() ![]() ![]() Location: the highest, happiest trip that you've ever been on
Posts: 3,407
|
When She Believes 5:19 Ben Harper Diamonds On The Inside Rock 11 6/16/2005 10:19 AM 7/28/2005 5:13 PM
The Mollusk 2:36 Ween The Mollusk Alternative Rock 5 5/17/2005 2:30 PM 7/28/2005 11:41 AM Sleepyhouse 4:28 Blind Melon Blind Melon Rock 100 45 12/1/2004 9:30 AM 7/28/2005 10:58 AM Blessed To Be A Witness 4:11 Ben Harper Diamonds On The Inside Rock 7 6/16/2005 10:31 AM 7/28/2005 1:32 PM Take my hand 3:54 Ben Harper and the Blind Boys of Alabama There will be a l Blues 10 5/17/2005 2:34 PM 7/28/2005 4:35 PM Voodoo Lady 3:48 Ween Chocolate & Cheese Rock 6 5/17/2005 2:30 PM 7/28/2005 11:22 AM Opiate 8:31 Tool Opiate 7/29/2005 9:15 AM Mutilated Lips 3:48 Ween The Mollusk Alternative Rock 6 5/17/2005 2:30 PM 7/28/2005 11:48 AM When It's Good 3:03 Ben Harper Diamonds On The Inside Rock 6 6/16/2005 10:12 AM 7/28/2005 5:08 PM Starálfur 6:46 Sigur Rós Ágætis Byrjun Alternative & Punk 9 12/6/2004 1:14 PM 1/31/2005 3:34 PM Untitled 6 8:48 Sigur Rós ( ) Alternative & Punk 3 12/9/2004 4:13 PM 7/29/2005 10:01 AM The Hollow 3:00 A Perfect Circle Mer de Noms Metal 80 29 12/1/2004 11:51 AM 7/28/2005 10:17 AM Svefn-g-englar 10:04 Sigur Rós Ágætis Byrjun Alternative & Punk 9 12/6/2004 1:13 PM 7/12/2005 1:19 PM Strawberry Fields Forever 4:27 Ben Harper I am Sam Soundtrack Rock 4 5/11/2005 12:24 PM 7/28/2005 4:31 PM Cymbaline 4:52 Pink Floyd More 7/29/2005 9:26 AM It's Gonna Be (Alright) 3:17 Ween The Mollusk Alternative Rock 5/17/2005 2:30 PM Pull 3:28 Blind Melon Nico Alternative & Punk 20 3/24/2005 10:45 AM 7/28/2005 10:40 AM Forever 3:24 Ben Harper Welcome To The Cruel World Alternative & Punk 36 1/24/2005 2:33 PM 7/28/2005 2:51 PM By Starlight 4:48 Smashing Pumpkins Mellon Collie And The Infinite Sadness - Twilight To Starlight Alternative & Punk 100 4 11/29/2004 1:06 PM 1/11/2005 1:05 PM Soothe 2:36 Smashing Pumpkins Pisces Iscariot Alternative & Punk 100 7 11/29/2004 1:33 PM 1/11/2005 2:05 PM Final Frontier 4:27 RJD2 Deadringer Hip Hop 1 3/9/2005 10:06 AM 7/12/2005 11:05 AM Olsen Olsen 8:03 Sigur Rós Ágætis Byrjun Alternative & Punk 12 12/6/2004 1:17 PM 1/31/2005 2:54 PM Nile Song 3:29 Pink Floyd More 7/29/2005 9:25 AM Pushit 13:58 Tool Live 7/29/2005 9:20 AM Inertia Creeps 5:56 Massive Attack Mezzanine Alternative 12 5/17/2005 1:26 PM 7/28/2005 11:32 AM Black Steel 5:40 Tricky Maxinquaye Trip-Hop 5/17/2005 2:32 PM Amen Omen 5:51 Ben Harper Diamonds On The Inside Rock 10 6/16/2005 10:27 AM 7/28/2005 1:24 PM Breakin' Down 4:00 Ben Harper Welcome To The Cruel World Alternative & Punk 21 1/24/2005 2:32 PM 7/28/2005 1:36 PM Cold Blows the Wind 4:28 Ween The Mollusk Alternative Rock 5/17/2005 2:30 PM Another Lonely Day 3:43 Ben Harper Fight For Your Mind Alternative & Punk 14 5/5/2005 9:08 AM 7/28/2005 1:28 PM Good Day 5:51 The Dresden Dolls The Dresden Dolls Alternative 5 5/17/2005 2:39 PM 7/28/2005 11:10 AM Teardrop 5:29 Massive Attack Mezzanine Alternative 11 5/17/2005 1:26 PM 7/28/2005 10:49 AM Brena 4:26 A Perfect Circle Mer de Noms Metal 80 9 12/1/2004 11:54 AM 6/29/2005 1:08 PM Temporary Remedy 3:11 Ben Harper Diamonds On The Inside Rock 9 6/16/2005 10:28 AM 7/28/2005 4:38 PM Risingson 4:58 Massive Attack Mezzanine Alternative 5 5/17/2005 1:26 PM 7/1/2005 11:24 AM With My Two Hands 4:34 Ben Harper Diamonds On The Inside Rock 4 6/16/2005 10:08 AM 7/28/2005 1:17 PM Gold To Me 5:00 Ben Harper Fight For Your Mind Alternative & Punk 13 5/5/2005 9:09 AM 7/28/2005 3:11 PM Fight For Your Mind 4:06 Ben Harper Fight For Your Mind Alternative & Punk 16 5/5/2005 9:10 AM 7/28/2005 2:48 PM Group Four 8:14 Massive Attack Mezzanine 100 18 12/3/2004 11:02 AM 6/17/2005 10:19 AM 3 Libras 3:41 A Perfect Circle Mer de Noms Metal 100 14 12/1/2004 11:52 AM 7/28/2005 11:14 AM Overcome 4:30 Tricky Maxinquaye Trip-Hop 5/17/2005 2:32 PM All Is Full Of Love 4:32 Bjork Homogenic Rock 6 5/17/2005 2:35 PM 7/14/2005 1:49 PM Don't Take That Attitude To Your Grave 4:25 Ben Harper Welcome To The Cruel World Alternative & Punk 14 1/24/2005 2:33 PM 7/28/2005 2:35 PM Touch From Your Lust 4:27 Ben Harper Diamonds On The Inside Rock 10 6/16/2005 10:17 AM 7/28/2005 4:48 PM Black Milk 6:20 Massive Attack Mezzanine Alternative 4 5/17/2005 1:26 PM 6/17/2005 10:05 AM Green Is The Color 3:00 Pink Floyd More 7/29/2005 9:26 AM Since We Last Spoke 4:14 RJD2 Since We Last Spoke Lo-Fi 1 5/17/2005 2:33 PM 7/12/2005 12:19 PM Untitled 1 6:38 Sigur Rós ( ) Alternative & Punk 4 12/9/2004 4:09 PM 7/12/2005 1:01 PM Dissolved Girl 6:06 Massive Attack Mezzanine Alternative 7 5/17/2005 1:26 PM 6/29/2005 12:02 PM Suffocated Love 4:51 Tricky Maxinquaye Trip-Hop 5/17/2005 2:32 PM |
|
|
|
|
#11 | |
|
no more than sympathy
![]() ![]() ![]() ![]() ![]() Location: lying on the floor
Posts: 14,826
|
Quote:
__________________
i once told a To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. that nothing really ends
|
|
|
|