/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/purchasing/oh_rate_kpi_report.aspx
343 строки
10 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="OH_rate_KPI_report.aspx.vb" Inherits="r" %> <%@ Register Src="~/UserControls/editableGridNew.ascx" TagPrefix="uc1" TagName="editableGridNew" %> <%@ Register Src="~/UserControls/alerter.ascx" TagPrefix="uc1" TagName="alerter" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Orchestra report master</title> <link href="../Styles/page.css" rel="stylesheet" /> </head> <body> <form id="form1" runat="server"> <div class="center"> <asp:Label runat ="server" id="Message"></asp:Label> <hr /> </div> <div id="getdatafromgerp" class="center"> <%--<asp:TextBox ID="reportDate" TextMode="Date" runat="server"></asp:TextBox>--%> <asp:Button id="getData" runat ="server" Text ="Run O/H rate calculation" /> <asp:Label ID="Label1" runat ="server"></asp:Label> </div> <div class="center"> <asp:ImageButton ID="ibRefresh" runat="server" ImageUrl="~/Images/Refresh.png" class="vcenter" /> <asp:ImageButton ID="ibExcelDownload" runat="server" Height="27" Width="27" ImageUrl="~/Images/Microsoft%20Office%202003%20Excel.png" CssClass="vcenter" /> </div> <asp:GridView ID="report" runat="server" CellPadding="4" ForeColor="#333333" Style="margin: 0 auto;" AutoGenerateColumns="False" HorizontalAlign="Center"> <AlternatingRowStyle BackColor="White" /> <EditRowStyle BackColor="#2461BF" /> <EmptyDataRowStyle BackColor="Red" /> <FooterStyle BackColor="#229EE5" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#229EE5" Font-Bold="True" ForeColor="White" /> <PagerSettings Mode="NumericFirstLast" PageButtonCount="5" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#EFF3FB" HorizontalAlign="Center" VerticalAlign="Middle" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingCellStyle BackColor="#F5F7FB" /> <SortedAscendingHeaderStyle BackColor="#6D95E1" /> <SortedDescendingCellStyle BackColor="#E9EBEF" /> <SortedDescendingHeaderStyle BackColor="#4870BE" /> <Columns> <asp:BoundField HeaderText="Vendor" DataField="Vendor" /> <asp:BoundField HeaderText="W-5" DataField="W-5"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="W-4" DataField="W-4"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="W-3" DataField="W-3"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="W-2" DataField="W-2"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="W-1" DataField="W-1"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="Vendor" DataField="Vendor" /> <asp:BoundField HeaderText="Status" DataField="Status" /> <asp:BoundField HeaderText="Items" DataField="Items" /> <asp:BoundField HeaderText="Req' pcs" DataField="Req" /> <asp:BoundField HeaderText="D-4" DataField="D-4"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="D-3" DataField="D-3"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="D-2" DataField="D-2"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="D-1" DataField="D-1"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="D" DataField="D"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="Target" DataField="Target"> <ItemStyle Font-Bold="True" /> </asp:BoundField> <asp:BoundField HeaderText="Result" DataField="Result"> <ItemStyle Font-Bold="True" /> </asp:BoundField> </Columns> </asp:GridView> <div> <asp:SqlDataSource ID="SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SERKIntranetConnectionString %>" SelectCommand=" select [WeekW-5].[rate] as [W-5] ,[WeekW-4].[rate] as [W-4] ,[WeekW-3].[rate] as [W-3] ,[WeekW-2].[rate] as [W-2] ,[WeekW-1].[rate] as [W-1] ,Vendor.[VENDOR_NAME] as Vendor ,DayD.[Status] ,DayD.[Items] ,DayD.[Req' pcs] as Req ,[DayD-4].[Rate] as [D-4] ,[DayD-3].[Rate] as [D-3] ,[DayD-2].[Rate] as [D-2] ,[DayD-1].[Rate] as [D-1] ,DayD.[Rate] as D ,Vendor.[Target] ,DayD.[Result] from [UserModules].[user].[Vendors_code] Vendor left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate](getdate()) union select vendor ,'Plan to produce' as [Status] ,[plan to produce items] as [Items] ,[plan to produce] as [Req' pcs] ,'' as Rate ,'' as [Target] ,'' as Result from [UserModules].[dbo].[mm_OnHandRate](getdate()) union select vendor ,'TTL' as [Status] ,[ttl items] as [Items] ,[ttl] as [Req' pcs] ,'' as Rate ,'' as [Target] ,'' as Result from [UserModules].[dbo].[mm_OnHandRate](getdate()) ) DayD on Vendor.[VENDOR_CODE] = DayD.vendor -- Выборка за Д-1 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate](dateadd(day,-1, getdate())) ) [DayD-1] on Vendor.[VENDOR_CODE] = [DayD-1].vendor -- Выборка за Д-2 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate](dateadd(day,-2, getdate())) ) [DayD-2] on Vendor.[VENDOR_CODE] = [DayD-2].vendor -- Выборка за Д-3 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate](dateadd(day,-3, getdate())) ) [DayD-3] on Vendor.[VENDOR_CODE] = [DayD-3].vendor -- Выборка за Д-4 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate](dateadd(day,-4, getdate())) ) [DayD-4] on Vendor.[VENDOR_CODE] = [DayD-4].vendor -- Выборка за W-1 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate]( cast (case when datepart(weekday, getdate()) = 2 then dateadd(day, -3, getdate()) when datepart(weekday, getdate()) = 3 then dateadd(day, -4, getdate()) when datepart(weekday, getdate()) = 4 then dateadd(day, -5, getdate()) when datepart(weekday, getdate()) = 5 then dateadd(day, -6, getdate()) when datepart(weekday, getdate()) = 6 then dateadd(day, -7, getdate()) end as date) ) ) [WeekW-1] on Vendor.[VENDOR_CODE] = [WeekW-1].vendor -- Выборка за W-2 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate]( cast (case when datepart(weekday, getdate()) = 2 then dateadd(day, -10, getdate()) when datepart(weekday, getdate()) = 3 then dateadd(day, -11, getdate()) when datepart(weekday, getdate()) = 4 then dateadd(day, -12, getdate()) when datepart(weekday, getdate()) = 5 then dateadd(day, -13, getdate()) when datepart(weekday, getdate()) = 6 then dateadd(day, -14, getdate()) end as date) ) ) [WeekW-2] on Vendor.[VENDOR_CODE] = [WeekW-2].vendor -- Выборка за W-3 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate]( cast (case when datepart(weekday, getdate()) = 2 then dateadd(day, -17, getdate()) when datepart(weekday, getdate()) = 3 then dateadd(day, -18, getdate()) when datepart(weekday, getdate()) = 4 then dateadd(day, -19, getdate()) when datepart(weekday, getdate()) = 5 then dateadd(day, -20, getdate()) when datepart(weekday, getdate()) = 6 then dateadd(day, -21, getdate()) end as date) ) ) [WeekW-3] on Vendor.[VENDOR_CODE] = [WeekW-3].vendor -- Выборка за W-4 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate]( cast (case when datepart(weekday, getdate()) = 2 then dateadd(day, -24, getdate()) when datepart(weekday, getdate()) = 3 then dateadd(day, -25, getdate()) when datepart(weekday, getdate()) = 4 then dateadd(day, -26, getdate()) when datepart(weekday, getdate()) = 5 then dateadd(day, -27, getdate()) when datepart(weekday, getdate()) = 6 then dateadd(day, -28, getdate()) end as date) ) ) [WeekW-4] on Vendor.[VENDOR_CODE] = [WeekW-4].vendor -- Выборка за W-5 left join ( select vendor ,'Finish production' as [Status] ,[finish production items] as [Items] ,[finish production] as [Req' pcs] ,Rate ,[Target] ,Result from [UserModules].[dbo].[mm_OnHandRate]( cast (case when datepart(weekday, getdate()) = 2 then dateadd(day, -31, getdate()) when datepart(weekday, getdate()) = 3 then dateadd(day, -32, getdate()) when datepart(weekday, getdate()) = 4 then dateadd(day, -33, getdate()) when datepart(weekday, getdate()) = 5 then dateadd(day, -34, getdate()) when datepart(weekday, getdate()) = 6 then dateadd(day, -35, getdate()) end as date) ) ) [WeekW-5] on Vendor.[VENDOR_CODE] = [WeekW-5].vendor order by vendor, [Status] "></asp:SqlDataSource> </div> </form> </body> </html>