示例#1
0
 private void btnEliminar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     DialogResult = XtraMessageBox.Show("¿Desea Eliminar los servicios seleccionados?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
     if (DialogResult == DialogResult.Yes)
     {
         string[] ODC = CadenaCodigos.Split(',');
         foreach (string vOrden in ODC)
         {
             for (int i = 0; i < dtgValServicios.RowCount; i++)
             {
                 int xRow = dtgValServicios.GetVisibleRowHandle(i);
                 if (dtgValServicios.GetRowCellValue(xRow, "PSC_ODC").ToString() == vOrden)
                 {
                     string   vfecha = dtgValServicios.GetRowCellValue(xRow, "PSC_Fecha").ToString();
                     DateTime DFecha = Convert.ToDateTime(vfecha);
                     vfecha = DFecha.Year.ToString() + DosCeros(DFecha.Month.ToString()) + DosCeros(DFecha.Day.ToString());
                     CLS_ServiciosCortes del = new CLS_ServiciosCortes();
                     del.PSC_Fecha = vfecha;
                     del.PSC_ODC   = vOrden;
                     del.MtdEliminarServicioCorte();
                     if (!del.Exito)
                     {
                         XtraMessageBox.Show(del.Mensaje);
                     }
                     break;
                 }
             }
         }
         btnBuscarServicios.PerformClick();
         CadenaCodigos = string.Empty;
         gridCheckMarksODC.ClearSelection();
     }
 }
示例#2
0
        private int BuscarOrdendeCorte(string vODC)
        {
            int valor = 0;
            CLS_ServiciosCortes sel = new CLS_ServiciosCortes();

            sel.PSC_ODC = vODC;
            sel.MtdSeleccionarServicioCorteODCCont();
            if (sel.Exito)
            {
                valor = Convert.ToInt32(sel.Datos.Rows[0]["Registros"].ToString());
            }
            return(valor);
        }
示例#3
0
        private void btnBuscarServicios_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CLS_ServiciosCortes sel          = new CLS_ServiciosCortes();
            DateTime            vFechaInicio = Convert.ToDateTime(dtInicio.EditValue.ToString());
            DateTime            vFechaFin    = Convert.ToDateTime(dtFin.EditValue.ToString());

            sel.Fecha_Inicio = vFechaInicio.Year.ToString() + DosCeros(vFechaInicio.Month.ToString()) + DosCeros(vFechaInicio.Day.ToString());
            sel.Fecha_Fin    = vFechaFin.Year.ToString() + DosCeros(vFechaFin.Month.ToString()) + DosCeros(vFechaFin.Day.ToString());
            sel.MtdSeleccionarServicioCorteODC_Fechas();
            if (sel.Exito)
            {
                dtgServicios.DataSource = sel.Datos;
            }
        }
示例#4
0
        private void btnGuardar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (dtgValServicios.RowCount > 0)
            {
                //pgbProgreso.Properties.Maximum = dtgValServicios.RowCount;
                //pgbProgreso.Position = 0;

                for (int x = 0; x < dtgValServicios.RowCount; x++)
                {
                    int xRow = dtgValServicios.GetVisibleRowHandle(x);
                    //pgbProgreso.Position = x + 1;
                    Application.DoEvents();

                    CLS_ServiciosCortes ins    = new CLS_ServiciosCortes();
                    DateTime            DFecha = Convert.ToDateTime(dtgValServicios.GetRowCellValue(xRow, "PSC_Fecha").ToString());
                    string vFecha = DFecha.Year.ToString() + DosCeros(DFecha.Month.ToString()) + DosCeros(DFecha.Day.ToString());
                    ins.PSC_Fecha         = vFecha;
                    ins.PSC_ODC           = dtgValServicios.GetRowCellValue(xRow, "PSC_ODC").ToString();
                    ins.PSC_Ubicacion     = dtgValServicios.GetRowCellValue(xRow, "PSC_Ubicacion").ToString();
                    ins.PSC_Pesada        = dtgValServicios.GetRowCellValue(xRow, "PSC_Pesada").ToString();
                    ins.PSC_Placas        = dtgValServicios.GetRowCellValue(xRow, "PSC_Placas").ToString();
                    ins.PSC_Huertas       = dtgValServicios.GetRowCellValue(xRow, "PSC_Huertas").ToString();
                    ins.PSC_Productor     = dtgValServicios.GetRowCellValue(xRow, "PSC_Productor").ToString();
                    ins.PSC_Cajas         = dtgValServicios.GetRowCellValue(xRow, "PSC_Cajas").ToString();
                    ins.PSC_Kilos         = dtgValServicios.GetRowCellValue(xRow, "PSC_Kilos").ToString();
                    ins.PSC_Variedad      = dtgValServicios.GetRowCellValue(xRow, "PSC_Variedad").ToString();
                    ins.PSC_JefeCuadrilla = dtgValServicios.GetRowCellValue(xRow, "PSC_JefeCuadrilla").ToString();
                    ins.PSC_CajasZ        = dtgValServicios.GetRowCellValue(xRow, "PSC_CajasZ").ToString();
                    ins.PSC_FolioZ        = dtgValServicios.GetRowCellValue(xRow, "PSC_FolioZ").ToString();
                    ins.PSC_JefeArea      = dtgValServicios.GetRowCellValue(xRow, "PSC_JefeArea").ToString();
                    ins.PSC_ClaveDia      = dtgValServicios.GetRowCellValue(xRow, "PSC_ClaveDia").ToString();
                    ins.MtdUpdateServiciosCortes();
                    if (!ins.Exito)
                    {
                        XtraMessageBox.Show(ins.Mensaje);
                    }
                    else
                    {
                        XtraMessageBox.Show("Se ha modificado el registro con Exito");
                    }
                }
            }
        }
示例#5
0
        private bool BuscarRegistro(string vFecha, string vODC)
        {
            Boolean  Valor = false;
            DateTime fecha = Convert.ToDateTime(vFecha);

            vFecha = fecha.Year.ToString() + DosCeros(fecha.Month.ToString()) + DosCeros(fecha.Day.ToString());
            CLS_ServiciosCortes sel = new CLS_ServiciosCortes();

            sel.PSC_Fecha = vFecha;
            sel.PSC_ODC   = vODC;
            sel.MtdSeleccionarServicioCorteODC();
            if (sel.Exito)
            {
                if (sel.Datos.Rows.Count > 0)
                {
                    Valor = true;
                }
            }
            return(Valor);
        }
示例#6
0
        private void btnGenerarApoyo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DialogResult = XtraMessageBox.Show("¿Desea generar una cuadrilla de apoyo de los elementos seleccionados?", "Genera Cuadrilla", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (DialogResult == DialogResult.Yes)
            {
                string[] ODC = CadenaCodigos.Split(',');
                foreach (string vOrden in ODC)
                {
                    for (int i = 0; i < dtgValServicios.RowCount; i++)
                    {
                        int xRow = dtgValServicios.GetVisibleRowHandle(i);
                        if (dtgValServicios.GetRowCellValue(xRow, "PSC_ODC").ToString() == vOrden)
                        {
                            string vFecha         = dtgValServicios.GetRowCellValue(xRow, "PSC_Fecha").ToString();
                            string vODC           = dtgValServicios.GetRowCellValue(xRow, "PSC_ODC").ToString();
                            string vUbicacion     = dtgValServicios.GetRowCellValue(xRow, "PSC_Ubicacion").ToString();
                            string vPesada        = dtgValServicios.GetRowCellValue(xRow, "PSC_Pesada").ToString();
                            string vPlacas        = dtgValServicios.GetRowCellValue(xRow, "PSC_Placas").ToString();
                            string vHuertas       = dtgValServicios.GetRowCellValue(xRow, "PSC_Huertas").ToString();
                            string vProductor     = dtgValServicios.GetRowCellValue(xRow, "PSC_Productor").ToString();
                            string vCajas         = dtgValServicios.GetRowCellValue(xRow, "PSC_Cajas").ToString();
                            string vKilos         = dtgValServicios.GetRowCellValue(xRow, "PSC_Kilos").ToString();
                            string vVariedad      = dtgValServicios.GetRowCellValue(xRow, "PSC_Variedad").ToString();
                            string vJefeCuadrilla = dtgValServicios.GetRowCellValue(xRow, "PSC_JefeCuadrilla").ToString();
                            string vCajasZ        = dtgValServicios.GetRowCellValue(xRow, "PSC_CajasZ").ToString();
                            string vFolioZ        = dtgValServicios.GetRowCellValue(xRow, "PSC_FolioZ").ToString();
                            string vJefeArea      = dtgValServicios.GetRowCellValue(xRow, "PSC_JefeArea").ToString();
                            string vClaveDia      = dtgValServicios.GetRowCellValue(xRow, "PSC_ClaveDia").ToString();

                            int Registros              = BuscarOrdendeCorte(vODC);
                            CLS_ServiciosCortes ins    = new CLS_ServiciosCortes();
                            DateTime            DFecha = Convert.ToDateTime(vFecha);
                            vFecha                = DFecha.Year.ToString() + DosCeros(DFecha.Month.ToString()) + DosCeros(DFecha.Day.ToString());
                            ins.PSC_Fecha         = vFecha;
                            ins.PSC_ODC           = vODC + "_" + Letra(Registros);
                            ins.PSC_Ubicacion     = vUbicacion;
                            ins.PSC_Pesada        = vPesada;
                            ins.PSC_Placas        = vPlacas;
                            ins.PSC_Huertas       = vHuertas;
                            ins.PSC_Productor     = vProductor;
                            ins.PSC_Cajas         = vCajas;
                            ins.PSC_Kilos         = vKilos;
                            ins.PSC_Variedad      = vVariedad;
                            ins.PSC_JefeCuadrilla = vJefeCuadrilla;
                            ins.PSC_CajasZ        = vCajasZ;
                            ins.PSC_FolioZ        = vFolioZ;
                            ins.PSC_JefeArea      = vJefeArea;
                            ins.PSC_ClaveDia      = vClaveDia;
                            ins.MtdInsertarServiciosCortes();
                            if (!ins.Exito)
                            {
                                XtraMessageBox.Show(ins.Mensaje);
                            }
                        }
                    }
                }
                btnBuscarServicios.PerformClick();
                CadenaCodigos = string.Empty;
                gridCheckMarksODC.ClearSelection();
            }
        }
示例#7
0
        private void btnImportar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int contadorins = 0;

            if (txtClave.Text != string.Empty)
            {
                if (dtgValServicios.RowCount > 0)
                {
                    pgbProgreso.Properties.Maximum = dtgValServicios.RowCount;
                    pgbProgreso.Position           = 0;

                    for (int x = 0; x < dtgValServicios.RowCount; x++)
                    {
                        int xRow = dtgValServicios.GetVisibleRowHandle(x);
                        pgbProgreso.Position = x + 1;
                        Application.DoEvents();
                        string vFecha         = dtgValServicios.GetRowCellValue(xRow, "col_Fecha").ToString();
                        string vODC           = dtgValServicios.GetRowCellValue(xRow, "col_ODC").ToString();
                        string vUbicacion     = dtgValServicios.GetRowCellValue(xRow, "col_Ubicacion").ToString();
                        string vPesada        = dtgValServicios.GetRowCellValue(xRow, "col_Pesada").ToString();
                        string vPlacas        = dtgValServicios.GetRowCellValue(xRow, "col_Placas").ToString();
                        string vHuertas       = dtgValServicios.GetRowCellValue(xRow, "col_Huertas").ToString();
                        string vProductor     = dtgValServicios.GetRowCellValue(xRow, "col_Productor").ToString();
                        string vCajas         = dtgValServicios.GetRowCellValue(xRow, "col_Cajas").ToString();
                        string vKilos         = dtgValServicios.GetRowCellValue(xRow, "col_Kilos").ToString();
                        string vVariedad      = dtgValServicios.GetRowCellValue(xRow, "col_Variedad").ToString();
                        string vJefeCuadrilla = dtgValServicios.GetRowCellValue(xRow, "col_JefeCuadrilla").ToString();
                        string vCajasZ        = dtgValServicios.GetRowCellValue(xRow, "col_CajasZ").ToString();
                        string vFolioZ        = dtgValServicios.GetRowCellValue(xRow, "col_FolioZ").ToString();
                        string vJefeArea      = dtgValServicios.GetRowCellValue(xRow, "col_JefeArea").ToString();
                        if (!BuscarRegistro(vFecha, vODC))
                        {
                            CLS_ServiciosCortes ins    = new CLS_ServiciosCortes();
                            DateTime            DFecha = Convert.ToDateTime(vFecha);
                            vFecha                = DFecha.Year.ToString() + DosCeros(DFecha.Month.ToString()) + DosCeros(DFecha.Day.ToString());
                            ins.PSC_Fecha         = vFecha;
                            ins.PSC_ODC           = vODC;
                            ins.PSC_Ubicacion     = vUbicacion;
                            ins.PSC_Pesada        = vPesada;
                            ins.PSC_Placas        = vPlacas;
                            ins.PSC_Huertas       = vHuertas;
                            ins.PSC_Productor     = vProductor;
                            ins.PSC_Cajas         = vCajas;
                            ins.PSC_Kilos         = vKilos;
                            ins.PSC_Variedad      = vVariedad;
                            ins.PSC_JefeCuadrilla = vJefeCuadrilla;
                            ins.PSC_CajasZ        = vCajasZ;
                            ins.PSC_FolioZ        = vFolioZ;
                            ins.PSC_JefeArea      = vJefeArea;
                            ins.PSC_ClaveDia      = txtClave.Text;
                            ins.MtdInsertarServiciosCortes();
                            if (!ins.Exito)
                            {
                                XtraMessageBox.Show(ins.Mensaje);
                            }
                            else
                            {
                                contadorins++;
                            }
                        }
                    }
                    XtraMessageBox.Show("Se importaron " + contadorins + " de " + dtgValServicios.RowCount);
                    btnLimpiar.PerformClick();
                }
                else
                {
                    XtraMessageBox.Show("No existen registros para importar");
                }
            }
            else
            {
                XtraMessageBox.Show("Se debe capturar Hoja y Clave");
            }
        }