Exemplo n.º 1
0
        private void printModel_Click(object sender, EventArgs e)
        {
            var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.FocusedNode);

            if (dr == null)
            {
                return;
            }
            //lstTransactions.Items.Clear();
            var       iss        = new IssueDoc();
            DataTable dt         = iss.GetModel22ByRefNo(dr["RefNo"].ToString(), Convert.ToDateTime(dr["Date"]));
            var       issuedBy   = "";
            var       receivedBy = "";

            if (dt.Rows.Count > 0)
            {
                issuedBy   = (dt.Rows[0]["ModelIssuedBy"] != null) ? dt.Rows[0]["ModelIssuedBy"].ToString() : "";
                receivedBy = (dt.Rows[0]["RecipientName"] != null) ? dt.Rows[0]["RecipientName"].ToString() : "";
            }

            var modelprint = new PharmInventory.Reports.Model22
            {
                PrintedBy    = { Text = _printedby },
                xrStore      = { Text = cboStores.Text },
                xrIssuedBy   = { Text = issuedBy },
                xrReceivedBy = { Text = receivedBy }
            };

            var tbl1 = dt;

            tbl1.TableName = "Model22";

            var dtset = new DataSet();

            dtset.Tables.Add(tbl1.Copy());
            modelprint.DataSource = dtset;
            modelprint.Landscape  = true;
            //var pagecount = modelprint.Pages.Count;
            //XtraMessageBox.Show(string.Format("You are about to print {0} pages!", pagecount), "Success", MessageBoxButtons.OK,
            //                     MessageBoxIcon.Information);
            modelprint.ShowPreviewDialog();
        }