Ejemplo n.º 1
0
        private void Guardar()
        {
            cod_calles     oCalle          = new cod_calles();
            CalleImplement oCalleImplement = new CalleImplement();

            if (this.lblCodigo.Text == "")
            {
                oCalle.calle       = this.txtNombre.Text;
                oCalle.normalizado = this.txtNormalizado.Text;
                oCalleImplement.Save(oCalle);
            }
            else
            {
                DataGridViewRow row = this.dgvCalle.CurrentRow;
                int             id  = Convert.ToInt32(row.Cells[0].Value);
                oCalle             = oCalleImplement.Get(id);
                oCalle.calle       = this.txtNombre.Text;
                oCalle.normalizado = this.txtNormalizado.Text;
                oCalleImplement.Update(oCalle);
            }
            Deshabilitar();
            this.txtNombre.Text      = "";
            this.txtNormalizado.Text = "";
            CargarGrid();
        }
Ejemplo n.º 2
0
        public void Save(cod_calles oCalle)
        {
            cooperativaEntities bd = new cooperativaEntities();

            bd.cod_calles.AddObject(oCalle);
            bd.SaveChanges();
        }
Ejemplo n.º 3
0
        public void CargarCombo(ComboBox combo, string InsertaFila)
        {
            IList      ListaCalles = GetAll();
            cod_calles oCalle      = new cod_calles();

            oCalle.id_calle    = 0;
            oCalle.normalizado = InsertaFila;
            ListaCalles.Insert(0, oCalle);
            combo.DisplayMember = "normalizado";
            combo.ValueMember   = "id_calle";
            combo.DataSource    = ListaCalles;
        }
Ejemplo n.º 4
0
        public void Update(cod_calles oCalle)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var editar = (from p in bd.cod_calles
                              where p.id_calle == oCalle.id_calle
                              select p).Single();

                editar.calle       = oCalle.calle;
                editar.normalizado = oCalle.normalizado;
                bd.SaveChanges();
            }
        }
Ejemplo n.º 5
0
        private void CargarSeleccion()
        {
            cod_calles      oCalle          = new cod_calles();
            CalleImplement  oCalleImplement = new CalleImplement();
            DataGridViewRow row             = this.dgvCalle.CurrentRow;
            int             id = Convert.ToInt32(row.Cells[0].Value);

            oCalle = oCalleImplement.Get(id);

            this.lblCodigo.Text      = oCalle.id_calle.ToString();
            this.txtNombre.Text      = oCalle.calle;
            this.txtNormalizado.Text = oCalle.normalizado;
            this.gbCalle.Enabled     = false;
            Deshabilitar();
        }
Ejemplo n.º 6
0
        private void ModificarCalle()
        {
            HabilitarBotones();
            this.gbCalle.Enabled = true;
            cod_calles      oCalle          = new cod_calles();
            CalleImplement  oCalleImplement = new CalleImplement();
            DataGridViewRow row             = this.dgvCalle.CurrentRow;
            int             id = Convert.ToInt32(row.Cells[0].Value);

            oCalle = oCalleImplement.Get(id);
            this.lblCodigo.Text      = oCalle.id_calle.ToString();
            this.txtNombre.Text      = oCalle.calle;
            this.txtNormalizado.Text = oCalle.normalizado;
            this.dgvCalle.Enabled    = false;
        }
Ejemplo n.º 7
0
        public cod_calles Get(int id)
        {
            cod_calles oCalle = new cod_calles();

            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var regis = (from p in bd.cod_calles
                             where p.id_calle == id
                             select p).Single();
                oCalle.id_calle    = regis.id_calle;
                oCalle.calle       = regis.calle;
                oCalle.normalizado = regis.normalizado;
                return(oCalle);
            }
        }
Ejemplo n.º 8
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();
        }