function fcnDistribution(id) {
var enterdAmount = Filtervalue($("[id$='txtAmountReceipt']"));
$("input[id$=txtReceivables]").each(function () {
var id = $(this).attr('id');
var rowId = id.substr(id.length - 20).substr(0, 5);
var txtReceivableAmt = Filtervalue($(this));
var txtAmountId = $("[id$=" + rowId + "_txtAmount]");
if (parseFloat(enterdAmount) > 0) {
$(txtAmountId).val((parseFloat(enterdAmount) >= parseFloat(txtReceivableAmt)) ? txtReceivableAmt : enterdAmount);
enterdAmount = enterdAmount - txtReceivableAmt;
}
});
if (parseFloat(enterdAmount) > 0) {
var firstVal = Filtervalue($("[id$=txtAmount]:first"));
$("[id$=txtAmount]:first").val(parseFloat(firstVal).toFixed(2) + parseFloat(enterdAmount).toFixed(2));
}
}
var enterdAmount = Filtervalue($("[id$='txtAmountReceipt']"));
$("input[id$=txtReceivables]").each(function () {
var id = $(this).attr('id');
var rowId = id.substr(id.length - 20).substr(0, 5);
var txtReceivableAmt = Filtervalue($(this));
var txtAmountId = $("[id$=" + rowId + "_txtAmount]");
if (parseFloat(enterdAmount) > 0) {
$(txtAmountId).val((parseFloat(enterdAmount) >= parseFloat(txtReceivableAmt)) ? txtReceivableAmt : enterdAmount);
enterdAmount = enterdAmount - txtReceivableAmt;
}
});
if (parseFloat(enterdAmount) > 0) {
var firstVal = Filtervalue($("[id$=txtAmount]:first"));
$("[id$=txtAmount]:first").val(parseFloat(firstVal).toFixed(2) + parseFloat(enterdAmount).toFixed(2));
}
}