private void Inicializar() { FacturasImplement oFacturasImplement = new FacturasImplement(); facturas oFacturas = new facturas(); oFacturas = oFacturasImplement.Get(_idFactura); txtFactura.Text = oFacturas.id_factura.ToString(); txtPeriodo.Text = oFacturas.id_periodo.ToString().Substring(4,2) + "/" + oFacturas.id_periodo.ToString().Substring(0,4); txtFehaFacturacion.Text = ""; txtFechaVencimiento.Text = ""; EstadosPagoImplement oEstadosPagoImplement = new EstadosPagoImplement(); cod_estados_pago oCod_Estados_Pago = new cod_estados_pago(); int idEstado = (int)oFacturas.id_estadoPago; oCod_Estados_Pago=oEstadosPagoImplement.Get(idEstado); txtEstado.Text = oCod_Estados_Pago.estado_pago; txtFechaPago.Text = oFacturas.fechaPago.ToString(); socios_mediciones oSociosMediciones = new socios_mediciones(); SocioMedicionImplement oSocioMedicionImplement = new SocioMedicionImplement(); oSociosMediciones = oSocioMedicionImplement.Get((int)oFacturas.id_medicion); txtM3Consumidos.Text = oSociosMediciones.consumo.ToString(); cargarGrillaConceptos(); txtImporteTotal.Text = oFacturas.importeTotal.ToString(); txtCobrado.Text = oFacturas.cobrado.ToString(); }
private void CargarGrid() { //this.dgvBarrio.DataSource = oBarrioImplement.Buscar(""); //this.dgvBarrio.Enabled = true; //_eliminoBarrio = false; SocioMedicionImplement oSocioMedicionImplement = new SocioMedicionImplement(); string strAuxBarrio = this.cboxBarrios.SelectedValue.ToString(); string strAuxOrden; if (this.cBoxOrdenarPor.SelectedValue != null) strAuxOrden = this.cBoxOrdenarPor.SelectedValue.ToString(); else strAuxOrden = "1"; this.dgvDatos.DataSource = oSocioMedicionImplement.GetByFilterDT(int.Parse(strAuxBarrio), this.chkbSinEstadoActual.Checked, int.Parse(strAuxOrden)); }
private void CargarFacturaFutura(string periodo, int idSocio) { decimal NetoConIVA = 0; decimal NetoSinIVA = 0; int idMedidor = 0; facturas oFactura = new facturas(); FacturasImplement oFacturaImplement = new FacturasImplement(); oFactura = oFacturaImplement.Get(_idFactura); _oFactura = new facturas(); _oFactura.id_socio = _idSocio; //oFactura.id_medicion Ver como soluciono el idMedicion _oFactura.id_estadoPago = 1;//Impaga _oFactura.id_tarifa = 0;//aun no se carga _oFactura.id_convenio = 0;//Aun no se carga _oFactura.fechaPago = null; _oFactura.cobrado = 0; _oFactura.neto1 = 0; _oFactura.neto2 = 0; _oFactura.importeNeto = 0; _oFactura.importeTotal = 0; _oFactura.id_medicion = 0; // obtengo solo los conceptos activos IList listaConceptos = new ConceptoImplement().GetActivosAll(); SocioConexionImplement oSocioConexionImpl = new SocioConexionImplement(); DataTable DTUsuariosAFacturar = oSocioConexionImpl.GetSociosAFacturar(periodo, idSocio); if (DTUsuariosAFacturar.Rows[0]["medidor"].ToString() != "") { socios_mediciones oSocioMedicionActual = new socios_mediciones(); SocioMedicionImplement oSocioMedicionImplement = new SocioMedicionImplement(); oSocioMedicionActual = oSocioMedicionImplement.ultimaMedicion(int.Parse(DTUsuariosAFacturar.Rows[0]["id_socio"].ToString())); socios_mediciones oSocioMedicionNew = new socios_mediciones(); oSocioMedicionNew.fecha_lectura = null; oSocioMedicionNew.id_socio = _idSocio; decimal consumo = 0; if (oSocioMedicionActual != null) { consumo = (decimal)decimal.Parse((oSocioMedicionActual.consumo * 0.75).ToString()); oSocioMedicionNew.consumo = (int)Math.Truncate(consumo); oSocioMedicionNew.lectura = oSocioMedicionActual.lectura + oSocioMedicionNew.consumo; } else { oSocioMedicionNew.consumo = 0; oSocioMedicionNew.lectura = 0; } idMedidor = oSocioMedicionImplement.Save(oSocioMedicionNew); } _oFactura.id_medicion = idMedidor;//Cargo 0 si no tiene medidor // recorre toda la base de conceptos foreach (cod_conceptos oConcepto in listaConceptos) { bool CorrespondeFacturar = false; if (_oFactura.id_medicion.Value != 0) { //SocioMedicionImplement oSosioMedicionImpl = new SocioMedicionImplement(); //socios_mediciones oSocioMedicion = new socios_mediciones(); //oSocioMedicion = oSosioMedicionImpl.Get(oFactura.id_medicion.Value); } acciones oAccion = new acciones(); conceptos_particulares oConceptoParticular = new conceptos_particulares(); conceptosParticularesImplement oConceptoParticularImplement = new conceptosParticularesImplement(); AccionImplement oAccionesImplement = new AccionImplement(); if (oConcepto.aplicacion == 2) { // si concepto Particular oConceptoParticular = oConceptoParticularImplement.GetByFilter(idSocio, oConcepto.id_concepto, _oFactura.id_periodo); if (oConceptoParticular != null) { CorrespondeFacturar = true; } else { // No encontrado entonces no corresponde facturar CorrespondeFacturar = false; } } else { //Concepto Activo y no particular entonces corresponde facturar CorrespondeFacturar = true; } if (CorrespondeFacturar) { facturas_detalles oDetalle = new facturas_detalles(); FacturasDetallesImplement oFacturasDetallesImplement = new FacturasDetallesImplement(); //ConvenioImplement oConvenioImplement = new ConvenioImplement(); CalculosFacturacionFormulas oCalculosFacturacionFormulas = new CalculosFacturacionFormulas(); oDetalle = oCalculosFacturacionFormulas.getDetalle(idSocio, decimal.Parse(DTUsuariosAFacturar.Rows[0]["cargo_fijo"].ToString()), decimal.Parse(DTUsuariosAFacturar.Rows[0]["abono"].ToString()), decimal.Parse(DTUsuariosAFacturar.Rows[0]["valor_m3"].ToString()), oConcepto, _oFactura, oConceptoParticular); if (oDetalle.importe != 0) AgregarDetalle(oDetalle); // Calcula los subtotales separados para los conceptos con y sin IVA if (oConcepto.aplicar_iva.Value) NetoConIVA = NetoConIVA + oDetalle.importe; else NetoSinIVA = NetoSinIVA + oDetalle.importe; // Calcula los campos Neto1 y Neto2 utilizados en los // cálculos de intereses if (oConcepto.aplicar_recargo.Value) oFactura.neto1 = oFactura.neto1.Value + Convert.ToSingle(oDetalle.importe); else oFactura.neto2 = oFactura.neto2.Value + Convert.ToSingle(oDetalle.importe); } } cod_conceptos oConceptoIVA = new cod_conceptos(); ConceptoImplement oConceptoImplement = new ConceptoImplement(); facturas_detalles oDetalleFac = new facturas_detalles(); oConceptoIVA = oConceptoImplement.Get(23);//concepto IVA es el 23 oDetalleFac.id_concepto = oConceptoIVA.id_concepto; oDetalleFac.id_factura = 0; oDetalleFac.idOrden = oConceptoIVA.orden_concepto; oDetalleFac.idTipo = 0; oDetalleFac.importe = decimal.Round(NetoConIVA * decimal.Parse(DTUsuariosAFacturar.Rows[0]["iva"].ToString()) / 100, 2); AgregarDetalle(oDetalleFac); }
private void CargarGrilla() { SocioMedicionImplement oSocioMedicionImplement = new SocioMedicionImplement(); this.dvMediciones.DataSource = oSocioMedicionImplement.GetByIdSocioDT(_idSocio); }
private void CargarSocio() { SocioImplement oSocioImplement = new SocioImplement(); socios oSocio = new socios(); oSocio = oSocioImplement.Get(_idSocio); socios_lote oSocioLote = new socios_lote(); SocioLoteImplement oSocioLoteImplement = new SocioLoteImplement(); oSocioLote = oSocioLoteImplement.Get(_idSocio); socios_conexion oSocioConexion = new socios_conexion(); SocioConexionImplement oSocioConexionImplement = new SocioConexionImplement(); oSocioConexion = oSocioConexionImplement.Get(_idSocio); socios_varios oSocioVarios = new socios_varios(); SocioVariosImplement oSocioVariosImplement = new SocioVariosImplement(); oSocioVarios = oSocioVariosImplement.Get(_idSocio); this.mtxtNumero.Text = oSocio.codigo_socio + oSocio.subcodigo_socio; this.txtNombre.Text = oSocio.nombre; this.cmbTipoDni.SelectedValue = oSocio.tipo_documento; if (this.cmbTipoDni.SelectedValue == null) this.cmbTipoDni.SelectedValue = 0;//Esto es cuando asigno algo que el combo no contiene if (oSocio.documento!=null) this.mtxtDocumento.Text = oSocio.documento.ToString(); if (oSocio.fecha_alta != null) if (oSocio.fecha_alta != DateTime.Parse("01/01/1900")) this.dtpFecha.Text = oSocio.fecha_alta.ToString(); this.cmbEstadoConexion.SelectedValue = (oSocio.estado == null) ? 0 : oSocio.estado; if (this.cmbEstadoConexion.SelectedValue == null) this.cmbEstadoConexion.SelectedValue = 0; this.txtFinalizaEstado.Text = oSocio.fin_estado; this.cmbTarifa.SelectedValue = (oSocio.tarifa == null) ? 0 : oSocio.tarifa; if (this.cmbTarifa.SelectedValue == null) this.cmbTarifa.SelectedValue = 0; this.txtFinalizaTarifa.Text = oSocio.fin_tarifa; this.cmbIVA.SelectedValue = oSocio.iva; if (this.cmbIVA.SelectedValue == null) this.cmbIVA.SelectedValue = 0; this.mtxtCuit.Text = oSocio.cuit; this.cmbCategoria.SelectedValue = oSocio.categoria; if (this.cmbCategoria.SelectedValue == null) this.cmbCategoria.SelectedValue = 0; ///**************************** DOMICILIO CONEXION*****************************/ this.cmbDcBarrio.SelectedValue =oSocioConexion.barrio; if (this.cmbDcBarrio.SelectedValue == null) this.cmbDcBarrio.SelectedValue = 0; this.cmbDcCalle.SelectedValue = oSocioConexion.calle; if (this.cmbDcCalle.SelectedValue == null) this.cmbDcCalle.SelectedValue = 0; this.txtDcAltura.Text = oSocioConexion.calle_altura; this.txtDcPiso.Text = oSocioConexion.piso; this.txtDcDpto.Text = oSocioConexion.dpto; this.txtDcDistrito.Text = (oSocioConexion.distrito_electoral == null) ? "" : oSocioConexion.distrito_electoral.ToString(); this.cmbZona.SelectedValue = (oSocioConexion.zona == null) ? 0 : oSocioConexion.zona; if (this.cmbZona.SelectedValue == null) this.cmbZona.SelectedValue = 0; this.txtAdicDomicilioConexion.Text = oSocioConexion.adic_domicilio; ///**************************** DOMICILIO LEGAL *******************************/ this.cmbDlProvincia.SelectedValue = oSocioLote.provincia; if (this.cmbDlProvincia.SelectedValue == null) this.cmbDlProvincia.SelectedValue = 0; this.cmbDlBarrio.SelectedValue = oSocioLote.barrio; if (this.cmbDlBarrio.SelectedValue == null) this.cmbDlBarrio.SelectedValue = 0; this.cmbDlCalle.SelectedValue = oSocioLote.calle; if (this.cmbDlCalle.SelectedValue == null) this.cmbDlCalle.SelectedValue = 0; this.cmbDLLocalidad.SelectedValue = oSocioLote.localidad; if (this.cmbDLLocalidad.SelectedValue == null) this.cmbDLLocalidad.SelectedValue = 0; this.txtDLCP.Text = oSocioLote.cp.ToString(); this.txtDlAltura.Text = oSocioLote.calle_altura; this.txtDlPiso.Text = oSocioLote.piso; this.txtDLDpto.Text = oSocioLote.dpto; this.txtAdicDomicilioLegal.Text = oSocioLote.adic_domicilio; /*************************** VARIOS *****************************/ this.txtVProfesion.Text = oSocioVarios.profesion; this.txtVNombreConyuge.Text = oSocioVarios.conyuge_nombre; this.cmbVTipoDoc.SelectedValue = oSocioVarios.conyuge_tipo_documento; if (this.cmbVTipoDoc.SelectedValue == null) this.cmbVTipoDoc.SelectedValue = 0; this.mtxtVDocumento.Text = oSocioVarios.conyuge_documento.ToString(); this.txtVNumSocioLuz.Text = oSocioVarios.id_coop_luz; this.dtpVFechaAlta.Text = oSocioVarios.fecha_convenio_coop_luz; this.cmbSituacionEsp.SelectedValue = oSocioVarios.situacion_especial; if (this.cmbSituacionEsp.SelectedValue == null) this.cmbSituacionEsp.SelectedValue = 0; /************************** LOTE ***************************/ this.mtbLNomenclarura.Text = oSocioLote.nomenclatura; this.txtLManzana.Text = oSocioLote.manzana; this.txtLLote.Text = oSocioLote.lote; this.txtLRuta.Text = oSocioLote.ruta_reparto.ToString(); this.txtLOrden.Text = oSocioLote.orden_reparto.ToString(); /*********************** DATOS TECNICOS **********************/ socios_mediciones oSocioMedicion = new socios_mediciones(); SocioMedicionImplement oSocioMedicionImplement = new SocioMedicionImplement(); oSocioMedicion = oSocioMedicionImplement.ultimaMedicion(_idSocio); this.txtDTNumero.Text = oSocioConexion.medidor; this.txtDTMarca.Text = oSocioConexion.marca_medidor; ///VER this.txtDTEstados.Text = oSocioMedicion == null ? "" : oSocioMedicion.consumo.ToString(); this.txtDTUltimaLectura.Text = oSocioMedicion == null ? "" : oSocioMedicion.lectura.ToString(); this.txtDTDistanciaMedianera.Text = oSocioConexion.ubicacion_servicio.ToString(); this.cmbDTMedianera.SelectedValue = oSocioConexion.medianera; if (this.cmbDTMedianera.SelectedValue == null) this.cmbDTMedianera.SelectedValue = 0; this.cmbDTTipoConexion.SelectedValue = oSocioConexion.tipo_conexion; if (this.cmbDTTipoConexion.SelectedValue == null) this.cmbDTTipoConexion.SelectedValue = 0; this.txtDTDistanciaLinea.Text = oSocioConexion.distancia_a_red.ToString(); this.txtDTProfondidad.Text = oSocioConexion.profundidad_red.ToString(); this.cmbDTTipoMaterial.SelectedValue = oSocioConexion.tipo_material; if (this.cmbDTTipoMaterial.SelectedValue == null) this.cmbDTTipoMaterial.SelectedValue = 0; this.txtDTDiametro.Text = oSocioConexion.diametro_red.ToString(); //VER CargarBanderas(oSocioVarios); }