예제 #1
0
        private void Process()
        {
            if (SelectedOrder != null && ValidateDate() && ConfirmDialog("Desea procesar el Pedido", "Confimar"))
            {
                //Guardar el pedido
                SpecialOrdersHelper.AddOrder(SelectedOrder);
                SaveChanges();

                var currentOrder = SelectedOrder;
                var param        = new Dictionary <string, string>();
                param.Add("@IdSpecialOrder", selectedOrder.IdSpecialOrder.ToString());
                var data = StoredCallbackProcessor.CallDataSet("SP_INV_PEDIDOS_ES", param);
                //var report = new ReportContainer("rptPedidosEspeciales.rpt", data);

                //report.Export(currentOrder.ReportFileName);

                ShowProcessLoader(this);
                AsyncHelper.DoAsync(() =>
                {
                    Sync(currentOrder);
                    RaisePropertyChanged("SpecialOrdersCollection");
                },
                                    ViewModelManager.CloseProcessLoader);
            }
            else
            {
                UndoChanges();
            }
        }
        private void CrystalReportsViewer1_OnLoaded(object sender, RoutedEventArgs e)
        {
            try
            {
                report = new ReportDocument();

                report.Load(reportName, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault);

                if (data == null)
                {
                    report.SetDataSource(StoredCallbackProcessor.CallDataSet(StoredProcedureName).Tables[0]);
                }

                else
                {
                    report.SetDataSource(data.Tables[0]);
                }
                crystalReportsViewer1.ViewerCore.ReuseParameterWhenRefresh = true;

                report.Refresh();

                crystalReportsViewer1.ViewerCore.ReportSource = report;
            }
            catch (Exception ex)
            {
                LoggerHelper.WriteLog(ex);
                MessageBox.Show(ViewModelManager.mainWindow, "Error Al cargar Reporte, verifique configuracion",
                                "Error ", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        public override void ViewReport()
        {
            var param = new Dictionary <string, string>();

            param.Add("@id", SelectedGoodsReceipt.IdGoodReceiptL.ToString());

            var data = StoredCallbackProcessor.CallDataSet("SP_INV_REP_AJUSTES_E", param);
            //var report = new ReportContainer("rptAjustedeInventarios.rpt", data);
            //ShowDialog (report,this);
        }
예제 #4
0
        public override void ViewReport()
        {
            var param = new Dictionary <string, string>();

            param.Add("@IdSpecialOrder", selectedOrder.IdSpecialOrder.ToString());

            var data = StoredCallbackProcessor.CallDataSet("SP_INV_PEDIDOS_ES", param);
            //var report = new ReportContainer("rptPedidosEspeciales.rpt", data);
            //ShowDialog(report, this);
        }
        public static ObservableCollection <NotificationItemMenu> GetNotifications()
        {
            var notifications = new List <NotificationItemMenu>();
            var endOfDay      = StoredCallbackProcessor.CallDataSet("SP_Notifications");

            if (endOfDay != null)
            {
                foreach (DataTable table in endOfDay.Tables)
                {
                    notifications.AddRange(from DataRow row in table.Rows select new NotificationItemMenu(row.ItemArray[0].ToString(), row.ItemArray[1].ToString(), new RelayCommand(() => { })));
                }
            }

            return(new ObservableCollection <NotificationItemMenu>(notifications));
        }
예제 #6
0
        private void BuildReport()
        {
            var mapping = ViewModelManager.ActionBarViewModel.ReportType;

            if (mapping == null)
            {
                return;
            }

            var parameters = GetParameters(mapping);

            var dataSet = StoredCallbackProcessor.CallDataSet(mapping.StoredProcedureName, parameters);
            //var report = new ReportContainer(mapping.ReportFileName, dataSet);

            //ViewModelManager.LoadReport(report);
        }
        public void Export(string filename)
        {
            try
            {
                var report = new ReportDocument();

                report.Load(reportName, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault);

                if (data == null)
                {
                    report.SetDataSource(StoredCallbackProcessor.CallDataSet(StoredProcedureName).Tables[0]);
                }

                else
                {
                    report.SetDataSource(data.Tables[0]);
                }
                // crystalReportsViewer1.ViewerCore.ReuseParameterWhenRefresh = true;

                report.Refresh();

                report.ExportToDisk(ExportFormatType.PortableDocFormat, System.IO.Path.Combine(Config.ReportPath, filename));
                //crystalReportsViewer1.ViewerCore.ReportSource = report;

                report.Database.Dispose();
                report.Close();
                report.Dispose();

                this.crystalReportsViewer1.ViewerCore.Dispose();
            }
            catch (Exception ex)
            {
                LoggerHelper.WriteLog(ex);
                MessageBox.Show(ViewModelManager.mainWindow, "Error Al cargar Reporte, verifique configuracion",
                                "Error ", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            finally
            {
                GC.Collect();
            }
        }
예제 #8
0
        public void RunEndOfDayAsync()
        {
            ProgressValue = 0;

            if (!WebApiClient.IsAvailableConnection)
            {
                BusyContent = "Error de Conneccion Intente nuevamente ..";
                return;
            }

            BusyContent           = "Ejectutando Validacion de Fin de Dia";
            IsLockedForEndOfDay   = IsRunningEndOfDay = true;
            EndOfDayNotifications = NotificationsManager.GetEndOfDayNotifications();
            IsRunningEndOfDay     = false;
            IsLoading             = true;
            if (EndOfDayNotifications.Any(n => n.NotificationName.ToLower() != "completo"))
            {
                var error = BusyContent = "Error Existen Validaciones Pendientes, Favor verificar";
                MessageBox.Show(error, "Fin de dia Error", MessageBoxButton.OK, MessageBoxImage.Error);
                IsLoading = IsLockedForEndOfDay = false;
                return;
            }

            BusyContent = "Sincronizando Productos Aloha...";
            StoredCallbackProcessor.StartAlohaSync(ignoreAsync: true);

            BusyContent = "Procesando Venta Pendiente...";
            var idVenta = (int)StoredCallbackProcessor.CallDataSet("SP_INV_VNT_PROCESAR").Tables[0].Rows[0].ItemArray.FirstOrDefault();

            if (idVenta <= 0)
            {
                MessageBox.Show("Error al procesar venta", "Fin de dia Error", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                IsLoading = IsLockedForEndOfDay = false;
            }
            else
            {
                var sale = SalesHelper.Get(idVenta);

                //Asiganado las formas de pago para la venta por ALOHA
                var pagos = SalesHelper.GetiInvoicePayments(sale);
                sale.paymentsAloha = pagos;

                if (sale != null)
                {
                    BusyContent = "Sincronizando Venta...";
                    Synchronization.Synchronize(sale);
                    if (sale.StateL == LocalStatus.Procesado)
                    {
                        var token = TransactionLogHelper.ConfirmationLog();
                        BusyContent = "Proceso completado con exito, Codigo de verificacion " + token;
                        MessageBox.Show(BusyContent, "Finalizado", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        BusyContent   = "Error al procesar venta, Verifique ..";
                        ProgressValue = 0;
                        MessageBox.Show(BusyContent, "Error Fin de Dia", MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                        IsLoading = IsLockedForEndOfDay = false;
                    }
                }
                else
                {
                    BusyContent   = "Error al procesar venta, Verifique ..";
                    ProgressValue = 0;
                    MessageBox.Show(BusyContent, "Error Fin de Dia", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    IsLoading = IsLockedForEndOfDay = false;
                }
            }
            IsLoading = IsLockedForEndOfDay = false;
        }