Ejemplo n.º 1
0
        //插入会员消费记录
        private void insert_member_infor(Account account)
        {
            double account_money = BathClass.get_account_money(account);

            if (m_promotion_Member != null)
            {
                CardCharge cc = new CardCharge();
                cc.CC_CardNo        = m_promotion_Member.CI_CardNo;
                cc.CC_AccountNo     = account.id.ToString();
                cc.CC_ItemExplain   = "会员打折";
                cc.expense          = account_money;
                cc.CC_InputOperator = LogIn.m_User.id.ToString();
                cc.CC_InputDate     = DateTime.Now;
                db.CardCharge.InsertOnSubmit(cc);
            }

            if (m_Member != null)
            {
                CardCharge cc = new CardCharge();
                cc.CC_CardNo        = m_Member.CI_CardNo;
                cc.CC_AccountNo     = account.id.ToString();
                cc.CC_ItemExplain   = "会员刷卡";
                cc.CC_LenderSum     = account.creditCard;
                cc.expense          = account_money;
                cc.CC_InputOperator = LogIn.m_User.id.ToString();
                cc.CC_InputDate     = DateTime.Now;
                db.CardCharge.InsertOnSubmit(cc);
                db.SubmitChanges();
            }
            //db.SubmitChanges();
        }
Ejemplo n.º 2
0
        //显示信息
        private void dgv_show()
        {
            dgv.Rows.Clear();
            var ops = db.Operation.Where(x => x.explain == "手工打折");

            ops = ops.Where(x => x.opTime >= startTime.Value && x.opTime <= endTime.Value);

            if (cEmployee.Checked)
            {
                ops = ops.Where(x => x.employee == employee.Text);
            }

            foreach (var op in ops)
            {
                var x = db.Account.FirstOrDefault(a => a.systemId == op.note2);
                if (x == null)
                {
                    continue;
                }
                string[] row =
                {
                    x.id.ToString(),
                    x.text,
                    x.systemId,
                    x.payTime.ToString(),
                    x.payEmployee,
                    op.employee,
                    op.note1,
                    BathClass.get_account_money(x).ToString()
                };
                dgv.Rows.Add(row);
            }
            BathClass.set_dgv_fit(dgv);
        }
Ejemplo n.º 3
0
        //打印优惠券
        private void btnCoupon_Click(object sender, EventArgs e)
        {
            InputNumber inputNumber = new InputNumber("输入账单号", false);

            if (inputNumber.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var act_id = inputNumber.number;
            var act    = db.Account.FirstOrDefault(x => x.id == act_id);

            if (act == null)
            {
                return;
            }

            //if (BathClass.ToBool(act.couponPrinted))
            //{
            //    InformationDlg dlg = new InformationDlg("该账单号已经打印");
            //    dlg.ShowDialog();
            //    return;
            //}

            var act_money = BathClass.get_account_money(act);

            if (db.Coupon.Any(x => x.minAmount != null && act_money >= x.minAmount))
            {
                var coupons = db.Coupon.Where(x => x.minAmount != null && act_money >= x.minAmount);
                var coupon  = coupons.OrderByDescending(x => x.money).FirstOrDefault();

                PrintCoupon.Print_Coupon((byte[])coupon.img.ToArray());

                //act.couponPrinted = true;
                db.SubmitChanges();
            }
            else
            {
                InformationDlg dlg = new InformationDlg("未达到最低赠送消费金额");
                dlg.ShowDialog();
            }
        }
Ejemplo n.º 4
0
        //插入会员消费记录
        private void insert_member_infor()
        {
            double account_money = BathClass.get_account_money(account);

            if (m_promotion_Member != null)
            {
                CardCharge cc = new CardCharge();
                cc.CC_CardNo        = m_promotion_Member.CI_CardNo;
                cc.CC_AccountNo     = account.id.ToString();
                cc.CC_ItemExplain   = "会员打折";
                cc.expense          = account_money;
                cc.CC_InputOperator = LogIn.m_User.id.ToString();
                cc.CC_InputDate     = GeneralClass.Now;
                db.CardCharge.InsertOnSubmit(cc);
                send_sms(m_promotion_Member.CI_CardNo);
            }

            if (m_Member_List != null)
            {
                foreach (string cardNo in m_Member_List.Keys)
                {
                    CardCharge cc = new CardCharge();
                    cc.CC_CardNo        = cardNo;
                    cc.CC_AccountNo     = account.id.ToString();
                    cc.CC_ItemExplain   = "会员刷卡";
                    cc.CC_LenderSum     = m_Member_List[cardNo];
                    cc.expense          = account_money;
                    cc.CC_InputOperator = LogIn.m_User.id.ToString();
                    cc.CC_InputDate     = GeneralClass.Now;
                    db.CardCharge.InsertOnSubmit(cc);
                    send_sms(cardNo);
                }
                //db.SubmitChanges();
            }
            //db.SubmitChanges();
        }
Ejemplo n.º 5
0
        //查询
        private void dgv_show()
        {
            dgv.Rows.Clear();
            List <Account> accountList = findAccount();

            if (!accountList.Any())
            {
                return;
            }

            //第一部分:账单部分
            double totalMoney = 0;

            foreach (var act in accountList)
            {
                var    money    = BathClass.get_account_money(act);
                string act_text = string.Join("\n", act.text.Split('|').ToArray());

                var money_str = "";
                if (act.cash != null)
                {
                    if (act.changes == null)
                    {
                        money_str += act.cash + "现";
                    }
                    else
                    {
                        money_str += act.cash - act.changes + "现";
                    }
                }
                if (act.bankUnion != null)
                {
                    money_str = money_str == "" ? money_str + act.bankUnion + "银" : money_str + "\n" + act.bankUnion + "银";
                }
                if (act.creditCard != null)
                {
                    money_str = money_str == "" ? money_str + act.creditCard + "卡" : money_str + "\n" + act.creditCard + "卡";
                }
                if (act.coupon != null)
                {
                    money_str = money_str == "" ? money_str + act.coupon + "券" : money_str + "\n" + act.coupon + "券";
                }
                if (act.groupBuy != null)
                {
                    money_str = money_str == "" ? money_str + act.groupBuy + "团" : money_str + "\n" + act.groupBuy + "团";
                }
                if (act.zero != null)
                {
                    money_str = money_str == "" ? money_str + act.zero + "挂" : money_str + "\n" + act.zero + "挂";
                }
                if (act.server != null)
                {
                    money_str = money_str == "" ? money_str + act.server + "招" : money_str + "\n" + act.server + "招";
                }
                if (act.wipeZero != null)
                {
                    money_str = money_str == "" ? money_str + act.wipeZero + "抹" : money_str + "\n" + act.wipeZero + "抹";
                }

                dgv.Rows.Add(act.id, act_text, act.payTime.ToString("MM-dd HH:mm"), money_str);
                totalMoney += money;
            }
            dgv.Rows.Add("合计", "", "", totalMoney);

            totalMoney = 0;
            dgv.Rows.Add();

            //第二部分:订单部分
            var orders = db.HisOrders.Where(x => idList.Contains(x.accountId.Value) && x.deleteEmployee == null);
            var menus  = orders.Select(x => x.menu).Distinct();

            foreach (var menu in menus)
            {
                var menu_orders = orders.Where(x => x.menu == menu);
                var tmp_menu    = db.Menu.FirstOrDefault(x => x.name == menu);

                double t_number = menu_orders.Sum(x => x.number);
                double money    = BathClass.get_orders_money(accountList, menu_orders.ToList());
                double t_money  = 0;
                if (tmp_menu != null)
                {
                    t_money = t_number * tmp_menu.price;
                }

                dgv.Rows.Add(menu, t_number, t_money, money);
                totalMoney += money;
            }

            //第三部分:售卡部分
            double card_cash = 0, card_bank = 0;
            var    cardsale = db.CardSale.Where(x => (x.macAddress == macAdd || x.macAddress == null) && x.payTime >= lastTime && x.payTime <= thisTime);

            var cardsale_free = cardsale.Where(x => x.note == "赠送卡");

            if (cardsale_free.Any())
            {
                dgv.Rows.Add("赠送卡", cardsale_free.Count());
            }

            cardsale = cardsale.Where(x => x.note == null);
            //dgv.Rows.Add(MConvert<int>.ToTypeOrDefault(balance).ToString() + "会员卡", card_balance.Count(), "", card_balance_money);
            var balance_list = cardsale.Select(x => x.balance).Distinct();

            foreach (var balance in balance_list)
            {
                var    card_balance       = cardsale.Where(x => x.balance == balance);
                double card_balance_money = 0;
                var    card_balance_cash  = card_balance.Where(x => x.cash != null);
                if (card_balance_cash.Any())
                {
                    double cash = card_balance_cash.Sum(x => x.cash).Value;
                    card_balance_money += cash;
                    card_cash          += cash;
                }

                var card_balance_bank = card_balance.Where(x => x.bankUnion != null);
                if (card_balance_bank.Any())
                {
                    double bank = card_balance_bank.Sum(x => x.bankUnion).Value;
                    card_balance_money += bank;
                    card_bank          += bank;
                }

                totalMoney += card_balance_money;
                dgv.Rows.Add(MConvert <int> .ToTypeOrDefault(balance, 0) + "会员卡", card_balance.Count(), "", card_balance_money);
            }

            dgv.Rows.Add("合计", "", "", totalMoney);
            dgv.Rows.Add();


            //第四部分:汇总部分
            string[] cashRow     = { "现金", "", "", card_cash.ToString() };
            string[] bankRow     = { "银联", "", "", card_bank.ToString() };
            string[] cardRow     = { "储值卡", "", "", "0" };
            string[] couponRow   = { "优惠券", "", "", "0" };
            string[] groupBuyRow = { "团购优惠", "", "", "0" };
            string[] discountRow = { "挂账", "", "", "0" };
            string[] serverRow   = { "免单", "", "", "0" };
            string[] otherRow    = { "扣卡", "", "", "0" };
            string[] wipeRow     = { "抹零", "", "", "0" };

            double act_money = card_bank + card_cash;

            double tmp_Money = Convert.ToDouble(accountList.Where(x => x.cash != null).Sum(x => x.cash));

            cashRow[3] = (Convert.ToDouble(cashRow[3]) + tmp_Money).ToString();
            act_money += tmp_Money;

            tmp_Money  = Convert.ToDouble(accountList.Where(x => x.changes != null).Sum(x => x.changes));
            cashRow[3] = (Convert.ToDouble(cashRow[3]) - tmp_Money).ToString();
            act_money -= tmp_Money;

            tmp_Money  = Convert.ToDouble(accountList.Where(x => x.bankUnion != null).Sum(x => x.bankUnion));
            bankRow[3] = (Convert.ToDouble(bankRow[3]) + tmp_Money).ToString();
            act_money += tmp_Money;

            tmp_Money  = Convert.ToDouble(accountList.Where(x => x.creditCard != null).Sum(x => x.creditCard));
            cardRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money    = Convert.ToDouble(accountList.Where(x => x.coupon != null).Sum(x => x.coupon));
            couponRow[3] = tmp_Money.ToString();
            act_money   += tmp_Money;

            tmp_Money      = Convert.ToDouble(accountList.Where(x => x.groupBuy != null).Sum(x => x.groupBuy));
            groupBuyRow[3] = tmp_Money.ToString();
            act_money     += tmp_Money;

            tmp_Money      = Convert.ToDouble(accountList.Where(x => x.zero != null).Sum(x => x.zero));
            discountRow[3] = tmp_Money.ToString();
            act_money     += tmp_Money;

            tmp_Money    = Convert.ToDouble(accountList.Where(x => x.server != null).Sum(x => x.server));
            serverRow[3] = tmp_Money.ToString();
            act_money   += tmp_Money;

            tmp_Money   = Convert.ToDouble(accountList.Where(x => x.deducted != null).Sum(x => x.deducted));
            otherRow[3] = tmp_Money.ToString();
            act_money  += tmp_Money;

            tmp_Money  = Convert.ToDouble(accountList.Where(x => x.wipeZero != null).Sum(x => x.wipeZero));
            wipeRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            dgv.Rows.Add(cashRow);
            dgv.Rows.Add(bankRow);
            dgv.Rows.Add(cardRow);
            dgv.Rows.Add(couponRow);
            dgv.Rows.Add(groupBuyRow);
            dgv.Rows.Add(discountRow);
            dgv.Rows.Add(serverRow);
            dgv.Rows.Add(otherRow);
            dgv.Rows.Add(wipeRow);
            dgv.Rows.Add("合计", "", "", act_money);

            BathClass.set_dgv_fit(dgv);
        }
Ejemplo n.º 6
0
        //查询
        private void dgv_show()
        {
            dgv.Rows.Clear();
            List<Account> accountList = findAccount();
            if (!accountList.Any())
                return;

            double totalMoney = 0;
            foreach (var act in accountList)
            {
                var money = BathClass.get_account_money(act);
                string act_text = string.Join("\n", act.text.Split('|').ToArray());

                var money_str = "";
                if (act.cash != null)
                {
                    if (act.changes == null)
                        money_str += act.cash + "现";
                    else
                        money_str += act.cash - act.changes + "现";
                }
                if (act.bankUnion != null)
                    money_str = money_str == "" ? money_str + act.bankUnion + "银" : money_str + "\n" + act.bankUnion + "银";
                if (act.creditCard != null)
                    money_str = money_str == "" ? money_str + act.creditCard + "卡" : money_str + "\n" + act.creditCard + "卡";
                if (act.coupon != null)
                    money_str = money_str == "" ? money_str + act.coupon + "券" : money_str + "\n" + act.coupon + "券";
                if (act.groupBuy != null)
                    money_str = money_str == "" ? money_str + act.groupBuy + "团" : money_str + "\n" + act.groupBuy + "团";
                if (act.zero != null)
                    money_str = money_str == "" ? money_str + act.zero + "挂" : money_str + "\n" + act.zero + "挂";
                if (act.server != null)
                    money_str = money_str == "" ? money_str + act.server + "招" : money_str + "\n" + act.server + "招";
                if (act.wipeZero != null)
                    money_str = money_str == "" ? money_str + act.wipeZero + "抹" : money_str + "\n" + act.wipeZero + "抹";

                dgv.Rows.Add(act.id, act_text, act.payTime.ToString("MM-dd HH:mm"), money_str);
                totalMoney += money;
            }
            string[] trow = { "合计", "", "", totalMoney.ToString("0") };
            dgv.Rows.Add(trow);

            totalMoney = 0;
            dgv.Rows.Add();
            var menuList = db.Menu.Select(x => x.name);
            foreach (string menu in menuList)
            {
                List<HisOrders> orderList = findOrder(menu);
                if (orderList.Count() != 0)
                {
                    var tmp_menu = db.Menu.FirstOrDefault(x => x.name == menu);
                    double money = 0;
                    double t_money = orderList.Sum(x => x.number) * tmp_menu.price;
                    string[] row = { menu, orderList.Sum(x => x.number).ToString(), t_money.ToString("0"), money.ToString("0") };
                    dgv.Rows.Add(row);
                    totalMoney += money;
                }
            }

            var comboList = db.Combo.Select(x => x.id.ToString());
            foreach (string comboId in comboList)
            {
                string menu = "套餐" + comboId + "优惠";
                List<HisOrders> orderList = findOrder(menu);
                if (orderList.Count() != 0)
                {
                    double money = Convert.ToDouble(orderList.Sum(x => x.money));
                    string[] row = { menu, orderList.Count().ToString(), money.ToString("0"), money.ToString("0") };
                    dgv.Rows.Add(row);
                    totalMoney += money;
                }
            }
            string[] trow2 = { "合计", "", "", totalMoney.ToString("0") };
            dgv.Rows.Add(trow2);
            dgv.Rows.Add();

            string[] cashRow = { "现金", "", "", "0" };
            string[] bankRow = { "银联", "", "", "0" };
            string[] cardRow = { "储值卡", "", "", "0" };
            string[] couponRow = { "优惠券", "", "", "0" };
            string[] groupBuyRow = { "团购优惠", "", "", "0" };
            string[] discountRow = { "挂账", "", "", "0" };
            string[] serverRow = { "免单", "", "", "0" };
            string[] otherRow = { "扣卡", "", "", "0" };
            string[] wipeRow = { "抹零", "", "", "0" };

            double act_money = 0;

            double tmp_Money = Convert.ToDouble(accountList.Where(x => x.cash != null).Sum(x => x.cash));
            cashRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.changes != null).Sum(x => x.changes));
            cashRow[3] = (Convert.ToDouble(cashRow[3]) - tmp_Money).ToString();
            act_money -= tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.bankUnion != null).Sum(x => x.bankUnion));
            bankRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.creditCard != null).Sum(x => x.creditCard));
            cardRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.coupon != null).Sum(x => x.coupon));
            couponRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.groupBuy != null).Sum(x => x.groupBuy));
            groupBuyRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.zero != null).Sum(x => x.zero));
            discountRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.server != null).Sum(x => x.server));
            serverRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.deducted != null).Sum(x => x.deducted));
            otherRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            tmp_Money = Convert.ToDouble(accountList.Where(x => x.wipeZero != null).Sum(x => x.wipeZero));
            wipeRow[3] = tmp_Money.ToString();
            act_money += tmp_Money;

            dgv.Rows.Add(cashRow);
            dgv.Rows.Add(bankRow);
            dgv.Rows.Add(cardRow);
            dgv.Rows.Add(couponRow);
            dgv.Rows.Add(groupBuyRow);
            dgv.Rows.Add(discountRow);
            dgv.Rows.Add(serverRow);
            dgv.Rows.Add(otherRow);
            dgv.Rows.Add(wipeRow);
            trow[3] = act_money.ToString("0");
            dgv.Rows.Add(trow);

            BathClass.set_dgv_fit(dgv);
        }