Ejemplo n.º 1
0
        async void performaDetails(string reservationID)
        {
            PerformaDetails result = await performaInformaion.performaInfo(reservationID);

            //advancedValues
            BindingContext = result;

            if (result != null)
            {
                if (result.advancedReceivedNegative != "" || result.advancedReceivedPositive != "")
                {
                    advancedValues.IsVisible = true;
                }
                else
                {
                    advancedValues.IsVisible = false;
                }
                performaItemDetails.ItemsSource = null;
                var res = performaInformaion.performaItemInformation();
                performaItemDetails.ItemsSource = res;

                PerformaItemDetails details = res.FirstOrDefault();
                if (details != null)
                {
                    roomTypeLabel.Text   = details.roomType;
                    mealPlanLabel.Text   = details.mealPlan;
                    occuLabel.Text       = details.occu;
                    nosLabel.Text        = details.nos;
                    roomNightsLabel.Text = details.roomNights;
                    rateLabel.Text       = details.rate;
                    currLabel.Text       = details.currency;
                }
            }
            PerformaIndicator.IsRunning = false;
            PerformaIndicator.IsVisible = false;
            PerformaLayout.IsVisible    = true;
        }
        public async Task <PerformaDetails> performaInfo(string reservationID)
        {
            try
            {
                result = await checkinManger.GetPerformaDetails(reservationID);

                if (result == null || result == "Error")
                {
                    MessagingCenter.Send <PerformaInformation, string>(this, Constants._proformaGeneratError, "");
                }
                else
                {
                    var output = JObject.Parse(result);
                    if (Enumerable.Count(output["d"]["results"]) > 0)
                    {
                        string advanceTextPositive = string.Empty, advanceTextNegative = string.Empty, advanceTextPositiveValue = string.Empty, advanceTextNegativeValue = string.Empty;
                        try
                        {
                            if (Enumerable.Count(output["d"]["results"][0]["advanceLinesSet"]["results"]) > 0)
                            {
                                advanceTextPositive      = Convert.ToString(output["d"]["results"][0]["advanceLinesSet"]["results"][0]["AdvText"]) + " :";
                                advanceTextPositiveValue = Convert.ToString(output["d"]["results"][0]["advanceLinesSet"]["results"][0]["AdvValue"]);
                                advanceTextNegative      = Convert.ToString(output["d"]["results"][0]["advanceLinesSet"]["results"][1]["AdvText"]) + " :";
                                advanceTextNegativeValue = Convert.ToString(output["d"]["results"][0]["advanceLinesSet"]["results"][1]["AdvValue"]);
                            }
                        }
                        catch (Exception)
                        {
                        }
                        string          value           = string.Format("{0:F2}", Convert.ToString(output["d"]["results"][0]["BdGrandTotal"]));
                        int             count           = Enumerable.Count(output["d"]["results"][0]["profomaLinesSet"]["results"]);
                        PerformaDetails PerformaDetails = new PerformaDetails(Convert.ToString(output["d"]["results"][0]["HdKunnr"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdCusName"]) + "\n" +
                                                                              Convert.ToString(output["d"]["results"][0]["HdCusStreet"]) + "\n" +
                                                                              Convert.ToString(output["d"]["results"][0]["HdCusCity"]) + " \n" +
                                                                              Convert.ToString(output["d"]["results"][0]["HdCusCountry"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdCusVatno"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdCusGuest"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdCusBookingparty"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdInvoice"]),
                                                                              FormatChanges.changedateformat(Convert.ToString(output["d"]["results"][0]["HdInvoiceDate"])),
                                                                              FormatChanges.changedateformat(Convert.ToString(output["d"]["results"][0]["HdArrivalDate"])),
                                                                              FormatChanges.changedateformat(Convert.ToString(output["d"]["results"][0]["HdDepartureDate"])),
                                                                              Convert.ToString(output["d"]["results"][0]["HdReservation"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdVoucher"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdResStatus"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdRooms"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdAdult"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdChild"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdChildf"]),
                                                                              Convert.ToString(output["d"]["results"][0]["HdGuide"]),
                                                                              serviceDataValidation.decimalTruncating(Convert.ToString(output["d"]["results"][0]["BdGrandTotal"])),
                                                                              serviceDataValidation.decimalTruncating(Convert.ToString(output["d"]["results"][0]["BdTotalExVat"])),
                                                                              serviceDataValidation.decimalTruncating(Convert.ToString(output["d"]["results"][0]["BdVat"])),
                                                                              serviceDataValidation.decimalTruncating(Convert.ToString(output["d"]["results"][0]["BdTotalDue"])),
                                                                              serviceDataValidation.decimalTruncating(Convert.ToString(output["d"]["results"][0]["BdBalanceDue"])),
                                                                              Convert.ToString(output["d"]["results"][0]["FtRoomList"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtGeneratedBy"]),
                                                                              serviceDataValidation.decimalTruncating(Convert.ToString(output["d"]["results"][0]["FtExRate"])),
                                                                              Convert.ToString(output["d"]["results"][0]["FtDescription1"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtAccHolder"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtBank"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtAccNum"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtSwiftCode"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtDescription2"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtDescription3"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtPrintedBy"]),
                                                                              Convert.ToString(output["d"]["results"][0]["FtExecDate"]),
                                                                              advanceTextPositive,
                                                                              advanceTextPositiveValue,
                                                                              advanceTextNegative,
                                                                              advanceTextNegativeValue
                                                                              );
                        performaDetails = PerformaDetails;
                    }
                }
            }

            catch (Exception e)
            {
                MessagingCenter.Send <PerformaInformation, string>(this, Constants._proformaGeneratError, result);
            }
            return(performaDetails);
        }