Esempio n. 1
0
        public void LoadInfos()
        {
            stkDesconto.IsVisible = false;

            lblTaxsTitle.Text = AppResource.lblTaxs + "(" + _checkin.Company.TaxPercentage + "%)";
            lblTipTitle.Text  = AppResource.lblTips + "(" + _checkin.TipPercentage + "%)";

            if (_checkin.CheckinStatus != Enums.CheckinStatus.Checkout && _checkin.CheckinStatus != Enums.CheckinStatus.RequestedCheckout)
            {
                btnRequestCheckout.IsVisible = true;

                total = _checkin.TotalSpent;

                if (_sub != null && (_sub.CheckinSubStatus == Enums.CheckinSubStatus.RequestedCheckout || _sub.CheckinSubStatus == Enums.CheckinSubStatus.Checkout))
                {
                    lblTipTitle.Text = AppResource.lblTips + "(" + _sub.TipPercentage + "%)";
                }

                var tip = _checkin.GetTip(null, null, null, _sub);
                var tax = _checkin.GetTax(null, null, null, _sub);
                lblTip.Text      = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", tip);
                lblDesconto.Text = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", _checkin.PriceDiscount);
                lblTax.Text      = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", tax);


                lblSubTotal.Text = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", _checkin.TotalSpent);

                lblTotal.Text = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", _checkin.TotalPaid);
                //20190219 mudei pq a linha debaixo n parece fazer sentido
                //decimal totalToBePaid = total - _checkin.TotalPaid;
                decimal totalToBePaid = _checkin.TotalToBePaid;

                lblTotalBePaid.Text = String.Format(App.AppCurrent.CompanyCulture, "{0:C}", totalToBePaid);

                //exibe o adicionar gorjeta
                if (_checkin.CheckinStatus == Enums.CheckinStatus.Checkin)
                {
                    lblTapToAlter.IsVisible = true;
                }


                if (string.IsNullOrEmpty(_checkin.Occupation) && _company.CompanyType == Enums.CompanyType.Hotel && totalToBePaid < 0)
                {
                    stkPayNow.IsVisible       = false;
                    stkBtuttonOrder.IsVisible = false;
                    //btnPayNow.IsVisible = false;
                    //btnPayNowCard.IsVisible = false;//20190412
                    lblPaymentOption.IsVisible = false;

                    if (_sub == null)
                    {
                        btnRequestCheckout.IsVisible = true;
                    }
                    else
                    {
                        btnRequestCheckout.IsVisible = false;
                    }


                    btnRequestCheckout.Text = AppResource.textCloseBill;
                }
                else
                {
                    //20190403
                    if (_company.CompanyType != CompanyType.Hotel)
                    {
                        //stkPayNow.IsVisible = true;
                        //btnPayNow.IsVisible = true;
                        //btnPayNowCard.IsVisible = true;
                        //lblPaymentOption.IsVisible = true;
                    }
                    else
                    {
                        stkPayNow.IsVisible = true;
                        //btnPayNow.IsVisible = true;
                        //btnPayNowCard.IsVisible = true; //20190412
                        lblPaymentOption.IsVisible = true;
                    }

                    stkBtuttonOrder.IsVisible = true;
                    stkWarning.IsVisible      = false;
                    lblLocation.IsVisible     = false;
                    lblLocation.Text          = "";
                }
            }
            else
            {
                LoadPricesIfCheckout();
                btnRequestCheckout.IsVisible = false;
            }
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();

            listView.ItemsSource = _checkin.Orders;

            if (_checkin.CheckinStatus != Enums.CheckinStatus.Checkout)
            {
                var subTotal      = _checkin.GetSubTotal();
                var tip           = _checkin.GetTip();
                var tax           = _checkin.GetTax();
                var tipPercentage = _checkin.GetTipPercentage(tip, subTotal);
                var taxPercentage = _checkin.GetTaxPercentage(tax, subTotal);

                lblTaxsTitle.Text = AppResource.lblTaxs + "(" + taxPercentage + "%)";
                lblTipTitle.Text  = AppResource.lblTips + "(" + tipPercentage + "%)";
                lblDesconto.Text  = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PriceDiscount);
                lblTotal.Text     = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.TotalPaid);
                lblTax.Text       = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", tax);
                lblTip.Text       = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", tip);
            }
            else
            {
                //20180904
                lblTaxsTitle.Text = AppResource.lblTaxs + "(" + _checkin.TaxPercentage.ToString("#.##") + "%)";
                lblTipTitle.Text  = AppResource.lblTips + "(" + _checkin.TipPercentage.ToString("#.##") + "%)";
                lblDesconto.Text  = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PriceDiscount);
                lblTotal.Text     = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.TotalPaid);
                lblTax.Text       = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PriceTaxPaid);
                lblTip.Text       = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PriceTipPaid);
            }

            if (_checkin.Company.HasLocation)
            {
                lblSubTotal.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.TotalSpent);
            }
            else
            {
                lblSubTotal.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.SubTotal);
            }



            lblCashValue.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PaidInCash);
            lblCardValue.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PaidInCard);


            //total = 0;
            //foreach (var item in _checkin.Orders.Where(m => m.OrderStatus != Enums.OrderStatus.Canceled))
            //{
            //    total = total + item.TotalPrice;
            //}

            //lblSubTotal.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.SubTotal);


            //lblTaxsTitle.Text = AppResource.lblTaxs + "(" + _checkin.Company.TaxPercentage + "%)";
            //lblTipTitle.Text = AppResource.lblTips + "(" + _checkin.TipPercentage + "%)";


            ////var totalWithTip = total * _checkin.TipPercentage / 100;
            //decimal totalWithTip = 0;
            ////totalWithTip = _checkin.PriceTipPaid != 0 ? _checkin.PriceTipPaid : total * _checkin.Company.RecommendedTipPercentage / 100;
            //if (_checkin.PriceTipPaid != 0)
            //{
            //    totalWithTip = _checkin.PriceTipPaid;
            //}
            //else if (_checkin.Company.RecommendedTipPercentage != 0)
            //{
            //    totalWithTip = total * _checkin.Company.RecommendedTipPercentage / 100;
            //}
            //lblTip.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", totalWithTip);

            //lblDesconto.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PriceDiscount);

            //var totalWithTax = total * _checkin.Company.TaxPercentage / 100;
            //lblTax.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", totalWithTax);
            //subTotal = total + totalWithTax;


            //var newTotal = (total + totalWithTax + totalWithTip) - _checkin.PriceDiscount;
            //total = newTotal;


            //lblTotal.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", newTotal);
            //lblCashValue.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PaidInCash);
            //lblCardValue.Text = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", _checkin.PaidInCard);
        }