Beispiel #1
0
 public void CargarConceptos(int id)
 {
     try
     {
         PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "P4");
         MyPermission.Demand();
         Presupuesto_Contenido   presupuesto = new Presupuesto_Contenido();
         Presupuesto_Contenido[] contenido   = presupuesto.TableToArray(presupuesto.SelXNumPresupuesto(id));
         for (int x = 0; x < contenido.Length; x++)
         {
             if (contenido[x].Eliminado == false)
             {
                 Concepto            n    = new Concepto(contenido[x].Numero_Concepto);
                 PresupuestoAgregado pres = (new PresupuestoAgregado()
                 {
                     ID = contenido[x].Numero_Concepto, Tipo = n.Tipo, ConceptoA = n.Nombre, ImporteA = Convert.ToDecimal(contenido[x].Costo), CantidadA = contenido[x].Cantidad, TotalA = Convert.ToDecimal(contenido[x].Total)
                 });
                 ListaConceptosAgregados.Items.Add(pres);
             }
         }
         Totalpres();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #2
0
 public void llenarReporte(string [,] A)
 {
     try
     {
         for (int x = 0; x < (A.Length / 7); x++)
         {
             PresupuestoAgregado presupuesto = new PresupuestoAgregado()
             {
                 ID = Convert.ToInt32(A[x, 0]), Tipo = A[x, 1], ConceptoA = A[x, 2], ImporteA = Convert.ToDecimal(A[x, 3]), CantidadA = Convert.ToInt32(A[x, 4]), TotalA = Convert.ToDecimal(A[x, 5])
             };
             if (A[x, 1] == "Pago de honorarios")
             {
                 pagosdehonorarios.Items.Add(presupuesto);
                 TotalA += presupuesto.TotalA;
             }
             else if (A[x, 1] == "Pagos ante ayuntamiento")
             {
                 pagosanteayuntamiento.Items.Add(presupuesto);
                 TotalB += presupuesto.TotalA;
             }
         }
         tolA.Text = "$" + TotalA.ToString();
         TolB.Text = "$" + TotalB.ToString();
         s.Text    = "Total: $" + (TotalA + TotalB).ToString();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #3
0
 public void llenarConceptos(int x)
 {
     try
     {
         PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "P4");
         MyPermission.Demand();
         string tipos = null;
         ListaConceptos.Items.Clear();
         ListaConcepto = new Concepto();
         if (x == 0)
         {
             ListConceptos = ListaConcepto.TableToArray(ListaConcepto.dtsSelNumeroNombreCostoXTipEli("Pago de honorarios", false));
             tipos         = "Pago de honorarios";
         }
         else if (x == 1)
         {
             ListConceptos = ListaConcepto.TableToArray(ListaConcepto.dtsSelNumeroNombreCostoXTipEli("Pagos ante ayuntamiento", false));
             tipos         = "Pagos ante ayuntamiento";
         }
         for (int p = 0; p < ListConceptos.Length; p++)
         {
             PresupuestoAgregado presupuesto = (new PresupuestoAgregado()
             {
                 ID = ListConceptos[p].Numero, Tipo = tipos, ConceptoA = ListConceptos[p].Nombre.ToString(), ImporteA = Convert.ToDecimal(ListConceptos[p].Costo), CantidadA = 1, TotalA = Convert.ToDecimal(ListConceptos[p].Costo), eliminado = ListConceptos[p].Eliminado
             });
             bool esta = false;
             for (int c = 0; c < ListaConceptosAgregados.Items.Count; c++)
             {
                 PresupuestoAgregado agregado = (PresupuestoAgregado)ListaConceptosAgregados.Items[c];
                 if (agregado.ID == presupuesto.ID)
                 {
                     esta = true;
                     break;
                 }
             }
             if (esta == false)
             {
                 ListaConceptos.Items.Add(presupuesto);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #4
0
 private void TxtTotalAgregado_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         TextBox ttotal = (TextBox)sender;
         if (decimal.TryParse(ttotal.Text.Trim(), out decimal total))
         {
             Grid grid             = (Grid)ttotal.Parent;
             PresupuestoAgregado p = (PresupuestoAgregado)grid.DataContext;
             if (p != null)
             {
                 p.TotalA = total;
                 Totalpres();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #5
0
 public void Totalpres()
 {
     try
     {
         decimal subtotal = 0.00m, tol = 0.00m;
         Total.Text    = "0.00";
         SubTotal.Text = "0.00";
         for (int x = 0; x < ListaConceptosAgregados.Items.Count; x++)
         {
             PresupuestoAgregado p = (PresupuestoAgregado)ListaConceptosAgregados.Items[x];
             subtotal += Convert.ToDecimal(p.TotalA);
         }
         SubTotal.Text = subtotal.ToString();
         tol           = Decimal.Round(subtotal + (subtotal * 0.16m), 2);
         Total.Text    = tol.ToString();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #6
0
 private void BtnAgregar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "P1");
         MyPermission.Demand();
         Button button         = (Button)sender;
         Grid   grid           = (Grid)button.Parent;
         PresupuestoAgregado P = (PresupuestoAgregado)grid.DataContext;
         if (P != null)
         {
             ListaConceptosAgregados.Items.Add(P);
             ListaConceptos.Items.Remove(P);
             Totalpres();
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #7
0
 private void BtnQuitar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Button button         = (Button)sender;
         Grid   grid           = (Grid)button.Parent;
         PresupuestoAgregado P = (PresupuestoAgregado)grid.DataContext;
         if (P != null)
         {
             ListaConceptosAgregados.Items.Remove(P);
             Totalpres();
             if (P.Tipo == OpcionesTipo.Text)
             {
                 ListaConceptos.Items.Add(P);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #8
0
 private void Btn_GenerarPresupuesto_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         PrincipalPermission MyPermission = new PrincipalPermission(NombreUsuario, "P1");
         MyPermission.Demand();
         string[,] vs        = new string[ListaConceptosAgregados.Items.Count, 7];
         datosPresupuesto[0] = TXT_Propietario.Text;
         datosPresupuesto[1] = TXT_Solicitante.Text;
         datosPresupuesto[3] = TXT_Metros.Text;
         for (int x = 0; x < ListaConceptosAgregados.Items.Count; x++)
         {
             PresupuestoAgregado presupuestoAgregado = (PresupuestoAgregado)ListaConceptosAgregados.Items[x];
             vs[x, 0] = presupuestoAgregado.ID.ToString();
             vs[x, 1] = presupuestoAgregado.Tipo;
             vs[x, 2] = presupuestoAgregado.ConceptoA.ToString();
             vs[x, 3] = presupuestoAgregado.ImporteA.ToString();
             vs[x, 4] = presupuestoAgregado.CantidadA.ToString();
             vs[x, 5] = presupuestoAgregado.TotalA.ToString();
             vs[x, 6] = presupuestoAgregado.eliminado.ToString();
         }
         if (idpresupuesto == 0)
         {
             idpresupuesto = presupuesto.Insertar(TXT_Etiqueta.Text, TXT_Solicitante.Text, TXT_Propietario.Text, TXT_Genero.Text, Convert.ToDecimal(TXT_Metros.Text), Convert.ToDecimal(Total.Text), EstadoPresupuesto.SelectedIndex, IdTipodeproyecto, 1);
         }
         if (idpresupuesto != 0)
         {
             IngresarDatos(vs);
             PresupuestoLicenciaConstrucción construcción = new PresupuestoLicenciaConstrucción(idpresupuesto, vs, datosPresupuesto);
             construcción.ShowDialog();
         }
         else
         {
             MessageBox.Show(presupuesto.Mensaje);
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #9
0
 private void TxtPrecioAgregado_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         TextBox tprecio = (TextBox)sender;
         if (decimal.TryParse(tprecio.Text.Trim(), out decimal precio))
         {
             Grid grid             = (Grid)tprecio.Parent;
             PresupuestoAgregado p = (PresupuestoAgregado)grid.DataContext;
             if (p != null)
             {
                 TextBox total = (TextBox)grid.Children[3];
                 p.ImporteA = precio;
                 p.TotalA   = p.CantidadA * p.ImporteA;
                 total.Text = p.TotalA.ToString();
                 Totalpres();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }