Example #1
0
 private void CargarDatagrid(string tipodocumento)
 {
     try
     {
         listadocumentos = LogicaCompras.obtenerDocumentoAnterior(empresa, tipodocumento);
         for (int i = 0; i < listadocumentos.Count; i++)
         {
             if (i < listadocumentos.Count)
             {
                 dtgrdDocumentos.Rows.Add();
             }
             dtgrdDocumentos[0, i].Value = listadocumentos[i].Consecutivo.ToString();
             dtgrdDocumentos[1, i].Value = listadocumentos[i].Fecha.ToString();
             dtgrdDocumentos[2, i].Value = listadocumentos[i].TipoCompra;
             dtgrdDocumentos[3, i].Value = listadocumentos[i].Proveedor.Nombre;
             dtgrdDocumentos[4, i].Value = listadocumentos[i].Proyecto.Nombre;
             dtgrdDocumentos[5, i].Value = listadocumentos[i].Moneda.Codigo;
             dtgrdDocumentos[6, i].Value = listadocumentos[i].Total.ToString();
             dtgrdDocumentos[7, i].Value = listadocumentos[i].Impuesto.ToString();
             dtgrdDocumentos[8, i].Value = listadocumentos[i].TotalJunto.ToString();
         }
         dtgrdDocumentos.Refresh();
     }
     catch (Exception e)
     {
         MessageBox.Show("No se pudo Cargar la informcación");
     }
 }
Example #2
0
        private void LLenadoTiposDocumentos()
        {
            List <string> tiposdocs = new List <string>();

            try
            {
                tiposdocs = LogicaCompras.obtenerTipoCompras();
                for (int i = 0; i < tiposdocs.Count; i++)
                {
                    cmbTiposDocumentos.Items.Add(tiposdocs[i]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se pudo obtener los tipos de Documentos.");
            }
        }
Example #3
0
        private void btnCrear_Click(object sender, EventArgs e)
        {
            try
            {
                Socio    socioesc    = socios.Find(s => s.Nombre.Equals(cmbSocios.SelectedItem.ToString()));
                Proyecto proyectoesc = proyectos.Find(a => a.Nombre.Equals(cmbProyecto.SelectedItem.ToString()));

                DataTable servicio = new DataTable();
                servicio.TableName = "@Cuentas";
                servicio.Columns.Add("Nombre", typeof(string));
                servicio.Columns.Add("Descripcion", typeof(string));
                servicio.Columns.Add("Cantidad", typeof(int));
                servicio.Columns.Add("Precio", typeof(double));
                servicio.Columns.Add("PrecioTotal", typeof(double));
                servicio.Columns.Add("Impuesto", typeof(double));
                servicio.Columns.Add("PrecioJunto", typeof(double));
                for (int i = 0; i < dtgrdServicios.Rows.Count - 1; i++)
                {
                    DataRow Fila = servicio.NewRow();
                    Fila["Nombre"]      = dtgrdServicios["Nombre", i].Value;
                    Fila["Descripcion"] = dtgrdServicios["Descripcion", i].Value;
                    Fila["Cantidad"]    = Int32.Parse(dtgrdServicios["Cantidad", i].Value.ToString());
                    Fila["Precio"]      = double.Parse(dtgrdServicios["Precio", i].Value.ToString());
                    Fila["PrecioTotal"] = double.Parse(dtgrdServicios["TotalProducto", i].Value.ToString());
                    Fila["Impuesto"]    = double.Parse(dtgrdServicios["Impuesto", i].Value.ToString());
                    Fila["PrecioJunto"] = double.Parse(dtgrdServicios["PrecioJunto", i].Value.ToString());
                    servicio.Rows.Add(Fila);
                }
                double total         = Double.Parse(this.txtTotal.Text);
                double totalImpuesto = Double.Parse(this.txtImpuesto.Text);
                double totalJunto    = Double.Parse(this.txtTotalJunto.Text);
                LogicaCompras.insertarCompra(empresa, socioesc.Codigo, proyectoesc.Codigo, cmbMonedas.SelectedItem.ToString(), cmbTiposDocumentos.SelectedItem.ToString(), total, totalImpuesto, totalJunto, servicio, this.dttmpckrFecha.Value, this.NumeroFactura);
                MessageBox.Show("La " + cmbTiposDocumentos.SelectedItem.ToString() + " se realizó exitosamente");
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se pudo crear la orden.");
            }
        }