凯云水利水电造价工程系统( 四) 人工单价模块
3.5 功能5名称:人工单价
3.5-1 功能实现
人工单价的数据处理主要有:添加、删除、复制、粘贴、导出、导入
人工单价的添加,自动添加一行,代号也会跟着自增,而且不会重复。而其它的字段可以双击列名为名称和单位那两列时,会弹出一个小窗体,填写相应的字段进行添加。删除就是选择一行进行删除。
人工单价的复制、粘贴:对现有的数据进行复制、粘贴,为了进行区分,粘贴后的数据,代号会自动跟着”复制“二字,如果某条数据时再次复制、粘贴,那代号会重复出现”复制“二字。
人工单价的导出、导入:系统将自动给出一个路径,把材料的单价的所有数据导入到一张Excel表。导入:先手动填写一些数据,这些数据要根据数据库的参数来写,一一对应才能导入到人工单价表中。
人工单价明细的数据处理主要有添加、计算:
人工单价明细的添加同人工单价的添加相同。
人工单价的计算:双击列名为计算公式那一列,会弹出一个计算的窗体(图 3-2),里面可以对明细里的公式进行一一计算,然后计算的结果会相应的出现在人工单价明细的预算单价那一列,和人工单价的预算单价的那一列。
3.5-2 表和关系
人工单价所涉及到的表有:
資料表總表
SN | 資料表 | 描述 |
3 | CountDatagrid | 公式名称表、 |
6 | Name | 人工单价名称表 |
8 | PeopleCode | 人工单价代号自增表 |
9 | PeopleDetail |
|
10 | PeoplePriceName | 人工单价公式名表 |
40 | SYS_PeoplePriceDetailList | 人工单价明细表 |
41 | SYS_PeoplePriceList | 人工单价表 |
CountDatagrid
資料表名稱 | CountDatagrid | 資料表描述 |
| ||||
SN | 欄位 | 資料型態 | 長度 | null | PK | 描述 | |
1 | CountDatagridID | int identity | (10, 0) | NO | PK | 公式名称ID | |
2 | JiBen | nchar | 50 | YES |
| 基本工资 | |
3 | YeCan | nchar | 50 | YES |
| 夜餐津贴 | |
4 | GongHui | nchar | 50 | YES |
| 工会经商 | |
5 | YiLiao | nchar | 50 | YES |
| 医疗保险 | |
6 | DiQu | nchar | 50 | YES |
| 地区系数 | |
7 | JeiRi | nchar | 50 | YES |
| 节日加班津贴 | |
8 | YangLao | nchar | 50 | YES |
| 养老保险费 | |
9 | ShiGong | nchar | 50 | YES |
| 施工津贴 | |
10 | ZhiGong | nchar | 50 | YES |
| 职工福利津贴 | |
11 | YangLaoJi | nchar | 50 | YES |
| 养老基金 |
Name
資料表名稱 | Name | 資料表描述 |
| ||||
SN | 欄位 | 資料型態 | 長度 | null | PK | 描述 | |
1 | NameID | int identity | (10, 0) | NO | PK | 人工单价名称ID | |
2 | Name | nchar | 150 | YES |
| 人工单价名称 |
PeopleCode
資料表名稱 | PeopleCode | 資料表描述 |
| ||||
SN | 欄位 | 資料型態 | 長度 | null | PK | 描述 | |
1 | PeopleCode | int | (10, 0) | YES |
| 人工单价代号 |
PeoplePriceName
資料表名稱 | PeoplePriceName | 資料表描述 |
| ||||
SN | 欄位 | 資料型態 | 長度 | null | PK | 描述 | |
1 | PeoplePriceNameID | int identity | (10, 0) | NO | PK | 人工单价明细名称ID | |
2 | PeoplePriceName | nchar | 50 | YES |
| 人工单价明细名称 |
SYS_PeoplePriceDetailList
SYS_PeoplePriceDetailList | 資料表描述 |
|
| |||||
欄位 | 資料型態 | 長度 | null | PK | 描述 | |||
PeoplePriceDetailID | int identity | (10, 0) | NO | PK | 人工单价明细ID | |||
PeoplePriceID | int | (10, 0) | YES | 外键 | 人工单价ID | |||
Number | nchar | 150 | YES |
| 代号 | |||
Name | nchar | 150 | YES |
| 名称 | |||
Unit | nchar | 150 | YES |
| 单位 | |||
Price | nchar | 150 | YES |
| 预算价格 | |||
CountFurmula | nchar | 150 | YES |
| 计算公式 | |||
Remark | nchar | 150 | YES |
| 备注 |
SYS_PeoplePriceList
資料表名稱 | SYS_PeoplePriceList | 資料表描述 |
| ||||
SN | 欄位 | 資料型態 | 長度 | null | PK | 描述 | |
1 | PeoplePriceID | int identity | (10, 0) | NO | PK | 人工单价ID | |
2 | BuildProjectID | int | (10, 0) | YES | 外键 | 建立项目ID | |
3 | Number | nchar | 150 | YES |
| 代号 | |
4 | Name | nchar | 150 | YES |
| 名称 | |
8 | Unit | nchar | 150 | YES |
| 单位 | |
9 | BudgetPrice | char | 100 | YES |
| 预算价格 |
表之间的关系:
(图 1)
3.5-3模块功能的具体实现
3.5-3.1 控件的使用
3.5-3.1.1 分页功能
(1)分页功能截图
(图 2)
(2)实现分页功能的界面代码:
<script>
function pagerFilter(data) {//自定义方法
if (typeof data.length == 'number' && typeof data.splice == 'function') { // is array
data = {
total: data.length,
rows: data
}
}
var rengongdanjiamingxi = $(this);
var opts = rengongdanjiamingxi.datagrid('options');
var pager = rengongdanjiamingxi.datagrid('getPager');
pager.pagination({
onSelectPage: function (pageNum, pageSize) {
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh', {
pageNumber: pageNum,
pageSize: pageSize
});
rengongdanjiamingxi.datagrid('loadData', data);
}
});
if (!data.originalRows) {
data.originalRows = (data.rows);
}
var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
var end = start + parseInt(opts.pageSize);
data.rows = (data.originalRows.slice(start, end));
return data;
}
$(function () {
$('#rengongdanjiamingxi').datagrid({ loadFilter: pagerFilter });
// $('#rengongdanjiamingxi')就是放分页功能的datagrid的id
});
</script>
<script>
function formatPrices(val, row) {
if (val > 230) {
return '<span style="color:blue;">(' + val + ')</span>';
} else {
return val;
}
}
</script>
3.5-3.2 人工单价模块功能的分解
3.5-3.2.1 人工单价
3.5-3.2.1.1 添加
(1)当点击添加按钮时,人工单价会自动增加一行,代号也会随之生成:
(1.1)添加添加功能,所触发的界面层的代码:
var R="";//r拼接字符窜
function tianjia(){
//自定义方法
$.getJSON("/RenGongDanJia/PeopleCode/",
//从控制器传来的JSON 格式
function (data) {
Code= data[0].PeopleCode;
var t="A0"+ Code;
$.getJSON("/RenGongDanJia/inserRenGongDanJia?ChrNumber="+t+"&"
+"ID="+ @Session["项目ID"] ,
function(data){
rengongdanjia();
//调用绑定人工单价的方法
});
});
}
//加载人工单价
function rengongdanjia() {
//查询人工单价的方法
$.getJSON("/RenGongDanJia/SelectRenGongDanJia/?IntBuildProjectID="+@Session["项目ID"],
function (data) {
$('#rengongdanjia').datagrid('loadData', data);
$('#rengongdanjia').datagrid('endEdit', Ibd);//结束编辑
$('#rengongdanjia').datagrid('beginEdit', Ibd);//开始编辑
});
setTimeout( function(){
$('#rengongdanjia').datagrid('selectRow',Ibd)},100);//指定到索引为Ibd的那一行<pre name="code" class="javascript">
}
(2)双击列名为名称或单位的一列,进行添加名称和单位,如果那一列已经存在名称和单位,也可以是一个修改的操作:
双击列名,打开窗体所用到的方法代码:、
//点击名称、单位
function onDblClickCell(rowIndex, field, value) {
if (field == "Name" || field == "Unit" )//如果双击到列名为名称或单位,就会打开窗体
$('#wInsertData').window('open');
}
(图 4)
(3)名称下拉框里的数据,单位的下拉框会随之改变:
选中之后,添加添加按钮:触发界面层的方法:
//确认
function Insert(){
var s=$('#rengongdanjia').datagrid('getSelected');
//选中要添加人工单价的一行
var Name=$('#lingLiaoBuMen').combobox('getText');
//获取名字对应的 下拉框的值
var Unit=$('#lingLisoRen').combobox('getText');<pre name="code" class="javascript"> //获取单位对应的下拉框的值 s.Unit=Unit; s.Name=Name; //把获取的值分类赋值给:s.Unit/s.Name $.getJSON("/RenGongDanJia/UpdateRengongdanjia?ID="+s.PeoplePriceID+"&" + "ChrcopyName="+ Name+"&" +"ChrcopyUnit=" + Unit + "&" +"ChrcopyBudgetPrice="+"0.00"+"&" , function(data){ rengongdanjia(); //调用人工单价的查询方法 $('#wInsertData').window('close'); }); }<pre>
public ContentResult UpdateRengongdanjia(string ID, string ChrcopyName, string ChrcopyUnit, string ChrcopyBudgetPrice)
{
int i = rengongdanjia.UpdateRengongdanjia(Convert.ToInt32(ID), ChrcopyName, ChrcopyUnit, ChrcopyBudgetPrice);
string k = i.ToString();//把值转化为字符串
return Content(k);//把转化的值传给界面层
}
逻辑层的代码:
public int UpdateRengongdanjia(int ID, string ChrcopyName, string ChrcopyUnit, string ChrcopyBudgetPrice)
{
SqlParameter[] mySQL = {
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@PeoplePriceID",SqlDbType.Int),
new SqlParameter("@Name",SqlDbType.Char),
new SqlParameter("@Unit",SqlDbType.Char),
new SqlParameter("@BudgetPrice",SqlDbType.Char),
};
mySQL[0].Value = "UpdateRengongdanjia";//和存储过程名对应
mySQL[1].Value = ID;
mySQL[2].Value = ChrcopyName;
mySQL[3].Value = ChrcopyUnit;
mySQL[4].Value = ChrcopyBudgetPrice;
int i = nihao.DAL_OPTableDB_Par("RenGongDanJia", mySQL);
return i;//把返回传给控制器
}
数据层的SQL语句:
IF @type='UpdateRengongdanjia'
BEGIN
UPDATE SYS_PeoplePriceList SET Name=@Name, Unit=@Unit, BudgetPrice=@BudgetPrice
WHERE PeoplePriceID=@PeoplePriceID
END
添加成功后的截图:
3.5-3.2.1.2 删除
(1)对于多余的人工单价进行删除操作:
点击删除,触发界面层的代码:
//删除人工单价
//删去
function btnshanqu(){
var data =$('#rengongdanjia').datagrid('getSelected');//获取一行
var rengonID = data. PeoplePriceID;//获取一行的id
if (confirm('是否删除项目?')) {
$.getJSON("/RenGongDanJia/DeleteRenGongDanJia?ID="+rengonID,
function (data) {
if (data > 0) {
alert("删除成功!");
$('#rengongdanjia').datagrid('deleteRow', editIndex);
//表面删去一行
rengongdanjia();
//调用查询人工单价的方法(刷新)
}
else { alert("删除失败") }
});
}
}
控制器的代码:
public ContentResult DeleteRenGongDanJia(string ID)
{
int i = rengongdanjia.DeleteRenGongDanJia(Convert.ToInt32(ID));
string k = i.ToString();
return Content(k);
}
逻辑层的代码:
public int DeleteRenGongDanJia(int ID)
{
SqlParameter[] mySQL = {
new SqlParameter("@type",SqlDbType.Char),
new SqlParameter("@PeoplePriceID",SqlDbType.Int),
};
mySQL[0].Value = "DeleteRenGongDanJia";
mySQL[1].Value = ID;
int i = nihao.DAL_OPTableDB_Par("RenGongDanJia", mySQL);
return i;
}
数据库SQL语句:
if @type='DeleteRenGongDanJia'
BEGIN
DELETE SYS_PeoplePriceList
WHERE PeoplePriceID=@PeoplePriceID
END
3.5-3.2.1.3 复制
(1)对现有的人工单价进行复制功能:
点击复制,触发界面层的代码:
//这些变量是用来做这类里的变量的,给下面的粘贴用的
var copyName="";
var copyUnit="";
var copyBudgetPrice="";
var copyNumber="";//声明全局变量,用于粘贴
FuZhi=0;
function BtnFuzZhi(){
var de=$('#rengongdanjia').datagrid('getSelected');//获取里面的数据
if(de){
FuZhi=1;//如果执行了复制这个方法,就把1赋值给FuZhi
if(confirm('是否要复制此条数据?')){
copyName = de.Name.trim();
copyUnit = de.Unit.trim();
copyBudgetPrice = de.BudgetPrice.trim();
copyNumber = de.Number.trim();
alert("复制成功!");
}
else{
alert("已放弃复制此数据!")
}
}
else{
alert("亲,请选中你要复制的数据!");
}
}
3.5-3.2.1.4 粘贴
(1)点击复制,如果弹出“复制成功”,则点击粘贴:
点击粘贴,触发界面层的方法的代码:
点击粘贴,触发界面层的方法的代码:
//粘贴
function BtnZhanTie(){
var rengongID =$('#rengongdanjia').datagrid('getSelected');
var y= copyNumber;
var t = y.length;
var e = y.substring(t-2,t);
var tr=copyNumber+"_复制"; //在原来的数据上加上“复制”
var i =tr.length;
var d =tr.substring(i-3,i);
if(FuZhi==1){
if (rengongID){
if(confirm('是否需要粘贴?')){
if(e=="_复制"){
var Number=tr+"—_复制"
$.getJSON("/RenGongDanJia/ZhanTieRenGongDanJia?ChrNumber="+Number+"&"
+"ChrcopyName="+copyName+"&"
+"ChrcopyUnit="+copyUnit+"&"
+"ChrcopyBudgetPrice="+ "0"+"&"
+"ID="+ @Session["项目ID"],
function(data){
rengongdanjia();
alert("谢谢你的使用,水利工程造价系统,粘贴成功,数据已经在最后一行");
});
}
else{
$.getJSON("/RenGongDanJia/ZhanTieRenGongDanJia?ChrNumber="+tr+"&"
+"ChrcopyName="+copyName+"&"
+"ChrcopyUnit="+copyUnit+"&"
+"ChrcopyBudgetPrice="+ "0"+"&"
+"ID="+ @Session["项目ID"],
function(data){
rengongdanjia();
alert("谢谢你的使用,水利工程造价系统,粘贴成功,数据已经在最后一行");
});
}
}
else{
alert("已放弃粘贴!");
}
}
else{
alert("亲,请先复制");
}
}
else{
alert("亲,请先复制");
}
}
(2)粘贴功能其实就是新增功能,所有控制器、逻辑层、数据库就是跟新增的方法一样。
(3)粘贴成功后的截图:
(图 6)3.5-3.2.1.5 计算单价
(1)当你单价计算单价按钮,它会帮你计算出你所选中人工单价下的所有人工单价明细的总和:
界面层的代码:
//计算单价
function JiSuanDanJia(){
var rengongID = $('#rengongdanjia').datagrid('getSelected');
//先选中所要计算的人工单价
if(rengongID){
//如果那一行存在,就进行下面的代码
var D=0;
var rengongMingXiID = $('#rengongdanjiamingxi').datagrid('getData');
//获取人工单价明细的所有数据
for (var i = 0; i < rengongMingXiID.rows.length; i++)
//对人工单价明细的数据进行遍历循环
{
D += rengongMingXiID.rows[i].Price*1;
//每循环一次,就相加预算单价一次,然后把计算的值赋值给D
}
var Name=rengongID.Name.trim();
var Unit= rengongID.Unit.trim();
var PeoplePriceID=rengongID.PeoplePriceID;
$.getJSON("/RenGongDanJia/UpdateRengongdanjia?ID="+PeoplePriceID+"&"
+ "ChrcopyName="+ Name+"&"
+"ChrcopyUnit=" + Unit + "&"
+"ChrcopyBudgetPrice="+D+"&"
function(data){
rengongdanjia();
//调用查询人工单价的方法
setTimeout(function(){ $('#rengongdanjia').datagrid('selectRow',SelectRow);},500);
});
}
else{
alert("请选中要计算的人工单价!");
}
}
3.5-3.2.1.6 导入
(1)写好一张Excel表,点击导入,数据加载到人工单价的datagrid中:
(2)导入之前先选中你要导入的文件,界面层的代码:
<form action="/RenGongDanJia/GetTableFromExcel" method="post" enctype="multipart/form-data">
<text>选择上传文件</text>
<input name="file1" type="file" id="file" />
<input type="submit" name="Upload" value="导入" />
</form>
(3)逻辑层涉及到的代码:
#region 导入
public ActionResult GetTableFromExcel()
{
try
{
HttpPostedFileBase fostField = Request.Files["file1"];
Stream streamfile = fostField.InputStream;
HSSFWorkbook hssfworkbook = new HSSFWorkbook(streamfile);
using (NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0))
{
DataTable table = new DataTable();
IRow headerRow = sheet.GetRow(0);
int cellCount = headerRow.LastCellNum;
int rowCount = sheet.LastRowNum;
for (int i = headerRow.FirstCellNum; i < cellCount; i++)
{
DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
table.Columns.Add(column);
}
for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
{
IRow row = sheet.GetRow(i);
DataRow dataRow = table.NewRow();
if (row != null)
{
for (int j = row.FirstCellNum; j < cellCount; j++)
{
if (row.GetCell(j) != null)
dataRow[j] = GetCellValue(row.GetCell(j));
}
}
table.Rows.Add(dataRow);
}
for (int i = 0; i < table.Rows.Count; i++)
{
rengongdanjia.InsertDaoRu(table.Rows[i][0].ToString(), table.Rows[i][1].ToString(), table.Rows[i][2].ToString(), table.Rows[i][3].ToString(), Convert.ToInt32(table.Rows[i][4]));
//调用逻辑层的方法,把值传给逻辑层
}
}
return Content("");
}
catch {
return Content("请选择文件");
}
}
private static string GetCellValue(ICell cell)
{
if (cell == null)
return string.Empty;
switch (cell.CellType)
{
case CellType.BLANK:
return string.Empty;
case CellType.BOOLEAN:
return cell.BooleanCellValue.ToString();
case CellType.ERROR:
return cell.ErrorCellValue.ToString();
case CellType.NUMERIC:
case CellType.Unknown:
default:
return cell.ToString();
case CellType.FORMULA:
try
{
HSSFFormulaEvaluator e = new HSSFFormulaEvaluator(cell.Sheet.Workbook);
e.EvaluateFormulaCell(cell);
return cell.ToString();
}
catch
{
return cell.NumericCellValue.ToString();
}
}
}
#endregion
3.5-3.2.1.7 导出
(1)把现有的人工单价导出到一张表上:
(2)界面层所用到的方法的代码:
function daoru(){
window.location.href = "/RenGongDanJia/DownloadFile?BuildProjectID="+@Session["项目ID"];
}
(3)调用控制的方法的代码:
#region 导出
public FileResult DownloadFile(int BuildProjectID)
{
DataSet ds = new DataSet();
DataTable dt = rengongdanjia.SelectRenGongDanJia(BuildProjectID);
//调用逻辑层的查询人工单价的方法
string schoolname = "401";
NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook();
NPOI.SS.UserModel.ISheet sheet1 = book.CreateSheet("Sheet1");
NPOI.SS.UserModel.IRow row1 = sheet1.CreateRow(0);
for (int i = 0; i < dt.Columns.Count; i++)
{
row1.CreateCell(i).SetCellValue(dt.Columns[i].ColumnName);
}
for (int i = 0; i < dt.Rows.Count; i++)
{
NPOI.SS.UserModel.IRow rowtemp = sheet1.CreateRow(i + 1);
for (int j = 0; j < dt.Columns.Count; j++)
{
rowtemp.CreateCell(j).SetCellValue(dt.Rows[i][j].ToString().Trim());
}
}
System.IO.MemoryStream ms = new System.IO.MemoryStream();
book.Write(ms);
ms.Seek(0, SeekOrigin.Begin);
return File(ms, "application/vnd.ms-excel", "导出.xls");
}
#endregion
(图 9)
3.5-3.2.2 人工单价明细
3.5-3.2.2.1 添加
(1)人工单价明细的添加统人工单价的添加是相同的,都是点击添加按钮,会自动增加一行,代号也会随之增加:
点击添加所触发的界面层的代码:
/对人工单价明细的新增
var r="";
function InsertPeople(){
var rengongID =$('#rengongdanjia').datagrid('getSelected');
//先选中人工单价
$.getJSON("/RenGongDanJia/PeopleDetailCode/",
function (data) {
Code= data[0].PeopleDetail;
//获取从控制器传来的数字
var t="D0"+ Code;
//自动增加代号
$.getJSON("/RenGongDanJia/InsertPeoPleDetail?Number="+t+"&"
//把获取的代号赋值到所新增的那一行里
+"PeoplePriceID="+rengongID.PeoplePriceID,
function(data){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+ rengongID.PeoplePriceID,
function(data){
$('#rengongdanjiamingxi').datagrid('loadData', data);
//新增一行成功后,就对人工单价明细进行一次刷新
} );
} );
});
}
(2)双击名称,对名称和计算公式进行添加:
双击名称所触发的方法的代码:
// 点击人工单价明细
var ee=new Array(30);
var arrayObj = new Array(30);
var mingcheng=0;
function onDblClick(rowIndex, field, value) {
var PeoplePrice=$('#rengongdanjia').datagrid('getSelected');
//先选中人工单价的一行
var PeoplePriceDetailID=$('#rengongdanjiamingxi').datagrid('getData');
for(var j=0;j<PeoplePriceDetailID.rows.length;j++){
if(PeoplePriceDetailID.rows[j]["Name"]==null){
mingcheng=1
}
else{
}
}
if (field == "Name"||field=="Number" )
{
//如果单价列名为名称或代号那一列,就会弹出添加名称和计算公式的窗体
$('#wCount').window('open');
}
else{
if(mingcheng!=1){
mingcheng=0
if (field == "CountFurmula"){
//如果列名为计算公式
for(var i=0;i<PeoplePriceDetailID.rows.length;i++){
//进行遍历整张人工单价明细表
arrayObj[i]=$('#rengongdanjiamingxi').datagrid('getData').rows[i]["CountFurmula"].trim();
//把在明细表里获取的数据放到一个数组里
ee[i]=$('#rengongdanjiamingxi').datagrid('getData').rows[i]["Name"].trim();
$('#TextArea1').val($('#TextArea1').val()+ee[i]+"="+arrayObj[i]+", ");
//把放在数组里的值进行拼接,把放在计算预算单价的文本框里
var f =$('#TextArea1').val();
}
$('#w计算').window('open');
$('#TextArea1').val(f);
$('#PeopleCode').val(PeoplePrice.Number);
$('#PeopleName').val(PeoplePrice.Name);
}
}
else{
mingcheng=0;
alert("请把数据填写完整!");
}
}
}
单击那个单价明细,进行开始编辑和结束编辑的方法的代码:
var editIndex = undefined;
var SelectRow="";
function onClickRowMing(index) {
SelectRow=index;
//当单价人工单价明细的一行时,会自动获取它的索引
if (editIndex != index) {
$('#rengongdanjiamingxi').datagrid('beginEdit', index);
//开始编辑
$('#rengongdanjiamingxi').datagrid('endEdit', editIndex);
//结束编辑
editIndex = index;
}
}
点击名称下拉框里的值所触发的方法的代码:
/绑定下拉抗框 (人工单价明细-单位)
var name=0;
function comboboxUnit() {
var q=$('#stringName').combobox('getValue');
var Name=$('#stringName').combobox('getText');
var PeoPlePrice=$('#rengongdanjiamingxi').datagrid('getData');
for(var j=0;j<PeoPlePrice.rows.length;j++){
if(PeoPlePrice.rows[j]["Name"]==Name.trim()){
name=1;
}
else{
}
}
if(name!=1){
name=0;
$.getJSON("/RenGongDanJia/SlectedCountFormu?PeoplePriceNameID="+q,
function (data) {
$('#stringUnit').combobox({ data: data, valueField: 'CountFormulID',
textField: 'CountFormu'
});
});
}
else{
name=0;
alert("已添加过此名称,请重新选择!");
}
}
(3)把名称和计算公式选好之后,就点击添加,进行保存操作:
点击添加,所触发的界面层的方法的代码:
//添加不同的公式
var name=0;
function TianJia(){
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
var Name=$('#stringName').combobox('getText');
var s=$('#rengongdanjia').datagrid('getSelected');
var Count=$('#stringUnit').combobox('getText');
if(rengongdanjiamingxi.Remark!=null ){
//如果选中人工单价明细那一行的备注不是空的,就执行下面的代码
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+Count.trim()+"&"
+"Price="+"0"+"&"
+"Unit="+"元/工日"+"&"
//添加的单位先默认添加“元/工日”
+"Name="+Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
//添加完之后,对人工单价明细进行刷新
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#wCount').window('close');
});
}
});
}
else{
//如果备注是空的,就执行下面的代码
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+"暂时无备注"+"&"
+"CountFurmula="+Count.trim()+"&"
+"Price="+"0"+"&"
+"Unit="+"元/工日"+"&"
+"Name="+Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#wCount').window('close');
});
}
});
}
}
(4)添加好之后的截图:
(5)接下来要进行的操作就是技术人工单价明细的各个单价:
双击列名为单价一行,就会弹出计算单价的窗体:
(5.1)然后就能根据相应的公式进行计算,比如,夜餐津贴,就双击大考上面的夜餐津贴,然后进行计算:
计算出结果后,点击确认,就会把所计算的结果赋值给夜餐津贴的文本框里,也会加载到人工单价明细相应的位置。
(图 15)
(图 16)
点击列名出现各计算个窗体
点击列名出现各计算个窗体
// 点击列名出现各计算个窗体
function onDblClickCe(rowIndex, field, value){
if(field == "JiBen"){
//如果列名是“基本工资”,那就打开计算基本工资的计算窗体
$('#w基本工资').window('open');
}
else{
//否则如果列名是“夜餐津贴”,那就打开夜餐津贴的计算窗体
if(field=="YeCan"){
$('#w夜餐津贴').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{//否则如果列名是“工会经商”,那就打开夜餐津贴的计算窗体
if(field=="GongHui"){
var Basic1=$('#BasicWages').val();
$('#GongJiBen').val(Basic1);
$('#w工会经商').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{
if(field=="YiLiao"){
//否则如果列名是“医疗保险费”,那就打开夜餐津贴的计算窗体
var Basic2=$('#BasicWages').val();
$('#YiJiBen').val(Basic2);
$('#w医疗保险费').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{
if(field=="DiQu"){
//否则如果列名是“地区津贴”,那就打开夜餐津贴的计算窗体
var Basic3=$('#BasicWages').val();
$('#DiJiBen').val(Basic3);
$('#地区津贴').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{
if(field=="JeiRi"){
//否则如果列名是“节日加班津贴”,那就打开夜餐津贴的计算窗体
var Basic4=$('#BasicWages').val();
$('#JieJiBen').val(Basic4);
$('#w节日加班津贴').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{
if(field=="YangLao"){
//否则如果列名是“养老保险费”,那就打开夜餐津贴的计算窗体
var Basic5=$('#BasicWages').val();
$('#YangJiBen').val(Basic5);
$('#养老保险费').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{
if(field=="ShiGong"){
//否则如果列名是“施工津贴”,那就打开夜餐津贴的计算窗体
$('#施工津贴').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{
if(field=="ZhiGong"){
//否则如果列名是“职工福利基金”,那就打开夜餐津贴的计算窗体
var Basic6=$('#BasicWages').val();
$('#ZhiGongJiBen').val(Basic6);
$('#职工福利基金').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
else{
//否则如果列名是“养老基金”,那就打开夜餐津贴的计算窗体
if(field=="YangLaoJi"){
$('#养老基金').window('open');
setTimeout(function(){ $('#rengongdanjiamingxi').datagrid('selectRow',SelectRow+1);},500);
}
}
}
}
}
}
}
}
}
}
}
</pre><pre>
(5.2)点击各个计算窗体的计算的方法代码:
//每个计算窗体的计算方法都一样
//基本工资
function BasicSalary(){
//点击计算的方法
var Basic=$('#JiBenBiaoZhunGongZi').val().trim();
var Area=$('#DiQuGongZiXiShu').val();
var Month=$('#Yue').val();
var Day=$('#NianYin').val();
//获取计算窗体的各个文本框的值
var Count=Basic*1*Area*1*Month*1*Day*1
$('#JieGuo').val(Count);
//把相成的值赋值给结果的文本框里
}
function BasicSalaryOK(){
//点击计算窗体里的确认按钮,所执行的方法
var Count= $('#JieGuo').val();
//获取所计算出结果的值
$('#BasicWages').val(Count);
//把获取出的值赋值给计算窗体的基本工资的文本框里
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
//把获取出的值加载到人工单价明细相应的单价列里
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+Count+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
//加载成功之后,就刷新人工单价的datagrid
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#w基本工资').window('close');
//这个窗体就会关闭
});
}
});
$('#w基本工资').window('close');
}
//工会经商
function TradeUnion(){ //点击计算按钮
var Basic=$('#GongJiBen').val();
var FeiLv=$('#GongJinFei').val();
var Count=Basic*1*FeiLv
$('#JieGuo2').val(Count);
}
function TradeUnionOK(){
//点击确认按钮所触发的方法的代码:
var combination=$('#JieGuo2').val();
$('#TradeBusiness').val(combination);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+combination+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#w工会经商').window('close');
});
}
});
}
//医疗保险费
function HospitalizationPremiums(){
var Basic=$('#YiJiBen').val();
var Fei=$('#YiJinFei').val();
var Cpunt=Basic*1*Fei*1
$('#JieGuo3').val(Cpunt);
}
function HospitalizationPremiumsOK(){
//点击确认按钮所触发的方法的代码:
var d=$('#JieGuo3').val();
$('#Medical').val(d);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+d+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
+function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#w医疗保险费').window('close');
});
}
});
}
//节假日加班
function Holiday(){
var Basic=$('#JieJiBen').val();
var Rate=$('#JieQu').val();
var Count=Basic*3*10/Rate*0.35
$('#JieGuo5').val(Count);
}
function HolidayOK(){
//点击确认按钮所触发的方法的代码:
var Count=$('#JieGuo5').val();
$('#Festival').val(Count);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+Count+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#w节日加班津贴').window('close');
});
}
});
}
//职工福利基金
function Labour(){
var Worders =$('#ZhiGongJiBen').val();
var ZhiGongFeiLv=$('#ZhiGongFeiLv').val();
var Count=Worders*1*ZhiGongFeiLv
$('#JieGuo8').val(Count);
}
function LabourOK(){
//点击确认按钮所触发的方法的代码:
var Cpomy= $('#JieGuo8').val();
$('#Labour').val(Cpomy);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+Cpomy+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#职工福利基金').window('close');
});
}
});
}
//养老保险费
function EndowmentAssurance(){
var Basic= $('#YangJiBen').val();
var YangLaoFeiLv=$('#YangLaoFeiLv').val();
var Count=Basic*YangLaoFeiLv
$('#JieGuo6').val(Count);
}
function EndowmentAssuranceOK(){
//点击确认按钮所触发的方法的代码:
var Count=$('#JieGuo6').val();
$('#ProvideForTheAged').val(Count);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+Count+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#养老保险费').window('close');
});
}
});
}
//施工津贴
function ConstructionSubsidy(){
var Construction=$('#ShiGongJinTie').val();
var Days=$('#ShiGongTianShu').val();
var Count=Construction*1*365*0.95/Days*1.068
$('#JieGuo7').val(Count);
}
function ConstructionSubsidyOK(){
//点击确认按钮所触发的方法的代码:
var result=$('#JieGuo7').val();
$('#Build').val(result);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+result+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#施工津贴').window('close');
});
}
});
}
//养老基金
function PensionFund(){
var PensionFund=$('#YangLaoJinTie').val();
var Month=$('#YueShu').val();
var Result=PensionFund*1*Month
$('#JieGuo9').val(Result);
}
function PensionFundOK(){
//点击确认按钮所触发的方法的代码:
var Count=$('#JieGuo9').val();
$('#PensionFund').val(Count);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+Count+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#养老基金').window('close');
});
}
});
}
//夜餐津贴标准
function MidnightMeal(){
var A=$('#ZhongBan').val();
var B=$('#YeBan').val();
var nightShift=$('#nightShift').val();
var Days=$('#nightShift').val();
var Result=(A*1+B*1)/2*nightShift*Days
$('#JieGuo1').val(Result);
}
function MidnightMealOK(){
//点击确认按钮所触发的方法的代码:
var Count=$('#JieGuo1').val();
$('#Midnight').val(Count);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+Count+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#w夜餐津贴').window('close');
});
}
});
}
//地区津贴
function Area(){
var Basic=$('#DiJiBen').val();
var Days=$('#day').val();
var Count=Basic/2*Days
$('#JieGuo4').val(Count);
}
function AreaOK(){
//点击确认按钮所触发的方法的代码:
var Result=$('#JieGuo4').val();
$('#Area').val(Result);
var s=$('#rengongdanjia').datagrid('getSelected');
var rengongdanjiamingxi=$('#rengongdanjiamingxi').datagrid('getSelected');
$.getJSON("/RenGongDanJia/UpdatePeoplePriceDetai?Remark="+rengongdanjiamingxi.Remark.trim()+"&"
+"CountFurmula="+rengongdanjiamingxi.CountFurmula.trim()+"&"
+"Price="+Result+"&"
+"Unit="+rengongdanjiamingxi.Unit.trim()+"&"
+"Name="+rengongdanjiamingxi.Name.trim()+"&"
+"Number="+rengongdanjiamingxi.Number.trim()+"&"
+"PeoplePriceDetailID="+rengongdanjiamingxi.PeoplePriceDetailID,
function(data){
if(data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+s.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
$('#地区津贴').window('close');
});
}
});
}
(图 17)
把要计算的都计算完后,就点击计算,计算出所有明细单价的总和,然后再点击确定,把人工单价的总和加载到人工单价的预算单价中去:
(图 18)
点击计算窗体上的确定按钮,所触发的方法的代码:
//把人工单价总和加载到相应的列中
function CountPeoplePriceOK(){
var TotalPrice=$('#PeopleCount').val();
//先把人工单价总和获取出来
var rengongID = $('#rengongdanjia').datagrid('getSelected');
rengongID.BudgetPrice=$('#PeopleCount').val();
var Name=rengongID.Name.trim();
var Unit= rengongID.Unit.trim();
var PeoplePriceID=rengongID.PeoplePriceID;
if(rengongID){
$.getJSON("/RenGongDanJia/UpdateRengongdanjia?ID="+PeoplePriceID+"&"
+ "ChrcopyName="+ Name+"&"
+"ChrcopyUnit=" + Unit + "&"
+"ChrcopyBudgetPrice="+rengongID.BudgetPrice+"&"
,
function(data){
rengongdanjia(); //调用人工单价的查询方法
$('#TextArea1').val("");//清空文本框的值
$('#BasicWages').val("");
$('#Midnight').val("");
$('#TradeBusiness').val("");
$('#Medical').val("");
$('#Area').val("");
$('#Festival').val("");
$('#ProvideForTheAged').val("");
$('#Build').val("");
$('#Labour').val("");
$('#PensionFund').val("");
$('#PeopleCount').val("");
});
}else{
alert("请选中人工单价!")
}
$('#w计算').window('close');//计算窗体关闭
$('#YingFuJingE').val(TotalPrice);
setTimeout(function(){ $('#rengongdanjia').datagrid('selectRow',Ibd);},500);
}
3.5-3.2.2.2 计算
(1)当点击计算按钮时,会计算你选中人工单价下的所有明细的总和:
(图 19)
//计算
function Countss(rowIndex, rowData, changes){
var rengongID = $('#rengongdanjia').datagrid('getSelected');//选中要计算的人工单价那一行
if(rengongID){//如果那一行存在,就执行下面的方法
var D=0;
var rengongMingXiID = $('#rengongdanjiamingxi').datagrid('getData');
//获取人工单价明细的所有数据
for (vari = 0; i < rengongMingXiID.rows.length; i++)//循环数据
{
D +=rengongMingXiID.rows[i].Price*1;
}
$('#YingFuJingE').val(D);
alert("你计算出的结果是:代号为:"+rengongID.Number+":"+D+"元")
}
else{
alert("请选中要计算的人工单价!");
}
}
(
3.5-3.2.2.3 删除
(1)对于多余的人工单价进行删除操作:
点击删除,触发界面层的代码:
//删除人工单价
function DeletePeopleDetail(){
var PeoplePriceDetailID=$('#rengongdanjiamingxi').datagrid('getSelected');
rengongID =$('#rengongdanjia').datagrid('getSelected');
alert(PeoplePriceDetailID.PeoplePriceDetailID);
if(confirm('是否删除此条人工单价明细')){
$.getJSON("/RenGongDanJia/DeletePeopleDetail?PeoplePriceDetailID="+PeoplePriceDetailID.PeoplePriceDetailID,
function(data){
if (data>0){
$.getJSON("/RenGongDanJia/SelectRenGongDanJiamingcxi/?IntPeoplePriceID="+ rengongID.PeoplePriceID,
function (data) {
$('#rengongdanjiamingxi').datagrid('loadData', data);
Count();
//调用计算人工明细单价总和的方法
//当删除一条人工单价明细后,人工单价的预算单价会自动更新
});
alert("删除成功!");
}
});
}
}
function Count(rowIndex, rowData, changes){
//调用计算人工明细单价总和的方法
var rengongID = $('#rengongdanjia').datagrid('getSelected');
var D=0;
var rengongMingXiID = $('#rengongdanjiamingxi').datagrid('getData');
for (var i = 0; i < rengongMingXiID.rows.length; i++)
{
D += rengongMingXiID.rows[i].Price*1;
}
$('#YingFuJingE').val(D);
$.getJSON("/RenGongDanJia/UpdateRengongdanjia?ID="+rengongID.PeoplePriceID+"&"
+ "ChrcopyName="+ rengongID.Name.trim()+"&"
+"ChrcopyUnit=" +rengongID.Unit.trim()+ "&"
+"ChrcopyBudgetPrice="+D+"&"
,
function(data){
rengongdanjia();
//调用对人工单价的查询方法
setTimeout(function(){ $('#rengongdanjia').datagrid('selectRow',Ibd);},500);
});
}
仅供学习参考,禁止用于商业用途,否则后果自负!