Beispiel #1
0
        private void UCWarehouseSummariz_Load(object sender, EventArgs e)
        {
            ReportCommon.BindWarehouseType(cboOrderType);
            CommonFuncCall.BindCompany(cboCompany, "全部");     //绑定公司
            CommonFuncCall.BindWarehouse(cboWarehouse, "全部"); //绑定仓库

            BindData();
        }
Beispiel #2
0
        private void UCWarehouseDetail_Load(object sender, EventArgs e)
        {
            ReportCommon.BindWarehouseType(cboOrderType);
            CommonFuncCall.BindCompany(cboCompany, "全部");     //绑定公司
            CommonFuncCall.BindWarehouse(cboWarehouse, "全部"); //绑定仓库

            BindData();

            //双击查看明细,要手动调用权限
            if (this.Name != "CL_BusinessAnalysis_Stock_WarehouseDet")
            {
                base.RoleButtonStstus("CL_BusinessAnalysis_Stock_WarehouseDet");
            }
        }
        public static void Generate(Report report, string fileSaveDirectory, Application app)
        {
            // generates the report in the specified reportFormat with the
            // specified report.Filename saves it in fileSaveDirectory and always overwrites it
            string cleanFilename = report.Filename.TrimStart('\\');
            string cleanPath     = fileSaveDirectory.TrimEnd('\\');

            // gen up the Word objects we need
            Document  document = app.Documents.Add();
            Paragraph paragraph;

            // load our styles into the document
            ReportCommon.LoadDocumentStyles(document);

            try
            {
                // build the report document

                // add header
                // get a handle to the first paragraph
                paragraph = document.Paragraphs[document.Paragraphs.Count];
                paragraph.set_Style(document.Styles["Header"]);
                paragraph.Range.Text  = "Sample Report";
                paragraph.Range.Text += "Header";

                // add body
                // add paragraph and get a handle to the paragraph
                document.Paragraphs.Add();
                paragraph = document.Paragraphs[document.Paragraphs.Count];
                paragraph.set_Style(document.Styles["CustomStyle"]);
                paragraph.Range.Text = "Report Body";

                // save the document
                document.SaveAs2(Path.Combine(cleanPath, cleanFilename) + "." + report.Extension, report.SaveFormat);
            }
            catch (Exception e)
            {
                throw new Exception("SampleReport.Generate: " + e.Message);
            }
            finally
            {
                // close and dispose of the writer if it exists
                document.Close(WdSaveOptions.wdDoNotSaveChanges);
            }
        } // Generate
        public static void Generate(Report report, string fileSaveDirectory, Application app)
        {
            // generates the report in the specified reportFormat with the
            // specified report.Filename saves it in fileSaveDirectory and always overwrites it
            string saveFilename = Path.Combine(fileSaveDirectory.TrimEnd('\\'), report.Filename.TrimStart('\\')) + "." + report.Extension;
            // gen up the Word objects we need
            Document document = app.Documents.Add();

            // load our styles into the document
            ReportCommon.LoadDocumentStyles(document);

            try
            {
                // build the report document
                // set the document properties
                ReportCommon.SetDocumentDefaultProperties(document, app);
                // add header
                AddDocumentHeader(document);
                // add body
                AddDocumentBody(document);
                // save the document
                document.SaveAs2(saveFilename, report.SaveFormat);
                // display ready message
                AppCommon.Log(report.Name + " ready. Open at: " + AppCommon.BuildUrl(AppCommon.GetAppEngineUrl(), report.Filename + "." + report.Extension, AppCommon.GetAppEnginePort()) + " .", EventLogEntryType.Information);
            }
            catch (Exception e)
            {
                string message = AppCommon.AppendInnerExceptionMessages("LoadsIndexViewReport.Generate: " + e.Message, e);
                message += " - Filename = " + saveFilename + "";
                throw new Exception(message);
            }
            finally
            {
                // close and dispose of the writer if it exists
                document.Close(WdSaveOptions.wdDoNotSaveChanges);
            }
        } // Generate