private void CargarGrid() { SysConfigImplement oSysConfigImplement = new SysConfigImplement(); this.dgvConfig.DataSource = oSysConfigImplement.Buscar(""); this.dgvConfig.Enabled = true; }
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 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 Inicializar() { this.dtpFecha.Value = DateTime.Now.Date; SysConfigImplement oSysConfigImplement = new SysConfigImplement(); sys_configuracion oSysConfig = new sys_configuracion(); oSysConfig = oSysConfigImplement.GetByNombre("DiaPrimerVencimiento"); _primerVencimiento = DateTime.Parse(oSysConfig.valor + "/" + DateTime.Now.Date.Month + "/" + DateTime.Now.Date.Year).AddMonths(1); oSysConfig = oSysConfigImplement.GetByNombre("DiasEntreVenc2"); _diasEntreVencimiento = int.Parse(oSysConfig.valor); this.nudCantidad.Value = 2; InicializarTab("0"); InicializarTab("1"); }
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 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 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; }
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 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 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 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); }
private void Iniciar() { sys_configuracion oSysConfig = new sys_configuracion(); SysConfigImplement oSysConfigImplement = new SysConfigImplement(); oSysConfig = oSysConfigImplement.GetByNombre("CantVencimientos"); int CantUsuarios = 0; decimal NetoConIVA = 0; decimal NetoSinIVA = 0; decimal SubTotal = 0; switch (int.Parse(oSysConfig.valor)) { case 1: //No hace nada porque el primer se establece por defecto break; case 2: for (int i = 1; i <= (int.Parse(this.nudCantidad.Value.ToString()) - 1); i++) { DateTimePicker fecha1 = (DateTimePicker)tcPeriodos.Controls.Find("dtpPrimerVencimiento" + i, true)[0]; DateTimePicker fecha2 = (DateTimePicker)tcPeriodos.Controls.Find("dtpSegundoVencimiento" + i, true)[0]; if (fecha2.Value <= fecha1.Value) { string msg = "Debe establecer las fechas para los 2 vencimientos y éstas " + "no pueden ser iguales, controlar fechas indicadas en el periodo " + (i - 1).ToString(); MessageBox.Show(msg); } } break; case 3: for (int i = 1; i <= (int.Parse(this.nudCantidad.Value.ToString()) + 1); i++) { DateTimePicker fecha1 = (DateTimePicker)tcPeriodos.Controls.Find("dtpPrimerVencimiento" + i, true)[0]; DateTimePicker fecha2 = (DateTimePicker)tcPeriodos.Controls.Find("dtpSegundoVencimiento" + i, true)[0]; if (fecha2.Value <= fecha1.Value) { string msg = "Debe establecer las fechas para los 2 vencimientos y éstas " + "no pueden ser iguales, controlar fechas indicadas en el periodo " + (i - 1).ToString(); MessageBox.Show(msg); } } break; } // Verificar que se hayan cargado los estados de los medidores SocioConexionImplement oSocioConexionImplement = new SocioConexionImplement(); DataTable DTMedidores = oSocioConexionImplement.GetEstadosMedidores(); if (DTMedidores.Rows.Count > 0) { string msg2 = "No se puede efectuar el proceso de facturación porque existen " + "socios de servicio medido que no tienen informado el estado del " + "medidor. \n El estado del medidor debe ser " + "informado siempre, si por algún motivo no se efectuó la lectura, " + "coloque un valor estimado en el campo 'Lectura' pero no informe " + "la fecha de lectura en el campo 'Fecha Lectura', en la factura " + "se informará al socio que el valor de M3 consumidos fué estimado /n" + "El proceso de facturación no puede continuar."; MessageBox.Show(msg2); } // Pide confirmar el proceso de facturación string msj2 = ""; if (int.Parse(this.nudCantidad.Value.ToString()) > 1) { msj2 = "Está Ud. realmente seguro de querer comenzar el proceso de " + "facturación ?. \nEste proceso no puede ser " + "cancelado y al facturarse más de un período sólo puede " + "anularse la facturación del último período pero no de los " + "períodos anteriores"; } else { msj2 = "Está Ud. realmente seguro de querer comenzar el proceso de " + "facturación ?. \nEste proceso no puede ser " + "cancelado, aunque sí es reversible, es decir que una vez " + "finalizado el proceso se puede anular \n toda la facturación " + "y volver a efectuarla"; } DialogResult dialogResult = MessageBox.Show(msj2, "Confirmar facturación", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { // Hay que inhabilitar los forms porque el proceso no puede detenerse DeshabilitarControles(); // Guarda la cantidad de usuarios para utilizar la misma cantidad en // todos los períodos a facturar // obtengo solo los conceptos activos IList listaConceptos = new ConceptoImplement().GetActivosAll(); for (int i = 0; i < (int.Parse(this.nudCantidad.Value.ToString())); i++) { TextBox textPeriodo = (TextBox)this.Controls.Find("txtPeriodo" + i, true)[0]; string idPeriodo = textPeriodo.Text.Substring(3, 4) + textPeriodo.Text.Substring(0, 2); DataTable DTUsuariosAFacturar = oSocioConexionImplement.GetSociosAFacturar(idPeriodo); //Repetir el proceso de facturación para todas las solapas (periodos) seleccionados CantUsuarios = DTUsuariosAFacturar.Rows.Count; this.txtUsuariosAFacturar.Text = CantUsuarios.ToString(); this.txtUsuariosFacturados.Text = "0"; this.txtUsuariosFaltantes.Text = CantUsuarios.ToString(); this.pbEstado.Value = 0; // Cartel indicativo del proceso que se está efectuando this.tcPeriodos.TabIndex = i; // Guarda el número 'ProxFactura' del proceso anterior por si se desea // anular la facturación en curso (obviamente luego que termine) //sys_configuracion oSysProxFacturaAnterior = new sys_configuracion(); //oSysProxFacturaAnterior = oSysConfigImplement.GetByNombre("ProxFacturaAnt"); //sys_configuracion oSysProxFactura = new sys_configuracion(); //oSysProxFactura = oSysConfigImplement.GetByNombre("ProxFactura"); //oSysProxFacturaAnterior.valor = oSysProxFactura.valor; //oSysConfigImplement.Update(oSysProxFacturaAnterior); // Guardo las fechas de vencimiento en la tabla periodos periodos oPeriodo = new periodos(); PeriodosImplement oPeriodosImplement = new PeriodosImplement(); oPeriodo = oPeriodosImplement.Get(idPeriodo); this.txtProceso.Text = "Se esta procesando el periodo " + idPeriodo; this.txtProceso.Visible = true; Application.DoEvents(); oPeriodo.fecha_facturacion = this.dtpFecha.Value; DateTimePicker dtpPrimerVenc = (DateTimePicker)this.Controls.Find("dtpPrimerVencimiento" + i, true)[0]; oPeriodo.fecha_primer_venc = dtpPrimerVenc.Value; DateTimePicker dtpSegundoVenc = (DateTimePicker)this.Controls.Find("dtpSegundoVencimiento" + i, true)[0]; if (dtpSegundoVenc.Value.ToString() != "") { oPeriodo.fecha_segundo_venc = dtpSegundoVenc.Value; } oPeriodo.fecha_tercer_venc = null; oPeriodo.facturado = true; FacturasImplement oFacturasImplement = new FacturasImplement(); int cantUsuario = DTUsuariosAFacturar.Rows.Count; this.pbEstado.Maximum = cantUsuario; for (int j = 0; j < cantUsuario; j++) { this.pbEstado.Value = j; facturas oFactura = new facturas(); FacturasImplement oFacturaImplement = new FacturasImplement(); oFactura.id_periodo = idPeriodo; oFactura.id_socio = int.Parse(DTUsuariosAFacturar.Rows[j]["id_socio"].ToString()); //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; int idFactura = 0; idFactura = oFacturasImplement.Save(oFactura); /* Si corresponde calcula los consumos estimados, además transfiere * los valores de los campos de datos actuales a los campos de * los datos anteriores*/ int idMedidor = 0; if (DTUsuariosAFacturar.Rows[j]["medidor"].ToString() != "") { socios_mediciones oSocioMedicionActual = new socios_mediciones(); SocioMedicionImplement oSocioMedicionImplement = new SocioMedicionImplement(); oSocioMedicionActual = oSocioMedicionImplement.ultimaMedicion(int.Parse(DTUsuariosAFacturar.Rows[j]["id_socio"].ToString())); socios_mediciones oSocioMedicionNew = new socios_mediciones(); oSocioMedicionNew.fecha_lectura = null; oSocioMedicionNew.id_socio = int.Parse(DTUsuariosAFacturar.Rows[j]["id_socio"].ToString()); if (i <= (int.Parse(this.nudCantidad.Value.ToString()) - 1)) { 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; } } else { oSocioMedicionNew.consumo = 0; oSocioMedicionNew.lectura = 0; } idMedidor = oSocioMedicionImplement.Save(oSocioMedicionNew); } oFactura.id_medicion = idMedidor; //Cargo 0 si no tiene medidor // Limpia las variables de subtotales con y sin IVA NetoConIVA = 0; NetoSinIVA = 0; //Para cada socio, 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(int.Parse(DTUsuariosAFacturar.Rows[j]["id_socio"].ToString()), 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(int.Parse(DTUsuariosAFacturar.Rows[j]["id_socio"].ToString()), decimal.Parse(DTUsuariosAFacturar.Rows[j]["cargo_fijo"].ToString()), decimal.Parse(DTUsuariosAFacturar.Rows[j]["abono"].ToString()), decimal.Parse(DTUsuariosAFacturar.Rows[j]["valor_m3"].ToString()), oConcepto, oFactura, oConceptoParticular); if (oDetalle.importe != 0) { oFacturasDetallesImplement.Save(oDetalle); } this.txtUsuariosFacturados.Text = j.ToString(); this.txtUsuariosFaltantes.Text = (int.Parse(this.txtUsuariosAFacturar.Text) - j).ToString(); Application.DoEvents(); // 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); } } } // Obtiene el subtotal general como suma de los // subtotales parciales con y sin IVA SubTotal = NetoConIVA + NetoSinIVA; // Redondea el subtotal a dos dígitos SubTotal = decimal.Round(SubTotal, 2); // Registra el subtotal general oFactura.importeNeto = Convert.ToSingle(SubTotal); // Calcula IVA (sólo para los conceptos que corresponde) facturas_detalles oFacDetalle = new facturas_detalles(); FacturasDetallesImplement oFacDetalleImplement = new FacturasDetallesImplement(); cod_conceptos oConceptoIVA = new cod_conceptos(); ConceptoImplement oConceptoImplement = new ConceptoImplement(); oConceptoIVA = oConceptoImplement.Get(23);//concepto IVA es el 23 oFacDetalle.id_concepto = oConceptoIVA.id_concepto; oFacDetalle.id_factura = oFactura.id_factura; oFacDetalle.idOrden = oConceptoIVA.orden_concepto; oFacDetalle.idTipo = 0; oFacDetalle.importe = decimal.Round(NetoConIVA * decimal.Parse(DTUsuariosAFacturar.Rows[j]["iva"].ToString()) / 100, 2); oFacDetalleImplement.Save(oFacDetalle); // Calcula Total oFactura.importeTotal = oFactura.importeNeto.Value + Convert.ToSingle(oFacDetalle.importe); //este ahi que ver el tipo de dato oFactura.id_factura = idFactura; oFacturaImplement.Update(oFactura); // Generar entradas en la base de CuentasCorrientes CuentaCorrienteImplement oCuentaCorrienteImplement = new CuentaCorrienteImplement(); cuentas_corrientes oCuentaCorriente = new cuentas_corrientes(); oCuentaCorriente.fecha = DateTime.Now; oCuentaCorriente.id_factura = idFactura; oCuentaCorriente.id_movimiento = 1; oCuentaCorriente.id_socio = int.Parse(DTUsuariosAFacturar.Rows[j]["id_socio"].ToString()); oCuentaCorriente.importe_credito = 0; oCuentaCorriente.importe_saldo = 0; oCuentaCorriente.importe_debito = Convert.ToDecimal(oFactura.importeTotal); oCuentaCorriente.id_cobranza = 0; oCuentaCorrienteImplement.Save(oCuentaCorriente); // } } } } }
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) } }
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(); }