public JsonResult Borrar(string strId)
        {
            int Id = 0;

            strId = strId.TrimEnd(',');
            string strmsg = "ok";
            bool   blsucc = true;
            object respuesta;

            try {
                string[] Ids = strId.Split(',');

                for (int i = 0; i < Ids.Length; i++)
                {
                    if (Ids[i].Length != 0)
                    {
                        Id = int.Parse(Ids[i]);

                        NotaCredito oNotaCredito = db.NotaCredito.Where(x => x.id == Id).SingleOrDefault();
                        oNotaCredito.activo = 0;
                        Log log = new Log();
                        log.insertaNuevoOEliminado(oNotaCredito, "Eliminado", "NotaCredito.html", Request.UserHostAddress);

                        db.SaveChanges();
                    }
                }
                respuesta = new { success = blsucc, results = strmsg };
            } catch (Exception ex) {
                strmsg    = ex.Message;
                respuesta = new { success = false, result = strmsg };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public static void probarDocElectronico()
        {
            DocumentoElectronico docElec = null;

            docElec = DocumentoElectronico.crearDocumentoElectronico(2);
            //docElec.calcularTotal();
            anaularDocumento(docElec);

            IOperacionDocSoporte doc = null;

            doc = new FacturaVentaNacional();
            //obtenerFormaPago(doc);

            //MALA PRACTICA (sin polimorfismo)
            FacturaVentaNacional fvn = null;

            fvn = new FacturaVentaNacional();
            //fvn.calcularTotal();
            //
            NotaCredito nc = null;

            nc = new NotaCredito();
            //nc.calcularTotal();
            //
            //para ND
        }
        //Actualizar Nota Credito
        public string Put(NotaCredito nc)
        {
            try
            {
                DataTable table  = new DataTable();
                DateTime  time   = nc.FechaDeExpedicion;
                DateTime  time2  = nc.FechaVencimiento;
                DateTime  time3  = nc.FechaDeEntrega;
                string    format = "yyyy-MM-dd HH:mm:ss";

                string query = @"
                                update NotaCredito set IdCliente = " + nc.IdCliente + ", IdFactura =" + nc.IdFactura + ", Serie = '" + nc.Serie + "', Folio =" + nc.Folio + ", Tipo = '" + nc.Tipo + "', FechaDeExpedicion = '" + time.ToLocalTime().ToString(format) + "', LugarDeExpedicion = '" + nc.LugarDeExpedicion + "', Certificado= '" + nc.Certificado + "', NumeroDeCertificado = '" + nc.NumeroDeCertificado +
                               "',UUID='" + nc.UUID + "', UsoDelCFDI='" + nc.UsoDelCFDI + "', Subtotal='" + nc.Subtotal + "', Descuento= '" + nc.Descuento + "', ImpuestosRetenidos = '" + nc.ImpuestosRetenidos + "', ImpuestosTrasladados = '" + nc.ImpuestosTrasladados + "', Total = '" + nc.Total + "', FormaDePago = '" + nc.FormaDePago + "', MetodoDePago = '" + nc.MetodoDePago + "'," +
                               "Cuenta= '" + nc.Cuenta + "', Moneda='" + nc.Moneda + "', CadenaOriginal='" + nc.CadenaOriginal + "', SelloDigitalSAT='" + nc.SelloDigitalSAT + "', SelloDigitalCFDI = '" + nc.SelloDigitalCFDI + "', NumeroDeSelloSAT = '" + nc.NumeroDeSelloSAT + "', RFCDelPAC = '" + nc.RFCdelPAC + "', Observaciones='" + nc.Observaciones + "', FechaVencimiento='" + time2.ToLocalTime().ToString(format) +
                               "',OrdenDeCompra ='" + nc.OrdenDeCompra + "', TipoDeCambio='" + nc.TipoDeCambio + "', FechaDeEntrega='" + time3.ToLocalTime().ToString(format) + "', CondicionesDePago='" + nc.CondicionesDePago + "', Vendedor='" + nc.Vendedor + "', Estatus='" + nc.Estatus + "', Ver='" + nc.Ver + "', Usuario='" + nc.Usuario + "', SubtotalDlls='" + nc.SubtotalDlls + "', ImpuestosTrasladadosDlls='" + nc.ImpuestosTrasladadosDlls + "',TotalDlls='" + nc.TotalDlls + "', Relacion='" + nc.Relacion + "' where IdNotaCredito =" + nc.IdNotaCredito + ";";

                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }
                return("Se Actualizo Correctamente");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }
        public JsonResult Modificar(int id, string Sentido, int?Sociedad, int?Trafico, int?Servicio, string DeudorAcreedor, int?Operador, int?Grupo, decimal Importe, int?Moneda, DateTime MesConsumo, int lineaNegocio)
        {
            object respuesta = null;

            try {
                NotaCredito nc = db.NotaCredito.Where(x => x.id == id).SingleOrDefault();

                nc.sentido        = Sentido;
                nc.id_sociedad    = Sociedad;
                nc.id_trafico     = Trafico;
                nc.id_servicio    = Servicio;
                nc.deudorAcreedor = DeudorAcreedor;
                nc.id_operador    = Operador;
                nc.id_grupo       = Grupo;
                nc.importe        = Importe;
                nc.id_moneda      = Moneda;
                nc.mes_consumo    = new DateTime(MesConsumo.Year, MesConsumo.Month, 1);
                Log log = new Log();
                log.insertaBitacoraModificacion(nc, "id", nc.id, "Clase_Servicio.html", Request.UserHostAddress);

                db.SaveChanges();

                respuesta = new { success = true, results = "ok" };
            } catch (Exception e) {
                respuesta = new { success = false, results = e.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Agregar(string Sentido, int?Sociedad, int?Trafico, int?Servicio, string DeudorAcreedor, int?Operador, int?Grupo, decimal Importe, int?Moneda, DateTime MesConsumo, int lineaNegocio)
        {
            object   respuesta      = null;
            DateTime fecha_contable = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

            try {
                var nuevo = new NotaCredito();

                nuevo.sentido         = Sentido;
                nuevo.id_sociedad     = Sociedad;
                nuevo.id_trafico      = Trafico;
                nuevo.id_servicio     = Servicio;
                nuevo.deudorAcreedor  = DeudorAcreedor;
                nuevo.id_operador     = Operador;
                nuevo.id_grupo        = Grupo;
                nuevo.importe         = Importe;
                nuevo.id_moneda       = Moneda;
                nuevo.mes_consumo     = new DateTime(MesConsumo.Year, MesConsumo.Month, 1);
                nuevo.id_lineaNegocio = lineaNegocio;
                nuevo.activo          = 1;
                nuevo.periodo_carga   = fecha_contable;
                db.NotaCredito.Add(nuevo);
                Log log = new Log();
                log.insertaNuevoOEliminado(nuevo, "Nuevo", "NotaCredito.html", Request.UserHostAddress);

                db.SaveChanges();

                respuesta = new { success = true, results = "ok" };
            } catch (Exception e) {
                respuesta = new { success = false, results = e.Message };
            }
            return(Json(respuesta, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
 protected void btnResetarNotaCredito_Click(object sender, EventArgs e)
 {
     notaCreditoActual         = null;
     txtNroNotaCredito.Text    = string.Empty;
     txtMontoFP.Enabled        = true;
     txtNroNotaCredito.Enabled = true;
 }
Exemple #7
0
 protected void btnBuscarNroCredito_Click(object sender, EventArgs e)
 {
     try
     {
         NotaCredito nc;
         using (ControladorVentas c_ventas = new ControladorVentas())
         {
             nc = c_ventas.BuscarNotaCreditoXNumero(Convert.ToInt32(txtNroNotaCredito.Text));
         }
         if (nc.UtilizadaEnVenta)
         {
             mostrarExcepcionFormaPago("La nota de credito se encuentra utilizada");
         }
         else if (nc.FechaVto < DateTime.Today)
         {
             mostrarExcepcionFormaPago("La nota de credito se encuentra vencida");
         }
         else
         {
             notaCreditoActual         = nc;
             txtNroNotaCredito.Enabled = false;
             txtMontoFP.Text           = notaCreditoActual.Monto.ToString();
             txtMontoFP.Enabled        = false;
         }
     }
     catch (ExcepcionPropia myex)
     {
         mostrarExcepcionFormaPago(myex.Message);
     }
     catch (FormatException myex)
     {
         mostrarExcepcionFormaPago(myex.Message);
     }
 }
        public static void DatosNotaCredito(DataSet dstcancelxml, NotaCredito nota)
        {
            foreach (DataRow reader in dstcancelxml.Tables[0].Rows)
            {
                //var nombreComplemento = reader["NombreComplemento"];
                var FechaEmisionDocumentoOrigen = reader["FechaEmisionDocumentoOrigen"];
                var motivoAjuste = reader["MotivoAjuste"];
                var NumeroAutorizacionDocumentoOrigen = reader["NumeroAutorizacionDocumentoOrigen"];
                var SerieDocumentoOrigen  = reader["SerieDocumentoOrigen"];
                var NumeroDocumentoOrigen = reader["NumeroDocumentoOrigen"];
                var tipoNCRE = reader["Tipo_FE"];

                if (tipoNCRE.ToString() == "GFACE")
                {
                    Constants.isNCREGFACE = true;
                }
                else
                {
                    Constants.isNCREGFACE = false;
                }

                nota.NumeroAutorizacionDocumentoOrigen = NumeroAutorizacionDocumentoOrigen.ToString();
                nota.SerieDocumentoOrigen        = SerieDocumentoOrigen.ToString();
                nota.FechaEmisionDocumentoOrigen = FechaEmisionDocumentoOrigen.ToString();
                nota.nombreComplemento           = "ncomp";
                nota.MotivoAjuste          = motivoAjuste.ToString();
                nota.IDComplemento         = "text";
                nota.NumeroDocumentoOrigen = NumeroDocumentoOrigen.ToString();
            }
        }
Exemple #9
0
        /// <summary>
        /// Agrega la nota de credito y actualiza las lineas de ventas correspondientes
        /// </summary>
        /// <param name="idUsuario"></param>
        /// <param name="fechaVto"></param>
        /// <param name="descripcion"></param>
        /// <param name="monto"></param>
        /// <param name="listlv"></param>
        /// <returns></returns>
        public int AgregarNotaCredito(int idUsuario, DateTime?fechaVto, string descripcion, decimal monto, List <VentaLinea> listlv)
        {
            BeginTransaction();
            try
            {
                Venta v = buscarVenta(listlv[0].Idventa);

                NotaCredito nc = new NotaCredito();
                nc.Descripcion   = descripcion;
                nc.Fecha         = DateTime.Today;
                nc.FechaVto      = fechaVto;
                nc.Idusuario     = idUsuario;
                nc.Monto         = monto;
                nc.IdnotaCredito = insertNotaCredito(nc);
                ControladorArticulos c_art = new ControladorArticulos(conn);
                foreach (VentaLinea lv in listlv)
                {
                    updateVentaLinea(lv.Idventa, lv.Idarticulo, nc.IdnotaCredito);
                    c_art.ActualizarStockArticulo(lv.Idarticulo, lv.Cantidad, v.IdSucursal);
                }
                CommitTransaction();
                return(nc.IdnotaCredito);
            }
            catch (Npgsql.NpgsqlException ex)
            {
                RollbackTransaction();
                ControladorExcepcion.tiraExcepcion(ex);
                return(0);
            }
        }
Exemple #10
0
 public void ConsultaNotaCredito_Buscar(NotaCredito notaCredito, ref List <NotaCredito> listaNotaCredito, string Conexion
                                        , string Nombre
                                        , int?Id_Cte_inicio
                                        , int?Id_Cte_fin
                                        , DateTime?Ncr_Fecha_inicio
                                        , DateTime?Ncr_Fecha_fin
                                        , string Ncr_Estatus
                                        , int?Id_Ncr_inicio
                                        , int?Id_Ncr_fin
                                        , int?Id_U)
 {
     try
     {
         new CD_CapNotaCredito().ConsultaNotaCredito_Buscar(notaCredito, ref listaNotaCredito, Conexion
                                                            , Nombre
                                                            , Id_Cte_inicio
                                                            , Id_Cte_fin
                                                            , Ncr_Fecha_inicio
                                                            , Ncr_Fecha_fin
                                                            , Ncr_Estatus
                                                            , Id_Ncr_inicio
                                                            , Id_Ncr_fin
                                                            , Id_U);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #11
0
 /// <summary>
 /// Busca una nota de credito si no la encuentra devulve eccepcion propia.
 /// Te indica si esta utilizada en venta o no
 /// No trae las lineas de ventas q contiene
 /// </summary>
 /// <param name="idNotaCredito"></param>
 /// <returns></returns>
 public NotaCredito BuscarNotaCredito(int idNotaCredito)
 {
     try
     {
         DataTable dt = selectNotaCredito(idNotaCredito);
         if (dt == null || dt.Rows.Count == 0)
         {
             throw new ExcepcionPropia("La nota de credito no existe");
         }
         DataRow     row = dt.Rows[0];
         NotaCredito nc  = new NotaCredito();
         nc.Descripcion      = row["descripcion"].ToString();
         nc.Fecha            = Convert.ToDateTime(row["fecha"]);
         nc.FechaVto         = row["fecha_vto"] as DateTime?;
         nc.IdnotaCredito    = Convert.ToInt32(row["idnota_credito"]);
         nc.Idusuario        = Convert.ToInt32(row["idusuario"]);
         nc.Monto            = Convert.ToDecimal(row["monto"]);
         nc.Numero           = Convert.ToInt32(row["numero"]);
         nc.UtilizadaEnVenta = !validarNotaCreditoSinUtilizar(nc.Numero);
         return(nc);
     }
     catch (Npgsql.NpgsqlException ex)
     {
         ControladorExcepcion.tiraExcepcion(ex);
         return(null);
     }
 }
Exemple #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            NotaCredito notacredito = db.NotaCredito.Find(id);

            db.NotaCredito.Remove(notacredito);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        private void btnota_Click(object sender, RoutedEventArgs e)
        {
            NotaCredito nota = new NotaCredito();

            nota.NotaWindowStart(_user);
            nota.Show();
            this.Close();
        }
Exemple #14
0
 protected void btnNuevaFormaPago_Click(object sender, EventArgs e)
 {
     notaCreditoActual = null;
     txtMontoFP.Text   = txtTotal.Text;
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     sb.Append(@"<script type='text/javascript'>");
     sb.Append("$('#formaPagoModal').modal('show');");
     sb.Append(@"</script>");
     ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "FPShowModalScript", sb.ToString(), false);
 }
Exemple #15
0
 public void ModificarNotaCreditoSAT(NotaCredito notaCredito, string Conexion, ref int verificador)
 {
     try
     {
         new CD_CapNotaCredito().ModificarNotaCreditoSAT(notaCredito, Conexion, ref verificador);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #16
0
 public void ModificarNotaCredito(ref NotaCredito notaCredito, string Conexion, ref int verificador, List <AdendaDet> listAdendaCabecera, System.Data.DataTable ListaProductosNotaCredito)
 {
     try
     {
         new CD_CapNotaCredito().ModificarNotaCredito(ref notaCredito, Conexion, ref verificador, listAdendaCabecera, ListaProductosNotaCredito);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #17
0
 public void EliminarNotaCredito(ref NotaCredito notaCredito, string Conexion, int verificador)
 {
     try
     {
         new CD_CapNotaCredito().EliminarNotaCredito(notaCredito, Conexion, ref verificador);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #18
0
 public void ConsultarNotaCreditoSAT(ref NotaCredito notaCredito, string Conexion, ref object resultado)
 {
     try
     {
         new CD_CapNotaCredito().ConsultarNotaCreditoSAT(ref notaCredito, Conexion, ref resultado);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #19
0
 public void ConsultarNotaCredito(ref NotaCredito notaCredito, string Conexion)
 {
     try
     {
         new CD_CapNotaCredito().ConsultarNotaCredito(ref notaCredito, Conexion);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #20
0
 public void AgregarAdenda(NotaCredito notaCredito, Sesion sesion, ref int verificador)
 {
     try
     {
         CD_CapNotaCredito claseCapaDatos = new CD_CapNotaCredito();
         claseCapaDatos.AgregarAdenda(notaCredito, sesion, ref verificador);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #21
0
 public void ArchivoPdf_Xml(ref NotaCredito notaCredito, string Conexion)
 {
     try
     {
         CD_CapNotaCredito claseCapaDatos = new CD_CapNotaCredito();
         claseCapaDatos.ArchivoPdf_Xml(ref notaCredito, Conexion);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #22
0
        public void registrarFormaPago()
        {
            ///////EFECTIVO DEBITO, CTA. CORRIENTE////////
            if (InterfazVenta.cbx_formaPago.SelectedIndex == 1 || InterfazVenta.cbx_formaPago.SelectedIndex == 3)
            {
                int codigoFormaPago = int.Parse(InterfazVenta.cbx_formaPago.SelectedValue.ToString());
                listaFormaPago.crear(new ListaFormaPago {
                    CodigoVenta = venta.CodigoVenta, CodigoFormaPago = codigoFormaPago
                });
            }

            if (saldoAPagar != 0.0f && InterfazVenta.cbx_formaPago.SelectedIndex != 1 && InterfazVenta.cbx_formaPago.SelectedIndex != 3)
            {
                int codigoFormaPago = formaPago.obtenerCodigoFormaPago("EFECTIVO");
                coleccionFormaPago.Add(new ListaFormaPago {
                    CodigoVenta = venta.CodigoVenta, CodigoFormaPago = codigoFormaPago
                });
            }

            if (listaTarjeta.Count != 0)
            {
                tarjeta = new Tarjeta();
                foreach (var item in listaTarjeta)
                {
                    tarjeta.crear(item.Nombre, item.Apellido, item.Interes, item.Cuota, item.CodigoNombreTarjeta, item.CodigoTipoTarjeta, item.CodigoBanco, item.NumeroTarjeta, item.ImporteTarjeta, venta.CodigoVenta);
                }
                int codigoFormaPago = formaPago.obtenerCodigoFormaPago("CREDITO");
                coleccionFormaPago.Add(new ListaFormaPago {
                    CodigoVenta = venta.CodigoVenta, CodigoFormaPago = codigoFormaPago
                });
            }

            if (listaNotaCredito.Count != 0 && InterfazVenta.ch_notaCredito.Checked == true)
            {
                notaCredito = new NotaCredito();
                foreach (var item in listaNotaCredito)
                {
                    notaCredito.actualizarNotaDeCredito(item);
                }
                int codigoFormaPago = formaPago.obtenerCodigoFormaPago("NOTA DE CREDITO");
                coleccionFormaPago.Add(new ListaFormaPago {
                    CodigoVenta = venta.CodigoVenta, CodigoFormaPago = codigoFormaPago
                });
            }

            foreach (var item in coleccionFormaPago)
            {
                listaFormaPago.crear(new ListaFormaPago {
                    CodigoVenta = item.CodigoVenta, CodigoFormaPago = item.CodigoFormaPago
                });
            }
        }
 public Controlador_ActualizarNotaDeCredito(IU_ActualizarNotaDeCredito interfazActNotaCredito)
 {
     InterfazActualizarNotaDeCredito = interfazActNotaCredito;
     _clienteMayorista              = new ClienteMayorista();
     _clientesMayoristas            = new List <ClienteMayorista>();
     NotaDeCredito                  = new NotaCredito();
     _clientesMinoristas            = new List <NotaCredito>();
     _notaCreditoColeccionMayorista = new List <NotaCredito>();
     _notaCreditoColeccionMinorista = new List <NotaCredito>();
     ListaAActualizar               = new List <NotaCredito>();
     ListaNotaCreditoStandBy        = new List <NotaCredito>();
     _venta = new Venta();
 }
Exemple #24
0
 public List <NotaCredito> ConsultaProductosNotaCredito(ref NotaCredito notaCredito, string Conexion)
 {
     try
     {
         CD_CapNotaCredito  claseCapaDatos = new CD_CapNotaCredito();
         List <NotaCredito> notaCredito1   = claseCapaDatos.ConsultaProductosNotaCredito(ref notaCredito, Conexion);
         return(notaCredito1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public async Task <string> GenerarNotaCredito()
        {
            NotaCredito nota_credito = null;

            var result = string.Empty;

            try
            {
                var facturadeposito = await _facturaRepository.ListarFacturaDeposito();

                if (facturadeposito.Count > 0)
                {
                    foreach (FacturaDeposito c in facturadeposito)
                    {
                        nota_credito                   = new NotaCredito();
                        nota_credito.IdProducto        = c.IdProducto;
                        nota_credito.NumeroNotaCredito = " ";
                        nota_credito.IdFacturaDeposito = c.IdFacturaDeposito;
                        nota_credito.DcMonto           = c.MontoTotal;
                        nota_credito.VcUsuarioCreacion = "AppConciliacion";
                        nota_credito.IddgEstado        = 1; //Generado

                        await _facturaRepository.RegistrarNotaCredito(nota_credito);

                        await _facturaRepository.AnularFacturaDeposito(c);

                        foreach (DetalleFacturaDeposito d in c.DetalleFacturaDeposito)
                        {
                            d.IddgEstadoDeposito = 1101; //Ingresado
                            await _facturaRepository.ActualizarEstadoDeposito(d);
                        }
                    }

                    return("1");
                }
                else
                {
                    return("0");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                _logger.LogError(ex.StackTrace);

                result = "2";
            }

            return(result);
        }
Exemple #26
0
        /// <summary>
        /// Agrega una venta
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public int AgregarVenta(Venta v)
        {
            BeginTransaction();
            try
            {
                v.Idventa = insertVenta(v);
                foreach (VentaLinea lv in v.ListLineaVenta)
                {
                    lv.Idventa = v.Idventa;
                    insertVentaLinea(lv);
                    if (lv.Articulo.ControlarStock)
                    {
                        ControladorArticulos c_articulos = new ControladorArticulos(conn);
                        c_articulos.ActualizarStockArticulo(lv.Idarticulo, -lv.Cantidad, v.IdSucursal);
                    }
                }
                foreach (FormaPago fp in v.ListFormaPago)
                {
                    insertFormaPagoVenta(v.Idventa, fp.IdtipoFormaPago, fp.Monto, fp.IdNotaCredito);
                }

                ///Si tengo q generar una nota de credito porque sobra un monto
                if (v.Total < v.ListFormaPago.Sum(fp => fp.Monto) && v.ListFormaPago.Exists(fp => fp.AceptaNotaCredito))
                {
                    NotaCredito nc;
                    nc             = new NotaCredito();
                    nc.Descripcion = "Diferencia en venta";
                    nc.Fecha       = DateTime.Today;
                    nc.FechaVto    = DateTime.Today.AddMonths(3);
                    nc.Idusuario   = v.Idusuario;
                    nc.Monto       = v.ListFormaPago.Sum(fp => fp.Monto) - v.Total;
                    insertNotaCredito(nc);
                }
                agregarComprobante(v);
                CommitTransaction();
                return(v.Idventa);
            }
            catch (Npgsql.NpgsqlException ex)
            {
                RollbackTransaction();
                ControladorExcepcion.tiraExcepcion(ex);
                return(0);
            }
            catch (ExcepcionPropia myEx)
            {
                RollbackTransaction();
                ControladorExcepcion.tiraExcepcion(myEx.Message);
                return(0);
            }
        }
Exemple #27
0
        private void updateNotaCredito(NotaCredito nc)
        {
            string sql = @"UPDATE nota_credito
                        SET	                        
	                        fecha = :p8,
	                        monto = :p7,
	                        descripcion = :p6,
	                        fecha_vto = :p5,
	                        idusuario = :p4,
	                        numero = :p3
                        WHERE idnota_credito=:p2";

            conn.Execute(sql, nc.Fecha, nc.Monto, nc.Descripcion, nc.FechaVto, nc.Idusuario, nc.Numero, nc.IdnotaCredito);
        }
Exemple #28
0
        // GET: /NotaCredito/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NotaCredito notacredito = db.NotaCredito.Find(id);

            if (notacredito == null)
            {
                return(HttpNotFound());
            }
            return(View(notacredito));
        }
Exemple #29
0
        private static void Prueba_DocElecDIAN()
        {
            short   opcionDocElect     = 0;
            decimal porcentajeComision = 0.0M;
            decimal comision           = 0.0M;
            DocumentoElectronico de    = null;

            Console.Write("Entre tipo Doc Electronico [1-FVN,2-NC]:");
            if (!Int16.TryParse(Console.ReadLine(), out opcionDocElect))
            {
                throw new ArgumentException("Valor para OPCION no valida!");
            }
            Console.Write("Entre % de comision:");
            if (!Decimal.TryParse(Console.ReadLine(), out porcentajeComision))
            {
                throw new ArgumentException("Valor para COMISION no valida!");
            }

            //de = new DocumentoElectronico(); //REMAAAAAL!!!
            //BUENA PRACTICA!
            de       = DocumentoElectronico.CrearDocumentoElctronico(opcionDocElect);
            comision = CalcularTotalComision(de, porcentajeComision);

            //Un RE-JUNIOR, Caso 1°
            FacturaVentaNacional facVenNac   = null;
            NotaCredito          notaCredito = null;

            if (opcionDocElect == 1)  //FVN
            {
                facVenNac = new FacturaVentaNacional();
                facVenNac.CalcularTotal();
                comision = facVenNac.total * 0.20M;
            }
            else if (opcionDocElect == 2)    //NC
            {
                notaCredito = new NotaCredito();
                notaCredito.CalcularTotal();
                comision = notaCredito.total * 0.10M;
            }
            else if (opcionDocElect == 3)    //ND
            {
                notaCredito = new NotaCredito();
                notaCredito.CalcularTotal();
                comision = notaCredito.total * 0.50M;
            }
        }
Exemple #30
0
        public void generarNvoNumeroVenta()
        {
            buscarUltimoNroVenta();
            venta.CodigoEncargado = InterfazVentaMayorista.InterfazContenedora.EncargadoActivo.CodigoEncargado;

            int codigoFormaPago = int.Parse(InterfazVentaMayorista.cbx_formaPago.SelectedValue.ToString());

            //venta.CodigoFormaPago = codigoFormaPago;

            ///////EFECTIVO, EFECTIVO DEBITO, CTA. CORRIENTE////////
            if (codigoFormaPago == 1 || codigoFormaPago == 2 || codigoFormaPago == 4)
            {
                venta.crearVentaMayorista(venta);
            }
            else
            {
                ////////TARJETA/////////////
                if (codigoFormaPago == 3)
                {
                    venta.crearVentaMayorista(venta);
                    tarjeta = new Tarjeta();
                    foreach (var item in listaTarjeta)
                    {
                        tarjeta.crear(item.Nombre, item.Apellido, item.Interes, item.Cuota, item.CodigoNombreTarjeta, item.CodigoTipoTarjeta, item.CodigoBanco, item.NumeroTarjeta, item.ImporteTarjeta, venta.CodigoVenta);
                    }
                }
                else
                {
                    venta.crearVentaMayorista(venta);
                    notaCredito = new NotaCredito();
                    foreach (var item in listaNotaCredito)
                    {
                        notaCredito.actualizarNotaDeCredito(item);
                    }
                }
            }

            if (listaEntrega.Count != 0 && InterfazVentaMayorista.ch_cargoEnvio.Checked)
            {
                registrarEntregas();
            }

            registrarDetalleVP();
        }