当前位置: 首页>>代码示例>>C#>>正文


C# ReportDocument.PrintToPrinter方法代码示例

本文整理汇总了C#中CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.PrintToPrinter方法的具体用法?C# ReportDocument.PrintToPrinter怎么用?C# ReportDocument.PrintToPrinter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CrystalDecisions.CrystalReports.Engine.ReportDocument的用法示例。


在下文中一共展示了ReportDocument.PrintToPrinter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CustomerStatement


//.........这里部分代码省略.........
            lDate = System.Date.FromOADate(lDate.ToOADate() + 10);
            lDate = DateAndTime.DateSerial(DateAndTime.Year(lDate), DateAndTime.Month(lDate), 1);
            lDate = System.Date.FromOADate(lDate + rs.Fields("Company_PaymentDay").Value - 1);
            //Report.txtPaymentDate.SetText Format(lDate, "dd mmm yyyy")

            lAddress = Strings.Replace(rs.Fields("Company_PhysicalAddress").Value, Constants.vbCrLf, ", ");
            if (Strings.Right(lAddress, 2) == ", ") {
                lAddress = Strings.Left(lAddress, Strings.Len(lAddress) - 2);
            }
            Report.Database.Tables(1).SetDataSource(rs);
            Report.SetParameterValue("txtAddress", lAddress);
            lNumber = "";
            if (!string.IsNullOrEmpty(rs.Fields("Company_Telephone").Value))
                lNumber = lNumber + "Tel: " + rs.Fields("Company_Telephone").Value;
            if (!string.IsNullOrEmpty(rs.Fields("Company_Fax").Value)) {
                if (!string.IsNullOrEmpty(lNumber))
                    lNumber = lNumber + " / ";
                lNumber = lNumber + "Fax: " + rs.Fields("Company_Fax").Value;
            }
            if (!string.IsNullOrEmpty(rs.Fields("Company_Email").Value)) {
                if (!string.IsNullOrEmpty(lNumber))
                    lNumber = lNumber + " / ";
                lNumber = lNumber + "Email: " + rs.Fields("Company_Email").Value;
            }
            Report.SetParameterValue("txtNumbers", lNumber);

            //New banking details
            if (Information.IsDBNull(rs.Fields("Company_BankName").Value)) {
            } else {
                Report.SetParameterValue("txtBankName", rs.Fields("Company_BankName"));
            }

            if (Information.IsDBNull(rs.Fields("Company_BranchName").Value)) {
            } else {
                Report.SetParameterValue("txtBranchName", rs.Fields("Company_BranchName"));
            }

            if (Information.IsDBNull(rs.Fields("Company_BranchCode").Value)) {
            } else {
                Report.SetParameterValue("txtBranchCode", rs.Fields("Company_BranchCode"));
            }

            if (Information.IsDBNull(rs.Fields("Company_AccountNumber").Value)) {
            } else {
                Report.SetParameterValue("txtAccountNumber", rs.Fields("Company_AccountNumber"));
            }
            //...................

            rsCompany = new ADODB.Recordset();
            rsCompany.Open("SELECT * FROM Customer Where CustomerID = " + id, cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);
            Report.Database.Tables(2).SetDataSource(rsCompany);

            rsTransaction = new ADODB.Recordset();
            //rsTransaction.Open "SELECT CustomerTransaction.*, TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" & id & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText
            rsTransaction.Open("SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName," + " TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + id + "));", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);

            //Report.Database.Tables(3).SetDataSource rsTransaction, 3
            if (rsTransaction.BOF | rsTransaction.EOF) {
                rsTransaction = new ADODB.Recordset();
                rsTransaction.Open("SELECT 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0," + " 0, 0 AS debit, 0 AS credit;", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);
                Report.Database.Tables(3).SetDataSource(rsTransaction);
                //Exit Sub
            } else {
                Report.Database.Tables(3).SetDataSource(rsTransaction);
            }

            if (rsTransaction.BOF | rsTransaction.EOF) {
                return;
            }

            rsInterest = new ADODB.Recordset();
            rsInterest.Open("SELECT * FROM Interest WHERE (((CustomerID)=" + id + ")) and (Debit>0);", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);

            //If rsInterest.BOF Or rsInterest.EOF Then
            if (rsInterest.RecordCount > 0) {
                //Report.Field20.Top = 280
                //Report.Field21.Top = 280
                //Report.Field22.Top = 280
                //Report.Field23.Top = 280

                Report.Database.Tables(4).SetDataSource(rsInterest);
            } else {
                rsInterest = new ADODB.Recordset();
                rsInterest.Open("SELECT 0 AS CustomerID, 0 AS CDate, 0 AS Description, 0 AS Debit, 0 AS Credit, 0 AS SumIntBal ;", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText);
                //Report.Field20.Suppress = True
                //Report.Field21.Suppress = True
                //Report.Field22.Suppress = True
                //Report.Field23.Suppress = True
                Report.Database.Tables(4).SetDataSource(rsInterest);

                //Exit Sub
                //Set rsInterest = New Recordset
                //rsInterest.Open "SELECT * FROM Interest WHERE (((CustomerID)=" & id & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText
            }

            //Report.PrintOut(False, 1)
            Report.PrintToPrinter(1, false, 0, 0);

            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:101,代码来源:frmCustomerStatementRun.cs


注:本文中的CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。