Basf_FCL/FCL/FineUIPro.Web/CCP/CcpEdit.aspx

319 lines
22 KiB
Plaintext
Raw Normal View History

2024-05-08 10:17:02 +08:00
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CcpEdit.aspx.cs" Inherits="FineUIPro.Web.CCP.CcpEdit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel2" />
<f:Panel ID="Panel2" CssClass="blockpanel" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelTopRegion" RegionPosition="Center"
Title="中间面板" ShowBorder="false" ShowHeader="false" Layout="VBox">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true" runat="server"
BoxFlex="1" DataKeyNames="ID,CPT_No,Contract_No,Tax" AllowCellEditing="true" DataIDField="CPT_NO"
SortField="Contract_No" SortDirection="ASC" OnSort="Grid1_Sort" IsDatabasePaging="true" EnableCheckBoxSelect="true" KeepCurrentSelection="true" OnRowClick="Grid1_RowClick" EnableRowSelectEvent="true" EnableRowClickEvent="true">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:DropDownList runat="server" ID="ddlContractNo" Label="Contract No" EnableEdit="true" LabelWidth="100px" Width="210px"
AutoPostBack="true" OnSelectedIndexChanged="ddlContractNo_SelectedIndexChanged">
</f:DropDownList>
<f:TextBox ID="txtCPT_No" runat="server" Label="CPT No." LabelAlign="Right" EmptyText="Search by CPT No." NextFocusControl="btnSearch" LabelWidth="90px" Width="230px"></f:TextBox>
<f:Button ID="btnSearch" Text="Search" Icon="SystemSearch" runat="server" Size="Medium" CssClass="marginr" OnClick="btnSearch_Click" />
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:TextBox ID="txtCcpNo" runat="server" Required="true" Label="CCP No." LabelAlign="Right" LabelWidth="90px" Width="160px"></f:TextBox>
<f:DropDownList ID="ddlPaymentTerm" runat="server" Label="结算方式" LabelWidth="100px" LabelAlign="Right" Required="true" ShowRedStar="true" Width="180px">
<f:ListItem Text="-Please select-" Value="" Selected="true" />
<f:ListItem Text="按月" Value="0" />
<f:ListItem Text="按季" Value="1" />
</f:DropDownList>
<f:DropDownList ID="ddlDeductionDeductionRate" runat="server" Label="高核减扣款" LabelWidth="100px" LabelAlign="Right" Width="180px" >
<f:ListItem Text="适用" Value="1" />
<f:ListItem Text="不适用" Value="2" />
</f:DropDownList>
<f:DropDownList ID="ddlDelayedDeduction" runat="server" Label="延迟递交结算扣款" LabelWidth="140px" LabelAlign="Right" Width="220px" MarginRight="10px">
<f:ListItem Text="适用" Value="1" />
<f:ListItem Text="不适用" Value="2" />
</f:DropDownList>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="Save" ToolTip="Save" ValidateForms="SimpleForm1"
OnClick="btnSave_Click" MarginRight="10px">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:TemplateField Width="40px">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="180px" ColumnID="ID" DataField="ID" SortField="ID"
FieldType="String" HeaderTextAlign="Center" Hidden="true">
</f:RenderField>
<f:RenderField Width="180px" ColumnID="CPT_No" DataField="CPT_No" SortField="CPT_No"
FieldType="String" HeaderText="CPT No" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="Contract_No" DataField="Contract_No" SortField="Contract_No"
FieldType="String" HeaderText="Contract No" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="500px" ColumnID="Contractor" DataField="Contractor" SortField="Contractor"
FieldType="String" HeaderText="Contractor" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="140px" ColumnID="FC_Desctription" DataField="FC_Desctription" SortField="FC_Desctription"
FieldType="String" HeaderText="FC Description" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="Report_Date" DataField="Report_Date" SortField="Report_Date"
FieldType="String" HeaderText="Created Time" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="PriceScheme" DataField="PriceScheme" SortField="PriceScheme"
FieldType="String" HeaderText="FC Price scheme" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="FC_Start_Date" DataField="FC_Start_Date" SortField="FC_Start_Date"
FieldType="Date" Renderer="Date" HeaderText="FC Start Date" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="FC_End_Date" DataField="FC_End_Date" SortField="FC_End_Date"
FieldType="Date" Renderer="Date" HeaderText="FC End Date" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="UserName" DataField="UserName" SortField="UserName"
FieldType="String" HeaderText="Contract Admin" HeaderTextAlign="Center">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelBottomRegion" RegionPosition="Bottom" RegionSplit="true" RegionSplitWidth="20px" EnableCollapse="true" Height="400px"
Title="底部面板" ShowBorder="false" ShowHeader="false" Layout="Fit">
<Items>
<f:Grid ID="Grid2" CssClass="blockpanel" ShowBorder="true" ShowHeader="true" EnableCollapse="false" runat="server"
DataKeyNames="Id,CPT_No" AllowSorting="true" SortField="SES" ClicksToEdit="1" SortDirection="ASC"
AllowCellEditing="true" IsFluid="true" AutoSelectEditor="true"
EnableSummary="true" SummaryPosition="Bottom">
<Columns>
<f:TemplateField Width="40px">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="120px" ColumnID="Contract_No" DataField="Contract_No" SortField="Contract_No"
FieldType="String" HeaderText="合同号" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="180px" ColumnID="CPT_No" DataField="CPT_No" SortField="CPT_No"
FieldType="String" HeaderText="CPT No" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="Ses" DataField="Ses" SortField="Ses"
FieldType="String" HeaderText="Ses No" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="300px" ColumnID="Short_Description" DataField="Short_Description" SortField="Short_Description"
FieldType="String" HeaderText="项目名称" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Quotation" DataField="Quotation" SortField="Quotation"
2024-09-18 10:36:26 +08:00
FieldType="Double" HeaderText="承包商报价" HeaderTextAlign="Center" >
2024-05-08 10:17:02 +08:00
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Tax_Value" DataField="Tax_Value" SortField="Tax_Value"
2024-09-18 10:36:26 +08:00
FieldType="Double" HeaderText="CTE/D审价" HeaderTextAlign="Center">
2024-05-08 10:17:02 +08:00
</f:RenderField>
<f:RenderField Width="100px" ColumnID="ThirdParty_PriceReview" DataField="ThirdParty_PriceReview" SortField="ThirdParty_PriceReview" FieldType="Float"
HeaderText="第三方审价" TextAlign="Right">
<Editor>
<f:NumberBox NoDecimal="false" DecimalPrecision="2" NoNegative="true" runat="server">
</f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField Width="120px" ColumnID="Reduction" FieldType="Float" HeaderText="核减额" HeaderTextAlign="Center" TextAlign="Right"></f:RenderField>
<f:RenderField Width="120px" ColumnID="Reduction_Rate" FieldType="Float" HeaderText="核减率" HeaderTextAlign="Center" TextAlign="Right"></f:RenderField>
<f:RenderField Width="120px" ColumnID="DeductionDeduction_Rate" FieldType="Float" HeaderText="高核减率扣款" HeaderTextAlign="Center" TextAlign="Right"></f:RenderField>
<f:RenderField Width="100px" ColumnID="Con_Days" DataField="Con_Days" SortField="Con_Days"
FieldType="Int" HeaderText="SSR结算提交天数" HeaderTextAlign="Center" TextAlign="Right">
<Editor>
<f:NumberBox NoDecimal="true" NoNegative="true" runat="server">
</f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField Width="100px" ColumnID="DelayedDeduction" FieldType="Float" HeaderText="延迟扣款" HeaderTextAlign="Center" TextAlign="Right"></f:RenderField>
<f:RenderField Width="100px" ColumnID="Final_SettlementAmount" FieldType="Float" HeaderText="最终结算金额(含税)" HeaderTextAlign="Right" TextAlign="Center"></f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="afteredit" Handler="onGridAfterEdit" />
<f:Listener Event="dataload" Handler="LoadPage" />
</Listeners>
</f:Grid>
<f:HiddenField ID="hidCcpId" runat="server" Text=""></f:HiddenField>
<f:HiddenField ID="hidContractNo" runat="server" Text=""></f:HiddenField>
</Items>
</f:Panel>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="Pop-up window" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true"
Width="1200px" Height="680px">
</f:Window>
</form>
<script type="text/javascript">
var grid2ClientID = '<%= Grid2.ClientID %>';
var ddldeductionRate = '<%= ddlDeductionDeductionRate.ClientID %>';
var ddldelayedTion = '<%= ddlDelayedDeduction.ClientID %>';
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
// 页面渲染完毕
F.ready(function () {
LoadPage();
F(ddldeductionRate).on('change', function () {
LoadPage();
});
F(ddldelayedTion).on('change', function () {
LoadPage();
});
});
function onGridAfterEdit(event, value, params) {
var me = this, columnId = params.columnId, rowId = params.rowId;
var rowValue = params.rowValue;
if (columnId === 'ThirdParty_PriceReview' || columnId === 'Con_Days') {
var reduction = 0.00;
var reductionRate = 0.00;
var deductionDeductionRate = 0.00;
var delayedDeduction = 0.00;
var finalSettlementAmount = 0.00;
var thirdPartyPriceReview = rowValue["ThirdParty_PriceReview"];
var tax = rowValue["Tax_Value"];
var quotation = rowValue["Quotation"];
var conDays = rowValue["Con_Days"];
if (thirdPartyPriceReview > 0) {
//核减额=-(CTE/D审价-第三方审价)
reduction = (tax - thirdPartyPriceReview);
me.updateCellValue(rowId, 'Reduction', parseFloat(-reduction).toFixed(2));
//核减率=(承包商报价-第三方审价)/承包商报价
reductionRate = ((quotation - thirdPartyPriceReview) / quotation) * 100;
me.updateCellValue(rowId, 'Reduction_Rate', parseFloat(reductionRate).toFixed(2));
//高核减率扣款(如果核减率超10%则扣除终审金额的2%)=-(第三方审价*2%)
deductionDeductionRate = reductionRate > 10 ? thirdPartyPriceReview * 0.02 : 0.00;
me.updateCellValue(rowId, 'DeductionDeduction_Rate', parseFloat(-deductionDeductionRate).toFixed(2));
//延迟扣款(如果提交天数Con超出15天则按终审金额10%扣款)=-(第三方审价*10%)
delayedDeduction = conDays > 15 ? thirdPartyPriceReview * 0.1 : 0.00;
me.updateCellValue(rowId, 'DelayedDeduction', parseFloat(-delayedDeduction).toFixed(2));
} else {
//核减额为空
me.updateCellValue(rowId, 'Reduction', 0.00);
//核减率=(承包商报价-CTE/D审价/承包商报价
reductionRate = ((quotation - tax) / quotation) * 100;
me.updateCellValue(rowId, 'Reduction_Rate', parseFloat(reductionRate).toFixed(2));
//高核减率扣款= -(CTE/D审价*2%)
deductionDeductionRate = reductionRate > 10 ? tax * 0.02 : 0;
me.updateCellValue(rowId, 'DeductionDeduction_Rate', parseFloat(-deductionDeductionRate).toFixed(2));
//延迟扣款(如果提交天数Con超出15天则按终审金额10%扣款)= -(CTE/D审价*10%)
delayedDeduction = conDays > 15 ? tax * 0.1 : 0;
me.updateCellValue(rowId, 'DelayedDeduction', parseFloat(-delayedDeduction).toFixed(2));
}
//最终结算金额(含税)= CTE/D审价+(-核减额)+(-高核减率扣款)+(-延迟扣款)
finalSettlementAmount = tax - reduction - deductionDeductionRate - delayedDeduction;
me.updateCellValue(rowId, 'Final_SettlementAmount', parseFloat(finalSettlementAmount).toFixed(2));
//合计列方法
updateSummary();
}
}
//合计赋值
function updateSummary() {
var me = F(grid2ClientID), reduction = 0.00, deductionDeductionRate = 0.00, delayedDeduction = 0.00, finalSettlementAmount = 0.00;
me.getRowEls().each(function (index, tr) {
reduction += me.getCellValue(tr, 'Reduction');
deductionDeductionRate += me.getCellValue(tr, 'DeductionDeduction_Rate');
delayedDeduction += me.getCellValue(tr, 'DelayedDeduction');
finalSettlementAmount += me.getCellValue(tr, 'Final_SettlementAmount');
});
// 第三个参数 true强制更新不显示左上角的更改标识
me.updateSummaryCellValue('Reduction', renderSalaryFloat(parseFloat(reduction)), true);
me.updateSummaryCellValue('DeductionDeduction_Rate', renderSalaryFloat(parseFloat(deductionDeductionRate)), true);
me.updateSummaryCellValue('DelayedDeduction', renderSalaryFloat(parseFloat(delayedDeduction)), true);
me.updateSummaryCellValue('Final_SettlementAmount', renderSalaryFloat(parseFloat(finalSettlementAmount)), true);
}
function LoadPage() {
var grid = F(grid2ClientID);
grid.getRowEls().each(function (index, tr) {
var me = F(grid2ClientID), rowId = index;
var reduction = 0.00;
var reductionRate = 0.00;
var deductionDeductionRate = 0.00;
var delayedDeduction = 0.00;
var finalSettlementAmount = 0.00;
var thirdPartyPriceReview = me.getCellValue(tr, 'ThirdParty_PriceReview');
var tax = me.getCellValue(tr, 'Tax_Value');
var quotation = me.getCellValue(tr, 'Quotation');
var conDays = me.getCellValue(tr, 'Con_Days');
if (thirdPartyPriceReview > 0) {
//核减额=-(CTE/D审价-第三方审价)
reduction = (tax - thirdPartyPriceReview);
me.updateCellValue(rowId, 'Reduction', parseFloat(-reduction).toFixed(2));
//核减率=(承包商报价-第三方审价)/承包商报价
reductionRate = ((quotation - thirdPartyPriceReview) / quotation) * 100;
me.updateCellValue(rowId, 'Reduction_Rate', parseFloat(reductionRate).toFixed(2));
//高核减率扣款(如果核减率超10%则扣除终审金额的2%)=-(第三方审价*2%)
if (F(ddldeductionRate).value == 1) {
deductionDeductionRate = reductionRate > 10 ? thirdPartyPriceReview * 0.02 : 0.00;
me.updateCellValue(rowId, 'DeductionDeduction_Rate', parseFloat(-deductionDeductionRate).toFixed(2));
} else {
me.updateCellValue(rowId, 'DeductionDeduction_Rate', 0.00);
}
//延迟扣款(如果提交天数Con超出15天则按终审金额10%扣款)=-(第三方审价*10%)
if (F(ddldelayedTion).value == 1) {
delayedDeduction = conDays > 15 ? thirdPartyPriceReview * 0.1 : 0.00;
me.updateCellValue(rowId, 'DelayedDeduction', parseFloat(-delayedDeduction).toFixed(2));
} else {
me.updateCellValue(rowId, 'DelayedDeduction', 0.00);
}
} else {
//核减额为空
me.updateCellValue(rowId, 'Reduction', 0.00);
//核减率=(承包商报价-CTE/D审价/承包商报价
reductionRate = ((quotation - tax) / quotation) * 100;
me.updateCellValue(rowId, 'Reduction_Rate', parseFloat(reductionRate).toFixed(2));
//高核减率扣款= -(CTE/D审价*2%)
if (F(ddldeductionRate).value == 1) {
deductionDeductionRate = reductionRate > 10 ? tax * 0.02 : 0;
me.updateCellValue(rowId, 'DeductionDeduction_Rate', parseFloat(-deductionDeductionRate).toFixed(2));
} else {
me.updateCellValue(rowId, 'DeductionDeduction_Rate', 0.00);
}
//延迟扣款(如果提交天数Con超出15天则按终审金额10%扣款)= -(CTE/D审价*10%)
if (F(ddldelayedTion).value == 1) {
delayedDeduction = conDays > 15 ? tax * 0.1 : 0;
me.updateCellValue(rowId, 'DelayedDeduction', parseFloat(-delayedDeduction).toFixed(2));
} else {
me.updateCellValue(rowId, 'DelayedDeduction', 0.00);
}
}
//最终结算金额(含税)= CTE/D审价+(-核减额)+(-高核减率扣款)+(-延迟扣款)
finalSettlementAmount = tax - reduction - deductionDeductionRate - delayedDeduction;
me.updateCellValue(rowId, 'Final_SettlementAmount', parseFloat(finalSettlementAmount).toFixed(2));
//合计列方法
updateSummary();
});
}
function renderSalaryFloat(value) {
return F.addCommas(value.toFixed(2));
}
</script>
</body>
</html>