private void GenerarReporte()
        {
            List <TributarioDataSourceShow> tribut = new List <TributarioDataSourceShow>();

            tribut = this.negocioTributario.CargarInforme();
            EmpresaDataSource empresa = new EmpresaDataSource();

            empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
            List <TributarioDataSourceReport> tributR = new List <TributarioDataSourceReport>();

            this.Size = new Size(840, 566);
            foreach (TributarioDataSourceShow item in tribut)
            {
                TributarioDataSourceReport tribR = new TributarioDataSourceReport();
                tribR.Codigo     = item.Codigo;
                tribR.NombreTrib = item.NombreTrib;
                tribR.Tope       = item.Tope ?? default(decimal);
                tribR.NitTope    = item.NitTope;
                tribR.NombreNit  = item.NombreNit;
                tribR.NombreCia  = empresa.Nombrecia;
                tributR.Add(tribR);
            }

            ReporteTributario reporttribut = new ReporteTributario();

            reporttribut.SetDataSource(tributR);
            crystal_reporttribut.ReportSource = reporttribut;
        }
Beispiel #2
0
        /// <summary>
        /// guardar la empresa.
        /// </summary>
        /// <param name="compa">empresa a guardar</param>
        /// <returns>empresa que se ha guardado</returns>
        public EmpresaDataSource SaveEmpresa(compania compa)
        {
            EmpresaDataSource empresa = new EmpresaDataSource();

            try
            {
                var item = this.persistencia.CreateEmpresa(compa);
                empresa.Idcompania = item.idcompania;
                empresa.Nombrecia  = item.nombrecia;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(empresa);
        }
        private void Btn_informe_ButtonClick(object sender, EventArgs e)
        {
            List <CuentaDataSource> cuentas = new List <CuentaDataSource>();

            cuentas = this.negocioCuenta.CargarInforme(txt_cuentainiinforme.Text, txt_cuentafininforme.Text);
            EmpresaDataSource empresa = new EmpresaDataSource();

            empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
            List <CuentaDataSourceReports> cuentasR = new List <CuentaDataSourceReports>();

            foreach (CuentaDataSource item in cuentas)
            {
                CuentaDataSourceReports cuentaR = new CuentaDataSourceReports();
                cuentaR.Cuenta         = item.Cuenta;
                cuentaR.Nombre         = item.Nombre;
                cuentaR.Pidenit        = item.Pidenit == true ? "SI" : "NO";
                cuentaR.Tipocta        = item.Tipocta;
                cuentaR.Centro         = item.Centro == true ? "SI" : "NO";
                cuentaR.Cueaju         = item.Cueaju;
                cuentaR.Ajudoc         = item.Ajudoc;
                cuentaR.NombreCia      = empresa.Nombrecia;
                cuentaR.NombreSucursal = empresa.NombreSucursal;
                cuentaR.NitCia         = empresa.NitCia + " - " + empresa.DigitoCia;
                cuentaR.Porete         = item.Porete ?? default(decimal);
                cuentaR.Fecha          = fecha_informecuenta.Value.ToShortDateString();
                cuentasR.Add(cuentaR);
            }

            ReporteCuentas reportcuenta = new ReporteCuentas();

            reportcuenta.SetDataSource(cuentasR);
            crystal_reportecuenta.ReportSource = reportcuenta;
            this.Size = new Size(1003, 583);
            crystal_reportecuenta.Size         = new Size(987, 519);
            this.crystal_reportecuenta.Visible = true;
            this.lbl_cuentafinal.Visible       = false;
            this.lbl_cuentainicial.Visible     = false;
            this.txt_cuentainiinforme.Visible  = false;
            this.txt_nombrecuentafin.Visible   = false;
            this.txt_nombrecuentaini.Visible   = false;
            txt_cuentafininforme.Visible       = false;
            lbl_fecha.Visible           = false;
            fecha_informecuenta.Visible = false;
            this.CenterToScreen();
        }
Beispiel #4
0
        private void Btn_informe_ButtonClick(object sender, EventArgs e)
        {
            List <FormatoDataSourceShow> formato = new List <FormatoDataSourceShow>();

            formato = this.negocioFormato.CargarInforme(this.tipofor);
            EmpresaDataSource empresa = new EmpresaDataSource();

            empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
            List <FormatoDataSourceReport> formatoR = new List <FormatoDataSourceReport>();
            int    idform     = int.Parse(this.tipofor);
            string encabezado = this.negocioFormato.DevolverEncabezado(idform);

            foreach (FormatoDataSourceShow item in formato)
            {
                FormatoDataSourceReport formR = new FormatoDataSourceReport();
                formR.TipoFormato     = this.tipofor.ToUpper();
                formR.NombreEmpresa   = empresa.Nombrecia;
                formR.Encabezado      = encabezado;
                formR.ClaseCuenta     = item.ClaseCuenta;
                formR.NombreClase     = this.negocioCuenta.DevolverNombre(item.ClaseCuenta);
                formR.Linea           = item.Linea;
                formR.NombreLinea     = this.negocioCuenta.DevolverNombre(item.ClaseCuenta + item.Linea);
                formR.Nombre          = item.Nombre;
                formR.CuentaInicial   = item.CuentaInicial;
                formR.CuentaFinal     = item.CuentaFinal;
                formR.NombreCuentaIni = this.negocioCuenta.DevolverNombre(formR.CuentaInicial);
                formR.NombreCuentaFin = this.negocioCuenta.DevolverNombre(formR.CuentaFinal);
                formR.Fecha           = fecha_informecuenta.Value.ToShortDateString();
                formatoR.Add(formR);
            }

            ReporteFormato reportformato = new ReporteFormato();

            reportformato.SetDataSource(formatoR);
            crystal_reportformato.ReportSource = reportformato;
            this.Size = new Size(1003, 583);
            crystal_reportformato.Size         = new Size(987, 519);
            this.crystal_reportformato.Visible = true;
            lbl_fecha.Visible           = false;
            fecha_informecuenta.Visible = false;
            this.CenterToScreen();
        }
Beispiel #5
0
        private void Btn_informe_ButtonClick(object sender, EventArgs e)
        {
            if (this.ValidarGuardar())
            {
                List <PresupDataSource> presupuesto = new List <PresupDataSource>();
                presupuesto = this.negocioPresupuesto.DevolverPresu(txt_anio.Text, txt_cuenta.Text, int.Parse(txt_centro.Text), Program.compa);
                EmpresaDataSource empresa = new EmpresaDataSource();
                empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
                List <PresupShowDataSourceReporte> presupR = new List <PresupShowDataSourceReporte>();
                foreach (PresupDataSource item in presupuesto)
                {
                    PresupShowDataSourceReporte presupDev = new PresupShowDataSourceReporte();
                    presupDev.Anio          = item.Anio;
                    presupDev.NombreMes     = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(item.IdMes).ToUpper();
                    presupDev.Cuenta        = item.Cuenta + " - " + item.NombreCuenta;
                    presupDev.IdCentro      = Convert.ToString(item.IdCentro) + " - " + item.NombreCentro;
                    presupDev.Presupuesto   = item.Presupuesto;
                    presupDev.NombreEmpresa = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                    presupDev.NitEmpresa    = empresa.NitCia + " - " + empresa.DigitoCia;
                    presupDev.Fecha         = fecha_informepres.Value.ToShortDateString();
                    presupR.Add(presupDev);
                }

                ReportePresupuesto reportpresup = new ReportePresupuesto();
                reportpresup.SetDataSource(presupR);
                crystal_Presupuesto.ReportSource = reportpresup;
                this.Size = new Size(1003, 583);
                crystal_Presupuesto.Size         = new Size(987, 519);
                this.crystal_Presupuesto.Visible = true;
                this.lbl_cuenta.Visible          = false;
                this.lbl_anio.Visible            = false;
                this.txt_anio.Visible            = false;
                this.txt_descripcentro.Visible   = false;
                this.txt_nombrecuenta.Visible    = false;
                txt_cuenta.Visible        = false;
                lbl_centro.Visible        = false;
                txt_centro.Visible        = false;
                lbl_fecha.Visible         = false;
                fecha_informepres.Visible = false;
                this.CenterToScreen();
            }
        }
Beispiel #6
0
        public EmpresaDataSource DevolverDatosEmpresa(int empresa)
        {
            EmpresaDataSource empresadev = new EmpresaDataSource();

            try
            {
                var item = this.persistencia.DevolverDatosEmpresa(empresa);
                empresadev.Idcompania     = item.idsucursal;
                empresadev.Nombrecia      = item.compania.nombrecia;
                empresadev.NombreSucursal = item.nombresucursal;
                empresadev.NitCia         = item.compania.nit;
                empresadev.DigitoCia      = item.compania.digito;
                empresadev.NombreCiudad   = item.ciudad.nombreciudad;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(empresadev);
        }
        private void GenerarReporte(string tipo)
        {
            List <NitsDataSourceShow> nits = new List <NitsDataSourceShow>();

            if ("numero".Equals(tipo))
            {
                nits = this.negocioNits.CargarNitsReporteOrdeNumero();
            }
            else
            {
                nits = this.negocioNits.CargarNitsReporteOrdNombre();
            }
            this.Size = new Size(840, 566);
            List <NitsDataSourceReports> nitsR   = new List <NitsDataSourceReports>();
            EmpresaDataSource            empresa = new EmpresaDataSource();

            empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
            foreach (NitsDataSourceShow item in nits)
            {
                NitsDataSourceReports nitR = new NitsDataSourceReports();
                nitR.Nit            = item.Nit;
                nitR.Digito         = item.Digito;
                nitR.Tiponit        = item.Tiponit;
                nitR.Nombrenit      = item.Nombrenit;
                nitR.Direccion      = item.Direccion;
                nitR.Telefono       = item.Telefono;
                nitR.Celular        = item.Celular;
                nitR.Idpais         = item.NombrePais;
                nitR.Iddepartamento = item.NombreDepto;
                nitR.Idciudad       = item.NombreCiudad;
                nitR.Compania_nits  = empresa.Nombrecia;
                nitsR.Add(nitR);
            }

            ReporteNits reportnit = new ReporteNits();

            reportnit.SetDataSource(nitsR);
            crystal_reportnits.ReportSource = reportnit;
        }
Beispiel #8
0
        /// <summary>
        /// Cargar empresa.
        /// </summary>
        /// <returns>lista de las empresas que se encuentran en la tabla</returns>
        public List <EmpresaDataSource> CargarEmpresa()
        {
            List <EmpresaDataSource> empresa = new List <EmpresaDataSource>();

            try
            {
                var items = this.persistencia.CargarEmpresa();
                foreach (var item in items)
                {
                    EmpresaDataSource eds = new EmpresaDataSource();
                    eds.Idcompania = item.idcompania;
                    eds.Nombrecia  = item.nombrecia;
                    empresa.Add(eds);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(empresa);
        }
        private void GenerarReporte(string cualasi)
        {
            EmpresaDataSource              empresa = new EmpresaDataSource();
            List <CuentaDataSource>        cuenta  = new List <CuentaDataSource>();
            List <SaldosCuentasDataSource> saldos  = new List <SaldosCuentasDataSource>();

            saldos = this.balance;
            try
            {
                empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
            }
            catch (Exception ex)
            {
                MessageBox.Show("SE PRESENTO UN ERROR" + ex.Message, "ERROR", MessageBoxButtons.OK);
            }

            switch (cualasi)
            {
            case "mayor":

                this.Text = "LIBRO MAYOR";
                crystal_ReporteInv.Visible = true;
                List <LibroDiarioDataSourceReports> balanceRe = new List <LibroDiarioDataSourceReports>();
                if (saldos.Count() > 0)
                {
                    for (int i = 0; i < saldos.Count(); i++)
                    {
                        LibroDiarioDataSourceReports balanceR = new LibroDiarioDataSourceReports();
                        if (this.encabezado)
                        {
                            balanceR.MesyAnio = "MES : " + saldos[i].Mes + "   AÑO : " + saldos[i].Anio;
                            balanceR.Compania = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                            balanceR.FechaAct = "FECHA: " + this.fecha;
                            balanceR.Titulo   = "LIBRO MAYOR ";
                        }
                        else
                        {
                            balanceR.Titulo = null;
                        }

                        balanceR.Cuenta = saldos[i].Cuenta + " " + saldos[i].NombreCuenta;
                        balanceR.SaldoAnteriorDebito  = saldos[i].SaldoAnterior > 0 ? saldos[i].SaldoAnterior : 0;
                        balanceR.SaldoAnteriorCredito = saldos[i].SaldoAnterior < 0 ? saldos[i].SaldoAnterior : 0;
                        balanceR.Valorcredito         = saldos[i].ValorCredito;
                        balanceR.Valordebito          = saldos[i].ValorDebito;
                        balanceR.SaldoActualCredito   = saldos[i].SaldoActual < 0 ? saldos[i].SaldoActual : 0;
                        balanceR.SaldoActualDebito    = saldos[i].SaldoActual > 0 ? saldos[i].SaldoActual : 0;
                        balanceRe.Add(balanceR);
                    }
                }

                ReporteLibroMayor reportelibro = new ReporteLibroMayor();
                reportelibro.SetDataSource(balanceRe);
                crystal_ReporteInv.ReportSource = reportelibro;
                this.Size = new Size(1003, 583);
                crystal_ReporteInv.Size = new Size(987, 519);
                break;

            case "anio":

                List <LibroAuxiliarDataSource> saldos1 = new List <LibroAuxiliarDataSource>();
                saldos1   = this.libro;
                this.Text = "LIBRO MAYOR";
                crystal_ReporteInv.Visible = true;
                List <LibroAuxiliarDataSourceReports> balanceRl = new List <LibroAuxiliarDataSourceReports>();
                if (saldos1.Count() > 0)
                {
                    for (int i = 0; i < saldos1.Count(); i++)
                    {
                        LibroAuxiliarDataSourceReports balanceR = new LibroAuxiliarDataSourceReports();
                        balanceR.Compania      = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                        balanceR.FechayHoraAct = "HORA HH:MM:SS " + DateTime.Now.ToShortTimeString() + "   FECHA DE IMPRESIÓN: " + DateTime.Now.ToShortDateString();
                        balanceR.Titulo        = "LIBRO AUXILIAR ";
                        balanceR.NitCia        = "NIT  " + empresa.NitCia + "-" + empresa.DigitoCia;
                        balanceR.FechasEntre   = "DEL DD/MM/YYY : " + fechai.ToString() + "AL  " + fechaf.ToString();
                        balanceR.Totales       = this.totales == true ? null : "NOTOTALES";
                        if (this.nit)
                        {
                            List <SaldosNitsDataSource> nitssaldos = new List <SaldosNitsDataSource>();
                            balanceR.Cuenta = saldos1[i].Cuenta;
                            try
                            {
                                nitssaldos = this.negocioAsiento.SaldosNits(saldos1[i].Cuenta, saldos1[i].Anio, saldos1[i].Mes, saldos1[i].Sucursal);
                                if (nitssaldos != null)
                                {
                                    foreach (SaldosNitsDataSource nit in nitssaldos)
                                    {
                                        balanceR.Nit = "NIT: " + nit.Nit + "-" + nit.Digito + "-" + nit.Nombrenit;
                                        balanceR.SaldoAnteriorNit = nit.SaldoAnterioMes;
                                        balanceR.SaldoActual      = nit.SaldoNit;
                                        balanceR.ValorCreditoNit  = nit.CreditoNit;
                                        balanceR.ValorDebitoNit   = nit.DebitoNit;
                                        balanceR.CuentaMayor      = saldos1[i].Cuenta.Substring(0, 4) + "   " + this.negocioCuenta.DevolverNombre(saldos1[i].Cuenta.Substring(0, 4));
                                        balanceR.Cuenta           = saldos1[i].Cuenta + " " + saldos1[i].NombreCuenta;
                                        balanceR.FechaCompr       = saldos1[i].Fecha.ToShortDateString();
                                        balanceR.CentroCosto      = Convert.ToString(saldos1[1].Idcentro);
                                        balanceR.Comprobante      = saldos1[i].Comproban;
                                        balanceR.Asiento          = saldos1[i].Documento;
                                        balanceR.Descriptransa    = saldos1[i].Descripcion;
                                        balanceR.Valorcredito     = saldos1[i].Valorcredito;
                                        balanceR.Valordebito      = saldos1[i].Valordebito;
                                        balanceRl.Add(balanceR);
                                    }
                                }
                                else
                                {
                                    balanceR.CuentaMayor   = saldos1[i].Cuenta.Substring(0, 4) + "   " + this.negocioCuenta.DevolverNombre(saldos1[i].Cuenta.Substring(0, 4));
                                    balanceR.Cuenta        = saldos1[i].Cuenta + " " + saldos1[i].NombreCuenta;
                                    balanceR.FechaCompr    = saldos1[i].Fecha.ToShortDateString();
                                    balanceR.CentroCosto   = Convert.ToString(saldos1[1].Idcentro);
                                    balanceR.Comprobante   = saldos1[i].Comproban;
                                    balanceR.Asiento       = saldos1[i].Documento;
                                    balanceR.Descriptransa = saldos1[i].Descripcion;
                                    balanceR.Valorcredito  = saldos1[i].Valorcredito;
                                    balanceR.Valordebito   = saldos1[i].Valordebito;
                                    balanceRl.Add(balanceR);
                                }
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }
                        else
                        {
                            balanceR.CuentaMayor   = saldos1[i].Cuenta.Substring(0, 4) + "   " + this.negocioCuenta.DevolverNombre(saldos1[i].Cuenta.Substring(0, 4));
                            balanceR.Cuenta        = saldos1[i].Cuenta + " " + saldos1[i].NombreCuenta;
                            balanceR.FechaCompr    = saldos1[i].Fecha.ToShortDateString();
                            balanceR.CentroCosto   = Convert.ToString(saldos1[1].Idcentro);
                            balanceR.Comprobante   = saldos1[i].Comproban;
                            balanceR.Asiento       = saldos1[i].Documento;
                            balanceR.Descriptransa = saldos1[i].Descripcion;
                            balanceR.Valorcredito  = saldos1[i].Valorcredito;
                            balanceR.Valordebito   = saldos1[i].Valordebito;
                            balanceRl.Add(balanceR);
                        }
                    }
                }
                ReporteLibroAuxiliar reporteaux = new ReporteLibroAuxiliar();
                reporteaux.SetDataSource(balanceRl);
                crystal_ReportAux.ReportSource = reporteaux;
                this.Size = new Size(1003, 583);
                crystal_ReportAux.Size = new Size(987, 519);
                break;
            }
        }
        private void GenerarReporte(string cualasi)
        {
            EmpresaDataSource              empresa = new EmpresaDataSource();
            List <CuentaDataSource>        cuenta  = new List <CuentaDataSource>();
            List <SaldosCuentasDataSource> saldos  = new List <SaldosCuentasDataSource>();

            saldos = this.balance;
            try
            {
                empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
            }
            catch (Exception ex)
            {
                MessageBox.Show("SE PRESENTO UN ERROR" + ex.Message, "ERROR", MessageBoxButtons.OK);
            }

            switch (cualasi)
            {
            case "mes":

                this.Text = "BALANCE DE PRUEBA POR MES";
                crystal_reportebalance.Visible = true;
                List <BalanceDataSourceReports> balanceRe = new List <BalanceDataSourceReports>();
                if (saldos.Count() > 0)
                {
                    for (int i = 0; i < saldos.Count(); i++)
                    {
                        BalanceDataSourceReports balanceR = new BalanceDataSourceReports();
                        if (this.encabezado)
                        {
                            balanceR.MesyAnio     = "MES : " + saldos[i].Mes + "   AÑO : " + saldos[i].Anio;
                            balanceR.CompaniayNit = empresa.Nombrecia + " - " + empresa.NombreSucursal + " - " + empresa.NitCia + " - " + empresa.DigitoCia;
                            balanceR.FechaAct     = "FECHA DE IMPRESION DD/MM/YYYY: " + this.fecha;
                            balanceR.Titulo       = "BALANCE DE PRUEBA A ";
                        }
                        else
                        {
                            balanceR.Titulo = null;
                        }

                        if (this.terceros)
                        {
                            List <SaldosNitsDataSource> nitssaldos = new List <SaldosNitsDataSource>();
                            balanceR.Cuenta = saldos[i].Cuenta;
                            try
                            {
                                nitssaldos = this.negocioAsiento.SaldosNits(saldos[i].Cuenta, saldos[i].Anio, saldos[i].Mes, saldos[i].Sucursal);
                                if (nitssaldos != null)
                                {
                                    foreach (SaldosNitsDataSource nit in nitssaldos)
                                    {
                                        balanceR.TituloNit         = "TERCEROS DE ESTA CUENTA:";
                                        balanceR.Nit               = nit.Nit + "-" + nit.Digito + "-" + nit.Nombrenit;
                                        balanceR.SaldoAnteriorNit  = nit.SaldoAnterioMes;
                                        balanceR.SaldoActualNit    = nit.SaldoNit;
                                        balanceR.ValorCreditoNit   = nit.CreditoNit;
                                        balanceR.ValorDebitoNit    = nit.DebitoNit;
                                        balanceR.CuentaMayor       = saldos[i].Cuenta.Substring(0, 4);
                                        balanceR.Cuenta            = saldos[i].Cuenta + " " + saldos[i].NombreCuenta;
                                        balanceR.NombreCuentaMayor = this.negocioCuenta.DevolverNombre(balanceR.CuentaMayor);
                                        balanceR.SaldoAnterior     = saldos[i].SaldoAnterior;
                                        balanceR.Valorcredito      = saldos[i].ValorCredito;
                                        balanceR.Valordebito       = saldos[i].ValorDebito;
                                        balanceR.SaldoActual       = saldos[i].SaldoActual;
                                        balanceRe.Add(balanceR);
                                    }
                                }
                                else
                                {
                                    balanceR.CuentaMayor       = saldos[i].Cuenta.Substring(0, 4);
                                    balanceR.Cuenta            = saldos[i].Cuenta + " " + saldos[i].NombreCuenta;
                                    balanceR.NombreCuentaMayor = this.negocioCuenta.DevolverNombre(balanceR.CuentaMayor);
                                    balanceR.SaldoAnterior     = saldos[i].SaldoAnterior;
                                    balanceR.Valorcredito      = saldos[i].ValorCredito;
                                    balanceR.Valordebito       = saldos[i].ValorDebito;
                                    balanceR.SaldoActual       = saldos[i].SaldoActual;
                                    balanceRe.Add(balanceR);
                                }
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }
                        else
                        {
                            balanceR.CuentaMayor       = saldos[i].Cuenta.Substring(0, 4);
                            balanceR.Cuenta            = saldos[i].Cuenta + " " + saldos[i].NombreCuenta;
                            balanceR.NombreCuentaMayor = this.negocioCuenta.DevolverNombre(balanceR.CuentaMayor);
                            balanceR.SaldoAnterior     = saldos[i].SaldoAnterior;
                            balanceR.Valorcredito      = saldos[i].ValorCredito;
                            balanceR.Valordebito       = saldos[i].ValorDebito;
                            balanceR.SaldoActual       = saldos[i].SaldoActual;
                            balanceRe.Add(balanceR);
                        }
                    }
                }

                ReporteBalance reportebalance = new ReporteBalance();
                reportebalance.SetDataSource(balanceRe);
                crystal_reportebalance.ReportSource = reportebalance;
                this.Size = new Size(1003, 583);
                crystal_reportebalance.Size = new Size(987, 519);
                break;

            case "anual":

                this.Text = "BALANCE DE PRUEBA ANUAL";
                crystal_reporteanual.Visible = true;
                List <SaldoAnualDataSource> salanual = new List <SaldoAnualDataSource>();
                salanual = this.saldoanual;
                List <SaldosAnualDataSourceReports> balananual = new List <SaldosAnualDataSourceReports>();
                if (salanual.Count() > 0)
                {
                    for (int i = 0; i < salanual.Count(); i++)
                    {
                        SaldosAnualDataSourceReports balanceR = new SaldosAnualDataSourceReports();
                        if (this.encabezado)
                        {
                            balanceR.CompaniayNit = empresa.Nombrecia + " - " + empresa.NombreSucursal + " - " + empresa.NitCia + " - " + empresa.DigitoCia;
                            balanceR.FechaAct     = "FECHA DE IMPRESION DD/MM/YYYY: " + DateTime.Now.ToShortDateString();
                            string aniotraba = this.negocioParametro.AnioTrabajo();
                            balanceR.Titulo = "BALANCE DE PRUEBA AÑO:" + aniotraba;
                        }
                        else
                        {
                            balanceR.Titulo = null;
                        }

                        balanceR.CuentaMayor       = salanual[i].Cuenta.Substring(0, 4);
                        balanceR.Cuenta            = salanual[i].Cuenta + " " + salanual[i].NombreCuenta;
                        balanceR.NombreCuentaMayor = this.negocioCuenta.DevolverNombre(balanceR.CuentaMayor);
                        balanceR.SaldoEnero        = salanual[i].SaldoEnero;
                        balanceR.SaldoFebrero      = salanual[i].SaldoFebrero;
                        balanceR.SaldoMarzo        = salanual[i].SaldoMarzo;
                        balanceR.SaldoAbril        = salanual[i].SaldoAbril;
                        balanceR.SaldoMayo         = salanual[i].SaldoMayo;
                        balanceR.SaldoJunio        = salanual[i].SaldoJunio;
                        balanceR.SaldoJulio        = salanual[i].SaldoJulio;
                        balanceR.SaldoAgosto       = salanual[i].SaldoAgosto;
                        balanceR.SaldoSeptiembre   = salanual[i].SaldoSeptiembre;
                        balanceR.SaldoOctubre      = salanual[i].SaldoOctubre;
                        balanceR.SaldoNoviembre    = salanual[i].SaldoNoviembre;
                        balanceR.SaldoDiciembre    = salanual[i].SaldoDiciembre;
                        balananual.Add(balanceR);
                    }
                }

                ReporteBalanceAnual reportebalanceanual = new ReporteBalanceAnual();
                reportebalanceanual.SetDataSource(balananual);
                crystal_reporteanual.ReportSource = reportebalanceanual;
                this.Size = new Size(1003, 583);
                crystal_reporteanual.Size = new Size(987, 519);
                break;

            case "inventario":
                saldos    = this.balance;
                this.Text = "LIBRO DE INVENTARIOS Y BALANCES";
                crystal_ReporteInv.Visible = true;
                List <InventarioDataSourceReports> balanceRi = new List <InventarioDataSourceReports>();
                if (saldos.Count() > 0)
                {
                    for (int i = 0; i < saldos.Count(); i++)
                    {
                        InventarioDataSourceReports balanceR = new InventarioDataSourceReports();
                        if (this.encabezado)
                        {
                            balanceR.MesyAnio = "MES : " + saldos[i].Mes + "   AÑO : " + saldos[i].Anio;
                            balanceR.Compania = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                            balanceR.Nit      = empresa.NitCia + " - " + empresa.DigitoCia;
                            balanceR.FechaAct = this.fecha;
                            balanceR.Titulo   = "LIBRO DE INVENTARIOS Y BALANCES A ";
                        }
                        else
                        {
                            balanceR.Titulo = null;
                        }

                        if (this.terceros)
                        {
                            List <SaldosNitsDataSource> nitssaldos = new List <SaldosNitsDataSource>();
                            balanceR.Cuenta = saldos[i].Cuenta;
                            try
                            {
                                nitssaldos = this.negocioAsiento.SaldosNits(saldos[i].Cuenta, saldos[i].Anio, saldos[i].Mes, saldos[i].Sucursal);
                                if (nitssaldos != null)
                                {
                                    foreach (SaldosNitsDataSource nit in nitssaldos)
                                    {
                                        balanceR.TituloNit         = "TERCEROS DE ESTA CUENTA:";
                                        balanceR.Nit               = nit.Nit + "-" + nit.Digito + "-" + nit.Nombrenit;
                                        balanceR.SaldoActualNit    = nit.SaldoNit;
                                        balanceR.CuentaMayor       = saldos[i].Cuenta.Substring(0, 4);
                                        balanceR.Cuenta            = saldos[i].Cuenta + " " + saldos[i].NombreCuenta;
                                        balanceR.NombreCuentaMayor = this.negocioCuenta.DevolverNombre(balanceR.CuentaMayor);
                                        balanceR.SaldoActual       = saldos[i].SaldoActual;
                                        balanceRi.Add(balanceR);
                                    }
                                }
                                else
                                {
                                    balanceR.CuentaMayor       = saldos[i].Cuenta.Substring(0, 4);
                                    balanceR.Cuenta            = saldos[i].Cuenta + " " + saldos[i].NombreCuenta;
                                    balanceR.NombreCuentaMayor = this.negocioCuenta.DevolverNombre(balanceR.CuentaMayor);
                                    balanceR.SaldoActual       = saldos[i].SaldoActual;
                                    balanceRi.Add(balanceR);
                                }
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }
                        else
                        {
                            balanceR.CuentaMayor       = saldos[i].Cuenta.Substring(0, 4);
                            balanceR.Cuenta            = saldos[i].Cuenta + " " + saldos[i].NombreCuenta;
                            balanceR.NombreCuentaMayor = this.negocioCuenta.DevolverNombre(balanceR.CuentaMayor);
                            balanceR.SaldoActual       = saldos[i].SaldoActual;
                            balanceRi.Add(balanceR);
                        }
                    }
                }

                ReporteInventarioBalance reporteinventario = new ReporteInventarioBalance();
                reporteinventario.SetDataSource(balanceRi);
                crystal_ReporteInv.ReportSource = reporteinventario;
                this.Size = new Size(1003, 583);
                crystal_ReporteInv.Size = new Size(987, 519);
                break;
            }
        }
Beispiel #11
0
        private void GenerarReporte(string cualasi)
        {
            EmpresaDataSource empresa = new EmpresaDataSource();

            try
            {
                empresa = this.negocioEmpresa.DevolverDatosEmpresa(Program.compa);
            }
            catch (Exception ex)
            {
                MessageBox.Show("SE PRESENTO UN ERROR" + ex.Message, "ERROR", MessageBoxButtons.OK);
            }
            List <AsientoDataSource> asiento = new List <AsientoDataSource>();

            switch (cualasi)
            {
            case "actual":
                asiento = this.asientoshow;
                string comprob = string.Empty;
                this.Text = "REPORTE ASIENTO";
                try
                {
                    comprob = this.negocioComprobante.DevolverNombre(asiento[0].Codcompr);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("SE PRESENTO UN ERROR" + ex.Message, "ERROR", MessageBoxButtons.OK);
                }

                List <AsientoDataSourceReports> asientoRe = new List <AsientoDataSourceReports>();
                for (int i = 0; i < asiento.Count(); i++)
                {
                    AsientoDataSourceReports asientoR = new AsientoDataSourceReports();
                    asientoR.IdAsiento = asiento[i].IdAsiento;
                    asientoR.Compania  = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                    asientoR.Comproban = asiento[i].Codcompr + " - " + comprob;
                    asientoR.Documento = asiento[i].Documento;
                    asientoR.Cuenta    = asiento[i].Cuenta;
                    asientoR.FechaAct  = "FECHA : " + DateTime.Now.ToShortTimeString();
                    asientoR.Fecha     = asiento[i].Fecha.ToShortDateString();
                    asientoR.Idcentro  = asiento[i].Idcentro ?? default(int);
                    asientoR.IdNit     = asiento[i].IdNit != null?this.negocioNits.DevolverNit(asiento[i].IdNit) : string.Empty;

                    asientoR.Cheque       = asiento[i].Cheque;
                    asientoR.Descripcion  = asiento[i].Descripcion;
                    asientoR.Valordebito  = asiento[i].Valordebito;
                    asientoR.Valorcredito = asiento[i].Valorcredito;
                    asientoRe.Add(asientoR);
                }

                ReporteAsiento reportasiento = new ReporteAsiento();
                reportasiento.SetDataSource(asientoRe);
                crystal_reportasiento.ReportSource = reportasiento;
                this.Size = new Size(1003, 583);
                crystal_reportasiento.Size = new Size(987, 519);
                break;

            case "borrados":

                List <AsientoDataSourceShow> asientobor = new List <AsientoDataSourceShow>();
                this.Text = "REPORTE ASIENTOS BORRADOS";
                try
                {
                    asientobor = this.negocioAsiento.CargarInforme("borrados", Program.compa);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("SE PRESENTO UN ERROR" + ex.Message, "ERROR", MessageBoxButtons.OK);
                }

                List <AsientoDataSourceReports> asientoRep = new List <AsientoDataSourceReports>();
                foreach (AsientoDataSourceShow item in asientobor)
                {
                    AsientoDataSourceReports asientoR = new AsientoDataSourceReports();
                    asientoR.IdAsiento    = item.IdAsiento;
                    asientoR.Compania     = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                    asientoR.FechaAct     = "FECHA : " + DateTime.Now.ToShortTimeString();
                    asientoR.Comproban    = item.Comproban;
                    asientoR.Documento    = item.Documento;
                    asientoR.Cuenta       = item.Cuenta;
                    asientoR.Fecha        = "FECHA : " + item.Fecha;
                    asientoR.Idcentro     = item.Idcentro ?? default(int);
                    asientoR.IdNit        = item.IdNit;
                    asientoR.Cheque       = item.Cheque;
                    asientoR.Descripcion  = item.Descripcion;
                    asientoR.Valordebito  = item.Valordebito;
                    asientoR.Valorcredito = item.Valorcredito;
                    asientoRep.Add(asientoR);
                }

                ReporteAsiento reportasientobor = new ReporteAsiento();
                reportasientobor.SetDataSource(asientoRep);
                crystal_reportasiento.ReportSource = reportasientobor;
                this.Size = new Size(1003, 583);
                crystal_reportasiento.Size = new Size(987, 519);
                break;

            case "fijos":
                List <AsientoDataSourceShow> asientofijo = new List <AsientoDataSourceShow>();
                this.Text = "REPORTE ASIENTOS FIJOS";
                try
                {
                    asientofijo = this.negocioAsiento.CargarInforme("fijos", Program.compa);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("SE PRESENTO UN ERROR" + ex.Message, "ERROR", MessageBoxButtons.OK);
                }

                List <AsientoDataSourceReports> asientoRepo = new List <AsientoDataSourceReports>();
                foreach (AsientoDataSourceShow item in asientofijo)
                {
                    AsientoDataSourceReports asientoR = new AsientoDataSourceReports();
                    asientoR.IdAsiento    = item.IdAsiento;
                    asientoR.FechaAct     = "FECHA : " + DateTime.Now.ToShortTimeString();
                    asientoR.Compania     = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                    asientoR.Comproban    = item.Comproban;
                    asientoR.Documento    = item.Documento.Replace("FIJO", string.Empty);
                    asientoR.Cuenta       = item.Cuenta;
                    asientoR.Fecha        = item.Fecha;
                    asientoR.Idcentro     = item.Idcentro ?? default(int);
                    asientoR.IdNit        = item.IdNit;
                    asientoR.Cheque       = item.Cheque;
                    asientoR.Descripcion  = item.Descripcion;
                    asientoR.Valordebito  = item.Valordebito;
                    asientoR.Valorcredito = item.Valorcredito;
                    asientoRepo.Add(asientoR);
                }

                ReporteAsiento reportasientofij = new ReporteAsiento();
                reportasientofij.SetDataSource(asientoRepo);
                crystal_reportasiento.ReportSource = reportasientofij;
                this.Size = new Size(1003, 583);
                crystal_reportasiento.Size = new Size(987, 519);
                break;


            case "sinact":
                List <AsientoDataSourceReports> asientoRsinAct = new List <AsientoDataSourceReports>();
                this.Text = "REPORTE ASIENTOS SIN ACTUALIZAR";
                foreach (AsientoDataSourceShow item in this.asientosllega)
                {
                    AsientoDataSourceReports asientoR = new AsientoDataSourceReports();
                    asientoR.IdAsiento = item.IdAsiento;
                    if (this.encabezado)
                    {
                        asientoR.Compania = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                        asientoR.FechaAct = "FECHA : " + DateTime.Now.ToShortTimeString();
                    }

                    asientoR.Comproban    = item.Comproban;
                    asientoR.Documento    = item.Documento;
                    asientoR.Cuenta       = item.Cuenta;
                    asientoR.Fecha        = item.Fecha;
                    asientoR.Idcentro     = item.Idcentro ?? default(int);
                    asientoR.IdNit        = item.IdNit;
                    asientoR.Cheque       = item.Cheque;
                    asientoR.Descripcion  = item.Descripcion;
                    asientoR.Valordebito  = item.Valordebito;
                    asientoR.Valorcredito = item.Valorcredito;
                    asientoRsinAct.Add(asientoR);
                }

                ReporteAsiento reportasientosinact = new ReporteAsiento();
                reportasientosinact.SetDataSource(asientoRsinAct);
                crystal_reportasiento.ReportSource = reportasientosinact;
                this.Size = new Size(1003, 583);
                crystal_reportasiento.Size = new Size(987, 519);
                break;

            case "librodiario":
                List <AsientoDataSourceReports> asientoRlibrodiario = new List <AsientoDataSourceReports>();
                this.Text = "REPORTE LIBRO DIARIO";
                foreach (AsientoDataSourceShow item in this.asientosllega)
                {
                    AsientoDataSourceReports asientoR = new AsientoDataSourceReports();
                    asientoR.IdAsiento = item.IdAsiento;
                    if (this.encabezado)
                    {
                        asientoR.Compania = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                        asientoR.FechaAct = "FECHA : " + DateTime.Now.ToShortTimeString();
                    }
                    asientoR.Comproban    = item.Comproban;
                    asientoR.Documento    = item.Documento;
                    asientoR.Cuenta       = item.Cuenta;
                    asientoR.Fecha        = item.Fecha;
                    asientoR.Idcentro     = item.Idcentro ?? default(int);
                    asientoR.IdNit        = item.IdNit;
                    asientoR.Cheque       = item.Cheque;
                    asientoR.Descripcion  = item.Descripcion;
                    asientoR.Valordebito  = item.Valordebito;
                    asientoR.Valorcredito = item.Valorcredito;
                    asientoRlibrodiario.Add(asientoR);
                }

                ReporteAsiento reportasientolibro = new ReporteAsiento();
                reportasientolibro.SetDataSource(asientoRlibrodiario);
                crystal_reportasiento.ReportSource = reportasientolibro;
                this.Size = new Size(1003, 583);
                crystal_reportasiento.Size = new Size(987, 519);
                break;

            case "libroresumido":
                List <AsientoDataSourceReports> asientoRlibroresumido = new List <AsientoDataSourceReports>();
                this.Text = "REPORTE LIBRO RESUMIDO";
                foreach (AsientoDataSourceShow item in this.asientosllega)
                {
                    AsientoDataSourceReports asientoR = new AsientoDataSourceReports();
                    asientoR.IdAsiento = item.IdAsiento;
                    if (this.encabezado)
                    {
                        asientoR.Compania = empresa.Nombrecia + " - " + empresa.NombreSucursal;
                        asientoR.FechaAct = "FECHA : " + DateTime.Now.ToShortTimeString();
                    }
                    asientoR.Comproban    = item.Comproban;
                    asientoR.Documento    = item.Documento;
                    asientoR.Cuenta       = item.Cuenta;
                    asientoR.Fecha        = item.Fecha;
                    asientoR.Idcentro     = item.Idcentro ?? default(int);
                    asientoR.IdNit        = item.IdNit;
                    asientoR.Cheque       = item.Cheque;
                    asientoR.Descripcion  = item.Descripcion;
                    asientoR.Valordebito  = item.Valordebito;
                    asientoR.Valorcredito = item.Valorcredito;
                    asientoRlibroresumido.Add(asientoR);
                }

                ReporteLibroResumido reportasientolibrores = new ReporteLibroResumido();
                reportasientolibrores.SetDataSource(asientoRlibroresumido);
                crystal_ReporteResumido.ReportSource = reportasientolibrores;
                this.Size = new Size(1003, 583);
                crystal_ReporteResumido.Size = new Size(987, 519);
                break;
            }
        }