/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/purchasing/oh_rate_kpi_report.aspx.vb
217 строк
10 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
Imports System.Data Imports System.IO Imports CommonFunctions Partial Class r Inherits System.Web.UI.Page Private ExcelDownload As Boolean = False Private Const parameterPrefix As String = "$#" Private WeekNumber, DayOfWeekNumber As Integer Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load report.DataSource = SqlDataSource report.DataBind() If IsPostBack Then Message.Text = "" End If WeekNumber = DatePart(DateInterval.WeekOfYear, Date.Today, Microsoft.VisualBasic.FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays) DayOfWeekNumber = Date.Today.DayOfWeek End Sub Private Function IndexOf(str As String, c As String, startPos As Integer) As Integer Return IIf(str.IndexOf(c, startPos) = -1, Integer.MaxValue, str.IndexOf(c, startPos)) End Function Private Sub r_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender Try If ExcelDownload Then ExcelDownloadSub(report, "Vendor on hand rate" & "_" & DateTime.Now.ToString("yyyyMMddHHmmss")) Else report.DataBind() End If Catch ex As Exception End Try End Sub Protected Sub ibExcelDownload_Click(sender As Object, e As ImageClickEventArgs) Handles ibExcelDownload.Click ExcelDownload = True End Sub Sub ExcelDownloadSub(ByVal gv As GridView, ByVal filename As String) Response.Clear() 'Response.Buffer = True Response.AddHeader("content-disposition", "attachment;filename=" & filename & ".xls") Response.ContentType = "application/vnd.xls" Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8") EnableViewState = False Response.Charset = "utf-8" Dim myCItrad As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US", True) gv.AllowSorting = False gv.AllowPaging = False gv.DataBind() Dim sw As StringWriter = New StringWriter(myCItrad) Dim hw As HtmlTextWriter = New HtmlTextWriter(sw) gv.RenderControl(hw) Response.Write(sw.ToString) Response.End() End Sub Private Sub report_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles report.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Select Case e.Row.Cells(7).Text Case "Finish production" e.Row.Cells(0).RowSpan = 3 e.Row.Cells(1).RowSpan = 3 If e.Row.Cells(1).Text <> " " Then e.Row.Cells(1).Text = e.Row.Cells(1).Text + "%" e.Row.Cells(2).RowSpan = 3 If e.Row.Cells(2).Text <> " " Then e.Row.Cells(2).Text = e.Row.Cells(2).Text + "%" e.Row.Cells(3).RowSpan = 3 If e.Row.Cells(3).Text <> " " Then e.Row.Cells(3).Text = e.Row.Cells(3).Text + "%" e.Row.Cells(4).RowSpan = 3 If e.Row.Cells(4).Text <> " " Then e.Row.Cells(4).Text = e.Row.Cells(4).Text + "%" e.Row.Cells(5).RowSpan = 3 If e.Row.Cells(5).Text <> " " Then e.Row.Cells(5).Text = e.Row.Cells(5).Text + "%" e.Row.Cells(10).RowSpan = 3 If e.Row.Cells(10).Text <> " " Then e.Row.Cells(10).Text = e.Row.Cells(10).Text + "%" e.Row.Cells(11).RowSpan = 3 If e.Row.Cells(11).Text <> " " Then e.Row.Cells(11).Text = e.Row.Cells(11).Text + "%" e.Row.Cells(12).RowSpan = 3 If e.Row.Cells(12).Text <> " " Then e.Row.Cells(12).Text = e.Row.Cells(12).Text + "%" e.Row.Cells(13).RowSpan = 3 If e.Row.Cells(13).Text <> " " Then e.Row.Cells(13).Text = e.Row.Cells(13).Text + "%" e.Row.Cells(14).RowSpan = 3 If e.Row.Cells(14).Text <> " " Then e.Row.Cells(14).Text = e.Row.Cells(14).Text + "%" e.Row.Cells(15).RowSpan = 3 If e.Row.Cells(15).Text <> " " Then e.Row.Cells(15).Text = e.Row.Cells(15).Text + "%" e.Row.Cells(16).RowSpan = 3 If e.Row.Cells(16).Text = "Achieve" Then e.Row.Cells(16).BackColor = Drawing.Color.Green e.Row.Cells(6).RowSpan = 2 Case "Plan to produce" e.Row.Cells(0).Visible = False e.Row.Cells(1).Visible = False e.Row.Cells(2).Visible = False e.Row.Cells(3).Visible = False e.Row.Cells(4).Visible = False e.Row.Cells(5).Visible = False e.Row.Cells(10).Visible = False e.Row.Cells(11).Visible = False e.Row.Cells(12).Visible = False e.Row.Cells(13).Visible = False e.Row.Cells(14).Visible = False e.Row.Cells(15).Visible = False e.Row.Cells(16).Visible = False e.Row.Cells(6).Visible = False Case "TTL" e.Row.Cells(0).Visible = False e.Row.Cells(1).Visible = False e.Row.Cells(2).Visible = False e.Row.Cells(3).Visible = False e.Row.Cells(4).Visible = False e.Row.Cells(5).Visible = False e.Row.Cells(10).Visible = False e.Row.Cells(11).Visible = False e.Row.Cells(12).Visible = False e.Row.Cells(13).Visible = False e.Row.Cells(14).Visible = False e.Row.Cells(15).Visible = False e.Row.Cells(16).Visible = False e.Row.Cells(6).Text = e.Row.Cells(6).Text + " " + e.Row.Cells(7).Text e.Row.Cells(6).ColumnSpan = 2 e.Row.Cells(7).Visible = False Case Else If e.Row.Cells(1).Text <> " " Then e.Row.Cells(1).Text = e.Row.Cells(1).Text + "%" If e.Row.Cells(2).Text <> " " Then e.Row.Cells(2).Text = e.Row.Cells(2).Text + "%" If e.Row.Cells(3).Text <> " " Then e.Row.Cells(3).Text = e.Row.Cells(3).Text + "%" If e.Row.Cells(4).Text <> " " Then e.Row.Cells(4).Text = e.Row.Cells(4).Text + "%" If e.Row.Cells(5).Text <> " " Then e.Row.Cells(5).Text = e.Row.Cells(5).Text + "%" If e.Row.Cells(10).Text <> " " Then e.Row.Cells(10).Text = e.Row.Cells(10).Text + "%" If e.Row.Cells(11).Text <> " " Then e.Row.Cells(11).Text = e.Row.Cells(11).Text + "%" If e.Row.Cells(12).Text <> " " Then e.Row.Cells(12).Text = e.Row.Cells(12).Text + "%" If e.Row.Cells(13).Text <> " " Then e.Row.Cells(13).Text = e.Row.Cells(13).Text + "%" If e.Row.Cells(14).Text <> " " Then e.Row.Cells(14).Text = e.Row.Cells(14).Text + "%" If e.Row.Cells(15).Text <> " " Then e.Row.Cells(15).Text = e.Row.Cells(15).Text + "%" End Select ElseIf e.Row.RowType = DataControlRowType.Header Then e.Row.Cells(1).Text = "W" + (WeekNumber - 5).ToString e.Row.Cells(2).Text = "W" + (WeekNumber - 4).ToString e.Row.Cells(3).Text = "W" + (WeekNumber - 3).ToString e.Row.Cells(4).Text = "W" + (WeekNumber - 2).ToString e.Row.Cells(5).Text = "W" + (WeekNumber - 1).ToString e.Row.Cells(9).Text = "W" + (WeekNumber).ToString + " Req' pcs" Select Case DayOfWeekNumber Case 1 e.Row.Cells(14).Text = "Monday" report.Columns(13).Visible = False report.Columns(12).Visible = False report.Columns(11).Visible = False report.Columns(10).Visible = False Case 2 e.Row.Cells(14).Text = "Tuesday" e.Row.Cells(13).Text = "Monday" report.Columns(12).Visible = False report.Columns(11).Visible = False report.Columns(10).Visible = False Case 3 e.Row.Cells(14).Text = "Wednesday" e.Row.Cells(13).Text = "Tuesday" e.Row.Cells(12).Text = "Monday" report.Columns(11).Visible = False report.Columns(10).Visible = False Case 4 e.Row.Cells(14).Text = "Thursday" e.Row.Cells(13).Text = "Wednesday" e.Row.Cells(12).Text = "Tuesday" e.Row.Cells(11).Text = "Monday" report.Columns(10).Visible = False Case 5 e.Row.Cells(14).Text = "Friday" e.Row.Cells(13).Text = "Thursday" e.Row.Cells(12).Text = "Wednesday" e.Row.Cells(11).Text = "Tuesday" e.Row.Cells(10).Text = "Monday" End Select End If End Sub Protected Sub getData_Click(sender As Object, e As EventArgs) Handles getData.Click Dim sqlf As New sharedClasses.dbFunctions.SqlFunctions sqlf.NonQuery("Update UserModules.[user].WA_JOB_LIST Set RUN_IMMEDIATELY='Y' WHERE id=43 ") Message.Text = "Выгрузка поставлена в очередь. Время ожидания 15-20 минут" End Sub End Class