Пример #1
0
        private void reportPrint(List <titletable> title, List <TB_EXPENSE> detail, List <foots> fs)
        {
            try
            {
                ReportTools     myReportTool;
                TfrxReportClass report;
                myReportTool = new ReportTools();
                report       = new TfrxReportClass();
                report.ClearDatasets();
                FrxDataTable titleable = new FrxDataTable("dtWorkTitle");      //概要
                myReportTool.ListToFrxTable(title, titleable);
                FrxDataTable detailtable = new FrxDataTable("dtWorkDetail");   //明细
                myReportTool.ListToFrxTable(detail, detailtable);
                FrxDataTable detailtable2 = new FrxDataTable("dtWorkDetail2"); //明细2
                myReportTool.ListToFrxTable(fs, detailtable2);
                report.LoadReportFromFile("ExpenseReport.fr3");

                detailtable.AssignToReport(true, report);
                titleable.AssignToReport(true, report);
                report.ShowReport();
            }
            catch (System.Exception ex)
            {
                MessageHelper.ShowMessage(ex.Message);
            }
        }
Пример #2
0
        private void button7_Click(object sender, EventArgs e)
        {
            TfrxReportClass report;

            report = new TfrxReportClass();
            report.ReportOptions.ConnectionName = @"Database=database1;Data Source=127.0.0.1;User Id=root;Password="******"C:/Users/Asus/Desktop/2.fr3");
            // report.DesignReport(); редактирование отчета
            report.ShowReport();
            report.PrintOptions.PageNumbers = "";
            report.ExportToTXT("export2.txt", true, true, true, true);
        }
Пример #3
0
 private void reportPrint(List <projProfileClass> summery, List <TB_EXPENSE> detail)
 {
     try
     {
         ReportTools     myReportTool;
         TfrxReportClass report;
         myReportTool = new ReportTools();
         report       = new TfrxReportClass();
         report.ClearDatasets();
         FrxDataTable summeryTable = new FrxDataTable("dtWorkTitle");  //概要
         myReportTool.ListToFrxTable(summery, summeryTable);
         FrxDataTable detailtable = new FrxDataTable("dtWorkDetail");  //明细
         myReportTool.ListToFrxTable(detail, detailtable);
         report.LoadReportFromFile("profileReport.fr3");
         summeryTable.AssignToReport(true, report);
         detailtable.AssignToReport(true, report);
         report.ShowReport();
     }
     catch (System.Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
Пример #4
0
        private void printpq(string barcode, string strJz)
        {
            string scriptstr = "";
            string ph, gg, pch, jz, rq, bb, gh, bz, xlh, tm, ckcxh, sx, pcxx, bzstr, bbtemp, printmodual, stpath, tct, wlh;
            bool   ckflg, nocheck;
            int    iType;

            if (chkTSXX.Checked)
            {
                if (chkCPDJ.Checked)
                {
                    iType = 4;
                }
                else
                {
                    iType = 3;
                }
            }
            else
            {
                if (chkCPDJ.Checked)
                {
                    iType = 2;
                }
                else
                {
                    iType = 1;
                }
            }
            printmodual = Public.GetXmlValue("PrintModuleName");
            if (printmodual == "")
            {
                printmodual = "标准模板";
            }
            stpath = Application.StartupPath + "\\report\\" + printmodual + "\\";
            if (!Directory.Exists(stpath))
            {
                MessageBox.Show("标签模板不存在!", "系统提示");
                return;
            }



            string  strSql = "select * from " + tablename + " where barcode='" + barcode.Trim() + "'";
            DataSet ds     = DbEntry.Context.ExecuteDataset(strSql);

            ph   = ds.Tables[0].Rows[0]["PH"].ToString();
            gg   = ds.Tables[0].Rows[0]["GG"].ToString();
            pch  = ds.Tables[0].Rows[0]["PCH"].ToString();
            jz   = strJz;
            rq   = ds.Tables[0].Rows[0]["ProduceData"].ToString();
            bb   = ds.Tables[0].Rows[0]["bb"].ToString();
            pcxx = ds.Tables[0].Rows[0]["pcinfo"].ToString();
            gh   = Convert.ToInt32(ds.Tables[0].Rows[0]["gh"]).ToString().PadLeft(2, '0');
            sx   = ds.Tables[0].Rows[0]["SX"].ToString();
            if (sx.ToUpper() == "CK")
            {
                bz = ds.Tables[0].Rows[0]["GH"].ToString().PadLeft(2, '0');
            }
            else
            {
                bz = ds.Tables[0].Rows[0]["bz"].ToString();
            }
            xlh   = this.txtLSH.Text;
            tm    = barcode;
            wlh   = ds.Tables[0].Rows[0]["wlh"].ToString();
            ckcxh = ds.Tables[0].Rows[0]["ckcxh"].ToString();

            if ((sx == "B2") || (sx == "C2"))
            {
                nocheck = false;
            }
            else
            {
                nocheck = true;
            }

            TfrxReportClass Report = new TfrxReportClass();

            scriptstr = "begin" + "\r\n";
            if (sx == "CK")
            {
                Report.LoadReportFromFile(stpath + "ckcz.fr3");
                scriptstr += "memspec.Text:='" + pcxx + "';";
                if (this.chkTSXX.Checked)
                {
                    scriptstr += "memspec.visible:=true;";
                }
                else
                {
                    scriptstr += "memspec.visible:=false;";
                }
            }
            else
            {
                switch (iType)
                {
                case 1:
                    Report.LoadReportFromFile(stpath + "ptcz1.fr3");
                    break;

                case 2:
                    Report.LoadReportFromFile(stpath + "ptcz2.fr3");
                    scriptstr += "memosx.text:='" + sx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memosx.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memosx.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;

                case 3:
                    Report.LoadReportFromFile(stpath + "ptcz3.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                    }
                    break;

                case 4:
                    Report.LoadReportFromFile(stpath + "ptcz4.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;
                }
            }

            scriptstr += "Barcode1.text:='" + tm + "';";
            scriptstr += "memoph.text:='" + ph + "';";
            scriptstr += "memogg.text:='" + gg + "';";
            scriptstr += "memopch.text:='" + pch + "';";
            double fjz = Convert.ToDouble(jz);;

            scriptstr += "memojz.text:='" + fjz.ToString() + " kg';";
            scriptstr += "memorq.text:='" + rq + "';";
            scriptstr += "memogh.text:='" + gh + "';";
            //bbtemp = "";
            //if (bb == "甲班") bbtemp = "A";
            //if (bb == "乙班") bbtemp = "B";
            //if (bb == "丙班") bbtemp = "C";
            //if (bb == "丁班") bbtemp = "D";
            //scriptstr += "memobb.text:='" + bbtemp + "';";

            //如果炉号为空,则再次查询nc
            if (txtheatid.Text.Trim() == "")
            {
                string loadSql = "";
                loadSql += "select mm_wr_b.pch,getbilletbatchcode(mm_wr_b.pch) billet_heat_number,";
                loadSql += " mm_po.xsddh customer_material_number";
                loadSql += " from mm_wr_b mm_wr_b, mm_mo mm_mo, mm_mosource mm_mosource, mm_po mm_po";
                loadSql += "  where mm_wr_b.scddid = mm_mo.pk_moid and mm_mo.pk_moid = mm_mosource.scddid";
                loadSql += "  and mm_mosource.lyid = mm_po.pk_poid  and mm_po.pk_corp = '1001'";
                loadSql += " and mm_po.dr = 0  and mm_mosource.pk_corp = '1001' and mm_mosource.dr = 0 ";
                loadSql += "  and mm_mo.pk_corp = '1001' and mm_mo.dr = 0 and mm_wr_b.pk_corp = '1001'";
                loadSql += "  and mm_wr_b.dr = 0  and mm_wr_b.pch = '" + pch + "'";
                //OracleConnection conn = new OracleConnection("Data Source=192.168.2.221/orcl;User ID=nctest;Password=nctest;");

                //OracleConnection conn = new OracleConnection("Data Source=nctest;User ID=nctest;Password=nctest;");
                OracleConnection conn = new OracleConnection("Data Source=ncv5;User ID=xgerp50;Password=xgerp204212350;");
                conn.Open();
                OracleCommand selectCmd = conn.CreateCommand();
                selectCmd.CommandText = loadSql;
                // selectCmd.BindByName = true;

                OracleDataAdapter oradap = new OracleDataAdapter(selectCmd);
                DataSet           ds1    = new DataSet();
                oradap.Fill(ds1);
                conn.Close();
                if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
                {
                }
                else
                {
                    txtheatid.Text   = ds1.Tables[0].Rows[0]["billet_heat_number"].ToString();
                    txtGgHeatid.Text = ds1.Tables[0].Rows[0]["billet_heat_number"].ToString();
                    txtliaohao.Text  = ds1.Tables[0].Rows[0]["customer_material_number"].ToString();
                }
            }


            //库内补打 料号判断  异常情况料号置空
            if ((txtliaohao.Text.ToString().Trim() != "") && (tablename == "WMS_Bms_Inv_Info"))
            {
                string sql = " SELECT invinfo.WGDH FROM WMS_Bms_Inv_Info AS invinfo LEFT OUTER JOIN WMS_Bms_Rec_WGD AS wgd ON invinfo.PCH = wgd.PCH WHERE (invinfo.WLH = wgd.YWLH) AND (invinfo.vfree1 = wgd.vfree1) AND ";

                sql += "  (wgd.yvfree1 = wgd.vfree1) AND (invinfo.vfree2 = wgd.vfree2) AND  (wgd.yvfree2 = wgd.vfree2) AND (invinfo.vfree3 = wgd.vfree3) AND (wgd.yvfree3 = wgd.vfree3) AND (invinfo.SX IN ('AAA', 'AA', 'A', 'CK')) AND ";
                sql += " invinfo.barcode='" + barcode.Trim() + "'";
                DataSet dstable = DbEntry.Context.ExecuteDataset(sql);
                if ((dstable == null) || (dstable.Tables.Count == 0) || dstable.Tables[0].Rows.Count == 0)
                {
                    txtliaohao.Text = "";
                }
            }

            if (txtliaohao.Text.ToString().Trim() != "")
            {
                scriptstr += "Memliao.text:='" + txtliaohao.Text.ToString().Trim() + "';";
                scriptstr += "Memliao.visible:=true;";
                scriptstr += "memliao1.visible:=true;";
                scriptstr += "Lineliao.visible:=true;";
            }

            //修改添加 炉次 删除班别
            scriptstr += "memobb.text:='" + txtheatid.Text.ToString().Trim() + "';";


            if (sx != "CK")
            {
                string bzstrf = "";
                bzstrf     = bz.Substring(bz.IndexOf('~') + 1);
                scriptstr += "memobz.text:='" + bzstrf + "';";
            }
            else
            {
                scriptstr += "memoxlh.text:='" + xlh + "';";
            }
            scriptstr        += "memowlh.text:='" + wlh.Substring(0, 3) + "';";
            scriptstr        += "end.";
            Report.ScriptText = scriptstr;
            Report.PrepareReport(true);
            int con = 2;

            if (this.numTxt.Value > 0)
            {
                con = int.Parse(numTxt.Value.ToString());
            }
            Report.PrintOptions.ShowDialog = false;
            Report.PrintOptions.Copies     = con;
            try
            {
                if (this.chkBowse.Checked)
                {
                    Report.ShowReport();
                }
                else
                {
                    Report.PrintReport();
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("打印错误:" + ex.Message + ".请补打!");
            }
        }
Пример #5
0
 public static void Preview(TfrxReportClass report)
 {
     report.PrepareReport(true);
     report.ShowReport();
 }