Esempio n. 1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            string whereLocales = null;
            string articulo     = "";
            string descripcion  = "";

            Cursor.Current = Cursors.WaitCursor;
            string idLocal;

            foreach (DataRowView filaLocal in lstLocales.SelectedItems)
            {
                idLocal       = filaLocal.Row[0].ToString();
                whereLocales += "IdLocalSTK LIKE '" + idLocal + "' OR ";
            }
            whereLocales = whereLocales.Substring(0, whereLocales.Length - 4);
            if (rdArticulo.Checked == true)
            {
                articulo = txtParametros.Text;
            }
            else
            {
                descripcion = txtParametros.Text;
            }
            string      origen      = "frmStock";
            string      accion      = "cargar";
            frmProgress newMDIChild = new frmProgress(origen, accion, whereLocales, proveedor, articulo, descripcion);

            newMDIChild.ShowDialog();
            tblStock = frmProgress.dtEstatico.Tables[0];
            if (rdPantalla.Checked == true)
            {
                try
                {
                    DataColumn columnaPivot = tblStock.Columns["NombreLOC"];
                    DataColumn valorPivot   = tblStock.Columns["Cantidad"];
                    dtCruzada = BL.Utilitarios.Pivot(tblStock, columnaPivot, valorPivot);
                }
                catch
                {
                    if (whereLocales == null)
                    {
                        MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("No se encontraron artículos coincidentes", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    return;
                }
            }
            else
            {
            }
            frmStockInforme stockInforme = new frmStockInforme(dtCruzada);

            stockInforme.ShowDialog();
            Cursor.Current = Cursors.Arrow;
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            string whereLocales = null;
            string articulo = "";
            string descripcion = "";
            Cursor.Current = Cursors.WaitCursor;
            string idLocal;
            foreach (DataRowView filaLocal in lstLocales.SelectedItems)
            {
                idLocal = filaLocal.Row[0].ToString();
                whereLocales += "IdLocalSTK LIKE '" + idLocal + "' OR ";
            }
            whereLocales = whereLocales.Substring(0, whereLocales.Length - 4);
            if (rdArticulo.Checked == true)
            {
                articulo = txtParametros.Text;
            }
            else
            {
                descripcion = txtParametros.Text;
            }
            string origen = "frmStock";
            string accion = "cargar";
            frmProgress newMDIChild = new frmProgress(origen, accion, whereLocales, proveedor, articulo, descripcion);
            newMDIChild.ShowDialog();
            tblStock = frmProgress.dtEstatico.Tables[0];
            if (rdPantalla.Checked == true)
            {
                try
                {
                    DataColumn columnaPivot = tblStock.Columns["NombreLOC"];
                    DataColumn valorPivot = tblStock.Columns["Cantidad"];
                    dtCruzada = BL.Utilitarios.Pivot(tblStock, columnaPivot, valorPivot);
                }
                catch
                {
                    if (whereLocales == null)
                    {
                        MessageBox.Show("Debe seleccionar un local.", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("No se encontraron artículos coincidentes", "Trend", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    return;
                }
            }
            else
            {

            }
            frmStockInforme stockInforme = new frmStockInforme(dtCruzada);
            stockInforme.ShowDialog();
            Cursor.Current = Cursors.Arrow;
        }
Esempio n. 3
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;
            }
            string whereLocales = null;
            string articulo     = "";
            string descripcion  = "";
            int    activoWeb    = 0;

            Cursor.Current = Cursors.WaitCursor;
            string idLocal;

            foreach (DataRowView filaLocal in lstLocales.SelectedItems)
            {
                idLocal       = filaLocal.Row[0].ToString();
                whereLocales += "IdLocalSTK LIKE '" + idLocal + "' OR ";
            }
            whereLocales = whereLocales.Substring(0, whereLocales.Length - 4);
            string genero;

            if (!string.IsNullOrEmpty(cmbGenero.Text))
            {
                genero = cmbGenero.SelectedValue.ToString();
            }
            else
            {
                genero = string.Empty;
            }
            proveedor = Convert.ToInt32(cmbProveedor.SelectedValue);
            if (rdArticulo.Checked == true)
            {
                articulo = txtParametros.Text;
            }
            else
            {
                descripcion = txtParametros.Text;
            }
            if (chkActivo.Checked == true)
            {
                activoWeb = 1;
            }
            DataTable sortedDT;
            DataView  dv;

            try
            {
                string      origen      = "frmStock";
                string      accion      = "cargar";
                frmProgress newMDIChild = new frmProgress(origen, accion, whereLocales, genero, proveedor, articulo, descripcion, activoWeb);
                newMDIChild.ShowDialog();
                tblStock = frmProgress.dtEstatico.Tables[0];
                // Ordeno por NombreLOC para que aparezcan ordenadas las columnas local en el informe de stock
                dv       = tblStock.DefaultView;
                dv.Sort  = "NombreLOC asc";
                sortedDT = dv.ToTable();
            }
            catch (NullReferenceException)
            {
                return;
            }
            DataColumn columnaPivot = tblStock.Columns["NombreLOC"];
            DataColumn valorPivot   = tblStock.Columns["Cantidad"];

            dtCruzada = BL.Utilitarios.Pivot(sortedDT, columnaPivot, valorPivot);
            dv        = dtCruzada.DefaultView;
            dv.Sort   = "Descripcion asc";
            if (rdPantalla.Checked == true)
            {
                try
                {
                    frmStockInforme stockInforme = new frmStockInforme(dv);
                    stockInforme.Show();
                }
                catch
                {
                    if (whereLocales == null)
                    {
                        MessageBox.Show("Debe seleccionar un local.", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("No se encontraron artículos coincidentes", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    return;
                }
            }
            else
            {
                StockRpt rpt = new StockRpt(tblStock);
                rpt.ShowDialog();
            }

            Cursor.Current = Cursors.Arrow;
        }
        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;
            }
            string whereLocales = null;
            string articulo = "";
            string descripcion = "";
            int activoWeb = 0;
            Cursor.Current = Cursors.WaitCursor;
            string idLocal;
            foreach (DataRowView filaLocal in lstLocales.SelectedItems)
            {
                idLocal = filaLocal.Row[0].ToString();
                whereLocales += "IdLocalSTK LIKE '" + idLocal + "' OR ";
            }
            whereLocales = whereLocales.Substring(0, whereLocales.Length - 4);
            string genero;
            if (!string.IsNullOrEmpty(cmbGenero.Text)) genero = cmbGenero.SelectedValue.ToString();
            else genero = string.Empty;
            proveedor = Convert.ToInt32(cmbProveedor.SelectedValue);
            if (rdArticulo.Checked == true)
            {
                articulo = txtParametros.Text;
            }
            else
            {
                descripcion = txtParametros.Text;
            }
            if (chkActivo.Checked == true)
            {
                activoWeb = 1;
            }
            DataTable sortedDT;
            DataView dv;
            try
            {
                string origen = "frmStock";
                string accion = "cargar";
                frmProgress newMDIChild = new frmProgress(origen, accion, whereLocales, genero, proveedor, articulo, descripcion, activoWeb);
                newMDIChild.ShowDialog();
                tblStock = frmProgress.dtEstatico.Tables[0];
                // Ordeno por NombreLOC para que aparezcan ordenadas las columnas local en el informe de stock
                dv = tblStock.DefaultView;
                dv.Sort = "NombreLOC asc";
                sortedDT = dv.ToTable();
            }
            catch (NullReferenceException)
            {
                return;
            }
            DataColumn columnaPivot = tblStock.Columns["NombreLOC"];
            DataColumn valorPivot = tblStock.Columns["Cantidad"];
            dtCruzada = BL.Utilitarios.Pivot(sortedDT, columnaPivot, valorPivot);
            dv = dtCruzada.DefaultView;
            dv.Sort = "Descripcion asc";
            if (rdPantalla.Checked == true)
            {
                try
                {
                    frmStockInforme stockInforme = new frmStockInforme(dv);
                    stockInforme.Show();
                }
                catch
                {
                    if (whereLocales == null)
                    {
                        MessageBox.Show("Debe seleccionar un local.", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("No se encontraron artículos coincidentes", "Trend Gestión", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    return;
                }
            }
            else
            {
                StockRpt rpt = new StockRpt(tblStock);
                rpt.ShowDialog();
            }

            Cursor.Current = Cursors.Arrow;
        }