Пример #1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            #region <<Datos Socio>>

            if (panelIVA.Visible)
            {
                _IVAs            = "";
                panelIVA.Visible = false;
                for (int i = 0; i < chkListIVA.Items.Count; i++)
                {
                    if (chkListIVA.GetItemChecked(i))
                    {
                        _IVAs = _IVAs + "'" + chkListIVA.Items[i].ToString() + "',";
                    }
                }

                txtIVAs.Text = _IVAs;
            }

            if (panelCategorias.Visible)
            {
                _Categorias             = "";
                panelCategorias.Visible = false;
                for (int i = 0; i < chkListCategorias.Items.Count; i++)
                {
                    if (chkListCategorias.GetItemChecked(i))
                    {
                        _Categorias = _Categorias + "'" + chkListCategorias.Items[i].ToString().Trim() + "',";
                    }
                }

                txtCategorias.Text = _Categorias;
            }

            if (panelEstadoConexion.Visible)
            {
                _EstadosConexion            = "";
                panelEstadoConexion.Visible = false;
                for (int i = 0; i < chkListEstadoConexion.Items.Count; i++)
                {
                    if (chkListEstadoConexion.GetItemChecked(i))
                    {
                        _EstadosConexion = _EstadosConexion + "'" + chkListEstadoConexion.Items[i].ToString() + "',";
                    }
                }

                txtEstadoConexion.Text = _EstadosConexion;
            }

            if (panelSituacionEsp.Visible)
            {
                _SituacionEspecial        = "";
                panelSituacionEsp.Visible = false;
                for (int i = 0; i < chkListSituacionEsp.Items.Count; i++)
                {
                    if (chkListSituacionEsp.GetItemChecked(i))
                    {
                        _SituacionEspecial = _SituacionEspecial + "'" + chkListSituacionEsp.Items[i].ToString() + "',";
                    }
                }

                txtSituacionEsp.Text = _SituacionEspecial;
            }

            if (panelTarifa.Visible)
            {
                _Tarifas            = "";
                panelTarifa.Visible = false;
                for (int i = 0; i < chkListTarifa.Items.Count; i++)
                {
                    if (chkListTarifa.GetItemChecked(i))
                    {
                        _Tarifas = _Tarifas + "'" + chkListTarifa.Items[i].ToString().Replace("'", "''").Trim() + "',";
                    }
                }

                txtTarifa.Text = _Tarifas;
            }

            if (panelZonaFacturacion.Visible)
            {
                _ZonaFacturacion             = "";
                panelZonaFacturacion.Visible = false;
                for (int i = 0; i < chkListZonaFacturacion.Items.Count; i++)
                {
                    if (chkListZonaFacturacion.GetItemChecked(i))
                    {
                        _ZonaFacturacion = _ZonaFacturacion + "'" + chkListZonaFacturacion.Items[i].ToString() + "',";
                    }
                }

                txtZonaFacturacion.Text = _ZonaFacturacion;
            }
            #endregion

            #region <<Datos Varios>>


            if (panelBarrio.Visible)
            {
                _Barrios            = "";
                txtBarrio.Text      = "";
                panelBarrio.Visible = false;
                for (int i = 0; i < chkListBarrio.Items.Count; i++)
                {
                    if (chkListBarrio.GetItemChecked(i))
                    {
                        _Barrios       = _Barrios + "'" + ((cod_barrios)(chkListBarrio.Items[i])).id_barrio.ToString() + "',";
                        txtBarrio.Text = txtBarrio.Text + ((cod_barrios)(chkListBarrio.Items[i])).barrio + ",";
                    }
                }
            }

            if (panelCalle.Visible)
            {
                _Calles            = "";
                txtCalle.Text      = "";
                panelCalle.Visible = false;
                for (int i = 0; i < chkListCalle.Items.Count; i++)
                {
                    if (chkListCalle.GetItemChecked(i))
                    {
                        _Calles       = _Calles + "'" + ((cod_calles)(chkListCalle.Items[i])).id_calle.ToString() + "',";
                        txtCalle.Text = txtCalle.Text + ((cod_calles)(chkListCalle.Items[i])).calle + ",";
                    }
                }
            }

            if (panelProvincia.Visible)
            {
                _Provincias            = "";
                txtProvincia.Text      = "";
                panelProvincia.Visible = false;
                for (int i = 0; i < chkListProvincia.Items.Count; i++)
                {
                    if (chkListProvincia.GetItemChecked(i))
                    {
                        _Provincias       = _Provincias + "'" + ((cod_provincias)(chkListProvincia.Items[i])).id_provincia.ToString() + "',";
                        txtProvincia.Text = txtProvincia.Text + ((cod_provincias)(chkListProvincia.Items[i])).provincia + ",";
                    }
                }
            }

            if (panelBarrioLegal.Visible)
            {
                _BarriosLegal            = "";
                txtBarrioLegal.Text      = "";
                panelBarrioLegal.Visible = false;
                for (int i = 0; i < chkListBarrioLegal.Items.Count; i++)
                {
                    if (chkListBarrioLegal.GetItemChecked(i))
                    {
                        _BarriosLegal       = _BarriosLegal + "'" + ((cod_barrios)(chkListBarrioLegal.Items[i])).id_barrio.ToString() + "',";
                        txtBarrioLegal.Text = txtBarrioLegal.Text + ((cod_barrios)(chkListBarrioLegal.Items[i])).barrio + ",";
                    }
                }
            }

            if (panelCalleLegal.Visible)
            {
                _CallesLegal            = "";
                txtCalleLegal.Text      = "";
                panelCalleLegal.Visible = false;
                for (int i = 0; i < chkListCalleLegal.Items.Count; i++)
                {
                    if (chkListCalle.GetItemChecked(i))
                    {
                        _CallesLegal       = _CallesLegal + "'" + ((cod_calles)(chkListCalleLegal.Items[i])).id_calle.ToString() + "',";
                        txtCalleLegal.Text = txtCalleLegal.Text + ((cod_calles)(chkListCalleLegal.Items[i])).calle + ",";
                    }
                }
            }

            if (panelLocalidad.Visible)
            {
                _Localidad             = "";
                txtLocalidad.Text      = "";
                panelLocalidad.Visible = false;
                for (int i = 0; i < chkListLocalidad.Items.Count; i++)
                {
                    if (chkListLocalidad.GetItemChecked(i))
                    {
                        _Localidad        = _Localidad + "'" + ((cod_localidades)(chkListLocalidad.Items[i])).id_localidad.ToString() + "',";
                        txtLocalidad.Text = txtLocalidad.Text + ((cod_localidades)(chkListLocalidad.Items[i])).localidad + ",";
                    }
                }
            }
            #endregion

            #region <<Datos Catastral>>


            if (panelEntidad.Visible)
            {
                _Entidades           = "";
                txtEntidad.Text      = "";
                panelEntidad.Visible = false;
                for (int i = 0; i < chkListEntidad.Items.Count; i++)
                {
                    if (chkListEntidad.GetItemChecked(i))
                    {
                        _Entidades      = _Entidades + "'" + ((cod_prestador)(chkListEntidad.Items[i])).id_prestador.ToString() + "',";
                        txtEntidad.Text = txtEntidad.Text + ((cod_prestador)(chkListEntidad.Items[i])).prestador + ",";
                    }
                }
            }
            #endregion

            SocioImplement oSocioImplement = new SocioImplement();
            string         _CodigoSocio    = "";
            if (mtxtNumero.Text.Length >= 6)
            {
                _CodigoSocio = this.mtxtNumero.Text.Substring(0, 6);
            }
            string _SubcodigoSocio = "";
            if (mtxtNumero.Text.Length >= 9)
            {
                _SubcodigoSocio = this.mtxtNumero.Text.Substring(7, 2);
            }

            _DataSocios = oSocioImplement.SociosGetByFilters(_IVAs, _Categorias, _EstadosConexion, _SituacionEspecial, _Tarifas,
                                                             _ZonaFacturacion, _CodigoSocio, _SubcodigoSocio, this.txtNombre.Text, this.mtxtDocumento.Text, this.mtxtCuit.Text,
                                                             this.dtpFecha.Text, _Barrios, _Calles, _Provincias, _BarriosLegal, _CallesLegal, _Localidad, _Entidades,
                                                             txtDcDistrito.Text, txtDcAltura.Text, txtDLCP.Text, txtDlAltura.Text, mtbLNomenclarura.Text, txtLManzana.Text,
                                                             txtLLote.Text, txtMedidor.Text);
            this.dgSocios.DataSource = _DataSocios;
        }
Пример #2
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();
        }