private void Form_codeprint_Load(object sender, EventArgs e)
        {
            if (Program.bcode_x != 0)
            {
                numericUpDown1.Value = Program.bcode_x;
                numericUpDown2.Value = Program.bcode_y;
                numericUpDown3.Value = Program.bcode_count;
                numericUpDown4.Value = Program.bcode_scale;
                numericUpDown5.Value = Program.bcode_range;
            }
            //bcode_w.Text = Program.bcode_w.ToString();
            //bcode_h.Text = Program.bcode_h.ToString();

            txt_tjdw.Text = Program.now_tjdwmc;//by zhz
            txt_tjdw.Tag  = Program.now_tjdwid;

            dgv_tjdjb.AutoGenerateColumns = false;
            LisBiz   lisbiz = new LisBiz();
            DateTime dt     = Convert.ToDateTime(lisbiz.Get_ServerDate());

            dtp_begin.Value = dt;
            dtp_end.Value   = dt;
            List <string> listprint = Common.Common.GetPrinterInfo();

            if (listprint != null && listprint.Count > 0)
            {
                cboxPrinter.Items.AddRange(listprint.ToArray());
                cboxPrinter.SelectedIndex = 0;
            }
        }
Beispiel #2
0
        private void bt_gx_Click(object sender, EventArgs e)
        {
            LisBiz lisbiz = new LisBiz();

            lisbiz.Exec_Gxdzm();
            MessageBox.Show("¸üгɹ¦£¡");
        }
        private void bt_save_Click(object sender, EventArgs e)
        {
            string tjmxxm  = txt_tjxtbh.Text.Trim();
            LisBiz lisbiz1 = new LisBiz();

            lisbiz1.str_Delete_TJ_JGXMDZB(tjmxxm);
            dt_TJ_JGXMDZB.AcceptChanges();
            foreach (DataRow dr in dt_TJ_JGXMDZB.Rows)
            {
                string jyjx = dr["jyjx"].ToString().Trim();
                string gjc  = dr["gjc"].ToString().Trim();
                string sm   = dr["sm"].ToString().Trim();
                if (jyjx != "" && gjc != "")
                {
                    lisbiz1.str_Insert_TJ_JGXMDZB(tjmxxm, jyjx, gjc, sm);
                }
            }
            lisbiz1.Exec_ArrayList();
            MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        public void printDocument(DataTable dt)
        {
            if (cboxPrinter.SelectedItem == null)
            {
                MessageBox.Show("请选择打印机。");
                return;
            }
            DataTable printnowdata = dt;

            if (printnowdata.Rows.Count > 0)//存在记录
            {
                //林修改于2016-01-28 打印条码 结合实际调整
                for (int i = 0; i < printnowdata.Rows.Count; i++)
                {
                    try
                    {
                        /*
                         * PrintDocument pd = new PrintDocument();
                         * pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
                         * header = "";
                         * footer = printnowdata.Rows[i]["xm"].ToString().Trim() + "  " + printnowdata.Rows[i]["xb"].ToString().Trim() + "  " + printnowdata.Rows[i]["nl"].ToString().Trim();
                         * barcode = printnowdata.Rows[i]["tjbh"].ToString().Trim();
                         * header = printnowdata.Rows[i]["tjbh"].ToString().Trim();
                         * for (int j = 0; j < numericUpDown3.Value; j++)
                         * {
                         *  pd.DocumentName = "条码打印";
                         *  pd.PrinterSettings.PrinterName = cboxPrinter.SelectedItem.ToString();
                         *  pd.Print();
                         * }
                         * */

                        header  = "";
                        barcode = printnowdata.Rows[i]["tjbh"].ToString().Trim();
                        header  = printnowdata.Rows[i]["tjbh"].ToString().Trim();
                        footer  = printnowdata.Rows[i]["xm"].ToString().Trim() + "" + printnowdata.Rows[i]["xb"].ToString().Trim() + "" + printnowdata.Rows[i]["nl"].ToString().Trim();

                        PrintDocument printDocument1 = new PrintDocument();
                        printDocument1.PrintPage += printDocument1_PrintPage;
                        printDocument1.PrinterSettings.PrinterName = cboxPrinter.SelectedItem.ToString();
                        printDocument1.PrintController             = new System.Drawing.Printing.StandardPrintController();
                        printDocument1.OriginAtMargins             = true;
                        System.Drawing.Printing.Margins margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
                        printDocument1.DefaultPageSettings.Margins = margins;
                        System.Drawing.Printing.PaperSize paperSize = new System.Drawing.Printing.PaperSize();
                        paperSize.Height = 160;
                        paperSize.Width  = 750;

                        frmLabel = new Form_label(header, footer, barcode, (int)numericUpDown5.Value);
                        printDocument1.Print();


                        //更改为已打印状态
                        LisBiz lisprint = new LisBiz();
                        lisprint.UpdatePrintLabel(header);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("打印异常:" + ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        continue;
                    }
                }
            }
            else
            {
                MessageBox.Show("请勾选需要打印的体检人员。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }