private void iPTXemTruoc_ItemClick(object sender, ItemClickEventArgs e) { if (this.isPhieuThuTab() && this.phieuthuBindingSource.Current != null) { if (this.ValidatePhieuThuFields()) { RptPhieuThu rpt = new RptPhieuThu(); this.fillReportPhieuThu(rpt); this.ucReport1.printControl1.PrintingSystem = rpt.PrintingSystem; rpt.CreateDocument(); this.xtraTabControl1.SelectedTabPageIndex = 3; this.xtraTabControl1.TabPages[3].Text = "Xem trước Phiếu thu"; } } }
private void iPTIn_ItemClick(object sender, ItemClickEventArgs e) { if (this.isPhieuThuTab() && this.phieuthuBindingSource.Current != null) { if (this.ValidatePhieuThuFields()) { RptPhieuThu rpt = new RptPhieuThu(); this.fillReportPhieuThu(rpt); this.ucReport1.printControl1.PrintingSystem = rpt.PrintingSystem; try { rpt.Print(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void fillReportPhieuThu(RptPhieuThu rpt) { QLCMND.CMND.phieuthuRow row = (QLCMND.CMND.phieuthuRow)((DataRowView)this.phieuthuBindingSource.Current).Row; rpt.lblHoTen.Text = row.hoten.ToUpper(); if (!row.IsdiachiNull()) { rpt.lblDiaChi.Text = row.diachi; } else { rpt.lblDiaChi.Text = ""; } if (!row.IslydoNull()) { rpt.lblLyDo.Text = row.lydo; } else { rpt.lblLyDo.Text = ""; } if (!row.IschungtugocNull()) { rpt.lblChungTuGoc.Text = row.chungtugoc; } else { rpt.lblChungTuGoc.Text = ""; } if (!row.IskemtheoNull()) { rpt.lblKemTheo.Text = row.kemtheo; } else { rpt.lblKemTheo.Text = ""; } rpt.lblSoTien.Text = string.Format("{0:n0}, đồng", row.sotien); rpt.lblSoTienChu.Text = " " + VNCurrency.ToString((double)row.sotien); if (!row.IsngaylapNull()) { rpt.lblNgayLap.Text = string.Format("Ngày {0} tháng {1} năm {2}", row.ngaylap.Day, row.ngaylap.Month, row.ngaylap.Year); } else { rpt.lblNgayLap.Text = ""; } if (!row.IscotkNull()) { rpt.lblCoTK.Text = row.cotk; } else { rpt.lblCoTK.Text = ""; } }