public void DisplayData()
        {
            OutputInvoiceDataLoading = true;

            OutputInvoiceListResponse response = new OutputInvoiceSQLiteRepository()
                                                 .GetOutputInvoicesByPage(MainWindow.CurrentCompanyId, OutputInvoiceSearchObject, currentPage, itemsPerPage);

            if (response.Success)
            {
                OutputInvoicesFromDB = new ObservableCollection <OutputInvoiceViewModel>(response.OutputInvoices ?? new List <OutputInvoiceViewModel>());
                totalItems           = response.TotalItems;
            }
            else
            {
                OutputInvoicesFromDB    = new ObservableCollection <OutputInvoiceViewModel>();
                totalItems              = 0;
                MainWindow.ErrorMessage = response.Message;
            }

            int itemFrom = totalItems != 0 ? (currentPage - 1) * itemsPerPage + 1 : 0;
            int itemTo   = currentPage * itemsPerPage < totalItems ? currentPage * itemsPerPage : totalItems;

            PaginationDisplay = itemFrom + " - " + itemTo + " od " + totalItems;

            OutputInvoiceDataLoading = false;
        }
Exemplo n.º 2
0
        private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            #region Validation

            if (CurrentOutputInvoice?.BusinessPartner == null)
            {
                MainWindow.WarningMessage = ((string)Application.Current.FindResource("Obavezno_polje_poslovni_partner"));
                return;
            }

            #endregion

            Thread td = new Thread(() => {
                SubmitButtonContent = ((string)Application.Current.FindResource("Čuvanje_u_tokuTriTacke"));
                SubmitButtonEnabled = false;

                CurrentOutputInvoice.IsSynced = false;
                CurrentOutputInvoice.Company  = new CompanyViewModel()
                {
                    Id = MainWindow.CurrentCompanyId
                };
                CurrentOutputInvoice.CreatedBy = new UserViewModel()
                {
                    Id = MainWindow.CurrentUserId
                };

                OutputInvoiceResponse response = new OutputInvoiceSQLiteRepository().Create(CurrentOutputInvoice);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Greška_kod_lokalnog_čuvanjaUzvičnik"));
                    SubmitButtonContent     = ((string)Application.Current.FindResource("Proknjiži"));
                    SubmitButtonEnabled     = true;
                }

                response = outputInvoiceService.Create(CurrentOutputInvoice);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Podaci_su_sačuvani_u_lokaluUzvičnikTačka_Greška_kod_čuvanja_na_serveruUzvičnik")) + response.Message;
                    SubmitButtonContent     = ((string)Application.Current.FindResource("Proknjiži"));
                    SubmitButtonEnabled     = true;
                }

                if (response.Success)
                {
                    MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Podaci_su_uspešno_sačuvaniUzvičnik"));
                    SubmitButtonContent       = ((string)Application.Current.FindResource("Proknjiži"));
                    SubmitButtonEnabled       = true;

                    new OutputInvoiceSQLiteRepository().Sync(outputInvoiceService);

                    OutputInvoiceCreatedUpdated();

                    Application.Current.Dispatcher.BeginInvoke(
                        System.Windows.Threading.DispatcherPriority.Normal,
                        new Action(() =>
                    {
                        FlyoutHelper.CloseFlyout(this);
                    })
                        );
                }
            });
            td.IsBackground = true;
            td.Start();
        }
Exemplo n.º 3
0
        public OutputInvoice_ReportWindow(OutputInvoiceViewModel outputInvoiceView)
        {
            InitializeComponent();
            rdlcOutputInvoiceReport.LocalReport.DataSources.Clear();

            List <OutputInvoicesReportViewModel> outputInvoice      = new List <OutputInvoicesReportViewModel>();
            List <OutputInvoiceViewModel>        OutputInvoiceItems = new OutputInvoiceSQLiteRepository().GetOutputInvoicesByPage(MainWindow.CurrentCompanyId, OutputInvoiceSearchObject, 1, 50).OutputInvoices;
            int counter = 1;

            foreach (var OutputInvoiceItem in OutputInvoiceItems)
            {
                outputInvoice.Add(new OutputInvoicesReportViewModel()
                {
                    OrderNumbersForOutputInvoices = counter++,
                    BusinessPartnerName           = OutputInvoiceItem?.BusinessPartner?.Name ?? "",
                    Supplier       = OutputInvoiceItem?.Supplier ?? "",
                    Address        = OutputInvoiceItem?.Address ?? "",
                    InvoiceNumber  = OutputInvoiceItem?.InvoiceNumber ?? "",
                    InvoiceDate    = OutputInvoiceItem?.InvoiceDate.ToString("dd.MM.yyyy") ?? "",
                    AmountNet      = OutputInvoiceItem?.AmountNet.ToString("#.00") ?? "",
                    PDVPercent     = OutputInvoiceItem?.PdvPercent.ToString("#.00") ?? "",
                    PDV            = OutputInvoiceItem?.Pdv.ToString() ?? "",
                    AmountGros     = OutputInvoiceItem?.AmountGross.ToString("#.00") ?? "",
                    Currency       = OutputInvoiceItem?.Currency.ToString("#.00") ?? "",
                    DateOfPaymetse = OutputInvoiceItem?.DateOfPayment.ToString("dd.MM.yyyy") ?? "",
                    Statuse        = OutputInvoiceItem?.Status.ToString() ?? "",
                    StatusDate     = OutputInvoiceItem?.StatusDate.ToString("dd.MM.yyyy") ?? ""
                });
            }
            var rpdsModel = new ReportDataSource()
            {
                Name  = "DataSet1",
                Value = outputInvoice
            };

            rdlcOutputInvoiceReport.LocalReport.DataSources.Add(rpdsModel);

            //List<ReportParameter> reportParams = new List<ReportParameter>();
            //string parameterText = "Dana " + (CurrentOutputInvoice?.InvoiceDate.ToString("dd.MM.yyyy") ?? "") + " na stočni depo klanice Bioesen primljeno je:";
            //reportParams.Add(new ReportParameter("txtOutputInvoiceDate", parameterText));


            //var businessPartnerList = new List<InvoiceBusinessPartnerViewModel>();
            //businessPartnerList.Add(new InvoiceBusinessPartnerViewModel() { Name = "Pera peric " });
            //var businessPartnerModel = new ReportDataSource() { Name = "DataSet2", Value = businessPartnerList };
            //rdlcOutputNoteReport.LocalReport.DataSources.Add(businessPartnerModel);

            //////string exeFolder = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())));
            //////string ContentStart = System.IO.Path.Combine(exeFolder, @"SirmiumERPGFC\RdlcReports\OutputInvoices\OutputInvoicesReport.rdlc");

            //////rdlcOutputInvoiceReport.LocalReport.ReportPath = ContentStart;
            ///

            string exeFolder    = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            string ContentStart = System.IO.Path.Combine(exeFolder, @"RdlcReports\OutputInvoices\OutputInvoicesReport.rdlc");

            rdlcOutputInvoiceReport.LocalReport.ReportPath = ContentStart;
            // rdlcOutputInvoiceReport.LocalReport.SetParameters(reportParams);
            rdlcOutputInvoiceReport.SetDisplayMode(DisplayMode.PrintLayout);
            rdlcOutputInvoiceReport.Refresh();
            rdlcOutputInvoiceReport.ZoomMode    = ZoomMode.Percent;
            rdlcOutputInvoiceReport.ZoomPercent = 100;
            rdlcOutputInvoiceReport.RefreshReport();
        }