|
@ -239,8 +239,7 @@ |
|
|
tableSetup($supplierInfo, tableId); |
|
|
tableSetup($supplierInfo, tableId); |
|
|
}); |
|
|
}); |
|
|
// 给实际采购数的输入框绑定事件处理器 |
|
|
// 给实际采购数的输入框绑定事件处理器 |
|
|
$('.actualPurchaseNum').off('keyup').on('keyup', function(event) { |
|
|
$('.actualPurchaseNum').off('blur').on('blur', function(event) { |
|
|
if (event.keyCode === 13) { |
|
|
|
|
|
var $supplierInfo = $(this).closest('.supplier-card'); |
|
|
var $supplierInfo = $(this).closest('.supplier-card'); |
|
|
var $supplierCard = $(this).closest('.supplier_card'); |
|
|
var $supplierCard = $(this).closest('.supplier_card'); |
|
|
var crad = $supplierInfo.attr('id'); |
|
|
var crad = $supplierInfo.attr('id'); |
|
@ -260,16 +259,15 @@ |
|
|
$supplierCard.find('.actualPurchaseNum').each(function () { |
|
|
$supplierCard.find('.actualPurchaseNum').each(function () { |
|
|
actualPurchaseNum += parseInt($(this).val()) || 0; |
|
|
actualPurchaseNum += parseInt($(this).val()) || 0; |
|
|
}); |
|
|
}); |
|
|
if (actualPurchaseNum > maxPurchaseNum) { |
|
|
// if (actualPurchaseNum > maxPurchaseNum) { |
|
|
actualPurchaseNum - maxPurchaseNum; |
|
|
// actualPurchaseNum - maxPurchaseNum; |
|
|
} |
|
|
// } |
|
|
// 更新供应商采购总价 |
|
|
// 更新供应商采购总价 |
|
|
$supplierInfo.find('.supplierPurchaseTotal').val(parseFloat(Number(purchaseNum * noRmbPrice).toFixed(2))); |
|
|
$supplierInfo.find('.supplierPurchaseTotal').val(parseFloat(Number(purchaseNum * noRmbPrice).toFixed(2))); |
|
|
if (rmbPrice) { |
|
|
if (rmbPrice) { |
|
|
$supplierInfo.find('.supplierPurchaseTotalRmb').val(parseFloat(Number(purchaseNum * rmbPrice).toFixed(2))); |
|
|
$supplierInfo.find('.supplierPurchaseTotalRmb').val(parseFloat(Number(purchaseNum * rmbPrice).toFixed(2))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果采购数量大于0,则显示供应商采购总价 |
|
|
// 如果采购数量大于0,则显示供应商采购总价 |
|
|
if (purchaseNum > 0) { |
|
|
if (purchaseNum > 0) { |
|
|
$supplierInfo.find('.supplierPurchaseTotal').removeClass('hidden'); |
|
|
$supplierInfo.find('.supplierPurchaseTotal').removeClass('hidden'); |
|
@ -281,7 +279,6 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
recalculateTotals(tableId); // 重新计算当前物料的合计 |
|
|
recalculateTotals(tableId); // 重新计算当前物料的合计 |
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
// 定义一个函数来重新计算当前物料的合计 |
|
|
// 定义一个函数来重新计算当前物料的合计 |
|
|
// 初始化总计 |
|
|
// 初始化总计 |
|
@ -306,11 +303,11 @@ |
|
|
totalActualPurchase = totalActualPurchase + purchaseNum; |
|
|
totalActualPurchase = totalActualPurchase + purchaseNum; |
|
|
}); |
|
|
}); |
|
|
// 物料的实际采购数合计 |
|
|
// 物料的实际采购数合计 |
|
|
$('#materialAmountSum_' + tableId).val(totalActualPurchase); |
|
|
$('#materialAmountSum_' + tableId).val(parseFloat(totalActualPurchase.toFixed(2))); |
|
|
//物料的实际不含税采购总价: |
|
|
// 物料的实际不含税采购总价 |
|
|
$('#materialNoRmbSum_' + tableId).val(parseFloat(totalNoRmb)); |
|
|
$('#materialNoRmbSum_' + tableId).val(parseFloat(totalNoRmb.toFixed(2))); |
|
|
//物料的实际含税总价: |
|
|
// 物料的实际含税总价 |
|
|
$('#materialRmbSum_' + tableId).val(parseFloat(totalRmb)); |
|
|
$('#materialRmbSum_' + tableId).val(parseFloat(totalRmb.toFixed(2))); |
|
|
// 采购物料合计 |
|
|
// 采购物料合计 |
|
|
materialActualPurchaseSum(); |
|
|
materialActualPurchaseSum(); |
|
|
} |
|
|
} |
|
@ -342,9 +339,9 @@ |
|
|
//采购数量合计 |
|
|
//采购数量合计 |
|
|
$('#purchaseSum').val(totalActualPurchase); |
|
|
$('#purchaseSum').val(totalActualPurchase); |
|
|
//采购不含税总价 |
|
|
//采购不含税总价 |
|
|
$('#purchaseNoRmbSum').val(totalNoRmb); |
|
|
$('#purchaseNoRmbSum').val(parseFloat(totalNoRmb.toFixed(2))); |
|
|
//采购含税总价 |
|
|
//采购含税总价 |
|
|
$('#purchaseRmbSum').val(totalRmb); |
|
|
$('#purchaseRmbSum').val(parseFloat(totalRmb.toFixed(2))); |
|
|
} |
|
|
} |
|
|
function tableSetup(element, tableId) { |
|
|
function tableSetup(element, tableId) { |
|
|
var $totalSection = $('<div class="card">' + |
|
|
var $totalSection = $('<div class="card">' + |
|
@ -352,19 +349,19 @@ |
|
|
'<div class="col-xs-4">' + |
|
|
'<div class="col-xs-4">' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-5">实际采购数合计:</label>' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-5">实际采购数合计:</label>' + |
|
|
'<div class="col-sm-6">' + |
|
|
'<div class="col-sm-6">' + |
|
|
'<input type="number" name="materialAmountSum" class="form-control actualPurchaseTotalSum" id="materialAmountSum_' + tableId + '" >' + |
|
|
'<input type="number" name="materialAmountSum" class="form-control actualPurchaseTotalSum" id="materialAmountSum_' + tableId + '" readonly>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'<div class="col-xs-4">' + |
|
|
'<div class="col-xs-4">' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-5">不含税采购总价:</label>' + |
|
|
'<label for="actualPurchaseTotal" class="col-sm-5">不含税采购总价:</label>' + |
|
|
'<div class="col-sm-6">' + |
|
|
'<div class="col-sm-6">' + |
|
|
'<input type="number" name="materialNoRmbSum" class="form-control actualPurchaseTotal" id="materialNoRmbSum_' + tableId + '" >' + |
|
|
'<input type="number" name="materialNoRmbSum" class="form-control actualPurchaseTotal" id="materialNoRmbSum_' + tableId + '" readonly>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'<div class="col-xs-4">' + |
|
|
'<div class="col-xs-4">' + |
|
|
'<label for="actualPurchaseTotalTax" class="col-sm-5">含税采购总价:</label>' + |
|
|
'<label for="actualPurchaseTotalTax" class="col-sm-5">含税采购总价:</label>' + |
|
|
'<div class="col-sm-6">' + |
|
|
'<div class="col-sm-6">' + |
|
|
'<input type="number" name="materialRmbSum" class="form-control actualPurchaseTotalTax" id="materialRmbSum_' + tableId + '" >' + |
|
|
'<input type="number" name="materialRmbSum" class="form-control actualPurchaseTotalTax" id="materialRmbSum_' + tableId + '" readonly>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>' + |
|
|
'</div>'+ |
|
|
'</div>'+ |
|
|