Ejemplo n.º 1
0
        private void PrintPreview(bool preview)
        {
            printds = new DsPrintedInvoices();
            foreach (var item in pds.PrintedInvoices)
            {
                if (item.Exclude != true)
                {
                    for (int i = 1; i <= item.NoOfBoxes; i++)
                    {
                        item.NumberOfTotal = i;
                        item.CVisible      = !this.chkPrintCompanyDetail.Checked;
                        object[] values = item.ItemArray;
                        printds.PrintedInvoices.Rows.Add(values);
                    }
                }
            }
            rptLabels crp = new rptLabels();

            crp.SetDataSource((DataTable)printds.PrintedInvoices);
            FrmReportViewer frmViewer = new FrmReportViewer();

            frmViewer.crystalReportViewer1.ReportSource = crp;
            if (preview)
            {
                frmViewer.ShowDialog();
            }
            else
            {
                frmViewer.crystalReportViewer1.RefreshReport();
                frmViewer.crystalReportViewer1.PrintReport();
            }
        }
Ejemplo n.º 2
0
 public DsPrintedInvoices GetPrintedInvoices(DateTime fromDate, DateTime toDate)
 {
     try
     {
         //load the current Company Information
         DataTable dt = new DataTable();// new CompanyInfoDAL().GetCompanyInfo();
         //Declare DataSet to contain Printed Invoice Data
         DsPrintedInvoices dspi = new DsPrintedInvoices();
         //Setup a connection to database and Retrieve Data.
         this.readconfile          = new ReadConfigFile();
         this.con                  = new OleDbConnection();
         this.con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
         if (this.con.ConnectionString != null)
         {
             this.con.Open();
             this.cmd             = new OleDbCommand();
             this.cmd.Connection  = this.con;
             this.cmd.CommandType = CommandType.Text;
             if (this.con.State == ConnectionState.Open)
             {
                 this.cmd.Connection  = this.con;
                 this.cmd.CommandText = "Select * from SaleInvoice where sinumber<>'' and siDate >='" + fromDate.ToShortDateString() + "' and siDate <= '" + toDate.ToShortDateString() + "'";
                 reader = this.cmd.ExecuteReader();
                 while (reader.Read())
                 {
                     object[] values = new object[21];
                     values[0]  = Convert.ToDateTime(reader["siDate"]);
                     values[1]  = reader["sinumber"].ToString();
                     values[2]  = reader["CustomerName"].ToString();
                     values[3]  = false;
                     values[4]  = 0;
                     values[5]  = reader["Recipient"].ToString();
                     values[6]  = reader["Line1"].ToString();
                     values[7]  = reader["Line2"].ToString();
                     values[8]  = reader["City"].ToString();
                     values[9]  = reader["State"].ToString();
                     values[10] = reader["ZIP"].ToString();
                     values[11] = reader["CustomerPO"].ToString();
                     values[12] = reader["ShipVia"].ToString();
                     values[13] = dt.Rows[0].ItemArray[0];
                     values[14] = dt.Rows[0].ItemArray[1];
                     values[15] = dt.Rows[0].ItemArray[2];
                     values[16] = dt.Rows[0].ItemArray[3];
                     values[17] = dt.Rows[0].ItemArray[4];
                     values[18] = dt.Rows[0].ItemArray[5];
                     values[19] = dt.Rows[0].ItemArray[7];
                     values[20] = dt.Rows[0].ItemArray[8];
                     dspi.PrintedInvoices.Rows.Add(values);
                 }
                 reader.Close();
             }
         }
         return(dspi);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         con.Close();
     }
 }
Ejemplo n.º 3
0
 private void btnPrintedInvoice_Click(object sender, EventArgs e)
 {
     pds = plbll.GetPrintedInvoices(this.dtpFromDate.Value.Date, this.dtpToDate.Value.Date);
     this.dgvPrintedInvoices.DataSource = pds.PrintedInvoices;
 }