private void Guardar()
 {
     sys_configuracion oSysConfig = new sys_configuracion();
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     if (this.lblCodigo.Text == "")
     {
         oSysConfig.nombre = this.txtNombre.Text;
         oSysConfig.valor = this.txtValor.Text;
         oSysConfig.observacion = this.txtObsevacion.Text;
         oSysConfigImplement.Save(oSysConfig);
     }
     else
     {
         DataGridViewRow row = this.dgvConfig.CurrentRow;
         int id = Convert.ToInt32(row.Cells[0].Value);
         oSysConfig = oSysConfigImplement.Get(id);
         oSysConfig.nombre = this.txtNombre.Text;
         oSysConfig.valor = this.txtValor.Text;
         oSysConfig.observacion = this.txtObsevacion.Text;
         oSysConfigImplement.Update(oSysConfig);
     }
     Deshabilitar();
     this.txtNombre.Text = "";
     this.txtValor.Text = "";
     this.txtObsevacion.Text = "";
     CargarGrid();
 }
        private void Generar()
        {
            string UltimoPeriodo="";
            pgbProgreso.Value = 0;
            pgbProgreso.Minimum = 0;
            pgbProgreso.Visible = true;
            DateTime StartDate = new DateTime(int.Parse(this.mtbDesde.Text.Substring(0, 4)),int.Parse( this.mtbDesde.Text.Substring(5, 2)), 1);
            DateTime EndDate = new DateTime(int.Parse(this.mtbHasta.Text.Substring(0, 4)), int.Parse(this.mtbHasta.Text.Substring(5, 2)), 1);
            //Calculo diferencia de meses para utilizar en la barra de progreso
            pgbProgreso.Maximum = Math.Abs((EndDate.Month - StartDate.Month) + 12 * (EndDate.Year - StartDate.Year));
            int MonthInterval = 1;
            PeriodosImplement oPeriodoImplement = new PeriodosImplement();
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();
            sys_configuracion oSysUltimoPeriodo = new sys_configuracion();
            oSysUltimoPeriodo = oSysConfigImplement.GetByNombre("UltimoPeriodo");
            UltimoPeriodo = oSysUltimoPeriodo.valor;
            //voy sumando meses hasta llegar a iguales fechas
            while (StartDate.AddMonths(MonthInterval) <= EndDate)
            {
                StartDate = StartDate.AddMonths(MonthInterval);
                periodos oPeriodo = new periodos();
                oPeriodo.id_periodo = StartDate.Date.ToString("yyyyMMdd").Substring(0,6);
                DateTime PrimerVencimiento = DateTime.Parse(oPeriodo.id_periodo.Substring(0, 4) + "/" + oPeriodo.id_periodo.Substring(4, 2)+"/" + this.txtPrimerVenc.Text);
                // incremento el dia mientra no sea fin de semana(se puede agregar para feriados - primer vencimiento
                while (PrimerVencimiento.DayOfWeek == DayOfWeek.Saturday || PrimerVencimiento.DayOfWeek == DayOfWeek.Sunday)
                {
                    PrimerVencimiento=PrimerVencimiento.Date.AddDays(1);
                }
                DateTime segundoVencimiento = PrimerVencimiento.Date.AddDays(int.Parse(this.txtDiasEntre.Text));
                // incremento el dia mientra no sea fin de semana(se puede agregar para feriados - segundo vencimiento
                while (segundoVencimiento.DayOfWeek == DayOfWeek.Saturday || segundoVencimiento.DayOfWeek == DayOfWeek.Sunday)
                {
                    segundoVencimiento = segundoVencimiento.Date.AddDays(1);
                }
                oPeriodo.fecha_primer_venc = PrimerVencimiento;
                oPeriodo.fecha_segundo_venc = segundoVencimiento;
                oPeriodo.fecha_tercer_venc = null;
                oPeriodo.fecha_facturacion = null;
                oPeriodo.facturado = false;
                oPeriodoImplement.Save(oPeriodo);
                UltimoPeriodo=oPeriodo.id_periodo;
                pgbProgreso.Value += 1;
            }

            if (oSysUltimoPeriodo.valor != UltimoPeriodo)
            {
                oSysUltimoPeriodo.valor = UltimoPeriodo;
                oSysConfigImplement.Update(oSysUltimoPeriodo);
                MessageBox.Show("La Generación se realizo Exitosamente");
                Inicializar();
            }
            else {
                MessageBox.Show("La Generación fue nula");
            }
        }
        private void CargarSeleccion()
        {
            sys_configuracion oSysConfig = new sys_configuracion();
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();
            DataGridViewRow row = this.dgvConfig.CurrentRow;
            int id = Convert.ToInt32(row.Cells[0].Value);
            oSysConfig = oSysConfigImplement.Get(id);

            this.lblCodigo.Text = oSysConfig.id_configuracion.ToString();
            this.txtNombre.Text = oSysConfig.nombre;
            this.txtValor.Text = oSysConfig.valor;
            this.txtObsevacion.Text = oSysConfig.observacion;
            this.gbConfig.Enabled = false;
            Deshabilitar();
        }
 private void CargarVencimientos()
 {
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     sys_configuracion oSysDiaPrimerVencimiento = new sys_configuracion();
     sys_configuracion oSysUltimoPeriodo = new sys_configuracion();
     sys_configuracion oSysDíasEntreVenc2 = new sys_configuracion();
     oSysDiaPrimerVencimiento = oSysConfigImplement.GetByNombre("DiaPrimerVencimiento");
     oSysDíasEntreVenc2 = oSysConfigImplement.GetByNombre("DíasEntreVenc2");
     oSysUltimoPeriodo = oSysConfigImplement.GetByNombre("UltimoPeriodo");
     this.mtbDesde.Text = oSysUltimoPeriodo.valor;
     this.txtDiasEntre.Text = oSysDíasEntreVenc2.valor;
     this.txtPrimerVenc.Text = oSysDiaPrimerVencimiento.valor;
     this.mtbDesde.Enabled = false;
     this.txtDiasEntre.Enabled = false;
     this.txtPrimerVenc.Enabled = false;
 }
Beispiel #5
0
 private void Imprimir()
 {
     CalleImplement oCalleImplement = new CalleImplement();
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     Reportes.frmReportes frmRpt= new Reportes.frmReportes();
     Reportes.rptCalles rpt = new Reportes.rptCalles();
     //Cargo el Data Set
     DataSet ds = new DataSet("Generico");
     ds.Tables.Add(oSysConfigImplement.GetEncabezadoDT("Encabezado"));
     ds.Tables[0].TableName="dtEncabezado";
     ds.Tables.Add(oCalleImplement.GetByNombreDT(""));
     ds.Tables[1].TableName = "dtCalles";
     rpt.SetDataSource(ds);
     frmRpt.crvGenerico.ReportSource = rpt;
     frmRpt.Show();
 }
 private void CargarGrid()
 {
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     this.dgvConfig.DataSource = oSysConfigImplement.Buscar("");
     this.dgvConfig.Enabled = true;
 }
Beispiel #7
0
 private void Imprimir()
 {
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     Reportes.frmReportes frmRpt = new Reportes.frmReportes();
     Reportes.rptBarrios rpt = new Reportes.rptBarrios();
     //Cargo el Data Set
     DataSet ds = new DataSet("Generico");
     ds.Tables.Add(oSysConfigImplement.GetEncabezadoDT("Encabezado"));
     ds.Tables[0].TableName = "dtEncabezado";
     ds.Tables.Add(oTarifaImplement.GetByTarifaDT(""));
     ds.Tables[1].TableName = "dtTarifas";
     rpt.SetDataSource(ds);
     frmRpt.crvGenerico.ReportSource = rpt;
     frmRpt.Show();
 }
 private void ImprimirTarifas()
 {
     FacturasImplement oFacturaImplement = new FacturasImplement();
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     view.Reportes.frmReportes frmRpt = new view.Reportes.frmReportes();
     Facturacion.Reportes.rptResumenXTarifa rpt = new Reportes.rptResumenXTarifa();
     //Cargo el Data Set
     DataSet ds = new DataSet("dsResumen");
     ds.Tables.Add(oSysConfigImplement.GetEncabezadoDT("Encabezado"));
     ds.Tables[0].TableName = "dtEncabezado";
     ds.Tables.Add(oFacturaImplement.GetResumenFacturacionPorTarifas(this.cmbAnio.SelectedValue.ToString() + this.cmbMes.SelectedValue.ToString(), 108000));
     ds.Tables[1].TableName = "dtXTarifas";
     rpt.SetDataSource(ds);
     frmRpt.crvGenerico.ReportSource = rpt;
     frmRpt.Show();
 }
 private void ImprimirFacturacionZB()
 {
     FacturasImplement oFacturaImplement = new FacturasImplement();
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     view.Reportes.frmReportes frmRpt = new view.Reportes.frmReportes();
     Facturacion.Reportes.rptResumenFacturacionXzonaXBarrio rpt = new Reportes.rptResumenFacturacionXzonaXBarrio();
     //Cargo el Data Set
     DataSet ds = new DataSet("dsResumen");
     ds.Tables.Add(oSysConfigImplement.GetEncabezadoDT("Encabezado"));
     ds.Tables[0].TableName = "dtEncabezado";
     ds.Tables.Add(oFacturaImplement.GetResumenFacturacionPorBarriosPorZonas(this.cmbAnio.SelectedValue.ToString() + this.cmbMes.SelectedValue.ToString(),int.Parse(this.cmbBarrios.SelectedValue.ToString()), int.Parse(this.cmbZonas.SelectedValue.ToString())));
     ds.Tables[1].TableName = "dtResumenFacturacionXBXC";
     rpt.SetDataSource(ds);
     frmRpt.crvGenerico.ReportSource = rpt;
     frmRpt.Show();
 }
 private void InicializarLeyendas()
 {
     SysConfigImplement oSysConfigImplement=new SysConfigImplement();
         this.txtObsComun.Text = oSysConfigImplement.GetByNombre("ObsComun").valor;
         this.txtObsDeuda.Text = oSysConfigImplement.GetByNombre("ObsDeuda").valor;
         this.txtObsDeuda2.Text = oSysConfigImplement.GetByNombre("ObsDeuda2").valor;
 }
        private void GuardarLeyendas()
        {
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();
                sys_configuracion oSysObsComun = new sys_configuracion();
                oSysObsComun = oSysConfigImplement.GetByNombre("ObsComun");
                oSysObsComun.valor=this.txtObsComun.Text;
                oSysConfigImplement.Save(oSysObsComun);

                sys_configuracion oSysObsDeuda = new sys_configuracion();
                oSysObsDeuda = oSysConfigImplement.GetByNombre("ObsDeuda");
                oSysObsDeuda.valor = this.txtObsDeuda.Text;
                oSysConfigImplement.Save(oSysObsDeuda);

                sys_configuracion oSysObsDeuda2 = new sys_configuracion();
                oSysObsDeuda2 = oSysConfigImplement.GetByNombre("ObsDeuda2");
                oSysObsDeuda2.valor = this.txtObsDeuda2.Text;
                oSysConfigImplement.Save(oSysObsDeuda2);
        }
Beispiel #12
0
        private void Imprimir()
        {
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();
            Reportes.frmReportes frmRpt = new Reportes.frmReportes();
            Reportes.rptFacturas rpt = new Reportes.rptFacturas();
            FacturasImplement oFacturasImplement = new FacturasImplement();
            //DataTable dtFacturas=new DataTable();
            //if(_mostrarImpagas ==0)
            //{
            //    if(_mostrarValoresActualizados==0)
            //    {
            //        dtFacturas=_facturasNoAct;
            //    }
            //    else
            //    {
            //        dtFacturas=_facturasAct;
            //    }
            //}
            //else
            //{
            //    if(_mostrarValoresActualizados==0)
            //    {
            //        dtFacturas=_facturasNoActImp;
            //    }
            //    else
            //    {
            //        dtFacturas=_facturasActImp;
            //    }
            //}

            DataTable dtFacturas = oFacturasImplement.GetByIdSocioDT(_idSocio, _mostrarImpagas, _mostrarValoresActualizados);
            decimal totalfacturado = 0;
            decimal totalrecargo = 0;
            decimal totalcobrado = 0;
            decimal totaldeuda = 0;
            foreach(DataRow dr in dtFacturas.Rows)
            {
                dr["Total"] = (decimal.Parse(dr["Recargo"].ToString()) + decimal.Parse(dr["IVARecargo"].ToString())) + (decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString())) - decimal.Parse(dr["Cobrado"].ToString());
                dr["Neto"] = (decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString()));
                dr["Recargo"] = (decimal.Parse(dr["Recargo"].ToString()) + decimal.Parse(dr["IVARecargo"].ToString()));

                totalfacturado = totalfacturado + (decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString()));
                totalrecargo = totalrecargo + (decimal.Parse(dr["Recargo"].ToString()) + decimal.Parse(dr["IVARecargo"].ToString()));
                totalcobrado = totalcobrado + decimal.Parse(dr["Cobrado"].ToString());
                totaldeuda = totaldeuda + decimal.Parse(dr["Total"].ToString());

            }

            socios oSocio = new socios();
            SocioImplement oSocioImplement = new SocioImplement();
            socios_lote oSocio_lote = new socios_lote();
            SocioLoteImplement oSocio_loteImplement = new SocioLoteImplement();
            tarifas oTarifas = new tarifas();
            TarifaImplement oTarifaImplement = new TarifaImplement();
            cod_barrios oCod_Barrios = new cod_barrios();
            BarrioImplement oBarrioImplement = new BarrioImplement();
            cod_calles oCod_Calles = new  cod_calles();
            CalleImplement oCalleImplement = new CalleImplement();
            oSocio = oSocioImplement.Get(_idSocio);
            oSocio_lote = oSocio_loteImplement.Get(_idSocio);
            string calleAltura = "";
            string manzana = "";
            string lote = "";
            string tarifa = "";
            string barrio = "";
            if(oSocio.tarifa>0)
                tarifa = oTarifaImplement.Get((int)oSocio.tarifa).tarifa;
            if (oSocio_lote != null)
            {
                if (oSocio_lote.barrio > 0)
                    barrio = oBarrioImplement.Get((int)oSocio_lote.barrio).barrio;
                if (oSocio_lote.calle_altura.Length > 0)
                    calleAltura = oSocio_lote.calle_altura;
                if (oSocio_lote.manzana.Length > 0)
                    manzana = oSocio_lote.manzana;
                if (oSocio_lote.lote.Length > 0)
                    lote = oSocio_lote.lote;
            }
            string calle = "";
            if (oSocio_lote.calle != null && oSocio_lote.calle>0)
                calle=oCalleImplement.Get((int)oSocio_lote.calle).calle;

            //Cargo el Data Set

            DataSet ds = new DataSet("Generico");
            ds.Tables.Add(oSysConfigImplement.GetEncabezadoDT("Encabezado"));
            ds.Tables[0].TableName = "dtEncabezado";
            ds.Tables.Add(dtFacturas);
            ds.Tables[1].TableName = "dtFacturas";
            rpt.SetDataSource(ds);
            rpt.SetParameterValue("socio", oSocio.codigo_socio + "/" + oSocio.subcodigo_socio + "  " + oSocio.nombre);
            rpt.SetParameterValue("tarifa", tarifa);
            rpt.SetParameterValue("barrio", barrio);
            rpt.SetParameterValue("calle", calle);
            rpt.SetParameterValue("numero", calleAltura);
            rpt.SetParameterValue("manzana", manzana);
            rpt.SetParameterValue("lote",lote);
            rpt.SetParameterValue("totalfacturado", Math.Round(totalfacturado, 2).ToString());
            rpt.SetParameterValue("totalrecargo", Math.Round(totalrecargo, 2).ToString());
            rpt.SetParameterValue("totalcobrado", Math.Round(totalcobrado, 2).ToString());
            rpt.SetParameterValue("totaldeuda", Math.Round(totaldeuda, 2).ToString());
            frmRpt.crvGenerico.ReportSource = rpt;
            frmRpt.Show();
        }
        private void GenerarListado()
        {
            //verifica que el barrio este seleccionado
            if (this.rbtnSelecionaBarrio.Checked && this.cmbBarrio.SelectedValue.ToString() == "0")

                MessageBox.Show("Debe seleccionar un barrio", "Información Insuficiente");

            if (rbtnFiltro.Checked && SQLFiltro=="")
                MessageBox.Show("Filtro", "Información Insuficiente");

            //verifica que se haya ingresado la fecha valida

            if (this.rbtnAAdeudan.Checked && this.txtPeriodos.Text=="")
                MessageBox.Show("Debe indicar la cantidad de Periodos que se utilizara", "Información Insuficiente");

            if (this.rbtnADeudaPesos.AutoCheck && this.txtPesos.Text=="")
                MessageBox.Show("Debe indicar el importe que se utilizara", "Información Insuficiente");

            if( this.rbtnSeleccionaCategoria.Checked && this.cmbCategoria.SelectedValue=="0")
                MessageBox.Show("Debe Seleccionar Categoria", "Información Insuficiente");

            string SQLSocios="select * from socios s "+
                    " inner join socios_conexion sc on s.id_Socio=sc.id_Socio where 1=1 ";

                if (this.rbtnSelecionaBarrio.Checked)

                    SQLSocios= SQLSocios+ " and sc.barrio="+this.cmbBarrio.SelectedValue;

                if (this.rbtnFiltro.Checked)
                    SQLSocios = SQLSocios + SQLFiltro;

                if (this.chkAExcluirNoSocios.Checked){
                    SysConfigImplement oSysConfigImplement = new SysConfigImplement();
                    sys_configuracion oSysConfig = new sys_configuracion();
                    oSysConfig = oSysConfigImplement.GetByNombre("DiaPrimerVencimiento");
                    SQLSocios = SQLSocios + " and s.codigo_socio<" + oSysConfig.valor;
                    }

                if (rbtnSeleccionaCategoria.Checked)
                    SQLSocios = SQLSocios + "and s.categoria=" + cmbCategoria.SelectedValue;

            Consultas oConsultas=new Consultas();
            DataTable dtSocios = oConsultas.GetScript(SQLSocios);
            foreach (DataRow dtRow in dtSocios.Rows)
            {
                //foreach(DataColumn dc in dtRow)
            }
        }