示例#1
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var localSaved = Windows.Storage.ApplicationData.Current.LocalSettings;

            _language = localSaved.Values["Language"].ToString();
            if (_language == "nl")
            {
                UiDutch();
            }
            else
            {
                UiFrench();
            }
            if (localSaved.Values["TempControlReport"] == null)
            {
                return;
            }
            _controlReport      = JsonConvert.DeserializeObject <ControlReport>(localSaved.Values["TempControlReport"].ToString());
            _selectedLocation   = JsonConvert.DeserializeObject <Location>(localSaved.Values["Templocation"].ToString());
            _selectedMatis      = JsonConvert.DeserializeObject <Matis>(localSaved.Values["TempMatis"].ToString());
            txtName.Text        = _controlReport.user;
            txtHour.Text        = _controlReport.matisServiceTime.ToString();
            btnLocation.Content = _selectedLocation.name;
            btnMatis.Content    = _selectedMatis.name;
            btnMatis.IsEnabled  = true;
            btnStart.IsEnabled  = true;
        }
 public void DisplayReport(ControlReport report)
 {
     Master.ShowReportViewer();
     reportData.Visible     = true;
     DateViewedLiteral.Text = (report == null)?"":report.DateViewed.ToDateTimeString();
     AllClientsReportHelpMessage.Visible = false;
     ReportPanel.Display(report);
 }
        private void btnContinue_Click(object sender, RoutedEventArgs e)
        {
            var           localSave = ApplicationData.Current.LocalSettings;
            ControlReport report    = JsonConvert.DeserializeObject <ControlReport>(localSave.Values["TempControlReport"].ToString());

            report.endTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz");
            localSave.Values["TempControlReport"] = JsonConvert.SerializeObject(report);
            this.NavigationCacheMode = NavigationCacheMode.Disabled;
            this.Frame.Navigate(typeof(InspectionComplete), _answers);
        }
示例#4
0
        private async void btnStart_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                if (!string.IsNullOrEmpty(txtHour.Text))
                {
                    if (NetworkInterface.GetIsNetworkAvailable())
                    {
                        _controlReport = new ControlReport
                        {
                            languageId       = _language == "nl" ? 1 : 2,
                            locationId       = _selectedLocation.id,
                            matisId          = _selectedMatis.id,
                            matisServiceTime = int.Parse(txtHour.Text),
                            user             = txtName.Text,
                            controlAnswers   = new List <ControlAnswer>(),
                            startTime        = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz")
                        };
                        var tempSave = ApplicationData.Current.LocalSettings;
                        tempSave.Values["TempMatis"]         = JsonConvert.SerializeObject(_selectedMatis);
                        tempSave.Values["TempLocation"]      = JsonConvert.SerializeObject(_selectedLocation);
                        tempSave.Values["TempControlReport"] = JsonConvert.SerializeObject(_controlReport);
                        ControlQuestions questions = new ControlQuestions();
                        string           response  = await questions.GetControlQuestion(_selectedMatis.Category.name, _language);

                        if (response.Contains("data"))
                        {
                            List <ControlQuestion> controlQuestions =
                                JsonConvert.DeserializeObject <ControlQuestionWrapper>(response).data;
                            this.Frame.Navigate(typeof(QuestionPage), controlQuestions);
                        }
                        else
                        {
                            ErrorMessage();
                        }
                        //this.Frame.Navigate(typeof(QuestionPage), await questions.ControlQuestionList(_selectedMatis.Category.name, _language));
                    }
                    else
                    {
                        NoConnectionError();
                    }
                }
                else
                {
                    txtHour.BorderBrush = new SolidColorBrush(Colors.Red);
                    CheckStart(_language, lblHour.Text);
                }
                txtName.ClearValue(BorderBrushProperty);
            }
            else
            {
                txtName.BorderBrush = new SolidColorBrush(Colors.Red);
                CheckStart(_language, lblName.Text);
            }
        }
        public void Display(ControlReport report)
        {
            ViewState.Add("ControlReport", report);

            if (report != null)
            {
                DebtorsLedger debtorsLedger = report.DebtorsLedger;
                CurrentLiteral.Text            = debtorsLedger.Current.ToString("C");
                OneMonthLiteral.Text           = debtorsLedger.OneMonth.ToString("C");
                TwoMonthsLiteral.Text          = debtorsLedger.TwoMonths.ToString("C");
                ThreeMonthsLiteral.Text        = debtorsLedger.ThreeMonthsAndOver.ToString("C");
                TotalDebtorsLedgerLiteral.Text = debtorsLedger.Total.ToString("C");

                FactorsLedger factorsLedger        = report.FactorsLedger;
                Subledger     broughtForwardLedger = factorsLedger.BroughtForwardLedger;
                FundedInvoicesBroughtForwardLiteral.Text    = broughtForwardLedger.FundedInvoices.ToString("C");
                NonFundedInvoicesBroughtForwardLiteral.Text = broughtForwardLedger.NonFundedInvoices.ToString("C");
                CreditNotesBroughtForwardLiteral.Text       = broughtForwardLedger.CreditNotes.ToString("C");
                NetJournalsBroughtForwardLiteral.Text       = broughtForwardLedger.NetJournals.ToString("C");
                CashReceiveBroughtForwardLiteral.Text       = broughtForwardLedger.CashReceived.ToString("C");
                OverpaymentsBroughtForwardLiteral.Text      = broughtForwardLedger.Overpayments.ToString("C");
                NetAdjustmentBroughtForwardLiteral.Text     = broughtForwardLedger.NetAdjustment.ToString("C");
                DiscountsBroughtForwardLiteral.Text         = broughtForwardLedger.Discounts.ToString("C");
                TotalBroughtForwardLiteral.Text             = broughtForwardLedger.Total.ToString("C");

                Subledger currentLedger = factorsLedger.CurrentLedger;
                FundedInvoicesCurrentLiteral.Text    = currentLedger.FundedInvoices.ToString("C");
                NonFundedInvoicesCurrentLiteral.Text = currentLedger.NonFundedInvoices.ToString("C");
                CreditNotesCurrentLiteral.Text       = currentLedger.CreditNotes.ToString("C");
                NetJournalsCurrentLiteral.Text       = currentLedger.NetJournals.ToString("C");
                CashReceivedCurrentLiteral.Text      = currentLedger.CashReceived.ToString("C");
                OverpaymentsCurrentLiteral.Text      = currentLedger.Overpayments.ToString("C");
                NetAdjustmentCurrentLiteral.Text     = currentLedger.NetAdjustment.ToString("C");
                DiscountsCurrentLiteral.Text         = currentLedger.Discounts.ToString("C");
                TotalCurrentLiteral.Text             = currentLedger.Total.ToString("C");
                TotalFactorsLedgerLiteral.Text       = factorsLedger.Total.ToString("C");

                FundedInvoicesBalanceLiteral.Text    = report.FundedInvoicesBalance.ToString("C");
                NonFundedInvoicesBalanceLiteral.Text = report.NonFundedInvoicesBalance.ToString("C");
                FundedToBeRepurchasedLiteral.Text    = report.FundedToBeRepurchased.ToString("C");
                CreditsToBeClaimedLiteral.Text       = report.CreditsToBeClaimed.ToString("C");
                UnallocatedTransactionsLiteral.Text  = report.UnallocatedTransactions.ToString("C");
                RepurchasesThisMonthLiteral.Text     = report.RepurchasesThisMonth.ToString("C");
                AllocatedInPeriodLiteral.Text        = report.AllocatedThisPeriod.ToString("C");
                CBTSInPeriodLiteral.Text             = report.CbtsInPeriod.ToString("C");
            }
        }
示例#6
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.
 /// This parameter is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter != null)
     {
         _answers = (List <ControlAnswer>)e.Parameter;
         var localSave = ApplicationData.Current.LocalSettings;
         _language      = localSave.Values["Language"].ToString();
         _controlReport = JsonConvert.DeserializeObject <ControlReport>(localSave.Values["TempControlReport"].ToString());
         if (_language == "nl")
         {
             lblComplete.Text = "Controle is voltooid";
             btnSend.Content  = "Controle verzenden";
         }
         else
         {
             lblComplete.Text = "Contrôle terminé";
             btnSend.Content  = "Envoyez la contrôle";
         }
     }
     else
     {
         var previousControl = ApplicationData.Current.LocalSettings;
         _language      = previousControl.Values["Language"].ToString();
         _answers       = JsonConvert.DeserializeObject <List <ControlAnswer> >(previousControl.Values["PreviousAnswers"].ToString());
         _controlReport = JsonConvert.DeserializeObject <ControlReport>(previousControl.Values["PreviousReport"].ToString());
         if (_language == "nl")
         {
             lblComplete.Text = "Vorige Controle verzenden";
             btnSend.Content  = "Controle verzenden";
         }
         else
         {
             lblComplete.Text = "Envoyer la dernière contrôle";
             btnSend.Content  = "Envoyez la contrôle";
         }
     }
 }
        public override void Export()
        {
            ControlReport report = ViewState["ControlReport"] as ControlReport;

            if (report != null)
            {
                ExcelDocument document = new ExcelDocument(true);
                document.WriteTitle(report.Title);

                DebtorsLedger debtorsLedger = report.DebtorsLedger;
                document.FormatAsHeaderRow(3);
                document.AddHeaderCell("Debtors Ledger");
                document.MoveToNextRow();
                document.AddCell("Current:");
                document.AddCurrencyCell(debtorsLedger.Current);
                document.MoveToNextRow();
                document.AddCell("1 month:");
                document.AddCurrencyCell(debtorsLedger.OneMonth);
                document.MoveToNextRow();
                document.AddCell("2 months:");
                document.AddCurrencyCell(debtorsLedger.TwoMonths);
                document.MoveToNextRow();
                document.AddCell("3 months & over:");
                document.AddCurrencyCell(debtorsLedger.ThreeMonthsAndOver);
                document.MoveToNextRow();
                document.AddCell("Total Ledger:");
                document.AddCurrencyCell(debtorsLedger.Total, 2);
                document.MoveToNextRow();

                FactorsLedger factorsLedger = report.FactorsLedger;
                document.FormatAsHeaderRow(3);
                document.AddHeaderCell("Factors Ledger");
                document.MoveToNextRow();

                Subledger broughtForwardLedger = factorsLedger.BroughtForwardLedger;
                document.FormatAsSubheaderRow(3);
                document.AddHeaderCell("Brought Forward");
                document.MoveToNextRow();

                document.AddCell("Funded Invoices:");
                document.AddCurrencyCell(broughtForwardLedger.FundedInvoices);
                document.MoveToNextRow();
                document.AddCell("Non Funded Invoices:");
                document.AddCurrencyCell(broughtForwardLedger.NonFundedInvoices);
                document.MoveToNextRow();
                document.AddCell("Credit Notes:");
                document.AddCurrencyCell(broughtForwardLedger.CreditNotes);
                document.MoveToNextRow();
                document.AddCell("Net Journals:");
                document.AddCurrencyCell(broughtForwardLedger.NetJournals);
                document.MoveToNextRow();
                document.AddCell("Cash Received:");
                document.AddCurrencyCell(broughtForwardLedger.CashReceived);
                document.MoveToNextRow();
                document.AddCell("Overpayments:");
                document.AddCurrencyCell(broughtForwardLedger.Overpayments);
                document.MoveToNextRow();
                document.AddCell("Net Adjustment:");
                document.AddCurrencyCell(broughtForwardLedger.NetAdjustment);
                document.MoveToNextRow();
                document.AddCell("Discounts:");
                document.AddCurrencyCell(broughtForwardLedger.Discounts);
                document.MoveToNextRow();
                document.AddCell("Total Brought Foward:");
                document.AddCurrencyCell(broughtForwardLedger.Total, 2);
                document.MoveToNextRow();

                Subledger currentLedger = factorsLedger.CurrentLedger;
                document.FormatAsSubheaderRow(3);
                document.AddHeaderCell("Current");
                document.MoveToNextRow();

                document.AddCell("Funded Invoices:");
                document.AddCurrencyCell(currentLedger.FundedInvoices);
                document.MoveToNextRow();
                document.AddCell("Non Funded Invoices:");
                document.AddCurrencyCell(currentLedger.NonFundedInvoices);
                document.MoveToNextRow();
                document.AddCell("Credit Notes:");
                document.AddCurrencyCell(currentLedger.CreditNotes);
                document.MoveToNextRow();
                document.AddCell("Net Journals:");
                document.AddCurrencyCell(currentLedger.NetJournals);
                document.MoveToNextRow();
                document.AddCell("Cash Received:");
                document.AddCurrencyCell(currentLedger.CashReceived);
                document.MoveToNextRow();
                document.AddCell("Overpayments:");
                document.AddCurrencyCell(currentLedger.Overpayments);
                document.MoveToNextRow();
                document.AddCell("Net Adjustment:");
                document.AddCurrencyCell(currentLedger.NetAdjustment);
                document.MoveToNextRow();
                document.AddCell("Discounts:");
                document.AddCurrencyCell(currentLedger.Discounts);
                document.MoveToNextRow();

                document.FormatAsSubheaderRow(3);
                document.AddHeaderCell("Total Current:");
                document.AddCurrencyHeaderCellLedger(currentLedger.Total, 2, false);
                document.MoveToNextRow();

                document.FormatAsSubheaderRow(3);
                document.AddHeaderCell("Total Ledger:");
                document.AddCurrencyHeaderCellLedger(factorsLedger.Total, 2, true);

                document.InsertEmptyRow();

                document.AddCell("Balance of Funded Invoices:");
                document.AddCurrencyCell(report.FundedInvoicesBalance);
                document.MoveToNextRow();
                document.AddCell("Balance of Non Funded Invoices:");
                document.AddCurrencyCell(report.NonFundedInvoicesBalance);
                document.MoveToNextRow();
                document.AddCell("Unallocated Transactions:");
                document.AddCurrencyCell(report.UnallocatedTransactions);
                document.AddCurrencyCellLedger(report.FundedInvoicesBalance + report.NonFundedInvoicesBalance + report.UnallocatedTransactions, 2, true);
                document.MoveToNextRow();
                document.AddCell("Prepayments this Month:");
                document.AddCurrencyCell(report.RepurchasesThisMonth);
                document.MoveToNextRow();
                document.AddCell("Prepayments to be Claimed:");
                document.AddCurrencyCell(report.FundedToBeRepurchased);
                document.MoveToNextRow();
                document.AddCell("Credits to be Claimed:");
                document.AddCurrencyCell(report.CreditsToBeClaimed);
                document.MoveToNextRow();
                document.AddCell("Allocated in Period:");
                document.AddCurrencyCell(report.AllocatedThisPeriod);
                document.MoveToNextRow();
                document.AddCell("CBT's in Period:");
                document.AddCurrencyCell(report.CbtsInPeriod);
                document.MoveToNextRow();

                document.InsertEmptyRow();
                document.AddCell("Date Viewed");
                document.AddCell(report.DateViewed.ToDateTimeString());

                WriteToResponse(document.WriteToStream(), report.ExportFileName);
            }
        }
        public async Task <string> SendControlRapport(List <ControlAnswer> imageSendList, ControlReport report)
        {
            try
            {
                List <ControlAnswer> sendList = new List <ControlAnswer>();
                foreach (var controlAnswerImage in imageSendList)
                {
                    ControlAnswer sendAnswer = new ControlAnswer();
                    sendAnswer.controlQuestionId = controlAnswerImage.controlQuestionId;
                    sendAnswer.startTime         = controlAnswerImage.startTime;
                    sendAnswer.endTime           = controlAnswerImage.endTime;
                    sendAnswer.testOk            = controlAnswerImage.testOk;
                    sendAnswer.comment           = controlAnswerImage.comment;
                    if (controlAnswerImage.images != null)
                    {
                        sendAnswer.images = new List <ControlImage>();
                        foreach (ControlImage imgPath in controlAnswerImage.images)
                        {
                            var storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync(imgPath.fileName);

                            var buffer = await Windows.Storage.FileIO.ReadBufferAsync(storageFile);

                            var bufferArray = buffer.ToArray();
                            _client = new HttpClient();
                            MultipartFormDataContent form = new MultipartFormDataContent();
                            form.Add(new ByteArrayContent(bufferArray), "image", imgPath.fileName);
                            HttpResponseMessage response = await _client.PostAsync(_apiControlImage, form);

                            response.EnsureSuccessStatusCode();
                            _client.Dispose();
                            var          responsemessage = response.Content.ReadAsStringAsync().Result;
                            ControlImage img             = JsonConvert.DeserializeObject <ControlImageWrapper>(responsemessage).data;
                            sendAnswer.images.Add(img);
                        }
                    }
                    sendList.Add(sendAnswer);
                }
                report.controlAnswers = sendList;
                var sendReport = JsonConvert.SerializeObject(report, Formatting.None, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                using (_client = new HttpClient())
                {
                    HttpResponseMessage response = await _client.PostAsync(_apiControlReport, new StringContent(sendReport, Encoding.UTF8, "application/json"));

                    response.EnsureSuccessStatusCode();
                }
                return("Ok");
            }
            catch (Exception)
            {
                return("Nok");
            }
        }
示例#9
0
 public SaleReport()
 {
     InitializeComponent();
     this.cargar();
     rp = new ControlReport();
 }