Advertisement
Guest User

было

a guest
Oct 31st, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. modifyAttrs:    function(){
  2.         var tempHdl = calc.creditHandlersMgr.hdl('CC_CURRENCY');
  3.         if (tempHdl.propEqual("CC_PRODUCT_TYPE", "Credit.ProductType.Obligation")){         // Облигация
  4.             this.modifyAttrNames(this.bondAttrNames);
  5.             this.modifyAttrPlaces(this.bondAttrPlaces);
  6.         } else if ( tempHdl.propEqual("CC_PRODUCT_TYPE", "Credit.ProductType.Guarant1") &&
  7.                     tempHdl.inFilter("CC_CREDIT_TYPE", "CREDIT_TYPE_GUARANT_LC") &&
  8.                     tempHdl.propEqual("CC_LC_TYPE", "Credit.Accreditiv.NoPokr")
  9.             ){                                                                              // Аккредитивы
  10.             this.modifyAttrNames(this.lcAttrNames);
  11.             this.modifyAttrPlaces(this.lcAttrPlaces);
  12.         } else if (tempHdl.propEqual("CC_PRODUCT_TYPE", "Credit.ProductType.Guarant")){     // Гарантия
  13.             this.modifyAttrNames(this.guarantyAttrNames);
  14.             this.modifyAttrPlaces(this.guarantyAttrPlaces);
  15.         } else {                                                                            // Кредит
  16.             this.modifyAttrNames(this.creditAttrNames);
  17.             this.modifyAttrPlaces(this.creditAttrPlaces);          
  18.         }
  19.        
  20.         // Проверка атрибутов, с изменяемыми блоками
  21.         this.ccRatesBlockAttrs = this.getBlockAttributes('CC_RATES');
  22.         this.ccCommissionsBlockAttrs = this.getBlockAttributes('CC_COMMISSIONS');
  23.         this.ccPrivlBlockAttrs = this.getBlockAttributes('CC_DOP_PRIVL');
  24.         this.ccPokrBlockAttrs = this.getBlockAttributes('CC_DOP_POKR');
  25.         this.ccVeksBlockAttrs = this.getBlockAttributes('CC_DOP_VEKS');
  26.     },
  27.    
  28.     modifyAttrNames: function(attrNames){
  29.         for (var attr in attrNames){
  30.             var attrHdl = this.creditHandlersMgr.hdl(attr);
  31.             attrHdl.setName(attrNames[attr] + ":");
  32.         }
  33.     },
  34.    
  35.     modifyAttrPlaces: function(attrPlaces){
  36.         for (var i=0; i<attrPlaces.length; i++){
  37.             var attrPlace = attrPlaces[i];
  38.             var attrCode = attrPlace.attrCode;
  39.             var attrBlock = attrPlace.blockCode;
  40.             var attrOrder = attrPlace.blockOrder;
  41.             var beforeAttr = undefined, afterAttr = undefined;
  42.             var beforeOrder = undefined, afterOrder = undefined;
  43.             for (var attr in this.pane.attrOrders){
  44.                 if (this.pane.attrOrders[attr].block === attrBlock){
  45.                     var order = this.pane.attrOrders[attr].order;
  46.                     // Здесь из предыдущих и последующих атрибутов выбираются те,
  47.                     // которые расположены наиболее близко к искомому атрибуту.
  48.                     // Например, если у искомого атрибута order = 50 и есть атрибуты:
  49.                     //  "attr_A" (order = 10)
  50.                     //  "attr_B" (order = 20)
  51.                     //  "attr_C" (order = 30)
  52.                     //  "attr_D" (order = 60)
  53.                     //  "attr_E" (order = 70)
  54.                     // то beforeAttr = "attr_C", beforeOrder = 30,
  55.                     // afterAttr = "attr_D", afterOrder = 60
  56.                     if (order < attrOrder){
  57.                         if (typeof beforeOrder === "undefined" || order > beforeOrder){
  58.                             beforeAttr = attr;
  59.                             beforeOrder = order;
  60.                         }
  61.                     } else {
  62.                         if (typeof afterOrder === "undefined" || order < afterOrder){
  63.                             afterAttr = attr;
  64.                             afterOrder = order;
  65.                         }
  66.                     }
  67.                 }
  68.             }
  69.             var attrHdl = this.creditHandlersMgr.hdl(attrCode);
  70.             if (typeof beforeAttr !== "undefined"){
  71.                 attrHdl.changeAttrPlace(beforeAttr, "after");
  72.             } else if (typeof afterAttr !== "undefined"){
  73.                 attrHdl.changeAttrPlace(afterAttr, "before");
  74.             } else {
  75.                 attrHdl.changeAttrPlace("block_" + attrBlock, "last");
  76.             }
  77.             this.pane.attrOrders[attrCode].block = attrBlock;
  78.             this.pane.attrOrders[attrCode].order = attrOrder;
  79.         }
  80.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement