CMR Anhang

This commit is contained in:
2024-08-12 10:39:20 +02:00
parent aea4f8f6ad
commit 6701e4fe92
4 changed files with 78 additions and 33 deletions

View File

@@ -159,14 +159,20 @@ Public Class cCMR
Property CMR_Firma As Object = Nothing
Property EPBes_ID As Object = Nothing
Property CMR_isVorlage As Object = Nothing
Property CMRPos As New List(Of cCMRPos)
Public _kurz As Boolean = True
Dim SQL As New SQL
Sub New()
End Sub
Sub New(isVorlage As Boolean)
CMR_isVorlage = isVorlage
End Sub
Sub New(CMR_ID As Integer)
@@ -336,6 +342,7 @@ Public Class cCMR
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CMR_pkArt_8", CMR_pkArt_8))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CMR_pkArt_9", CMR_pkArt_9))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CMR_TblLangKurz", CMR_TblLangKurz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CMR_isVorlage", CMR_isVorlage))
Return list
End Function

View File

@@ -34,7 +34,7 @@ Partial Class frmCMR
Me.lblGespeichert = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtSuchbegriff = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.btnSaveVorlage = New System.Windows.Forms.Button()
Me.cboPrinter = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.btnCMRtoAkt = New System.Windows.Forms.Button()
@@ -83,7 +83,7 @@ Partial Class frmCMR
Me.Panel1.Controls.Add(Me.lblGespeichert)
Me.Panel1.Controls.Add(Me.Label1)
Me.Panel1.Controls.Add(Me.txtSuchbegriff)
Me.Panel1.Controls.Add(Me.Button1)
Me.Panel1.Controls.Add(Me.btnSaveVorlage)
Me.Panel1.Controls.Add(Me.Label16)
Me.Panel1.Controls.Add(Me.cboPrinter)
Me.Panel1.Controls.Add(Me.Button2)
@@ -179,15 +179,15 @@ Partial Class frmCMR
Me.txtSuchbegriff.Size = New System.Drawing.Size(243, 20)
Me.txtSuchbegriff.TabIndex = 2
'
'Button1
'btnSaveVorlage
'
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.Location = New System.Drawing.Point(252, 30)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(82, 24)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Speichern"
Me.Button1.UseVisualStyleBackColor = True
Me.btnSaveVorlage.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnSaveVorlage.Location = New System.Drawing.Point(252, 30)
Me.btnSaveVorlage.Name = "btnSaveVorlage"
Me.btnSaveVorlage.Size = New System.Drawing.Size(82, 24)
Me.btnSaveVorlage.TabIndex = 3
Me.btnSaveVorlage.Text = "Speichern"
Me.btnSaveVorlage.UseVisualStyleBackColor = True
'
'cboPrinter
'
@@ -222,6 +222,7 @@ Partial Class frmCMR
'btnCMRtoAkt
'
Me.btnCMRtoAkt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.btnCMRtoAkt.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnCMRtoAkt.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnCMRtoAkt.Image = Global.SDL.My.Resources.Resources.pdf
Me.btnCMRtoAkt.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
@@ -393,7 +394,6 @@ Partial Class frmCMR
Friend WithEvents lblSuche As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtSuchbegriff As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents lblGespeichert As System.Windows.Forms.Label
Friend WithEvents timerSave As System.Windows.Forms.Timer
Friend WithEvents btnDelete As System.Windows.Forms.Button
@@ -407,4 +407,5 @@ Partial Class frmCMR
Public WithEvents txtCMRName As VERAG_PROG_ALLGEMEIN.MyTextBox
Public WithEvents btnCMRtoAkt As Button
Public WithEvents uCmr As usrcntlCMR
Public WithEvents btnSaveVorlage As Button
End Class

View File

@@ -1,11 +1,16 @@

Imports GrapeCity.ActiveReports
Public Class frmCMR
Dim CMR As cCMR = Nothing
Public CMR As cCMR = Nothing
Dim ready = False
Public ueberschreiben As Boolean = False
Dim old_anh_id As Integer
Dim old_anh_docId As Integer
Public PDF_Path = ""
Public CMR_Name = ""
Sub New()
' Dieser Aufruf ist für den Designer erforderlich.
@@ -25,10 +30,24 @@ Public Class frmCMR
End Sub
Sub New(CMRid As Integer, _old_anh_id As Integer, _old_anh_docId As Integer)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
Me.CMR = New cCMR(CMRid)
ueberschreiben = True
old_anh_docId = _old_anh_docId
old_anh_id = _old_anh_id
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
End Sub
Private Sub frmCMR_Load(sender As Object, e As EventArgs) Handles Me.Load
'EPBES = New cEPBes()
If CMR Is Nothing Then
CMR = New cCMR
CMR = New cCMR(False)
Else
fillData()
End If
@@ -58,7 +77,7 @@ Public Class frmCMR
Private Sub btnLaden_Click(sender As Object, e As EventArgs) Handles btnLaden.Click
If IsNumeric(MySearchBox1._value) Then
Dim id = MySearchBox1._value
Dim id = CInt(MySearchBox1._value)
resetForm(False)
CMR = New cCMR(id)
fillData()
@@ -313,12 +332,12 @@ Public Class frmCMR
Me.Cursor = Cursors.Default
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnSaveVorlage.Click
Me.Cursor = Cursors.WaitCursor
Try
If txtSuchbegriff.Text = "" Then MsgBox("Suchbegriff eingeben!") : Me.Cursor = Cursors.Default : Exit Sub
getData()
If CMR.CMR_ID > 0 And CMR.CMR_Suchbegriff = txtSuchbegriff.Text Then
If CMR.CMR_ID > 0 And CMR.CMR_Suchbegriff = txtSuchbegriff.Text And CMR.CMR_isVorlage = True Then
Select Case MsgBox("Möchten Sie das aktuelle Formular überschreiben?" & Environment.NewLine & CMR.CMR_Suchbegriff, vbYesNo)
Case MsgBoxResult.Yes
@@ -333,7 +352,7 @@ Public Class frmCMR
End Select
Else
'MsgBox(CMR.CMR_Firma)
CMR = New cCMR
CMR = New cCMR(True)
doSave()
End If
@@ -381,7 +400,7 @@ Public Class frmCMR
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
If CMR.CMR_ID > 0 Then
If CMR.CMR_ID > 0 AndAlso CMR.CMR_isVorlage = True Then
Select Case MsgBox("Möchten Sie die aktuelle Vorlage wirkliche löschen?" & Environment.NewLine & CMR.CMR_Suchbegriff, vbYesNo)
Case MsgBoxResult.Yes
CMR.DELETE()
@@ -402,7 +421,7 @@ Public Class frmCMR
' End If
End Sub
Sub resetForm(resetTxt)
CMR = New cCMR()
CMR = New cCMR(False)
fillData()
For Each r As DataGridViewRow In uCmr.dgvLadungen.Rows
For Each c In r.Cells
@@ -430,8 +449,12 @@ Public Class frmCMR
Try
Dim id = getData()
id.CMR_isVorlage = False
If id.SAVE Then
Dim rpt As New rptCMR(id)
Dim tmpPath = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("CMR.pdf", ".pdf", , False)
Dim p As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
rpt.Run(False)
@@ -444,6 +467,17 @@ Public Class frmCMR
Me.Cursor = Cursors.Default
Me.Close()
If ueberschreiben Then
Dim deleted As Boolean = True
Dim DSOLD As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(old_anh_id)
deleted = DSOLD.DELETE_COMPLETE()
If Not deleted Then MsgBox("Fehler beim Löschen der Datei!")
deleted = VERAG_PROG_ALLGEMEIN.cAvisoAnhaenge.DELETE(old_anh_docId)
If Not deleted Then MsgBox("Fehler beim Löschen der Datei!")
End If
End If
Catch ex As Exception
End Try

View File

@@ -14,6 +14,7 @@ Public Class cAvisoAnhaenge
Property anh_GestellungslisteAnfuegen As Boolean = False
Property anh_markiert As Boolean = False
Property anh_size As Double
Property anh_cmrId As Integer
Public hasEntry As Boolean = False
@@ -30,7 +31,7 @@ Public Class cAvisoAnhaenge
' End If
End Sub
Sub New(anh_AvisoId, anh_Name, anh_docId, anh_Art, anh_Typ, Optional anh_SendungsId = Nothing, Optional anh_Reihenfolge = 99, Optional anh_size = 0)
Sub New(anh_AvisoId, anh_Name, anh_docId, anh_Art, anh_Typ, Optional anh_SendungsId = Nothing, Optional anh_Reihenfolge = 99, Optional anh_size = 0, Optional anh_cmrId = -1)
Me.anh_AvisoId = anh_AvisoId
Me.anh_SendungsId = anh_SendungsId
Me.anh_Name = anh_Name
@@ -39,6 +40,7 @@ Public Class cAvisoAnhaenge
Me.anh_Typ = anh_Typ
Me.anh_Reihenfolge = anh_Reihenfolge
Me.anh_size = anh_size
Me.anh_cmrId = anh_cmrId
If anh_Art.ToString.Equals("Auftrag") Then
anh_markiert = True
@@ -63,6 +65,7 @@ Public Class cAvisoAnhaenge
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("anh_GestellungslisteAnfuegen", anh_GestellungslisteAnfuegen))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("anh_markiert", anh_markiert))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("anh_size", anh_size))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("anh_cmrId", anh_cmrId))
Return list
End Function