var globalTotalDecimalPlaces=2,globalIntermediumDecimalPlaces=2;function checkMultiplyOverflow(a,b){return 999999999999<a/1E3*(b/1E3)?(alert(NextWay.Localization.JavascriptOverflowErrorText),!1):!0}function checkSumOverflow(a,b){return 0>999999999999999-a-b?(alert(NextWay.Localization.JavascriptOverflowErrorText),!1):!0}function ChangeGlobalTotalDecimalPlaces(a){globalTotalDecimalPlaces=parseInt(a);OnChangeGlobalTotalDecimalPlaces()}
function ChangeGlobalIntermediumDecimalPlaces(a){globalIntermediumDecimalPlaces=parseInt(a);OnChangeGlobalIntermediumDecimalPlaces()}function OnChangeGlobalTotalDecimalPlaces(){$.each($(".TotalDecimalType"),function(a,b){DoAutoNumericUpdate(b,{mDec:globalTotalDecimalPlaces})})}function OnChangeGlobalIntermediumDecimalPlaces(){$.each($(".IntermediumDecimalType"),function(a,b){DoAutoNumericUpdate(b,{mDec:globalIntermediumDecimalPlaces})})}
function DoAutoNumericUpdate(a,b){var c=$(a).data("AutoNumericOptions");b=$.extend({},c,b);$(a).unbind("keydown");$(a).unbind("keypress");$(a).unbind("keyup");$(a).unbind("focusout");$(a).unbind("focusin");$(a).autoNumeric(b);$(a).val($.fn.autoNumeric.Format($(a).attr("id"),$(a).val(),b))}
function GeneralPriceListItemProperties_Calc_CeilingPriceTotal(a){var b=void 0,c=a.FindValue("Quantity");a=a.FindValue("CeilingPrice");isNaN(c)||isNaN(a)||(b=checkMultiplyOverflow(c,a)?RoundNumber(c*a,globalTotalDecimalPlaces):0);return isNaN(b)?0:b}function GeneralPriceListItemProperties_Calc_CostPriceTotal(a){var b=void 0,c=a.FindValue("Quantity");a=a.FindValue("CostPrice");isNaN(c)||isNaN(a)||(b=checkMultiplyOverflow(c,a)?RoundNumber(c*a,globalTotalDecimalPlaces):0);return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_SalesPriceTotal(a){var b=void 0,c=a.FindValue("Quantity");a=a.FindValue("SalesPrice");isNaN(c)||isNaN(a)||(b=checkMultiplyOverflow(c,a)?RoundNumber(c*a,globalTotalDecimalPlaces):0);return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_BillingDiscountValue(a){var b=void 0,c=a.FindValue("BillingQuantity"),d=a.FindValue("BillingPrice");a=a.FindValue("BillingDiscountPercentage");isNaN(a)&&(a=0);isNaN(c)||isNaN(d)||(b=RoundNumber(a/100*d*c,globalTotalDecimalPlaces));return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_BillingPriceTotal(a){var b=void 0,c=a.FindValue("BillingQuantity"),d=a.FindValue("BillingDiscountValue");a=a.FindValue("BillingPrice");isNaN(d)&&(d=0);isNaN(c)||isNaN(a)||(b=RoundNumber(c*a-d,globalTotalDecimalPlaces));return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_ReplyLineDiscountValue(a){var b=void 0,c=a.FindValue("Quantity"),d=a.FindValue("ReplyPrice");a=a.FindValue("LineDiscountPercentage");isNaN(a)&&(a=0);isNaN(c)||isNaN(d)||(b=checkMultiplyOverflow(c,d)?RoundNumber(a/100*d*c,globalTotalDecimalPlaces):0);return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_ReplyPriceTotal(a){var b=void 0,c=a.FindValue("Quantity"),d=a.FindValue("ReplyPrice");a=a.FindValue("LineDiscountPercentage");isNaN(a)&&(a=0);isNaN(c)||isNaN(d)||(b=checkMultiplyOverflow(c,d)?RoundNumber(c*d-a/100*d*c,globalTotalDecimalPlaces):0);return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_TotalLowestPrice(a){var b=void 0,c=a.FindValue("Quantity");a=a.FindValue("LowestPrice");isNaN(a)||isNaN(c)||(b=checkMultiplyOverflow(c,a)?RoundNumber(c*a,globalTotalDecimalPlaces):0);return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_TotalBudget(a){var b=void 0,c=a.FindValue("Quantity"),d=a.FindValue("ProfitMargin"),e=a.FindValue("ComercialDiscount"),f=a.FindValue("ReplyPrice");a=a.FindValue("GlobalDiscount");isNaN(d)&&(d=0);isNaN(e)&&(e=0);isNaN(a)&&(a=0);isNaN(c)||isNaN(f)||(b=RoundNumber((f+f*d/100-f*a/100-f*e/100)*c,globalTotalDecimalPlaces));return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Calc_TotalUnitPriceBudget(a){var b=void 0,c=a.FindValue("Quantity");a=a.FindValue("TotalBudget");isNaN(c)&&(profitMargin=0);isNaN(a)&&(comercialDiscount=0);isNaN(c)||isNaN(a)||(b=RoundNumber(a/c,globalTotalDecimalPlaces));return isNaN(b)?0:b}
function GeneralPriceListItemProperties_Save_Formated_BillingDiscountValue(a){var b;void 0!=a.Find("BillingDiscountValue")&&(b=GeneralPriceListItemProperties_Calc_BillingDiscountValue(a),a.SaveFormatedValue("BillingDiscountValue",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_BillingPriceTotal(a){var b;void 0!=a.Find("BillingPriceTotal")&&(b=GeneralPriceListItemProperties_Calc_BillingPriceTotal(a),a.SaveFormatedValue("BillingPriceTotal",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_CeilingPriceTotal(a){var b;void 0!=a.Find("CeilingPriceTotal")&&(b=GeneralPriceListItemProperties_Calc_CeilingPriceTotal(a),a.SaveFormatedValue("CeilingPriceTotal",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_CostPriceTotal(a){var b;void 0!=a.Find("CostPriceTotal")&&(b=GeneralPriceListItemProperties_Calc_CostPriceTotal(a),a.SaveFormatedValue("CostPriceTotal",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_SalesPriceTotal(a){var b;void 0!=a.Find("SalesPriceTotal")&&(b=GeneralPriceListItemProperties_Calc_SalesPriceTotal(a),a.SaveFormatedValue("SalesPriceTotal",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_ReplyLineDiscountValue(a){var b;void 0!=a.Find("ReplyLineDiscountValue")&&(b=GeneralPriceListItemProperties_Calc_ReplyLineDiscountValue(a),a.SaveFormatedValue("ReplyLineDiscountValue",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_ReplyPriceTotal(a){var b;void 0!=a.Find("ReplyPriceTotal")&&(b=GeneralPriceListItemProperties_Calc_ReplyPriceTotal(a),a.SaveFormatedValue("ReplyPriceTotal",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_TotalLowestPrice(a){var b;void 0!=a.Find("TotalLowestPrice")&&(b=GeneralPriceListItemProperties_Calc_TotalLowestPrice(a),a.SaveFormatedValue("TotalLowestPrice",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Save_Formated_TotalBudget(a){var b;void 0!=a.Find("TotalBudget")&&(b=GeneralPriceListItemProperties_Calc_TotalBudget(a),a.SaveFormatedValue("TotalBudget",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())));void 0!=a.Find("TotalUnitPriceBudget")&&(b=GeneralPriceListItemProperties_Calc_TotalUnitPriceBudget(a),a.SaveFormatedValue("TotalUnitPriceBudget",b,$.format(b,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Update_BillingDiscountPercentage(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_BillingDiscountValue(a);GeneralPriceListItemProperties_Save_Formated_BillingPriceTotal(a);a.SetPreviousValue("BillingDiscountValue");b=$(a.Find("BillingDiscountValue"));b.trigger("onchange");a.SetPreviousValue("BillingPriceTotal");b=$(a.Find("BillingPriceTotal"));b.trigger("onchange")}
function GeneralPriceListItemProperties_Update_BillingQuantity(a){GeneralPriceListItemProperties_Update_BillingDiscountPercentage(a)}function GeneralPriceListItemProperties_Update_Quantity(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);void 0!=a.Find("ReplyPriceTotal")?UpdateSupplierProperties_Quantity(a):UpdateBuyerProperties_Quantity(a)}
function UpdateSupplierProperties_Quantity(a){var b;void 0!=a.Find("ReplyPriceTotal")&&(b=$.parseFloat($(a.Find("ReplyPriceTotal")).val()));isNaN(b)&&(b=0);GeneralPriceListItemProperties_Save_Formated_ReplyLineDiscountValue(a);GeneralPriceListItemProperties_Save_Formated_ReplyPriceTotal(a);GeneralPriceListItemProperties_Save_Formated_TotalBudget(a);GeneralPriceListItemProperties_Update_Totals_ProposalTotal(a,b);a.SetPreviousValue("ReplyLineDiscountValue");$(a.Find("ReplyLineDiscountValue")).trigger("onchange");
a.SetPreviousValue("ReplyPriceTotal");$(a.Find("ReplyPriceTotal")).trigger("onchange");a.SetPreviousValue("TotalBudget");$(a.Find("TotalBudget")).trigger("onchange");var c=a.Find("Chk_Sel_ReplyPrice");void 0!=c&&c.is(":checked")&&(c=$(a.Find("Quantity")).parent().parent().parent().parent().parent().parent().parent(),GeneralPriceListItemProperties_Update_AwardPrice(a,c,b))}
function UpdateBuyerProperties_Quantity(a){var b,c,d;b=void 0==a.Find("CostPriceTotal")||""===a.Find("CostPriceTotal").val()||isNaN($.parseFloat(a.Find("CostPriceTotal").val()))?0:$.parseFloat($(a.Find("CostPriceTotal")).val());c=void 0==a.Find("TotalLowestPrice")||""===a.Find("TotalLowestPrice").val()||isNaN($.parseFloat(a.Find("TotalLowestPrice").val()))?0:$.parseFloat($(a.Find("TotalLowestPrice")).val());d=void 0==a.Find("SalesPriceTotal")||""===a.Find("SalesPriceTotal").val()||isNaN($.parseFloat(a.Find("SalesPriceTotal").val()))?
0:$.parseFloat($(a.Find("SalesPriceTotal")).val());GeneralPriceListItemProperties_Save_Formated_CeilingPriceTotal(a);GeneralPriceListItemProperties_Save_Formated_CostPriceTotal(a);GeneralPriceListItemProperties_Save_Formated_SalesPriceTotal(a);GeneralPriceListItemProperties_Save_Formated_TotalLowestPrice(a);GeneralPriceListItemProperties_Update_Totals_CostPriceTotal(a,b);GeneralPriceListItemProperties_Update_Totals_TotalLowestPriceTotal(a,c);GeneralPriceListItemProperties_Update_Totals_SalesPriceTotalTotal(a,
d);a.SetPreviousValue("CeilingPriceTotal");$(a.Find("CeilingPriceTotal")).trigger("onchange");a.SetPreviousValue("CostPriceTotal");$(a.Find("CostPriceTotal")).trigger("onchange");a.SetPreviousValue("TotalLowestPrice");$(a.Find("TotalLowestPrice")).trigger("onchange");a.SetPreviousValue("SalesPriceTotal");$(a.Find("SalesPriceTotal")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_Totals_CostPriceTotal(a,b){var c,d;void 0!=a.Find("CostPriceTotal")&&(c=$.parseFloat($(a.Find("CostPriceTotal")).val()));d=$.parseFloat($('[contextid="TOTAL_BUYER"]').find('input[contextvarid="CostPriceTotal"]').val());isNaN(d)&&(d=0);isNaN(c)||isNaN(b)?$('[contextid="TOTAL_BUYER"]').find('input[contextvarid="CostPriceTotal"]').val(void 0):(c>b&&(d+=c-b),c<b&&(d-=b-c),$('[contextid="TOTAL_BUYER"]').find('input[contextvarid="CostPriceTotal"]').val($.format(d,
"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Update_Totals_ProposalTotal(a,b){var c;void 0!=a.Find("ReplyPriceTotal")&&(c=GeneralPriceListItemProperties_Calc_ReplyPriceTotal(a));isNaN(c)&&(c=0);void 0==a.parentSandBox||void 0==a.parentSandBox.Find("ReplyPriceTotal")||""===a.parentSandBox.Find("ReplyPriceTotal").val()||isNaN($.parseFloat(a.parentSandBox.Find("ReplyPriceTotal").val()))||(previousProposalTotalValue=$.parseFloat($(a.parentSandBox.Find("ReplyPriceTotal")).val()),c=previousProposalTotalValue+
(c-b),a.parentSandBox.SaveFormatedValue("ReplyPriceTotal",c,$.format(c,"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Update_Totals_TotalLowestPriceTotal(a,b){var c,d;void 0!=a.Find("TotalLowestPrice")&&(c=$.parseFloat($(a.Find("TotalLowestPrice")).val()));d=$.parseFloat($('[contextid="TOTAL_BUYER"]').find('input[contextvarid="TotalLowestPrice"]').val());isNaN(d)&&(d=0);isNaN(c)||isNaN(b)?$('[contextid="TOTAL_BUYER"]').find('input[contextvarid="TotalLowestPrice"]').val(void 0):(c>b&&(d+=c-b),c<b&&(d-=b-c),$('[contextid="TOTAL_BUYER"]').find('input[contextvarid="TotalLowestPrice"]').val($.format(d,
"n"+globalTotalDecimalPlaces.toString())))}
function GeneralPriceListItemProperties_Update_Totals_SalesPriceTotalTotal(a,b){var c,d;void 0!=a.Find("SalesPriceTotal")&&(c=$.parseFloat($(a.Find("SalesPriceTotal")).val()));d=$.parseFloat($('[contextid="TOTAL_BUYER"]').find('input[contextvarid="SalesPriceTotal"]').val());isNaN(d)&&(d=0);isNaN(c)||isNaN(b)?$('[contextid="TOTAL_BUYER"]').find('input[contextvarid="SalesPriceTotal"]').val(void 0):(c>b&&(d+=c-b),c<b&&(d-=b-c),$('[contextid="TOTAL_BUYER"]').find('input[contextvarid="SalesPriceTotal"]').val($.format(d,"n"+
globalTotalDecimalPlaces.toString())))}function GeneralPriceListItemProperties_Update_CeilingPrice(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_CeilingPriceTotal(a);a.SetPreviousValue("CeilingPriceTotal");$(a.Find("CeilingPriceTotal")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_CostPrice(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);b=void 0==a.Find("CostPriceTotal")||""===a.Find("CostPriceTotal").val()||isNaN($.parseFloat(a.Find("CostPriceTotal").val()))?0:$.parseFloat($(a.Find("CostPriceTotal")).val());GeneralPriceListItemProperties_Save_Formated_CostPriceTotal(a);GeneralPriceListItemProperties_Update_Totals_CostPriceTotal(a,b);a.SetPreviousValue("CostPriceTotal");$(a.Find("CostPriceTotal")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_SalesPrice(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);b=void 0==a.Find("SalesPriceTotal")||""===a.Find("SalesPriceTotal").val()||isNaN($.parseFloat(a.Find("SalesPriceTotal").val()))?0:$.parseFloat($(a.Find("SalesPriceTotal")).val());GeneralPriceListItemProperties_Save_Formated_SalesPriceTotal(a);GeneralPriceListItemProperties_Update_Totals_SalesPriceTotalTotal(a,b);a.SetPreviousValue("SalesPriceTotal");$(a.Find("SalesPriceTotal")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_LineDiscountPercentage(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_ReplyLineDiscountValue(a);GeneralPriceListItemProperties_Save_Formated_ReplyPriceTotal(a);a.SetPreviousValue("ReplyLineDiscountValue");$(a.Find("ReplyLineDiscountValue")).trigger("onchange");a.SetPreviousValue("ReplyPriceTotal");$(a.Find("ReplyPriceTotal")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_ReplyPrice(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);var c;void 0!=a.Find("ReplyPriceTotal")&&(c=$.parseFloat($(a.Find("ReplyPriceTotal")).val()));isNaN(c)&&(c=0);GeneralPriceListItemProperties_Save_Formated_ReplyLineDiscountValue(a);GeneralPriceListItemProperties_Save_Formated_ReplyPriceTotal(a);GeneralPriceListItemProperties_Save_Formated_TotalBudget(a);GeneralPriceListItemProperties_Update_Totals_ProposalTotal(a,
c);a.SetPreviousValue("ReplyLineDiscountValue");$(a.Find("ReplyLineDiscountValue")).trigger("onchange");a.SetPreviousValue("ReplyPriceTotal");$(a.Find("ReplyPriceTotal")).trigger("onchange");if($(a.Find("ReplyPrice")).parent().parent().parent().parent().parent().hasClass("BusinessItemLineMap")){var b=$(a.Find("ReplyPrice")).parent().parent().parent().parent().parent().parent().parent(),d=b.find('input[contextvarid="LowestPrice"]'),e=$.parseFloat($(d).val()),f=0;$(b).find('input[contextvarid="ReplyPrice"]').each(function(){var a=
$.parseFloat(this.value);if(0<a&&a<$.parseFloat(f)||0==$.parseFloat(f))f=this.value});$.parseFloat(f)!=e&&($(d).val(f),d.trigger("onchange"));d=a.Find("Chk_Sel_ReplyPrice");void 0!=d&&d.is(":checked")&&GeneralPriceListItemProperties_Update_AwardPrice(a,b,c)}}function GeneralPriceListItemProperties_Update_ReplyPriceTotal(a){}
function GeneralPriceListItemProperties_Update_LowestPrice(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_TotalLowestPrice(a);a.SetPreviousValue("TotalLowestPrice");$(a.Find("TotalLowestPrice")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_AwardPrice(a,b,c){if(3==arguments.length){var d=$('tr[contextid="TOTAL_BUYER"]'),e=getElementValue(d,"TotalAwardPrice");isNaN(e)&&(e=0);var f=$(a.Find("ReplyPriceTotal")),g=$.parseFloat($(f).val());isNaN(g)&&(g=0);var l=b.find('input[contextvarid="AwardPrice"]'),h=$.parseFloat($(l).val());isNaN(h)&&(h=0);var f=$(a.Find("ReplyPriceSelectedTotal")),k=$.parseFloat($(f).val());isNaN(k)&&(k=0);var m=g-c,g=h+m,k=k+m;$(l).data("previous_value",h);$(l).val($.format(g,
"n"+globalTotalDecimalPlaces.toString()));l.trigger("onchange");e=e+g-h;$(f).val($.format(k,"n"+globalTotalDecimalPlaces.toString()));f.trigger("onchange");setElementValue(d,"TotalAwardPrice",$.format(e,"n3"))}}function GeneralPriceListItemProperties_Update_ProfitMargin(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_TotalBudget(a);a.SetPreviousValue("TotalBudget");$(a.Find("TotalBudget")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_ComercialDiscount(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_TotalBudget(a);a.SetPreviousValue("TotalBudget");$(a.Find("TotalBudget")).trigger("onchange")}
function GeneralPriceListItemProperties_Update_GlobalDiscount(a){var b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_TotalBudget(a);a.SetPreviousValue("TotalBudget");$(a.Find("TotalBudget")).trigger("onchange")}
function DefaultValues_GeneralPriceListItemProperties(){var a=new SandBox("defaultValues");a.AddValue("Quantity",void 0);a.AddValue("Sale_Price",void 0);a.AddValue("Base_Price",void 0);a.AddValue("Total_Unit_Min_Price",void 0);a.AddValue("Total_Buyer_SalePrice",void 0);a.AddValue("Price_Per_Unit",void 0);a.AddValue("Total_Supplier",void 0);a.AddValue("Lowest_Price",void 0);a.AddValue("Total_Buyer_LowestPrice",0);a.AddValue("ProfitMargin",void 0);a.AddValue("ComercialDiscount",void 0);a.AddValue("GlobalDiscount",
void 0);a.AddValue("Total_Budget",0);return a}
function GeneralPriceListItemProperties_Award_Calc_SumReplyPriceTotal(a){var b=DefaultValues_GeneralPriceListItemProperties(),b=CreateSandBox(a,b),c=0;a=GetElements(a,"ReplyPriceTotal");if(void 0!=a&&0<a.length){var d;$.each(a,function(){d=$.parseFloat(this.val());isNaN(d)||(c+=d)})}b.SaveFormatedValue("ReplyPriceTotal",c,$.format(c,"n"+globalTotalDecimalPlaces.toString()));b.SetPreviousValue("ReplyPriceTotal");c=$(b.Find("ReplyPriceTotal"));c.trigger("onchange")}
function GetElements(a,b){var c=$("[parentcontextid="+a+"]"),d=[];void 0!=c&&0<c.length&&c.each(function(){var a=$(this).find("[contextvarid="+b+"]");void 0!=a&&d.push(a)});return d}function GetRestrictedElements(a,b){var c=$("[restrictedctxt="+a+"]"),d=[];void 0!=c&&0<c.length&&c.each(function(){var a=$(this),c=a.find("[contextvarid= Restricted"+b+"]");void 0!=c&&c.is(":checked")&&(a=a.find("[contextvarid="+b+"]"),void 0!=a&&d.push(a))});return d}
function GeneralPriceListItemProperties_Award_Update_Quantity(a){var b=$('tr[contextid="'+a+'"]'),c=getElementValue(b,"ReplyPriceTotal"),d=!0;"False"==b.attr("countsToTotal")&&(d=!1);b=DefaultValues_GeneralPriceListItemProperties();b=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_ReplyPriceTotal(b);b.SetPreviousValue("ReplyPriceTotal");a=$(b.Find("ReplyPriceTotal"));a.trigger("onchange");if(void 0!=b.parentSandBox&&d){var d=$('tr[contextid="'+b.parentSandBox.contextId+'"]'),e=getElementValue(d,
"ReplyPriceTotal");isNaN(e)||isNaN($.parseFloat(a.val()))||isNaN(c)||(delta=$.parseFloat(a.val())-c,e+=delta,setElementValue(d,"ReplyPriceTotal",$.format(e,"n2")))}d=b.Find("RestrictedReplyPriceTotal");void 0!=d&&d.is(":checked")?(d=$('tr[contextid="'+b.restrictedContextId+'"]'),b=getElementValue(d,"ReplyPriceSelectedTotal"),isNaN(b)||isNaN($.parseFloat(a.val()))||isNaN(c)||(delta=$.parseFloat(a.val())-c,b+=delta,setElementValue(d,"ReplyPriceSelectedTotal",$.format(b,"n2")))):void 0!=d&&!0==d.attr("disabled")?
""!=$(b.Find("Quantity")).val()&&""!=$(b.Find("ReplyPrice")).val()&&d.attr("disabled",!1):void 0!=d&&!1==d.attr("disabled")&&(""!=$(b.Find("Quantity")).val()&&""!=$(b.Find("ReplyPrice")).val()||d.attr("disabled",!0))}function DOPriceList_ApplyTax(a,b){if(void 0==a||isNaN(a))a=0;if(void 0==b||isNaN(b))b=0;return b/100*a}
function DOPriceList_Award_UpdateBusinessItemTotals(a){var b=$('tr[contextid="'+a.attr("parentcontextid")+'"]'),c=$('tr[contextid="'+a.attr("restrictedctxt")+'"]'),d=0,e=0;a.closest("#fltBillOfQuantitiesMap").find("[parentcontextid='"+a.attr("parentcontextid")+"']").each(function(a,b){var c=$(b),h=getElementValueOrZero(c,"ReplyPriceTotal"),k="False"!=c.attr("countsToTotal"),c=getElement(c,"RestrictedReplyPriceTotal").is(":checked");k&&(d+=h);c&&(e+=h)});void 0!==b&&setElementValueFixed(b,"ReplyPriceTotal",
d);void 0!==c&&setElementValueFixed(c,"ReplyPriceSelectedTotal",e)}
function DOPriceList_Award_UpdateBusinessItemLine(a){a=$('tr[contextid="'+a+'"]');var b=getElementValueOrZero(a,"Quantity"),c=getElementValueOrZero(a,"ReplyPrice"),b=b*c;setElementValueFixed(a,"ReplyPriceValue",b);c=getElementValueOrZero(a,"LineDiscountPercentage");c=DOPriceList_ApplyTax(b,c);setElementValueFixed(a,"ReplyLineDiscountValue",c);b-=c;c=getElementValue(a,"MontoGrabado");if(void 0===c||isNaN(c))c=b;var d=getElementValueOrZero(a,"ITBIS"),c=DOPriceList_ApplyTax(c,d);setElementValueFixed(a,
"ITBISValue",c);d=getElementValueOrZero(a,"Tax");d=DOPriceList_ApplyTax(b,d);setElementValueFixed(a,"TaxValue",d);setElementValueFixed(a,"ReplyPriceTotal",b+c+d);DOPriceList_Award_UpdateBusinessItemTotals(a)}function DOPriceList_Award_Update_Quantity(a){DOPriceList_Award_UpdateBusinessItemLine(a)}function DOPriceList_Award_Update_ReplyPrice(a){DOPriceList_Award_UpdateBusinessItemLine(a)}
function GeneralPriceListItemProperties_Award_Update_ReplyPrice(a){var b=$('tr[contextid="'+a+'"]');getElementValue(b,"ReplyPriceTotal");b.attr("countsToTotal");b=DefaultValues_GeneralPriceListItemProperties();a=CreateSandBox(a,b);GeneralPriceListItemProperties_Save_Formated_ReplyPriceTotal(a);a.SetPreviousValue("ReplyPriceTotal");$(a.Find("ReplyPriceTotal")).trigger("onchange")}
function GeneralPriceListItemProperties_Award_Update_RestrictedReplyPriceTotal(a){var b=DefaultValues_GeneralPriceListItemProperties(),b=CreateSandBox(a,b),c=0;a=GetRestrictedElements(a,"ReplyPriceTotal");if(void 0!=a&&0<a.length){var d;$.each(a,function(){d=$.parseFloat(this.val());isNaN(d)||(c+=d)})}b.SaveFormatedValue("ReplyPriceSelectedTotal",c,$.format(c,"n"+globalTotalDecimalPlaces.toString()));b.SetPreviousValue("ReplyPriceSelectedTotal");c=$(b.Find("ReplyPriceSelectedTotal"));c.trigger("onchange")}
function getElement(a,b){return a.find("[contextvarid="+b+"]")}function getElementValue(a,b){var c=getElement(a,b),d=0;void 0!=c&&(c=c.is("span")?c.text():$.getVal(c),d=$.parseFloat(c));return d}function getElementValueOrZero(a,b){var c=getElementValue(a,b);if(void 0===c||isNaN(c))c=0;return c}function setElementValue(a,b,c){a=a.find('[contextvarid="'+b+'"]');void 0!=a&&(a.is("span")?a.text(c):a.val(c),a.change())}
function setElementValueFixed(a,b,c){formatted=$.format(c,"n"+globalTotalDecimalPlaces.toString());void 0!==formatted&&(c=formatted);setElementValue(a,b,c)}function updateSupplierCellCss(a,b){var c=a.parent().parent().parent();b&&!c.hasClass("SelectedRow")?c.addClass("SelectedRow"):c.hasClass("SelectedRow")&&c.removeClass("SelectedRow")}
function checkUncheckAllItemsInComparativeMap(a,b,c){b=$("#"+b);c=b.find('tr[contextid^="'+c+'_"]');void 0!=c&&0<c.length&&updateAwardPriceColumns(c,a.checked,b)}
function checkUncheckItemInComparativeMap(a,b){var c=$(window),d=$(a),e=c.data(d.attr("id")),f=c.data(d.attr("id")+"_to");if((null==e||e!=a.checked)&&"complete"===document.readyState){c.data(d.attr("id"),a.checked);var e=$('tr[contextid="'+b+'"]'),g=$('table[contextid="'+e.attr("parentcontextid")+'"]'),l=$('tr[contextid="'+e.attr("bctxid")+'"]');UpdateAwardPriceValue(e,g,l,a.checked);updateSupplierCellCss(e,a.checked);$("#"+a.id).removeAttr("disabled");null!=f&&(clearTimeout(f),c.removeData(d.attr("id")+
"_to"));c.data(d.attr("id")+"_to",setTimeout('$(window).removeData("'+d.attr("id")+'_to");$(window).removeData("'+d.attr("id")+'");',500))}}function uncheckItemInComparativeMapWhenRemovingLine(a,b){if("complete"===document.readyState)for(var c=0;c<b.length;c++){var d=$('tr[contextid="'+b[c]+'"]'),e=$('table[contextid="'+d.attr("parentcontextid")+'"]'),f=$('tr[contextid="'+d.attr("bctxid")+'"]');getElement(d,"Chk_Sel_ReplyPrice").attr("checked")&&UpdateAwardPriceValue(d,e,f,!1)}}
function removeItemInComparativeMap(a,b){var c=$("#"+a);c.val("");for(var d=0;d<b.length;d++){var e=$('tr[contextid="'+b[d]+'"]'),e=getElement(e,"Chk_Sel_ReplyPrice");if(null!=e&&0<e.length)for(var f=0;f<e.length;f++)if(null!=e[f]&&e[f].checked){var g=$(e[f]);g.attr("checked",!1);c.val(c.val()+g.attr("ctrlinfo")+";");checkUncheckItemInComparativeMap(e[f],b[d])}}}
function updateAwardPriceColumns(a,b,c){a.each(function(){var a=$(this),e=$('table[contextid="'+a.attr("parentcontextid")+'"]'),f=c.find('tr[contextid="'+a.attr("bctxid")+'"]');UpdateAwardPriceColumn(a,e,f,b)})}function UpdateAwardPriceColumn(a,b,c,d){var e=getElement(a,"Chk_Sel_ReplyPrice");if(void 0!=e){var e=$(e),f=e.attr("checked");f&&d||!f&&!d||(UpdateAwardPriceValue(a,b,c,d),e.attr("checked",d),updateSupplierCellCss(a,d))}}
function UpdateAwardPriceValue(a,b,c,d){var e=0;a=getElementValue(a,"ReplyPriceTotal");var f=getElementValue(c,"AwardPrice");isNaN(f)&&(f=0);isNaN(a)||isNaN(f)?isNaN(f)||(e=f):e=d?f+a:f-a;UpdateBuyerAwardedTotalValue(f,e);setElementValue(c,"AwardPrice",$.format(e,"n"+globalTotalDecimalPlaces.toString()));void 0!=b&&updateSupplierAwardTotalValue(b,a,d)}
function updateSupplierAwardTotalValue(a,b,c){var d=getElementValue(a,"ReplyPriceSelectedTotal");isNaN(b)||isNaN(d)||setElementValue(a,"ReplyPriceSelectedTotal",$.format(c?d+b:d-b,"n"+globalTotalDecimalPlaces.toString()))}function UpdateBuyerAwardedTotalValue(a,b){var c=$('tr[contextid="TOTAL_BUYER"]'),d=0,e=getElementValue(c,"TotalAwardPrice");isNaN(e)||isNaN(a)||(d=e-a+b);setElementValue(c,"TotalAwardPrice",$.format(d,"n"+globalTotalDecimalPlaces.toString()))};
