private void LadBillReportButton_Click(object sender, EventArgs e) { try { bool isCanceldedLadBill = (bool)LadBillWithTrafficGridView.CurrentRow.Cells["colCanceled_bit"].Value; if (isCanceldedLadBill && HPS.Common.CurrentUser.user.UserGroupID_int != 1) { throw new ApplicationException("این مجوز باطل شده و امکان چاپ ندارد"); } HPS.Reports.Forms.StimulViewer frm = new StimulViewer(1, (Int32)this.LadBillWithTrafficGridView.CurrentRow.Cells["LadBillCreditID_int"].Value); frm.ShowDialog(); //stiViewerControl1.Document = rpt.Document; //rpt.Document.Printer.PrinterName = string.Empty; //rpt.Document.Printer.PaperSize.Height = 14; //rpt.Document.Printer.PaperSize.Width = 17; //stiViewerControl1.Document.Printer.PrinterSettings.Copies = 3; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void PrintStripButton_Click(object sender, EventArgs e) { try { //if (FromDatefaDatePicker.IsNull) //{ // throw new ApplicationException("از تاریخ خالی است"); //} //else if (ToDatefaDatePicker.IsNull) //{ // throw new ApplicationException("تا تاریخ خالی است"); //} //Hepsa.Core.Validation.DateRule<string> FromDateValidator = new Hepsa.Core.Validation.DateRule<string>("FromDate", "از تاریخ", null, null); //if (FromDateValidator.Validate(FromDatefaDatePicker.Text) == false) // throw new ApplicationException(FromDateValidator.Description); //Hepsa.Core.Validation.DateRule<string> ToDateValidator = new Hepsa.Core.Validation.DateRule<string>("ToDate", "تا تاریخ", null, null); //if (ToDateValidator.Validate(ToDatefaDatePicker.Text) == false) // throw new ApplicationException(ToDateValidator.Description); //HPS.Reports.ReportDoc.AllAcceptedTurnReport rpt = null; //if (WithProductionYear == true) //{ // rpt = new HPS.Reports.ReportDoc.AllAcceptedTurnReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, true); // rpt.Document.Printer.PrinterName = string.Empty; // rpt.Run(); //} //else //{ // rpt = new HPS.Reports.ReportDoc.AllAcceptedTurnReport(FromDatefaDatePicker.Text, ToDatefaDatePicker.Text, false); // rpt.Document.Printer.PrinterName = string.Empty; // rpt.Run(); //} //Properties.Settings s = new HPS.Properties.Settings(); //if (string.IsNullOrEmpty(s.PrinterName)) //{ // rpt.Document.Print(true, true, true); //} //else //{ // rpt.Document.Printer.PrinterName = s.PrinterName; // rpt.Document.Print(false, true, true); //} HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); string Condition = string.Empty; if (WithProductionYear == true) { Condition = " T1.Area_bit=1 And [T1].[TurnAccepted_bit]='true' AND [T1].[TrafficTypeID_int]=1 AND (T1.TurnDate_nvc>='" + FromDatefaDatePicker.Text + "') AND (T1.TurnDate_nvc<='" + ToDatefaDatePicker.Text + "') AND T1.ProductionYear_int IS NOT NULL"; } else { Condition = "T1.Area_bit=1 And [T1].[TurnAccepted_bit]='true' AND [T1].[TrafficTypeID_int]=1 AND (T1.TurnDate_nvc>='" + FromDatefaDatePicker.Text + "') AND (T1.TurnDate_nvc<='" + ToDatefaDatePicker.Text + "')"; } AllAcceptedTurnstiReport.Dictionary.Synchronize(); AllAcceptedTurnstiReport.Dictionary.Databases.Clear(); AllAcceptedTurnstiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString)); AllAcceptedTurnstiReport.Compile(); AllAcceptedTurnstiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys() { SettingID_int = 1029 }).Value_nvc.ToString(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); AllAcceptedTurnstiReport["fromdate_vc"] = FromDatefaDatePicker.Text; AllAcceptedTurnstiReport["todate_vc"] = ToDatefaDatePicker.Text; AllAcceptedTurnstiReport["date_vc"] = PortPlaceFactory.ServerJalaliDate + " " + PortPlaceFactory.ServerTime;; AllAcceptedTurnstiReport["UserName_vc"] = HPS.Common.CurrentUser.user.UserName_nvc; AllAcceptedTurnstiReport["fromTrafficNumber"] = TrafficNumber_binttextBox.Text; AllAcceptedTurnstiReport["@condition_nvc"] = Condition; AllAcceptedTurnstiReport.Render(); HPS.Reports.Forms.StimulViewer frm = new StimulViewer(AllAcceptedTurnstiReport); frm.Show(); //Properties.Settings s = new HPS.Properties.Settings(); //System.Drawing.Printing.PrinterSettings PrinterSetting = new System.Drawing.Printing.PrinterSettings(); //if (string.IsNullOrEmpty(s.PrinterName)) // AllAcceptedTurnstiReport.Print(true); //else //{ // PrinterSetting.PrinterName = s.PrinterName; // AllAcceptedTurnstiReport.Print(false, PrinterSetting); //} //this.Close(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }