public virtual void Init(ContabilidadConfig config)
        {
            _config = config;
            SetConditions(config.Conditions);

            _accounting_entry = Convert.ToInt64(_config.AsientoInicial);

            if (!_config.RutaSalida.EndsWith("\\"))
            {
                _config.RutaSalida += "\\";
            }

            if (!Directory.Exists(_config.RutaSalida))
            {
                Directory.CreateDirectory(_config.RutaSalida);
            }

            _ayudas        = AyudaList.GetList(false);
            _taxes         = ImpuestoList.GetList(false);
            _families      = FamiliaList.GetList(false, true);
            _bank_accounts = BankAccountList.GetList(false);
            _expense_types = TipoGastoList.GetList(false);

            _registry                  = Registro.New(ETipoRegistro.Contabilidad);
            _registry.Nombre           = Resources.Labels.REGISTRO_CONTABILIDAD;
            _registry.ETipoExportacion = config.TipoExportacion;
            _registry.Observaciones    = GetConditions();
        }
Beispiel #2
0
        private void SumarTotales()
        {
            gvDetalle.BeginDataUpdate();
            gvDetalle.RefreshData();

            //Percepcion
            var totalItemPercepcion =
                VwNotadebitodetList.Where(w => w.DataEntityState != DataEntityState.Deleted)
                .Sum(s => s.Porcentajepercepcion);

            rPorcentajepercepcion.EditValue = totalItemPercepcion > 0 ? SessionApp.EmpresaSel.Porcentajepercepcion : 0;
            //

            var totalbruto = VwNotadebitodetList.Where(w => !w.Exoneradoimpuesto && w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Cantidad * s.Preciounitario);

            rTotalbruto.EditValue = totalbruto;

            var totalneto = VwNotadebitodetList.Where(w => !w.Exoneradoimpuesto && w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Importetotal);

            rTotalneto.EditValue = totalneto;

            var totalexonerado = VwNotadebitodetList.Where(w => w.Exoneradoimpuesto && w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Importetotal);

            rTotalexonerado.EditValue = totalexonerado;

            var totalGravado = VwNotadebitodetList.Where(w => !w.Exoneradoimpuesto && w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Importetotal);

            rBaseimponible.EditValue = totalGravado;

            var impuestoSel = ImpuestoList.FirstOrDefault(x => x.Idimpuesto == (int)iIdimpuesto.EditValue);

            decimal porcentajeImpuesto = 0;

            if (impuestoSel != null)
            {
                porcentajeImpuesto       = impuestoSel.Porcentajeimpuesto;
                rTotalimpuesto.EditValue = decimal.Round(totalGravado * (porcentajeImpuesto / 100), 2);
            }

            decimal importePecepcionGravado = VwNotadebitodetList.Where(w => !w.Exoneradoimpuesto && w.DataEntityState != DataEntityState.Deleted && w.Porcentajepercepcion > 0).Sum(s => s.Importetotal * (s.Porcentajepercepcion / 100));

            //Calculo percepcion

            rTotalpercepcion.EditValue = importePecepcionGravado * (1 + porcentajeImpuesto / 100);

            rImportetotal.EditValue = ((decimal)rBaseimponible.EditValue + (decimal)rTotalimpuesto.EditValue);

            rTotaldocumento.EditValue = (decimal)rImportetotal.EditValue + (decimal)rTotalpercepcion.EditValue;
            gvDetalle.EndDataUpdate();

            gvDetalle.BestFitColumns(true);
        }
Beispiel #3
0
        public List <ImpuestoResumen> GetImpuestos()
        {
            try
            {
                ImpuestoList           impuestos = ImpuestoList.GetList(false);
                List <ImpuestoResumen> list      = new List <ImpuestoResumen>();
                bool nuevo;

                foreach (ConceptoTicketInfo item in _concepto_tickets)
                {
                    if (item.Impuestos == 0)
                    {
                        continue;
                    }

                    nuevo = true;

                    //Agrupamos los conceptos por tipo de impuesto devengado
                    for (int i = 0; i < list.Count; i++)
                    {
                        ImpuestoResumen cr = list[i];

                        if (cr.OidImpuesto == item.OidImpuesto)
                        {
                            cr.Importe       += item.Impuestos;
                            cr.BaseImponible += item.BaseImponible;
                            list[i]           = cr;
                            nuevo             = false;
                            break;
                        }
                    }

                    if (nuevo)
                    {
                        list.Add(new ImpuestoResumen {
                            Nombre        = impuestos.GetItem(item.OidImpuesto).Nombre,
                            OidImpuesto   = item.OidImpuesto,
                            Importe       = item.Impuestos,
                            BaseImponible = item.BaseImponible
                        });
                    }
                }

                return(list);
            }
            catch
            {
                throw new iQException(String.Format(Resources.Messages.ERROR_FACTURA_IMPUESTO, NTicket, string.Empty));
            }
        }
Beispiel #4
0
        private void SumarTotales()
        {
            gvDetalle.BeginDataUpdate();
            gvDetalle.RefreshData();


            var totalbruto = VwNotadebitoclidetList.Where(w => w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Cantidad * s.Preciounitario);

            rTotalbruto.EditValue = totalbruto;

            var totalgravado = VwNotadebitoclidetList.Where(w => w.Gravado && w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Importetotal);

            rTotalgravado.EditValue = totalgravado;

            var totalinafecto = VwNotadebitoclidetList.Where(w => w.Inafecto && w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Importetotal);

            rTotalinafecto.EditValue = totalinafecto;

            var totalexonerado = VwNotadebitoclidetList.Where(w => w.Exonerado && w.DataEntityState != DataEntityState.Deleted).Sum(s => s.Importetotal);

            rtotalexonerado.EditValue = totalexonerado;

            var impuestoSel = ImpuestoList.FirstOrDefault(x => x.Idimpuesto == (int)iIdimpuesto.EditValue);

            if (impuestoSel != null)
            {
                var     porcentajeImpuesto = impuestoSel.Porcentajeimpuesto;
                decimal totalImpuesto      = decimal.Round(totalgravado * (porcentajeImpuesto / 100), 2);
                rTotalimpuesto.EditValue = decimal.Round(totalgravado * (porcentajeImpuesto / 100), 2);
                rImportetotal.EditValue  = totalgravado + totalinafecto + totalexonerado + totalImpuesto;

                //Calculo percepcion
                decimal totalValorPercepcion = VwNotadebitoclidetList.Where(
                    w => w.DataEntityState != DataEntityState.Deleted &&
                    w.Porcentajepercepcion > 0).Sum(s => s.Importetotal * (s.Porcentajepercepcion / 100));
                rPorcentajepercepcion.EditValue = totalValorPercepcion > 0 ? SessionApp.EmpresaSel.Porcentajepercepcion : 0m;

                decimal importetotalpercepcion = Math.Round(totalValorPercepcion * (1 + porcentajeImpuesto / 100), 2);
                rImportetotalpercepcion.EditValue = importetotalpercepcion;
                //fin calculo percepcion

                rTotaldocumento.EditValue = (decimal)rImportetotal.EditValue +
                                            (decimal)rImportetotalpercepcion.EditValue;
            }

            gvDetalle.EndDataUpdate();

            gvDetalle.BestFitColumns(true);
        }
Beispiel #5
0
        private IEnumerable <ImpuestoItemViewModel> ToImpuestoItemViewModel()
        {
            return(ImpuestoList.Select(m => new ImpuestoItemViewModel
            {
                idImpuesto = m.idImpuesto,
                nombreImpuesto = m.nombreImpuesto,
                siglasImpuesto = m.siglasImpuesto,
                valorImpuesto = m.valorImpuesto,
                porcentual = m.porcentual,
                porDefecto = m.porDefecto,
                estado = m.estado,
                enUso = m.enUso,

                BackgroundItem = (m.estado == 0) ? (Color)App.Current.Resources["AlertLight"] : Color.Transparent,
                TextColorItem = (m.estado == 0) ? (Color)App.Current.Resources["Alert"] : (Color)App.Current.Resources["GreyDark"],
            }));
        }
		public static MvcHtmlString TaxesDropDown(this System.Web.Mvc.HtmlHelper helper, string name, string optionLabel, object selectedValue)
		{
			ImpuestoList taxes = ImpuestoList.GetList();

			StringBuilder b = new StringBuilder();
			b.Append(string.Format("<select class=\"input-small\" name=\"{0}\" id=\"{0}\">", name));
			
			if (!string.IsNullOrEmpty(optionLabel))
				b.Append(string.Format("<option value=\"\">{0}</option>", optionLabel));

			string selected = string.Empty;

			foreach (ImpuestoInfo item in taxes)
			{
				selected = (item.Oid == Convert.ToInt64(selectedValue)) ? "selected=\"selected\"" : string.Empty;

				b.Append(string.Format("<option value=\"{0}\" {1}>{2}</option>", item.Oid, selected, item.Porcentaje));
			}
			b.Append("</select>");

			return MvcHtmlString.Create(b.ToString());
		}
        public List <CuentaResumen> GetCuentasAndImpuestosA3()
        {
            try
            {
                List <CuentaResumen> list      = new List <CuentaResumen>();
                ProductList          productos = ProductList.GetList(false, true);
                FamiliaList          familias  = FamiliaList.GetList(false, true);
                ImpuestoList         impuestos = ImpuestoList.GetList(false);
                bool        nuevo;
                ProductInfo producto;
                FamiliaInfo familia;
                string      cuenta;
                string      nombre;

                foreach (OutputInvoiceLineInfo item in _conceptos)
                {
                    ImpuestoResumen impuesto = new ImpuestoResumen();

                    nuevo    = true;
                    producto = productos.GetItem(item.OidProducto);
                    familia  = familias.GetItem(producto.OidFamilia);


                    cuenta = (producto.CuentaContableVenta == string.Empty) ? familia.CuentaContableVenta : producto.CuentaContableVenta;
                    nombre = (producto.CuentaContableVenta == string.Empty)
                            ? familia.Codigo + " " + familia.Nombre
                            : producto.Codigo + " " + producto.Nombre;

                    //Agrupamos los conceptos por cuentas contables
                    for (int i = 0; i < list.Count; i++)
                    {
                        CuentaResumen cr = list[i];

                        //Tiene prioridad la cuenta contable del producto
                        if (producto.CuentaContableVenta != string.Empty)
                        {
                            if ((cr.CuentaContable == producto.CuentaContableVenta) && (cr.Impuesto != null && cr.Impuesto.OidImpuesto == item.OidImpuesto))
                            {
                                cr.Importe                += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                                cr.Impuesto.Importe       += item.Impuestos;
                                cr.Impuesto.BaseImponible += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                                list[i] = cr;
                                nuevo   = false;
                                break;
                            }
                        }
                        //Luego la de la familia
                        else if ((cr.CuentaContable == familia.CuentaContableVenta) && (cr.Impuesto != null && cr.Impuesto.OidImpuesto == item.OidImpuesto))
                        {
                            cr.Importe                += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                            cr.Impuesto.Importe       += item.Impuestos;
                            cr.Impuesto.BaseImponible += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                            list[i] = cr;
                            nuevo   = false;
                            break;
                        }
                    }

                    if (nuevo)
                    {
                        CuentaResumen new_cr = new CuentaResumen
                        {
                            OidFamilia     = producto.OidFamilia,
                            Importe        = item.PDescuento > 0 ? item.BaseImponible : item.Subtotal,
                            CuentaContable = cuenta,
                            Nombre         = nombre,
                        };

                        if (item.Impuestos != 0)
                        {
                            ImpuestoInfo imp = null;

                            if (item.OidImpuesto != 0)
                            {
                                imp = impuestos.GetItem(item.OidImpuesto);
                            }
                            else
                            {
                                imp = impuestos.GetItemByProperty("Porcentaje", item.PImpuestos);
                            }

                            new_cr.Impuesto = new ImpuestoResumen
                            {
                                OidImpuesto           = item.OidImpuesto,
                                BaseImponible         = item.PDescuento > 0 ? item.BaseImponible : item.Subtotal,
                                Importe               = item.Impuestos,
                                SubtipoFacturaEmitida = imp.CodigoImpuestoA3Emitida,
                                Porcentaje            = item.PImpuestos,
                            };
                        }
                        //else
                        //{
                        //    new_cr.Impuesto = new ImpuestoResumen
                        //    {
                        //        OidImpuesto = item.OidImpuesto,
                        //        BaseImponible = 0,
                        //        Importe = 0
                        //    };
                        //}

                        list.Add(new_cr);
                    }
                }

                return(list);
            }
            catch
            {
                throw new iQException(String.Format(Resources.Messages.ERROR_FACTURA_CUENTA, NFactura, Cliente));
            }
        }
Beispiel #8
0
 protected override void GetFormSourceData()
 {
     _list = ImpuestoList.GetList();
 }