private async void MethodLoadDetail()
 {
     await Task.Factory.StartNew(() =>
         {
             try
             {
                 CollectionESGR_ProductoSubCategoria.Source = new BSGR_ProductoSubCategoria().GetCollectionProductoSubCategoria(ESGR_ProductoSubCategoria.ESGR_ProductoCategoria);
                 Application.Current.Dispatcher.Invoke(() =>
                 {
                     PropertyEnabledEditar = true;
                     PropertyEnabledCancelar = false;
                     ESGR_ProductoSubCategoria.IdSubCategoria = 0;
                     ESGR_ProductoSubCategoria.SubCategoria = string.Empty;
                 });
             }
             catch (Exception ex)
             {
                 CmpMessageBox.Show(SGRMessage.AdministratorProductoCategoria, ex.Message, CmpButton.Aceptar);
             }
         });
     
 }
Beispiel #2
0
        private void LoadHeader()
        {
            string strOutMessageError = string.Empty;
            string strPeriodoActivo   = new BMNF_Periodo().GetPeriodoActual();

            CmpTask.ProcessAsync(
                () =>
            {
                ListOpciones       = GetOpciones();
                ListEMNF_Periodo   = new ObservableCollection <EMNF_Periodo>(new BMNF_Periodo().ListPeriodo());
                ListESGC_Moneda    = new ObservableCollection <ESGC_Moneda>(new BSGC_Moneda().ListGetMoneda());
                ListESGC_Documento = GetDocumento();
            },
                (e) =>
            {
                if (e != null)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleMessage, e.Message, CmpButton.Aceptar);
                    return;
                }
                else
                {
                    ListESGC_Moneda.Add(new ESGC_Moneda()
                    {
                        CodMoneda = "%", Descripcion = "TODOS"
                    });
                    ListESGC_Documento.Add(new ESGC_Documento()
                    {
                        CodDocumento = "%", Descripcion = "TODOS"
                    });
                    ListEMNF_Periodo.ToList().ForEach(x => ListPeriodoCmpPeriodo.Add(x.Periodo));
                    SelectOpcion            = ListOpciones.LastOrDefault();
                    SelectPeriodo           = ListEMNF_Periodo.LastOrDefault(x => x.Periodo == strPeriodoActivo);
                    SelectMoneda            = ListESGC_Moneda.LastOrDefault();
                    SelectDocumento         = ListESGC_Documento.LastOrDefault();
                    SelectPeriodoCmpPeriodo = strPeriodoActivo;
                }
            });
        }
 private async void MethodLoadMotivo(ASSGR_ValueComboBox ASSGR_ValueComboBox)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             CollectionESGR_Motivo.Source = new CmpObservableCollection <ESGR_Motivo>(new BSGR_Motivo().CollectionESGR_Motivo().Where(x => x.Modulo == "SGR_MovimientoCaja" && x.Campo == ASSGR_ValueComboBox.Codigo));
             if (ESGR_MovimientoCaja.Opcion == "I")
             {
                 SelectedESGR_Motivo = CollectionESGR_Motivo.FirstOrDefault();
             }
             else
             {
                 SelectedESGR_Motivo = CollectionESGR_Motivo.FirstOrDefault(x => x.CodMotivo == ESGR_MovimientoCaja.ESGR_Motivo.CodMotivo);
             }
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministracionMovimientoCaja, ex.Message, CmpButton.Aceptar);
         }
     });
 }
 private async void MethodLoadSubCategoria(ESGR_ProductoCategoria ESGR_ProductoCategoria)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             CollectionESGR_ProductoSubCategoria.Source = new BSGR_ProductoSubCategoria().GetCollectionProductoSubCategoria(ESGR_ProductoCategoria);
             Application.Current.Dispatcher.Invoke(() =>
             {
                 CollectionESGR_ProductoSubCategoria.Add(new ESGR_ProductoSubCategoria()
                 {
                     IdSubCategoria = 0, SubCategoria = "TODOS"
                 });
             });
             SelectedESGR_ProductoSubCategoria = CollectionESGR_ProductoSubCategoria.FirstOrDefault(x => x.IdSubCategoria == 0);
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.ListadoVentaDia, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #5
0
        private void LoadDetail()
        {
            string strOutMessageError = string.Empty;

            CmpTask.ProcessAsync(
                () =>
            {
                if (ObjECMP_ReporteGrlDocumento.ObjEMNF_ClienteProveedor.RazonSocial.Trim().Length == 0)
                {
                    ObjECMP_ReporteGrlDocumento.ObjEMNF_ClienteProveedor.IdCliProveedor = 0;
                }
                ListECMP_ReporteGrlDocumento = new ObservableCollection <ECMP_ReporteGrlDocumento>(new BCMP_ReporteGrlDocumento().ListReporteGrlDocumento(ObjECMP_ReporteGrlDocumento));
            },
                (e) =>
            {
                if (e != null)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleMessage, e.Message, CmpButton.Aceptar);
                    return;
                }
            });
        }
Beispiel #6
0
 private async void MethodLoadCartaDiaDetalle()
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             CollectionESGR_CartaDiaDetalle.Source = new BSGR_CartaDiaDetalle().GetCollectionCartaDiaDetalle(ESGR_CartaDia);
             if (CollectionESGR_CartaDiaDetalle.Count > 0)
             {
                 CollectionESGR_CartaDiaDetalle.ToList().ForEach(x => { MethodCompare(x); });
             }
             else
             {
                 MethodCompare(new ESGR_CartaDiaDetalle());
             }
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorCartaDia, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #7
0
        private void LoadHeader()
        {
            string strOutMessageError = string.Empty;
            string strPeriodoActivo   = new BMNF_Periodo().GetPeriodoActual();

            CmpTask.Process(
                () =>
            {
                try
                {
                    ListOpciones     = GetOpciones();
                    ListEMNF_Periodo = new ObservableCollection <EMNF_Periodo>(new BMNF_Periodo().ListPeriodo());
                    ListESGC_Moneda  = new ObservableCollection <ESGC_Moneda>(new BSGC_Moneda().ListGetMoneda());
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleMessage, strOutMessageError, CmpButton.Aceptar);
                }
                else
                {
                    ListESGC_Moneda.Add(new ESGC_Moneda()
                    {
                        CodMoneda = "%", Descripcion = "TODOS"
                    });
                    ListEMNF_Periodo.ToList().ForEach(x => ListPeriodoCmpPeriodo.Add(x.Periodo));
                    SelectOpcion            = ListOpciones.LastOrDefault();
                    SelectMoneda            = ListESGC_Moneda.LastOrDefault();
                    SelectPeriodoCmpPeriodo = strPeriodoActivo;
                }
            });
        }
Beispiel #8
0
 public void MethodLoadHeader()
 {
     try
     {
         Application.Current.Dispatcher.Invoke(() =>
         {
             CollectionItemOpciones.Source   = GetOpciones();
             PropertyVisibilityCategoria     = Visibility.Collapsed;
             CollectionESGR_Categoria.Source = new BSGR_ProductoCategoria().GetCollectionProductoCategoria();
             CollectionESGR_Categoria.Add(new ESGR_ProductoCategoria
             {
                 IdCategoria = 0,
                 Categoria   = "TODOS"
             });
             SelectItemOpciones           = CollectionItemOpciones.FirstOrDefault();
             SelectESGR_ProductoCategoria = CollectionESGR_Categoria.FirstOrDefault(x => x.IdCategoria == 0);
         });
     }
     catch (Exception ex)
     {
         CmpMessageBox.Show(SGRMessage.AdministratorProducto, ex.Message, CmpButton.Aceptar);
     }
 }
Beispiel #9
0
        private async void MethodLoadCaja()
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    var CollectionCajaAperturada = new BSGR_AperturaCierreCaja().CollectionESGR_AperturaCierreCaja().Where(x => x.ESGR_Estado.CodEstado == "APTCJ").ToList();

                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        CollectionESGR_Caja.Clear();
                        CollectionCajaAperturada.ForEach(x =>
                        {
                            CollectionESGR_Caja.Add(x.ESGR_Caja);
                        });
                    });
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(SGRMessage.AdministracionCaja, ex.Message, CmpButton.Aceptar);
                }
            });
        }
 private async void MethodLoadProducto(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             PropertyMetroProgressBarProducto = true;
             if (PropertyFlitroText.Trim().Length > 0)
             {
                 CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProducto(ESGR_ProductoSubCategoria = null, PropertyFlitroText, "PRODUCTO");
             }
             else
             {
                 CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProducto(ESGR_ProductoSubCategoria);
             }
             PropertyMetroProgressBarProducto = false;
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorCartaDia, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #11
0
 private async void MethodLoadProductoSubCategoria(ESGR_ProductoCategoria ESGR_ProductoCategoria)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             CollectionESGR_ProductoSubCategoria.Source = new BSGR_ProductoSubCategoria().GetCollectionProductoSubCategoriaCartaDia(ESGR_ProductoCategoria);
             SelectedESGR_ProductoSubCategoria          = CollectionESGR_ProductoSubCategoria.FirstOrDefault();
             if (CollectionESGR_ProductoSubCategoria.Count == 1 && SelectedESGR_ProductoSubCategoria.SubCategoria == "NINGUNA")
             {
                 PropertyVisibilitySubCategoria = Visibility.Collapsed;
             }
             else
             {
                 PropertyVisibilitySubCategoria = Visibility.Visible;
             }
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #12
0
        public static byte[] SearchImage()
        {
            byte[] ByteArray = new byte[] { };
            try
            {
                Stream         myStream        = null;
                OpenFileDialog openFileDialog1 = new OpenFileDialog();

                openFileDialog1.Filter           = "Archivo de imagen (*.bmp, *.jpg, *.png)|*.bmp;*.jpg;*.png";
                openFileDialog1.RestoreDirectory = true;
                if (openFileDialog1.ShowDialog().Value)
                {
                    if ((myStream = openFileDialog1.OpenFile()) != null)
                    {
                        using (myStream)
                        {
                            ByteArray = new byte[myStream.Length];
                            myStream.Read(ByteArray, 0, System.Convert.ToInt32(myStream.Length));
                            myStream.Close();
                        }
                    }
                }

                //OpenFileDialog dlg = new OpenFileDialog();
                //dlg.Filter = "Archivo de imagen (*.bmp, *.jpg, *.png)|*.bmp;*.jpg;*.png";
                //if (dlg.ShowDialog().GetValueOrDefault())
                //{
                //    System.IO.FileStream fs = new System.IO.FileStream(dlg.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                //    ByteArray = new byte[fs.Length];
                //    fs.Read(ByteArray, 0, System.Convert.ToInt32(fs.Length));
                //    fs.Close();
                //}
            }
            catch (System.Exception ex) { CmpMessageBox.Show("ERROR", ex.Message, CmpButton.Aceptar); }

            return(ByteArray);
        }
Beispiel #13
0
 private async void MethodLoadSerieNumero(string CodDocumento)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             if (ESGR_VentaCuenta.Opcion == "I")
             {
                 CollectionESGR_DetalleVenta.OrderBy(x => x.ESGR_VentaCuenta.ESGR_Documento.CodDocumento);
                 var asd         = CollectionESGR_DetalleVenta;
                 var vrDocumento = (CollectionESGR_DetalleVenta.Count > 0) ? CollectionESGR_DetalleVenta.LastOrDefault(x => x.ESGR_VentaCuenta.ESGR_Documento.CodDocumento == CodDocumento) : null;
                 if (vrDocumento != null)
                 {
                     string Correlativo     = string.Empty;
                     ESGR_VentaCuenta.Serie = vrDocumento.ESGR_VentaCuenta.ESGR_Documento.Serie;
                     var strCorrelativo     = (Convert.ToInt32(vrDocumento.ESGR_VentaCuenta.Numero) + 1).ToString();
                     for (int item = 0; item < (vrDocumento.ESGR_VentaCuenta.ESGR_Documento.Longitud - strCorrelativo.Length); item++)
                     {
                         Correlativo += "0";
                     }
                     ESGR_VentaCuenta.Numero = Correlativo + strCorrelativo;
                 }
                 else
                 {
                     CollectionESGR_DocumentoSerieNumero.Source = new BSGR_Documento().GetCollectionDocumento(CodDocumento);
                     var FirstDocumentoSerieNumero = CollectionESGR_DocumentoSerieNumero.FirstOrDefault();
                     ESGR_VentaCuenta.Serie        = FirstDocumentoSerieNumero.Serie;
                     ESGR_VentaCuenta.Numero       = FirstDocumentoSerieNumero.Correlativo.ToString();
                 }
             }
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #14
0
 private async void MethodLoadProducto(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria, string Filtro = "%")
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             if (ESGR_ProductoSubCategoria == null)
             {
                 Application.Current.Dispatcher.Invoke(() =>
                 {
                     CollectionESGR_Producto.Clear();
                 });
                 return;
             }
             PropertyMetroProgressBarProducto = true;
             CollectionESGR_Producto.Source   = new BSGR_Producto().GetCollectionProductoCartaDia(ESGR_ProductoSubCategoria, Filtro);
             PropertyMetroProgressBarProducto = false;
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.TitlePedido, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #15
0
 private async void MethodLoadFechaCartaDia()
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             var Fecha = DateTime.Now;
             if (CollectionESGR_CartaDia.Count > 1)
             {
                 Fecha = Convert.ToDateTime(CollectionESGR_CartaDia.LastOrDefault().Fecha);
             }
             ESGR_CartaDia = CollectionESGR_CartaDia.LastOrDefault(x => Convert.ToDateTime(x.Fecha).ToShortDateString() == SelectedESGR_Fecha.ToShortDateString());
             if (Convert.ToDateTime(SelectedESGR_Fecha.ToShortDateString()) >= Convert.ToDateTime(Fecha) && ESGR_CartaDia.IdCartaDia == 0)
             {
                 ESGR_CartaDia = CollectionESGR_CartaDia.LastOrDefault();
             }
             MethodLoadCartaDiaDetalle();
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorCartaDia, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #16
0
 private void LoadDetail()
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         string strOutMessageError = string.Empty;
         CmpTask.ProcessAsync(
             () =>
         {
             if (ObjECMP_ReporteStockMinimo.ObjESGC_UsuarioEmpresaSucursal.ObjESGC_EmpresaSucursal == null)
             {
                 ObjECMP_ReporteStockMinimo.ObjESGC_UsuarioEmpresaSucursal.ObjESGC_EmpresaSucursal = new ESGC_EmpresaSucursal();
             }
             ListECMP_ReporteStockMinimo = new ObservableCollection <ECMP_ReporteStockMinimo>(new BCMP_ReporteStockMinimo().ListReporteStockMinimo(ObjECMP_ReporteStockMinimo ?? new ECMP_ReporteStockMinimo()));
         },
             (e) =>
         {
             if (e != null)
             {
                 CmpMessageBox.Show(CMPMensajes.TitleMessage, e.Message, CmpButton.Aceptar);
                 return;
             }
         });
     });
 }
Beispiel #17
0
        public void btnExportarIsClicked()
        {
            if (dtgListaPrecio.Items.Count == 0)
            {
                CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, "No hay Datos que Exportar", CmpButton.Aceptar);
                return;
            }
            var vrObjListaPrecio = new BCMP_TempArticuloListaPrecio().ListArticuloListaPrecio_Preview(IdCategoria, IdSubCategoria, IdMarca, IdArticulo, IdProveedor, FechaDesde.ToString("yyyyMM"), FechaHasta.ToString("yyyyMM"));

            try
            {
                var ListarExcel = vrObjListaPrecio.Select(x
                                                          => new
                {
                    Codigo       = x.Codigo,
                    Articulo     = x.Articulo,
                    UnidadMedida = x.CodUndMedida,
                    Marca        = x.Marca,
                    Categoria    = x.Categoria,
                    SubCategoria = x.SubCategoria,
                    NroDocumento = x.NroDocIdentidad,
                    RazonSocial  = x.RazonSocial,
                    CodMoneda    = x.CodMoneda,
                    Periodo      = x.Periodo,
                    Precio       = x.Precio,
                }).ToList();
                ListarExcel.Export("ListaPrecio", ExportType.Excel, (value) =>
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminListadoPrecio, value, CmpButton.Aceptar);
                });
            }
            catch (Exception ex)
            {
                CmpMessageBox.Show(CMPMensajes.TitleAdminListadoPrecio, ex.Message, CmpButton.Aceptar);
            }
        }
Beispiel #18
0
        private bool MethodValidaDatos()
        {
            if (CollectionESGR_VentaDetalle.Count(x => x.CantidadPagar == 0) == CollectionESGR_VentaDetalle.Count)
            {
                CmpMessageBox.Show(SGRMessage.AdministratorVenta, "No ha ingresado cantidad a pagar", CmpButton.Aceptar);
                return(true);
            }

            #region VALIDA POR DOCUMENTO

            else if (SelectedESGR_Documento.CodDocumento == "FAC")
            {
                if (ESGR_VentaCuenta.ESGR_Cliente == null)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, "Seleccione un Cliente", CmpButton.Aceptar);
                    return(true);
                }
                else if (NroDocIdentidad.Trim().Length != 11)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, "Ingrese Nro de Documento válido", CmpButton.Aceptar);
                    return(true);
                }
            }
            else if (SelectedESGR_Documento.CodDocumento == "BOL")
            {
                if (NroDocIdentidad.Trim().Length != 0 && NroDocIdentidad.Trim().Length != 8)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, "Ingrese Nro de Documento válido", CmpButton.Aceptar);
                    return(true);
                }
            }

            #endregion

            return(false);
        }
Beispiel #19
0
 private async void MethodLoadPedido(ESGR_Pedido ESGR_Pedido)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             ESGR_VentaCuenta.ESGR_Venta.ESGR_Pedido = ESGR_Pedido;
             if (CollectionESGR_PedidoDetalle.Count == 0)
             {
                 PropertyFiltroPedido = string.Empty;
             }
             Application.Current.Dispatcher.Invoke(() =>
             {
                 if (ESGR_VentaCuenta.Opcion == "I")
                 {
                     CollectionESGR_VentaDetalle.Clear();
                     CollectionESGR_PedidoDetalle.ToList().ForEach(x =>
                     {
                         CollectionESGR_VentaDetalle.Add(new ESGR_VentaDetalle()
                         {
                             Cantidad         = x.Cantidad,
                             ESGR_Producto    = x.ESGR_Producto,
                             ESGR_VentaCuenta = this.ESGR_VentaCuenta,
                             Importe          = 0
                         });
                     });
                 }
             });
             MethodCalcularTotales();
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Beispiel #20
0
 private async void MethodLoadCategoria()
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             PropertyMetroProgressBarCategoria       = true;
             CollectionESGR_ProductoCategoria.Source = new BSGR_ProductoCategoria().GetCollectionProductoCategoriaCartaDia();
             Application.Current.Dispatcher.Invoke(() => { CollectionESGR_ProductoSubCategoria.Clear(); SelectedESGR_ProductoCategoria = CollectionESGR_ProductoCategoria.FirstOrDefault(); });
             if (CollectionESGR_ProductoCategoria.Count == 0)
             {
                 CmpMessageBox.Show(SGRMessage.TitlePedido, "No se ha registrado Carta del Día para hoy " + DateTime.Now.ToLongDateString(), CmpButton.Aceptar, () =>
                 {
                     Volver();
                 });
             }
             PropertyMetroProgressBarCategoria = false;
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.BusquedaMesaDisponible, ex.Message, CmpButton.Aceptar);
         }
     });
 }
        private async void MethodLoadHeader()
        {
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    CollectionESGR_ProductoCategoria.Source = new BSGR_ProductoCategoria().GetCollectionProductoCategoria();
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        CollectionESGR_ProductoCategoria.Add(new ESGR_ProductoCategoria()
                        {
                            IdCategoria = 0, Categoria = "TODOS"
                        });
                        SelectedESGR_ProductoCategoria = CollectionESGR_ProductoCategoria.LastOrDefault();

                        PropertyProfile = SGRVariables.ESGR_Usuario.ESGR_Perfil.NombrePerfil;
                    });
                });
            }
            catch (Exception ex)
            {
                CmpMessageBox.Show(SGRMessage.ListadoPedidoAnulado, ex.Message, CmpButton.Aceptar);
            }
        }
        private bool MethodValidaDatos()
        {
            if (ESGR_AperturaCierreCaja.ESGR_UsuarioCajero == null)
            {
                CmpMessageBox.Show(SGRMessage.AdministracionAperturaCierreCaja, "Debe seleccionar Cajero para continuar.", CmpButton.Aceptar);
                return(true);
            }
            else if (ESGR_AperturaCierreCaja.ESGR_Motivo == null || ESGR_AperturaCierreCaja.ESGR_Motivo.CodMotivo.Trim().Length == 0)
            {
                CmpMessageBox.Show(SGRMessage.AdministracionAperturaCierreCaja, "Debe seleccionar Motivo para continuar.", CmpButton.Aceptar);
                return(true);
            }
            else if (ColletionMDSGR_AperturaCajaDetalle.Count == 0)
            {
                CmpMessageBox.Show(SGRMessage.AdministracionAperturaCierreCaja, "Ingrese un detalle como mínimo.", CmpButton.Aceptar);
                return(true);
            }
            else if (ColletionMDSGR_AperturaCajaDetalle.Count > 0)
            {
                string Message = string.Empty;
                foreach (var item in ColletionMDSGR_AperturaCajaDetalle)
                {
                    if (item.Monto_Inicio < 0 || item.Monto_Inicio < 0)
                    {
                        Message = "Los montos no deben ser menor a 0";
                    }
                }

                if (Message.Trim().Length > 0)
                {
                    CmpMessageBox.Show(SGRMessage.AdministracionAperturaCierreCaja, Message, CmpButton.Aceptar);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #23
0
        private void btnVisualizarIsClicked()
        {
            if (!btnVisualizar.IsEnabled)
            {
                return;
            }

            MSGC_UpdatePrivilege.Process(this, "CMP", CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.GetAccesoRestringidoNull("Orden Compra"), new Action <ESGC_PermisoPerfil>((P) =>
            {
                try
                {
                    if (P.Consulta)
                    {
                        if (dtgOrdenServicio.SelectedItems.Count == 0)
                        {
                            CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.IsNullSelectItem, CmpButton.Aceptar);
                            return;
                        }

                        ObjECMP_OrdenServicio            = (ECMP_OrdenServicio)dtgOrdenServicio.SelectedItem;
                        ObjListECMP_OrdenServicioDetalle = new BCMP_OrdenServicioDetalle().ListAdministrarOrdenServicioDetalle(ObjECMP_OrdenServicio);
                        foreach (var item in ObjListECMP_OrdenServicioDetalle)
                        {
                            if (ObjECMP_OrdenServicio.Exonerado == 12)
                            {
                                decimal dmlCalculoIGV = (item.PrecioUnitario * ObjECMP_OrdenServicio.IGV);
                                item.PrecioUnitario   = decimal.Round(dmlCalculoIGV + item.PrecioUnitario, 2);
                            }

                            //factura
                            if (ObjECMP_OrdenServicio.Exonerado == 12)
                            {
                                //Calculo con incluir IGV [12]
                                decimal dmlImporte    = item.PrecioUnitario * item.Cantidad;
                                decimal dmlImporteIGV = (dmlImporte / (((ObjECMP_OrdenServicio.IGV * 100) + 100) / 100)) * ObjECMP_OrdenServicio.IGV;

                                item.Importe    = dmlImporte;
                                item.ImporteIGV = dmlImporteIGV;
                            }
                            else if (ObjECMP_OrdenServicio.Exonerado == 21)
                            {
                                //Calculo cuando es Honorario [21]
                                decimal dmlImporte    = item.PrecioUnitario * item.Cantidad;
                                decimal dmlImporteIGV = 0;

                                item.Importe    = dmlImporte;
                                item.ImporteIGV = dmlImporteIGV;
                            }
                            else
                            {
                                //Calculo sin incluir IGV [11]
                                decimal dmlImporte    = item.PrecioUnitario * item.Cantidad;
                                decimal dmlImporteIGV = dmlImporte * ObjECMP_OrdenServicio.IGV;

                                item.Importe    = dmlImporte;
                                item.ImporteIGV = dmlImporteIGV;
                            }
                        }
                        ImprimirOrdenServicio(ObjECMP_OrdenServicio, ObjListECMP_OrdenServicioDetalle);
                    }
                    else
                    {
                        CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.GetAccesoRestringidoEditar("Orden Compra"), CmpButton.Aceptar);
                    }
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, ex.Message, CmpButton.Aceptar);
                }
            }));
        }
Beispiel #24
0
        private void btnAnularIsClick()
        {
            if (!btnAnular.IsEnabled)
            {
                return;
            }

            MSGC_UpdatePrivilege.Process(this, "CMP", CMPMensajes.TitleAdminCompra, CMPMensajes.GetAccesoRestringidoNull("Compra"), new Action <ESGC_PermisoPerfil>((P) =>
            {
                try
                {
                    if (P.Eliminar)
                    {
                        if (dtgCompra.SelectedItems.Count == 0)
                        {
                            CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, CMPMensajes.IsNullSelectItem, CmpButton.Aceptar);
                            return;
                        }
                        var ObjECMP_Compra = (ECMP_Compra)dtgCompra.SelectedItem;
                        if (ObjECMP_Compra != null)
                        {
                            if (ObjECMP_Compra.ObjESGC_Estado.CodEstado == "PECMP")
                            {
                                CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, CMPMensajes.PreguntaContinuarProceso, CmpButton.AceptarCancelar, () =>
                                {
                                    string strOutMessageError = string.Empty;
                                    CmpMessageBox.Proccess(CMPMensajes.TitleAdminCompra, CMPMensajes.PreguntaContinuarProceso, () =>
                                    {
                                        try
                                        {
                                            ObjECMP_Compra.Opcion = "N";
                                            new BCMP_Compra().TransCompra(ObjECMP_Compra);
                                        }
                                        catch (Exception ex)
                                        {
                                            strOutMessageError = ex.Message;
                                        }
                                    }, () =>
                                    {
                                        if (strOutMessageError.Length > 0)
                                        {
                                            CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, strOutMessageError, CmpButton.Aceptar);
                                        }
                                        else
                                        {
                                            CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, CMPMensajes.DatoProcesados, CmpButton.Aceptar);
                                            LoadDetail();
                                        }
                                    });
                                });
                            }
                            else
                            {
                                CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, "Solo se pueden anular Compras Pendientes", CmpButton.Aceptar);
                            }
                        }
                    }
                    else
                    {
                        CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, CMPMensajes.GetAccesoRestringidoEliminar("Compra"), CmpButton.Aceptar);
                    }
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, ex.Message, CmpButton.Aceptar);
                }
            }));
        }
        private async void MethodGuardarVenta()
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    ESGR_Venta.CuentasXML = MethodCuentasXML();
                    ESGR_Venta.DetalleXML = MethodDetalleXML();
                    new BSGR_Venta().TransVenta(ESGR_Venta);

                    if (OpcionGuardado == "VR")
                    {
                        var CollectionMSGR_PedidoDetalle = new BSGR_PedidoDetalle().GetCollectionPedidoDetalle(ESGR_Venta.ESGR_Pedido);
                        #region REALIZA IMPRESION

                        CrearTicket ticket = new CrearTicket();
                        ticket.TextoCentro(SGRVariables.ESGR_Usuario.ESGR_Empresa.RazonSocial);
                        ticket.TextoIzquierda("RUC:   " + SGRVariables.ESGR_Usuario.ESGR_Empresa.Ruc);
                        ticket.TextoIzquierda("DIREC: " + SGRVariables.ESGR_Usuario.ESGR_Empresa.DireccionFiscal);
                        ticket.TextoIzquierda("TELEF: " + SGRVariables.ESGR_Usuario.ESGR_Empresa.Telefono);
                        ticket.TextoIzquierda("");
                        ticket.lineasIgual();
                        ticket.TextoIzquierda("");
                        ticket.TextoDerecha("Ticket #001-" + ESGR_Venta.ESGR_Pedido.IdPedido.ToString("00000#"));
                        ticket.TextoIzquierda(SGRVariables.ESGR_Usuario.ESGR_Perfil.NombrePerfil + ": " + SGRVariables.ESGR_Usuario.IdUsuario + " " + SGRVariables.ESGR_Usuario.Nombres);
                        ticket.TextoExtremos("Fecha: " + DateTime.Now.ToShortDateString(), "Hora: " + DateTime.Now.ToShortTimeString());
                        ticket.TextoExtremos("Mesa: " + ESGR_Venta.ESGR_Pedido.Identificador, "Personas: " + ESGR_Venta.ESGR_Pedido.Cubierto);
                        ticket.TextoIzquierda("");
                        ticket.lineasIgual();
                        ticket.TextoIzquierda("");
                        //Articulos a vender.
                        ticket.EncabezadoVenta();//NOMBRE DEL ARTICULO, CANT, PRECIO, IMPORTE
                        ticket.lineasGuion();
                        foreach (var item in CollectionMSGR_PedidoDetalle)
                        {
                            ticket.AgregaArticulo(item.ESGR_Producto.Producto, (int)item.Cantidad, (decimal)item.ESGR_Producto.Precio, ((int)item.Cantidad * (decimal)item.ESGR_Producto.Precio));
                        }
                        ticket.lineasGuion();
                        decimal Total = CollectionMSGR_PedidoDetalle.Sum(x => ((int)x.Cantidad * (decimal)x.ESGR_Producto.Precio));
                        ticket.AgregarTotales("         TOTAL S/", Total);
                        ticket.TextoIzquierda("");
                        ticket.TextoIzquierda("Razon Social:");
                        ticket.lineasSubGuion();
                        ticket.lineasSubGuion();
                        ticket.TextoIzquierda("RUC:");
                        ticket.lineasSubGuion();
                        ticket.TextoIzquierda("Direccion:");
                        ticket.lineasSubGuion();
                        ticket.lineasSubGuion();
                        ticket.TextoIzquierda("");
                        ticket.TextoCentro("¡ GRACIAS POR SU PREFERENCIA !");
                        ticket.TextoIzquierda("ESTE NO ES UN COMPROBANTE FISCAL CANJEAR POR BOLETA O FACTURA");

                        if (SGRVariables.NotificacionPreCuenta != null && SGRVariables.NotificacionPreCuenta.Trim().Length != 0)
                        {
                            ticket.TextoIzquierda("");
                            ticket.lineasAsteriscos();
                            ticket.TextoIzquierda("");
                            ticket.TextoIzquierda(SGRVariables.NotificacionPreCuenta);
                            ticket.TextoIzquierda("");
                        }

                        ticket.ImprimirTicket(SGRVariables.ImpresoraCaja);

                        #endregion
                    }

                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, SGRMessageContent.ContentSaveOK, CmpButton.Aceptar, () => Volver(null));
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar);
                }
            });
        }
Beispiel #26
0
        private void LoadTipoDestino()
        {
            try
            {
                var varObjECMP_OrdenServicio = (ECMP_OrdenServicio)MyHeader.DataContext;
                var vrSelectTipoDestino      = (ECMP_ValueComboBox)cbxTipoDestino.SelectedItem;
                if (vrSelectTipoDestino == null)
                {
                    return;
                }

                if (vrSelectTipoDestino.Value == "CTDIS") //Cuenta por Distribuir General
                {
                    dtgColumnaTipoDestino.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    dtgColumnaTipoDestino.Header     = vrSelectTipoDestino.Item;
                    dtgColumnaTipoDestino.Visibility = System.Windows.Visibility.Visible;

                    var vrListECMP_ValueComboBox = new List <ECMP_ValueComboBox>();

                    string strOutMessageError = string.Empty;
                    CmpTask.Process(
                        () =>
                    {
                        try
                        {
                            if (vrSelectTipoDestino.Value == "CCOST") //Categoría Centro Costo (Listado Centro de Costo)
                            {
                                var vrListCentroCosto = new BMNF_CentroCosto().ListFiltrarCentroCosto(varObjECMP_OrdenServicio.ObjESGC_EmpresaSucursal);
                                foreach (var item in vrListCentroCosto)
                                {
                                    vrListECMP_ValueComboBox.Add(new ECMP_ValueComboBox()
                                    {
                                        Item = item.Descripcion, Value = item.IdCentroCosto.ToString()
                                    });
                                }
                            }
                            else if (vrSelectTipoDestino.Value == "SCOST") //Centro Costo (Listado Sub Centro de Costo)
                            {
                                var vrListCentroCosto = new BMNF_SubCentroCosto().ListGetSubCentroCosto(varObjECMP_OrdenServicio.ObjESGC_EmpresaSucursal);
                                foreach (var item in vrListCentroCosto)
                                {
                                    vrListECMP_ValueComboBox.Add(new ECMP_ValueComboBox()
                                    {
                                        Item = item.Descripcion, Value = item.IdSubCenCosto.ToString()
                                    });
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            strOutMessageError = ex.Message;
                        }
                    },
                        () =>
                    {
                        if (strOutMessageError.Length > 0)
                        {
                            CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenServicio, strOutMessageError, CmpButton.Aceptar);
                        }
                        else
                        {
                            var vrObjListECMP_OrdenServicioDetalle = (dgDetalleServicio.Items.OfType <ECMP_OrdenServicioDetalle>()).ToList();
                            foreach (var item in vrObjListECMP_OrdenServicioDetalle)
                            {
                                item.ListCentroCosto = vrListECMP_ValueComboBox;
                            }

                            dgDetalleServicio.Items.Refresh();
                        }
                    });
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #27
0
        /// <summary>
        /// Inicializa/desencripta los valores incriptados
        /// </summary>
        public async static void Load(Action ParameterTask = null)
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    var listaConfiguracion = new BSGR_Configuracion().GetCollectionConfiguracion();

                    //POLITICA DE SEGURIDAD
                    var objPoliticaSeguridad = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "POLITICASEGURIDAD");
                    if (objPoliticaSeguridad != null)
                    {
                        SGRVariables.ESGR_PoliticaSeguridad = JsonConvert.DeserializeObject <ESGR_PoliticaSeguridad>(objPoliticaSeguridad.Valor);
                    }

                    //IMPUESTOS
                    var vrObjESGC_Retencion = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "IGV");
                    if (vrObjESGC_Retencion != null)
                    {
                        SGRVariables.ESGR_Retencion.IGV = Convert.ToDecimal(vrObjESGC_Retencion.Valor);
                    }

                    //IMPRESORA PEDIDO
                    var vrImpresoraPedido = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "IMP");
                    if (vrImpresoraPedido != null)
                    {
                        SGRVariables.ImpresoraPedido = vrImpresoraPedido.Valor;
                    }

                    //IMPRESORA COPIA PEDIDO
                    var vrImpresoraCopiaPedido = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "IPC");
                    if (vrImpresoraCopiaPedido != null)
                    {
                        SGRVariables.ImpresoraCopiaPedido = vrImpresoraCopiaPedido.Valor;
                    }

                    //IMPRESORA CAJA
                    var vrImpresoraCaja = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "ICJ");
                    if (vrImpresoraCaja != null)
                    {
                        SGRVariables.ImpresoraCaja = vrImpresoraCaja.Valor;
                    }

                    //IMPRESORA CAJA
                    var vrNotificacion = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "NTF");
                    if (vrNotificacion != null)
                    {
                        SGRVariables.NotificacionPreCuenta = vrNotificacion.Valor;
                    }

                    //MESA FIJA
                    var vrMesaFija = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "MSA");
                    if (vrMesaFija != null)
                    {
                        SGRVariables.MesaFija = vrMesaFija.Valor == "SI";
                    }

                    //MESA PREDETERMINADA
                    var vrMesaPredeterminada = listaConfiguracion.FirstOrDefault(x => x.IdConfig == "MPD");
                    if (vrMesaPredeterminada != null)
                    {
                        SGRVariables.MesaPredeterminada = Convert.ToInt32(vrMesaPredeterminada.Valor);
                    }

                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        if (ParameterTask != null)
                        {
                            ParameterTask.Invoke();
                        }
                    });
                }
                catch (System.Exception ex)
                {
                    CmpMessageBox.Show(SGRMessage.TitleMessage, ex.Message, CmpButton.Aceptar);
                }
            });
        }
Beispiel #28
0
        public void btnAnularIsClicked()
        {
            if (!btnAnular.IsEnabled)
            {
                return;
            }

            MSGC_UpdatePrivilege.Process(this, "CMP", CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.GetAccesoRestringidoNull("Orden Servicio"), new Action <ESGC_PermisoPerfil>((P) =>
            {
                try
                {
                    if (P.Eliminar)
                    {
                        if (dtgOrdenServicio.SelectedItems.Count == 0)
                        {
                            CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenServicio, CMPMensajes.IsNullSelectItem, CmpButton.Aceptar);
                            return;
                        }

                        var vrObjECMP_OrdenServicio = new ECMP_OrdenServicio(dtgOrdenServicio.SelectedItem, TipoConstructor.Update);

                        CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.PreguntaContinuarProceso, CmpButton.AceptarCancelar, () =>
                        {
                            string strOutMessageError = string.Empty;
                            CmpMessageBox.Proccess(CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.ProcesandoDatos, () =>
                            {
                                try
                                {
                                    vrObjECMP_OrdenServicio.Opcion = "N";
                                    new BCMP_OrdenServicio().TransOrdenServicio(vrObjECMP_OrdenServicio);
                                }
                                catch (Exception ex)
                                {
                                    strOutMessageError = ex.Message;
                                }
                            },
                                                   () =>
                            {
                                if (strOutMessageError.Length > 0)
                                {
                                    CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, strOutMessageError, CmpButton.Aceptar);
                                }
                                else
                                {
                                    CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.DatoProcesados, CmpButton.Aceptar);
                                    LoadDetail();
                                }
                            });
                        });
                    }
                    else
                    {
                        CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, CMPMensajes.GetAccesoRestringidoEliminar("Orden Servicio"), CmpButton.Aceptar);
                    }
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, ex.Message, CmpButton.Aceptar);
                }
            }));
        }
Beispiel #29
0
        /// <summary>
        /// Carga datos del orden de compra
        /// </summary>
        private void LoadDetail()
        {
            dgDetalleServicio.Items.Clear();
            var vrListECMP_OrdenServicioDetalle = new List <ECMP_OrdenServicioDetalle>();
            var vrListPeriodoCapania            = new List <ECMP_ValueComboBox>();
            var varObjECMP_OrdenServicio        = (ECMP_OrdenServicio)MyHeader.DataContext;

            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    vrListECMP_OrdenServicioDetalle = new BCMP_OrdenServicioDetalle().ListAdministrarOrdenServicioDetalle(varObjECMP_OrdenServicio);

                    int Anio = Convert.ToInt32(varObjECMP_OrdenServicio.Periodo.Substring(0, varObjECMP_OrdenServicio.Periodo.Length - 2));
                    for (int i = Anio - 1; i <= Anio + 1; i++)
                    {
                        vrListPeriodoCapania.Add(new ECMP_ValueComboBox()
                        {
                            Item = i.ToString(), Value = i.ToString()
                        });
                    }
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAprobacionOrdenServicio, strOutMessageError, CmpButton.Aceptar);
                }
                else
                {
                    var ObjECMP_OrdenServicio = (ECMP_OrdenServicio)MyHeader.DataContext;
                    foreach (var item in vrListECMP_OrdenServicioDetalle)
                    {
                        item.ListPeriodoCampania = vrListPeriodoCapania;
                        if (varObjECMP_OrdenServicio.Exonerado == 12) //INCLUYE IGV
                        {
                            decimal dmlCalculoIGV = (item.PrecioUnitario * varObjECMP_OrdenServicio.IGV);
                            item.PrecioUnitario   = decimal.Round(dmlCalculoIGV + item.PrecioUnitario, 8);
                        }
                        LoadTipoDestino();
                        dgDetalleServicio.Items.Add(item);
                        CalcularTotalesItems(item);
                    }

                    txtGravada.Text    = ObjECMP_OrdenServicio.Gravada.ToString("###,###,##0.#0");
                    txtImporteIGV.Text = ObjECMP_OrdenServicio.ImporteIGV.ToString("###,###,##0.#0");

                    //factura
                    if (rbIncluidoIGV.IsChecked.Value)
                    {
                        //Calculo con incluir IGV
                        txtTotal.Text = decimal.Round((ObjECMP_OrdenServicio.Gravada + ObjECMP_OrdenServicio.ImporteIGV), 2).ToString("###,###,##0.#0");
                    }
                    else if (rbExonerado.IsChecked.Value)
                    {
                        //Calculo cuando es Honorario
                        txtTotal.Text = decimal.Round((ObjECMP_OrdenServicio.Gravada - ObjECMP_OrdenServicio.ImporteIGV), 2).ToString("###,###,##0.#0");
                    }
                    else if (chkAplicarRetencion.IsChecked.Value)
                    {
                        //Calculo cuando es Renta de segunda categoria
                        txtTotal.Text = decimal.Round((ObjECMP_OrdenServicio.Gravada - ObjECMP_OrdenServicio.ImporteIGV), 2).ToString("###,###,##0.#0");
                    }
                    else
                    {
                        //Calculo sin incluir IGV
                        txtTotal.Text = decimal.Round((ObjECMP_OrdenServicio.Gravada + ObjECMP_OrdenServicio.ImporteIGV), 2).ToString("###,###,##0.#0");
                    }
                }
            });
        }
Beispiel #30
0
        private void ImprimirOrdenServicio(ECMP_OrdenServicio ObjECMP_OrdenServicio, List <ECMP_OrdenServicioDetalle> ListECMP_OrdenServicioDetalle)
        {
            try
            {
                ListECMP_OrdenServicioDetalle.ForEach((f) =>
                {
                    if (f.ObjEMNF_Servicio.IdServicio != 0)
                    {
                        decimal dmlPrecioUnitario = 0;

                        if ((f.ObjEMNF_Servicio.ObjEMNF_OperacionIGV.CodOperacionIGV == "GB"))
                        {
                            if (ObjECMP_OrdenServicio.Exonerado == 12)
                            {
                                dmlPrecioUnitario = (f.PrecioUnitario) / ((decimal.Round(ObjECMP_OrdenServicio.IGV * 100, 2) + 100) / 100);
                            }
                            else
                            {
                                dmlPrecioUnitario = f.PrecioUnitario;
                            }
                        }
                        else
                        {
                            dmlPrecioUnitario = f.PrecioUnitario;
                        }
                        f.PrecioUnitario = dmlPrecioUnitario;
                        f.Importe        = f.PrecioUnitario * f.Cantidad;
                    }
                });

                string[] parametro;

                string direccion   = new BALM_Almacen().ListFiltrarAlmacen(ObjECMP_OrdenServicio.ObjESGC_EmpresaSucursal).FirstOrDefault().Direccion;
                var    textMostrar = ObjECMP_OrdenServicio.Exonerado;
                var    text        = ListECMP_OrdenServicioDetalle.FirstOrDefault().ObjEMNF_Servicio.ObjEMNF_OperacionIGV.CodOperacionIGV;
                string strIgvText  = ((ObjECMP_OrdenServicio.Retencion) ? "Retención " : "IGV ") + String.Format("{0:N2}", decimal.Round((ObjECMP_OrdenServicio.IGV * 100), 2)) + "%";
                string Monto       = string.Empty;
                if (ObjECMP_OrdenServicio.Retencion || ObjECMP_OrdenServicio.Exonerado == 21)
                {
                    Monto = decimal.Round(Convert.ToDecimal(ObjECMP_OrdenServicio.Gravada - ObjECMP_OrdenServicio.ImporteIGV), 2).ToString();
                }
                else
                {
                    Monto = decimal.Round(Convert.ToDecimal(ObjECMP_OrdenServicio.Gravada + ObjECMP_OrdenServicio.ImporteIGV), 2).ToString();
                }

                parametro = new string[]
                {
                    "prmRazonSocial|" + SGCVariables.ObjESGC_Usuario.ObjESGC_Empresa.RazonSocial,
                    "prmRuc|" + SGCVariables.ObjESGC_Usuario.ObjESGC_Empresa.Ruc,
                    "prmDireccionEmpresa|" + SGCVariables.ObjESGC_Usuario.ObjESGC_Empresa.DireccionFiscal,
                    "prmTelefonoEmpresa|" + SGCVariables.ObjESGC_Usuario.ObjESGC_Empresa.Telefono,
                    "prmFechaDocumento|" + ObjECMP_OrdenServicio.Fecha.ToShortDateString(),
                    "prmFechaLetra|" + DateTime.Now.ToLongDateString().Split(',').ElementAt(1),
                    "prmNumOrden|" + ObjECMP_OrdenServicio.Serie + " - " + ObjECMP_OrdenServicio.Numero,
                    "prmProveedor|" + ObjECMP_OrdenServicio.ObjEMNF_ClienteProveedor.RazonSocial,
                    "prmRucProveedor|" + ObjECMP_OrdenServicio.ObjEMNF_ClienteProveedor.NroDocIdentidad,
                    "prmDireccionProv|" + ObjECMP_OrdenServicio.ObjEMNF_ClienteProveedor.Direccion,
                    "prmCondicionPago|" + ObjECMP_OrdenServicio.ObjESGC_FormaPago.FormaPago,
                    "prmNetoLetra|" + NumLetras.Convertir(Monto, true, ObjECMP_OrdenServicio.ObjESGC_Moneda.Descripcion),
                    "prmTotal|" + ObjECMP_OrdenServicio.ObjESGC_Moneda.Simbolo + " " + string.Format("{0:N2}", decimal.Round(ObjECMP_OrdenServicio.Gravada, 2)),
                    "prmIgv|" + ObjECMP_OrdenServicio.ObjESGC_Moneda.Simbolo + " " + string.Format("{0:N2}", decimal.Round(ObjECMP_OrdenServicio.ImporteIGV, 2)),
                    "prmGravadaText|" + ((textMostrar == 21) ? "Total Honorario": (text == "GB") ? ((ObjECMP_OrdenServicio.Retencion) ? "Renta Bruta" : "Gravada") : "Exonerado"),
                    "prmIgvText|" + ((textMostrar == 21) ? ("Retención " + decimal.Round(ObjECMP_OrdenServicio.IGV * 100, 2) + "%"): strIgvText),
                    "prmNetoText|" + ((textMostrar == 21) ? "Total Neto " : ((textMostrar == 11 && ObjECMP_OrdenServicio.Retencion) ? "Renta Neta" : "Importe Total ")),
                    "prmNeto|" + ObjECMP_OrdenServicio.ObjESGC_Moneda.Simbolo + " " + string.Format("{0:N2}", Convert.ToDecimal(Monto)),
                    "prmSucursal|" + ObjECMP_OrdenServicio.ObjESGC_EmpresaSucursal.Sucursal,
                    "prmDireccionSucursal|" + direccion,
                    "prmFechaFin|" + ObjECMP_OrdenServicio.FechaFin.ToShortDateString(),
                    "prmMoneda|" + ObjECMP_OrdenServicio.ObjESGC_Moneda.Descripcion,
                    "prmCreadopor|" + ObjECMP_OrdenServicio.Creacion,
                    "prmAprobadopor|" + ObjECMP_OrdenServicio.Aprobacion,
                };
                MainRerport ObjMainRerport = new MainRerport();
                ObjMainRerport.InitializeMainRerport("CMP.Reports.Files.RptOrdenServicio.rdlc", "dtsOrdenServicioDetalle", ListECMP_OrdenServicioDetalle.ToList(), parametro);
                ObjMainRerport.ShowDialog();
            }
            catch (Exception ex)
            {
                CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenServicio, ex.Message, CmpButton.Aceptar);
            }
        }