/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/demurrage/container_management.aspx
934 строки
32 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Container_management.aspx.vb" Inherits="demurrage_item" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Container manager</title> <style> .date { width: 70px; } .center { margin: 0 auto; } body { font-family: Tahoma; } .click { cursor: pointer; } /*Форма для редактирования полей и для добавления новых записей*/ /* Button used to open the contact form - fixed at the bottom of the page */ .open-button { background-color: #555; color: white; padding: 16px 20px; border: none; cursor: pointer; opacity: 0.8; position: fixed; bottom: 23px; right: 28px; width: 280px; } /* The popup form - hidden by default */ .form-popup { display: none; position: fixed; top: 20%; left: 40%; border: 3px solid #f1f1f1; z-index: 9; } /* Add styles to the form container */ .form-container { width: 400px; padding: 10px; background-color: white; } /*Input img-button*/ .img_but { /*padding: 10px 10px 10px 10px;*/ margin: 0px 10px 0px 10px; } /* Full-width input fields */ .form-container input[type=text], .form-container input[type=password], .form-container input[type=date] { width: 100%; padding: 15px 0 15px 0; margin: 5px 0 22px 0; border: none; background: #f1f1f1; } /* When the inputs get focus, do something */ .form-container input[type=text]:focus, .form-container input[type=password]:focus, .form-container input[type=date]:focus { background-color: #ddd; outline: none; } /* Set a style for the submit/login button */ .form-container .btn { background-color: #4CAF50; color: white; padding: 16px 20px; border: none; cursor: pointer; width: 49%; margin-bottom: 10px; opacity: 0.8; } /* Add a red background color to the cancel button */ .form-container .cancel { background-color: red; } .eta { background-color: deepskyblue; } /* Add some hover effects to buttons */ .form-container .btn:hover, .open-button:hover { opacity: 1; } /* Form dropdown list */ .form-container .select { width: 400px; background: transparent; line-height: 1; border: 1; padding: 10px; border-radius: 0; position: relative; font-size: 1em; margin-bottom: 10px; } /*Закреплённая шапка*/ /*<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />*/ #header { width: 1000%; display: block; position: fixed; background: #6B696B; overflow: hidden; z-index: 1; top: 0px; } #header div { display: table-cell; padding: 4px; border: 1px solid #ccc; border-collapse: collapse; font-weight: bold; color: white; } .simplepopup { background-color: Navy; color: White; } .tooltip { position: absolute; z-index: 1030; display: block; font-size: 12px; line-height: 1.4; visibility: visible; max-width: 1100px !important; } .tooltip-inner { max-width: 1000px; padding: 3px 8px; color: #000000; text-align: center; text-decoration: none; background-color: burlywood; border-radius: 4px; } .detailTable td{ font-size: 18pt !important; } .detailTable th { font-size: 22pt !important; } </style> <link id="gridStyle" runat="server" rel="stylesheet" /> <link id="pageStyle" runat="server" rel="stylesheet" /> <script src="../Scripts/jquery-1.9.1.min.js"></script> <script src="../Scripts/bootstrap.js"></script> <script src="../Scripts/popover.js"></script> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManagerProxy1" runat="server"> <Services> <asp:ServiceReference Path="~/Services/edGrid.svc" /> </Services> <Scripts> <%--<asp:ScriptReference Path="~/Scripts/jquery-1.9.1.min.js" />--%> <asp:ScriptReference Path="~/Scripts/editableGrid.js" /> <%--<asp:ScriptReference Path="../Scripts/bootstrap.js" />--%> <%--<asp:ScriptReference Path="../Scripts/popover.js" />--%> </Scripts> </asp:ScriptManager> <div> <div class="center" align="center"> <table border="0"> <tr> <td align="rigth"> <b>Main operations: </b> </td> <td align="left"> <asp:ImageButton runat="server" ID="ImageAdd" AlternateText="Add new record" Height="28px" ImageUrl="~/Images/Buttons/24/plus.png" ToolTip="Add new record" Width="28px" Visible="false" ImageAlign="AbsMiddle" /> <asp:Image ID="DataUpload" CssClass="click dataupload" runat="server" AlternateText="Data Upload" ImageUrl="~/Images/Buttons/24/Database.png" ToolTip="Data bulk upload" Height="28px" Width="28px" Visible="false" ImageAlign="AbsMiddle" /> <asp:ImageButton ID="ExcelDownload" runat="server" AlternateText="Excel Download" Height="28px" ImageUrl="~/Images/Microsoft Office 2003 Excel.png" ToolTip="Excel download" Width="28px" ImageAlign="AbsMiddle" /> <asp:ImageButton ID="SendMail" runat="server" AlternateText="Send mail report" Height="28px" ImageUrl="~/Images/Buttons/24/Mail.png" ToolTip="Send mail report" Width="28px" ImageAlign="AbsMiddle" /> </td> </tr> <tr> <td align="right"> <b>Train suggestion: </b> Train suggestion: </b> </td> <td align="left" colspan="2"> <asp:ImageButton runat="server" ID="ImageSAP" AlternateText="" Height="32px" ImageUrl="~/Images/Demurrage/SAP.png" ToolTip="Extract MRP from SAP" Width="36px" Visible="true" ImageAlign="AbsMiddle" /> <asp:ImageButton runat="server" ID="Prediction" AlternateText="" Height="36px" ImageUrl="~/Images/Demurrage/prediction.png" ToolTip="Calculate delivery by train possibility" Width="36px" Visible="true" ImageAlign="AbsMiddle" /> <asp:ImageButton runat="server" ID="Train_filter" AlternateText="" Height="36px" ImageUrl="~/Images/Demurrage/Train.png" ToolTip="Show only containers possible to delivery by train" Width="36px" Visible="true" ImageAlign="AbsMiddle" /> </td> </tr> <tr> <td align="right"><b>Train details: <td align="left"> MRP date: <asp:Label ID="MRP_date_label" runat="server" Text="MRP_date_label"></asp:Label><br /> Tracing information date: <asp:Label ID="Trasing_date_label" runat="server" Text="Tracing_date_label"></asp:Label><br /> Containers detail information date: <asp:Label ID="Containers_details_date_label" runat="server" Text="Containers_details_date_label"></asp:Label><br /> Train suggestion calculation: <asp:Label ID="Train_date_label" runat="server" Text="Train_date_label"></asp:Label> </td> </tr> </table> </div> <%--Это зафиксированная шапка таблицы. Заполняется java-scriptом--%> <div id="header" class="center"></div> <asp:GridView ID="main_list" runat="server" CssClass="center" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" ShowFooter="True" AutoGenerateColumns="False" > <AlternatingRowStyle BackColor="White" /> <FooterStyle BackColor="#CCCC99" /> <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" BorderStyle="solid" /> <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /> <RowStyle BackColor="#F7F7DE" /> <%--<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />--%> <SortedAscendingCellStyle BackColor="#FBFBF2" /> <SortedAscendingHeaderStyle BackColor="#848384" /> <SortedDescendingCellStyle BackColor="#EAEAD3" /> <SortedDescendingHeaderStyle BackColor="#575357" /> <Columns> <asp:BoundField Visible="false" HeaderText="Row action" ItemStyle-Wrap="False" /> <asp:BoundField Visible="true" DataField="ETA_placeholder" HeaderText="ETA placeholder" ItemStyle-Wrap="False" /> <asp:BoundField DataField="Container ID" Visible="true" HeaderText="ID" /> <%--<div data-toggle="tooltip" data-placement="auto" data-html="true" data-original-title="@TEMPLATE" style="cursor: pointer;"> </div>--%> <asp:BoundField DataField="ODCY_ref" Visible="true" HeaderText="ODCY" /> <asp:BoundField DataField="ODCY_flag" Visible="true" HeaderText="ODCY_flag" /> <asp:BoundField DataField="train_flag" Visible="true" HeaderText="Train flag"/> <asp:BoundField DataField="Destination" Visible="true" HeaderText="Destination" ItemStyle-Wrap="False" /> <asp:BoundField DataField="Provider" Visible="true" HeaderText="Provider" ItemStyle-Wrap="False" /> <asp:BoundField DataField="Container" Visible="true" HeaderText="Container" ItemStyle-Wrap="False" /> <asp:BoundField DataField="Cargo" Visible="true" HeaderText="Cargo" ItemStyle-Wrap="False" /> <asp:BoundField DataField="Condition" Visible="true" HeaderText="Condition" ItemStyle-Wrap="False" /> <asp:BoundField DataField="Arrival date" Visible="true" HeaderText="Arrival date" ItemStyle-Wrap="False" /> <asp:BoundField DataField="DO_date" Visible="true" HeaderText="DO date" ItemStyle-Wrap="False" /> <asp:BoundField DataField="Status" Visible="true" HeaderText="Status" ItemStyle-Wrap="False" /> <asp:BoundField Visible="true" HeaderText="CY (days)" /> <asp:BoundField Visible="true" HeaderText="Demurrage (days)" /> </Columns> </asp:GridView> </div> <asp:GridView ID="Log" runat="server" CssClass="center" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" ShowFooter="True" AutoGenerateColumns="False" visibility="false" > <AlternatingRowStyle BackColor="White" /> <FooterStyle BackColor="#CCCC99" /> <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" BorderStyle="solid" /> <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /> <RowStyle BackColor="#F7F7DE" /> <%--<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />--%> <SortedAscendingCellStyle BackColor="#FBFBF2" /> <SortedAscendingHeaderStyle BackColor="#848384" /> <SortedDescendingCellStyle BackColor="#EAEAD3" /> <SortedDescendingHeaderStyle BackColor="#575357" /> <Columns> </Columns> </asp:GridView> <asp:Panel runat="server" ID="pnlDataUpload" CssClass="borderRadius popup hidden" Width="500px"> <div id="dvHeaderDataUpload" style="font-weight: bold;"> <table style="width: 100%; cursor: move;"> <tr> <td style="width: 100%; text-align: center;">Data upload from Excel<br /> <span style="color: Navy; font-size: small;">First download excel form for this table, arrange your data in excel according to the given format and copy/paste data from excel to text box below (without header). </span> </td> <td style="padding-left: 10px"> <asp:Image runat="server" ID="CancelDataUpload" CssClass="closepopup" ImageUrl="~/Images/cancel.png" /> </td> </tr> </table> </div> <hr /> <table style="width: 100%; display: none;"> <tr> <td>Select your decimal notation format: </td> <td> <asp:RadioButtonList ID="rblDecimalNotation" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Value="1" Selected="True">0.000</asp:ListItem> <asp:ListItem Value="0">0,000</asp:ListItem> </asp:RadioButtonList> </td> <td>Select your date format: </td> <td> <asp:RadioButtonList ID="rblDateFormat" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Value="0" Selected="True">dd.MM.yyyy</asp:ListItem> <asp:ListItem Value="1">yyyy-MM-dd</asp:ListItem> </asp:RadioButtonList> </td> </tr> </table> <hr /> <table class="center centerAlign "> <tr> <td> <asp:ImageButton ID="ibUpload" CssClass="closepopup" runat="server" ImageUrl="~/Images/Buttons/24/Download.png" ToolTip="Upload" /> </td> </tr> <tr> <td> <asp:Literal ID="ltrUploadResults" runat="server"></asp:Literal> </td> </tr> </table> <asp:TextBox ID="txtDataToUpload" runat="server" TextMode="MultiLine" Height="242px" Width="500px"></asp:TextBox> </asp:Panel> </form> <div class="form-popup" id="Add"> <form action="" class="form-container"> <label for="destination_add"><b>Select division</b></label> <select class="select" id="destination_add" name="destination_add"></select> <input type="text" placeholder="Enter container number" name="container_add" id="container_add" /> <input type="text" placeholder="Input condition" name="condition_add" id="condition_add" /> <input type="text" placeholder="Input cargo" name="cargo_add" id="cargo_add" /> <label for="date_add"><b>Date</b></label> <input type="date" name="date_add" id="date_add" /><br /> <label for="status_add"><b>Select status</b></label> <select class="select" id="status_add" name="status_add"> <option value="-1">Please select status</option> <option value="1">in transit</option> <option value="2">Not CC</option> <option value="3">CC finished</option> <option value="4">DO</option> <option value="5">SERK</option> </select> <button type="button" class="btn" id="add_ok">Confirm</button> <button type="button" class="btn cancel" onclick="closeForm()">Cancel</button> </form> </div> <div class="form-popup" id="Calendar"> <form action="" class="form-container"> <h2>Enter date</h2> <input type="date" name="ata_date" id="ata_date" required><br /><br /> <button type="button" class="btn" id="calendar_ok">Confirm</button> <button type="button" class="btn cancel" onclick="closeForm()">Cancel</button> </form> </div> <div class="form-popup" id="Division"> <form action="" class="form-container"> <h2>Select destination and provider</h2> <select class="select" id="destination" name="destination"></select> <button type="button" class="btn" id="destination_ok">Confirm</button> <button type="button" class="btn cancel" onclick="closeForm()">Cancel</button> </form> </div> <div class="form-popup" id="Status_dropdown"> <form action="" class="form-container"> <h2>Change status</h2> <select class="select" id="Status" name="Status"> <option value="-1">Please select status</option> <option value="1">in transit</option> <option value="2">Not CC</option> <option value="3">CC finished</option> <option value="4">DO</option> <option value="5">SERK</option> </select> <button type="button" class="btn" id="status_ok">Confirm</button> <button type="button" class="btn cancel" onclick="closeForm()">Cancel</button> </form> </div> </body> <script type="text/javascript"> var cell; var savingCell; var txt; var value; var cls; var key; var category = []; //$(document).ready(function () { //}); //Фиксированная шапка jQuery(document).ready(function ($) { $("[data-toggle=popover]").popover(); $("[data-toggle=tooltip]").tooltip(); var $header = $('#header'), $thead = $('#main_list'); $thead.find('th').each(function () { var $newdiv = $('<div />', { style: 'width: ' + $(this).width() + 'px' }); $newdiv.text($(this).text()); $header.append($newdiv); }); var $headrt_init_pos = $("#header").position().left; $header.hide(); var $viewport = $(window); $viewport.scroll(function () { $header.css({ left: -$(this).scrollLeft() + $headrt_init_pos }); if ($(this).scrollTop() != 0) { $header.show(); } else { $header.hide(); } }); }); //Фиксированная шапка $(document).keyup(function (e) { if (e.keyCode == 27) { if (cell != null) { cell.text(txt); cell.removeClass("noclick"); cell.addClass(cls); cell = null; } closeForm(); } }); function closeForm() { document.getElementById("Division").style.display = "none"; document.getElementById("Status_dropdown").style.display = "none"; document.getElementById("Calendar").style.display = "none"; document.getElementById("Add").style.display = "none"; if (cell != null) { cell.text(txt); cell.removeClass("noclick"); cell.addClass(cls); cell = null; } } function SaveData(val) { savingCell = cell; var data = {}; data.mode = "update"; data.rowid = key; data.value = val; $.ajax({ url: ('./table_management_handler.ashx'), type: 'POST', data: data, cache: false, dataType: 'JSON', success: function (data, textStatus, jqXHR) { //$("#form1").submit(); location.assign(location.href); }, error: function (jqXHR, textStatus, errorThrown) { // Handle errors here console.log('ERRORS2: '); console.log(textStatus); console.log(errorThrown); console.log(jqXHR); // STOP LOADING SPINNER } }); cell.removeClass("noclick") cell.addClass(cls); cell.html("<img src='../images/uploading.gif' />"); cell = null; }; //////////////Работа с редактированием текстовых полей //Разблокировка поля для редактирования $(".text").dblclick(function () { if ($(this).attr("class").indexOf("noclick") < 0) { //Saving data if there is active cell if ((cell != null)) { SaveData(); }; cell = $(this); key = $(this).attr("key"); cls = $(this).attr("class"); txt = $(this).text(); cell.removeClass("text"); cell.addClass("noclick"); cell.html("<input name=\"foo\" key= \"" + key + "\"type=\"text\" id=\"foo\" style=\"width: 100px;\" value=\"" + txt + "\">"); $("#foo").focus(); bindSubmit("#foo"); }; }); function bindSubmit(controlName) { $(controlName).bind('keydown', function (e) { if ((e.which == 13) && (e.shiftKey == false)) { e.preventDefault(); SaveData($("#foo").val()); return false; } }); $(controlName).bind('change', function (e) { if (cell != null) { cell.addClass("green"); } }); }; //////////////Работа с редактированием списка Division //Разблокировка поля для редактирования $(".droplist").dblclick(function () { if ($(this).attr("class").indexOf("noclick") < 0) { cell = $(this); key = $(this).attr("key"); cls = $(this).attr("class"); cell.addClass("noclick"); txt = $(this).text(); openForm() }; }); function openForm() { $.ajax({ type: "POST", url: "./dropdown_populate.ashx", data: "{}", dataType: 'JSON', success: function (data) { var s = '<option value="-1">Please Select a destination and provider</option>'; for (var i = 0; i < data.length; i++) { s += '<option value="' + data[i].id + '">' + data[i].title + '</option>'; } $("#destination").html(s); } }); document.getElementById("Division").style.display = "block"; } $("#destination_ok").click(function () { if ($("#destination").val() != -1) { SaveData($("#destination").val()); } }); //////////////Работа с редактированием списка Status //Разблокировка поля для редактирования $(".status").dblclick(function () { if ($(this).attr("class").indexOf("noclick") < 0) { cell = $(this); key = $(this).attr("key"); cls = $(this).attr("class"); cell.addClass("noclick"); txt = $(this).text(); openForm_status() }; }); function openForm_status() { document.getElementById("Status_dropdown").style.display = "block"; } $("#status_ok").click(function () { if ($("#Status").val() != -1) { SaveData($("#Status :selected").text()); } }); //////////////Работа с редактированием календаря //Разблокировка поля для редактирования $(".calendar").dblclick(function () { if ($(this).attr("class").indexOf("noclick") < 0) { cell = $(this); key = $(this).attr("key"); cls = $(this).attr("class"); cell.addClass("noclick"); txt = $(this).text(); openForm_calendar() }; }); function openForm_calendar() { document.getElementById("Calendar").style.display = "block"; } $("#calendar_ok").click(function () { SaveData($("#ata_date").val()); }); //////////////Обработка нажатия кнопки Add new record //Разблокировка формы для ввода данных для новой записи $("#ImageAdd").click(function () { event.preventDefault(); openForm_add() }); function openForm_add() { $.ajax({ type: "POST", url: "./dropdown_populate.ashx", data: "{}", dataType: 'JSON', success: function (data) { var s = '<option value="-1">Please Select a destination and provider</option>'; for (var i = 0; i < data.length; i++) { s += '<option value="' + data[i].id + '">' + data[i].title + '</option>'; } $("#destination_add").html(s); } }); document.getElementById("Add").style.display = "block"; } $("#add_ok").click(function () { if ($("#destination_add").val() != -1 && $("#container_add").val() != '' && $("#condition_add").val() != '' && $("#cargo_add").val() != '' && $("#date_add").val() != '' && $("#status_add").val() != -1 ) { AddData($("#destination_add").val(), $("#container_add").val(), $("#condition_add").val(), $("#cargo_add").val(), $("#date_add").val(), $("#status_add :selected").text()); } else alert('Все поля обязательны для заполнения'); }); function AddData(destination, container, condition, cargo, date, status) { var data = {}; data.mode = "add"; data.destination = destination; data.container = container; data.condition = condition; data.cargo = cargo; data.date = date; data.status = status; $.ajax({ url: ('./table_management_handler.ashx'), type: 'POST', data: data, cache: false, dataType: 'JSON', success: function (data, textStatus, jqXHR) { //$("#form1").submit(); //location.reload(true); location.assign(location.href); }, error: function (jqXHR, textStatus, errorThrown) { // Handle errors here console.log('ERRORS2: '); console.log(textStatus); console.log(errorThrown); console.log(jqXHR); // STOP LOADING SPINNER } }); }; $("#SendMail").click(function () { event.preventDefault(); var GR = prompt('Input GR(-) qty:') if (GR != '') { window.open("./mail_prepare.aspx?gr="+GR, "_blank") } }) ////Bulk data upload //$(".dataupload").click(function () { // hidePopups(); // var targetId = $(this).attr("id").replace("DataUpload", "pnlDataUpload"); // $("#" + targetId).removeClass("hidden"); // centerPopup($("#" + targetId)); // //$("#" + targetId).center(); // // -- POPUP MANAGEMENT // function hidePopups() { // $(".popup").each(function () { // $(this).addClass("hidden"); // }) // } // ///////////////////////// // function centerPopup(popup) { // if (typeof ($("#pnlAddNewItem")) != "undefined") { // popup.removeClass("hidden"); // popup.css("position", "absolute"); // popup.css("top", (($(window).height() - popup.outerHeight()) / 2) + $(window).scrollTop() + "px"); // popup.css("left", (($(window).width() - popup.outerWidth()) / 2) + $(window).scrollLeft() + "px"); // //$("#pnlAddNewItem").center(); // } // } </script> </html>