public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { moban rpt = new moban(); rpt.Site = this.Site; return(rpt); }
/// <summary> /// 打印 /// </summary> /// <param name="cache">订单号</param> private void printShow(string cache) { OrdersInfo newinfo = new OrdersInfo(cache); moban newmoban = new moban(); //收货人姓名 TextObject RecevieName = (TextObject)newmoban.ReportDefinition.ReportObjects["RecevieName"]; RecevieName.Text = newinfo.RecevieName.Text.ToString(); //收货人电话 TextObject ReceiveTel = (TextObject)newmoban.ReportDefinition.ReportObjects["ReceiveTel"]; ReceiveTel.Text = newinfo.ReceiveTel.Text.ToString(); //提货点名称 TextObject PickPointName = (TextObject)newmoban.ReportDefinition.ReportObjects["PickPointName"]; PickPointName.Text = newinfo.PickPointName.Text.ToString(); //订单号 TextObject OrderNo = (TextObject)newmoban.ReportDefinition.ReportObjects["OrderNo"]; OrderNo.Text = "*" + newinfo.OrderNo.Text.ToString() + "*"; //订单详情 TextObject commidityInfo = (TextObject)newmoban.ReportDefinition.ReportObjects["commidityInfo"]; for (int count = 0; count < newinfo.dataGridView1.RowCount - 1; count++) { commidityInfo.Text += (count + 1).ToString() + "," + newinfo.dataGridView1.Rows[count].Cells["GoodsName"].Value.ToString() + "\n" + "数量:" + newinfo.dataGridView1.Rows[count].Cells["GoodsNum"].Value.ToString() + "份" + " " + "¥:" + newinfo.dataGridView1.Rows[count].Cells["Subtotal"].Value.ToString() + "\n"; } //小计 TextObject subtotal = (TextObject)newmoban.ReportDefinition.ReportObjects["subtotal"]; subtotal.Text = "商品总价¥:" + newinfo.TotalMoney.Text.ToString() + "\n" + "-优惠抵扣¥:" + newinfo.CouponsMoney.Text.ToString() + "\n" + "-余额支付¥:" + newinfo.BanlanceMoney.Text.ToString() + "\n" + "=实际支付¥:" + newinfo.PayMoney.Text.ToString() + "\n"; //下单时间 TextObject PayTime = (TextObject)newmoban.ReportDefinition.ReportObjects["PayTime"]; PayTime.Text = newinfo.OrderTime.Text.ToString(); //表尾 //收货人姓名2 TextObject RecevieName2 = (TextObject)newmoban.ReportDefinition.ReportObjects["RecevieName2"]; RecevieName2.Text = newinfo.RecevieName.Text.ToString(); //收货人电话2 TextObject ReceiveTel2 = (TextObject)newmoban.ReportDefinition.ReportObjects["ReceiveTel2"]; ReceiveTel2.Text = newinfo.ReceiveTel.Text.ToString(); //提货点名称2 TextObject PickPointName2 = (TextObject)newmoban.ReportDefinition.ReportObjects["PickPointName2"]; PickPointName2.Text = newinfo.PickPointName.Text.ToString(); TextObject OrderNo2 = (TextObject)newmoban.ReportDefinition.ReportObjects["OrderNo2"]; OrderNo2.Text = "*" + newinfo.OrderNo.Text.ToString() + "*"; //crystalReportViewer1.ReportSource = newinfo; //crystalReportViewer1.Show(); //newinfo.PrintOptions.PrinterName= //newinfo.PrintOptions.PrinterName = printerName; // 设置打印机名称 System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument(); //List<string> Printer = new List<string>(); //LocalPrinter.GetLocalPrinters(); //foreach (string fPrinterName in Printing.LocalPrinter.GetLocalPrinters()) //{ // Printer.Add(fPrinterName); //} ////doc.PrinterSettings.PrinterName = "Foxit Reader PDF Printer"; //doc.PrinterSettings.PrinterName = Printer[0].ToString(); int rawKind = 1; for (int i = 0; i <= doc.PrinterSettings.PaperSizes.Count - 1; i++) { if (doc.PrinterSettings.PaperSizes[i].PaperName == "xiannvguo") { rawKind = doc.PrinterSettings.PaperSizes[i].RawKind; } } newmoban.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;; // 设置打印纸张样式 newmoban.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.DefaultPaperOrientation; //默认纸张方向 newmoban.PrintToPrinter(1, false, 1, 1); }
private void button5_Click(object sender, EventArgs e) { if (KindView == 1) { if (KindView == 1) //写入配货员编码 { dataBase sqlConn = new dataBase(); #region if (sqlConn.checkId(stockOrOrder.Text.ToString())) //检查是否有配货员id { if (sqlConn.checkedStokUperCodeOrder(stockOrOrder.Text.ToString())) { MessageBox.Show("此售货员正在备货"); return; } //变更状态 if (sqlConn.WriteOrderState(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString(), 1) && sqlConn.WriteShoppingId(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString(), stockOrOrder.Text.ToString()) == 1) { moban newmoban = new moban(); printShow(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString(), 0, newmoban); //打印 //写入日志 Log_Order_info newLog = new Log_Order_info(); newLog = sqlConn.Log_Getinfo(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString()); newLog.Remark = "订单管理工具"; newLog.Creater = sqlConn.searchContent("ManageName", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount"); newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount")); newLog.Pubtime = DateTime.Now.ToString(); sqlConn.Write_Log(newLog); stockOrOrder.Text = "订单" + dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString() + "已由备货员" + stockOrOrder.Text.ToString() + "开始备货"; weifahuoShow(); } else { stockOrOrder.Text = "订单" + dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString() + "备货失败"; } } else { stockOrOrder.Text = "没有该配货员"; } #endregion return; } } if (KindView == 2) { if (KindView == 2) //写入配货员编码 { dataBase sqlConn = new dataBase(); #region if (sqlConn.checkOrder(stockOrOrder.Text.ToString())) //检查是否有此订单 { //变更状态 if (sqlConn.WriteOrderState(stockOrOrder.Text.ToString(), 2) && sqlConn.WriteCheckerCodeId(stockOrOrder.Text.ToString(), adminId) == 1) { //printShow(stockOrOrder.Text.ToString());//打印 //写入日志 Log_Order_info newLog = new Log_Order_info(); newLog = sqlConn.Log_Getinfo(stockOrOrder.Text.ToString()); newLog.Remark = "订单管理工具"; newLog.Creater = sqlConn.searchContent("ManageName", "ManageTel", adminId, "yl_ManageAccount"); newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", adminId, "yl_ManageAccount")); newLog.Pubtime = DateTime.Now.ToString(); sqlConn.Write_Log(newLog); stockOrOrder.Text = "订单" + stockOrOrder.Text.ToString() + "检验成功"; beihuozhongShow(); } else { stockOrOrder.Text = "检验失败"; } } else { stockOrOrder.Text = "没有该订单"; } #endregion return; } } if (KindView == 0) { searchOrder(stockOrOrder.Text.ToString()); stockOrOrder.Focus(); return; } }