Beispiel #1
0
        public DataTable getPrintData(Nyuukin_Ichihanyou_Entity nie)
        {
            Dictionary <string, ValuePair> dic = new Dictionary <string, ValuePair>();

            dic.Add("@paystart", new ValuePair {
                value1 = SqlDbType.Date, value2 = nie.paymentstart
            });
            dic.Add("@payend", new ValuePair {
                value1 = SqlDbType.Date, value2 = nie.paymentend
            });
            dic.Add("@payinputstart", new ValuePair {
                value1 = SqlDbType.Date, value2 = nie.paymentinputstart
            });
            dic.Add("@payinputend", new ValuePair {
                value1 = SqlDbType.Date, value2 = nie.paymentinputend
            });
            dic.Add("@StoreName", new ValuePair {
                value1 = SqlDbType.VarChar, value2 = nie.cbo_store
            });
            dic.Add("@WebCollectType", new ValuePair {
                value1 = SqlDbType.VarChar, value2 = nie.cbo_torikomi
            });
            dic.Add("@CollectCustomerCD", new ValuePair {
                value1 = SqlDbType.VarChar, value2 = nie.search_customer
            });
            dic.Add("@Is_All", new ValuePair {
                value1 = SqlDbType.Int, value2 = nie.rdb_all
            });
            UseTransaction = true;
            return(SelectData(dic, "D_NyuuKinPrint"));
        }
 public NyuukinItiranHyou()
 {
     InitializeComponent();
     this.KeyUp += NyuukinItiranHyou_KeyUp;
     nih         = new Nyuukin_Ichihanyou_BL();
     previewForm = new Viewer();
     nie         = new Nyuukin_Ichihanyou_Entity();
     dtlog       = new DataTable();
 }
 protected Nyuukin_Ichihanyou_Entity GetNyuukinData()
 {
     nie = new Nyuukin_Ichihanyou_Entity();
     nie.paymentstart      = paymentstart.Text;
     nie.paymentend        = paymentend.Text;
     nie.cbo_store         = cbo_store.Text;
     nie.paymentinputstart = paymentinputstart.Text;
     nie.paymentinputend   = paymentinputend.Text;
     nie.cbo_torikomi      = String.IsNullOrWhiteSpace(cbo_torikomi.Text)? null : cbo_torikomi.SelectedValue.ToString().Equals("-1") ?  string.Empty : cbo_torikomi.SelectedValue.ToString();
     nie.search_customer   = search_customer.TxtCode.Text;
     nie.rdb_all           = rdb_all.Checked ? "1" : "0";
     return(nie);
 }
Beispiel #4
0
 public DataTable getPrintData(Nyuukin_Ichihanyou_Entity nie)
 {
     return(nidl.getPrintData(nie));
 }
        protected override void PrintSec()

        {
            // レコード定義を行う
            // DataTable table = new DataTable();



            if (ErrorCheck())
            {
                nie = GetNyuukinData();
                DataTable table = dtlog = nih.getPrintData(nie);

                try
                {
                    if (table == null)
                    {
                        return;
                    }

                    DialogResult ret;
                    var          Report = new DataSet.Nyuukin_Ichihanyou();

                    switch (PrintMode)
                    {
                    case EPrintMode.DIRECT:
                        ret = bbl.ShowMessage("Q202");
                        if (ret == DialogResult.Cancel)
                        {
                            return;
                        }
                        Report.SetDataSource(table);
                        Report.Refresh();
                        Report.SetParameterValue("txtStoreName", cbo_store.SelectedValue.ToString() + "  " + nie.cbo_store);
                        Report.SetParameterValue("txtDateTime", table.Rows[0]["yyyymmdd"].ToString() + "   " + table.Rows[0]["mmss"].ToString());
                        vr = previewForm.CrystalReportViewer1;
                        if (ret == DialogResult.Yes)
                        {
                            previewForm.CrystalReportViewer1.ShowPrintButton = true;
                            previewForm.CrystalReportViewer1.ReportSource    = Report;
                            previewForm.ShowDialog();
                        }
                        else         /// //Still Not Working because of Applymargin and Printer not Setting up  (PTK Will Solve)
                        {
                            CrystalDecisions.Shared.PageMargins margin = Report.PrintOptions.PageMargins;
                            margin.leftMargin   = DefaultMargin.Left;     // mmの指定をtwip単位に変換する
                            margin.topMargin    = DefaultMargin.Top;
                            margin.bottomMargin = DefaultMargin.Bottom;   //mmToTwip(marginLeft);
                            margin.rightMargin  = DefaultMargin.Right;
                            Report.PrintOptions.ApplyPageMargins(margin); /// Error Now
                            // プリンタに印刷
                            System.Drawing.Printing.PageSettings ps;
                            try
                            {
                                System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();

                                CrystalDecisions.Shared.PrintLayoutSettings PrintLayout = new CrystalDecisions.Shared.PrintLayoutSettings();

                                System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();

                                Report.PrintOptions.PrinterName = "\\\\dataserver\\Canon LBP2900";
                                System.Drawing.Printing.PageSettings pSettings = new System.Drawing.Printing.PageSettings(printerSettings);

                                Report.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;

                                Report.PrintOptions.PrinterDuplex = PrinterDuplex.Simplex;

                                Report.PrintToPrinter(printerSettings, pSettings, false, PrintLayout);
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                        break;

                    case EPrintMode.PDF:
                        bbl.ShowMessage("I202");

                        break;
                    }
                    var dt = new DataTable();
                    dt.Columns.Add("StoreCD");
                    for (int i = 0; i < dtlog.Rows.Count; i++)
                    {
                        if (!String.IsNullOrWhiteSpace(dtlog.Rows[i]["StoreCD"].ToString()) && !dtlog.Rows[i]["StoreCD"].Equals(null))
                        {
                            dt.Rows.Add(dtlog.Rows[i]["StoreCD"].ToString());
                        }
                    }
                    dt.AcceptChanges();
                    nih.L_Log_Insert_Print(new string[] { InOperatorCD, InPcID, InProgramID }, dt);
                }
                finally
                {
                    paymentstart.Focus();
                }
            }
        }