CMR AnhangCMR Anhang

This commit is contained in:
2024-08-12 10:39:14 +02:00
parent f096b224b2
commit 2a8c779333
4 changed files with 496 additions and 403 deletions

View File

@@ -3320,7 +3320,7 @@ Public Class frmSendungsdetailsNEU
End Sub
Sub initAnhang()
Dim hSQL As String = " SELECT [anh_id],[anh_Name],anh_Datum,[anh_docId],CASE WHEN (anh_SendungsId is null OR anh_SendungsId <=0) AND isnull(aa_name,'')='' THEN '***' ELSE [aa_name] END as [anh_Art],[anh_Typ],anh_LaufzettelDruck,anh_GestellungslisteAnfuegen, anh_markiert
Dim hSQL As String = " SELECT [anh_id],[anh_Name],anh_Datum,[anh_docId],CASE WHEN (anh_SendungsId is null OR anh_SendungsId <=0) AND isnull(aa_name,'')='' THEN '***' ELSE [aa_name] END as [anh_Art],[anh_Typ],anh_LaufzettelDruck,anh_GestellungslisteAnfuegen, anh_markiert , anh_cmrId
FROM [tblAvisoAnhaenge]
left join tblAvisoAnhangsArten on aa_bezeichnung = anh_Art
WHERE anh_AvisoId=" & AvisoId & " AND (anh_SendungsId is null OR anh_SendungsId <=0 OR anh_SendungsId=" & SENDUNG_LIST(CURRENT_INDEX).tblSnd_SendungID & ")
@@ -3338,6 +3338,7 @@ Public Class frmSendungsdetailsNEU
.Columns("anh_id").Visible = False 'VermerkID nicht anzeigen
.Columns("anh_docId").Visible = False 'AvisoID nicht anzeigen
.Columns("anh_markiert").Visible = False
.Columns("anh_cmrId").Visible = False
.Columns("anh_Name").MinimumWidth = 150
.Columns("anh_Name").HeaderText = "Name"
@@ -3362,15 +3363,31 @@ Public Class frmSendungsdetailsNEU
.Columns("anh_GestellungslisteAnfuegen").Width = 150
.Columns("anh_GestellungslisteAnfuegen").HeaderText = "GestListe anfügen"
If .Columns("isCMR") Is Nothing Then
Dim c As New DataGridViewImageColumn
c.Name = "isCMR" : c.HeaderText = "CMR"
c.Image = New Bitmap(1, 1)
c.Width = 40 : c.DefaultCellStyle.Padding = New Padding(2) : c.DefaultCellStyle.BackColor = Color.White
.Columns.Add(c)
End If
For Each row As DataGridViewRow In dgvAnhang.Rows
If Not IsDBNull(row.Cells("anh_markiert").Value) Then
If row.Cells("anh_markiert").Value Then row.DefaultCellStyle.BackColor = Color.Yellow
End If
If Not IsDBNull(row.Cells("anh_cmrId").Value) Then
If row.Cells("anh_cmrId").Value > 0 Then DirectCast(row.Cells("isCMR"), DataGridViewImageCell).Value = My.Resources.stift
End If
Next
.ClearSelection()
End With
End Sub
@@ -4076,18 +4093,55 @@ Public Class frmSendungsdetailsNEU
Try
If TabControl1.SelectedTab Is tbAnhang Then
If dgvAnhang.SelectedRows.Count > 0 Then
Dim docPath = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(dgvAnhang.SelectedRows(0).Cells("anh_docId").Value)
If Not IO.File.Exists(docPath) Then
MsgBox("Die Datei existiert nicht!")
If dgvAnhang.Columns(e.ColumnIndex).Name = "isCMR" Then
If Not IsDBNull(dgvAnhang.SelectedRows(0).Cells("anh_cmrId").Value) AndAlso dgvAnhang.SelectedRows(0).Cells("anh_cmrId").Value > 0 Then
Dim cmrId As Integer = dgvAnhang.SelectedRows(0).Cells("anh_cmrId").Value
Dim f As New SDL.frmCMR(cmrId, dgvAnhang.SelectedRows(0).Cells("anh_docId").Value, dgvAnhang.SelectedRows(0).Cells("anh_id").Value)
f.btnCMRtoAkt.Visible = True
f.txtCMRName.Visible = True
f.btnSaveVorlage.Visible = False 'aus dieser Ansicht keine Vorlagen speichern!
If f.ShowDialog(Me) = DialogResult.OK Then
If f.ueberschreiben Then
Dim da_id = -1
Dim anhId = -1
Dim destPath = ""
Dim Typ = ""
If f.PDF_Path <> "" Then
Dim CMRName = If(f.txtCMRName.Text <> "", f.txtCMRName.Text, "CMR")
frmSendungAnhangImport.saveToDS(AvisoId, CMRName, f.PDF_Path, "CMR", "PDF", da_id, anhId, destPath,, f.CMR.CMR_ID)
initAnhang()
End If
End If
End If
End If
Else
If docPath.ToString.ToLower.EndsWith(".msg") Then ' MSG - Mails --> lokale Kopie, sonst Fehler (bereits von Benutzer soUndSo geöffnet)
Dim docPathTMP = VERAG_PROG_ALLGEMEIN.cFormularManager.getTMPPath_MSG()
System.IO.File.Copy(docPath, docPathTMP)
Process.Start(docPathTMP)
Dim docPath = VERAG_PROG_ALLGEMEIN.cDATENSERVER.GET_PDFPath_BY_DocID(dgvAnhang.SelectedRows(0).Cells("anh_docId").Value)
If Not IO.File.Exists(docPath) Then
MsgBox("Die Datei existiert nicht!")
Else
Process.Start(docPath)
If docPath.ToString.ToLower.EndsWith(".msg") Then ' MSG - Mails --> lokale Kopie, sonst Fehler (bereits von Benutzer soUndSo geöffnet)
Dim docPathTMP = VERAG_PROG_ALLGEMEIN.cFormularManager.getTMPPath_MSG()
System.IO.File.Copy(docPath, docPathTMP)
Process.Start(docPathTMP)
Else
Process.Start(docPath)
End If
End If
End If
End If
End If
Catch ex As Exception
@@ -5902,7 +5956,7 @@ Public Class frmSendungsdetailsNEU
If f.PDF_Path <> "" Then
Dim CMRName = If(f.txtCMRName.Text <> "", f.txtCMRName.Text, "CMR")
frmSendungAnhangImport.saveToDS(AvisoId, CMRName, f.PDF_Path, "CMR", "PDF", da_id, anhId, destPath, SENDUNG_LIST(CURRENT_INDEX).tblSnd_SendungID)
frmSendungAnhangImport.saveToDS(AvisoId, CMRName, f.PDF_Path, "CMR", "PDF", da_id, anhId, destPath, SENDUNG_LIST(CURRENT_INDEX).tblSnd_SendungID, f.CMR.CMR_ID)
initAnhang()
End If