private void Estatus_cargar(RadComboBox cboBox) { CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); gsEstatus_ListarResult objEstatus = new gsEstatus_ListarResult(); try { objCobranzaWCF = new CobranzasWCFClient(); List <gsEstatus_ListarResult> lstEstatus = objCobranzaWCF.Estatus_Deuda_Listar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario).ToList(); lstEstatus.Insert(0, objEstatus); objEstatus.NombreEstaus = "Seleccionar"; objEstatus.id_estatus = 0; cboBox.DataSource = lstEstatus; cboBox.DataValueField = "id_estatus"; cboBox.DataTextField = "NombreEstaus"; cboBox.DataBind(); ViewState["lstEstatus"] = JsonHelper.JsonSerializer(lstEstatus); if (cboBox.Items.Count > 0) { cboBox.SelectedIndex = 0; } } catch (Exception ex) { throw ex; } }
private void Proyectado_Listar(int periodo, string id_sectorista, int id_zona, int anho, int mes) { CobranzasWCFClient objProyectadoWCF = new CobranzasWCFClient(); List <spEstadoCuenta_ProyectadoResult> lstProyectado = new List <spEstadoCuenta_ProyectadoResult>(); try { lstProyectado = objProyectadoWCF.EstadoCuenta_Proyectado(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, periodo, id_sectorista, id_zona, anho, mes).ToList().OrderBy(x => x.ClienteNombre).ToList(); ViewState["lstProyectado"] = JsonHelper.JsonSerializer(lstProyectado); lstProyectado = lstProyectado.FindAll(x => x.ImportePendiente > 0).ToList().OrderBy(x => x.Nom_Zona).ToList(); grdClientes.DataSource = lstProyectado; grdClientes.DataBind(); lblMensaje.Text = "Se cargo con exitó"; lblMensaje.CssClass = "mensajeExito"; } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void Proyectado_Verificar(string id_sectorista, string periodo, int id_zona) { CobranzasWCFClient objProyectadoWCF = new CobranzasWCFClient(); int respuesta; try { respuesta = objProyectadoWCF.ProyectadoCobranza_Verificar(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, id_sectorista, periodo, id_zona); //if(lblGrilla.Value == "0") //{ // btnCargaMasiva.Enabled = false; // btnExcel.Enabled = false; //} //else //{ // btnCargaMasiva.Enabled = true; // btnExcel.Enabled = true; //} } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void ListarVentasCobranzas(string codAgenda, DateTime fechaInicial, DateTime fechaFinal, string cliente, string texto) { int TipoDocumento = Convert.ToInt32(cboTipoDoc.SelectedValue.ToString()); CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient(); EstadoCuentaWCFClient objEstadoCuentaWCF = new EstadoCuentaWCFClient(); try { List <gsReporteFacturasInafectasV1Result> lstCobranzas = objCobranzasWCF.Reporte_FacturasInafecta(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, fechaInicial, fechaFinal, TipoDocumento, cliente).ToList(); if (texto == null) { var liq = from lq in lstCobranzas select lq; grdFacturasInafectas.DataSource = liq.ToList(); //lstCobranzas.ToList(); grdFacturasInafectas.DataBind(); } else { var liq = from lq in lstCobranzas where lq.Cliente == texto select lq; grdFacturasInafectas.DataSource = liq.ToList(); //lstCobranzas.ToList(); grdFacturasInafectas.DataBind(); } } catch (Exception ex) { throw ex; } }
public void Documentos_Proyectado(string id_cliente, int periodo) { try { CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); List <ProyectadoCobranza_DocumentosResult> lstGestion = objCobranzaWCF.ProyectadoCobranza_Documentos(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_cliente, periodo).ToList(); grdDocumentos.DataSource = lstGestion; grdDocumentos.DataBind(); ViewState["lstDocumentos"] = JsonHelper.JsonSerializer(lstGestion); if (lstGestion.Count > 0) { lblGrilla.Value = "1"; } else { lblGrilla.Value = "0"; } } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void ZonasReporte_CargarxUsuario(int idEmpresa, string id_Agenda) { CobranzasWCFClient objCorbanza = new CobranzasWCFClient(); List <ZonasSectoristaPermiso_ListarResult> lstdetalle; try { ltbZonas.ClearChecked(); //List<ZonasReporte_ListarResult> lst = objReporte.ZonasReporte_Listar(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idUsuario, idReporte).ToList(); lstdetalle = objCorbanza.ZonasSectoristaPermiso_Listar(int.Parse(cboEmpresa.SelectedValue), ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_Agenda).ToList(); foreach (RadListBoxItem item in ltbZonas.Items) { if (lstdetalle.FindAll(x => x.ID_Zona.ToString() == item.Value).Count > 0) { item.Checked = true; } } } catch (Exception ex) { throw ex; } }
private void ReporteVenta_Cliente(int mes, int year, int id_zona, string id_sectorista) { ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient(); try { int periodo; periodo = year * 100 + mes; CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient(); List <gsReporteCobranzas_Poryectadas_ClienteResult> Lista; Lista = objCobranzasWCF.Reporte_CobranzasProyectadasCliente(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, id_sectorista).ToList(); Lista = Lista.FindAll(x => x.ImportePendiente > 0).ToList(); Lista = Lista.OrderByDescending(x => x.Avance).ToList(); ViewState["lstReporte"] = JsonHelper.JsonSerializer(Lista); grdCliente.DataSource = Lista; grdCliente.DataBind(); //lblTitulo.Text = "Reporte " + fechaInico.Year.ToString() + "-" + fechaInico.Month.ToString() + " de " + rv.Vendedor; } catch (Exception ex) { throw ex; } }
protected void grdCobranza_ItemCommand(object sender, GridCommandEventArgs e) { if (Session["Usuario"] == null) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true); } if (!ConnectionHelpers.CheckForInternetConnection()) { throw new ArgumentException("ERROR: Revisar su conexión a internet."); } string mensaje = ""; lblMensaje.Text = ""; try { if (e.CommandName == "Eliminar") { if (ValidarValores(ref mensaje) == false) { int id_proyectado = 0; id_proyectado = int.Parse(e.CommandArgument.ToString()); string obj = Request.QueryString["objDocumento"]; char delimiter = '}'; string[] arryString = Request.QueryString["objDocumento"].Split(delimiter); arryString[0] = arryString[0] + "}"; arryString[1] = arryString[1].Substring(1, 6); string fecha = arryString[1]; gsReporte_EstadoCuenta_BIResult objDocumento = JsonHelper.JsonDeserialize <gsReporte_EstadoCuenta_BIResult>(arryString[0]); CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); objCobranzaWCF.ProyectadoCobranza_Eliminar( ((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_proyectado); Proyeccion_Sectorista(0, fecha, 0, objDocumento.Origen, (int)objDocumento.OrigenOp, 1); lblMensaje.Text = "Se eliminó el registro."; lblMensaje.CssClass = "mensajeExito"; } else { lblMensaje.Text = mensaje; lblMensaje.CssClass = "mensajeError"; } } } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
protected void btnGuardar_Click(object sender, EventArgs e) { if (Session["Usuario"] == null) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true); } CobranzasWCFClient objCorbanza = new CobranzasWCFClient(); string id_agenda = null; int idPermiso = 0; int ActivoPermiso = 0; string imagen = "Defoult.jpg"; try { id_agenda = hfIdUsuario.Value.ToString(); ActivoPermiso = int.Parse(cboEstado.SelectedValue.ToString()); int ActivoZona = 0; int idZona = 0; foreach (RadListBoxItem item in ltbZonas.Items) { idZona = int.Parse(item.Value.ToString()); if (item.Checked == true) { ActivoZona = 1; } else { ActivoZona = 0; } idPermiso = objCorbanza.PermisosZona_Registrar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_agenda, idZona, ActivoZona, ActivoPermiso); } ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CloseAndRebindZona(" + idPermiso + ");", true); } catch (Exception ex) { lblMensaje.Text = "ERROR: " + ex.Message; lblMensaje.CssClass = "mensajeError"; } }
public void Proyeccion_Sectorista(int idProyectado, string periodo, int id_semana, string tablaOrigen, int opOrigen, int estado) { try { Acumulado = 0; CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); List <ProyectadoCobranza_ListarResult> lstProyeccion = new List <ProyectadoCobranza_ListarResult>(); lstProyeccion = objCobranzaWCF.ProyectadoCobranza_Listar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idProyectado, periodo, id_semana, tablaOrigen, opOrigen, estado).ToList(); foreach (ProyectadoCobranza_ListarResult obj in lstProyeccion) { Acumulado = Acumulado + (float)obj.Importe; } Maximno = (float)ViewState["Maximno"]; Saldo = Maximno - Acumulado; ViewState["Acumulado"] = Acumulado; ViewState["Saldo"] = Saldo; lblMaximo.Text = "Pendiente de proyectar: " + string.Format("{0:#,##0.##}", Convert.ToDouble(Saldo.ToString())); lblMaximo.CssClass = "mensajeExito"; grdCobranza.DataSource = lstProyeccion; grdCobranza.DataBind(); ViewState["lstProyeccion"] = JsonHelper.JsonSerializer(lstProyeccion); if (lstProyeccion.Count > 0) { lblGrilla.Value = "1"; } else { lblGrilla.Value = "0"; } lblMensaje.Text = "Listo para mostrar planificación de sectorista"; lblMensaje.CssClass = "mensajeExito"; } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void ZonasReporte_Cargar(int idEmpresa, string id_sectorista) { CobranzasWCFClient objCorbanza = new CobranzasWCFClient(); try { List <Zonas_Reportes_CobranzaResult> lst = objCorbanza.Zonas_Listar_Cobranza(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_sectorista).ToList(); ltbZonas.DataSource = lst; ltbZonas.DataBind(); } catch (Exception ex) { throw ex; } }
private void Zona_Cargar(string NroDocumento) { CobranzasWCFClient objCorbanza = new CobranzasWCFClient(); try { //List<Zonas_ReportesResult> lstPersonal = objPersonalWCF.Zonas_Listar(int.Parse(cboEmpresa.SelectedValue), ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, 0, NroDocumento).ToList(); List <Zonas_Reportes_CobranzaResult> lst = objCorbanza.Zonas_Listar_Cobranza(int.Parse(cboEmpresa.SelectedValue), ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, NroDocumento).ToList(); cboZonas.DataSource = lst; cboZonas.DataBind(); } catch (Exception ex) { throw ex; } }
private void ReporteCobranza_Listar(string codAgenda, string codigoVendedor) { int periodo; int year, mes; CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient(); List <gsReporteCobranzas_Poryectadas_VendedorResult> lst; try { DateTime firstDayOfMonth = new DateTime(rmyReporte.SelectedDate.Value.Year, rmyReporte.SelectedDate.Value.Month, 1); DateTime lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); year = firstDayOfMonth.Year; mes = firstDayOfMonth.Month; periodo = year * 100 + mes; lst = objCobranzasWCF.Reporte_CobranzasProyectadasVendedor(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, 0, null).ToList(); lst = lst.OrderByDescending(x => x.AvanceCobrado).ToList().OrderBy(x => x.Sectorista_Nombre).ToList(); ViewState["cantidad"] = lst.Count; grdDocVenta.DataSource = lst; grdDocVenta.DataBind(); lblTitulo.Text = "Reporte de Pronostico de Cobranza (" + rmyReporte.SelectedDate.Value.Year.ToString() + "-" + rmyReporte.SelectedDate.Value.Month.ToString() + ")"; ViewState["lstDocVenta"] = JsonHelper.JsonSerializer(lst); ViewState["fechaInicio"] = firstDayOfMonth.ToString("dd/MM/yyyy"); ViewState["fechaFinal"] = lastDayOfMonth.ToString("dd/MM/yyyy"); ViewState["lstReporte"] = JsonHelper.JsonSerializer(lst); lblMensaje.Text = "Se cargo con éxito."; lblMensaje.CssClass = "mensajeExito"; } catch (Exception ex) { throw ex; } }
protected void grdVencidos_ItemDataBound1(object sender, GridItemEventArgs e) { int colum; colum = e.Item.RowIndex; CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem item = (GridEditableItem)e.Item; RadComboBox combo = ((RadComboBox)item.FindControl("RadComboBoxValore")); List <gsEstatus_ListarResult> lst = objCobranzaWCF.Estatus_Deuda_Listar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario).ToList(); combo.DataSource = lst; combo.DataValueField = "id_estatus"; combo.DataTextField = "NombreEstaus"; combo.DataBind(); } }
private void Personal_Listar(int idEmpresa, int idUsario, string codigoEmpresa, string codigoCargo, string descripcion, int reporte) { CobranzasWCFClient objCorbanza = new CobranzasWCFClient(); try { List <ZonasSectorista_ListarResult> lstPersonal = objCorbanza.ZonasSectorista_Listar(idEmpresa, idUsario, descripcion, reporte).ToList(); grdPersonal.DataSource = lstPersonal; grdPersonal.DataBind(); lblPersonalDS.Text = "1"; ViewState["lstPersonal"] = JsonHelper.JsonSerializer(lstPersonal); lblMensaje.Text = "Se encontraron " + lstPersonal.Count().ToString() + " registros "; lblMensaje.CssClass = "mensajeExito"; } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void ZonaPersonal_Detalle(string id_agenda) { CobranzasWCFClient objCorbanza = new CobranzasWCFClient(); List <ZonasSectoristaPermiso_ListarResult> lstdetalle; try { lstdetalle = objCorbanza.ZonasSectoristaPermiso_Listar(int.Parse(cboEmpresa.SelectedValue), ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_agenda).ToList(); grdZonas.DataSource = lstdetalle; grdZonas.DataBind(); lblZonaDS.Text = "1"; ViewState["lstDetalleZona"] = JsonHelper.JsonSerializer(lstdetalle); } catch (Exception ex) { lblMensaje.Text = "ERROR: " + ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void Zona_Cargar(string id_sectorista) { try { CobranzasWCFClient objCorbanza = new CobranzasWCFClient(); List <ZonasSectoristaPermiso_ListarResult> lstdetalle = new List <ZonasSectoristaPermiso_ListarResult>(); ZonasSectoristaPermiso_ListarResult objZona = new ZonasSectoristaPermiso_ListarResult(); List <ZonasSectoristaPermiso_ListarResult> lstZona; //lstZona = objAgendaWCF.Agenda_ListarZonaSectorista(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, // ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, id_sectorista).ToList(); lstZona = objCorbanza.ZonasSectoristaPermiso_Listar(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_sectorista).ToList(); lstZona.Insert(0, objZona); objZona.Zona = "TODO"; objZona.ID_Zona = 0; var lstZonas = from x in lstZona select new { x.ID_Zona, DisplayID = String.Format("{0}", x.ID_Zona), DisplayField = String.Format("{0}", x.Zona) //DisplayField = String.Format("{0} {1} {2} {3}", x.Placa, x.Modelo, x.Marca, x.Agenda) }; cboZona.DataSource = lstZonas; cboZona.DataTextField = "DisplayField"; cboZona.DataValueField = "DisplayID"; cboZona.DataBind(); } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void Seleccionar_Documento() { CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); gsEstatus_ListarResult objEstatus = new gsEstatus_ListarResult(); try { List <gsGestionCobranza_ListarResult> lista = new List <gsGestionCobranza_ListarResult>(); lista = JsonHelper.JsonDeserialize <List <gsGestionCobranza_ListarResult> >((string)ViewState["lstGestion"]); foreach (GridItem rowitem in grdDocumentos.MasterTableView.Items) { GridDataItem dataitem = (GridDataItem)rowitem; TableCell cell = dataitem["CheckColumn"]; CheckBox checkBox = (CheckBox)cell.Controls[0].FindControl("Check"); //if (checkBox.Checked == true && checkBox.Enabled == true) //{ string TablaOrigen = dataitem["TablaOrigen"].Text; string OpOrigen = dataitem["OpOrigen"].Text; string Periodo = dataitem["Periodo"].Text; foreach (gsGestionCobranza_ListarResult Gestion in lista) { if (Gestion.TablaOrigen == TablaOrigen && Gestion.OpOrigen == OpOrigen && Gestion.periodo == Periodo) { checkBox.Checked = true; } } } } catch (Exception ex) { throw ex; } }
private void Cobranza_Buscar(string Cliente, string Vendedor, int year, int mes) { CobranzasWCFClient objCobranzaWCF; gsReporteCobranzaWeb_DetalleMesResult[] objCobranzaDetalle; int idEmpresa; try { objCobranzaWCF = new CobranzasWCFClient(); idEmpresa = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa; objCobranzaDetalle = objCobranzaWCF.Reporte_CancelacionesResumenDetalleMes(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, Cliente, Vendedor, year, mes); var query_Venta = from c in objCobranzaDetalle where c.ClaseCliente != "LEGAL" select new { c.periodoMesC, c.periodoMesE, c.periodoYearC, c.periodoYearE, c.TotalVentaMes, c.totalMes }; grdCobranzasMes.DataSource = query_Venta; grdCobranzasMes.DataBind(); } catch (Exception ex) { throw ex; } }
private void Proyectado_Listar(int periodo, string id_sectorista, int id_zona, int anho, int mes) { CobranzasWCFClient objProyectadoWCF = new CobranzasWCFClient(); List <spEstadoCuenta_ProyectadoResult> lstProyectado = new List <spEstadoCuenta_ProyectadoResult>(); try { lstProyectado = objProyectadoWCF.EstadoCuenta_Proyectado(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, periodo, id_sectorista, id_zona, anho, mes).ToList(); var query_Detalle = from c in lstProyectado orderby c.id_Cliente select new { c.Proyectado, c.ClienteNombre, c.estado, c.id_Cliente, c.id_estado, c.Id_Zona, c.MontoS1, c.MontoS2, c.MontoS3, c.MontoS4, c.obsercacion, c.Periodo, c.Proyectado01a30, c.Proyectado31a60, c.Proyectado61a120, c.Proyectado121a360, c.Proyectado360aMas, c.ImportePendiente, c.ImportePendienteNoVencido, c.ImportePendienteVencido }; List <spEstadoCuenta_ProyectadoResult> lstProyectadoT = new List <spEstadoCuenta_ProyectadoResult>(); int y = 0; foreach (var linea in query_Detalle) { spEstadoCuenta_ProyectadoResult lineaP = new spEstadoCuenta_ProyectadoResult(); lineaP.ClienteNombre = linea.ClienteNombre; lineaP.estado = linea.estado; lineaP.id_Cliente = linea.id_Cliente; lineaP.id_estado = linea.id_estado; lineaP.Id_Zona = linea.Id_Zona; lineaP.MontoS1 = linea.MontoS1; lineaP.MontoS2 = linea.MontoS2; lineaP.MontoS3 = linea.MontoS3; lineaP.MontoS4 = linea.MontoS4; lineaP.obsercacion = linea.obsercacion; lineaP.Periodo = linea.Periodo; lineaP.Proyectado = linea.Proyectado; lineaP.Proyectado01a30 = linea.Proyectado01a30; lineaP.Proyectado31a60 = linea.Proyectado31a60; lineaP.Proyectado61a120 = linea.Proyectado61a120; lineaP.Proyectado121a360 = linea.Proyectado121a360; lineaP.Proyectado360aMas = linea.Proyectado360aMas; lineaP.ImportePendiente = linea.ImportePendiente; lineaP.ImportePendienteNoVencido = linea.ImportePendienteNoVencido; lineaP.ImportePendienteVencido = linea.ImportePendienteVencido; lstProyectadoT.Add(lineaP); y++; } string strminimo = "0.5"; decimal minimo = decimal.Parse(strminimo); var ListarDetalle = query_Detalle.ToList().FindAll(x => x.ImportePendiente > minimo).ToList(); grdDocVenta.DataSource = ListarDetalle; grdDocVenta.DataBind(); ViewState["lstProyectado"] = lstProyectadoT; if (lstProyectado.Count > 0) { lblGrilla.Value = "1"; } else { lblGrilla.Value = "0"; } } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void ReporteVenta_Cliente(int periodo, int year, int mes, int id_zona, string id_sectorista) { int Periodo; int TotalDias = 0; decimal EsperadoDia = 0; decimal EsperadoAcumulado = 0; DateTime fechaInico; DateTime fechaFinal; fechaInico = Convert.ToDateTime(year + "-" + mes + "-" + "1"); fechaFinal = fechaInico.AddMonths(1).AddDays(-1); TimeSpan ts = fechaFinal - fechaInico; TotalDias = ts.Days + 1; CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient(); //rhcParticipacion.PlotArea.Series[0].Items.Clear(); try { #region Venta al 80% y 20% List <gsReporteCobranzas_Poryectadas_Vendedor_DetalleResult> lst = objCobranzasWCF.Reporte_CobranzasProyectadasVendedorDetalle(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, id_sectorista).ToList().OrderByDescending(x => x.ImporteCobrado).ToList(); decimal sum = (decimal)lst.Sum(i => i.ImporteCobrado); decimal acumulado = 0; bool paso80 = false; foreach (var cliente in lst) { SeriesItem item = new SeriesItem(); if (sum > 0) { if (((int)((decimal.Parse(cliente.ImporteCobrado.ToString()) / sum) * 100)) > 0) { item.YValue = ((int)((decimal.Parse(cliente.ImporteCobrado.ToString()) / sum) * 100)); item.Name = string.Format("{0}<br/>Valor Cobrado:${1}K<br/>Proyectado:${2}K<br/>Avance:{3}%<br/>Participación:{4}%", cliente.Cliente + " - " + cliente.ImporteCobrado.ToString().Replace("'", string.Empty), Math.Round(decimal.Parse(cliente.ImporteCobrado.ToString()) / 1000, 2), Math.Round((decimal)cliente.ImporteProyectado / 1000, 2), cliente.Avance, item.YValue); //rhcParticipacion.PlotArea.Series[0].Items.Add(item); } } if (cliente.ImporteCobrado > 0) { acumulado = acumulado + (decimal)cliente.ImporteCobrado; if (!paso80) { if (cliente.Cliente.Length > 30) { rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty)); } else { rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty)); } item = new SeriesItem(); item.Name = cliente.Id_Cliente.Replace("'", string.Empty); item.YValue = Math.Round((decimal)cliente.ImporteCobrado / 1000, 2); this.rhcCliente80.PlotArea.Series[0].Items.Add(item); item = new SeriesItem(); item.Name = cliente.Cliente.Replace("'", string.Empty); item.YValue = Math.Round((decimal)cliente.ImporteProyectado / 1000, 2); this.rhcCliente80.PlotArea.Series[1].Items.Add(item); } else { if (cliente.Cliente.Length > 30) { rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty)); } else { rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty)); } item = new SeriesItem(); item.Name = cliente.Cliente.Replace("'", string.Empty); item.YValue = Math.Round((decimal)(cliente.ImporteCobrado) / 1000, 2); this.rhcCliente20.PlotArea.Series[0].Items.Add(item); item = new SeriesItem(); item.Name = cliente.Cliente.Replace("'", string.Empty); item.YValue = Math.Round((decimal)cliente.ImporteProyectado / 1000, 2); this.rhcCliente20.PlotArea.Series[1].Items.Add(item); } if (acumulado / sum * 100 >= 80) { paso80 = true; } } } #endregion #region Datos principales //Datos principales de la venta gsReporteCobranzas_Poryectadas_VendedorResult[] rvP = objCobranzasWCF.Reporte_CobranzasProyectadasVendedor(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, null); gsReporteCobranzas_Poryectadas_VendedorResult rv = new gsReporteCobranzas_Poryectadas_VendedorResult(); if (rvP.Count() > 0) { rv = rvP.ToList().Single(); rrgAvanceReal.Pointer.Value = decimal.Parse(rv.AvanceCobrado.ToString()); lblAvanceReal.Text = "Avance Real: " + Math.Round((decimal)rv.AvanceCobrado, 0).ToString() + "%"; rrgAvanceEsperado.Pointer.Value = decimal.Parse(rv.AvanceEsperado.ToString()); lblAvanceEsperado.Text = "Avance Esperado: " + Math.Round((decimal)rv.AvanceEsperado, 0).ToString() + "%"; //- Cuadro de periodos //lblPronostico.Text = string.Format("${0}", Math.Round((decimal)rv.ImporteProyectado, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblValorVenta.Text = string.Format("${0}", Math.Round((decimal)rv.ImporteCobrado, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblDiferencia.Text = string.Format("${0}", Math.Round((decimal)rv.Diferencia, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblCantTotal.Text = lst.Count.ToString(); //lblCantVenta.Text = lst.FindAll(x => x.ImporteCobrado > 0).Count.ToString(); //lblCantNoVenta.Text = lst.FindAll(x => x.ImporteCobrado <= 0).Count.ToString(); } gsReporteCancelados_ProyectadoResult[] rvCobradoP = objCobranzasWCF.Reporte_CobranzasProyectadas_Sectorista(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, id_sectorista); gsReporteCancelados_ProyectadoResult rvCobrado = new gsReporteCancelados_ProyectadoResult(); if (rvCobradoP.Count() > 0) { rvCobrado = rvCobradoP.ToList().Single(); //lblVencido01a30.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_01a30, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido31a60.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_31a60, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido61a120.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_61a120, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido121a360.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_121a360, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido361aMas.Text = string.Format("${0}", Math.Round((decimal)(rvCobrado.Importe_361a720 + rvCobrado.Importe_721amas), 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblNoVencido.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_NoVencido, 0).ToString("#,#", CultureInfo.InvariantCulture)); } else { //lblVencido01a30.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido31a60.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido61a120.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido121a360.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblVencido361aMas.Text = string.Format("${0}", Math.Round((decimal)(0), 0).ToString("#,#", CultureInfo.InvariantCulture)); //lblNoVencido.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture)); } #endregion #region Cobro diario List <gsReporteCobranzas_Poryectadas_Vendedor_FechaResult> lstFecha = objCobranzasWCF.Reporte_CobranzasProyectadasVendedor_Fecha(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, null).ToList(); acumulado = 0; EsperadoDia = (decimal)rv.ImporteProyectado / TotalDias; EsperadoAcumulado = 0; for (DateTime day = fechaInico; DateTime.Compare(day, fechaFinal) <= 0; day = day.AddDays(1)) { AxisItem xitem = new AxisItem(); xitem.LabelText = day.ToString("dd/MM/yyyy"); rhcDiario.PlotArea.XAxis.Items.Add(xitem); gsReporteCobranzas_Poryectadas_Vendedor_FechaResult objVFecha = lstFecha.Find(x => x.FechaCobranza == day); //Completar linea 1 SeriesItem serie1 = new SeriesItem(); if (objVFecha != null) { acumulado = acumulado + (decimal)objVFecha.ImporteCobrado; serie1.YValue = Math.Round((decimal)objVFecha.ImporteCobrado / 1000, 2); } else { serie1.YValue = 0; } rhcDiario.PlotArea.Series[0].Items.Add(serie1); //Completar linea 2 SeriesItem serie2 = new SeriesItem(); if (rv.ImporteProyectado == 0) { serie2.YValue = Math.Round(acumulado / 100 * 100, 0); } else { serie2.YValue = Math.Round(acumulado / (decimal)rv.ImporteProyectado * 100, 0); } rhcDiario.PlotArea.Series[1].Items.Add(serie2); //Completar linea 3 SeriesItem serie3 = new SeriesItem(); EsperadoAcumulado = EsperadoAcumulado + EsperadoDia; //serie3.YValue = Math.Round((decimal)EsperadoAcumulado / 1000, 2); if (rv.ImporteProyectado == 0) { serie2.YValue = Math.Round((decimal)EsperadoAcumulado / 100 * 100, 0); } else { serie3.YValue = Math.Round((decimal)EsperadoAcumulado / (decimal)rv.ImporteProyectado * 100, 0); } rhcDiario.PlotArea.Series[2].Items.Add(serie3); } rhcDiario.PlotArea.Series[1].AxisName = "AdditionalAxis"; rhcDiario.PlotArea.Series[2].AxisName = "AdditionalAxis"; #endregion lblTitulo.Text = "Reporte " + year.ToString() + "-" + mes.ToString() + " de " + rv.Zona_nombre; } catch (Exception ex) { throw ex; } }
private void ReporteCobranza_Cuadro1(int mes, int year, int id_zona) { try { int periodo; periodo = year * 100 + mes; CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient(); List <gsReporteProyectado_Cuadro1Result> Lista; List <gsReporteProyectado_Cuadro1Result> ListaNew = new List <gsReporteProyectado_Cuadro1Result>(); Lista = objCobranzasWCF.Reporte_CobranzasProyectadas_Cuadro1(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, null).ToList(); gsReporteProyectado_Cuadro1Result objNew0 = new gsReporteProyectado_Cuadro1Result(); gsReporteProyectado_Cuadro1Result objNew1 = new gsReporteProyectado_Cuadro1Result(); gsReporteProyectado_Cuadro1Result objNew2 = new gsReporteProyectado_Cuadro1Result(); gsReporteProyectado_Cuadro1Result objNew3 = new gsReporteProyectado_Cuadro1Result(); gsReporteProyectado_Cuadro1Result objNew4 = new gsReporteProyectado_Cuadro1Result(); gsReporteProyectado_Cuadro1Result objNew5 = new gsReporteProyectado_Cuadro1Result(); objNew0 = Lista.FindAll(x => x.Periodo.Contains("Deuda")).Single(); ListaNew.Add(objNew0); if (Lista.FindAll(x => x.Periodo.Contains("Pronostico")).Count() > 0) { objNew1 = Lista.FindAll(x => x.Periodo.Contains("Pronostico")).Single(); } else { objNew1.Periodo = "Pronostico"; objNew1.ImportePendiente = 0; objNew1.Importe_NoVencidoMenor30 = 0; objNew1.Importe_NoVencido30a0 = 0; objNew1.Importe_01a15 = 0; objNew1.Importe_16a30 = 0; objNew1.Importe_31a60 = 0; objNew1.Importe_61a90 = 0; objNew1.Importe_91a120 = 0; objNew1.Importe_121a240 = 0; objNew1.Importe_240aMas = 0; } ListaNew.Add(objNew1); if (Lista.FindAll(x => x.Periodo.Contains("Cobrado")).Count() > 0) { objNew2 = Lista.FindAll(x => x.Periodo.Contains("Cobrado")).Single(); } else { objNew2.Periodo = "Cobrado"; objNew2.ImportePendiente = 0; objNew2.Importe_NoVencidoMenor30 = 0; objNew2.Importe_NoVencido30a0 = 0; objNew2.Importe_01a15 = 0; objNew2.Importe_16a30 = 0; objNew2.Importe_31a60 = 0; objNew2.Importe_61a90 = 0; objNew2.Importe_91a120 = 0; objNew2.Importe_121a240 = 0; objNew2.Importe_240aMas = 0; } ListaNew.Add(objNew2); objNew3.Periodo = "Avance"; objNew3.ImportePendiente = (double)Valor_Avance((decimal)objNew1.ImportePendiente, (decimal)objNew2.ImportePendiente); objNew3.Importe_NoVencidoMenor30 = (double)Valor_Avance((decimal)objNew1.Importe_NoVencidoMenor30, (decimal)objNew2.Importe_NoVencidoMenor30); objNew3.Importe_NoVencido30a0 = (double)Valor_Avance((decimal)objNew1.Importe_NoVencido30a0, (decimal)objNew2.Importe_NoVencido30a0); objNew3.Importe_01a15 = (double)Valor_Avance((decimal)objNew1.Importe_01a15, (decimal)objNew2.Importe_01a15); objNew3.Importe_16a30 = (double)Valor_Avance((decimal)objNew1.Importe_16a30, (decimal)objNew2.Importe_16a30); objNew3.Importe_31a60 = (double)Valor_Avance((decimal)objNew1.Importe_31a60, (decimal)objNew2.Importe_31a60); objNew3.Importe_61a90 = (double)Valor_Avance((decimal)objNew1.Importe_61a90, (decimal)objNew2.Importe_61a90); objNew3.Importe_91a120 = (double)Valor_Avance((decimal)objNew1.Importe_91a120, (decimal)objNew2.Importe_91a120); objNew3.Importe_121a240 = (double)Valor_Avance((decimal)objNew1.Importe_121a240, (decimal)objNew2.Importe_121a240); objNew3.Importe_240aMas = (double)Valor_Avance((decimal)objNew1.Importe_240aMas, (decimal)objNew2.Importe_240aMas); ListaNew.Add(objNew3); if (Lista.FindAll(x => x.Periodo.Contains("Descuento")).Count() > 0) { objNew4 = Lista.FindAll(x => x.Periodo.Contains("Descuento")).Single(); } else { objNew4.Periodo = "Descuento"; objNew4.ImportePendiente = 0; objNew4.Importe_NoVencidoMenor30 = 0; objNew4.Importe_NoVencido30a0 = 0; objNew4.Importe_01a15 = 0; objNew4.Importe_16a30 = 0; objNew4.Importe_31a60 = 0; objNew4.Importe_61a90 = 0; objNew4.Importe_91a120 = 0; objNew4.Importe_121a240 = 0; objNew4.Importe_240aMas = 0; } ListaNew.Add(objNew4); if (Lista.FindAll(x => x.Periodo.Contains("OtrosIngresos")).Count() > 0) { objNew5 = Lista.FindAll(x => x.Periodo.Contains("OtrosIngresos")).Single(); } else { objNew5.Periodo = "OtrosIngresos"; objNew5.ImportePendiente = 0; objNew5.Importe_NoVencidoMenor30 = 0; objNew5.Importe_NoVencido30a0 = 0; objNew5.Importe_01a15 = 0; objNew5.Importe_16a30 = 0; objNew5.Importe_31a60 = 0; objNew5.Importe_61a90 = 0; objNew5.Importe_91a120 = 0; objNew5.Importe_121a240 = 0; objNew5.Importe_240aMas = 0; } ListaNew.Add(objNew5); grdCuadro1.DataSource = ListaNew; grdCuadro1.DataBind(); ViewState["lstCuadro1"] = JsonHelper.JsonSerializer(ListaNew); if (Lista.Count > 0) { lblGrilla.Value = "1"; } else { lblGrilla.Value = "0"; } } catch (Exception ex) { throw ex; } }
protected void btnAgregar_Click(object sender, EventArgs e) { CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); int id_proyectado = 0, id_semana = 0, id_estatus = 0; string observacion = ""; int year, mes, periodo = 0; string strCliente = Request.QueryString["strCliente"].ToString(); strCliente = Session["strId_Cliente"].ToString(); string strSectorista = Request.QueryString["strSectorista"].ToString(); string mensaje = ""; if (Session["Usuario"] == null) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true); } try { if (ValidarValores(ref mensaje) == false) { if (!string.IsNullOrEmpty(txtObservacion.Text) || (txtObservacion.Text != "")) { if ((cboEstado.SelectedValue != "0")) { int count = 0; foreach (GridItem rowitem in grdDocumentos.MasterTableView.Items) { GridDataItem dataitem = (GridDataItem)rowitem; TableCell cell = dataitem["CheckColumn"]; CheckBox checkBox = (CheckBox)cell.Controls[0].FindControl("Check"); if (checkBox.Checked == true && checkBox.Enabled == true) { count++; string TablaOrigen = dataitem["TablaOrigen"].Text; int OpOrigen = int.Parse(dataitem["OpOrigen"].Text); int Periodo = int.Parse(dataitem["Periodo"].Text); year = rmyReporte.SelectedDate.Value.Year; mes = rmyReporte.SelectedDate.Value.Month; periodo = year * 100 + mes; id_estatus = int.Parse(cboEstado.SelectedValue); observacion = txtObservacion.Text; id_semana = int.Parse(cboSemana.SelectedValue); objCobranzaWCF.GestionCobranza_Registrar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, strCliente, periodo.ToString(), id_semana, id_estatus, observacion, 1, TablaOrigen, OpOrigen); } } if (count > 0) { LimpiarValores(); GestionSectorista(strCliente, int.Parse(periodo.ToString())); Seleccionar_Documento(); } else { lblMensaje.Text = "ERROR: " + "Seleccionar documento."; lblMensaje.CssClass = "mensajeError"; } } else { throw new ArgumentException("ERROR: Se debe seleccionar un Estado. "); } } else { throw new ArgumentException("ERROR: Se debe ingresar una Observación. "); } } else { lblMensaje.Text = "ERROR: " + mensaje; lblMensaje.CssClass = "mensajeError"; } } catch (Exception ex) { lblMensaje.Text = "ERROR: " + ex.Message; lblMensaje.CssClass = "mensajeError"; } }
private void ReporteCobranza_Cuadro2(int mes, int year, int id_zona) { try { int periodo; periodo = year * 100 + mes; CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient(); List <gsReporteProyectado_Cuadro2Result> Lista; List <gsReporteProyectado_Cuadro2Result> ListaNew = new List <gsReporteProyectado_Cuadro2Result>(); Lista = objCobranzasWCF.Reporte_CobranzasProyectadas_Cuadro2(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, null).ToList(); gsReporteProyectado_Cuadro2Result objNew0 = new gsReporteProyectado_Cuadro2Result(); gsReporteProyectado_Cuadro2Result objNew1 = new gsReporteProyectado_Cuadro2Result(); gsReporteProyectado_Cuadro2Result objNew2 = new gsReporteProyectado_Cuadro2Result(); objNew0 = Lista.FindAll(x => x.Periodo.Contains("Deuda")).Single(); ListaNew.Add(objNew0); if (Lista.FindAll(x => x.Periodo.Contains("Proyectado")).Count() > 0) { objNew1 = Lista.FindAll(x => x.Periodo.Contains("Proyectado")).Single(); } else { objNew1.Periodo = "Proyectado"; objNew1.ClientesPendiente = 0; objNew1.ClientesNoVencido = 0; objNew1.Clientes01a70 = 0; objNew1.Clientes71aMas = 0; } ListaNew.Add(objNew1); if (Lista.FindAll(x => x.Periodo.Contains("Cobrado")).Count() > 0) { objNew2 = Lista.FindAll(x => x.Periodo.Contains("Cobrado")).Single(); } else { objNew2.Periodo = "Cobrado"; objNew2.ClientesPendiente = 0; objNew2.ClientesNoVencido = 0; objNew2.Clientes01a70 = 0; objNew2.Clientes71aMas = 0; } ListaNew.Add(objNew2); grdCuadro2.DataSource = ListaNew; grdCuadro2.DataBind(); ViewState["lstCuadro2"] = JsonHelper.JsonSerializer(ListaNew); if (Lista.Count > 0) { lblGrilla2.Value = "1"; } else { lblGrilla2.Value = "0"; } } catch (Exception ex) { throw ex; } }
protected void btnAgregar_Click(object sender, EventArgs e) { CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient(); int id_proyectado = 0, id_semana = 0, id_estatus = 0; string periodo = "", mensaje = "", mes; if (Session["Usuario"] == null) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true); } try { if (ValidarValores(ref mensaje) == false) { if (!string.IsNullOrEmpty(txtImporte.Text) || (txtImporte.Text != "")) { string semanaMng = ViewState["id_semana"].ToString(); string semanaCbo = cboSemana.SelectedValue.ToString(); if (semanaMng != semanaCbo) { Maximno = (float)ViewState["Maximno"]; Acumulado = (float)ViewState["Acumulado"]; Saldo = Maximno - Acumulado; ViewState["Saldo"] = Saldo; } char delimiter = '}'; string[] arryString = Request.QueryString["objDocumento"].Split(delimiter); arryString[0] = arryString[0] + "}"; arryString[1] = arryString[1].Substring(1, 6); gsReporte_EstadoCuenta_BIResult objDocumento = JsonHelper.JsonDeserialize <gsReporte_EstadoCuenta_BIResult>(arryString[0]); string fecha = arryString[1]; id_semana = int.Parse(cboSemana.SelectedValue); float Importe = float.Parse(txtImporte.Text); string TablaOrigen = objDocumento.Origen; int OpOrigen = (int)objDocumento.OrigenOp; periodo = arryString[1]; Saldo = (float)ViewState["Saldo"]; if (Importe <= Saldo) { objCobranzaWCF.ProyectarCobranza_Registrar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_proyectado, periodo, id_semana, Importe, TablaOrigen, OpOrigen, 1); LimpiarValores(); Proyeccion_Sectorista(id_proyectado, periodo, 0, objDocumento.Origen, (int)objDocumento.OrigenOp, 1); PeriodoSemana_cargar(); lblMaximo.CssClass = "mensajeExito"; } else { lblMensaje.Text = "Ingresar un importe igual o menor a " + ViewState["Saldo"]; lblMensaje.CssClass = "mensajeError"; } } else { throw new ArgumentException("ERROR: Se debe ingresar una Observación. "); } } else { lblMensaje.Text = "ERROR: " + mensaje; lblMensaje.CssClass = "mensajeError"; } } catch (Exception ex) { lblMensaje.Text = "ERROR: " + ex.Message; lblMensaje.CssClass = "mensajeError"; } }
List <DataTable> REGISTRAR_EXCEL(DataTable tabla) { CobranzasWCFClient objProyectadoWCF = new CobranzasWCFClient(); List <DataTable> lista = new List <DataTable>(); DataTable dtGral; DataTable dtError; string codSectorista; string codCliente; int codZona; string Periodo; int empresa, usuario; decimal Semana1; decimal Semana2; decimal Semana3; decimal Semana4; decimal Proyectado; string cortar = ""; try { dtGral = tabla; dtError = dtGral.Clone(); dtError.Rows.Clear(); dtError.Columns.Add("Comentario"); int lent = 0; for (int n = 0; n < dtGral.Rows.Count; n++) { codSectorista = ""; codCliente = ""; codZona = 0; Periodo = ""; Semana1 = 0; Semana2 = 0; Semana3 = 0; Semana4 = 0; Proyectado = 0; codSectorista = dtGral.Rows[n]["codSectorista"].ToString(); lent = codSectorista.Length; if (lent > 0) { cortar = codSectorista.Substring(0, 1); if (cortar == "'") { codSectorista = codSectorista.Substring(1, lent - 1); } codSectorista = codSectorista.ToString(); codCliente = dtGral.Rows[n]["codCliente"].ToString(); lent = codCliente.Length; cortar = codCliente.Substring(0, 1); if (cortar == "'") { codCliente = codCliente.Substring(1, lent - 1); } codZona = int.Parse(dtGral.Rows[n]["codZona"].ToString()); Periodo = dtGral.Rows[n]["Periodo"].ToString(); Semana1 = decimal.Parse(dtGral.Rows[n]["Semana1"].ToString()); Semana2 = decimal.Parse(dtGral.Rows[n]["Semana2"].ToString()); Semana3 = decimal.Parse(dtGral.Rows[n]["Semana3"].ToString()); Semana4 = decimal.Parse(dtGral.Rows[n]["Semana4"].ToString()); Proyectado = Semana1 + Semana2 + Semana3 + Semana4; empresa = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa; usuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario; objProyectadoWCF.ProyectadoCobranza_Registrar(empresa, usuario, codCliente, codSectorista, Periodo, codZona, Semana1, Semana2, Semana3, Semana4, Proyectado); } } lblMensaje.Text = "El archivo se cargo con éxito. "; lblMensaje.CssClass = "mensajeExito"; } catch (Exception ex) { lblMensaje.Text = "Error de carga. " + ex.Message.ToString(); lblMensaje.CssClass = "mensajeError"; } return(lista); }