Exemplo n.º 1
0
        private void LoadHeader()
        {
            string strOutMessageError = string.Empty;
            string strPeriodoActual   = 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());
            },
                (e) =>
            {
                if (e != null)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleMessage, strOutMessageError, CmpButton.Aceptar);
                    return;
                }
                else
                {
                    ListESGC_Moneda.Add(new ESGC_Moneda()
                    {
                        CodMoneda = "%", Descripcion = "TODOS"
                    });
                    ListEMNF_Periodo.ToList().ForEach(x => ListPeriodoCmpPeriodo.Add(x.Periodo));
                    SelectPeriodo           = ListEMNF_Periodo.LastOrDefault(x => x.Periodo == strPeriodoActual);
                    SelectOpcion            = ListOpciones.LastOrDefault();
                    SelectMoneda            = ListESGC_Moneda.LastOrDefault();
                    SelectPeriodoCmpPeriodo = strPeriodoActual;
                }
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Carga datos Orden Compra
        /// </summary>
        /// <param name="Filtro">Datos para filtrar</param>
        public void LoadDetail(string Filtro = "%")
        {
            var      vrListECMP_Compra = new List <ECMP_Compra>();
            DateTime FechaDesde        = (dtpFechaDesde.SelectedDate != null) ? dtpFechaDesde.SelectedDate.Value : DateTime.Now;
            DateTime FechaHasta        = (dtpFechaHasta.SelectedDate != null) ? dtpFechaHasta.SelectedDate.Value : DateTime.Now;

            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    vrListECMP_Compra = new BCMP_Compra().ListCompra(((strOpcion == string.Empty) ? "F" : strOpcion), FechaDesde, FechaHasta, "%", Filtro);
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminCompra, strOutMessageError, CmpButton.Aceptar);
                }
                else
                {
                    dtgCompra.ItemsSource = vrListECMP_Compra;
                    lblCountItems.Text    = vrListECMP_Compra.Count + " Registros";
                }
            });
        }
Exemplo n.º 3
0
        private void cbxCategoria_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ObjEMNF_ArticuloCategoria = (EMNF_ArticuloCategoria)cbxCategoria.SelectedItem;
            if (ObjEMNF_ArticuloCategoria == null)
            {
                dtgListaPrecio.Columns.Clear();
                return;
            }
            var    vrListEMNF_SubCategoria = new List <EMNF_ArticuloSubCategoria>();
            string strOutMessageError      = string.Empty;

            CmpTask.ProcessAsync(() =>
            {
                vrListEMNF_SubCategoria = new BMNF_ArticuloSubCategoria().ListAdministrarSubCategoria(ObjEMNF_ArticuloCategoria);
                vrListEMNF_SubCategoria.Add(new EMNF_ArticuloSubCategoria()
                {
                    IdSubCategoria = 0,
                    SubCategoria   = "TODOS"
                });
            },
                                 (ex) =>
            {
                if (ex != null)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminListadoPrecio, ex.Message, CmpButton.Aceptar);
                    return;
                }
                else
                {
                    cbxSubCategoria.ItemsSource  = vrListEMNF_SubCategoria;
                    cbxSubCategoria.SelectedItem = vrListEMNF_SubCategoria.FirstOrDefault(x => x.IdSubCategoria == 0);
                }
            });
        }
Exemplo n.º 4
0
        private void GetData()
        {
            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    if (SelectOpcionFiltro == null)
                    {
                        return;
                    }
                    ObjECMP_NotaCreditoDebito.FechaInicio = SelectFechaInicio;
                    ObjECMP_NotaCreditoDebito.FechaHasta  = SelectFechaFin;
                    ObjECMP_NotaCreditoDebito.Filtro      = (Filtro == null || Filtro == string.Empty)?"%":Filtro;
                    ListaNotaCreditoDebito = new BCMP_NotaCreditoDebito().GETNotaCreditoDebito(SelectOpcionFiltro.Item, ObjECMP_NotaCreditoDebito);
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminNotaCreditoDebito, strOutMessageError, CmpButton.Aceptar);
                }
            });
        }
Exemplo n.º 5
0
        private void LoadDetail()
        {
            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    ObjECMP_ReporteGastosInternos.ObjEMNF_ClienteProveedor = (ObjECMP_ReporteGastosInternos.ObjEMNF_ClienteProveedor == null) ? new EMNF_ClienteProveedor() : ObjECMP_ReporteGastosInternos.ObjEMNF_ClienteProveedor;
                    ObjECMP_ReporteGastosInternos.ObjESGC_Moneda           = (ObjECMP_ReporteGastosInternos.ObjESGC_Moneda == null) ? new ESGC_Moneda()
                    {
                        CodMoneda = "%"
                    } : ObjECMP_ReporteGastosInternos.ObjESGC_Moneda;
                    ObjECMP_ReporteGastosInternos.Opcion = (ObjECMP_ReporteGastosInternos.Opcion == null) ? string.Empty : ObjECMP_ReporteGastosInternos.Opcion;
                    ListECMP_ReporteGastosInternos       = new ObservableCollection <ECMP_ReporteGastosInternos>(new BCMP_ReporteGastosInternos().ListReporteReciboGastosInternos(ObjECMP_ReporteGastosInternos));
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleMessage, strOutMessageError, CmpButton.Aceptar);
                }
            });
        }
Exemplo n.º 6
0
        private void LoadAlmacen()
        {
            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    ListEALM_Almacen = new ObservableCollection <EALM_Almacen>(new BALM_Almacen().ListFiltrarAlmacen(SelectUsuarioEmpresaSucursal.ObjESGC_EmpresaSucursal));
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleMessage, strOutMessageError, CmpButton.Aceptar);
                }
                else
                {
                    ListEALM_Almacen.Add(new EALM_Almacen()
                    {
                        Almacen = "TODOS", IdAlmacen = 0
                    });
                    SelectAlmacen = ListEALM_Almacen.FirstOrDefault(x => x.IdAlmacen == 0);
                }
            });
        }
Exemplo n.º 7
0
        public void LoadHeader()
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                var vrListEMNF_Categoria     = new List <EMNF_ArticuloCategoria>();
                var vrListEMNF_ArticuloMarca = new List <EMNF_ArticuloMarca>();
                CmpTask.ProcessAsync(() =>
                {
                    int IdClase = 0;
                    string strOutMessageError = string.Empty;
                    vrListEMNF_Categoria      = new BMNF_ArticuloCategoria().LisFiltrarCategoria(IdClase);
                    vrListEMNF_ArticuloMarca  = new BMNF_ArticuloMarca().ListFiltrarMarca();
                },
                                     (e) =>
                {
                    if (e != null)
                    {
                        CmpMessageBox.Show(CMPMensajes.TitleAdminListadoPrecio, e.Message, CmpButton.Aceptar);
                        return;
                    }
                    vrListEMNF_Categoria.Add(new EMNF_ArticuloCategoria()
                    {
                        IdCategoria = 0,
                        Categoria   = "TODOS"
                    });
                    vrListEMNF_ArticuloMarca.Add(new EMNF_ArticuloMarca()
                    {
                        IdMarca = 0,
                        Marca   = "TODOS"
                    });

                    cbxCategoria.ItemsSource  = vrListEMNF_Categoria;
                    cbxCategoria.SelectedItem = vrListEMNF_Categoria.First(x => x.IdCategoria == 0);
                    cbxMarca.ItemsSource      = vrListEMNF_ArticuloMarca;
                    cbxMarca.SelectedItem     = vrListEMNF_ArticuloMarca.First(x => x.IdMarca == 0);
                    if (dtpPeriodoFin.SelectedDate == null)
                    {
                        dtpPeriodoFin.SelectedDate = DateTime.Now;
                    }
                    if (FechaHasta == new DateTime())
                    {
                        FechaHasta = DateTime.Now;
                    }
                    if (dtpPeriodoInicio.SelectedDate == null)
                    {
                        dtpPeriodoInicio.SelectedDate = DateTime.Now;
                    }
                    if (FechaDesde == new DateTime())
                    {
                        FechaDesde = DateTime.Now;
                    }
                });
            });
        }
Exemplo n.º 8
0
 private void LoadHeader()
 {
     CmpTask.Process(() =>
     {
         ListECMP_OpcionFiltrados = GetOpciones();
     },
                     () =>
     {
         SelectOpcionFiltro = ListECMP_OpcionFiltrados.FirstOrDefault();
     });
 }
Exemplo n.º 9
0
        /// <summary>
        /// Carga datos del orden de compra
        /// </summary>
        private void LoadDetail()
        {
            dgDetalleArticulo.Items.Clear();
            var vrListECompraDetalle   = new List <ECMP_OrdenCompraDetalle>();
            var varObjECMP_OrdenCompra = (ECMP_OrdenCompra)MyHeader.DataContext;

            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    vrListECompraDetalle = new BCMP_OrdenCompraDetalle().ListAdministrarOrdenCompraDetalle(varObjECMP_OrdenCompra);
                    vrListECompraDetalle.ForEach(x => x.IsEnableEstado = true);
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAprobacionOrdenCompra, strOutMessageError, CmpButton.Aceptar);
                }
                else
                {
                    var ObjECMP_OrdenCompra = (ECMP_OrdenCompra)MyHeader.DataContext;

                    foreach (var item in vrListECompraDetalle)
                    {
                        if (item.ObjEMNF_Articulo.ObjEMNF_OperacionIGV.CodOperacionIGV == "GB")
                        {
                            if (chkPrecioIncluidoIGV.IsChecked.Value || ObjECMP_OrdenCompra.IncluyeIGV)
                            {
                                //pRECIO INCLUIDO IGV
                                decimal dmlCalculoIGV = item.PrecioUnitario * ObjECMP_OrdenCompra.IGV;
                                item.PrecioUnitario   = decimal.Round(dmlCalculoIGV + item.PrecioUnitario, 8);
                            }
                        }

                        dgDetalleArticulo.Items.Add(item);
                        CalcularTotalesItems(item);
                    }

                    lblExonerado.Text = decimal.Round(ObjECMP_OrdenCompra.Exonerada, 2).ToString("###,###,##0.#0");
                    lblGravada.Text   = decimal.Round(ObjECMP_OrdenCompra.Gravada, 2).ToString("###,###,##0.#0");
                    lblTotalIgv.Text  = decimal.Round(ObjECMP_OrdenCompra.ImporteIGV, 2).ToString("###,###,##0.#0");
                    lblTotalNeto.Text = decimal.Round((ObjECMP_OrdenCompra.Exonerada + ObjECMP_OrdenCompra.Gravada + ObjECMP_OrdenCompra.ImporteIGV), 2).ToString("###,###,##0.#0");
                }
            });
        }
Exemplo n.º 10
0
        /// <summary>
        /// Carga datos Orden Compra
        /// </summary>
        /// <param name="Filtro">Datos para filtrar</param>
        public void LoadDetail(string Filtro = "%")
        {
            var vrListECMP_OrdenCompra = new List <ECMP_OrdenCompra>();

            string strOutMessageError = string.Empty;

            //Actualiza parametros de filtro
            if (cbxOpcion.SelectedIndex == 0)
            {
                ObjECMP_OrdenCompra.Fecha        = (dtpFechaDesde.SelectedDate != null) ? dtpFechaDesde.SelectedDate.Value : DateTime.Now;
                ObjECMP_OrdenCompra.FechaEntrega = (dtpFechaHasta.SelectedDate != null) ? dtpFechaHasta.SelectedDate.Value : DateTime.Now;
            }

            CmpTask.Process(
                () =>
            {
                try
                {
                    vrListECMP_OrdenCompra = new BCMP_OrdenCompra().ListOrdenCompra(ObjECMP_OrdenCompra, Filtro);
                    foreach (var item in vrListECMP_OrdenCompra)
                    {
                        if (item.ObjESGC_Estado.CodEstado == "APCOC")
                        {
                            var fechahoy     = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                            var FechaEntrega = Convert.ToDateTime(item.FechaEntrega.ToShortDateString());
                            TimeSpan ts      = fechahoy - FechaEntrega;
                            item.DiasRetraso = Convert.ToInt32(ts.TotalDays);
                        }
                    }
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenCompra, strOutMessageError, CmpButton.Aceptar);
                }
                else
                {
                    dtgOrdenCompra.ItemsSource = vrListECMP_OrdenCompra;
                    lblCountItems.Text         = vrListECMP_OrdenCompra.Count + " Registros";
                }
            });
        }
Exemplo n.º 11
0
 private void txtIdProveedor_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if ((Keyboard.Modifiers == ModifierKeys.Control) && (e.Key == Key.B))
     {
         string strFiltro = txtIdProveedor.Text;
         //if (strFiltro.Trim().Length == 0)
         //    strFiltro = "%";
         string strOutMessageError = string.Empty;
         CmpTask.ProcessAsync(
             () =>
         {
             ListEMNF_ClienteProveedor = new BMNF_ClienteProveedor().ListFiltrarClienteProveedor(strFiltro);
         },
             (ex) =>
         {
             if (ex != null)
             {
                 CmpMessageBox.Show(CMPMensajes.TitleAdminListadoPrecio, ex.Message, CmpButton.Aceptar);
                 return;
             }
             else
             {
                 if (ListEMNF_ClienteProveedor.Count == 1)
                 {
                     ObjEMNF_ClienteProveedor = ListEMNF_ClienteProveedor.FirstOrDefault();
                     txtIdProveedor.Text      = ObjEMNF_ClienteProveedor.RazonSocial;
                     CmpLoading.LoadDetail();
                 }
                 else
                 {
                     this.FlyoutIsOpen("PMNF_BuscarClienteProveedor", ((value) =>
                     {
                         if (value is PMNF_BuscarClienteProveedor)
                         {
                             var MyPMNF_BuscarClienteProveedor = (PMNF_BuscarClienteProveedor)value;
                             MyPMNF_BuscarClienteProveedor.InitializePMNF_BuscarClienteProveedor();
                             MyPMNF_BuscarClienteProveedor.SetValueFilter = strFiltro;
                             MyPMNF_BuscarClienteProveedor.SetListEMNF_ClienteProveedor = ListEMNF_ClienteProveedor;
                             MyPMNF_BuscarClienteProveedor.LoadDatil();
                             MyPMNF_BuscarClienteProveedor.IsOpen = true;
                         }
                     }));
                 }
             }
         });
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Carga datos de orden compra
        /// </summary>
        /// <param name="Filtro">Datos a filtrar</param>
        public void LoadDetail(string Filtro = "%")
        {
            var vrListECMP_OrdenCompra = new List <ECMP_OrdenCompra>();

            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    if (!IsFiltrado)
                    {
                        IsFiltrado = true;
                    }
                    else
                    {
                        vrListECMP_OrdenCompra = new BCMP_OrdenCompra().ListOrdenCompra(ObjECMP_OrdenCompra, Filtro).Where(x => x.Provisionado == 0 && (x.ObjESGC_Estado.CodEstado == "APCOC" || x.ObjESGC_Estado.CodEstado == "ATCOC")).ToList();
                    }
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                try
                {
                    if (strOutMessageError.Length > 0)
                    {
                        CmpMessageBox.Show(CMPMensajes.TitleConsulOrdenCompra, strOutMessageError, CmpButton.Aceptar);
                    }
                    else
                    {
                        dtgOrdenCompra.ItemsSource = vrListECMP_OrdenCompra;
                        lblCountItems.Text         = vrListECMP_OrdenCompra.Count + " Registros";
                    }
                }
                catch (Exception)
                {
                }
            });
        }
Exemplo n.º 13
0
 private void LoadHeader()
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         string strOutMessageError = string.Empty;
         CmpTask.ProcessAsync(
             () =>
         {
             ListEMNF_ArticuloClase          = new ObservableCollection <EMNF_ArticuloClase>(new BMNF_ArticuloClase().ListFiltrarArticuloClase("%"));
             ListEMNF_ArticuloMarca          = new ObservableCollection <EMNF_ArticuloMarca>(new BMNF_ArticuloMarca().ListFiltrarMarca("%"));
             ListESGC_UsuarioEmpresaSucursal = new ObservableCollection <ESGC_UsuarioEmpresaSucursal>(new BSGC_UsuarioEmpresaSucursal().ListFiltrarUsuarioEmpresaSucursal(SGCVariables.ObjESGC_Usuario));
         },
             (e) =>
         {
             if (e != null)
             {
                 CmpMessageBox.Show(CMPMensajes.TitleMessage, e.Message, CmpButton.Aceptar);
                 return;
             }
             else
             {
                 ListEMNF_ArticuloClase.Add(new EMNF_ArticuloClase()
                 {
                     Clase = "TODOS", IdArtClase = 0
                 });
                 ListEMNF_ArticuloMarca.Add(new EMNF_ArticuloMarca()
                 {
                     Marca = "TODOS", IdMarca = 0
                 });
                 ListESGC_UsuarioEmpresaSucursal.Add(new ESGC_UsuarioEmpresaSucursal()
                 {
                     ObjESGC_EmpresaSucursal = new ESGC_EmpresaSucursal()
                     {
                         Sucursal      = "TODOS",
                         IdEmpSucursal = 0
                     }
                 });
                 SelectArticuloClase          = ListEMNF_ArticuloClase.FirstOrDefault(x => x.IdArtClase == 0);
                 SelectArticuloMarca          = ListEMNF_ArticuloMarca.FirstOrDefault(x => x.IdMarca == 0);
                 SelectUsuarioEmpresaSucursal = ListESGC_UsuarioEmpresaSucursal.FirstOrDefault(x => x.ObjESGC_EmpresaSucursal.IdEmpSucursal == 0);
             }
         });
     });
 }
Exemplo n.º 14
0
 public void LoadDetail()
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         CmpTask.ProcessAsync(
             () =>
         {
             ListECMP_CuentasPorPagar = new BCMP_CuentasPorPagar().ListCuentasPorPagar(ObjEMNF_ClienteProveedor.IdCliProveedor, ((IsCheckedPorFecha) ? 1 : 0), FechaInicio, FechaFin);
         },
             (e) =>
         {
             if (e != null)
             {
                 CmpMessageBox.Show(CMPMensajes.TitleAdminCuentaPorPagar, e.Message, CmpButton.Aceptar);
                 return;
             }
         });
     });
 }
Exemplo n.º 15
0
        /// <summary>
        /// Carga datos Orden Compra
        /// </summary>
        /// <param name="Filtro">Datos para filtrar</param>
        public void LoadDetail(string Filtro = "%")
        {
            var vrListECMP_OrdenServicio = new List <ECMP_OrdenServicio>();

            string strOutMessageError = string.Empty;

            CmpTask.Process(
                () =>
            {
                try
                {
                    vrListECMP_OrdenServicio = new BCMP_OrdenServicio().ListFiltrarOrdenServicio(ObjECMP_OrdenServicio, Filtro);
                    foreach (var item in vrListECMP_OrdenServicio)
                    {
                        if (item.ObjESGC_Estado.CodEstado == "APCOS")
                        {
                            var fechahoy     = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                            var FechaFin     = Convert.ToDateTime(item.FechaFin.ToShortDateString());
                            TimeSpan ts      = fechahoy - FechaFin;
                            item.DiasRetraso = Convert.ToInt32(ts.TotalDays);
                        }
                    }
                }
                catch (Exception ex)
                {
                    strOutMessageError = ex.Message;
                }
            },
                () =>
            {
                if (strOutMessageError.Length > 0)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleAdminOrdenServicio, strOutMessageError, CmpButton.Aceptar);
                }
                else
                {
                    dtgOrdenServicio.ItemsSource = vrListECMP_OrdenServicio;
                    lblCountItems.Text           = vrListECMP_OrdenServicio.Count + " Registros";
                }
            });
        }
Exemplo n.º 16
0
        private void LoadDetail()
        {
            string strOutMessageError = string.Empty;

            CmpTask.ProcessAsync(
                () =>
            {
                if (ObjECMP_ReporteGrlHonorario.ObjEMNF_ClienteProveedor.RazonSocial.Trim().Length == 0)
                {
                    ObjECMP_ReporteGrlHonorario.ObjEMNF_ClienteProveedor.IdCliProveedor = 0;
                }
                ListECMP_ReporteGrlHonorario = new ObservableCollection <ECMP_ReporteGrlHonorario>(new BCMP_ReporteGrlHonorario().ListReporteGrlHonorario(ObjECMP_ReporteGrlHonorario));
            },
                (e) =>
            {
                if (e != null)
                {
                    CmpMessageBox.Show(CMPMensajes.TitleMessage, e.Message, CmpButton.Aceptar);
                    return;
                }
            });
        }
Exemplo n.º 17
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;
                }
            });
        }
Exemplo n.º 18
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;
             }
         });
     });
 }
Exemplo n.º 19
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");
                    }
                }
            });
        }
Exemplo n.º 20
0
        public void LoadDetail()
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                var Listado = new List <string>();
                string strOutMessageError = string.Empty;
                CmpTask.ProcessAsync(() =>
                {
                    IdCategoria    = (ObjEMNF_ArticuloCategoria != null) ? Convert.ToString(ObjEMNF_ArticuloCategoria.IdCategoria) : string.Empty;
                    IdSubCategoria = (ObjEMNF_ArticuloSubCategoria != null) ? Convert.ToString(ObjEMNF_ArticuloSubCategoria.IdSubCategoria) : string.Empty;
                    IdMarca        = (ObjEMNF_ArticuloMarca != null) ? Convert.ToString(ObjEMNF_ArticuloMarca.IdMarca) : string.Empty;
                    IdArticulo     = (ObjEMNF_Articulo != null) ? Convert.ToString(ObjEMNF_Articulo.IdArticulo) : "0";
                    IdProveedor    = (ObjEMNF_ClienteProveedor != null) ? Convert.ToString(ObjEMNF_ClienteProveedor.IdCliProveedor) : "0";
                    Listado        = new BCMP_TempArticuloListaPrecio().ListArticuloListaPercio(IdCategoria, IdSubCategoria, IdMarca, IdArticulo, IdProveedor, FechaDesde.ToString("yyyyMM"), FechaHasta.ToString("yyyyMM"));
                },
                                     (e) =>
                {
                    if (e != null)
                    {
                        CmpMessageBox.Show(CMPMensajes.TitleAdminListadoPrecio, e.Message, CmpButton.Aceptar);
                        return;
                    }
                    if (Listado == null)
                    {
                        dtgListaPrecio.Columns.Clear();
                        return;
                    }

                    dtgListaPrecio.Columns.Clear();

                    var vrObjStringColumn    = Listado.FirstOrDefault();
                    string[] arrayNamaColumn = vrObjStringColumn.Split("/".ToCharArray());
                    arrayNamaColumn          = arrayNamaColumn.Where(x => x != "").ToArray();
                    int Index = 0;
                    foreach (var name in arrayNamaColumn)
                    {
                        FrameworkElementFactory TextFActory = new FrameworkElementFactory(typeof(TextBlock));
                        DataTemplate dataTemp             = new DataTemplate();
                        DataGridTemplateColumn tempColumn = new DataGridTemplateColumn();
                        tempColumn.Header = name;
                        Binding bing      = new Binding("[" + Index + "]");
                        bing.Mode         = BindingMode.TwoWay;
                        TextFActory.SetBinding(TextBlock.TextProperty, bing);

                        if (Index > 8)
                        {
                            if (TextFActory.Type.Equals(typeof(TextBlock)))
                            {
                                TextFActory.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Right);
                            }
                            tempColumn.MinWidth = 100;
                            tempColumn.Width    = new DataGridLength(1, DataGridLengthUnitType.Star);
                        }

                        dataTemp.VisualTree     = TextFActory;
                        tempColumn.CellTemplate = dataTemp;
                        tempColumn.IsReadOnly   = true;
                        dtgListaPrecio.Columns.Add(tempColumn);

                        Index++;
                    }
                    dtgListaPrecio.Columns[0].MinWidth = 75;
                    dtgListaPrecio.Columns[1].MinWidth = 200;
                    dtgListaPrecio.Columns[1].MinWidth = 300;
                    dtgListaPrecio.Columns[2].MinWidth = 90;
                    dtgListaPrecio.Columns[3].MinWidth = 120;
                    dtgListaPrecio.Columns[4].MinWidth = 120;
                    dtgListaPrecio.Columns[5].MinWidth = 120;
                    dtgListaPrecio.Columns[6].MinWidth = 90;
                    dtgListaPrecio.Columns[7].MinWidth = 300;
                    dtgListaPrecio.Columns[7].Header   = "Proveedor";
                    dtgListaPrecio.Columns[8].MinWidth = 70;
                    //Agrega Valor

                    Listado.RemoveAt(0);
                    List <object> rows = new List <object>();
                    foreach (var value in Listado)
                    {
                        string[] arrayValueRow = value.Split(",".ToCharArray());
                        rows.Add(arrayValueRow);
                    }

                    dtgListaPrecio.ItemsSource = rows;
                    lblCountItems.Text         = dtgListaPrecio.Items.Count + " Registros";
                });
            });
        }
Exemplo n.º 21
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)
            {
            }
        }
Exemplo n.º 22
0
 private void txtAriculo_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if ((Keyboard.Modifiers == ModifierKeys.Control) && (e.Key == Key.B))
     {
         string strFiltro = txtAriculo.Text;
         if (strFiltro.Trim().Length == 0)
         {
             strFiltro = "%";
         }
         string strOutMessageError = string.Empty;
         CmpTask.ProcessAsync(
             () =>
         {
             ObjEMNF_Articulo = new EMNF_Articulo()
             {
                 ObjEMNF_ArticuloClase = new EMNF_ArticuloClase()
                 {
                     IdArtClase = 0
                 },
                 ObjEMNF_ArticuloMarca = new EMNF_ArticuloMarca()
                 {
                     IdMarca = 0
                 },
                 ObjEMNF_ArticuloSubCategoria = new EMNF_ArticuloSubCategoria()
                 {
                     IdSubCategoria = 0
                 },
             };
             ObjEMNF_ArticuloCategoria = new EMNF_ArticuloCategoria();
             ListEMNF_Articulo         = new BMNF_Articulo().ListGetArticulos(ObjEMNF_Articulo, ObjEMNF_ArticuloCategoria, strFiltro);
         },
             (ex) =>
         {
             if (ex != null)
             {
                 CmpMessageBox.Show(CMPMensajes.TitleAdminListadoPrecio, ex.Message, CmpButton.Aceptar);
                 return;
             }
             else
             {
                 if (ListEMNF_Articulo.Count == 1)
                 {
                     ObjEMNF_Articulo = ListEMNF_Articulo.FirstOrDefault();
                     txtAriculo.Text  = ObjEMNF_Articulo.Articulo;
                     CmpLoading.LoadDetail();
                 }
                 else
                 {
                     this.FlyoutIsOpen("PMNF_BuscarArticulos", ((value) =>
                     {
                         if (value is PMNF_BuscarArticulos)
                         {
                             var FlyoutsPMNF_BuscarArticulos = (PMNF_BuscarArticulos)value;
                             FlyoutsPMNF_BuscarArticulos.InitializePMNF_BuscarArticulos();
                             FlyoutsPMNF_BuscarArticulos.LoadHeader();
                             FlyoutsPMNF_BuscarArticulos.SetValueFilter = txtAriculo.Text;
                             FlyoutsPMNF_BuscarArticulos.IsOpen = true;
                         }
                     }));
                 }
             }
         });
     }
 }