]> git.llucax.com Git - z.facultad/75.10/miklolife.git/commitdiff
Hermosa ventana de consultar autorizaciones. Descubri que no se estan aprobando :S
authorRicardo Markiewicz <gazer.arg@gmail.com>
Thu, 7 Jul 2005 06:46:19 +0000 (06:46 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Thu, 7 Jul 2005 06:46:19 +0000 (06:46 +0000)
demo/glade/consultar_autorizacion.glade
demo/glade/main.glade
demo/src/Controlador/AutorizacionController.cs
demo/src/Main.cs
demo/src/Vistas/ConsultarAutorizaciones.cs [new file with mode: 0644]

index 1c2d31e8600efa3780e512c78cbfe01997471f81..077dd3de588fdeea79c7fe31c1bf39240179b592 100644 (file)
@@ -91,6 +91,7 @@
                          <property name="can_focus">True</property>
                          <property name="relief">GTK_RELIEF_NORMAL</property>
                          <property name="focus_on_click">True</property>
+                         <signal name="clicked" handler="BuscarPorAfiliado" last_modification_time="Thu, 07 Jul 2005 05:44:20 GMT"/>
 
                          <child>
                            <widget class="GtkAlignment" id="alignment12">
                          <property name="can_focus">True</property>
                          <property name="relief">GTK_RELIEF_NORMAL</property>
                          <property name="focus_on_click">True</property>
+                         <signal name="clicked" handler="BuscarPorCodigo" last_modification_time="Thu, 07 Jul 2005 05:44:41 GMT"/>
 
                          <child>
                            <widget class="GtkAlignment" id="alignment13">
                          <property name="can_focus">True</property>
                          <property name="relief">GTK_RELIEF_NORMAL</property>
                          <property name="focus_on_click">True</property>
+                         <signal name="clicked" handler="BuscarPorAuditor" last_modification_time="Thu, 07 Jul 2005 05:45:08 GMT"/>
 
                          <child>
                            <widget class="GtkAlignment" id="alignment14">
                          <property name="can_focus">True</property>
                          <property name="relief">GTK_RELIEF_NORMAL</property>
                          <property name="focus_on_click">True</property>
+                         <signal name="clicked" handler="BuscarPorFecha" last_modification_time="Thu, 07 Jul 2005 05:45:23 GMT"/>
 
                          <child>
                            <widget class="GtkAlignment" id="alignment15">
              <child>
                <widget class="GtkLabel" id="label34">
                  <property name="visible">True</property>
-                 <property name="label" translatable="yes">&lt;b&gt;Búesquedas&lt;/b&gt;</property>
+                 <property name="label" translatable="yes">&lt;b&gt;Búsquedas&lt;/b&gt;</property>
                  <property name="use_underline">False</property>
                  <property name="use_markup">True</property>
                  <property name="justify">GTK_JUSTIFY_LEFT</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry1">
+                               <widget class="GtkEntry" id="auth_codigo">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry2">
+                               <widget class="GtkEntry" id="auth_fecha">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
                                  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
 
                                  <child>
-                                   <widget class="GtkTextView" id="textview2">
+                                   <widget class="GtkTextView" id="auth_obs">
                                      <property name="visible">True</property>
                                      <property name="can_focus">True</property>
-                                     <property name="editable">True</property>
+                                     <property name="editable">False</property>
                                      <property name="overwrite">False</property>
                                      <property name="accepts_tab">True</property>
                                      <property name="justification">GTK_JUSTIFY_LEFT</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry4">
+                               <widget class="GtkEntry" id="prestacion_codigo">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry5">
+                               <widget class="GtkEntry" id="prestacion_nombre">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry6">
+                               <widget class="GtkEntry" id="prestador_cuit">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry7">
+                               <widget class="GtkEntry" id="prestador_nombre">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry8">
+                               <widget class="GtkEntry" id="prestador_email">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
                          <child>
                            <widget class="GtkTable" id="table2">
                              <property name="visible">True</property>
-                             <property name="n_rows">5</property>
+                             <property name="n_rows">4</property>
                              <property name="n_columns">2</property>
                              <property name="homogeneous">False</property>
                              <property name="row_spacing">8</property>
                                </packing>
                              </child>
 
-                             <child>
-                               <widget class="GtkLabel" id="label12">
-                                 <property name="visible">True</property>
-                                 <property name="label" translatable="yes">Sexo : </property>
-                                 <property name="use_underline">False</property>
-                                 <property name="use_markup">False</property>
-                                 <property name="justify">GTK_JUSTIFY_LEFT</property>
-                                 <property name="wrap">False</property>
-                                 <property name="selectable">False</property>
-                                 <property name="xalign">0</property>
-                                 <property name="yalign">0.5</property>
-                                 <property name="xpad">0</property>
-                                 <property name="ypad">0</property>
-                                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                                 <property name="width_chars">-1</property>
-                                 <property name="single_line_mode">False</property>
-                                 <property name="angle">0</property>
-                               </widget>
-                               <packing>
-                                 <property name="left_attach">0</property>
-                                 <property name="right_attach">1</property>
-                                 <property name="top_attach">4</property>
-                                 <property name="bottom_attach">5</property>
-                                 <property name="x_options">fill</property>
-                                 <property name="y_options"></property>
-                               </packing>
-                             </child>
-
-                             <child>
-                               <widget class="GtkHBox" id="hbox2">
-                                 <property name="visible">True</property>
-                                 <property name="homogeneous">True</property>
-                                 <property name="spacing">0</property>
-
-                                 <child>
-                                   <widget class="GtkRadioButton" id="sexom">
-                                     <property name="visible">True</property>
-                                     <property name="can_focus">True</property>
-                                     <property name="label" translatable="yes">Masculino</property>
-                                     <property name="use_underline">True</property>
-                                     <property name="relief">GTK_RELIEF_NORMAL</property>
-                                     <property name="focus_on_click">True</property>
-                                     <property name="active">False</property>
-                                     <property name="inconsistent">False</property>
-                                     <property name="draw_indicator">True</property>
-                                   </widget>
-                                   <packing>
-                                     <property name="padding">0</property>
-                                     <property name="expand">True</property>
-                                     <property name="fill">True</property>
-                                   </packing>
-                                 </child>
-
-                                 <child>
-                                   <widget class="GtkRadioButton" id="sexof">
-                                     <property name="visible">True</property>
-                                     <property name="can_focus">True</property>
-                                     <property name="label" translatable="yes">Femenino</property>
-                                     <property name="use_underline">True</property>
-                                     <property name="relief">GTK_RELIEF_NORMAL</property>
-                                     <property name="focus_on_click">True</property>
-                                     <property name="active">False</property>
-                                     <property name="inconsistent">False</property>
-                                     <property name="draw_indicator">True</property>
-                                     <property name="group">sexom</property>
-                                   </widget>
-                                   <packing>
-                                     <property name="padding">0</property>
-                                     <property name="expand">True</property>
-                                     <property name="fill">True</property>
-                                   </packing>
-                                 </child>
-                               </widget>
-                               <packing>
-                                 <property name="left_attach">1</property>
-                                 <property name="right_attach">2</property>
-                                 <property name="top_attach">4</property>
-                                 <property name="bottom_attach">5</property>
-                                 <property name="x_options">fill</property>
-                                 <property name="y_options">fill</property>
-                               </packing>
-                             </child>
-
                              <child>
                                <widget class="GtkHBox" id="hbox3">
                                  <property name="visible">True</property>
                                  <property name="spacing">0</property>
 
                                  <child>
-                                   <widget class="GtkComboBox" id="tipoDoc">
-                                     <property name="visible">True</property>
-                                     <property name="items" translatable="yes">DNI
-LC
-LE
-CI</property>
-                                     <property name="add_tearoffs">False</property>
-                                     <property name="focus_on_click">True</property>
-                                   </widget>
-                                   <packing>
-                                     <property name="padding">0</property>
-                                     <property name="expand">False</property>
-                                     <property name="fill">True</property>
-                                   </packing>
-                                 </child>
-
-                                 <child>
-                                   <widget class="GtkEntry" id="nroDoc">
+                                   <widget class="GtkEntry" id="afiliado_documento">
                                      <property name="visible">True</property>
                                      <property name="can_focus">True</property>
                                      <property name="editable">False</property>
@@ -1298,7 +1202,7 @@ CI</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="apellido">
+                               <widget class="GtkEntry" id="afiliado_apellido">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
@@ -1320,7 +1224,7 @@ CI</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="nombre">
+                               <widget class="GtkEntry" id="afiliado_nombre">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
@@ -1369,7 +1273,7 @@ CI</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry11">
+                               <widget class="GtkEntry" id="afiliado_codigo">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
@@ -1443,9 +1347,9 @@ CI</property>
                          <property name="right_padding">0</property>
 
                          <child>
-                           <widget class="GtkLabel" id="label24">
+                           <widget class="GtkLabel" id="tipo_auth">
                              <property name="visible">True</property>
-                             <property name="label" translatable="yes">[Manual|Automática]</property>
+                             <property name="label" translatable="yes"></property>
                              <property name="use_underline">False</property>
                              <property name="use_markup">False</property>
                              <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1551,7 +1455,7 @@ CI</property>
                              </child>
 
                              <child>
-                               <widget class="GtkEntry" id="entry10">
+                               <widget class="GtkEntry" id="fecha_res">
                                  <property name="visible">True</property>
                                  <property name="can_focus">True</property>
                                  <property name="editable">False</property>
@@ -1600,9 +1504,9 @@ CI</property>
                              </child>
 
                              <child>
-                               <widget class="GtkLabel" id="label31">
+                               <widget class="GtkLabel" id="estado">
                                  <property name="visible">True</property>
-                                 <property name="label" translatable="yes">[Pendiente|Aprobada|Rechazada]</property>
+                                 <property name="label" translatable="yes"></property>
                                  <property name="use_underline">False</property>
                                  <property name="use_markup">False</property>
                                  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1665,10 +1569,10 @@ CI</property>
                                  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
 
                                  <child>
-                                   <widget class="GtkTextView" id="textview1">
+                                   <widget class="GtkTextView" id="fundamento_res">
                                      <property name="visible">True</property>
                                      <property name="can_focus">True</property>
-                                     <property name="editable">True</property>
+                                     <property name="editable">False</property>
                                      <property name="overwrite">False</property>
                                      <property name="accepts_tab">True</property>
                                      <property name="justification">GTK_JUSTIFY_LEFT</property>
@@ -1722,9 +1626,9 @@ CI</property>
                              </child>
 
                              <child>
-                               <widget class="GtkLabel" id="label40">
+                               <widget class="GtkLabel" id="auditor">
                                  <property name="visible">True</property>
-                                 <property name="label" translatable="yes">Apellido y Nombre</property>
+                                 <property name="label" translatable="yes"></property>
                                  <property name="use_underline">False</property>
                                  <property name="use_markup">False</property>
                                  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1805,7 +1709,7 @@ CI</property>
              <property name="spacing">8</property>
 
              <child>
-               <widget class="GtkButton" id="button11">
+               <widget class="GtkButton" id="primero">
                  <property name="visible">True</property>
                  <property name="can_default">True</property>
                  <property name="can_focus">True</property>
@@ -1813,11 +1717,12 @@ CI</property>
                  <property name="use_underline">True</property>
                  <property name="relief">GTK_RELIEF_NORMAL</property>
                  <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="OnMove" last_modification_time="Thu, 07 Jul 2005 06:20:49 GMT"/>
                </widget>
              </child>
 
              <child>
-               <widget class="GtkButton" id="button12">
+               <widget class="GtkButton" id="anterior">
                  <property name="visible">True</property>
                  <property name="can_default">True</property>
                  <property name="can_focus">True</property>
@@ -1825,11 +1730,12 @@ CI</property>
                  <property name="use_underline">True</property>
                  <property name="relief">GTK_RELIEF_NORMAL</property>
                  <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="OnMove" last_modification_time="Thu, 07 Jul 2005 06:20:42 GMT"/>
                </widget>
              </child>
 
              <child>
-               <widget class="GtkButton" id="button13">
+               <widget class="GtkButton" id="siguiente">
                  <property name="visible">True</property>
                  <property name="can_default">True</property>
                  <property name="can_focus">True</property>
@@ -1837,11 +1743,12 @@ CI</property>
                  <property name="use_underline">True</property>
                  <property name="relief">GTK_RELIEF_NORMAL</property>
                  <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="OnMove" last_modification_time="Thu, 07 Jul 2005 06:20:34 GMT"/>
                </widget>
              </child>
 
              <child>
-               <widget class="GtkButton" id="button14">
+               <widget class="GtkButton" id="ultimo">
                  <property name="visible">True</property>
                  <property name="can_default">True</property>
                  <property name="can_focus">True</property>
@@ -1849,6 +1756,7 @@ CI</property>
                  <property name="use_underline">True</property>
                  <property name="relief">GTK_RELIEF_NORMAL</property>
                  <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="OnMove" last_modification_time="Thu, 07 Jul 2005 06:20:23 GMT"/>
                </widget>
              </child>
            </widget>
index 1510b77955505759d9e1fdbb71de978c831a0f93..8fc7c486cb26b8b7439c7ecb48aeb6bfe7f6cfc6 100644 (file)
              <child>
                <widget class="GtkMenu" id="consultas1_menu">
 
+                 <child>
+                   <widget class="GtkMenuItem" id="consultar_autorizaciones1">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Consultar Autorizaciones</property>
+                     <property name="use_underline">True</property>
+                     <signal name="activate" handler="OnConsultarAutorizaciones" last_modification_time="Thu, 07 Jul 2005 05:57:08 GMT"/>
+                   </widget>
+                 </child>
+
                  <child>
                    <widget class="GtkMenuItem" id="consultar_afiliado1">
                      <property name="visible">True</property>
index 654ca0b6e7860f14fb4ff49fe073eb8473e70fbb..4265fb08a8e2cf4397f1a4b2c0abc8491fef9b06 100644 (file)
@@ -183,7 +183,19 @@ namespace Controlador
 
                        return ObjectSetToArrayList (result);
                }
-\r
+
+               public ArrayList obtenerAutorizacionesPorAfiliado (int codafiliado)
+               {       
+                       Afiliado a = new Afiliado (codafiliado);
+       
+                       Query query = Db.query();
+                       query.constrain(typeof(Autorizacion));
+                       query.descend("_afiliado").constrain(a);
+
+                       ObjectSet result = query.execute ();
+
+                       return ObjectSetToArrayList (result);
+               }
                //PRE: El codigo solicitado tiene que ser de una autorizacion manual.\r
                public bool  setResolucionAutorizacionManual(int codAutorizacion, \r
                        String fundamentosResolucion, float porcentaje)\r
index e3085afb52868f701b8f65b6472b2a6a008bb9ec..37e797eadf4ea36b0352e974ac5b802e6becce15 100644 (file)
@@ -177,5 +177,11 @@ public class App
                VConsultarAfiliado v = new VConsultarAfiliado ();
                v.Run ();
        }
+
+       public void OnConsultarAutorizaciones (object o, EventArgs args)
+       {
+               VConsultarAutorizaciones v = new VConsultarAutorizaciones ();
+               v.Run ();
+       }
 }
 
diff --git a/demo/src/Vistas/ConsultarAutorizaciones.cs b/demo/src/Vistas/ConsultarAutorizaciones.cs
new file mode 100644 (file)
index 0000000..a146b49
--- /dev/null
@@ -0,0 +1,176 @@
+
+using System;
+using System.Collections;
+using Gtk;
+using Glade;
+
+using Controlador.Afiliacion;
+using Controlador;
+using Dominio.Autorizaciones;
+using Dominio.Planes;
+using Dominio.Afiliados;
+using Dominio;
+
+public class VConsultarAutorizaciones
+{
+       Glade.XML xml;
+
+       /* Campos de datos */
+       [Widget] Entry afiliado_documento;
+       [Widget] Entry afiliado_apellido;
+       [Widget] Entry afiliado_nombre;
+       [Widget] Entry afiliado_codigo;
+       [Widget] Entry auth_codigo;
+       [Widget] Entry auth_fecha;
+       [Widget] TextView auth_obs;
+       [Widget] Entry prestacion_nombre;
+       [Widget] Entry prestacion_codigo;
+       [Widget] Entry prestador_cuit;
+       [Widget] Entry prestador_nombre;
+       [Widget] Entry prestador_email;
+       [Widget] Label tipo_auth;
+       [Widget] Label auditor;
+       [Widget] Label estado;
+       [Widget] Entry fecha_res;
+       [Widget] TextView fundamento_res;
+
+       /* Botones */
+       [Widget] Button primero;
+       [Widget] Button anterior;
+       [Widget] Button siguiente;
+       [Widget] Button ultimo;
+
+       ArrayList autorizaciones;
+       int actualpos = 0;
+
+       public VConsultarAutorizaciones ()
+       {
+               xml = new Glade.XML (null, "consultar_autorizacion.glade", "consultar_autorizacion", null);
+               xml.Autoconnect (this);
+       }
+
+       public void BuscarPorAfiliado (object o, EventArgs args)
+       {
+               AutorizacionController c = new AutorizacionController (DateTime.Now);
+
+               VBuscarAfiliado v = new VBuscarAfiliado ();
+               string r = v.Run ();
+               if (r == null)
+                       return;
+
+               autorizaciones = c.obtenerAutorizacionesPorAfiliado (Int32.Parse (r));
+
+               c.Dispose ();
+
+               actualpos = 0;
+               Mostrar ();
+       }
+
+       public void BuscarPorCodigo (object o, EventArgs args)
+       {
+       }
+
+       public void BuscarPorAuditor (object o, EventArgs args)
+       {
+       }
+
+       public void BuscarPorFecha (object o, EventArgs args)
+       {
+       }
+
+       private void SetButton (bool p, bool a, bool s, bool u)
+       {
+               primero.Sensitive = p;
+               anterior.Sensitive = a;
+               siguiente.Sensitive = s;
+               ultimo.Sensitive = u;
+       }
+
+       private void UpdateButtons ()
+       {
+               if (autorizaciones == null) {
+                       SetButton (false, false, false, false);
+                       return;
+               }
+               if (autorizaciones.Count == 1) {
+                       SetButton (false, false, false, false);
+                       return;
+               }
+               if (actualpos == 0) {
+                       SetButton (false, false, true, true);
+                       return;
+               }
+               if (actualpos == (autorizaciones.Count - 1)) {
+                       SetButton (true, true, false, false);
+                       return;
+               }
+               SetButton (true, true, true, true);
+       }
+
+       public void OnMove (object o, EventArgs args)
+       {
+               if (autorizaciones == null) {
+                       UpdateButtons ();
+                       return;
+               }
+               if (o == primero) actualpos = 0;
+               if (o == anterior) actualpos--;
+               if (o == siguiente) actualpos++;
+               if (o == ultimo) actualpos = autorizaciones.Count - 1;
+
+               if (actualpos < 0) actualpos = 0;
+               if (actualpos >= autorizaciones.Count) actualpos = autorizaciones.Count - 1;
+       
+               Mostrar ();
+       }
+       
+       private void Mostrar ()
+       {
+               if (autorizaciones == null) return;
+
+               Autorizacion auth;
+               try {
+                       auth = autorizaciones[actualpos] as Autorizacion;
+               } catch (Exception e) {
+                       UpdateButtons ();
+                       return;
+               }
+
+               afiliado_documento.Text = String.Format ("{0} {1}", auth.Afiliado.TipoDocumento, auth.Afiliado.NroDocumento);
+               afiliado_apellido.Text = auth.Afiliado.Apellido;
+               afiliado_nombre.Text = auth.Afiliado.Nombre;
+               afiliado_codigo.Text = String.Format ("{0}", auth.Afiliado.Codigo);
+               auth_codigo.Text = String.Format ("{0}", auth.Codigo);
+               auth_fecha.Text = auth.FechaSolicitud.ToString ();
+               if (auth is AutorizacionManual)
+                       auth_obs.Buffer.Text = (auth as AutorizacionManual).Observaciones;
+               prestacion_nombre.Text = auth.Prestacion.Nombre;
+               prestacion_codigo.Text = auth.Prestacion.Codigo;
+               prestador_cuit.Text = auth.Prestador.Cuit;
+               prestador_nombre.Text = auth.Prestador.Nombre;
+               prestador_email.Text = auth.Prestador.Email;
+               if (auth is AutorizacionManual)
+                       tipo_auth.Text = "Manual";
+               else
+                       tipo_auth.Text = "Automatica";
+               auditor.Text = "Auditor Medico";
+               estado.Text = auth.getEstado (DateTime.Now).ToString ();
+               
+               if (auth is AutorizacionManual) {
+                       DateTime t = (auth as AutorizacionManual).FechaResolucion;
+                       if (t != DateTime.MinValue)
+                               fecha_res.Text = t.ToString ();
+               }
+               /*      [Widget] TextView fundamento_res;*/
+
+               UpdateButtons ();
+       }
+
+       public void Run ()
+       {
+               Dialog w = (Dialog)xml.GetWidget ("consultar_autorizacion");
+               w.Run ();
+               w.Destroy ();
+       }
+}
+