/// <summary>
        /// Sets the information.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="flight">The flight.</param>
        public void SetInformation(InterJetTicket ticket, InterJetFlight flight)
        {
            this.TotalPrice = flight.TotalPayed;
            string impuestos = string.Empty;

            if (CurrentUserControl.PassangerType == InterJetPassangerType.Adult)
            {
                SetAdultIcon();
                decimal basePrice  = flight.PriceDetail.Adult.BasePrice;
                decimal ivaTotal   = flight.PriceDetail.Adult.IVA;
                decimal tuaTotal   = flight.PriceDetail.Adult.TUA;
                decimal extraTaxes = flight.PriceDetail.Adult.TotalExtraTaxes; // TODO: total de impuestos en caso de sea internacionale
                decimal discount   = flight.PriceDetail.Adult.Discount;
                decimal totalPrice = flight.PriceDetail.Adult.Total;
                this.TotalPrice = totalPrice;

                if (ListTaxesInterjet.roud && InterJetPreviousPrincingHandler.Conexion)
                {
                    cont = ListTaxesInterjet.BasePriceList.Count / 2;
                    ListTaxesInterjet.mit = cont / 2;
                    decimal a = ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning] + ListTaxesInterjet.TaxesList[ListTaxesInterjet.turningTaxes] - ListTaxesInterjet.DiscountList[ListTaxesInterjet.turning];
                    this.TotalPrice = a;
                    this.SetFare(ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning], ListTaxesInterjet.IVA[ListTaxesInterjet.turning], ListTaxesInterjet.TUA[ListTaxesInterjet.turning], ListTaxesInterjet.Extras[ListTaxesInterjet.turning], a, ListTaxesInterjet.DiscountList[ListTaxesInterjet.turning], 0, 0, flight.IsInternational);
                    if (ListTaxesInterjet.turning < ListTaxesInterjet.BasePriceList.Count)
                    {
                        ListTaxesInterjet.turning = ListTaxesInterjet.turning + 1;
                    }

                    if (ListTaxesInterjet.turning > ListTaxesInterjet.mit - 1 && ListTaxesInterjet.Fligth == 1)
                    {
                        ListTaxesInterjet.turning = 0;
                    }
                    if (ListTaxesInterjet.turning > cont - 1 && ListTaxesInterjet.Fligth == 2)
                    {
                        ListTaxesInterjet.turning = ListTaxesInterjet.mit;
                    }

                    impuestos = impuestos + ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning] + ListTaxesInterjet.IVA[ListTaxesInterjet.turning] + ListTaxesInterjet.TUA[ListTaxesInterjet.turning] + ListTaxesInterjet.Extras[ListTaxesInterjet.turning];
                }
                else
                {
                    //Quitar
                    impuestos = basePrice.ToString("#.00") + " " + ivaTotal.ToString("#.00") + " " + tuaTotal.ToString("#.00") + " " + discount.ToString("#.00") + " " + extraTaxes.ToString("#.00");

                    this.SetFare(basePrice, ivaTotal, tuaTotal, extraTaxes, totalPrice, discount, 0, 0, flight.IsInternational);
                }
            }

            if (CurrentUserControl.PassangerType == InterJetPassangerType.Child)
            {
                SetChildIcon();
                decimal basePrice  = flight.PriceDetail.Child.BasePrice;
                decimal ivaTotal   = flight.PriceDetail.Child.IVA;
                decimal tuaTotal   = flight.PriceDetail.Child.TUA;
                decimal extraTaxes = flight.PriceDetail.Child.TotalExtraTaxes; // TODO: total de impuestos en caso de sea internacionale

                decimal discount   = flight.PriceDetail.Child.Discount;
                decimal totalPrice = flight.PriceDetail.Child.Total;
                this.TotalPrice = totalPrice;

                if (ListTaxesInterjet.roud && InterJetPreviousPrincingHandler.Conexion)
                {
                    cont = ListTaxesInterjet.BasePriceList.Count / 2;
                    ListTaxesInterjet.mit = cont / 2;
                    decimal a = ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning] + ListTaxesInterjet.TaxesList[ListTaxesInterjet.turningTaxes] - ListTaxesInterjet.DiscountList[ListTaxesInterjet.turning];
                    this.TotalPrice = a;
                    this.SetFare(ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning], ListTaxesInterjet.IVA[ListTaxesInterjet.turning], ListTaxesInterjet.TUA[ListTaxesInterjet.turning], ListTaxesInterjet.Extras[ListTaxesInterjet.turning], a, ListTaxesInterjet.DiscountList[ListTaxesInterjet.turning], 0, 0, flight.IsInternational);

                    //ListTaxesInterjet.turningTaxes++;

                    if (ListTaxesInterjet.turning < ListTaxesInterjet.BasePriceList.Count)
                    {
                        ListTaxesInterjet.turning = ListTaxesInterjet.turning + 1;
                    }

                    if (ListTaxesInterjet.turning > ListTaxesInterjet.mit - 1 && ListTaxesInterjet.Fligth == 1)
                    {
                        ListTaxesInterjet.turning = 0;
                    }
                    if (ListTaxesInterjet.turning > cont - 1 && ListTaxesInterjet.Fligth == 2)
                    {
                        ListTaxesInterjet.turning = ListTaxesInterjet.mit;
                    }

                    impuestos = impuestos + ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning] + ListTaxesInterjet.IVA[ListTaxesInterjet.turning] + ListTaxesInterjet.TUA[ListTaxesInterjet.turning] + ListTaxesInterjet.Extras[ListTaxesInterjet.turning];
                }
                else
                {
                    impuestos = impuestos + " " + basePrice.ToString("#.00") + " " + ivaTotal.ToString("#.00") + " " + tuaTotal.ToString("#.00") + " " + discount.ToString("#.00") + " " + extraTaxes.ToString("#.00");

                    this.SetFare(basePrice, ivaTotal, tuaTotal, extraTaxes, totalPrice, discount, 0, 0, flight.IsInternational);
                }
            }

            if (CurrentUserControl.PassangerType == InterJetPassangerType.Senior)
            {
                SetAdultIcon();
                decimal basePrice  = flight.PriceDetail.Senior.BasePrice;
                decimal ivaTotal   = flight.PriceDetail.Senior.IVA;
                decimal tuaTotal   = flight.PriceDetail.Senior.TUA;
                decimal extraTaxes = flight.PriceDetail.Senior.TotalExtraTaxes; // TODO: total de impuestos en caso de sea internacionale

                decimal discount   = flight.PriceDetail.Senior.Discount;
                decimal totalPrice = flight.PriceDetail.Senior.Total;
                this.TotalPrice = totalPrice;

                if (ListTaxesInterjet.roud && InterJetPreviousPrincingHandler.Conexion)
                {
                    cont = ListTaxesInterjet.BasePriceList.Count / 2;
                    ListTaxesInterjet.mit = cont / 2;

                    decimal a = ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning] + ListTaxesInterjet.TaxesList[ListTaxesInterjet.turningTaxes] - ListTaxesInterjet.DiscountList[ListTaxesInterjet.turning];
                    this.TotalPrice = a;
                    this.SetFare(ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning], ListTaxesInterjet.IVA[ListTaxesInterjet.turning], ListTaxesInterjet.TUA[ListTaxesInterjet.turning], ListTaxesInterjet.Extras[ListTaxesInterjet.turning], a, ListTaxesInterjet.DiscountList[ListTaxesInterjet.turning], 0, 0, flight.IsInternational);

                    if (ListTaxesInterjet.turning < ListTaxesInterjet.BasePriceList.Count)
                    {
                        ListTaxesInterjet.turning = ListTaxesInterjet.turning + 1;
                    }

                    if (ListTaxesInterjet.turning > ListTaxesInterjet.mit - 1 && ListTaxesInterjet.Fligth == 1)
                    {
                        ListTaxesInterjet.turning = 0;
                    }
                    if (ListTaxesInterjet.turning > cont - 1 && ListTaxesInterjet.Fligth == 2)
                    {
                        ListTaxesInterjet.turning = ListTaxesInterjet.mit;
                    }

                    impuestos = impuestos + ListTaxesInterjet.BasePriceList[ListTaxesInterjet.turning] + ListTaxesInterjet.IVA[ListTaxesInterjet.turning] + ListTaxesInterjet.TUA[ListTaxesInterjet.turning] + ListTaxesInterjet.Extras[ListTaxesInterjet.turning];
                }
                else
                {
                    impuestos = impuestos + " " + basePrice.ToString("#.00") + " " + ivaTotal.ToString("#.00") + " " + tuaTotal.ToString("#.00") + " " + discount.ToString("#.00") + " " + extraTaxes.ToString("#.00");
                    this.SetFare(basePrice, ivaTotal, tuaTotal, extraTaxes, totalPrice, discount, 0, 0, flight.IsInternational);
                }
            }

            //if (CurrentUserControl.PassangerType == InterJetPassangerType.Infant)
            //{
            //    this.SetFare(PriceTotalResponseInterjet.totalPriceInfant, 0, 0, 0, PriceTotalResponseInterjet.totalPriceInfant, 0, 0, 0, flight.IsInternational);

            //}

            //Quitar
            ImpuestosBajoCosto.ImpuestosMostrados = impuestos + " ";
            ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, string.Empty, ImpuestosBajoCosto.ImpuestosMostrados, string.Empty, string.Empty);
        }
Exemple #2
0
 /// <summary>
 /// Sets the information.
 /// </summary>
 /// <param name="ticket">The ticket.</param>
 /// <param name="flight">The flight.</param>
 public void SetInformation(InterJetTicket ticket, InterJetFlight flight)
 {
     this.SetDestinationsAndTime(flight);
     this.SetPassangerTaxVisibility(ticket, flight);
 }
 /// <summary>
 /// Loads the infant passanger control.
 /// </summary>
 /// <param name="flight">The flight.</param>
 private void LoadInfantPassangerControl(InterJetFlight flight)
 {
     LoadControls(flight, InterJetPassangerType.Infant, flight.PreviousPrincig.Infant);
 }
 /// <summary>
 /// Loads the child passanger control.
 /// </summary>
 /// <param name="flight">The flight.</param>
 private void LoadChildPassangerControl(InterJetFlight flight)
 {
     LoadControls(flight, InterJetPassangerType.Child, flight.PreviousPrincig.Child);
 }
 /// <summary>
 /// Loads the senior passanger control.
 /// </summary>
 /// <param name="flight">The flight.</param>
 private void LoadSeniorPassangerControl(InterJetFlight flight)
 {
     LoadControls(flight, InterJetPassangerType.Senior, flight.PreviousPrincig.Senior);
 }
 /// <summary>
 /// Loads the adult passanger control.
 /// </summary>
 /// <param name="flight">The flight.</param>
 private void LoadAdultPassangerControl(InterJetFlight flight)
 {
     LoadControls(flight, InterJetPassangerType.Adult, flight.PreviousPrincig.Adult);
 }
Exemple #7
0
        /// <summary>
        /// Gets the sabre command.
        /// </summary>
        /// <param name="flights">The flights.</param>
        /// <returns></returns>
        private string[] GetSabreCommand(List <InterJetFlight> flights)
        {
            var commands = new List <string>();
            //quitar
            string comando = string.Empty;

            if (flights.Count > 0)
            {
                string         currentFlightID = flights.FirstOrDefault().ID;
                InterJetFlight theFlight       = flights.FirstOrDefault();

                if (this.Ticket.Passangers.HasAdults)
                {
                    int infante = 1;

                    var adultCountingLine = new
                    {
                        TotalBasePriceSum = (flights.Sum(flight => flight.PriceDetail.Adult.BasePrice - flight.PriceDetail.Adult.Discount) / Ticket.Passangers.TotalAdults) * 100,
                        TotalTuaSum       = (flights.Sum(flight => flight.PriceDetail.Adult.TUA) / Ticket.Passangers.TotalAdults) * 100,
                        TotalIVASuma      = (flights.Sum(flight => flight.PriceDetail.Adult.IVA) / Ticket.Passangers.TotalAdults) * 100,
                        TotalExtraSum     = (flights.Sum(flight => flight.PriceDetail.Adult.TotalExtraTaxes) / Ticket.Passangers.TotalAdults) * 100
                    };
                    foreach (InterJetAdultPassanger pax in this.Ticket.Passangers.GetAdultsPassangers())
                    {
                        if (this.Ticket.PaymentForm.StartsWith("CCA3"))
                        {
                            this.Ticket.PaymentForm = this.Ticket.PaymentForm.Replace("CCA3", "CCAX");
                        }

                        //boleto = LogTicketsBL.LogTicketsInterjet("7916309061"); //solo para pruebas
                        boleto = LogTicketsBL.LogTicketsInterjet(pax.UniqueID + currentFlightID[1]);
                        if (!string.IsNullOrEmpty(boleto.TicketNumber))
                        {
                            NewTicketInterjet(boleto.TicketNumber);
                        }
                        else
                        {
                            boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                        }

                        LogTicketsBL.LogTicketsInterjetInsert(boleto.TicketNumber, DateTime.Now, Ticket.RecordLocator, string.Empty);
                        string command = string.Format("AC/4o/{0}/P01/{1}/{2}/d{3}/D{7}/ONE/{4} {5}/1/{6}",
                                                       boleto.TicketNumber,
                                                       decimal.Truncate(adultCountingLine.TotalBasePriceSum),
                                                       decimal.Truncate(adultCountingLine.TotalTuaSum),
                                                       decimal.Truncate(adultCountingLine.TotalIVASuma),
                                                       this.Ticket.PaymentForm,
                                                       pax.AccountLineParameter,
                                                       theFlight.IsInternational ? "F" : "D",
                                                       decimal.Truncate(adultCountingLine.TotalExtraSum));

                        if (ListTaxesInterjet.Conexion)
                        {
                            string quality = string.Format("5.</C80-{0}*{1}/>",
                                                           boleto.TicketNumber,
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.DepartureStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.ArrivalStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[1]).Information.ArrivalStation);

                            InterjetQualityControleEighty.c80.Add(quality);
                        }

                        string commandt = command.Trim();
                        commands.Add("" + commandt + "");

                        if (this.Ticket.Passangers.GetInfants().Count > 0 && infante <= this.Ticket.Passangers.GetInfants().Count &&
                            PriceTotalResponseInterjet.totalPriceInfant > 0)
                        {
                            string command2 = string.Format("AC/4o/{0}/P01/{1}/{2}/d{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-4o/P-SAL",
                                                            "88" + boleto.TicketNumber.Substring(2, 8),
                                                            decimal.Truncate(PriceTotalResponseInterjet.totalPriceInfant * 100),
                                                            decimal.Truncate(0),
                                                            decimal.Truncate(0),
                                                            this.Ticket.PaymentForm,
                                                            pax.AccountLineParameter,
                                                            theFlight.IsInternational ? "F" : "D",
                                                            decimal.Truncate(0));

                            string commandt2 = command2.Trim();
                            commands.Add("" + commandt2 + "");
                            infante++;
                        }


                        //quitar
                        comando = comando + commandt;
                        decimal C11 = adultCountingLine.TotalBasePriceSum + adultCountingLine.TotalIVASuma + adultCountingLine.TotalTuaSum + adultCountingLine.TotalExtraSum;
                        amountC11[cont] = amountC11[cont] + C11;
                        amountC16[cont] = amountC16[cont] + adultCountingLine.TotalBasePriceSum;
                        cont++;
                    }
                }

                if (this.Ticket.Passangers.HasChildren)
                {
                    var childCountingLine = new
                    {
                        TotalBasePriceSum = (flights.Sum(flight => flight.PriceDetail.Child.BasePrice - flight.PriceDetail.Child.Discount) / Ticket.Passangers.TotalChildren) * 100,
                        TotalTuaSum       = (flights.Sum(flight => flight.PriceDetail.Child.TUA) / Ticket.Passangers.TotalChildren) * 100,
                        TotalIVASuma      = (flights.Sum(flight => flight.PriceDetail.Child.IVA) / Ticket.Passangers.TotalChildren) * 100,
                        TotalExtraSum     = (flights.Sum(flight => flight.PriceDetail.Child.TotalExtraTaxes) / Ticket.Passangers.TotalChildren) * 100
                    };

                    foreach (InterJetChildPassanger pax in this.Ticket.Passangers.GetChildrenPassangers())
                    {
                        if (this.Ticket.PaymentForm.StartsWith("CCA3"))
                        {
                            this.Ticket.PaymentForm = this.Ticket.PaymentForm.Replace("CCA3", "CCAX");
                        }

                        boleto = LogTicketsBL.LogTicketsInterjet(pax.UniqueID + currentFlightID[1]);
                        if (!string.IsNullOrEmpty(boleto.TicketNumber))
                        {
                            NewTicketInterjet(boleto.TicketNumber);
                        }
                        else
                        {
                            boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                        }

                        LogTicketsBL.LogTicketsInterjetInsert(boleto.TicketNumber, DateTime.Now, Ticket.RecordLocator, string.Empty);

                        string command = string.Format(InterJetAddAccountingLineCommand.ACCOUNT_LINE_STRING_TEMPLATE,
                                                       boleto.TicketNumber,
                                                       decimal.Truncate(childCountingLine.TotalBasePriceSum),
                                                       decimal.Truncate(childCountingLine.TotalTuaSum),
                                                       decimal.Truncate(childCountingLine.TotalIVASuma),
                                                       this.Ticket.PaymentForm,
                                                       pax.AccountLineParameter,
                                                       theFlight.IsInternational ? "F" : "D",
                                                       decimal.Truncate(childCountingLine.TotalExtraSum));

                        if (ListTaxesInterjet.Conexion)
                        {
                            string quality = string.Format("5.</C80-{0}*{1}/>",
                                                           boleto.TicketNumber,
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.DepartureStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.ArrivalStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[1]).Information.ArrivalStation);

                            InterjetQualityControleEighty.c80.Add(quality);
                        }

                        commands.Add(command);
                        comando = comando + " " + command;

                        decimal C11 = childCountingLine.TotalBasePriceSum + childCountingLine.TotalIVASuma + childCountingLine.TotalTuaSum + childCountingLine.TotalExtraSum;
                        amountC11[cont] = amountC11[cont] + C11;
                        amountC16[cont] = amountC16[cont] + childCountingLine.TotalBasePriceSum;
                        cont++;
                    }
                }

                if (this.Ticket.Passangers.HasSeniorAdult)
                {
                    var SeniorCountingLine = new
                    {
                        TotalBasePriceSum = (flights.Sum(flight => (flight.PriceDetail.Senior.BasePrice - flight.PriceDetail.Senior.Discount)) / Ticket.Passangers.TotalSenior) * 100,
                        TotalTuaSum       = (flights.Sum(flight => flight.PriceDetail.Senior.TUA) / Ticket.Passangers.TotalSenior) * 100,
                        TotalIVASuma      = (flights.Sum(flight => flight.PriceDetail.Senior.IVA) / Ticket.Passangers.TotalSenior) * 100,
                        TotalExtraSum     = (flights.Sum(flight => flight.PriceDetail.Senior.TotalExtraTaxes) / Ticket.Passangers.TotalSenior) * 100
                    };

                    foreach (InterJetSeniorAdultPassanger pax in this.Ticket.Passangers.GetSeniorAdultsPassangers())
                    {
                        if (this.Ticket.PaymentForm.StartsWith("CCA3"))
                        {
                            this.Ticket.PaymentForm = this.Ticket.PaymentForm.Replace("CCA3", "CCAX");
                        }

                        boleto = LogTicketsBL.LogTicketsInterjet(pax.UniqueID + currentFlightID[1]);
                        if (!string.IsNullOrEmpty(boleto.TicketNumber))
                        {
                            NewTicketInterjet(boleto.TicketNumber);
                        }
                        else
                        {
                            boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                        }

                        LogTicketsBL.LogTicketsInterjetInsert(boleto.TicketNumber, DateTime.Now, Ticket.RecordLocator, string.Empty);

                        string command = string.Format(InterJetAddAccountingLineCommand.ACCOUNT_LINE_STRING_TEMPLATE,
                                                       boleto.TicketNumber,
                                                       decimal.Truncate(SeniorCountingLine.TotalBasePriceSum),
                                                       decimal.Truncate(SeniorCountingLine.TotalTuaSum),
                                                       decimal.Truncate(SeniorCountingLine.TotalIVASuma),
                                                       this.Ticket.PaymentForm,
                                                       pax.AccountLineParameter,
                                                       theFlight.IsInternational ? "F" : "D",
                                                       decimal.Truncate(SeniorCountingLine.TotalExtraSum));

                        if (ListTaxesInterjet.Conexion)
                        {
                            string quality = string.Format("5.</C80-{0}*{1}/>",
                                                           boleto.TicketNumber,
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.DepartureStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.ArrivalStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[1]).Information.ArrivalStation);

                            InterjetQualityControleEighty.c80.Add(quality);
                        }


                        commands.Add(command);
                        comando = comando + " " + command;

                        decimal C11 = SeniorCountingLine.TotalBasePriceSum + SeniorCountingLine.TotalIVASuma + SeniorCountingLine.TotalTuaSum + SeniorCountingLine.TotalExtraSum;
                        amountC11[cont] = amountC11[cont] + C11;
                        amountC16[cont] = amountC16[cont] + SeniorCountingLine.TotalBasePriceSum;
                        cont++;
                    }
                }
            }
            //quitar
            ImpuestosBajoCosto.LineaContable = comando;
            ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, ImpuestosBajoCosto.PNRBajoCosto, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, string.Empty);
            return(commands.ToArray());
        }