Advertisement
Guest User

Funcion modificada

a guest
Sep 17th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String      ls_value, ls_null
  2. Integer         li_tab_order[], li_opcion
  3. Boolean     lb_array_ind[], lb_estado = false
  4. String      ls_array_code[], ls_array_value[], ls_EmptyArray[]
  5. Integer     li_row, lj_row, li_cont, contador
  6.  
  7. setnull(ls_null)
  8. lb_array_ind = {ib_MontoCredito, ib_ExcepCuotas, ib_ExcepTEA}
  9. ls_array_code = {"000004", "000003", "000037"}
  10. li_tab_order = {270, 280, 290, 300}
  11. if ib_MontoCredito = true or ib_ExcepCuotas = true or ib_ExcepTEA = true then
  12.     li_opcion = MessageBox(g_nomapl,"A continuación se generará(n) la(s) excepcion(es) automática(s)." + &
  13.                                     "~rVerifique los datos ingresados antes de proseguir." + &
  14.                                     "~r¿Datos ingresados correctamente?", question!, YesNo!, 2)
  15.     if li_opcion = 1 then
  16.         if ib_bandera = false then
  17.             ib_bandera = true
  18.             dw_sol_cre.SetItem(1, "cre$cre_ind_exc", '1')
  19.             for li_row = 1 to UpperBound(lb_array_ind)
  20.                 if lb_array_ind[li_row] = true then
  21.                     ii_cont += 1
  22.                     dw_sol_cre.SetItem(1, "motivo_exc"+string(ii_cont), ls_array_code[li_row])
  23.                 end if
  24.             next
  25.             f_activar("motivo_exc"+string(ii_cont+1), li_tab_order[ii_cont+1], dw_sol_cre)
  26.         else
  27.             ls_array_value = ls_EmptyArray
  28.             /*
  29.                 Capturo el valor del combo box, solo se capturarán aquellas
  30.                 excepciones llenadas de forma manual y lo guardo dentro de un
  31.                 arreglo.
  32.                 Después procedo a limpiar el campo y deshabilitarlo
  33.              */
  34.             for li_row = 1 to 4
  35.                 ls_value = dw_sol_cre.GetItemString(1, "motivo_exc"+string(li_row))
  36.                 if not isnull(ls_value) or len(ls_value) > 0 then
  37.                     for lj_row = 1 to UpperBound(ls_array_code)
  38.                         if ls_value = ls_array_code[lj_row] then
  39.                             lb_estado = true
  40.                             exit
  41.                         end if
  42.                     next
  43.                     if lb_estado = false then
  44.                         contador += 1
  45.                         ls_array_value[contador] = ls_value
  46.                     end if
  47.                 end if
  48.                 dw_sol_cre.setitem(1, "motivo_exc"+string(li_row), ls_null)
  49.                 f_desactivar("motivo_exc"+string(li_row), dw_sol_cre)
  50.             next
  51.  
  52.             /*
  53.                 Ahora seteamos las excepciones automaticas y, de ser el caso,
  54.                 también las excepciones manuales
  55.              */
  56.             for li_row = 1 to UpperBound(lb_array_ind)
  57.                 if lb_array_ind[li_row] = true then
  58.                     li_cont += 1
  59.                     dw_sol_cre.SetItem(1, "motivo_exc"+string(li_cont), ls_array_code[li_row])
  60.                 end if
  61.             next
  62.  
  63.             /*
  64.                 Verificamos ls_array_value
  65.                     case > 1:
  66.                         seteamos los valores contenidos dentro del arreglo y si el contador
  67.                         es menor a 4, que es el total de excepciones, activa el combobox
  68.                         que le precede.
  69.                     case = 1
  70.                         seteamos el valor unico contenido en el arreglo y activamos el
  71.                         combobox que le precede.
  72.              */
  73.             if UpperBound(ls_array_value) > 1 then
  74.                 contador = li_cont
  75.                 for li_row = 1 to UpperBound(ls_array_value)
  76.                     contador += 1
  77.                     dw_sol_cre.SetItem(1, "motivo_exc"+string(contador), ls_array_value[li_row])
  78.                 next
  79.                 if contador < 4 then //total de excepciones
  80.                     f_activar("motivo_exc"+string(contador+1), li_tab_order[contador+1], dw_sol_cre)
  81.                 end if
  82.             elseif UpperBound(ls_array_value) = 1 then
  83.                 dw_sol_cre.SetItem(1, "motivo_exc"+string(li_cont+1), ls_array_value[li_cont])
  84.                 f_activar("motivo_exc"+string(li_cont+2), li_tab_order[li_cont+2], dw_sol_cre)
  85.             end if
  86.         end if
  87.     else
  88.         dw_sol_cre.SetItem(1, "cre$cre_ind_gar", ls_null)
  89.     end if
  90. else
  91.     f_activar("motivo_exc1", 270, dw_sol_cre)
  92.     ib_bandera = true
  93. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement