コード例 #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="pageWidth">打印页宽度, 以厘米为单位</param>
        /// <param name="pageHeight">打印页高度, 以厘米为单位</param>
        /// <param name="billReportInfo">单据类报表信息</param>
        public PrintReportBill(double pageWidth, double pageHeight, IBillReportInfo billReportInfo)
        {
            m_pageWidth      = pageWidth;
            m_pageHeight     = pageHeight;
            m_billReportInfo = billReportInfo;

            IPrintManagement printManagement = BasicServerFactory.GetServerModule <IPrintManagement>();

            S_PrintBillTable printInfo = new S_PrintBillTable();

            printInfo.Bill_ID                  = billReportInfo.BillNo;
            printInfo.Bill_Name                = billReportInfo.BillType;
            printInfo.PrintDateTime            = ServerModule.ServerTime.Time;
            printInfo.PrintFlag                = true;
            printInfo.PrintPersonnelCode       = BasicInfo.LoginID;
            printInfo.PrintPersonnelName       = BasicInfo.LoginName;
            printInfo.PrintPersonnelDepartment = BasicInfo.DeptName;

            if (billReportInfo.BillType != "")
            {
                if (!printManagement.AddPrintInfo(printInfo, out m_err))
                {
                    m_allowPrint = false;
                    MessageDialog.ShowPromptMessage(m_err);
                }
            }
        }
コード例 #2
0
        private void 打印单据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageDialog.ShowPromptMessage("请选择至少一条已入库记录后再行此操作");
                return;
            }

            int index = 0;

            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                if (row.Cells["单据状态"].Value.ToString() != OrdinaryInDepotBillStatus.已入库.ToString())
                {
                    continue;
                }

                IBillReportInfo report = null;

                if ((bool)row.Cells["需工装管理员验证"].Value)
                {
                    report = new 报表_普通入库单_工装验证类(row.Cells[0].Value.ToString(), labelTitle.Text, true);
                }
                else
                {
                    report = new 报表_普通入库单(row.Cells[0].Value.ToString(), labelTitle.Text, true);
                }

                PrintReportBill print = new PrintReportBill(21.8, 9.31, report);

                if (index++ > 0)
                {
                    print.ShowPrintDialog = false;
                }

                print.DirectPrintReport();
            }
        }