Example #1
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (lstLocales.SelectedIndex == -1)
     {
         MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (!BL.Utilitarios.ValidarServicioMysql())
     {
         string mensaje = "No se pudo establecer la conexión con el servidor de base de datos.";
         MessageBox.Show(this, mensaje, "Trend Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (rdTotales.Checked)
     {
         strLocales    = string.Empty;
         forma         = Convert.ToInt32(cmbForma.SelectedValue.ToString());
         strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00");
         dtFechaHasta  = dateTimeHasta.Value.AddDays(1);
         strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00");
         foreach (DataRowView filaLocal in lstLocales.SelectedItems)
         {
             idLocal     = filaLocal.Row[0].ToString();
             strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR ";
         }
         strLocales = strLocales.Substring(0, strLocales.Length - 4);
         progreso   = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar");
         progreso.ShowDialog();
         DataTable          tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0];
         frmVentasPesosCons frm            = new frmVentasPesosCons(tblVentasPesos);
         frm.Show();
     }
     else
     {
         string origen      = "frmVentasPesosInter_diarias";
         string accion      = "cargar";
         string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd");
         dtFechaHasta = dateTimeHasta.Value.AddDays(1);
         string      fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd");
         int         local       = Convert.ToInt32(lstLocales.SelectedValue.ToString());
         string      formaPago   = cmbForma.Text;
         frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, formaPago, origen, accion);
         newMDIChild.ShowDialog();
         DataTable tblVentasDiarias = frmProgress.tblEstatica;
         fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy");
         fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy");
         string nombreLocal = lstLocales.Text;
         frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal);
         frmDiarias.Show();
     }
 }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if(lstLocales.SelectedIndex == -1)
            {
            MessageBox.Show("Debe seleccionar un local.", "Trend",MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (rdTotales.Checked)
            {
                strLocales = string.Empty;
                forma = Convert.ToInt32(cmbForma.SelectedValue.ToString());
                strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00");
                dtFechaHasta = dateTimeHasta.Value.AddDays(1);
                strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00");
                foreach (DataRowView filaLocal in lstLocales.SelectedItems)
                {
                    idLocal = filaLocal.Row[0].ToString();
                    strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR ";

                }
                strLocales = strLocales.Substring(0, strLocales.Length - 4);
                progreso = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar");
                progreso.ShowDialog();
                DataTable tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0];
                frmVentasPesosCons frm = new frmVentasPesosCons(tblVentasPesos);
                frm.Show();
            }
            else
            {
                string origen = "frmVentasPesosInter_diarias";
                string accion = "cargar";
                string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd");
                dtFechaHasta = dateTimeHasta.Value.AddDays(1);
                string fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd");
                int local = Convert.ToInt32(lstLocales.SelectedValue.ToString());
                string formaPago = cmbForma.Text;
                frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, formaPago, origen, accion);
                newMDIChild.ShowDialog();
                DataTable tblVentasDiarias = frmProgress.tblEstatica;
                fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy");
                fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy");
                string nombreLocal = lstLocales.Text;
                frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal);
                frmDiarias.Show();
            }
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if(lstLocales.SelectedIndex == -1)
            {
            MessageBox.Show("Debe seleccionar un local.", "Trend",MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!BL.UtilDB.ValidarServicioMysql())
            {
                MessageBox.Show("No se pudo conectar con el servidor de base de datos."
                        + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                return;
            }
            if (rdTotales.Checked)
            {
                strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00");
                dtFechaHasta = dateTimeHasta.Value.AddDays(1);
                strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00");
                forma = Convert.ToInt32(cmbForma.SelectedValue.ToString());
                string genero;
                if (!string.IsNullOrEmpty(cmbGenero.Text)) genero = cmbGenero.SelectedValue.ToString();
                else genero = string.Empty;
                strLocales = string.Empty;
                foreach (DataRowView filaLocal in lstLocales.SelectedItems)
                {
                    idLocal = filaLocal.Row[0].ToString();
                    strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR ";

                }
                strLocales = strLocales.Substring(0, strLocales.Length - 4);
                progreso = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar", genero);
                progreso.ShowDialog();
                try
                {
                    DataTable tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0];
                    frmVentasPesosCons frm = new frmVentasPesosCons(tblVentasPesos);
                    frm.Show();
                }
                catch(NullReferenceException)
                {
                    MessageBox.Show("El servidor de base de datos no respondió a la solicitud. Intente nuevamente.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            else
            {
                string origen = "frmVentasPesosInter_diarias";
                string accion = "cargar";
                string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd");
                dtFechaHasta = dateTimeHasta.Value.AddDays(1);
                string fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd");
                int local = Convert.ToInt32(lstLocales.SelectedValue.ToString());
                string forma = cmbForma.Text;
                frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, forma, origen, accion);
                newMDIChild.ShowDialog();
                DataTable tblVentasDiarias = frmProgress.tblEstatica;
                fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy");
                fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy");
                string nombreLocal = lstLocales.Text;
                frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal);
                frmDiarias.Show();
            }
        }
Example #4
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (lstLocales.SelectedIndex == -1)
     {
         MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (!BL.UtilDB.ValidarServicioMysql())
     {
         MessageBox.Show("No se pudo conectar con el servidor de base de datos."
                         + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
         return;
     }
     if (rdTotales.Checked)
     {
         strFechaDesde = dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00");
         dtFechaHasta  = dateTimeHasta.Value.AddDays(1);
         strFechaHasta = dtFechaHasta.ToString("yyyy-MM-dd 00:00:00");
         forma         = Convert.ToInt32(cmbForma.SelectedValue.ToString());
         string genero;
         if (!string.IsNullOrEmpty(cmbGenero.Text))
         {
             genero = cmbGenero.SelectedValue.ToString();
         }
         else
         {
             genero = string.Empty;
         }
         strLocales = string.Empty;
         foreach (DataRowView filaLocal in lstLocales.SelectedItems)
         {
             idLocal     = filaLocal.Row[0].ToString();
             strLocales += "IdLocalLOC LIKE '" + idLocal + "' OR ";
         }
         strLocales = strLocales.Substring(0, strLocales.Length - 4);
         progreso   = new frmProgress(forma, strFechaDesde, strFechaHasta, strLocales, "frmVentasPesosCons", "cargar", genero);
         progreso.ShowDialog();
         try
         {
             DataTable          tblVentasPesos = frmProgress.dsVentasPesosCons.Tables[0];
             frmVentasPesosCons frm            = new frmVentasPesosCons(tblVentasPesos);
             frm.Show();
         }
         catch (NullReferenceException)
         {
             MessageBox.Show("El servidor de base de datos no respondió a la solicitud. Intente nuevamente.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
     }
     else
     {
         string origen      = "frmVentasPesosInter_diarias";
         string accion      = "cargar";
         string fecha_desde = dateTimeDesde.Value.ToString("yyyy-MM-dd");
         dtFechaHasta = dateTimeHasta.Value.AddDays(1);
         string      fecha_hasta = dtFechaHasta.ToString("yyyy-MM-dd");
         int         local       = Convert.ToInt32(lstLocales.SelectedValue.ToString());
         string      forma       = cmbForma.Text;
         frmProgress newMDIChild = new frmProgress(fecha_desde, fecha_hasta, local, forma, origen, accion);
         newMDIChild.ShowDialog();
         DataTable tblVentasDiarias = frmProgress.tblEstatica;
         fecha_desde = dateTimeDesde.Value.ToString("dd-MM-yyyy");
         fecha_hasta = dateTimeHasta.Value.ToString("dd-MM-yyyy");
         string nombreLocal = lstLocales.Text;
         frmVentasPesosDiarias frmDiarias = new frmVentasPesosDiarias(tblVentasDiarias, fecha_desde, fecha_hasta, nombreLocal);
         frmDiarias.Show();
     }
 }