{"id":362,"date":"2019-06-20T12:54:35","date_gmt":"2019-06-20T12:54:35","guid":{"rendered":"http:\/\/flace.de\/?p=362"},"modified":"2019-06-20T19:38:40","modified_gmt":"2019-06-20T19:38:40","slug":"sql-auftragsliste-mit-informationen-aus-baustellenlager-und-stundenerfassung","status":"publish","type":"post","link":"https:\/\/flace.de\/?p=362","title":{"rendered":"SQL Auftragsliste mit Informationen aus Baustellenlager und Stundenerfassung"},"content":{"rendered":"<p><span style=\"color: #000000;\">Erstellung einer View in der aktuellen Datenbank um daraus aus einen Report mit dem Reportmaker zu erstellen.&nbsp;<br \/>\n<\/span><!--more--><\/p>\n<p><span style=\"color: #0000ff;\">create view dbo.Name_der_View<\/span><br \/>\n<span style=\"color: #ff0000;\"><span style=\"color: #0000ff;\">as<\/span><br \/>\n<span style=\"color: #0000ff;\">SELECT P.ProjNr, P.ProjBezeichnung, P.SachBearb, P.AbtNr, P.AuftragsSumme,RECH.DEBNR, P.AuftragsDatum, ISNULL(A.Vorname, N&#8220;) + &#8218; &#8218; + ISNULL(A.Name, N&#8220;) + &#8218; (&#8218; + P.RechAdr + &#8218;)&#8216; AS Rechanschrift, RECH.Erstdat, AZ_1.AZMinDatum, AZ_1.AZMaxDatum, P.Kategorie, BSTLBEL.BSTLBELMinDatum, BSTLBEL.BSTLBELMaxDatum, AZ2.Lohn,AZ2.AZStunden, BSTLBUCH.EKMat, BSTLBUCH.GeplantVK, BSTLBUCH.GeplantVK &#8211; BSTLBUCH.EKMat AS MatZuschlag<\/span><br \/>\n<span style=\"color: #0000ff;\">FROM Projekt AS P LEFT OUTER JOIN<\/span><br \/>\n<span style=\"color: #0000ff;\">adrAdressen AS A ON A.AdrNrGes = P.RechAdr LEFT OUTER JOIN<\/span><br \/>\n<span style=\"color: #0000ff;\">(SELECT MAX(ERSTDAT) AS Erstdat, DEBNR, PROJNR<\/span><br \/>\n<span style=\"color: #0000ff;\">FROM Rechnung<\/span><br \/>\n<span style=\"color: #0000ff;\">GROUP BY PROJNR,DEBNR) AS RECH ON RECH.PROJNR = P.ProjNr LEFT OUTER JOIN<\/span><br \/>\n<span style=\"color: #0000ff;\">(SELECT ProjektNr AS ProjNr, MIN(Datum) AS AZMinDatum, MAX(Datum) AS AZMaxDatum<\/span><br \/>\n<span style=\"color: #0000ff;\">FROM ArbeitsZeit AS AZ<\/span><br \/>\n<span style=\"color: #0000ff;\">GROUP BY ProjektNr) AS AZ_1 ON AZ_1.ProjNr = P.ProjNr LEFT OUTER JOIN<\/span><br \/>\n<span style=\"color: #0000ff;\">(SELECT ProjNr, MIN(BelegDatum) AS BSTLBELMinDatum, MAX(BelegDatum) AS BSTLBELMaxDatum<\/span><br \/>\n<span style=\"color: #0000ff;\">FROM BstLagerBeleg<\/span><br \/>\n<span style=\"color: #0000ff;\">GROUP BY ProjNr) AS BSTLBEL ON BSTLBEL.ProjNr = P.ProjNr LEFT OUTER JOIN<\/span><br \/>\n<span style=\"color: #0000ff;\">(SELECT ProjektNr AS ProjNr, SUM(ErmBetrag) AS Lohn, SUM(StdBzWAnzahl) as AZStunden<\/span><br \/>\n<span style=\"color: #0000ff;\">FROM Arbeitszeit where AztVerarb=&#8216;-1&#8242;<\/span><br \/>\n<span style=\"color: #0000ff;\">GROUP BY ProjektNr) AS AZ2 ON AZ2.ProjNr = P.ProjNr LEFT OUTER JOIN<\/span><br \/>\n<span style=\"color: #0000ff;\">(SELECT BST.ProjNr, SUM(BST.Menge * BST.NettoPreis) AS EKMat, SUM(BST.Menge * BST.NettoPreis * KALK.Proj_Faktor) AS GeplantVK<\/span><br \/>\n<span style=\"color: #0000ff;\">FROM BstLagerBuchung AS BST INNER JOIN<\/span><br \/>\n<span style=\"color: #0000ff;\">Kalkulationsdaten AS KALK ON KALK.Kostenart = BST.KoArt<\/span><br \/>\n<span style=\"color: #0000ff;\">GROUP BY BST.ProjNr) AS BSTLBUCH ON BSTLBUCH.ProjNr = P.ProjNr<\/span><br \/>\n<span style=\"color: #0000ff;\">WHERE (P.AuftragStatus IN (7, 8))<\/span><br \/>\n<\/span><\/p>\n<p><span style=\"color: #000000;\">Mit Infos aus dem Baustellenlager und Stundenerfassung.&nbsp; Der Auftragsstatus mu\u00df &#8222;Auftrag erhalten&#8220; sein.<\/span><\/p>\n<p><strong>Die dazugeh\u00f6rige RPT Datei hat dann folgenden Inhalt:<\/strong><\/p>\n<p>[Header]<br \/>\nName=Auftragsliste1<br \/>\nDesc=Auftragsliste1<br \/>\nCategory=0<br \/>\nType=0<br \/>\n[Fields]<br \/>\nField1=ProjNr;;;0<br \/>\nField2=Projbezeichnung;;;0<br \/>\nField3=SachBearb;;;0<br \/>\nField4=AbtNr;;;0<br \/>\nField5=Auftragsdatum;;;1<br \/>\nField6=Rechanschrift;;;0<br \/>\nField7=Erstdat;;;1<br \/>\nField8=AZMinDatum;;;1<br \/>\nField9=AZMaxDatum;;;1<br \/>\nField10=Kategorie;;;0<br \/>\nField11=BSTLBELMinDatum;;;1<br \/>\nField12=BSTLBELMaxDatum;;;1<br \/>\nField13=Lohn;;;0<br \/>\nField14=EKMat;;;0<br \/>\nField15=GeplantVK;;;0<br \/>\nField16=MatZuschlag;;;0<br \/>\nField17=DEBNR;;;0<br \/>\n<span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'Libre Franklin','Helvetica Neue',helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\">Field18=AZStunden;;;0<br \/>\nField19=AuftragsSumme;;;0<br \/>\n<\/span>[Tables]<br \/>\nTable1=<span style=\"color: #ff0000;\">dbo.Name_der_View;<\/span><br \/>\n[Links]<br \/>\n<span style=\"color: #ff6600;\">Formular=Nord_XXX.rpf<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Erstellung einer View in der aktuellen Datenbank um daraus aus einen Report mit dem Reportmaker zu erstellen.&nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[42,43,44,41],"class_list":["post-362","post","type-post","status-publish","format-standard","hentry","category-sql","tag-auftrag","tag-behncke","tag-elpro","tag-report"],"_links":{"self":[{"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts\/362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=362"}],"version-history":[{"count":5,"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions"}],"predecessor-version":[{"id":368,"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions\/368"}],"wp:attachment":[{"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}