Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. // DESACTIVA BOTON ACEPTAR
  2. ActiveDocument.Sections["Filtros"].Shapes["CommandButtonAceptar"].Enabled = false
  3. ActiveDocument.Sections["Filtros"].Shapes["CommandButtonNuevo"].Enabled = true
  4. ActiveDocument.Sections["Filtros"].Shapes["DropDown2"].Enabled =true
  5. ActiveDocument.Sections["Filtros"].Shapes["DropDown3"].Enabled = true
  6. Console.Writeln("desactiva boton aceptar");
  7.  
  8. //Dias
  9.  
  10.  
  11. for (var K = 1; K <= ListBox2.SelectedList.Count; K++)
  12. {
  13. Console.Writeln(ListBox2.SelectedList[K]);
  14. var ddia = parseInt(ListBox2.SelectedList[K],10)
  15. Console.Writeln(ddia);
  16. }
  17.  
  18. // OBTIENE VALORES DESDE DROPDOWNs PARA LIMITES
  19. var nmes = DropDown2.SelectedIndex
  20.  
  21. var sanno = DropDown3[DropDown3.SelectedIndex]
  22. Console.Writeln(sanno);
  23. Console.Writeln(nmes.toString());
  24.  
  25. var d1=ddia
  26. var d2=ddia
  27. var m1=nmes
  28. var m2=nmes
  29. var sanno2=sanno
  30.  
  31. if (nmes == 2 && ddia == 28 ) //Cambiar si el aƱo es bisiesto
  32. { d1=28
  33. m1=2
  34. d2=1
  35. m2=3
  36. }
  37. else if ((nmes == 4 || nmes == 6 || nmes == 9 || nmes == 11) && (ddia == 30) )
  38. { d1=30
  39. m1=nmes
  40. d2=1
  41. m2=nmes+1
  42. }
  43. else if (nmes==12 && ddia == 31) {
  44. d1=31
  45. m1=12
  46. d2=1
  47. m2=1
  48. nanno=parseInt(sanno)
  49. nanno=nanno+1
  50. sanno2=nanno.toString()
  51. }
  52. else if((nmes == 1 || nmes == 3 || nmes == 5 || nmes == 7 || nmes == 8 || nmes == 10) && ddia == 31){
  53. d1=31
  54. m1=nmes
  55. d2=1
  56. m2=nmes+1
  57. }else d2=ddia+1
  58.  
  59.  
  60. sd1 = d1.toString()
  61. sd2 = d2.toString()
  62. sm1 = m1.toString()
  63. sm2 = m2.toString()
  64. A1 = sd1 +'/'+ sm1 +'/'+ sanno
  65. A2 = sd2 +'/'+ sm2 +'/'+ sanno2
  66. Console.Writeln(A1);
  67. Console.Writeln(A2);
  68. // CREA LIMITES DE DIA MES Y ANNO PARA QUERY
  69.  
  70. MiLimiteStartup1 = ActiveDocument.Sections["Query"].Limits.CreateLimit("TBL_WCBCHAT_SODIMAC_CH.FECHAHORA")
  71. ActiveDocument.Sections["Query"].Limits.Add(MiLimiteStartup1)
  72. MiLimiteStartup1.Operator =bqLimitOperatorBetween
  73. Console.Writeln('antes de poner el limite')
  74. MiLimiteStartup1.CustomValues.Add(A1)
  75. MiLimiteStartup1.CustomValues.Add(A2)
  76. MiLimiteStartup1.SelectedValues.Add(A1)
  77. MiLimiteStartup1.SelectedValues.Add(A2)
  78. MiLimiteStartup1.DisplayName = "Entre"
  79. Console.Writeln("Limite 1 OK");
  80.  
  81.  
  82. // LOGIN Y PROCESO DE DATOS
  83. Console.Writeln("Login..... ");
  84. MiConnexion = ActiveDocument.Sections["Query"].DataModel.Connection;
  85. Console.Writeln("Busco en C");
  86. //MiConnexion.Open("C:\\ODBC_GEN_OPE_PE.oce");
  87. MiConnexion.Open("C:\\ODBC_GEN_OPE_CH.oce");
  88. //MiConnexion.Username = "gen_ope";
  89. MiConnexion.Username = "gen_ope";
  90. Console.Writeln("User");
  91. //MiConnexion.SetPassword("genope");
  92. MiConnexion.SetPassword("pw2I726VE");
  93. Console.Writeln("Pass");
  94. MiConnexion.Connect();
  95. Console.Writeln("Conectado..");
  96. ActiveDocument.Sections["Query"].Process();
  97. MiConnexion.Disconnect();
  98. Console.Writeln("Login OK");
  99.  
  100.  
  101.  
  102.  
  103. // MUESTRA REPORTE
  104. ActiveDocument.Sections["Informe"].Activate();
  105.  
  106. // ACTIVA
  107. ActiveDocument.Sections["Filtros"].Shapes["CommandButtonNuevo"].Enabled = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement