Exemplo n.º 1
0
        private void NewTicketVolais(string oldTicket)
        {
            string num       = oldTicket.Substring(2, 1);
            string num2      = (Convert.ToInt32(num) + 1).ToString();
            string newTicket = oldTicket.Substring(0, 2) + num2.Substring(0, 1) + oldTicket.Substring(3, 7);

            boleto = LogTicketsBL.LogTicketsVolaris(newTicket);
            if (!string.IsNullOrEmpty(boleto.TicketNumber))
            {
                NewTicketVolais(boleto.TicketNumber);
            }
            else
            {
                boleto.TicketNumber = newTicket;
            }
        }
        private void commitButton_Click(object sender, EventArgs e)
        {
            //Cuando ya se pasa el pago
            try
            {
                if (IsValid)
                {
                    if (!VolarisSession.ErrorPay)
                    {
                        VolarisSession.PagoVolaris = new MetodoPagoVolaris();
                        prueba.Show();

                        if (expirationMonthComboBox.Text == "02")
                        {
                            VolarisSession.PagoVolaris.FechaExpiracion = Convert.ToDateTime("28" + "/" + expirationMonthComboBox.Text + "/" + expirationYearComboBox.Text);
                        }
                        else
                        {
                            VolarisSession.PagoVolaris.FechaExpiracion = Convert.ToDateTime("30" + "/" + expirationMonthComboBox.Text + "/" + expirationYearComboBox.Text);
                        }
                        VolarisSession.PagoVolaris.MetodoDePago   = ((ListItem)creditCardComboBox.SelectedItem).Value;
                        VolarisSession.PagoVolaris.NumeroTarjeta  = creditCardNumberTextBox.Text;
                        VolarisSession.PagoVolaris.Moneda         = "MXN";
                        VolarisSession.PagoVolaris.Monto          = Convert.ToDecimal(totalToPayTextBox.Text);
                        VolarisSession.PagoVolaris.TipoMetodoPago = TiposVolaris.PaymentMethodType.ExternalAccount;
                        VolarisSession.PagoVolaris.NumeroAgencia  = "ACCTNO";
                        VolarisSession.PagoVolaris.TipoTarjeta    = creditCardComboBox.Text;
                        VolarisSession.PagoVolaris.IP             = LocalIPAddress();


                        if (((ListItem)creditCardComboBox.SelectedItem).Value != "TP")
                        {
                            VolarisSession.PagoVolaris.Apellido        = txtLastNameTitular.Text;
                            VolarisSession.PagoVolaris.CodigoPais      = txtCountry.Text;
                            VolarisSession.PagoVolaris.CodigoPostal    = txtPostCode.Text;
                            VolarisSession.PagoVolaris.CodigoSeguridad = securityCodeTextBox.Text;
                            VolarisSession.PagoVolaris.Direccion       = txtAddress.Text;
                            VolarisSession.PagoVolaris.Ciudad          = txtCity.Text;
                            //VolarisSession.PagoVolaris.Direccion = "Y " + txtAddress.Text;
                            //VolarisSession.PagoVolaris.Ciudad = "Y " + txtCity.Text;
                            VolarisSession.PagoVolaris.Email           = txtEmail.Text;
                            VolarisSession.PagoVolaris.EstadoProvincia = ((ListItem)cmbStateorProvidence.SelectedItem).Value;
                            VolarisSession.PagoVolaris.Telefono        = txtPhone.Text;
                            VolarisSession.PagoVolaris.Titular         = txtNameTitular.Text;
                        }

                        if (ctsCheckBox.Checked)
                        {
                            VolarisSession.IsCTSCard = true;
                        }
                        else if (clientCheckBox.Checked)
                        {
                            VolarisSession.IsClientCard = true;
                        }
                    }
                    else
                    {
                        VolarisSession.PagoVolaris.NumeroTarjeta = creditCardNumberTextBox.Text;
                        VolarisSession.ErrorPay = false;
                    }

                    //System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(VolarisSession.PagoVolaris.GetType());
                    //System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\RESP\VolarisPaymentReq " + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".xml");
                    //writer.Serialize(file, VolarisSession.PagoVolaris);
                    //file.Close();

                    InterJetPaymentFormHandler.CommitTransaction();
                    prueba.Hide();

                    if (VolarisSession.IsValidCard)
                    {
                        if (VolarisSession.IsValidPNR && System.Configuration.ConfigurationManager.AppSettings["Ambiente"] == "PRUEBAS")
                        {
                            InterJetPaymentFormHandler.CerrarReservacion();
                            double   a     = LogTicketsBL.RandomVolaris();
                            string[] array = a.ToString().Split('.');
                            VolarisSession.Boleto        = array[1].Substring(0, 8);
                            VolarisSession.Agent         = Login.Agent;
                            VolarisSession.EmailAgent    = Login.Mail;
                            VolarisSession.StatusPaymnet = VolarisPaymentStatus.Approved;
                            VolarisLogger.InsertReservation();
                            Loader.AddToPanel(Loader.Zone.Middle, this, "ucConfirmPurchase");
                        }
                        else if (VolarisSession.IsValidPNR && VolarisSession.Mensaje.Contains("Approved"))
                        {
                            InterJetPaymentFormHandler.CerrarReservacion();
                            double   a     = LogTicketsBL.RandomVolaris();
                            string[] array = a.ToString().Split('.');
                            VolarisSession.Boleto        = array[1].Substring(0, 8);
                            VolarisSession.Agent         = Login.Agent;
                            VolarisSession.EmailAgent    = Login.Mail;
                            VolarisSession.StatusPaymnet = VolarisPaymentStatus.Approved;
                            VolarisLogger.InsertReservation();
                            Loader.AddToPanel(Loader.Zone.Middle, this, "ucConfirmPurchase");
                        }
                        else
                        {
                            if (VolarisSession.PNR.Contains("Invalid account number"))
                            {
                                VolarisSession.ErrorPay      = true;
                                VolarisSession.StatusPaymnet = VolarisPaymentStatus.Declined;
                                VolarisSession.Agent         = Login.Agent;
                                VolarisSession.EmailAgent    = Login.Mail;
                                VolarisLogger.InsertReservation();
                                VolarisSession.PNR = string.Empty;
                                MessageBox.Show("Número de Tarjeta de Crédito Invalida", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Loader.AddToPanel(Loader.Zone.Middle, this, "ucVolarisPaymentFormFormulario");
                            }
                            else if (VolarisSession.Mensaje.Contains("Declined"))
                            {
                                MessageBox.Show("TU CARGO A SIDO DECLINDO LO PROBABLE ES QUE HAYAS INGRESADO LOS DATOS MAL " + "\n" +
                                                "POR POLITICAS DE VOLARIS ES NECESARIO VUELVAS A REHACER TU COMPRA", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCAVAILABILITY);
                            }
                            else
                            {
                                VolarisSession.StatusPaymnet = VolarisPaymentStatus.Declined;
                                VolarisSession.Agent         = Login.Agent;
                                VolarisSession.EmailAgent    = Login.Mail;
                                VolarisLogger.InsertReservation();
                                MessageBox.Show(VolarisSession.Mensaje, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                VolarisSession.PNR = string.Empty;
                                Loader.AddToPanel(Loader.Zone.Middle, this, "ucVolarisPaymentFormFormulario");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                try
                {
                    string msg = ex.Message;
                    InterJetPaymentFormHandler.StopAnimation();
                }
                catch (Exception exception)
                {
                    InterJetPaymentFormHandler.RecoverFromError();
                }
            }
        }
        private void OnRecordCompleted(object sender, OnRecordCompletedEventArgs e)
        {
            if (VolarisSession.IsVolarisProcess)
            {
                var reservation = (VolarisReservation)this.Parameter;//preguntar a Luis
                VolarisSession.ReservationStatus            = VolarisReservationStatus.Accepted;
                ucServicesFeePayApply.PNRBajoCostoAerolinea = VolarisSession.PNR;
                ucServicesFeePayApply.PNRBajoCostoSabre     = String.Empty;
                ChargesPerService.DKActualBajoCosto         = VolarisSession.DK;
                ucServicesFeePayApply.OrigenTipo            = ChargesPerService.OrigenTipoCargo.BajoCosto;

                if (!string.IsNullOrEmpty(e.SabrePnr) && e.SabrePnr.Length == 6 && ValidateRegularExpression.ValidatePNR(e.SabrePnr))
                {
                    LogTicketsBL.LogTicketsVolarisUpdate(VolarisSession.PNR, e.SabrePnr);
                    VolarisSession.PNRSabre = e.SabrePnr;
                    ucServicesFeePayApply.PNRBajoCostoSabre = e.SabrePnr;
                    //quitar
                    ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, VolarisSession.PNR, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, VolarisSession.PNRSabre);

                    var mailer = new VolarisMailer
                    {
                        Reservation = reservation
                    };
                    mailer.SendTest();
                    if (e.IsInvoiced)
                    {
                        VolarisSession.ReservationStatus = VolarisReservationStatus.Invoiced;
                        VolarisLogger.UpdateReservation(VolarisSession.PNR,
                                                        VolarisSession.PNRSabre, VolarisSession.ReservationStatus);
                        ucServicesFeePayApply.OrigenTipo = ChargesPerService.OrigenTipoCargo.BajoCosto;
                        ucServicesFeePayApply pago = new ucServicesFeePayApply();
                        pago.PayServiceFee();
                        Loader.AddToPanelWithParameters(Loader.Zone.Middle, this, "ucEndRecordSuccess",
                                                        null);
                    }
                }
                else
                {
                    MessageBox.Show("No ha sido posible generar la factura para el servicio aéreo,\n por tal motivo los cargos por servicio en linea\n no pudieron ser completados", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            if (IsInterJet)
            {
                ucServicesFeePayApply.PNRBajoCostoAerolinea = InterJetTicket.RecordLocator;
                ucServicesFeePayApply.PNRBajoCostoSabre     = String.Empty;
                ucServicesFeePayApply.OrigenTipo            = ChargesPerService.OrigenTipoCargo.BajoCosto;

                if (!string.IsNullOrEmpty(e.SabrePnr) && e.SabrePnr.Length == 6 && ValidateRegularExpression.ValidatePNR(e.SabrePnr))
                {
                    //quitar
                    ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, ImpuestosBajoCosto.PNRBajoCosto, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, e.SabrePnr);

                    LogTicketsBL.LogTicketsInterjetUpdate(InterJetTicket.RecordLocator, e.SabrePnr);

                    InterJetTicket.RecordSabre = e.SabrePnr;
                    ucServicesFeePayApply.PNRBajoCostoSabre = e.SabrePnr;
                    var mailer = new InterJetMailer {
                        Ticket = InterJetTicket
                    };
                    mailer.SendConfirmationMail();
                    if (e.IsInvoiced)
                    {
                        InterJetTicket.IsFactured = e.IsInvoiced;
                        var service = new LogInterJetBL();
                        service.InvoiceRecord(InterJetTicket.RecordLocator);
                        MyCTS.Presentation.Reservations.Availability.ChargeOfServiceLowFare.AssignamentChargeOfService.ucChargeOfServiceAssign.sPNR = InterJetTicket.RecordLocator;
                        service.InsertSabreRecord(InterJetTicket.RecordLocator, InterJetTicket.RecordSabre);
                        ucMenuReservations.EnabledMenu   = true;
                        ucServicesFeePayApply.OrigenTipo = ChargesPerService.OrigenTipoCargo.BajoCosto;
                        ucServicesFeePayApply pago = new ucServicesFeePayApply();
                        pago.PayServiceFee();
                        Loader.AddToPanelWithParameters(Loader.Zone.Middle, this, "ucEndRecordSuccess",
                                                        null);
                    }
                }
                else
                {
                    MessageBox.Show("No ha sido posible generar la factura para el servicio aéreo,\n por tal motivo los cargos por servicio en linea\n no pudieron ser completados", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            this.errrorMessageContainer.Visible = e.Success;
            this.errorMessage.Text         = e.Message;
            ucMenuReservations.EnabledMenu = true;
            this._group.Visible            = true;
            this.loadingControl1.Visible   = false;
        }
Exemplo n.º 4
0
        private string[] GetSabreCommandVolaris(List <VolarisFlight> flights)
        {
            int infante = 1;

            if (VolarisSession.PagoVolaris.MetodoDePago == "MC")
            {
                VolarisSession.PagoVolaris.MetodoDePago = "CA";
            }
            VolarisSession.ContAdult          = VolarisSession.contAdult;
            VolarisSession.BaseTotalPayAdult  = 0;
            VolarisSession.IVATotalPayAdult   = 0;
            VolarisSession.TUATotalPayAdult   = 0;
            VolarisSession.OtrosTotalPayAdult = 0;

            VolarisSession.BaseTotalPayAdult  = (VolarisSession.baseTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.IVATotalPayAdult   = (VolarisSession.ivaTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.TUATotalPayAdult   = (VolarisSession.tuaTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.OtrosTotalPayAdult = (VolarisSession.otrosTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.AdditionalAdult    = VolarisSession.additionalAdult;
            //quitar
            string comando = string.Empty;

            var commands = new List <string>();

            for (int i = 0; i < flights.Count; i++)
            {
                string        currentFlightID = "0" + 1;
                VolarisFlight theFlight       = flights.FirstOrDefault();

                if (VolarisSession.ContAdult > 0)
                {
                    var adultCountingLine = new
                    {
                        TotalBasePriceSum = ((VolarisSession.BaseTotalPayAdult - VolarisSession.DiscountTotalPayAdult) / VolarisSession.ContAdult),
                        TotalIVASuma      = (VolarisSession.IVATotalPayAdult / VolarisSession.ContAdult),
                        TotalTuaSum       = (VolarisSession.TUATotalPayAdult / VolarisSession.ContAdult),
                        TotalExtraSum     = (VolarisSession.OtrosTotalPayAdult / VolarisSession.ContAdult)
                    };
                    foreach (InterJetPassanger pax in VolarisSession.InterJetPassangers)
                    {
                        if (pax.IsAdult)
                        {
                            //boleto = LogTicketsBL.LogTicketsVolaris("7916309061"); //solo para pruebas
                            boleto = LogTicketsBL.LogTicketsVolaris(pax.UniqueID + currentFlightID[1]);
                            if (!string.IsNullOrEmpty(boleto.TicketNumber))
                            {
                                NewTicketVolais(boleto.TicketNumber);
                            }
                            else
                            {
                                boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                            }

                            LogTicketsBL.LogTicketsVolarisInsert(boleto.TicketNumber, DateTime.Now, VolarisSession.PNR, string.Empty);

                            string command = string.Format("AC/Y4/{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),
                                                           "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                           pax.AccountLineParameter,
                                                           VolarisSession.IsInternational ? "F" : "D",
                                                           decimal.Truncate(
                                                               adultCountingLine.TotalExtraSum));
                            string commandt = command.Trim();
                            commands.Add("" + commandt + "");
                            //quitar la linea
                            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++;
                            foreach (AdditionalAccountingLine add in VolarisSession.AdditionalAdult)
                            {
                                if (add.Description == "11" && add.Amount > 0)
                                {
                                    string command11Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "88", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command11Percent);
                                    comando = comando + "  " + command11Percent;
                                }
                                if (add.Description == "16" && add.Amount > 0)
                                {
                                    string command16Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "99", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command16Percent);
                                    comando = comando + "  " + command16Percent;
                                }

                                if (VolarisSession.ContInfant > 0 && infante <= VolarisSession.ContInfant)
                                {
                                    string command11Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "88", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate(((VolarisSession.Extra / VolarisSession.ContInfant) * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((0)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command11Percent);
                                    comando = comando + "  " + command11Percent;
                                    infante++;
                                }
                            }
                        }
                    }
                }

                if (VolarisSession.ContChild > 0)
                {
                    VolarisSession.ContChild          = VolarisSession.contChild;
                    VolarisSession.BaseTotalPayChild  = 0;
                    VolarisSession.IVATotalPayChild   = 0;
                    VolarisSession.TUATotalPayChild   = 0;
                    VolarisSession.OtrosTotalPayChild = 0;

                    VolarisSession.BaseTotalPayChild  = (VolarisSession.baseTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.IVATotalPayChild   = (VolarisSession.ivaTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.TUATotalPayChild   = (VolarisSession.tuaTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.OtrosTotalPayChild = (VolarisSession.otrosTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.AdditionalChild    = VolarisSession.additionalChild;


                    var childCountingLine = new
                    {
                        TotalBasePriceSum = ((VolarisSession.BaseTotalPayChild - VolarisSession.DiscountTotalPayChild) / VolarisSession.ContChild),
                        TotalIVASuma      = (VolarisSession.IVATotalPayChild / VolarisSession.ContChild),
                        TotalTuaSum       = (VolarisSession.TUATotalPayChild / VolarisSession.ContChild),
                        TotalExtraSum     = (VolarisSession.OtrosTotalPayChild / VolarisSession.ContChild)
                    };

                    foreach (InterJetPassanger pax in VolarisSession.InterJetPassangers)
                    {
                        if (pax.IsChild)
                        {
                            boleto = LogTicketsBL.LogTicketsVolaris(pax.UniqueID + currentFlightID[1]);
                            if (!string.IsNullOrEmpty(boleto.TicketNumber))
                            {
                                NewTicketVolais(boleto.TicketNumber);
                            }
                            else
                            {
                                boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                            }

                            LogTicketsBL.LogTicketsVolarisInsert(boleto.TicketNumber, DateTime.Now, VolarisSession.PNR, string.Empty);

                            string command = string.Format(InterJetAddAccountingLineCommand.ACCOUNT_LINE_STRING_TEMPLATE_VOLARIS,
                                                           boleto.TicketNumber,
                                                           decimal.Truncate(childCountingLine.TotalBasePriceSum),
                                                           decimal.Truncate(childCountingLine.TotalTuaSum),
                                                           decimal.Truncate(childCountingLine.TotalIVASuma),
                                                           "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                           pax.AccountLineParameter,
                                                           VolarisSession.IsInternational ? "F" : "D",
                                                           decimal.Truncate(childCountingLine.TotalExtraSum));
                            commands.Add(command);
                            decimal C11 = childCountingLine.TotalBasePriceSum + childCountingLine.TotalIVASuma + childCountingLine.TotalTuaSum + childCountingLine.TotalExtraSum;
                            amountC11[cont] = amountC11[cont] + C11;
                            amountC16[cont] = amountC16[cont] + childCountingLine.TotalBasePriceSum;
                            cont++;
                            //quitar la linea
                            comando = comando + "  " + command;

                            foreach (AdditionalAccountingLine add in VolarisSession.AdditionalChild)
                            {
                                if (add.Description == "11" && add.Amount > 0)
                                {
                                    string command11Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "88", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command11Percent);
                                    comando = comando + "  " + command11Percent;
                                }
                                if (add.Description == "16" && add.Amount > 0)
                                {
                                    string command16Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "99", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command16Percent);
                                    comando = comando + "  " + command16Percent;
                                }
                            }
                        }
                    }
                }
            }
            //quitar
            ImpuestosBajoCosto.LineaContable = comando;
            ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, VolarisSession.PNR, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, string.Empty);
            return(commands.ToArray());
        }
Exemplo n.º 5
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());
        }