Files
ECO2-OD/ArinWarev1/FORM-BASIC/Frm_RepResult_Admin.vb

100 lines
4.5 KiB
VB.net

Public Class Frm_RepResult_Admin
Public Overrides Function AcceptChanged() As Boolean
End Function
Public Overrides Function RejectChanged() As Boolean
End Function
Public Overrides Function HasChanged() As Boolean
End Function
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
Select Case Me.DataGridView1.Rows(e.RowIndex).Cells(2).Value.ToString
Case "MT"
Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.ForeColor = Color.Green
Case "TT"
Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.ForeColor = Color.Blue
Case "ST"
Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.ForeColor = Color.Tomato
Case "SL"
Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.ForeColor = Color.DarkMagenta
Case Else
Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.ForeColor = Color.Black
End Select
End Sub
Private Sub Frm_RepResult_Admin_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.bsmain.DataSource = DSETR1
Me.bs_1차소요량.DataSource = DSETR1
Me.bs_max.DataSource = DSETR1
Me.bs_면적.DataSource = DSETR1
Me.bs_생산E.DataSource = DSETR1
Me.bs_소요량.DataSource = DSETR1
Dim dv() As DataGridView = New DataGridView() {Me.DataGridView7, _
Me.DataGridView9, _
Me.DataGridView10, _
Me.DataGridView11, _
Me.DataGridView12, _
Me.DataGridView13, _
Me.DataGridView14, _
Me.DataGridView15, _
Me.DataGridView16, _
Me.DataGridView17, _
Me.DataGridView18, _
Me.DataGridView19}
For i As Integer = 1 To 12
Dim Bs As New BindingSource
Bs.DataSource = DSETR1
Bs.DataMember = "월별에너지분석"
Bs.Filter = "월='M" & Format(i, "00") & "'"
dv(i - 1).DataSource = Bs
Next
' Me.bs.DataSource = DSETR
End Sub
Private Sub ToolStripButton1_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButton1.Click
Dim sd As New SaveFileDialog()
sd.Filter = "csv|*.csv"
sd.FilterIndex = 0
If (sd.ShowDialog() <> Windows.Forms.DialogResult.OK) Then Return
Dim Fs As New System.IO.FileStream(sd.FileName, IO.FileMode.Create)
Dim SW As New System.IO.StreamWriter(Fs, System.Text.Encoding.Default)
Dim Strbuf As String = ""
Dim colList As New List(Of Integer)
SW.WriteLine(",Code,Total,M1,M2,M3,M4,M5,M6,M7,M8,M9,M10,M11,M12")
Strbuf = ""
For Each DR As Windows.Forms.DataGridViewRow In DataGridView1.Rows
Strbuf = Strbuf & "," & DR.Cells(0).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 0).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 1).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 2).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 3).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 4).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 5).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 6).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 7).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 8).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 9).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 10).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 11).Value.ToString
Strbuf = Strbuf & "," & DR.Cells(7 + 12).Value.ToString
SW.WriteLine(Strbuf)
Strbuf = ""
Next
SW.Dispose()
Fs.Dispose()
MsgBox("저장완료" & vbCrLf & sd.FileName, MsgBoxStyle.Information, "확인")
Shell("notepad " & sd.FileName, AppWinStyle.NormalFocus)
End Sub
End Class