private void bmMantenimiento_ItemClick(object sender, ItemClickEventArgs e) { var subMenu = e.Item as BarSubItem; if (subMenu != null) { return; } switch (e.Item.Name) { case "btnNuevo": LimpiarCampos(); TipoMnt = TipoMantenimiento.Nuevo; IdEntidadMnt = 0; pkIdEntidad.EditValue = 0; RecibocajaMnt = null; RecibocajaMnt = new Recibocajaegreso(); btnGrabar.Enabled = true; btnGrabarCerrar.Enabled = true; btnGrabarNuevo.Enabled = true; btnEliminar.Enabled = false; btnActualizar.Enabled = false; ValoresPorDefecto(); if (Permisos.Nuevo) { CamposSoloLectura(false); } break; case "btnGrabar": if (Guardar()) { SeGuardoObjeto = true; //btnGrabar.Enabled = false; //btnGrabarCerrar.Enabled = false; btnGrabarNuevo.Enabled = false; if (IdEntidadMnt > 0) { TipoMnt = TipoMantenimiento.Modificar; } if (Permisos.Eliminar) { btnEliminar.Enabled = true; btnActualizar.Enabled = true; } DeshabilitarModificacion(); } break; case "btnGrabarCerrar": if (Guardar()) { SeGuardoObjeto = true; DialogResult = DialogResult.OK; } break; case "btnEliminar": EliminaRegistro(); break; case "btnLimpiarCampos": LimpiarCampos(); break; case "btnActualizar": if (IdEntidadMnt > 0) { TraerDatos(); CargarDetalle(); } break; case "btnCerrar": if (SeGuardoObjeto) { DialogResult = DialogResult.OK; } else { RecibocajaMnt = null; DialogResult = DialogResult.OK; } break; case "btnCtacteCliente": if (!ValidarDatosImportacion()) { return; } List <VwRecibocajaegresodet> vwRecibocajadetMntList = new List <VwRecibocajaegresodet>(); RecibocajaImpCtacteProveedorFrm recibocajaImpCtacteProveedorFrm = new RecibocajaImpCtacteProveedorFrm(vwRecibocajadetMntList, VwSocionegocioSel, (int)iIdtipomoneda.EditValue); recibocajaImpCtacteProveedorFrm.ShowDialog(); if (recibocajaImpCtacteProveedorFrm.DialogResult == DialogResult.OK) { VwRecibocajaegreso vwRecibocajaSelImp = recibocajaImpCtacteProveedorFrm.VwRecibocajaSel; if (vwRecibocajaSelImp != null) { iIdsocionegocio.EditValue = vwRecibocajaSelImp.Idsocionegocio; iIdtipomoneda.EditValue = vwRecibocajaSelImp.Idtipomoneda; } foreach (var item in vwRecibocajadetMntList) { Recibocajaegresodet recibocajadet = new Recibocajaegresodet(); recibocajadet.Idrecibocajaegreso = IdEntidadMnt; recibocajadet.Idrecibocajaegresodet = item.Idrecibocajaegresodet; recibocajadet.Numeroitem = item.Numeroitem; recibocajadet.Importepago = item.Importepago; recibocajadet.Idmediopago = item.Idmediopago; recibocajadet.Numeromediopago = item.Numeromediopago; recibocajadet.Comentario = item.Comentario; recibocajadet.Idcpcompra = item.Idcpcompra; Service.SaveRecibocajaegresodet(recibocajadet); } CargarDetalle(); CargarDetalleImprevistos(); SumarTotales(true); } break; case "btnImprimir": if (ImpresionFormato == null) { ImpresionFormato = new ImpresionFormato(); } if (IdEntidadMnt > 0) { ImpresionFormato.FormatoReciboEgreso(RecibocajaMnt); } break; } }
private void btnBuscarRecibo_Click(object sender, EventArgs e) { var idTipoCp = iIdTipoDocRecibo.EditValue; if (idTipoCp == null) { XtraMessageBox.Show("Seleccione el tipo de documento", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Warning); iIdTipoDocRecibo.Select(); return; } //var idEmpleado = iIdempleado.EditValue; int idSucursal = (int)iIdsucursal.EditValue; string serieCotizacion = (string)rSerieTipocp.EditValue; string numeroCotizacion = (string)iNumeroTipocp.EditValue; VwRecibocajaegreso recibocaja = Service.GetVwRecibocajaegreso( x => x.Idtipocp == (int)idTipoCp && x.Idsucursal == idSucursal && x.Serierecibo == serieCotizacion.Trim() && x.Numerorecibo == numeroCotizacion.Trim() && !x.Anulado && x.Idresponsable == (int)iIdempleado.EditValue ); // if (recibocaja != null) { //Verificar si tiene items la cotizacion long cantidadItemsCotizacion = Service.CountRecibocajaegresodet(x => x.Idrecibocajaegreso == recibocaja.Idrecibocajaegreso); if (cantidadItemsCotizacion <= 0) { XtraMessageBox.Show("El comprobante no tiene items, verifique", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Error); iNumeroTipocp.Text = @"0"; iNumeroTipocp.Focus(); iNumeroTipocp.Select(); iNumeroTipocp.SelectAll(); return; } //Verificar si el recibo tiene cuadro rendicion Rendicioncajachica rendicioncajachica = Service.GetRendicioncajachica( x => x.Idrecibocaja == recibocaja.Idrecibocajaegreso && !x.Anulado); if (rendicioncajachica != null) { string numeroDocCc = string.Format("{0}-{1}", rendicioncajachica.Serierendicioncaja.Trim(), rendicioncajachica.Numerorendicioncaja); XtraMessageBox.Show(string.Format("Recibo ya fue importada en la Rendicion N°: {0}", numeroDocCc), "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Error); iNumeroTipocp.Text = @"0"; iNumeroTipocp.Focus(); iNumeroTipocp.Select(); iNumeroTipocp.SelectAll(); return; } iIdrecibocaja.EditValue = recibocaja.Idrecibocajaegreso; rImporterecibo.EditValue = recibocaja.Totaldocumento; rFecharecibo.EditValue = recibocaja.Fecharecibo; XtraMessageBox.Show("Recibo de Caja encontrado con exito", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Information); btnBuscarRecibo.Enabled = false; } else { XtraMessageBox.Show("No se encontró el número de Recibo de Caja para el empleado seleccionado, verifique", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Warning); iIdrecibocaja.EditValue = 0; iNumeroTipocp.EditValue = @"00000000"; iNumeroTipocp.Focus(); iNumeroTipocp.Select(); iNumeroTipocp.SelectAll(); } }