public void AddConfrimOrderToOrderListItem()
        {
            if (GetConfirmOrderListItemModel == null)
            {
                DI.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Message",
                    Message = "Please choose one or more some product to the order list!"
                });

                return;
            }

            try
            {
                if (GetConfirmOrderListItemModel != null)
                {
                    if (System.Windows.MessageBox.Show($"Apakah Anda yakin ingin menambahkan {GetConfirmOrderListItemModel.ProductName} kedalam Daftar Pembelian ?", "Konfirmasi", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        OrderListItemsCollection.Add(new OrderListItemModel
                        {
                            ProductId       = GetConfirmOrderListItemModel.ProductId,
                            ProductName     = GetConfirmOrderListItemModel.ProductName,
                            ProductCategory = GetConfirmOrderListItemModel.ProductCategory,
                            Brand           = GetConfirmOrderListItemModel.Brand,
                            Price           = GetConfirmOrderListItemModel.Price,
                            Quantity        = GetConfirmOrderListItemModel.Quantity,
                            Discount        = GetConfirmOrderListItemModel.Total * (GetConfirmOrderListItemModel.Discount / 100),
                            Total           = GetConfirmOrderListItemModel.Price * GetConfirmOrderListItemModel.Quantity,
                            Subtotal        = GetConfirmOrderListItemModel.Total - (GetConfirmOrderListItemModel.Total * (GetConfirmOrderListItemModel.Discount / 100)),
                        });

                        if (OrderListItemsCollection != null)
                        {
                            TotalPay      = OrderListItemsCollection.Sum(items => items.Subtotal);
                            TotalQuantity = OrderListItemsCollection.Sum(items => items.Quantity);
                        }
                    }
                }
            }

            catch (Exception Ex)
            {
                CoreDI.Logger.Log(Ex.Message);
                System.Windows.MessageBox.Show(Ex.Message);
            }
        }
        public async void ProcessAndPrintTransactionOrder()
        {
            Cash = Convert.ToDecimal(TouchPadNumber);

            if (Cash < TotalPay)
            {
                await DI.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Message",
                    Message = "Opss.. nominal uang pembayaran tidak cukup!"
                });

                return;
            }
            else
            {
                Change = Cash - TotalPay;

                var totalDisc = OrderListItemsCollection.Sum(s => s.Discount);

                foreach (var order in OrderListItemsCollection)
                {
                    TransactionListItemsCollection.Add(new TransactionDetailViewModel
                    {
                        TransactionId       = TransactionId,
                        TransactionDetailId = TransactionDetailId,
                        Bill          = Bill,
                        CustomerName  = Name,
                        User          = User,
                        CustomerId    = CustomerId,
                        PhoneNumber   = PhoneNumber,
                        Address       = Address,
                        DateAndTime   = DateAndTime.ToString("yyyy/MM/dd hh:mm:ss"),
                        Note          = Note,
                        Change        = Change,
                        Total         = TotalPay,
                        Cash          = Cash,
                        Disc          = totalDisc,
                        Quantity      = TotalQuantity,
                        ProductId     = order.ProductId,
                        PurchaseTotal = order.Quantity,
                        UnitPrice     = order.Price,
                        TotalPayItem  = order.Subtotal,
                    });
                }



                try
                {
                    var rect = new Rectangle(190, 350);

                    PdfDocument = new Document(rect);

                    var writer = PdfWriter.GetInstance(PdfDocument, new FileStream(FilePath + FileName, FileMode.Create));
                    var font   = new Font(Font.FontFamily.COURIER, 6f, 0, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#333")));
                    PdfDocument.Open();
                    var transactionInfo = default(string);
                    var date            = DateTime.Now.ToString("yyyy/MM/dd");
                    var time            = DateTime.Now.ToString("hh:mm:dd");

                    transactionInfo =
                        $@"
Nota         : {Bill.ToString()}
Tanggal      : {date}
Jam          : {time}
Kasir        : {User.ToString() ?? "System"}
Pelanggan    : {Name.ToString() ?? "Umum"}
-------------------------------     
Name         Qty    Subtotal
";
                    var paragraph = new Paragraph(transactionInfo, font)
                    {
                        Alignment = Element.ALIGN_LEFT
                    };

                    PdfDocument.Add(paragraph);
                    var totalItem = 0;

                    var text = "";
                    foreach (var dataOrder in OrderListItemsCollection)
                    {
                        text      = $"{dataOrder.ProductName.ToString().Substring(0, 8) ?? dataOrder.ProductName.ToString().Substring(0, 6) }      {dataOrder.Quantity.ToString() ?? "None"}    {Convert.ToDecimal(dataOrder.Subtotal).ToString("C0") ?? "None"}";
                        paragraph = new Paragraph(text, font);
                        PdfDocument.Add(paragraph);
                        totalItem++;

                        if (totalItem == OrderListItemsCollection.Count)
                        {
                            var lineText = "-------------------------------";
                            var line     = new Phrase(lineText, font);
                            PdfDocument.Add(line);

                            text      = $"Total   :          {Convert.ToDecimal(TotalPay).ToString("C0") ?? "0"}";
                            paragraph = new Paragraph(text, font);
                            PdfDocument.Add(paragraph);
                            text      = $"Dibayar :          {Convert.ToDecimal(Cash).ToString("C0") ?? "0"}";
                            paragraph = new Paragraph(text, font);
                            PdfDocument.Add(paragraph);
                            text      = $"Kembali :          {Convert.ToDecimal(Change).ToString("C0") ?? "0"}";
                            paragraph = new Paragraph(text, font);
                            PdfDocument.Add(paragraph);

                            paragraph = new Paragraph($"{Environment.NewLine}");
                            PdfDocument.Add(paragraph);

                            paragraph = new Paragraph($"Catatan:", font);
                            PdfDocument.Add(paragraph);
                            paragraph = new Paragraph($"{Note.Substring(0, 27) ?? "Tidak ada catatan"}", font);
                            PdfDocument.Add(paragraph);
                            paragraph = new Paragraph($"{Environment.NewLine}");
                            PdfDocument.Add(paragraph);
                            line = new Phrase(" Terimakasih telah berbelanja", font);
                            PdfDocument.Add(line);
                            paragraph = new Paragraph($"{Environment.NewLine}");
                            PdfDocument.Add(paragraph);
                        }
                    }

                    if (TransactionListItemsCollection != null || TransactionListItemsCollection.Count >= 1)
                    {
                        foreach (var transaction in TransactionListItemsCollection)
                        {
                            var users = (from user in Context.Users
                                         where user.Name == User
                                         select user).ToList();

                            if (users.Count >= 1)
                            {
                                foreach (var user in users)
                                {
                                    GetTransactionModel = new Transaction
                                    {
                                        TransactionId = transaction.TransactionId,
                                        Bill          = transaction.Bill,
                                        Date          = DateAndTime,
                                        GrandTotal    = TotalPay,
                                        Cash          = Cash,
                                        Note          = Note,
                                        CustomerId    = CustomerId ?? "None",
                                        UsersId       = user.UserId ?? "System",
                                    };

                                    var counter = 0;
                                    var rand    = new Random();

                                    GetTransactionDetailModel = new TransactionDetail
                                    {
                                        TransactionDetailId = $"TO{DateTime.Now.ToLocalTime().ToString("yyMM")}{counter = rand.Next(1000, 9999)}",
                                        TransactionId       = transaction.TransactionId,
                                        ProductId           = transaction.ProductId,
                                        PurchaseTotal       = transaction.PurchaseTotal,
                                        UnitPrice           = transaction.UnitPrice,
                                        Disc  = transaction.Disc,
                                        Total = transaction.TotalPayItem,
                                    };

                                    if (GetTransactionModel != null)
                                    {
                                        Context.Transactions.Add(GetTransactionModel);
                                    }

                                    if (GetTransactionDetailModel != null)
                                    {
                                        Context.TransactionDetails.Add(GetTransactionDetailModel);
                                    }

                                    Context.SaveChanges();

                                    Process.Start(FilePath + FileName);


                                    await Task.Delay(TimeSpan.FromSeconds(0.5));
                                }
                            }
                        }
                    }
                }
                catch (Exception Ex)
                {
                    CoreDI.Logger.Log(Ex.Message);
                }
                finally
                {
                    PdfDocument.Close();
                    OrderListItemsCollection.Clear();
                    TransactionDetailModelCollection.Clear();
                    TransactionModelCollection.Clear();
                    TransactionListItemsCollection.Clear();
                    LoadTransactionInfo();
                    Address     = "-";
                    PhoneNumber = "-";
                    Name        = "Umum";
                }
            }
        }