386 lines
18 KiB
VB.net
386 lines
18 KiB
VB.net
|
|
Imports System.Data
|
|
|
|
Partial Class Customers_Invoices
|
|
Inherits System.Web.UI.Page
|
|
Dim datevon As DateTime
|
|
Dim datebis As DateTime
|
|
Dim Kdnrtext As String
|
|
Dim Absender As String = ""
|
|
Dim Empfaenger As String = ""
|
|
Dim LKWNR As String = ""
|
|
Dim KDNAFNR As String = ""
|
|
Dim dt As List(Of VERAG_PROG_ALLGEMEIN.cRechnungsausgang)
|
|
Dim reNr As String = ""
|
|
|
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
|
If Me.Page.User.Identity.IsAuthenticated Then
|
|
Try
|
|
Kdnrtext = Session.Item("CustomerID")
|
|
Catch A As UnauthorizedAccessException When String.IsNullOrEmpty(Kdnrtext)
|
|
lbl_status.Text = "Dieser Bereich ist nicht gestattet! Ein Fehler ist bei der Validierung der ID aufgetreten! Bitte erneut versuchen!"
|
|
End Try
|
|
Page.UnobtrusiveValidationMode = UnobtrusiveValidationMode.WebForms
|
|
DataBind()
|
|
tbl_Header_row.TableSection = TableRowSection.TableHeader
|
|
If (Page.IsPostBack And normaltable.EnableViewState = False) Then
|
|
Page.MaintainScrollPositionOnPostBack = True
|
|
normaltable.EnableViewState = True
|
|
datevon = Date.Parse(pickdate1.Text)
|
|
datebis = Date.Parse(pickdate2.Text)
|
|
Else
|
|
Page.MaintainScrollPositionOnPostBack = False
|
|
normaltable.EnableViewState = True
|
|
lbl_von.Visible = True
|
|
lbl_bis.Visible = True
|
|
'valDateRange_1.Enabled = True
|
|
'valDateRange_2.Enabled = True
|
|
Dim erster = New Date(Now().Year, Now().Month, 1)
|
|
Dim ersterdat = "1." + Now().Month.ToString + "." + Now().Year.ToString
|
|
pickdate1.Text = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
|
' lbl_status.Text=ersterdat)
|
|
datevon = ersterdat
|
|
datebis = Date.Parse(Now().Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString).ToString
|
|
pickdate2.Text = Now().ToShortDateString()
|
|
pickdate1.Text = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
|
End If
|
|
Else
|
|
FormsAuthentication.RedirectToLoginPage()
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub initcells(tr As TableRow, t1 As TableCell, t2 As TableCell, t3 As TableCell, t4 As TableCell, t5 As TableCell, t6 As TableCell, t7 As TableCell, t8 As TableCell, th1 As TableHeaderCell, th2 As TableHeaderCell, th3 As TableHeaderCell, th4 As TableHeaderCell, th5 As TableHeaderCell, th6 As TableHeaderCell, th7 As TableHeaderCell, th8 As TableHeaderCell)
|
|
Dim white As Drawing.Color = Drawing.Color.White
|
|
Dim schwarz As Drawing.Color = Drawing.Color.Black
|
|
Dim darkgrau As Drawing.Color = Drawing.Color.DarkGray
|
|
Dim darkblue = Drawing.Color.FromArgb(4, 51, 129)
|
|
|
|
tr.BackColor = white
|
|
If t1.Text = "" Then
|
|
t1.BackColor = white
|
|
t1.ForeColor = schwarz
|
|
Else
|
|
t1.BackColor = white
|
|
t1.ForeColor = schwarz
|
|
End If
|
|
If t2.Text = "" Then
|
|
t2.BackColor = Drawing.Color.HotPink
|
|
t2.ForeColor = white
|
|
Else
|
|
t2.BackColor = Drawing.Color.Red
|
|
t2.ForeColor = white
|
|
End If
|
|
If t3.Text = "" Then
|
|
t3.BackColor = white
|
|
t3.ForeColor = schwarz
|
|
Else
|
|
t3.BackColor = white
|
|
t3.ForeColor = schwarz
|
|
End If
|
|
If t4.Text = "" Then
|
|
t4.BackColor = white
|
|
t4.ForeColor = schwarz
|
|
Else
|
|
t4.BackColor = white
|
|
t4.ForeColor = schwarz
|
|
End If
|
|
If t5.Text = "" Then
|
|
t5.BackColor = white
|
|
t5.ForeColor = schwarz
|
|
Else
|
|
t5.BackColor = white
|
|
t5.ForeColor = schwarz
|
|
End If
|
|
If t6.Text = "" Then
|
|
t6.BackColor = white
|
|
t6.ForeColor = schwarz
|
|
Else
|
|
t6.BackColor = white
|
|
t6.ForeColor = schwarz
|
|
End If
|
|
If t7.Text = "" Then
|
|
t7.BackColor = white
|
|
t7.ForeColor = schwarz
|
|
Else
|
|
t7.BackColor = white
|
|
t7.ForeColor = schwarz
|
|
End If
|
|
If t8.Text = "" Then
|
|
t8.BackColor = white
|
|
t8.ForeColor = schwarz
|
|
Else
|
|
t8.BackColor = white
|
|
t8.ForeColor = schwarz
|
|
End If
|
|
th1.Font.Bold = True
|
|
th1.BackColor = darkblue
|
|
th1.ForeColor = white
|
|
th2.Font.Bold = True
|
|
th2.BackColor = darkblue
|
|
th2.ForeColor = white
|
|
th3.Font.Bold = True
|
|
th3.BackColor = darkblue
|
|
th3.ForeColor = white
|
|
th4.Font.Bold = True
|
|
th4.BackColor = darkblue
|
|
th4.ForeColor = white
|
|
th5.Font.Bold = True
|
|
th5.BackColor = darkblue
|
|
th5.ForeColor = white
|
|
th6.Font.Bold = True
|
|
th6.BackColor = darkblue
|
|
th6.ForeColor = white
|
|
th7.Font.Bold = True
|
|
th7.BackColor = darkblue
|
|
th7.ForeColor = white
|
|
th8.Font.Bold = True
|
|
th8.BackColor = darkblue
|
|
th8.ForeColor = white
|
|
End Sub
|
|
|
|
Protected Sub btn_resetForm_Click(sender As Object, e As EventArgs)
|
|
|
|
txt_Absender.Text = String.Empty
|
|
txt_Absender_M.Text = String.Empty
|
|
txt_Empfaenger.Text = String.Empty
|
|
txt_Empfaenger_M.Text = String.Empty
|
|
txt_KdNrAuftrag.Text = String.Empty
|
|
txt_KdNrAuftrag_M.Text = String.Empty
|
|
txt_LKWNr.Text = String.Empty
|
|
txt_LKWNr_M.Text = String.Empty
|
|
txt_ReNr.Text = String.Empty
|
|
txt_ReNr_M.Text = String.Empty
|
|
pickdate1.Text = String.Empty
|
|
pickdate2.Text = String.Empty
|
|
|
|
dt = Nothing
|
|
Kdnrtext = ""
|
|
Absender = ""
|
|
Empfaenger = ""
|
|
LKWNR = ""
|
|
KDNAFNR = ""
|
|
reNr = ""
|
|
End Sub
|
|
|
|
Protected Sub btn_Send_Data_Click(sender As Object, e As EventArgs)
|
|
dt = Nothing
|
|
valreq_pickdate1.Validate()
|
|
valreq_pickdate2.Validate()
|
|
If valreq_pickdate1.IsValid And valreq_pickdate2.IsValid And Kdnrtext = Not "" Then
|
|
' valDateRange_1.Validate()
|
|
'valDateRange_2.Validate()
|
|
'If valDateRange_1.IsValid And valDateRange_2.IsValid Then
|
|
If Not String.IsNullOrEmpty(txt_Absender.Text) Then
|
|
txt_Absender.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
regexval_txt_Absender.Enabled = True
|
|
regexval_txt_Absender.Validate()
|
|
Try
|
|
If regexval_txt_Absender.IsValid = True Then
|
|
Absender = txt_Absender.Text
|
|
Else
|
|
Absender = String.Empty
|
|
End If
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
If Not String.IsNullOrEmpty(txt_Empfaenger.Text) Then
|
|
txt_Empfaenger.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
regexval_txt_Empfaenger.Enabled = True
|
|
regexval_txt_Empfaenger.Validate()
|
|
Try
|
|
If regexval_txt_Empfaenger.IsValid = True Then
|
|
Empfaenger = txt_Empfaenger.Text
|
|
Else
|
|
Empfaenger = String.Empty
|
|
End If
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
If Not String.IsNullOrEmpty(txt_KdNrAuftrag.Text) Then
|
|
txt_KdNrAuftrag.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
regexval_txt_KdNrAuftrag.Enabled = True
|
|
regexval_txt_KdNrAuftrag.Validate()
|
|
Try
|
|
If regexval_txt_KdNrAuftrag.IsValid = True Then
|
|
KDNAFNR = txt_KdNrAuftrag.Text
|
|
Else
|
|
KDNAFNR = String.Empty
|
|
End If
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
If Not String.IsNullOrEmpty(txt_LKWNr.Text) Then
|
|
txt_LKWNr.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
regexval_txt_LKW.Enabled = True
|
|
regexval_txt_LKW.Validate()
|
|
Try
|
|
If regexval_txt_LKW.IsValid = True Then
|
|
LKWNR = txt_LKWNr.Text
|
|
Else
|
|
LKWNR = String.Empty
|
|
End If
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
If Not String.IsNullOrEmpty(txt_ReNr.Text) Then
|
|
txt_ReNr.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
regexval_txt_ReNr.Enabled = True
|
|
regexval_txt_ReNr.Validate()
|
|
Try
|
|
If regexval_txt_ReNr.IsValid = True Then
|
|
reNr = txt_ReNr.Text
|
|
Else
|
|
reNr = String.Empty
|
|
End If
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
|
|
If Not String.IsNullOrEmpty(txt_Absender_M.Text) Then
|
|
txt_Absender_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
Try
|
|
Absender = txt_Absender_M.Text
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
If Not String.IsNullOrEmpty(txt_Empfaenger_M.Text) Then
|
|
txt_Empfaenger_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
Try
|
|
Empfaenger = txt_Empfaenger_M.Text
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
If Not String.IsNullOrEmpty(txt_KdNrAuftrag_M.Text) Then
|
|
txt_KdNrAuftrag_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
Try
|
|
KDNAFNR = txt_KdNrAuftrag_M.Text
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
If Not String.IsNullOrEmpty(txt_LKWNr_M.Text) Then
|
|
txt_LKWNr_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
Try
|
|
LKWNR = txt_LKWNr_M.Text
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
|
|
If Not String.IsNullOrEmpty(txt_ReNr_M.Text) Then
|
|
txt_ReNr_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
Try
|
|
reNr = txt_ReNr_M.Text
|
|
Catch ex As FormatException
|
|
lbl_status.Text = ex.Message
|
|
End Try
|
|
End If
|
|
|
|
If pickdate1.Text = Nothing Or pickdate2.Text = Nothing Then
|
|
Try
|
|
Dim erster = New Date(Now().Year, Now().Month, 1)
|
|
Dim ersterdat = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
|
' lbl_status.Text=ersterdat)
|
|
datevon = ersterdat
|
|
pickdate1.Text = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
|
datebis = Date.Parse(Now().Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString).ToString
|
|
pickdate2.Text = Date.Parse(Now().Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString).ToString
|
|
Catch ex As ValidationException When Date.ParseExact(pickdate1.Text, "dd.MM.yyyy", Nothing).Year < Date.ParseExact("2001", "yyyy", Nothing).Year And Date.ParseExact(pickdate2.Text, "dd.MM.yyyy", Nothing).Year > Date.ParseExact(Today, "dd.MM.yyyy", Nothing).Year
|
|
lbl_status.Text = "Der gewählte Von-Zeitpunkt ist nicht gültig!"
|
|
End Try
|
|
Else
|
|
Try
|
|
datevon = Date.Parse(pickdate1.Text)
|
|
datebis = Date.Parse(pickdate2.Text)
|
|
Catch ex As ValidationException When Date.ParseExact(pickdate1.Text, "dd.MM.yyyy", Nothing).Year < Date.ParseExact("2001", "yyyy", Nothing).Year And Date.ParseExact(pickdate2.Text, "dd.MM.yyyy", Nothing).Year > Date.ParseExact(Today, "dd.MM.yyyy", Nothing).Year
|
|
lbl_status.Text = "Der gewählte Bis-Zeitpunkt ist nicht gültig!"
|
|
End Try
|
|
End If
|
|
|
|
'lbl_status.Text = Kdnrtext
|
|
If String.IsNullOrEmpty(Kdnrtext) = False And String.IsNullOrEmpty(datevon.ToString) = False And String.IsNullOrEmpty(datebis.ToString) = False Then
|
|
dt = VERAG_PROG_ALLGEMEIN.cRechnungsausgang.GET_LIST_WEB(Integer.Parse(Kdnrtext), datevon, datebis, Integer.Parse(reNr), Absender, Empfaenger, LKWNR, KDNAFNR)
|
|
ElseIf String.IsNullOrEmpty(Kdnrtext) = True And String.IsNullOrEmpty(datevon.ToString) = True And String.IsNullOrEmpty(datebis.ToString) = True And String.IsNullOrEmpty(reNr) = True And String.IsNullOrEmpty(Absender) = False And String.IsNullOrEmpty(LKWNR) = False And String.IsNullOrEmpty(Empfaenger) = False And String.IsNullOrEmpty(KDNAFNR) = False Then
|
|
lbl_status.Text = "Bitte alle fehlenden Felder ausfüllen!"
|
|
valreq_pickdate1.Validate()
|
|
valreq_pickdate2.Validate()
|
|
End If
|
|
|
|
If dt IsNot Nothing AndAlso Not dt.Count = 0 Then
|
|
Dim i As Integer = 0
|
|
For Each d In dt
|
|
Dim tr = New TableRow
|
|
Dim Cell = New TableCell
|
|
Dim tbl_CellIndex = New TableCell
|
|
Dim tbl_CellRENr = New TableCell
|
|
Dim tbl_Cell_Auftragsdatum = New TableCell
|
|
Dim tbl_CellAbsender = New TableCell
|
|
Dim tbl_CellEmpfaenger = New TableCell
|
|
Dim tbl_CellLKWs = New TableCell
|
|
Dim tbl_CellKundAuftNr = New TableCell
|
|
Dim tbl_CellInfo = New TableCell
|
|
|
|
Dim zahl = i + 1
|
|
tbl_CellIndex.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_CellIndex.Text = zahl
|
|
tr.Cells.Add(tbl_CellIndex)
|
|
tbl_CellRENr.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_CellRENr.Text = d.RechnungsNr.ToString
|
|
tr.Cells.Add(tbl_CellRENr)
|
|
tbl_CellLKWs.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_CellLKWs.Text = d.LKW_Kennzeichen.ToString
|
|
tr.Cells.Add(tbl_CellLKWs)
|
|
tbl_Cell_Auftragsdatum.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_Cell_Auftragsdatum.Text = d.RechnungsDatum.ToString
|
|
tr.Cells.Add(tbl_Cell_Auftragsdatum)
|
|
tbl_CellKundAuftNr.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_CellKundAuftNr.Text = d.KdAuftragsNr.ToString
|
|
tr.Cells.Add(tbl_CellKundAuftNr)
|
|
tbl_CellAbsender.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_CellAbsender.Text = d.AbsenderName_1.ToString + Space(1) + d.AbsenderName_2.ToString
|
|
tr.Cells.Add(tbl_CellAbsender)
|
|
tbl_CellEmpfaenger.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_CellEmpfaenger.Text = d.EmpfängerName_1.ToString + Space(1) + d.EmpfängerName_2.ToString
|
|
tr.Cells.Add(tbl_CellEmpfaenger)
|
|
|
|
Dim btn As New ImageButton
|
|
btn.ViewStateMode = ViewStateMode.Enabled
|
|
'btn.Text = "Text"
|
|
btn.CssClass = "btn btn-primary"
|
|
btn.ImageUrl = "../images/Icons/service/pdficon.gif"
|
|
'btn.Attributes.Add("Text", <img src= width="15" height="15"/>)
|
|
btn.Attributes.Add("href", "pdfviewer.aspx?P1=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.FilialenNr).ToString() + "&P2=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.AbfertigungsNr).ToString + "&P3=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.RK_ID).ToString)
|
|
btn.Attributes.Add("target", "_blank")
|
|
btn.PostBackUrl = "pdfviewer.aspx?P1=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.FilialenNr).ToString + "&P2=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.AbfertigungsNr).ToString + "&P3=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.RK_ID).ToString
|
|
tbl_CellInfo.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
|
tbl_CellInfo.Controls.Add(btn)
|
|
tr.Cells.Add(tbl_CellInfo)
|
|
initcells(tr, tbl_CellIndex, tbl_CellRENr, tbl_CellLKWs, tbl_Cell_Auftragsdatum, tbl_CellKundAuftNr, tbl_CellAbsender, tbl_CellEmpfaenger, tbl_CellInfo, tbl_HeaderCellIndexNr, tbl_HeaderCell_ReNr, tbl_HeaderCell_LKWNr, tbl_HeaderCell_Auftragsdatum, tbl_HeaderCell_KundAuftrNr, tbl_HeaderCell_Absender, tbl_HeaderCell_Empfaenger, tbl_HeaderCell_Info)
|
|
normaltable.Rows.Add(tr)
|
|
|
|
i += 1
|
|
Next
|
|
Else
|
|
Dim tbl_cellNothing = New TableCell()
|
|
tbl_cellNothing.ColumnSpan = tbl_Header_row.Cells.Count
|
|
tbl_cellNothing.Style.Add("text-align", "center")
|
|
Dim tr = New TableRow()
|
|
tr.Style.Add("text-align", "center")
|
|
tbl_cellNothing.Text = Server.HtmlEncode("Keine Daten gefunden.")
|
|
tr.Cells.Add(tbl_cellNothing)
|
|
normaltable.Rows.Add(tr)
|
|
End If
|
|
Else
|
|
lbl_status.Text = "Error in valid date room"
|
|
End If
|
|
'End If
|
|
End Sub
|
|
End Class
|