private void btnInforme_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                List <ReporteEppBE> lstReporte = null;
                lstReporte = new ReporteEppBL().ListadoAreaResponsable(Convert.ToInt32(cboEmpresa.EditValue), Convert.ToInt32(cboUnidadMinera.EditValue), Convert.ToDateTime(deFechaDesde.DateTime.ToShortDateString()), Convert.ToDateTime(deFechaHasta.DateTime.ToShortDateString()));

                if (lstReporte != null)
                {
                    if (lstReporte.Count > 0)
                    {
                        RptVistaReportes objRptEpp = new RptVistaReportes();
                        objRptEpp.VerRptEppAreaResponsable(lstReporte, deFechaDesde.DateTime.ToShortDateString(), deFechaHasta.DateTime.ToShortDateString());
                        objRptEpp.ShowDialog();
                    }
                    else
                    {
                        XtraMessageBox.Show("No hay información para el periodo seleccionado", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnInforme_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                List <ReporteEppBE> lstReporte = null;
                lstReporte = new ReporteEppBL().ListadoConsumoAnualEmpresaResponsable();

                if (lstReporte != null)
                {
                    if (lstReporte.Count > 0)
                    {
                        RptVistaReportes objRptEpp = new RptVistaReportes();
                        objRptEpp.VerRptEppConsumoAnualEmpresa(lstReporte);
                        objRptEpp.ShowDialog();
                    }
                    else
                    {
                        XtraMessageBox.Show("No hay información para el periodo seleccionado", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        private void tlbMenu_PrintClick()
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                if (gvEpp.RowCount > 0)
                {
                    int IdEpp = 0;
                    IdEpp = int.Parse(gvEpp.GetFocusedRowCellValue("IdEpp").ToString());
                    List <ReporteEppBE> lstReporte = null;

                    lstReporte = new ReporteEppBL().Listado(IdEpp);

                    if (lstReporte != null)
                    {
                        RptVistaReportes objRptAccUsu = new RptVistaReportes();
                        objRptAccUsu.VerRptEpp(lstReporte, Parametros.strUsuarioNombres, "CROSLAND LOGISTICA S.A.C.");
                        objRptAccUsu.ShowDialog();
                    }
                    else
                    {
                        XtraMessageBox.Show("No hay información para el periodo seleccionado", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnInforme_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                if (intIdPersonaResponsable == 0)
                {
                    XtraMessageBox.Show("Debe seleccionar una persona", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    btnBuscar.Select();
                    Cursor = Cursors.Default;
                    return;
                }

                List <ReporteEppBE> lstReporte = null;
                lstReporte = new ReporteEppBL().ListadoPorPersona(0, 0, 0, intIdPersonaResponsable, Convert.ToDateTime(deFechaDesde.DateTime.ToShortDateString()), Convert.ToDateTime(deFechaHasta.DateTime.ToShortDateString()));

                if (lstReporte != null)
                {
                    if (lstReporte.Count > 0)
                    {
                        RptVistaReportes objRptDocumentoVenta = new RptVistaReportes();
                        objRptDocumentoVenta.VerRptEppPersona(lstReporte, deFechaDesde.DateTime.ToShortDateString(), deFechaHasta.DateTime.ToShortDateString());
                        objRptDocumentoVenta.ShowDialog();
                    }
                    else
                    {
                        XtraMessageBox.Show("No hay información para el periodo seleccionado", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    EppBE objEpp    = new EppBE();
                    EppBL objBL_Epp = new EppBL();

                    StringBuilder strMensaje = new StringBuilder();

                    objEpp.IdEpp                     = IdEpp;
                    objEpp.IdEmpresa                 = Parametros.intEmpresaId;
                    objEpp.IdUnidadMinera            = Parametros.intUnidadMineraId;
                    objEpp.Numero                    = txtNumero.Text;
                    objEpp.IdSolicitudEpp            = intIdSolicitudEpp;
                    objEpp.IdPersona                 = intIdPersona;
                    objEpp.IdEmpresaResponsable      = intIdEmpresaResponsable;
                    objEpp.IdUnidadMineraResponsable = intIdUnidadMineraResponsable;
                    objEpp.IdAreaResponsable         = intIdAreaResponsable;
                    objEpp.IdSectorResponsable       = intIdSectorResponsable;
                    objEpp.Fecha                     = Convert.ToDateTime(deFecha.DateTime.ToShortDateString());
                    objEpp.DescOrdenInterna          = cboOrdenInterna.Text;
                    objEpp.Observacion               = txtObservacion.Text;
                    objEpp.FlagEstado                = true;
                    objEpp.Usuario                   = Parametros.strUsuarioLogin;
                    objEpp.Maquina                   = WindowsIdentity.GetCurrent().Name.ToString();


                    //Epp FOTO
                    List <EppDetalleBE> lstEppDetalle = new List <EppDetalleBE>();

                    foreach (var item in mListaEppDetalleOrigen)
                    {
                        EppDetalleBE objE_EppDetalle = new EppDetalleBE();
                        objE_EppDetalle.IdEmpresa        = Parametros.intEmpresaId;
                        objE_EppDetalle.IdEpp            = IdEpp;
                        objE_EppDetalle.IdEppDetalle     = item.IdEppDetalle;
                        objE_EppDetalle.Item             = item.Item;
                        objE_EppDetalle.IdEquipo         = item.IdEquipo;
                        objE_EppDetalle.Codigo           = item.Codigo;
                        objE_EppDetalle.DescEquipo       = item.DescEquipo;
                        objE_EppDetalle.FechaVencimiento = item.FechaVencimiento;
                        objE_EppDetalle.Cantidad         = item.Cantidad;
                        objE_EppDetalle.Precio           = item.Precio;
                        objE_EppDetalle.Total            = item.Total;
                        objE_EppDetalle.IdTipoEntrega    = item.IdTipoEntrega;
                        objE_EppDetalle.IdKardex         = item.IdKardex;
                        objE_EppDetalle.FlagEstado       = true;
                        objE_EppDetalle.Usuario          = Parametros.strUsuarioLogin;
                        objE_EppDetalle.Maquina          = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_EppDetalle.TipoOper         = item.TipoOper;
                        lstEppDetalle.Add(objE_EppDetalle);
                    }

                    if (pOperacion == Operacion.Nuevo)
                    {
                        int    intNumero = 0;
                        string strNumero = "";
                        intNumero      = objBL_Epp.Inserta(objEpp, lstEppDetalle);
                        strNumero      = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7);
                        txtNumero.Text = strNumero;

                        //ACTUALIZA NUMERO
                        EppBL objBEpp = new EppBL();
                        objBEpp.ActualizaNumero(intNumero, txtNumero.Text);



                        decimal decTotal = 0;

                        strMensaje.Append("**************************** REGISTRO DE ENTREGA DE EPP ***************************************\n\n");
                        strMensaje.Append("Se Generó el N° REGISTRO DE ENTREGA DE EPP : " + txtNumero.Text + "\n\n");
                        strMensaje.Append("Responsable : " + txtResponsable.Text + "\n\n");
                        foreach (var item in mListaEppDetalleOrigen)
                        {
                            strMensaje.Append("Código : " + item.Codigo.ToString() + "\n");
                            strMensaje.Append("EPP : " + item.DescEquipo.ToString() + "\n");
                            strMensaje.Append("Cantidad : " + item.Cantidad.ToString() + "\n\n");
                            decTotal = decTotal + item.Precio;
                        }

                        strMensaje.Append("Costo Total S/.: " + decTotal.ToString() + "\n\n");
                        strMensaje.Append("**********************************************************************************************\n\n");


                        //GENERAR EL REPORTE EN PDF
                        List <ReporteEppBE> lstReporte = null;
                        lstReporte = new ReporteEppBL().Listado(intNumero);
                        rptEpp objReporte = new rptEpp();

                        objReporte.SetDataSource(lstReporte);
                        objReporte.SetParameterValue("Coordinador", Parametros.strUsuarioNombres);
                        objReporte.SetParameterValue("EmpresaResponsable", "CROSLAND LOGISTICA S.A.C.");
                        objReporte.ExportToDisk(ExportFormatType.PortableDocFormat, @"D:\" + strNumero + ".pdf");
                        BSUtils.EmailSend(strEmail, "Registro de entrega de Epp", strMensaje.ToString(), @"D:\" + strNumero + ".pdf", "", "", "");



                        XtraMessageBox.Show("Se creó el Registro de Epp N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        objBL_Epp.Actualiza(objEpp, lstEppDetalle);
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }