/// <summary>
        /// Metodo encargado de validar si el boton Print esta habilitado o deshabilitado.
        /// </summary>
        /// <history>
        /// [vipacheco] 15/Agosto/2016 Created
        /// </history>
        private void grdMealTicket_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid grd = sender as DataGrid;

            if (grd != null && grd.Items.Count > 0)
            {
                MealTicket mtck = grd.SelectedItem as MealTicket;
                if (mtck != null)
                {
                    // verificamos si ya se imprimio
                    if (mtck.mePrinted)
                    {
                        btnPrint.IsEnabled = false;
                    }
                    else
                    {
                        // verificamos que no se modo lectura
                        if (_modeOpen != EnumMode.ReadOnly)
                        {
                            btnPrint.IsEnabled = true;
                        }
                        else
                        {
                            btnPrint.IsEnabled = false;
                        }
                    }
                }
            }
        }
Exemple #2
0
        private static IState TransferDocument()
        {
            MenuList      toTransferDocsMenu = new MenuList();
            String        label = "";
            SalesDocument sDoc;

            int i = 1;

            string labelFormat = "{0}\n{1}-{2}";

            label = String.Format(labelFormat, PosMessage.SELECT_DOCUMENT, i++, PosMessage.INVOICE);
            sDoc  = new Invoice(cr.Document);
            toTransferDocsMenu.Add(new MenuLabel(label, sDoc));

            label = String.Format(labelFormat, PosMessage.SELECT_DOCUMENT, i++, PosMessage.E_INVOICE);
            sDoc  = new EInvoice(cr.Document);
            toTransferDocsMenu.Add(new MenuLabel(label, sDoc));

            label = String.Format(labelFormat, PosMessage.SELECT_DOCUMENT, i++, PosMessage.E_ARCHIVE);
            sDoc  = new EArchive(cr.Document);
            toTransferDocsMenu.Add(new MenuLabel(label, sDoc));

            label = String.Format(labelFormat, PosMessage.SELECT_DOCUMENT, i++, PosMessage.MEAL_TICKET);
            sDoc  = new MealTicket(cr.Document);
            toTransferDocsMenu.Add(new MenuLabel(label, sDoc));

            return(List.Instance(toTransferDocsMenu, TransferToChoosenDoc, Continue));
        }
 public MealAssessment(List <Food_O> preppedMeal, MealTicket ticket, Menu menu, int mealsThrough) //constuctor
 {
     food      = preppedMeal;
     _ticket   = ticket;
     men       = menu;
     mealsSent = mealsThrough;
 }
        /// <summary>
        /// Función encargada de verificar si cuenta con los permisos de edicion!
        /// </summary>
        /// <history>
        /// [vipacheco] 23/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            // Se verifica que tenga permisos de editar
            if (_modeOpen != EnumMode.ReadOnly)
            {
                MealTicket mealTicket = grdMealTicket.SelectedItem as MealTicket;

                frmMealTicketsDetail frmealTkt = new frmMealTicketsDetail(_openBy)
                {
                    Owner = this
                };
                ObjectHelper.CopyProperties(frmealTkt._mealTicketCurrency, mealTicket);
                frmealTkt._modeOpen = EnumMode.Edit;
                frmealTkt.Title    += "Edit - ID " + mealTicket.meID;

                if (frmealTkt.ShowDialog().Value)
                {
                    int        indexOrigin = obsMealTicket.IndexOf(mealTicket);
                    MealTicket _mealTicket = ObjectHelper.CopyProperties(frmealTkt._mealTicketCurrency);

                    if (_modeOpen == EnumMode.Edit && _openBy == EnumOpenBy.Checkbox)
                    {
                        dsMealTicket.Source = BRMealTickets.GetMealTickets(_guestID);
                    }
                    else if (_modeOpen == EnumMode.Edit && _openBy == EnumOpenBy.Button)
                    {
                        obsMealTicket.Insert(indexOrigin, _mealTicket); obsMealTicket.Remove(mealTicket);
                    }
                }
            }
        }
Exemple #5
0
 public void SetTicket(MealTicket _ticket) //storing ticket information in the area
 {
     ticket = _ticket;
     if (ticket != null)
     {
         foodForSend = ticket.TheFoodInOrder();
         //mealName = ticket.GetMealName();
     }
 }
Exemple #6
0
        /// <summary>
        /// Función que actualiza un Meal Ticket creado anteriomente
        /// </summary>
        /// <param name="pMealTicket"></param>
        /// <history>
        /// [vipacheco] 01/04/2016 Created
        /// </history>
        public static void UpdateMealTicket(MealTicket pMealTicket)
        {
            using (var dbcontext = new IMEntities(ConnectionHelper.ConnectionString()))
            {
                dbcontext.Entry(pMealTicket).State = System.Data.Entity.EntityState.Modified;

                dbcontext.SaveChanges();
            }
        }
Exemple #7
0
        /// <summary>
        /// Función que agrega un nuevo Meal Ticket
        /// </summary>
        /// <param name="pMealTicket"></param>
        /// <history>
        /// [vipacheco] 01/04/2016 Created
        /// </history>
        public static void InsertNewMealTicket(MealTicket pMealTicket)
        {
            using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString()))
            {
                dbContext.MealTickets.Add(pMealTicket);

                dbContext.SaveChanges();
            }
        }
        /// <summary>
        /// Imprime el ticket de comida.
        /// </summary>
        ///  <history>
        /// [edgrodriguez] 15/07/2016 Created
        /// [vipacheco] 13/Agosto/2016 Modified -> se elimino el recorrido de todos los items del grid, por la seleccion actual.
        /// </history>
        private async void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            MealTicket mtck  = grdMealTicket.SelectedItem as MealTicket;
            int        folio = 0;

            if (!int.TryParse(mtck.meFolios, out folio))
            {
                UIHelper.ShowMessage($"Could not print this meal ticket.\n{string.Join("\n", mtck.meFolios)}");; return;
            }
            var mT = await BRMealTicketFolios.GetMealTicket(mtck.meID, Convert.ToInt32(mtck.meFolios), $"{Context.User.User.peID} - {Context.User.User.peN}");

            if (mT != null)
            {
                StringHelper.Items        = new List <string>();
                LanguageHelper.IDLanguage = mT.gula;
                if (!string.IsNullOrEmpty(mT.raN))
                {
                    StringHelper.Items.Add(mT.raN.PadCenter());
                }
                StringHelper.Items.Add($"{((char)27)}{((char)97)}1");//Centrado
                StringHelper.Items.Add("PALACE ELITE");
                StringHelper.Items.Add("VALE POR 1 BUFFET");
                StringHelper.Items.Add(mT.myN);
                StringHelper.Items.Add("\r\n");
                StringHelper.Items.Add($"{((char)27)}{((char)97)}0");//Izquierda
                if (!string.IsNullOrEmpty(mT.REFERENCE))
                {
                    StringHelper.Items.Add(mT.REFERENCE);
                    StringHelper.Items.Add(mT.REFERENCENAME);
                }
                else
                {
                    StringHelper.Items.Add($"Guest ID: {mT.guID}");
                    StringHelper.Items.Add($"{LanguageHelper.GetMessage("msgLblNameMT")}: { mT.Name}");
                }
                StringHelper.Items.Add($"{LanguageHelper.GetMessage("msgLblAdults")}: {mT.meAdults} {LanguageHelper.GetMessage("msgLblMinors")}: {mT.meMinors}");
                StringHelper.Items.Add($"{LanguageHelper.GetMessage("msgLblDate")}: {mT.meD.ToShortDateString()}");
                StringHelper.Items.Add($"{LanguageHelper.GetMessage("msgLblAuthorizedBy")}: {mT.Authorized}");
                StringHelper.Items.Add($"SalesRoom: {mT.SalesRoomID} - {mT.SalesRoomName}");
                StringHelper.Items.Add($"\r\n");
                StringHelper.Items.Add($"{((char)27)}{((char)97)}2");//Derecha
                StringHelper.Items.Add($"Folio: {mT.meFolio}");
                StringHelper.Items.Add($"{((char)27)}{((char)97)}1");
                StringHelper.Items.Add($"{LanguageHelper.GetMessage("msgLblDate")}: {DateTime.Today.ToString("dd/MM/yyyy h:mm:ss tt")}");
                StringHelper.Items.Add("\r\n");
                StringHelper.Items.Add($"{((char)29)}VB{((char)1)}");
                if (PrinterHelper.SendStringToPrinter(StringHelper.ToTicketString()))
                {
                    mtck.mePrinted = true;
                    BRMealTickets.UpdateMealTicket(mtck);
                    grdMealTicket.Items.Refresh();
                }
            }
        }
Exemple #9
0
        public static void EnterDefaultDocumentCode(Object o)
        {
            MenuLabel label = o as MenuLabel;
            int       defDocType;
            String    docType = label.Value.ToString().Split('\n')[1].Trim();

            switch (docType)
            {
            case PosMessage.RECEIPT_TR:
                defDocType = 0;
                break;

            case PosMessage.INVOICE:
                defDocType = new Invoice().DocumentTypeId;
                break;

            case PosMessage.E_ARCHIVE:
                defDocType = new EArchive().DocumentTypeId;
                break;

            case PosMessage.E_INVOICE:
                defDocType = new EInvoice().DocumentTypeId;
                break;

            case PosMessage.MEAL_TICKET:
                defDocType = new MealTicket().DocumentTypeId;
                break;

            case PosMessage.CAR_PARKIMG:
                defDocType = new CarParkDocument().DocumentTypeId;
                break;

            case PosMessage.ADVANCE:
                defDocType = new Advance().DocumentTypeId;
                break;

            case PosMessage.COLLECTION_INVOICE:
                defDocType = new CollectionInvoice().DocumentTypeId;
                break;

            case PosMessage.CURRENT_ACCOUNT_COLLECTION:
                defDocType = new CurrentAccountDocument().DocumentTypeId;
                break;

            default:
                defDocType = 0;
                break;
            }

            customerInput.Append(defDocType.ToString().PadLeft(2, '0'));

            cr.State = SaveCustomerInput();
        }
    void CreateTicket(OrderScreen screen)
    {
        List <string> obj    = RandomMeal();                         //random meal from the menu
        MealTicket    ticket = new MealTicket(obj[0], TheFood(obj)); //storing information in seperate class

        ticket.SetScreen(screen);
        StartCoroutine(ticket.TickerTimer(screen.TimeText()));                        //starting the timer
        mealTickets.Add(ticket);
        DisplayMeal(ticket.TheFoodInOrder(), ticket.GetMealName(), screen.GetText()); //displaying the meal
        sendAreas[(screen.screenNo) - 1].SetTicket(ticket);                           //assifning the ticket to the correct send area
        screen.SetUse(true);
        audioManager.PlaySound("Bell");
    }
    public void CreateTicket(OrderScreen screen)
    {
        List <string> obj    = RandomMeal();
        MealTicket    ticket = new MealTicket(obj[0], TheFood(obj)); //storing information in seperate class

        ticket.SetScreen(screen);
        //StartCoroutine(ticket.TickerTimer(screen.TimeText()));
        mealTickets.Add(ticket);
        DisplayMeal(ticket.TheFoodInOrder(), ticket.GetMealName(), screen.GetText());
        sendAreas[(screen.screenNo) - 1].SetTicket(ticket);
        screen.SetUse(true);
        audioManager.PlaySound("Bell");
    }
    public void SendMeal(List <Food_O> food, MealTicket ticket, Move_S plate)
    {
        MealAssessment assessment = new MealAssessment(food, ticket, menu, mealsThrough);

        ticket.pauseTimer = true;
        assessment.AssessMeal();
        double moneyBack = assessment.Money();

        StartCoroutine(UpdateMoney(moneyBack, moneyBack / 10d));
        daysEarnings += moneyBack;
        int mealIndex = mealTickets.IndexOf(ticket);

        mealTickets.Remove(mealTickets[mealIndex]);
        mealsThrough++;
        StartCoroutine(ShowResults(assessment));
        StartCoroutine(waiter.GetWaiter(sendAreas[ticket.GetScreen().screenNo - 1].transform, plate));
        mealAssesments.Add(assessment.AssessmentText());
    }
    public void SendMeal(List <Food_O> food, MealTicket ticket, Move_S plate)             //when the player puts plate on send area
    {
        MealAssessment assessment = new MealAssessment(food, ticket, menu, mealsThrough); //meal assessment

        ticket.pauseTimer = true;
        assessment.AssessMeal();
        double moneyBack = assessment.Money();                   //getting the money value

        StartCoroutine(UpdateMoney(moneyBack, moneyBack / 10d)); //updating credit
        daysEarnings += moneyBack;
        int mealIndex = mealTickets.IndexOf(ticket);

        mealTickets.Remove(mealTickets[mealIndex]);                                                    //removing from list so new meal can come through
        mealsThrough++;
        StartCoroutine(ShowResults(assessment));                                                       //showing feedback
        StartCoroutine(waiter.GetWaiter(sendAreas[ticket.GetScreen().screenNo - 1].transform, plate)); //calling for the waiter
        mealAssesments.Add(assessment.AssessmentText());
        DisallowInteraction(plate);
    }
        /// <summary>
        /// Guarda la informacion proporcionada!
        /// </summary>
        /// <history>
        /// [vipacheco] 23/03/2016 Created
        /// </history>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (ValidateGeneral())
            {
                RateType       _rateType  = cboRateType.SelectedItem as RateType;
                MealTicketType _mealType  = cboType.SelectedItem as MealTicketType;
                PersonnelShort _personnel = cboCollaborator.SelectedItem as PersonnelShort;
                AgencyShort    _agency    = cboAgency.SelectedItem as AgencyShort;

                int    _meAdults        = Convert.ToInt32((txtAdults.Text == "") ? "0" : txtAdults.Text);
                int    _meMinors        = Convert.ToInt32((txtMinors.Text == "") ? "0" : txtMinors.Text);
                string _meTAdultsString = txtTAdults.Text.TrimStart('$');
                string _meTMinorsString = txtTMinors.Text.TrimStart('$');

                // Agrega un nuevo Meal Ticket
                if (_modeOpen == EnumMode.Add)
                {
                    // Obtenemos el folio a asignar
                    int folioNew = 1 + BRMealTicketFolios.GetMaxMealTicketFolio(Context.User.SalesRoom.srID, _mealType.myID, _rateType == null ? 1 : _rateType.raID);

                    _mealTicketCurrency = CreateMealTicket(_rateType, _mealType, _personnel, _agency, _meAdults, _meMinors, _meTAdultsString, _meTMinorsString, folioNew);

                    //Actualizamos el folio!
                    BRMealTicketFolios.UpdateMealTicketFolio(Context.User.SalesRoom.srID, _mealType.myID, _rateType == null ? 1 : _rateType.raID, $"{folioNew}");

                    //Guardamos el Meal Ticket Creado
                    BRMealTickets.InsertNewMealTicket(_mealTicketCurrency);
                }
                // Modo edicion
                else
                {
                    int folio = Convert.ToInt32(_mealTicketCurrency.meFolios);

                    // Creamos el Meal Ticket con el guestID
                    _mealTicketCurrency.meD            = dtpDate.Value.Value.Date;
                    _mealTicketCurrency.megu           = _mealTicketCurrency.megu != 0 ? _mealTicketCurrency.megu : frmMealTickets._guestID;
                    _mealTicketCurrency.meQty          = frmMealTickets._Qty;
                    _mealTicketCurrency.meType         = _mealType.myID;
                    _mealTicketCurrency.meAdults       = _meAdults;
                    _mealTicketCurrency.meMinors       = _meMinors;
                    _mealTicketCurrency.meFolios       = $"{folio}";
                    _mealTicketCurrency.meTAdults      = Convert.ToDecimal(_meTAdultsString);
                    _mealTicketCurrency.meTMinors      = Convert.ToDecimal(_meTMinorsString);
                    _mealTicketCurrency.meComments     = txtComments.Text;
                    _mealTicketCurrency.mesr           = Context.User.SalesRoom.srID;
                    _mealTicketCurrency.meCanc         = chkCancel.IsChecked.Value;
                    _mealTicketCurrency.mera           = frmMealTickets._guestID > 0 ? 1 : _rateType.raID;
                    _mealTicketCurrency.mepe           = cboCollaborator.IsVisible ? _personnel.peID : null;
                    _mealTicketCurrency.mePrinted      = chkPrinted.IsChecked.Value;
                    _mealTicketCurrency.meag           = cboAgency.IsVisible ? _agency.agID : null;
                    _mealTicketCurrency.merep          = txtRepresentative.IsVisible ? txtRepresentative.Text : null;
                    _mealTicketCurrency.meAuthorizedBy = Context.User.User.peID;

                    //Actualizamos el folio!
                    BRMealTicketFolios.UpdateMealTicketFolio(Context.User.SalesRoom.srID, _mealType.myID, _rateType.raID, _mealTicketCurrency.meFolios);

                    // Insertamos el nuevo Meal Ticket con el folio asignado
                    BRMealTickets.UpdateMealTicket(_mealTicketCurrency);
                }
                //Actualizamos el campo guMealTicket del Guest
                BRGuests.UpdateFieldguMealTicket(true, frmMealTickets._guestID);

                DialogResult = true;
                Close();
            }
        }