private void ArmarReciboListaProductosConVariosElementos(DataRow filaUnicaDatosSocio, DataGridViewRowCollection filasConProductos, string totalAPagar, DataTable infoUsuarioTable, string folioReciboLicencia) { CRListaProductosPagados crListaProductosPagados = new CRListaProductosPagados(); //-----Rellenar el area del recibo licencia TextObject folioReciboLicenciaTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text29"] as TextObject; folioReciboLicenciaTextObject.Text = folioReciboLicencia.Length > 0 ? "FOLIO DE RECIBO LICENCIA " + folioReciboLicencia : ""; //-------Rellenar el area de total a pagar TextObject totalAPagarTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text5"] as TextObject; totalAPagarTextObject.Text = totalAPagar; //-------Rellenar el area superior TextObject propietarioPatenteTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text1"] as TextObject; propietarioPatenteTextObject.Text = filaUnicaDatosSocio.Field <string>("PropietarioPatente"); // + " " + filaUnicaDatosSocio.Field<string>("Comodatario"); TextObject nombreComercialTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text2"] as TextObject; nombreComercialTextObject.Text = filaUnicaDatosSocio.Field <string>("NombreComercial"); ConversorATextoMonedaPesos conversorATextoMonedaPesos = new ConversorATextoMonedaPesos(); TextObject totalAPagarEnLetrasTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text4"] as TextObject; totalAPagarEnLetrasTextObject.Text = conversorATextoMonedaPesos.Analizar((Decimal.Parse(totalAPagar)).ToString("0.00")); TextObject nombreComodatarioTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text25"] as TextObject; nombreComodatarioTextObject.Text = filaUnicaDatosSocio.Field <string>("Comodatario"); TextObject rfcComodatarioTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text27"] as TextObject; rfcComodatarioTextObject.Text = filaUnicaDatosSocio.Field <string>("RFCComodatario"); //-------Rellenar el area donde aparece Concepto - Total a pagar Hashtable tablaHash = RecuperarEtiquetasConceptoDelReporte(crListaProductosPagados); Hashtable totalesTablaHash = RecuperarEtiquetasTotalesDelReporte(crListaProductosPagados); int i = 0; foreach (DataGridViewRow fila in filasConProductos) { //Rellenando la columna conceptos ClsProductoViewModel clsProductoViewModel = (ClsProductoViewModel)fila.Cells[1].Value; TextObject objTextObject = (TextObject)tablaHash[i.ToString()]; objTextObject.Text = clsProductoViewModel.Nombre; //Rellenando la columna totales string totalEnCelda = fila.Cells[4].EditedFormattedValue.ToString(); TextObject otroTextObject = (TextObject)totalesTablaHash[i.ToString()]; otroTextObject.Text = totalEnCelda; i++; } AsignarVacioAEtiquetasQueContienen(tablaHash, "concepto"); //Quitar el texto "concepto" a las etiquetas no usadas AsignarVacioAEtiquetasQueContienen(totalesTablaHash, "total"); //Quitar el texto "0" a las etiquetas no usadas //--------Establecer la fecha que irá en el reporte if (infoUsuarioTable.Rows.Count == 1) { var res = from s in infoUsuarioTable.AsEnumerable() select s; DataRow filaUnica = res.First(); DateTime fechaEnServidor = filaUnica.Field <DateTime>("FechaAlta"); TextObject diaTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text6"] as TextObject; diaTextObject.Text = fechaEnServidor.Day.ToString(); TextObject mesTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text7"] as TextObject; mesTextObject.Text = MesATexto(fechaEnServidor.Month); TextObject anioTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text8"] as TextObject; anioTextObject.Text = (fechaEnServidor.Year % 2000).ToString(); //-------Mostrar el reporte crystalReportViewer1.ReportSource = crListaProductosPagados; } else { string mensaje = "FrmVisorReporte en ArmarReciboListaProductosConVariosElementos"; throw new ArgumentException(mensaje); } }
private void ArmarReciboListaProductosConSolo1Elemento(DataRow filaUnicaDatosSocio, DataGridViewRowCollection filasConProductos, string totalAPagar, DataTable infoUsuarioTable, string folioReciboLicencia) { CRListaProductosPagados crListaProductosPagados = new CRListaProductosPagados(); //-----Rellenar el area del recibo licencia TextObject folioReciboLicenciaTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text29"] as TextObject; folioReciboLicenciaTextObject.Text = "FOLIO DE RECIBO LICENCIA " + folioReciboLicencia; //-------Rellenar el area de total a pagar TextObject totalAPagarTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text5"] as TextObject; totalAPagarTextObject.Text = totalAPagar; //-------Rellenar el area superior TextObject propietarioPatenteTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text1"] as TextObject; propietarioPatenteTextObject.Text = filaUnicaDatosSocio.Field <string>("PropietarioPatente"); //+ " " + filaUnicaDatosSocio.Field<string>("Comodatario"); TextObject nombreComercialTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text2"] as TextObject; nombreComercialTextObject.Text = filaUnicaDatosSocio.Field <string>("NombreComercial"); ConversorATextoMonedaPesos conversorATextoMonedaPesos = new ConversorATextoMonedaPesos(); TextObject totalAPagarEnLetrasTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text4"] as TextObject; totalAPagarEnLetrasTextObject.Text = conversorATextoMonedaPesos.Analizar((Decimal.Parse(totalAPagar)).ToString("0.00")); TextObject nombreComodatarioTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text25"] as TextObject; nombreComodatarioTextObject.Text = filaUnicaDatosSocio.Field <string>("Comodatario"); TextObject rfcComodatarioTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text27"] as TextObject; rfcComodatarioTextObject.Text = filaUnicaDatosSocio.Field <string>("RFCComodatario"); //--------Rellenar el area donde aparece Afiliación - total a pagar TextObject afiliacionTextObject; afiliacionTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text11"] as TextObject; afiliacionTextObject.Text = "Afiliación"; DataGridViewRow filaDataGrid = filasConProductos[0]; decimal cantidadAPagar = Decimal.Parse(filaDataGrid.Cells[4].EditedFormattedValue.ToString()); TextObject totalAfiliacionTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text18"] as TextObject; totalAfiliacionTextObject.Text = cantidadAPagar.ToString(); //---------Limpiar el reporte de los conceptos no usados y totales no usados TextObject conceptoNoUsadoTextObject; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text12"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text13"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text14"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text15"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text16"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text17"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text28"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text30"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text31"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text32"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text33"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text34"] as TextObject; conceptoNoUsadoTextObject.Text = ""; conceptoNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text35"] as TextObject; conceptoNoUsadoTextObject.Text = ""; TextObject totalNoUsadoTextObject; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text19"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text20"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text21"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text22"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text23"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text24"] as TextObject; totalNoUsadoTextObject.Text = ""; //del 36 al 42 totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text36"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text37"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text38"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text39"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text40"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text41"] as TextObject; totalNoUsadoTextObject.Text = ""; totalNoUsadoTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text42"] as TextObject; totalNoUsadoTextObject.Text = ""; //--------Establecer la fecha que irá en el reporte if (infoUsuarioTable.Rows.Count == 1) { var res = from s in infoUsuarioTable.AsEnumerable() select s; DataRow filaUnica = res.First(); DateTime fechaEnServidor = filaUnica.Field <DateTime>("FechaAlta"); TextObject diaTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text6"] as TextObject; diaTextObject.Text = fechaEnServidor.Day.ToString(); TextObject mesTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text7"] as TextObject; mesTextObject.Text = MesATexto(fechaEnServidor.Month); TextObject anioTextObject = crListaProductosPagados.ReportDefinition.ReportObjects["Text8"] as TextObject; anioTextObject.Text = (fechaEnServidor.Year % 2000).ToString(); //-------Mostrar el reporte crystalReportViewer1.ReportSource = crListaProductosPagados; } else { string mensaje = "FrmVisorReporte en ArmarReciboListaProductosConSolo1Elemento "; throw new ArgumentException(mensaje); } }