Advertisement
Guest User

Untitled

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