Esempio n. 1
0
        public ActionResult Modificar(string IdCod_Impuesto = "")
        {
            int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
            tb_sis_Impuesto_Info model = bus_impuesto.get_info(IdCod_Impuesto);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.info_impuesto_ctacble = new tb_sis_Impuesto_x_ctacble_Info();
            model.info_impuesto_ctacble = bus_impuesto_ctacble.get_info(IdCod_Impuesto, Convert.ToInt32(SessionFixed.IdEmpresa));
            if (model.info_impuesto_ctacble != null)
            {
                model.info_impuesto_ctacble.IdEmpresa_cta  = IdEmpresa;
                model.info_impuesto_ctacble.IdCod_Impuesto = model.IdCod_Impuesto;
                model.IdCtaCble     = model.info_impuesto_ctacble.IdCtaCble;
                model.IdCtaCble_vta = model.info_impuesto_ctacble.IdCtaCble_vta;
            }
            else
            {
                model.info_impuesto_ctacble = new tb_sis_Impuesto_x_ctacble_Info
                {
                    IdCod_Impuesto = model.IdCod_Impuesto,
                    IdEmpresa_cta  = IdEmpresa
                };
            }

            cargar_combos();
            return(View(model));
        }
        public void AddRow(fa_notaCreDeb_det_Info info_det, decimal IdTransaccion)
        {
            List <fa_notaCreDeb_det_Info> list = get_list(IdTransaccion);

            info_det.Secuencia  = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1;
            info_det.IdProducto = info_det.IdProducto;
            var producto = bus_producto.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdProducto);

            if (producto != null)
            {
                info_det.pr_descripcion = producto.pr_descripcion_combo;
            }
            info_det.sc_descUni     = Math.Round(info_det.sc_Precio * (info_det.sc_PordescUni / 100), 2, MidpointRounding.AwayFromZero);
            info_det.sc_precioFinal = Math.Round(info_det.sc_Precio - info_det.sc_descUni, 2, MidpointRounding.AwayFromZero);
            info_det.sc_subtotal    = Math.Round(info_det.sc_cantidad * info_det.sc_precioFinal, 2, MidpointRounding.AwayFromZero);
            var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto_Iva);

            if (impuesto != null)
            {
                info_det.vt_por_iva = impuesto.porcentaje;
            }
            info_det.sc_iva   = Math.Round(info_det.sc_subtotal * (info_det.vt_por_iva / 100), 2, MidpointRounding.AwayFromZero);
            info_det.sc_total = Math.Round(info_det.sc_subtotal + info_det.sc_iva, 2, MidpointRounding.AwayFromZero);
            list.Add(info_det);
        }
Esempio n. 3
0
        public void AddRow(fa_notaCreDeb_det_Info info_det, decimal IdTransaccion)
        {
            int     IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
            decimal IdCliente = Convert.ToDecimal(SessionFixed.IdEntidad);
            List <fa_notaCreDeb_det_Info> list = get_list(IdTransaccion);

            info_det.Secuencia  = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1;
            info_det.IdProducto = info_det.IdProducto;
            var producto = bus_producto.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdProducto);

            if (producto != null)
            {
                info_det.pr_descripcion = producto.pr_descripcion_combo;
            }

            info_det.sc_descUni       = info_det.sc_Precio * (info_det.sc_PordescUni / 100);
            info_det.sc_precioFinal   = info_det.sc_Precio - info_det.sc_descUni;
            info_det.sc_subtotal      = info_det.sc_cantidad * info_det.sc_precioFinal;
            info_det.sc_subtotal_item = info_det.sc_subtotal;
            var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto_Iva);

            if (impuesto != null)
            {
                info_det.vt_por_iva = impuesto.porcentaje;
            }
            info_det.sc_iva   = info_det.sc_subtotal * (info_det.vt_por_iva / 100);
            info_det.sc_total = Math.Round(info_det.sc_subtotal + info_det.sc_iva, 2);

            #region Centro de costo
            info_det.IdCentroCosto = info_det.IdCentroCosto;
            if (string.IsNullOrEmpty(info_det.IdCentroCosto))
            {
                info_det.cc_Descripcion = string.Empty;
            }
            else
            {
                var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto);
                if (cc != null)
                {
                    info_det.cc_Descripcion = cc.cc_Descripcion;
                }
            }
            #endregion
            #region Punto de cargo
            if (info_det.IdPunto_Cargo == null || info_det.IdPunto_Cargo == 0)
            {
                info_det.cc_Descripcion = string.Empty;
            }
            else
            {
                var pc = bus_pc.GetInfo(Convert.ToInt32(SessionFixed.IdEmpresa), Convert.ToInt32(info_det.IdPunto_Cargo));
                if (pc != null)
                {
                    info_det.nom_punto_cargo = pc.nom_punto_cargo;
                }
            }
            #endregion
            list.Add(info_det);
        }
Esempio n. 4
0
        public JsonResult CalcularValores(int Cantidad = 0, double Precio = 0, string IdCodImpuesto = "", double PorcentajeDesc = 0)
        {
            double subtotal     = 0;
            double iva_porc     = 0;
            double iva          = 0;
            double total        = 0;
            double DescUnitario = 0;
            double PrecioFinal  = 0;

            DescUnitario = Convert.ToDouble(Precio * (PorcentajeDesc / 100));
            PrecioFinal  = Precio - DescUnitario;
            subtotal     = Math.Round(Convert.ToDouble(Cantidad * PrecioFinal), 2, MidpointRounding.AwayFromZero);

            var impuesto = bus_impuesto.get_info(IdCodImpuesto);

            if (impuesto != null)
            {
                iva_porc = impuesto.porcentaje;
            }

            iva   = Math.Round((subtotal * (iva_porc / 100)), 2, MidpointRounding.AwayFromZero);
            total = Math.Round((subtotal + iva), 2, MidpointRounding.AwayFromZero);

            return(Json(new { subtotal = subtotal, iva = iva, total = total }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public void AddRow(fa_guia_remision_det_Info info_det, decimal IdTransaccionSession)
        {
            List <fa_guia_remision_det_Info> list = get_list(IdTransaccionSession);

            info_det.Secuencia = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1;

            info_det.gi_descuentoUni = info_det.gi_precio * (info_det.gi_por_desc / 100);
            info_det.gi_PrecioFinal  = info_det.gi_precio - info_det.gi_descuentoUni;
            info_det.gi_Subtotal     = info_det.gi_cantidad * info_det.gi_PrecioFinal;

            var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto);

            if (impuesto != null)
            {
                info_det.gi_por_iva = impuesto.porcentaje;
            }
            else
            {
                info_det.gi_por_iva = 0;
            }

            info_det.gi_Iva   = info_det.gi_Subtotal * (info_det.gi_por_iva / 100);
            info_det.gi_Total = info_det.gi_Subtotal + info_det.gi_Iva;

            info_det.gi_Subtotal   = info_det.gi_Subtotal;
            info_det.gi_Iva_item   = info_det.gi_Iva;
            info_det.gi_Total_item = info_det.gi_Total;

            #region Centro de costo
            info_det.IdCentroCosto = info_det.IdCentroCosto;
            if (string.IsNullOrEmpty(info_det.IdCentroCosto))
            {
                info_det.cc_Descripcion = string.Empty;
            }
            else
            {
                var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto);
                if (cc != null)
                {
                    info_det.cc_Descripcion = cc.cc_Descripcion;
                }
            }
            #endregion

            list.Add(info_det);
        }
Esempio n. 6
0
        public void AddRow(fa_proforma_det_Info info_det, decimal IdTransaccionSession)
        {
            List <fa_proforma_det_Info> list = get_list(IdTransaccionSession);

            info_det.Secuencia        = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1;
            info_det.IdProducto       = info_det.IdProducto;
            info_det.pr_descripcion   = info_det.pr_descripcion;
            info_det.pd_descuento_uni = info_det.pd_precio * (info_det.pd_por_descuento_uni / 100);
            info_det.pd_precio_final  = info_det.pd_precio - info_det.pd_descuento_uni;
            info_det.pd_subtotal      = info_det.pd_cantidad * info_det.pd_precio_final;
            var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto);

            if (impuesto != null)
            {
                info_det.pd_por_iva = impuesto.porcentaje;
            }
            info_det.pd_iva   = info_det.pd_subtotal * (info_det.pd_por_iva / 100);
            info_det.pd_total = info_det.pd_subtotal + info_det.pd_iva;
            list.Add(info_det);
        }
Esempio n. 7
0
        public ActionResult Modificar(string IdCod_Impuesto = "")
        {
            tb_sis_Impuesto_Info model = bus_impuesto.get_info(IdCod_Impuesto);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.info_impuesto_ctacble = bus_impuesto_ctacble.get_info(IdCod_Impuesto, Convert.ToInt32(SessionFixed.IdEmpresa));
            if (model.info_impuesto_ctacble == null)
            {
                model.info_impuesto_ctacble = new tb_sis_Impuesto_x_ctacble_Info
                {
                    IdEmpresa_cta  = Convert.ToInt32(Session["IdEmpresa"]),
                    IdCod_Impuesto = model.IdCod_Impuesto
                }
            }
            ;
            cargar_combos();
            return(View(model));
        }
        public void AddRow(com_ordencompra_local_det_Info info_det, decimal IdTransaccionSession)
        {
            List <com_ordencompra_local_det_Info> list = get_list(IdTransaccionSession);

            info_det.Secuencia      = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1;
            info_det.do_descuento   = Math.Round(info_det.do_precioCompra * (info_det.do_porc_des / 100), 2, MidpointRounding.AwayFromZero);
            info_det.do_precioFinal = Math.Round(info_det.do_precioCompra - info_det.do_descuento, 2, MidpointRounding.AwayFromZero);
            info_det.do_subtotal    = Math.Round(info_det.do_Cantidad * info_det.do_precioFinal, 2, MidpointRounding.AwayFromZero);
            var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto);

            if (impuesto != null)
            {
                info_det.Por_Iva = impuesto.porcentaje;
            }
            else
            {
                info_det.Por_Iva = 0;
            }
            info_det.do_iva   = Math.Round(info_det.do_subtotal * (info_det.Por_Iva / 100), 2, MidpointRounding.AwayFromZero);
            info_det.do_total = Math.Round(info_det.do_subtotal + info_det.do_iva, 2, MidpointRounding.AwayFromZero);
            list.Add(info_det);
        }
Esempio n. 9
0
        public void AddRow(cp_orden_giro_det_Info info_det, decimal IdTransaccionSession)
        {
            List <cp_orden_giro_det_Info> list = get_list(IdTransaccionSession);

            info_det.Secuencia     = list.Count == 0 ? 1 : (list.Max(q => q.Secuencia) + 1);
            info_det.DescuentoUni  = Math.Round(info_det.CostoUni * (info_det.PorDescuento / 100), 2, MidpointRounding.AwayFromZero);
            info_det.CostoUniFinal = Math.Round(info_det.CostoUni - info_det.DescuentoUni, 2, MidpointRounding.AwayFromZero);
            info_det.Subtotal      = Math.Round(info_det.Cantidad * info_det.CostoUniFinal, 2, MidpointRounding.AwayFromZero);
            var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto_Iva);

            if (impuesto != null)
            {
                info_det.PorIva = impuesto.porcentaje;
            }
            else
            {
                info_det.PorIva = 0;
            }
            info_det.ValorIva = Math.Round(info_det.Subtotal * (info_det.PorIva / 100), 2, MidpointRounding.AwayFromZero);
            info_det.Total    = Math.Round(info_det.Subtotal + info_det.ValorIva, 2, MidpointRounding.AwayFromZero);
            list.Add(info_det);
        }
Esempio n. 10
0
        public void AddRow(com_ordencompra_local_det_Info info_det, decimal IdTransaccionSession)
        {
            List <com_ordencompra_local_det_Info> list = get_list(IdTransaccionSession);

            info_det.Secuencia      = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1;
            info_det.do_descuento   = info_det.do_precioCompra * (info_det.do_porc_des / 100);
            info_det.do_precioFinal = info_det.do_precioCompra - info_det.do_descuento;
            info_det.do_subtotal    = info_det.do_Cantidad * info_det.do_precioFinal;
            var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto);

            if (impuesto != null)
            {
                info_det.Por_Iva = impuesto.porcentaje;
            }
            else
            {
                info_det.Por_Iva = 0;
            }
            info_det.do_iva   = info_det.do_subtotal * (info_det.Por_Iva / 100);
            info_det.do_total = info_det.do_subtotal + info_det.do_iva;

            #region Centro de costo
            if (string.IsNullOrEmpty(info_det.IdCentroCosto))
            {
                info_det.cc_Descripcion = string.Empty;
            }
            else
            {
                var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto);
                if (cc != null)
                {
                    info_det.cc_Descripcion = cc.cc_Descripcion;
                }
            }
            #endregion
            list.Add(info_det);
        }
Esempio n. 11
0
        public JsonResult AgregarPedido(string SecuencialID = "", decimal IdTransaccionSession = 0)
        {
            int IdEmpresa  = Convert.ToInt32(SecuencialID.Substring(0, 4));
            int IdProducto = Convert.ToInt32(SecuencialID.Substring(4, 6));

            var producto = bus_producto.get_info(IdEmpresa, IdProducto);

            double subtotal         = 0;
            double iva_porc         = 0;
            double iva              = 0;
            double total            = 0;
            double Subtotal_Detalle = 0;
            double Iva_Detalle      = 0;
            double Total_Detalle    = 0;

            var impuesto = bus_impuesto.get_info(producto.IdCod_Impuesto_Iva);

            if (impuesto != null)
            {
                iva_porc = impuesto.porcentaje;
            }

            subtotal = 1 * producto.precio_1;
            iva      = Math.Round((subtotal * (iva_porc / 100)), 2);
            total    = Math.Round((subtotal + iva), 2);

            var lst_actual = List_det.get_list(IdTransaccionSession);
            var info_det   = new fa_factura_det_Info
            {
                IdEmpresa          = IdEmpresa,
                Secuencia          = lst_actual.Count + 1,
                IdProducto         = producto.IdProducto,
                pr_descripcion     = producto.pr_descripcion,
                vt_cantidad        = 1,
                vt_PorDescUnitario = 0,
                vt_Precio          = producto.precio_1,
                vt_DescUnitario    = 0,
                vt_PrecioFinal     = producto.precio_1 - 0,
                vt_Subtotal        = subtotal,
                tp_manejaInven     = producto.tp_ManejaInven,
                se_distribuye      = producto.se_distribuye,
                vt_detallexItems   = "",
                IdCod_Impuesto_Iva = producto.IdCod_Impuesto_Iva,
                //vt_Subtotal_item = 0,
                //vt_iva_item=0,
                //vt_total_item=0,
                vt_iva     = iva,
                vt_total   = total,
                vt_por_iva = iva_porc
            };

            var existe_producto = lst_actual.Where(q => q.IdEmpresa == IdEmpresa && q.IdProducto == IdProducto).FirstOrDefault();

            if (existe_producto == null)
            {
                lst_actual.Add(info_det);
            }
            else
            {
                var cantidad = existe_producto.vt_cantidad + 1;
                subtotal = cantidad * producto.precio_1;
                iva      = Math.Round((subtotal * (iva_porc / 100)), 2);
                total    = Math.Round((subtotal + iva), 2);

                //lst_actual.ForEach(q=> q.vt_cantidad = (q.Secuencia== existe_producto.Secuencia ? cantidad : q.vt_cantidad));
                lst_actual.Where(q => q.Secuencia == existe_producto.Secuencia).ToList().ForEach(q => { q.vt_cantidad = cantidad; q.vt_iva = iva; q.vt_Subtotal = subtotal; q.vt_total = total; });
            }

            List_det.set_list(lst_actual, IdTransaccionSession);
            Subtotal_Detalle = (double)Math.Round(lst_actual.Sum(q => q.vt_Subtotal), 2, MidpointRounding.AwayFromZero);
            Iva_Detalle      = (double)Math.Round(lst_actual.Sum(q => q.vt_iva), 2, MidpointRounding.AwayFromZero);
            Total_Detalle    = (double)Math.Round(lst_actual.Sum(q => q.vt_total), 2, MidpointRounding.AwayFromZero);

            var NombreProducto = producto.pr_descripcion;

            return(Json(new { Producto = NombreProducto, subtotal = Subtotal_Detalle.ToString("C2"), iva = Iva_Detalle.ToString("C2"), total = Total_Detalle.ToString("C2") }, JsonRequestBehavior.AllowGet));
        }