(m³)
@* 体积弹出框 *@
//弹出体积计算的对话框
function alertVolumn() {
$('#dlgVolume').dialog({
title: '体积计算',
iconCls: 'icon-add',
height: 180,
width: 280,
modal: true,
left: $(document).scrollLeft() + ($(window).width() - 600) * 0.5,
top: $(document).scrollTop() + ($(window).height() - 500) * 0.5,
onOpen: function () {
$('#txtRows').numberbox('setValue','');
$('#lblVolumeTotal').text('0.00');
$('#divRows').empty();
},
onClose: function () {
},
toolbar: [{
text: '保存',
id: "Savebtn",
iconCls: 'icon-save',
handler: function () {
var isValid = $('#from1').form('validate');
if (isValid) {
$('#RealVolumnTotal').numberbox('setValue', $('#lblVolumeTotal').text().trim());
$("#dlgVolume").dialog('close');
}
}
}],
});
}
//体积计算
function setTotalVolume(rows) {
var c = "c", k = "k", g = "g", v = "v";
var total = 0.00, itemTotal = 0.00;
for (var i = 0; i < rows; i++) {
c = "c" + i, k = "k" + i, g = "g" + i, v = "v" + i
var cn = $('#' + c).val();
var kn = $('#' + k).val();
var gn = $('#' + g).val();
if (cn != '' && cn + "" != "undefined" && kn != '' && kn + "" != "undefined" && gn != '' && gn + "" != "undefined") {
itemTotal = cn * kn * gn;
$('#' + v).text(itemTotal);
total += itemTotal;
}
}
if (total != 0) {
$('#lblVolumeTotal').text(total);
}
}
$(function () {
//默认对话框关闭
$('#dlgVolume').dialog('close');
//件数
$('#txtRows').numberbox({
width: 100,
height: 26,
required: false,
precision: 0,
min: 0,
validType: ["maxlength[9]"],
onChange: function (newValue, oldValue) {
var rows = oldValue;
if (newValue != null && newValue != '') {
$('#txtRows').numberbox('setValue', newValue);
rows = newValue;
} else {
$('#txtRows').numberbox('setValue', oldValue);
}
//重新生成行
$('#divRows').empty();
//总体积置空
$('#lblVolumeTotal').text('0.00');
for (var i = 0; i < rows; i++) {
var c = "c" + i, k = "k" + i, g = "g" + i, v = "v" + i, d = "div" + i;
var html = '
});