Exemplo n.º 1
0
        public override bool RefundReceipt(Guid pTerminalId, RefundReceiptViewModel pReceipt)
        {
            var receipt = ReceiptViewModelToReceipt(pTerminalId, pReceipt);

            receipt.UserCreate = Bl.GetUserIdbyWorkPlace(receipt.IdWorkplace);
            return(Bl.SaveReceipt(receipt));
        }
Exemplo n.º 2
0
        public ModelMID.Receipt ReceiptViewModelToReceipt(Guid pTerminalId, ReceiptViewModel pReceiptRVM)
        {
            if (pReceiptRVM == null)
            {
                return(null);
            }
            RefundReceiptViewModel RefundRVM = null;

            if (pReceiptRVM is RefundReceiptViewModel)
            {
                RefundRVM = (RefundReceiptViewModel)pReceiptRVM;
            }


            var receipt = new ModelMID.Receipt(RefundRVM == null ? new IdReceipt(pReceiptRVM.Id) : Bl.GetNewIdReceipt(Global.GetIdWorkplaceByTerminalId(pTerminalId)))
            {
                //ReceiptId  = pReceiptRVM.Id,
                StateReceipt  = (string.IsNullOrEmpty(pReceiptRVM.FiscalNumber) ? (pReceiptRVM.PaymentInfo != null ? eStateReceipt.Pay : eStateReceipt.Prepare) : eStateReceipt.Print),
                TypeReceipt   = (RefundRVM == null ? eTypeReceipt.Sale : eTypeReceipt.Refund),
                NumberReceipt = pReceiptRVM.FiscalNumber,

                /* Status = (pReceiptRVM.SumCash > 0 || pReceiptRVM.SumCreditCard > 0
                 *   ? ReceiptStatusType.Paid
                 *   : ReceiptStatusType.Created), //!!!TMP Треба врахувати повернення*/
                TerminalId  = pReceiptRVM.TerminalId,
                SumReceipt  = pReceiptRVM.Amount, //!!!TMP Сума чека.
                SumDiscount = pReceiptRVM.Discount,
                //!!TMP TotalAmount = pReceiptRVM.SumReceipt - pReceiptRVM.SumBonus,
                ///CustomerId = new Client(pReceiptRVM.CodeClient).ClientId,
                DateCreate  = pReceiptRVM.CreatedAt,
                DateReceipt = (pReceiptRVM.UpdatedAt == default(DateTime) ? DateTime.Now : pReceiptRVM.UpdatedAt)
                              //ReceiptItems=
                              //Customer /// !!!TMP Модель клієнта
                              //PaymentInfo
            };

            if (RefundRVM != null)
            {
                receipt.RefundId = (RefundRVM.IdPrimary == null ? null : new IdReceipt(RefundRVM.IdPrimary));
            }

            if (pReceiptRVM.PaymentInfo != null)
            {
                receipt.Payment = new Payment[] { ReceiptPaymentToPayment(receipt, pReceiptRVM.PaymentInfo) }
            }
            ;

            if (pReceiptRVM.ReceiptItems != null)
            {
                receipt.Wares = pReceiptRVM.ReceiptItems.Select(r => GetReceiptWaresFromReceiptItem(receipt, r));
            }

            //if(pReceiptRVM.ReceiptEvents!=null)
            //    receipt.ReceiptEvent= pReceiptRVM.ReceiptEvent


            return(receipt);
        }
Exemplo n.º 3
0
 public virtual bool RefundReceipt(Guid parTerminalId, RefundReceiptViewModel parReceipt)
 {
     throw new NotImplementedException();
 }