コード例 #1
0
ファイル: SplitPaymentVM.cs プロジェクト: 7ccgroup/MIS
        private void storeSplitPaymentInfo(SaleResponse response)
        {
            if (!_order._orderHeader.iSplitCount.HasValue)
            {
                _order._orderHeader.iSplitCount = ReceiptSplits.Count;
            }


            StringBuilder sb = new StringBuilder();

            if (_order._orderHeader.vSplitPayment != null)
            {
                sb.Append(";");
            }

            sb.Append(PaymentType == SplitPaymentType.Card ? "cash" : "card");
            sb.Append(",");

            if (response != null)
            {
                sb.Append(response.Resp_CardNum);
            }

            sb.Append(",");
            sb.Append(_activeSplit.Amount.ToString("0.##"));
            sb.Append(",");
            sb.AppendFormat("split{0}", (ReceiptSplits.IndexOf(_activeSplit) + 1));

            _order._orderHeader.vSplitPayment += sb.ToString();



            GConfig.DAL.SaveChanges();
        }
コード例 #2
0
ファイル: SplitPaymentVM.cs プロジェクト: 7ccgroup/MIS
        private void SwitchSplitPaymentProccess(SaleResponse response)
        {
            _inScale = null;
            if (!IsSplitInitialized)
            {
                IsSplitInitialized = true;
            }

            var currentindex = ReceiptSplits.IndexOf(_activeSplit);


            _activeSplit.IsPaid = true;

            _activeSplit.IsActive = false;

            RemainedAmount -= _activeSplit.Amount;

            _activeSplit.PaymentType = PaymentType;

            //payed
            storeSplitPaymentInfo(response);

            if (currentindex + 1 < ReceiptSplits.Count)
            {
                var nextsplit = ReceiptSplits[currentindex + 1];
                nextsplit.IsActive = true;

                _order.PaymentType = Model.OrderPaymentTypes.Split;


                if (IsAmountSplitType && ReceiptSplits.IndexOf(nextsplit) == ReceiptSplits.Count - 1)
                {
                    nextsplit.Amount         = RemainedAmount;
                    nextsplit.IsAmountLocked = true;
                }


                _activeSplit = nextsplit;
            }
            else
            {
                _order.PaymentType = Model.OrderPaymentTypes.Split;
                _order.OrderStatus = Model.OrderStatuses.Completed;


                _parent.Release();


                MainVM.Main.SaveOrderCommand.Execute(_order);
                MainVM.Main.SwitchToView(Model.SectionType.Dashboard);
            }
        }