/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/fi/gilistsum.aspx.vb
183 строки
7 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
Imports System.Data Imports System.IO Imports sharedClasses.dbFunctions Partial Class FI_gilistsum Inherits System.Web.UI.Page Private se As String = "" Private sd As SortDirection = 0 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load message.Text = "" If Not IsPostBack Then MakeReport(onlyInvEqGi.Checked, byGtdList.Checked) GridView1.Attributes.Add("se", se) GridView1.Attributes.Add("sd", sd) Else se = GridView1.Attributes("se") sd = GridView1.Attributes("sd") End If End Sub Protected Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound With e.Row If .RowType = DataControlRowType.DataRow Then Dim rV As DataRowView = CType(.DataItem, DataRowView) .Cells(5).Style.Add("font-weight", "bold") .Cells(6).Style.Add("font-weight", "bold") If rV("GI_QTY") <> rV("INVOICE_QTY") Then .Cells(5).Style.Add("color", "red") .Cells(6).Style.Add("color", "blue") Else .Cells(5).Style.Add("color", "green") .Cells(6).Style.Add("color", "green") End If End If End With End Sub Protected Sub ibPrint_Click(sender As Object, e As ImageClickEventArgs) Handles ibGiToProd.Click Print("giform") End Sub Protected Sub ImageButton1_Click(sender As Object, e As ImageClickEventArgs) Handles ibFgGr.Click Print("mx18form") End Sub Protected Sub ibGrPrint_Click(sender As Object, e As ImageClickEventArgs) Handles ibWhGr.Click Print("m4") End Sub Private Sub Print(whatToPring As String) For Each dr As GridViewRow In GridView1.Rows If dr.RowType = DataControlRowType.DataRow Then Dim c As TableCell = dr.Cells(dr.Cells.Count - 1) Try If CType(c.Controls(1), CheckBox).Checked Then message.Text &= CType(c.Controls(1), CheckBox).ToolTip & ";" End If Catch ex As Exception End Try End If Next If message.Text <> "" Then Dim params As Hashtable If IsNothing(Session("params")) Then params = New Hashtable Else params = Session("params") End If Dim paramId As String = Guid.NewGuid.ToString params.Add(paramId, message.Text) Session.Add("params", params) ClientScript.RegisterStartupScript(Me.GetType, "a", "<script>window.open('prntl.aspx?form=" & whatToPring & "¶mid=" & paramId & "')</script>") End If End Sub Protected Sub ibRefresh_Click(sender As Object, e As ImageClickEventArgs) Handles ibRefresh.Click MakeReport(onlyInvEqGi.Checked, byGtdList.Checked) End Sub Protected Sub GridView1_Sorting(sender As Object, e As GridViewSortEventArgs) Handles GridView1.Sorting If se <> e.SortExpression Then se = e.SortExpression sd = SortDirection.Ascending Else If sd = SortDirection.Ascending Then sd = SortDirection.Descending Else sd = SortDirection.Ascending End If End If GridView1.Attributes.Add("se", se) GridView1.Attributes.Add("sd", sd) MakeReport(onlyInvEqGi.Checked, byGtdList.Checked) End Sub Protected Sub GridView1_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles GridView1.PageIndexChanging GridView1.PageIndex = e.NewPageIndex MakeReport(onlyInvEqGi.Checked, byGtdList.Checked) End Sub Private Sub MakeReport(showAll As Boolean, byList As Boolean) If Not byList Then If showAll Then sdsGTDGIListSummary.SelectCommand = sdsGTDGIListSummary.SelectCommand.Replace("--", "") Else If Not sdsGTDGIListSummary.SelectCommand.Contains("-- having ") Then sdsGTDGIListSummary.SelectCommand = sdsGTDGIListSummary.SelectCommand.Replace("having", "-- having") End If End If If se <> "" Then sdsGTDGIListSummary.SelectCommand &= " ORDER BY " & se & IIf(sd = 0, " ASC", " DESC") End If GridView1.DataSource = sdsGTDGIListSummary Else Dim sqlf As New SqlFunctions Dim sql As New StringBuilder sql.AppendLine("select t1.gtd, ") sql.AppendLine("t2.inv, t1.MATERIAL, ") sql.AppendLine("t2.description, t2.iv_date, isnull(t2.gi_qty, 0) as gi_qty, ") sql.AppendLine("isnull(t2.INVOICE_QTY,0) as invoice_qty, t2.INVOICE_AMNT, ") sql.AppendLine("t2.currency, t2.exch_rate, ") sql.AppendLine("t2.PRINT_DOCUMENT_NUMBER, t2.FG_GR_DOCUMENT_NUMBER, ") sql.AppendLine("t2.GR_DOCUMENT_NUMBER, t2.WENUM, t2.Amount_RUB ") sql.AppendLine("from UserModules.[user].TMP_GTD___MATERIAL_LIST t1 ") sql.AppendLine("left join UserModules.[user].[VI_GTD_GI_LIST] t2 ") sql.AppendLine("on t1.gtd = t2.gtd and t1.MATERIAL = t2.material ") If showAll Then sql.AppendLine("WHERE isnull(t2.gi_qty, 0) = isnull(t2.INVOICE_QTY,0) AND t2.inv is not null") End If GridView1.DataSource = sqlf.GetData(sql.ToString) End If GridView1.DataBind() End Sub Protected Sub onlyInvEqGi_CheckedChanged(sender As Object, e As EventArgs) Handles onlyInvEqGi.CheckedChanged MakeReport(onlyInvEqGi.Checked, byGtdList.Checked) End Sub Protected Sub ImageButton2_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton2.Click GridView1.AllowPaging = False GridView1.AllowSorting = False MakeReport(onlyInvEqGi.Checked, byGtdList.Checked) ExcelDownloadSub(GridView1, "GI_LIST_SUM_" & DateTime.Now.ToString("yyyyMMddHHmmss") & ".xls") 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") Response.Charset = "utf-8" Dim myCItrad As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US", True) 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 Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) End Sub Protected Sub byGtdList_CheckedChanged(sender As Object, e As EventArgs) Handles byGtdList.CheckedChanged MakeReport(onlyInvEqGi.Checked, byGtdList.Checked) End Sub End Class