Esempio n. 1
0
        private void CargarInformacion()
        {
            try
            {
                if (CodigoCliente.HasValue && CodigoCliente > 0)
                {
                    Int32 Codigo = Convert.ToInt32(CodigoCliente);
                    //Informacion de cuentas
                    CuentasCobrarBL ObjetoCuenta = new CuentasCobrarBL();
                    dgvCargosGenerales.AutoGenerateColumns = false;
                    dgvCargosGenerales.DataSource          = ObjetoCuenta.ListarCargosGenerales(Codigo);
                    //Informacion de Clientes
                    ClienteBL ObjetoCliente = new ClienteBL();
                    cCliente  Cliente       = ObjetoCliente.BuscarPorID(Codigo);
                    txtNombreCliente.Text = Cliente.NombreComercial.ToString();
                    txtCodigoCliente.Text = Cliente.Codigo.ToString();
                    txtBalance.Text       = Cliente.Balance.ToString("C2");
                }
                else
                {
                    //Enviamos un mensaje indicando que debe seleccionar un cliente
                    MessageBox.Show("Debe seleccionar un cliente para verificar su estado de cuenta", "Seleccione un cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //Cerramos el formulario
                    this.Close();
                }
            }

            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
Esempio n. 2
0
 private void frmInfoCliente_Load(object sender, EventArgs e)
 {
     try
     {
         ClienteBL ObjetoCliente = new ClienteBL();
         MostrarDatos(ObjetoCliente.BuscarPorID(CodigoCliente));
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 3
0
        public void BusquedaCliente(Int32 Codigo)
        {
            try
            {
                ClienteBL ObjetoCliente = new ClienteBL();
                //Buscamos la direccion del cliente y el RNC mediante su codigo unico
                cCliente Cliente = ObjetoCliente.BuscarPorID(Codigo);
                AsignarDatosCliente(Cliente);
            }

            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
Esempio n. 4
0
 private void cbbCliente_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         Int32 C;
         if (Int32.TryParse(cbbCliente.SelectedValue.ToString(), out C))
         {
             ClienteBL ObjetoCliente = new ClienteBL();
             C = Convert.ToInt32(cbbCliente.SelectedValue.ToString());
             AsignarDatosCliente(ObjetoCliente.BuscarPorID(C));
         }
     }
     catch (Exception Ex)
     {
     }
 }
Esempio n. 5
0
        private void frmAgregarEditarCliente_Load(object sender, EventArgs e)
        {
            try
            {
                CargarDependencias();
                if (Codigo.HasValue)
                {
                    ClienteBL ObjetoCliente = new ClienteBL();
                    Int32     ID            = Convert.ToInt32(Codigo);
                    MostrarDatos(ObjetoCliente.BuscarPorID(ID));

                    txtSaldo.ReadOnly = false;
                }
                else
                {
                    txtCodigoCliente.Text = "-1";
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Error editar cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
        private void BuscarFactura()
        {
            DetalleFacturaBL ObjetoDetalle = new DetalleFacturaBL();
            FacturaBL        ObjetoFactura = new FacturaBL();
            Int64            ID;

            if (txtReferencia.Text != String.Empty)
            {
                //Obtenemos el ID del Documento por medio del numero de documento
                ID = Convert.ToInt64(txtReferencia.Text);

                //Buscamos la cotizacion que tiene este numero de documento
                cFactura Factura = ObjetoFactura.BuscarPorID(ID, "F");
                //Verificamos que obtuvimos algun resultado
                if (Int64.TryParse(Factura.ID.ToString(), out ID))
                {
                    //Verificamos que la factura no este cancelada ni se encuentre devuelta
                    if (Factura.EstatusID.ToString() != "C" && Factura.EstatusID.ToString() != "D")
                    {
                        //Guardamos el ID de la FacturA
                        Int64 FacturaID = Factura.ID;
                        Int32 ClienteID = Convert.ToInt32(Factura.ClienteID);

                        //Asignamos los datos del cliente que se encuentra en la cotizacion
                        AsignarDatosCliente(ObjetoCliente.BuscarPorID(ClienteID));

                        //Buscamos la lista de Articulos que se encuentran en la cotizacion
                        List <cDetalleFactura> ListaDetalle = ObjetoDetalle.ListarDetalle(FacturaID, "F");

                        //Objeto Inventario para realizar operaciones
                        InventarioBL ObjetoInventario = new InventarioBL();
                        foreach (cDetalleFactura Detalle in ListaDetalle)
                        {
                            cInventario Articulo = ObjetoInventario.BuscarPorID(Detalle.ArticuloID);

                            //Insertamos los articulos en el DataGrid
                            InsertarLineaGrid(Detalle.ArticuloID,
                                              Articulo.CodigoArticulo,
                                              Articulo.Descripcion,
                                              Detalle.Cantidad,
                                              Detalle.Precio,
                                              Detalle.ImpuestoValor,
                                              (Detalle.ImpuestoValor / 100) * Detalle.Precio,
                                              Detalle.DescuentoValor,
                                              (Detalle.DescuentoValor / 100) * Detalle.Precio,
                                              (((Detalle.Cantidad * Detalle.Precio) - ((Detalle.DescuentoValor / 100) * Detalle.Precio)) + ((Detalle.ImpuestoValor / 100) * Detalle.Precio)),
                                              Detalle.Costo,
                                              Detalle.UnidadVentaID,
                                              Detalle.TipoProducto);
                        }
                    }
                    else
                    {
                        throw new Exception("La factura se encuentra cancelada o devuelta y no puede ser procesada");
                    }
                }
                else
                {
                    throw new Exception("La factura solicitada no se encuentra en la lista");
                }
            }
        }