コード例 #1
0
        internal static TrTicketViewModel FillTicket(string numTransaction)
        {
            using (IDalTransaction dal = new DalTransaction())
            {
                //find transac
                var transac = TransactionBL.FindTransactionById(numTransaction);
                //create ticket
                TrTicketViewModel vm = new TrTicketViewModel();
                //vm.Ticket = (dal.CreateTicket()).ToString();

                vm.DateTicket = (DateTime.Now).ToString();
                //n° transac
                vm.Transaction = numTransaction;
                //to do --> magasin

                //detail
                vm.DetailsListWithTot = TransactionBL.ListDetailsWithTot(numTransaction);

                //discount

                if (transac.discountGlobal == null)
                {
                    vm.DiscountG = " - ";
                }
                else
                {
                    vm.DiscountG = (transac.discountGlobal).ToString();
                }

                ////VAT
                //vm.VatG = (FindVatValById(transac.vatId)).ToString();
                //vm.VatG = dal.GetAppliedVatById(transac.vatId).appliedVat;

                //Total
                vm.TotalG = (transac.total).ToString();

                //payment method & amount
                vm.Payments = PaymentBL.FindPaymentsByTransacId(numTransaction);

                //message
                var message = FindTicketMessageById(transac.messageId, transac.languageMessage);
                vm.Message = message;

                return(vm);
            }
        }
コード例 #2
0
ファイル: TicketBL.cs プロジェクト: Zedsk/MyPOS2
        internal static TrTicketViewModel FillTicket(string numTransaction, string language, bool?isChange)
        {
            using (IDalTransaction dal = new DalTransaction())
            {
                //find transac
                var transac = TransactionBL.FindTransactionById(numTransaction);
                //create ticket
                TrTicketViewModel vm = new TrTicketViewModel();
                int lang;
                if (int.TryParse(language, out int codeL))
                {
                    lang = codeL;
                }
                else
                {
                    lang = LanguageBL.FindIdLanguageByShortForm(language);
                }
                vm.Language = lang.ToString();

                //if rprint search dateTicket
                DateTime d        = new DateTime(2000, 1, 1, 0, 0, 0);
                int      dCompare = DateTime.Compare(transac.transactionDateEnd, d);
                if (dCompare == 0)
                {
                    vm.DateTicket = (DateTime.Now).ToString();
                }
                else
                {
                    vm.DateTicket = transac.transactionDateEnd.ToString();
                }
                //n° transac
                vm.Transaction = numTransaction;
                //shop informations
                vm.Shop = ShopBL.FindShopById(transac.shopId, lang);
                //detail transaction
                var listDetails = TransactionBL.ListDetailsWithTot(numTransaction);
                vm.DetailsListWithTot = TranslationBL.TranslateDetailList(listDetails, lang);
                //discount or not
                if (transac.discountGlobal == null)
                {
                    vm.DiscountG = " - ";
                }
                else
                {
                    var temp      = (transac.discountGlobal * 100).ToString();
                    var tempsplit = temp.Split(',');
                    var discount  = tempsplit[0] + "%";
                    vm.DiscountG = discount;
                }

                ////VAT
                //to do --> provisoire vatId = 2 --> 21%
                int tva = 2;
                vm.VatG = VatBL.FindVatValById(tva);

                //Total transaction
                vm.TotalG = (transac.total).ToString();

                //payment method & amount
                vm.Payments = PaymentBL.FindPaymentsByTransacId(numTransaction);

                ////message
                var messages = FindTicketMessageById(transac.idTransaction, lang, isChange);
                vm.Messages = messages;

                return(vm);
            }
        }