Esempio n. 1
0
        //打印账单
        private void printTool_Click(BathDBDataContext dc, string title)
        {
            List <string> printCols = new List <string>();

            printCols.Add("手牌");
            printCols.Add("项目名称");
            printCols.Add("技师");
            printCols.Add("单价");
            printCols.Add("数量");
            printCols.Add("金额");

            var ids = string.Join("|", m_Seats.OrderBy(x => x.text).Select(x => x.systemId).ToArray());
            var act = dc.Account.Where(x => x.systemId == ids && x.abandon == null).
                      OrderByDescending(x => x.payTime).FirstOrDefault();

            PrintBill.Print_DataGridView(act, title, dgvExpense, printCols, companyName);
        }
Esempio n. 2
0
        //重打账单
        private void CtxReprint_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            Seat seat = getContextSenderSeat(db_new, sender);

            if (seat.systemId == null || seat.status != 3)
            {
                BathClass.printErrorMsg("已经重新开牌,不能重打账单!");
                return;
            }

            var account = db_new.Account.FirstOrDefault(x => x.systemId.Contains(seat.systemId) && x.abandon == null);

            DataGridView dgv = new DataGridView();

            DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();

            col.HeaderText = "手牌号";
            dgv.Columns.Add(col);

            DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn();

            col1.HeaderText = "项目名称";
            dgv.Columns.Add(col1);

            DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn();

            col2.HeaderText = "技师";
            dgv.Columns.Add(col2);

            DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn();

            col3.HeaderText = "单价";
            dgv.Columns.Add(col3);

            DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn();

            col4.HeaderText = "数量";
            dgv.Columns.Add(col4);

            DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn();

            col5.HeaderText = "金额";
            dgv.Columns.Add(col5);

            var ids    = account.systemId.Split('|');
            var orders = db_new.Orders.Where(x => ids.Contains(x.systemId) && x.paid && x.deleteEmployee == null);

            foreach (var order in orders)
            {
                string[] row = new string[6];
                row[0] = order.text;
                row[1] = order.menu;
                row[2] = order.technician;

                var menu = db_new.Menu.FirstOrDefault(x => x.name == order.menu);
                if (menu != null)
                {
                    row[3] = menu.price.ToString();
                }

                row[4] = order.number.ToString();
                row[5] = order.money.ToString();
                dgv.Rows.Add(row);
            }

            List <string> printCols = new List <string>();

            printCols.Add("手牌");
            printCols.Add("项目名称");
            printCols.Add("技师");
            printCols.Add("单价");
            printCols.Add("数量");
            printCols.Add("金额");
            PrintBill.Print_DataGridView(account, "结账单", dgv, printCols, true, null, ops.companyName);
            PrintBill.Print_DataGridView(account, "结账单", dgv, printCols, true, null, ops.companyName);
        }
Esempio n. 3
0
        public static void reprint_bill(CSeat seat, DAO dao, bool use_pad)
        {
            if (seat.status != SeatStatus.PAIED)
            {
                BathClass.printErrorMsg("已经重新开牌,不能重打账单!");
                return;
            }

            var account = dao.get_account("abandon is null and systemId like '%" + seat.systemId + "%'");

            if (account == null)
            {
                return;
            }

            var    seats_txt = account.text.Split('|');
            string state_str = "";
            int    count     = seats_txt.Count();

            for (int i = 0; i < count; i++)
            {
                state_str += "text='" + seats_txt[i] + "'";
                if (i != count - 1)
                {
                    state_str += " or ";
                }
            }
            var           seats_reprint = dao.get_seats(state_str);
            List <string> m_rooms       = new List <string>();

            foreach (var s in seats_reprint)
            {
                m_rooms.Add(dao.get_seat_room(s.text));
            }

            DataGridView dgv = new DataGridView();

            DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();

            col.HeaderText = "手牌";
            dgv.Columns.Add(col);

            DataGridViewTextBoxColumn coll = new DataGridViewTextBoxColumn();

            coll.HeaderText = "房间";
            dgv.Columns.Add(coll);

            DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn();

            col1.HeaderText = "项目名称";
            dgv.Columns.Add(col1);

            DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn();

            col2.HeaderText = "技师";
            dgv.Columns.Add(col2);

            DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn();

            col3.HeaderText = "单价";
            dgv.Columns.Add(col3);

            DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn();

            col4.HeaderText = "数量";
            dgv.Columns.Add(col4);

            DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn();

            col5.HeaderText = "金额";
            dgv.Columns.Add(col5);

            List <string> printCols = new List <string>();

            printCols.Add("手牌");
            if (use_pad)
            {
                printCols.Add("房间");
            }

            printCols.Add("项目名称");
            printCols.Add("单价");
            printCols.Add("数量");
            printCols.Add("金额");

            var use_disAssemble = MConvert <bool> .ToTypeOrDefault(LogIn.options.启用大项拆分, false);

            var co_name = LogIn.options.companyName;

            if (account != null)
            {
                try
                {
                    var db     = new BathDBDataContext(LogIn.connectionString);
                    var orders = db.HisOrders.Where(x => x.deleteEmployee == null && x.accountId == account.id).OrderBy(x => x.text);
                    foreach (var order in orders)
                    {
                        var cmenu = db.Menu.FirstOrDefault(x => x.name == order.menu);
                        var price = "";
                        if (cmenu != null)
                        {
                            price = cmenu.price.ToString();
                            if (use_disAssemble && db.BigCombo.FirstOrDefault(x => x.menuid == cmenu.id) != null)
                            {
                                var substIDs = BathClass.disAssemble(db.BigCombo.FirstOrDefault(x => x.menuid == cmenu.id).substmenuid, Constants.SplitChar);
                                for (int i = 0; i < substIDs.Count; i++)
                                {
                                    var menu = db.Menu.FirstOrDefault(x => x.id == substIDs[i]);
                                    dgv.Rows.Add(order.text, order.roomId, menu.name, order.technician,
                                                 menu.price, order.number, menu.price * MConvert <double> .ToTypeOrDefault(order.number, 0));
                                }
                                continue;
                            }
                        }

                        dgv.Rows.Add(order.text, order.roomId, order.menu, order.technician, price, order.number, order.money);
                    }
                    PrintBill.Print_DataGridView(seats_reprint, m_rooms, account, "存根单", dgv, printCols, co_name);
                }
                catch (System.Exception ex)
                {
                    BathClass.printErrorMsg(ex.ToString());
                }
            }
            else
            {
                double money = 0;

                try
                {
                    var db     = new BathDBDataContext(LogIn.connectionString);
                    var orders = db.Orders.Where(x => x.text == seat.text && x.systemId != seat.systemId && x.deleteEmployee == null).OrderBy(x => x.text);
                    foreach (var order in orders)
                    {
                        var cmenu = db.Menu.FirstOrDefault(x => x.name == order.menu);
                        var price = "";
                        if (cmenu != null)
                        {
                            price = cmenu.price.ToString();
                        }

                        dgv.Rows.Add(order.text, order.roomId, order.menu, order.technician, price, order.number, order.money);
                    }

                    if (dgv.Rows.Count != 0)
                    {
                        BathClass.printErrorMsg("未检测到转账单或者结账单");
                        return;
                    }

                    PrintSeatBill.Print_DataGridView(seats_reprint, m_rooms, "", "转账确认单", dgv, printCols, money.ToString(), co_name);
                }
                catch (System.Exception ex)
                {
                    BathClass.printErrorMsg(ex.ToString());
                }
            }
        }