diff --git a/SDL/My Project/Resources.Designer.vb b/SDL/My Project/Resources.Designer.vb
index f042405f..ca43f1d1 100644
--- a/SDL/My Project/Resources.Designer.vb
+++ b/SDL/My Project/Resources.Designer.vb
@@ -1024,6 +1024,16 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Sucht eine lokalisierte Ressource vom Typ System.Byte[].
+ '''
+ Friend ReadOnly Property Kostenkalkulation() As Byte()
+ Get
+ Dim obj As Object = ResourceManager.GetObject("Kostenkalkulation", resourceCulture)
+ Return CType(obj,Byte())
+ End Get
+ End Property
+
'''
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
'''
diff --git a/SDL/My Project/Resources.resx b/SDL/My Project/Resources.resx
index 523b21d4..9fc039a8 100644
--- a/SDL/My Project/Resources.resx
+++ b/SDL/My Project/Resources.resx
@@ -931,4 +931,7 @@
..\Resources\ungueltig_en.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Kostenkalkulation.xlsx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/SDL/Resources/Kostenkalkulation.xlsx b/SDL/Resources/Kostenkalkulation.xlsx
new file mode 100644
index 00000000..aad95ed4
Binary files /dev/null and b/SDL/Resources/Kostenkalkulation.xlsx differ
diff --git a/SDL/SDL.vbproj b/SDL/SDL.vbproj
index 3559180d..efc5ca26 100644
--- a/SDL/SDL.vbproj
+++ b/SDL/SDL.vbproj
@@ -4551,6 +4551,7 @@
Always
+
Always
diff --git a/SDL/kunden/usrCntlOfferte.Designer.vb b/SDL/kunden/usrCntlOfferte.Designer.vb
index 5b664cda..f6d44139 100644
--- a/SDL/kunden/usrCntlOfferte.Designer.vb
+++ b/SDL/kunden/usrCntlOfferte.Designer.vb
@@ -22,9 +22,8 @@ Partial Class usrCntlOfferte
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
Private Sub InitializeComponent()
- Me.components = New System.ComponentModel.Container()
- Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
- Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
+ Dim DataGridViewCellStyle11 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
+ Dim DataGridViewCellStyle12 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.lblBesonderheiten = New System.Windows.Forms.Label()
Me.rtbBesonderheiten = New System.Windows.Forms.RichTextBox()
Me.lblOffert = New System.Windows.Forms.TextBox()
@@ -37,7 +36,7 @@ Partial Class usrCntlOfferte
Me.Label67 = New System.Windows.Forms.Label()
Me.btnDeleteLeistung = New System.Windows.Forms.Button()
Me.btnAddLeistung = New System.Windows.Forms.Button()
- Me.cntxtAddSdl = New System.Windows.Forms.ContextMenuStrip(Me.components)
+ Me.cntxtAddSdl = New System.Windows.Forms.ContextMenuStrip()
Me.DToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.btnOfferteSpeichern = New System.Windows.Forms.Button()
Me.btnHinzufuegen = New System.Windows.Forms.Button()
@@ -63,13 +62,16 @@ Partial Class usrCntlOfferte
Me.lblArchivierteOfferten = New System.Windows.Forms.Label()
Me.lblEditMode = New System.Windows.Forms.Label()
Me.btnOffertbearbeiten = New System.Windows.Forms.Button()
- Me.dgvOfferteNew = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
+ Me.dgvOfferteNew = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
+ Me.Button2 = New System.Windows.Forms.Button()
+ Me.Panel1 = New System.Windows.Forms.Panel()
CType(Me.dgvOfferteDetails, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.dgvOfferte, System.ComponentModel.ISupportInitialize).BeginInit()
Me.cntxtAddSdl.SuspendLayout()
Me.pnlSperre.SuspendLayout()
Me.pnlEdit.SuspendLayout()
CType(Me.dgvOfferteNew, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'lblBesonderheiten
@@ -121,8 +123,8 @@ Partial Class usrCntlOfferte
Me.dgvOfferteDetails.AllowUserToDeleteRows = False
Me.dgvOfferteDetails.AllowUserToOrderColumns = True
Me.dgvOfferteDetails.AllowUserToResizeRows = False
- DataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
- Me.dgvOfferteDetails.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1
+ DataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
+ Me.dgvOfferteDetails.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle11
Me.dgvOfferteDetails.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -141,8 +143,8 @@ Partial Class usrCntlOfferte
Me.dgvOfferte.AllowUserToAddRows = False
Me.dgvOfferte.AllowUserToDeleteRows = False
Me.dgvOfferte.AllowUserToResizeRows = False
- DataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
- Me.dgvOfferte.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle2
+ DataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
+ Me.dgvOfferte.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle12
Me.dgvOfferte.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.dgvOfferte.BackgroundColor = System.Drawing.Color.White
@@ -249,7 +251,7 @@ Partial Class usrCntlOfferte
Me.btnOfferteSpeichern.ForeColor = System.Drawing.Color.Black
Me.btnOfferteSpeichern.Image = Global.SDL.My.Resources.Resources.save
Me.btnOfferteSpeichern.ImageAlign = System.Drawing.ContentAlignment.TopLeft
- Me.btnOfferteSpeichern.Location = New System.Drawing.Point(663, 0)
+ Me.btnOfferteSpeichern.Location = New System.Drawing.Point(664, 0)
Me.btnOfferteSpeichern.Name = "btnOfferteSpeichern"
Me.btnOfferteSpeichern.Size = New System.Drawing.Size(132, 36)
Me.btnOfferteSpeichern.TabIndex = 15
@@ -397,9 +399,9 @@ Partial Class usrCntlOfferte
Me.pnlEdit.Controls.Add(Me.btnOfferteSpeichern)
Me.pnlEdit.Controls.Add(Me.cboLeistungenAdd)
Me.pnlEdit.Controls.Add(Me.MyTextBox1)
- Me.pnlEdit.Location = New System.Drawing.Point(235, 379)
+ Me.pnlEdit.Location = New System.Drawing.Point(234, 379)
Me.pnlEdit.Name = "pnlEdit"
- Me.pnlEdit.Size = New System.Drawing.Size(796, 60)
+ Me.pnlEdit.Size = New System.Drawing.Size(797, 60)
Me.pnlEdit.TabIndex = 20
'
'Button1
@@ -409,7 +411,7 @@ Partial Class usrCntlOfferte
Me.Button1.ForeColor = System.Drawing.Color.Black
Me.Button1.Image = Global.SDL.My.Resources.Resources.Excel_logo
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
- Me.Button1.Location = New System.Drawing.Point(606, 0)
+ Me.Button1.Location = New System.Drawing.Point(607, 0)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(51, 36)
Me.Button1.TabIndex = 33
@@ -421,7 +423,7 @@ Partial Class usrCntlOfferte
Me.cbxAutoFakturierung.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.cbxAutoFakturierung.AutoSize = True
Me.cbxAutoFakturierung.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.cbxAutoFakturierung.Location = New System.Drawing.Point(398, 3)
+ Me.cbxAutoFakturierung.Location = New System.Drawing.Point(399, 3)
Me.cbxAutoFakturierung.Name = "cbxAutoFakturierung"
Me.cbxAutoFakturierung.Size = New System.Drawing.Size(118, 17)
Me.cbxAutoFakturierung.TabIndex = 32
@@ -620,6 +622,30 @@ Partial Class usrCntlOfferte
Me.dgvOfferteNew.Size = New System.Drawing.Size(228, 347)
Me.dgvOfferteNew.TabIndex = 30
'
+ 'Button2
+ '
+ Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
+ Me.Button2.ForeColor = System.Drawing.Color.Black
+ Me.Button2.Image = Global.SDL.My.Resources.Resources.Excel_logo
+ Me.Button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
+ Me.Button2.Location = New System.Drawing.Point(0, 7)
+ Me.Button2.Name = "Button2"
+ Me.Button2.Size = New System.Drawing.Size(131, 36)
+ Me.Button2.TabIndex = 34
+ Me.Button2.Text = "Kostenkalkulation"
+ Me.Button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
+ Me.Button2.UseVisualStyleBackColor = True
+ '
+ 'Panel1
+ '
+ Me.Panel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
+ Me.Panel1.Controls.Add(Me.Button2)
+ Me.Panel1.Location = New System.Drawing.Point(3, 385)
+ Me.Panel1.Name = "Panel1"
+ Me.Panel1.Size = New System.Drawing.Size(139, 51)
+ Me.Panel1.TabIndex = 34
+ '
'usrCntlOfferte
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -646,6 +672,7 @@ Partial Class usrCntlOfferte
Me.Controls.Add(Me.dgvOfferteDetails)
Me.Controls.Add(Me.dgvOfferte)
Me.Controls.Add(Me.pnlEdit)
+ Me.Controls.Add(Me.Panel1)
Me.Margin = New System.Windows.Forms.Padding(2)
Me.Name = "usrCntlOfferte"
Me.Size = New System.Drawing.Size(1041, 576)
@@ -657,6 +684,7 @@ Partial Class usrCntlOfferte
Me.pnlEdit.ResumeLayout(False)
Me.pnlEdit.PerformLayout()
CType(Me.dgvOfferteNew, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.Panel1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -701,4 +729,6 @@ Partial Class usrCntlOfferte
Friend WithEvents btnOffertbearbeiten As Button
Friend WithEvents dgvOfferteNew As VERAG_PROG_ALLGEMEIN.MyDatagridview
Friend WithEvents Button1 As Button
+ Friend WithEvents Button2 As Button
+ Friend WithEvents Panel1 As Panel
End Class
diff --git a/SDL/kunden/usrCntlOfferte.vb b/SDL/kunden/usrCntlOfferte.vb
index 41dcfa2c..46a507fd 100644
--- a/SDL/kunden/usrCntlOfferte.vb
+++ b/SDL/kunden/usrCntlOfferte.vb
@@ -808,5 +808,111 @@ Public Class usrCntlOfferte
End Function
+ Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
+
+ Me.Cursor = Cursors.WaitCursor
+ Try
+ Dim Path = ""
+ If True Then
+
+
+ Dim sqlKostenkalk = " Select OffertenNr, isnull(LeistungsNr,'') as LeistungsNr,isnull(LeistungsBez,'' ) as LeistungsBez,isnull(Preis,'') as Preis,isnull([Geändert am],[Eingegeben am]) as Datum
+ FROM [VERAG].[dbo].[Offertenpositionen] where KundenNr = " & kdNr & " and OffertenNr in (38, 1) and LeistungsNr in (340, 324, 348, 440)
+ order by cast([Eingegeben am] as date) desc, LeistungsNr, Preis desc"
+
+
+ Dim dtKostenkalk As DataTable = (New SQL).loadDgvBySql(sqlKostenkalk, "FMZOLL")
+
+ If dtKostenkalk.Rows.Count <= 0 Then
+ MsgBox("keine Daten!")
+ Exit Sub
+ End If
+
+ Dim sPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\VERAG\SDL\tmp\"
+ If Not My.Computer.FileSystem.DirectoryExists(sPath) Then
+ My.Computer.FileSystem.CreateDirectory(sPath)
+ End If
+
+
+ Dim exclApp As Object 'as Application
+ Dim Datei As Object 'as WorkBook
+ Dim Blatt As Object 'Microsoft.Office.Interop.Excel.Worksheet 'As Object 'as Worksheet
+ exclApp = CreateObject("Excel.Application")
+
+ With exclApp
+ .Visible = False
+
+ Try
+ Path = sPath & "Kostenkalkulation " & kdNr & " .xlsx"
+ While System.IO.File.Exists(Path)
+ Path = sPath & "Kostenkalkulation " & kdNr & "_" & Now.ToString("ddMMyyyyHHmmss") & ".xlsx"
+ End While
+ My.Computer.FileSystem.WriteAllBytes(Path, My.Resources.Kostenkalkulation, False)
+ Catch ex As System.Exception
+ ' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ Me.Cursor = Cursors.Default
+
+ Exit Sub
+ End Try
+
+ Datei = .Workbooks.Open(Path) 'Anpassen
+ Blatt = Datei.Worksheets(1) 'Anpassen
+
+ Dim KD As New VERAG_PROG_ALLGEMEIN.cKunde(kdNr)
+ Dim ADR As New VERAG_PROG_ALLGEMEIN.cAdressen(kdNr)
+
+ Blatt.Range("B8").Value = ADR.Name_1
+ Blatt.Range("B9").Value = ADR.AdressenNr
+
+ Blatt.Range("H11").Value = "Tarif für " & Today().Year
+
+ Dim currentRow As Integer = 13
+
+ For Each row In dtKostenkalk.Rows
+ Blatt.Range("A" & currentRow).Value = row("LeistungsBez")
+ Blatt.Range("B" & currentRow).Value = row("Preis")
+
+ If IsDate(row("Datum")) Then
+
+ Select Case CDate(row("Datum")).Year
+ Case 2018 : Blatt.Range("D" & currentRow).Value = 0.3387
+ Case 2019 : Blatt.Range("D" & currentRow).Value = 0.3048
+ Case 2020 : Blatt.Range("D" & currentRow).Value = 0.2792
+ Case 2021 : Blatt.Range("D" & currentRow).Value = 0.2597
+ Case 2022 : Blatt.Range("D" & currentRow).Value = 0.2207
+ Case 2023 : Blatt.Range("D" & currentRow).Value = 0.0997
+ Case 2024 : Blatt.Range("D" & currentRow).Value = 0.0394
+ Case 2025 : Blatt.Range("D" & currentRow).Value = 0
+ Case Else
+ Blatt.Range("D" & currentRow).Value = ""
+ End Select
+
+ Else
+ Blatt.Range("D" & currentRow).Value = ""
+ End If
+ currentRow = currentRow + 1
+ Next
+
+
+
+ Datei.Save
+
+ If False Then
+ Blatt.PrintOutEx()
+ Else
+ 'Process.Start(Path)
+ .Visible = True
+
+ End If
+ End With
+
+ End If
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
+ Me.Cursor = Cursors.Default
+ End Sub
+
End Class