Exemple #1
0
        public ActionResult EnviarCorreo()
        {
            clsCotizacion ObjCotizacion = new clsCotizacion();

            ViewBag.Lista = ObjCotizacion.ConsultaCorreoProveedor().ToList();
            return(View());
        }
Exemple #2
0
        public ActionResult Index()
        {
            try
            {
                List <Cotizacion> listaCotizacion = new List <Cotizacion>();
                clsCotizacion     cliente         = new clsCotizacion();
                var data = cliente.ConsultarCotizacion().ToList();

                foreach (var item in data)
                {
                    Cotizacion modelo = new Cotizacion();
                    modelo.idCotizacion               = item.idCotizacion;
                    modelo.idColaborador              = item.idColaborador;
                    modelo.nombreProductoCotizacion   = item.nombreProductoCotizacion;
                    modelo.cantidadProductoCotizacion = item.cantidadProductoCotizacion;
                    modelo.detalleCotizacion          = item.detalleCotizacion;
                    modelo.estadoCotizacion           = item.estadoCotizacion;

                    listaCotizacion.Add(modelo);
                }
                return(View(listaCotizacion));
            }
            catch
            {
                string descMsg = "Error consultando la informacion del CLiente.";
                //Bitacora
                return(RedirectToAction("Error", "Error"));
            }
        }
        //// POST: Cotizacion/Edit/5
        //[HttpPost]
        //public ActionResult Edit(int id, FormCollection collection)
        //{
        //    try
        //    {
        //        // TODO: Add update logic here

        //        return RedirectToAction("Index");
        //    }
        //    catch
        //    {
        //        return View();
        //    }
        //}

        // GET: Cotizacion/Delete/5
        public ActionResult Deshabilitar(int id)
        {
            if (Session["ROLES"].Equals("Admin"))
            {
                string            message = "¿Desea deshabilitar este elemento?";
                string            title   = "Deshabilitar elemento.";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult      result  = MessageBox.Show(message, title, buttons);

                if (result == DialogResult.Yes)
                {
                    clsCotizacion ObjCotizacion = new clsCotizacion();
                    ObjCotizacion.DeshabilitarCotizacion(id);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                TempData["alertaMensaje"] = "El usuario con el que ha ingresado no tiene permiso para realizar esta operación.";
                return(RedirectToAction("Index"));
            }
        }
Exemple #4
0
        public Boolean insert(clsCotizacion cotizacion)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("GuardaCotizacion", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter oParam;
                oParam = cmd.Parameters.AddWithValue("codSu", cotizacion.CodSucursal);
                oParam = cmd.Parameters.AddWithValue("codalma", cotizacion.CodAlmacen);
                oParam = cmd.Parameters.AddWithValue("tipocliente", cotizacion.TipoCliente);
                if (cotizacion.CodCliente != 0)
                {
                    oParam = cmd.Parameters.AddWithValue("codcli", cotizacion.CodCliente);
                }
                else
                {
                    oParam = cmd.Parameters.AddWithValue("codcli", null);
                }
                oParam           = cmd.Parameters.AddWithValue("docref", cotizacion.DocRef);
                oParam           = cmd.Parameters.AddWithValue("moneda", cotizacion.Moneda);
                oParam           = cmd.Parameters.AddWithValue("codlista", cotizacion.CodListaPrecio);
                oParam           = cmd.Parameters.AddWithValue("tipocambio", cotizacion.TipoCambio);
                oParam           = cmd.Parameters.AddWithValue("fechacotizacion", cotizacion.FechaCotizacion);
                oParam           = cmd.Parameters.AddWithValue("auto", cotizacion.CodAutorizado);
                oParam           = cmd.Parameters.AddWithValue("comentario", cotizacion.Comentario);
                oParam           = cmd.Parameters.AddWithValue("vigencia", cotizacion.Vigencia);
                oParam           = cmd.Parameters.AddWithValue("fechavigencia", cotizacion.FechaVigencia);
                oParam           = cmd.Parameters.AddWithValue("bruto", cotizacion.MontoBruto);
                oParam           = cmd.Parameters.AddWithValue("montodscto", cotizacion.MontoDscto);
                oParam           = cmd.Parameters.AddWithValue("igv", cotizacion.Igv);
                oParam           = cmd.Parameters.AddWithValue("total", cotizacion.Total);
                oParam           = cmd.Parameters.AddWithValue("formapago", cotizacion.FormaPago);
                oParam           = cmd.Parameters.AddWithValue("fechapago", cotizacion.FechaPago);
                oParam           = cmd.Parameters.AddWithValue("codusu", cotizacion.CodUser);
                oParam           = cmd.Parameters.AddWithValue("newid", 0);
                oParam.Direction = ParameterDirection.Output;
                int x = cmd.ExecuteNonQuery();

                cotizacion.CodCotizacion = Convert.ToString(cmd.Parameters["newid"].Value);

                if (x != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Exemple #5
0
 // GET: Cotizacion/Delete/5
 public ActionResult Deshabilitar(int id)
 {
     if (Session["ROLES"].Equals("Admin"))
     {
         clsCotizacion ObjCotizacion = new clsCotizacion();
         ObjCotizacion.DeshabilitarCotizacion(id);
         return(RedirectToAction("Index"));
     }
     TempData["alertaMensaje"] = "El usuario con el que ha ingresado no tiene permiso para realizar esta operación.";
     return(RedirectToAction("Index"));
 }
Exemple #6
0
 public Boolean update(clsCotizacion cotizacion)
 {
     try
     {
         return(Mcotizacion.update(cotizacion));
     }
     catch (Exception ex)
     {
         DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
 }
Exemple #7
0
        public clsCotizacion BuscaCotizacion(String CodCotizacion, Int32 CodAlmacen)
        {
            clsCotizacion cotizacion = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("BuscaCotizacion", con.conector);
                cmd.Parameters.AddWithValue("codpe", Convert.ToInt32(CodCotizacion));
                cmd.Parameters.AddWithValue("codalm", CodAlmacen);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        cotizacion = new clsCotizacion();
                        cotizacion.CodCotizacion       = dr.GetString(0);
                        cotizacion.TipoCliente         = Convert.ToInt32(dr.GetString(1));
                        cotizacion.CodCliente          = Convert.ToInt32(dr.GetString(2));
                        cotizacion.DNI                 = dr.GetString(3);
                        cotizacion.RUCCliente          = dr.GetString(4);
                        cotizacion.CodigoPersonalizado = dr.GetString(5);
                        cotizacion.RazonSocialCliente  = dr.GetString(6);
                        cotizacion.Nombre              = dr.GetString(7);
                        cotizacion.Direccion           = dr.GetString(8);
                        cotizacion.Moneda              = Convert.ToInt32(dr.GetString(9));
                        cotizacion.TipoCambio          = dr.GetDecimal(10);
                        cotizacion.FechaCotizacion     = dr.GetDateTime(11);
                        cotizacion.Comentario          = dr.GetString(12);
                        cotizacion.MontoBruto          = dr.GetDecimal(13);
                        cotizacion.MontoDscto          = dr.GetDecimal(14);
                        cotizacion.Igv                 = dr.GetDecimal(15);
                        cotizacion.Total               = dr.GetDecimal(16);
                        cotizacion.Estado              = Convert.ToInt32(dr.GetDecimal(17));
                        cotizacion.FormaPago           = Convert.ToInt32(dr.GetString(18));
                        cotizacion.FechaPago           = dr.GetDateTime(19);
                        cotizacion.CodUser             = Convert.ToInt32(dr.GetDecimal(20));
                        cotizacion.FechaRegistro       = dr.GetDateTime(21);
                        cotizacion.Vigencia            = Convert.ToInt32(dr.GetDecimal(22));
                        cotizacion.FechaVigencia       = dr.GetDateTime(23);
                        cotizacion.CodListaPrecio      = Convert.ToInt32(dr.GetString(24));
                    }
                }
                return(cotizacion);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Exemple #8
0
        private void CargaPedido()
        {
            try
            {
                pedido = AdmPedido.CargaEntrega(Convert.ToInt32(CodPedido));
                if (pedido != null)
                {
                    txtPedido.Text = pedido.CodPedido;
                    if (pedido.CodCotizacion != 0)
                    {
                        coti = AdmCot.CargaCotizacion(pedido.CodCotizacion, frmLogin.iCodAlmacen);
                        txtCotizacion.Text = coti.CodCotizacion;
                    }

                    if (txtCodCliente.Enabled)
                    {
                        CodVendedor           = pedido.CodCliente;
                        txtCodCliente.Text    = pedido.CodigoPersonalizado;
                        txtNombreCliente.Text = pedido.Nombre;
                        txtDireccion.Text     = pedido.Direccion;
                    }
                    dtpFecha.Value               = pedido.FechaPedido;
                    cmbMoneda.SelectedIndex      = pedido.Moneda;
                    txtTipoCambio.Text           = pedido.TipoCambio.ToString();
                    cbListaPrecios.SelectedValue = pedido.CodListaPrecio;
                    if (txtDocRef.Enabled)
                    {
                        CodDocumento     = pedido.CodTipoDocumento;
                        txtDocRef.Text   = pedido.SiglaDocumento;
                        lbDocumento.Text = pedido.DescripcionDocumento;
                    }
                    txtComentario.Text  = pedido.Comentario;
                    txtBruto.Text       = String.Format("{0:#,##0.00}", pedido.MontoBruto);
                    txtDscto.Text       = String.Format("{0:#,##0.00}", pedido.MontoDscto);
                    txtValorVenta.Text  = String.Format("{0:#,##0.00}", pedido.Total - pedido.Igv);
                    txtIGV.Text         = String.Format("{0:#,##0.00}", pedido.Igv);
                    txtPrecioVenta.Text = String.Format("{0:#,##0.00}", pedido.Total);
                    textBox1.Text       = pedido.SEntregado;

                    CargaDetalle();
                }
                else
                {
                    MessageBox.Show("El documento solicitado no existe", "Nota de Ingreso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                return;
            }
        }
Exemple #9
0
 private Boolean BuscaCotizacion()
 {
     coti = AdmCot.BuscaCotizacion(txtCotizacion.Text, frmLogin.iCodAlmacen);
     if (coti != null)
     {
         CodCotizacion = Convert.ToInt32(coti.CodCotizacion);
         return(true);
     }
     else
     {
         CodCotizacion = 0;
         return(false);
     }
 }
Exemple #10
0
        public Boolean update(clsCotizacion cotizacion)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("ActualizaCotizacion", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("codCotizacion", Convert.ToInt32(cotizacion.CodCotizacion));
                cmd.Parameters.AddWithValue("codalma", cotizacion.CodAlmacen);
                cmd.Parameters.AddWithValue("tipocliente", cotizacion.TipoCliente);
                if (cotizacion.CodCliente != 0)
                {
                    cmd.Parameters.AddWithValue("codcli", cotizacion.CodCliente);
                }
                else
                {
                    cmd.Parameters.AddWithValue("codcli", null);
                }
                cmd.Parameters.AddWithValue("moneda", cotizacion.Moneda);
                cmd.Parameters.AddWithValue("codlista", cotizacion.CodListaPrecio);
                cmd.Parameters.AddWithValue("tipocambio", cotizacion.TipoCambio);
                cmd.Parameters.AddWithValue("fechacotizacion", cotizacion.FechaCotizacion);
                cmd.Parameters.AddWithValue("auto", cotizacion.CodAutorizado);
                cmd.Parameters.AddWithValue("comentario", cotizacion.Comentario);
                cmd.Parameters.AddWithValue("vigencia", cotizacion.Vigencia);
                cmd.Parameters.AddWithValue("fechavigencia", cotizacion.FechaVigencia);
                cmd.Parameters.AddWithValue("bruto", cotizacion.MontoBruto);
                cmd.Parameters.AddWithValue("montodscto", cotizacion.MontoDscto);
                cmd.Parameters.AddWithValue("igv", cotizacion.Igv);
                cmd.Parameters.AddWithValue("total", cotizacion.Total);
                cmd.Parameters.AddWithValue("estado", cotizacion.Estado);
                cmd.Parameters.AddWithValue("formapago", cotizacion.FormaPago);
                cmd.Parameters.AddWithValue("fechapago", cotizacion.FechaPago);
                int x = cmd.ExecuteNonQuery();
                if (x != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Exemple #11
0
        public Boolean insert(clsCotizacion cotizacion)
        {
            try
            {
                return(Mcotizacion.insert(cotizacion));
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Duplicate entry"))
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: N°- de Documento Repetido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return(false);
            }
        }
Exemple #12
0
        private void CargaCotizacion()
        {
            try
            {
                coti = AdmCot.CargaCotizacion(Convert.ToInt32(CodCotizacion), frmLogin.iCodAlmacen);
                if (coti != null)
                {
                    txtCotizacion.Text = coti.CodCotizacion;

                    if (txtCodCliente.Enabled)
                    {
                        CodCliente            = coti.CodCliente;
                        cli                   = AdmCli.MuestraCliente(CodCliente);
                        txtCodCliente.Text    = coti.CodigoPersonalizado;
                        txtNombreCliente.Text = coti.Nombre;
                        txtDireccion.Text     = coti.Direccion;
                    }
                    cmbMoneda.SelectedIndex      = coti.Moneda;
                    txtTipoCambio.Text           = coti.TipoCambio.ToString();
                    cbListaPrecios.SelectedValue = coti.CodListaPrecio;

                    txtComentario.Text  = coti.Comentario;
                    txtBruto.Text       = String.Format("{0:#,##0.00}", coti.MontoBruto);
                    txtDscto.Text       = String.Format("{0:#,##0.00}", coti.MontoDscto);
                    txtValorVenta.Text  = String.Format("{0:#,##0.00}", coti.Total - coti.Igv);
                    txtIGV.Text         = String.Format("{0:#,##0.00}", coti.Igv);
                    txtPrecioVenta.Text = String.Format("{0:#,##0.00}", coti.Total);
                    CargaDetalleCotizacion();
                }
                else
                {
                    MessageBox.Show("El documento solicitado no existe", "Pedido", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                return;
            }
        }
Exemple #13
0
        public ActionResult EnviarCorreo(string txtCorreoElectronico, string asunto, string mensaje
                                         , string txtIdColaboradorCotizacion, string txtNombreProductoCotizacion, string txtCantidadProductoCotizacion, string txtDetalleCotizacion)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    clsCotizacion ObjCotizacion = new clsCotizacion();
                    bool          Resultado     = ObjCotizacion.AgregarCotizacion(Int32.Parse(txtIdColaboradorCotizacion), txtNombreProductoCotizacion,
                                                                                  Int32.Parse(txtCantidadProductoCotizacion), txtDetalleCotizacion, true);

                    if (Resultado)
                    {
                        System.Net.Mail.MailMessage mmsg = new System.Net.Mail.MailMessage();

                        mmsg.To.Add(txtCorreoElectronico);
                        asunto  = "Cotización Tarimas LS";
                        mensaje =

                            "<h1 text-align: center;><b> Solicitud de cotización Tarimas LS </b></h1>" +
                            "<br />" +
                            "<br /> Este es un correo automatizado del sistema de Tarimas LS, se le solicita la cotización de lo siguiente: " +
                            "<br />" +
                            "<br /> ********************************************************************************************** " +
                            "<h3 text-align: center;><b> Cotización: </b></h3>" +
                            "<br /> Nombre de producto: " + txtNombreProductoCotizacion +
                            "<br /> Cantidad: " + txtCantidadProductoCotizacion +
                            "<br /> Detalles: " + txtDetalleCotizacion +
                            "<br /> ********************************************************************************************** " +
                            "<br />" +
                            "<br /> Tarimas LS S.A. <a href='https://www.tarimasls.com/'> Tarimas LS S.A </a>";

                        mmsg.Subject         = asunto;
                        mmsg.SubjectEncoding = System.Text.Encoding.UTF8;

                        mmsg.Body         = mensaje;
                        mmsg.BodyEncoding = System.Text.Encoding.UTF8;
                        mmsg.IsBodyHtml   = true;
                        mmsg.From         = new System.Net.Mail.MailAddress("*****@*****.**"); //En "correo" se tiene que escribir el correo que va a usar el sistema para enviar correos

                        System.Net.Mail.SmtpClient cliente = new System.Net.Mail.SmtpClient();

                        cliente.Credentials = new System.Net.NetworkCredential("*****@*****.**", "sisASE-123"); //En "correo" se escribe de nuevo el correo que va a usar el sistema y en contraseña va la contraseña del correo
                                                                                                                            //OJO: cuidado ponen su correo y contraseña aqui y mandan una version del proyecto por accidente con eso
                        cliente.Port      = 587;
                        cliente.EnableSsl = true;
                        cliente.Host      = "smtp.gmail.com"; //esta dirección de hosteo va a cambiar dependiendo del proveedor de correo electronico que se use en el correo del sistema, en esta caso, esa es la dirección de hosteo de gmail

                        try
                        {
                            cliente.Send(mmsg);
                        }
                        catch (Exception ex)
                        {
                            ViewBag.Error = ex.Message;
                        }
                        TempData["alertaMensaje"] = "La cotización ha sido enviada por correo exitosamente.";
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        return(View("Crear"));
                    }
                }
                else
                {
                    return(View("Crear"));
                }
            }
            catch
            {
                clsCotizacion ObjCotizacion = new clsCotizacion();
                ViewBag.Lista            = ObjCotizacion.ConsultaCorreoProveedor().ToList();
                TempData["errorMensaje"] = "Inserte correctamente el formato de los datos.";
                return(View());
            }
        }
Exemple #14
0
        public clsCotizacion CargaCotizacion(Int32 CodCotizacion, Int32 CodAlmacen)
        {
            clsCotizacion cotizacion = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("MuestraCotizacion", con.conector);
                cmd.Parameters.AddWithValue("codCotizacion", CodCotizacion);
                cmd.Parameters.AddWithValue("codalma", CodAlmacen);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        cotizacion = new clsCotizacion();
                        cotizacion.CodCotizacion          = dr.GetString(0);
                        cotizacion.CodAlmacen             = dr.GetInt32(1);
                        cotizacion.TipoCliente            = dr.GetInt32(2);;
                        cotizacion.CodCliente             = dr.GetInt32(3);
                        cotizacion.DNI                    = dr.GetString(4);
                        cotizacion.RUCCliente             = dr.GetString(5);
                        cotizacion.CodigoPersonalizado    = dr.GetString(6);
                        cotizacion.RazonSocialCliente     = dr.GetString(7);
                        cotizacion.Nombre                 = dr.GetString(8);
                        cotizacion.Direccion              = dr.GetString(9);
                        cotizacion.Moneda                 = dr.GetInt32(10);
                        cotizacion.TipoCambio             = dr.GetDecimal(11);
                        cotizacion.FechaCotizacion        = dr.GetDateTime(12);
                        cotizacion.Comentario             = dr.GetString(13);
                        cotizacion.MontoBruto             = dr.GetDecimal(14);
                        cotizacion.MontoDscto             = dr.GetDecimal(15);
                        cotizacion.Igv                    = dr.GetDecimal(16);
                        cotizacion.Total                  = dr.GetDecimal(17);
                        cotizacion.Estado                 = Convert.ToInt32(dr.GetDecimal(18));
                        cotizacion.FormaPago              = Convert.ToInt32(dr.GetString(19));
                        cotizacion.FechaPago              = dr.GetDateTime(20);
                        cotizacion.CodUser                = Convert.ToInt32(dr.GetDecimal(21));
                        cotizacion.FechaRegistro          = dr.GetDateTime(22);
                        cotizacion.CodAutorizado          = Convert.ToInt32(dr.GetDecimal(23));
                        cotizacion.NombreAutorizado       = dr.GetString(24);
                        cotizacion.Vigencia               = Convert.ToInt32(dr.GetDecimal(25));
                        cotizacion.FechaVigencia          = dr.GetDateTime(26);
                        cotizacion.CodListaPrecio         = Convert.ToInt32(dr.GetString(27));
                        cotizacion.DocRef                 = Convert.ToInt32(dr.GetDecimal(28));
                        cotizacion.SiglaDocRef            = dr.GetString(29);
                        cotizacion.CodSucursal            = dr.GetInt32(30);
                        cotizacion.Pendiente              = dr.GetInt32(31);
                        cotizacion.Anulado                = dr.GetInt32(32);
                        cotizacion.LineaCredito           = dr.GetDecimal(33);
                        cotizacion.LineaCreditoDisponible = dr.GetDecimal(34);
                        cotizacion.LineaCreditoUso        = dr.GetDecimal(35);
                    }
                }
                return(cotizacion);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Exemple #15
0
        private void CargaCotizacion()
        {
            try
            {
                //if (Proceso == 1)
                //{
                //    cotizacion = AdmCoti.CargaCotizacion(Convert.ToInt32(CodCotizacion), frmLogin.iCodAlmacen);
                //    if (cotizacion != null)
                //    {
                //        txtCotizacion.Text = cotizacion.CodCotizacion;

                //        if (txtCodCliente.Enabled)
                //        {
                //            CodCliente = cotizacion.CodCliente;
                //            //txtCodCliente.Text = cotizacion.DNI;
                //            txtCodCliente.Text = cotizacion.CodigoPersonalizado;
                //            txtNombreCliente.Text = cotizacion.Nombre;
                //            txtDireccion.Text = cotizacion.Direccion;
                //        }
                //        dtpFecha.Value = cotizacion.FechaCotizacion;
                //        dtpVigencia.Value = cotizacion.FechaVigencia;
                //        cmbMoneda.SelectedValue = cotizacion.Moneda;
                //        txtTipoCambio.Text = cotizacion.TipoCambio.ToString();
                //        cbListaPrecios.SelectedValue = cotizacion.CodListaPrecio;

                //        txtComentario.Text = cotizacion.Comentario;
                //        txtBruto.Text = String.Format("{0:#,##0.00}", cotizacion.MontoBruto);
                //        txtDscto.Text = String.Format("{0:#,##0.00}", cotizacion.MontoDscto);
                //        txtValorVenta.Text = String.Format("{0:#,##0.00}", cotizacion.Total - cotizacion.Igv);
                //        txtIGV.Text = String.Format("{0:#,##0.00}", cotizacion.Igv);
                //        txtPrecioVenta.Text = String.Format("{0:#,##0.00}", cotizacion.Total);
                //        //CargaDetalle();
                //    }
                //    else
                //    {
                //        MessageBox.Show("El documento solicitado no existe", "Nota de Ingreso", MessageBoxButtons.OK,
                //            MessageBoxIcon.Information);
                //    }
                //}
                //else
                //{
                cotizacion = AdmCoti.CargaCotizacion(Convert.ToInt32(CodCotizacion), frmLogin.iCodAlmacen);
                if (cotizacion != null)
                {
                    txtCotizacion.Text = cotizacion.CodCotizacion;

                    if (txtCodCliente.Enabled)
                    {
                        CodCliente = cotizacion.CodCliente;
                        //txtCodCliente.Text = cotizacion.DNI;
                        txtCodCliente.Text    = cotizacion.CodigoPersonalizado;
                        txtNombreCliente.Text = cotizacion.Nombre;
                        txtDireccion.Text     = cotizacion.Direccion;
                    }
                    dtpFecha.Value               = cotizacion.FechaCotizacion;
                    dtpVigencia.Value            = cotizacion.FechaVigencia;
                    cmbMoneda.SelectedValue      = cotizacion.Moneda;
                    txtTipoCambio.Text           = cotizacion.TipoCambio.ToString();
                    cbListaPrecios.SelectedValue = cotizacion.CodListaPrecio;

                    txtComentario.Text  = cotizacion.Comentario;
                    txtBruto.Text       = String.Format("{0:#,##0.00}", cotizacion.MontoBruto);
                    txtDscto.Text       = String.Format("{0:#,##0.00}", cotizacion.MontoDscto);
                    txtValorVenta.Text  = String.Format("{0:#,##0.00}", cotizacion.Total - cotizacion.Igv);
                    txtIGV.Text         = String.Format("{0:#,##0.00}", cotizacion.Igv);
                    txtPrecioVenta.Text = String.Format("{0:#,##0.00}", cotizacion.Total);
                    CargaDetalle();
                }
                else
                {
                    MessageBox.Show("El documento solicitado no existe", "Nota de Ingreso", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                // }
            }
            catch (Exception ex)
            {
                return;
            }
        }