예제 #1
0
        public bool ExportKhoa(List <ChiTietHoaDon> dataSource, HoaDon hd, ref string fileName, bool isPrintPreview)
        {
            // Check if data is null
            if (dataSource == null || (dataSource != null && dataSource.Count == 0))
            {
                return(false);
            }

            /// B1
            string   maban          = hd.MaBan;
            string   sohd           = hd.MaHoaDon;
            NhanVien nv             = db.NhanViens.Where(a => a.MaNhanVien == hd.MaNhanVien).FirstOrDefault();
            string   nguoilaphoadon = nv.TenNhanVien;

            string sotienbangchu = dstc.So_chu(double.Parse(hd.ThanhTien.ToString()));
            string tenkhachhang  = "Khách lẻ";
            string diachi        = "";
            string sdt           = "";
            double pTongTien     = double.Parse(hd.ThanhTien.ToString());
            // Create replacer
            Dictionary <string, string> replacer = new Dictionary <string, string>();

            ThanhPhanB1(ref replacer, pTongTien, maban, sohd, tenkhachhang, diachi, sdt, nguoilaphoadon, sotienbangchu);
            //  BuildReplacerCurrentDate(ref replacer);

            return(OutSimpleReport(dataSource, replacer, "HoaDon", isPrintPreview, ref fileName));
        }
예제 #2
0
 private void grvctdspc_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         PrintPreView printPreView = new PrintPreView(grvrootdspc.GetRowCellValue(grvrootdspc.FocusedRowHandle, "TenNCC").ToString(), "",
                                                      grvrootdspc.GetRowCellValue(grvrootdspc.FocusedRowHandle, "GhiChu").ToString(), float.Parse(grvrootdspc.GetRowCellValue(grvrootdspc.FocusedRowHandle, "TongTien").ToString()), DocSoThanhChu.So_chu(Double.Parse(grvrootdspc.GetRowCellValue(grvrootdspc.FocusedRowHandle, "TongTien").ToString())), grvrootdspc.GetRowCellValue(grvrootdspc.FocusedRowHandle, "MaPNH").ToString(), grvrootdspc.GetRowCellValue(grvrootdspc.FocusedRowHandle, "MaPC").ToString(), "", 0);
         printPreView.ShowDialog();
     }
     catch { }
 }
 private void btnin_Click(object sender, EventArgs e)
 {
     try
     {
         PrintPreView printPreView = new PrintPreView(grvdspt.GetRowCellValue(grvdspt.FocusedRowHandle, "TenKH").ToString(), "",
                                                      grvdspt.GetRowCellValue(grvdspt.FocusedRowHandle, "GhiChu").ToString(), float.Parse(grvdspt.GetRowCellValue(grvdspt.FocusedRowHandle, "TongTien").ToString()), DocSoThanhChu.So_chu(Double.Parse(grvdspt.GetRowCellValue(grvdspt.FocusedRowHandle, "TongTien").ToString())), grvdspt.GetRowCellValue(grvdspt.FocusedRowHandle, "MaPBH").ToString(), grvdspt.GetRowCellValue(grvdspt.FocusedRowHandle, "MaPT").ToString(), "", 1);
         printPreView.ShowDialog();
     }
     catch { }
 }
예제 #4
0
 private void btnluu_Click(object sender, EventArgs e)
 {
     if (vaitro == 0)
     {
         if (PhieuChiTheoChungTuBUS.KiemTraMaPCDaTonTai(txtphieuchi.Text) < 1)
         {
             if (PhieuChiTheoChungTuBUS.LuuThongTinPhieuChi(txtphieuchi.Text, maphieu, txtngay_pc.EditValue.ToString(), mancc, txtkhachhang.Text, float.Parse(txtsotien.Text.ToString()), txtghichu.Text) > 0)
             {
                 whenInsertSuccessed();
                 DialogResult dialogResult = MessageBox.Show("Bạn có muốn in không?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (dialogResult == DialogResult.Yes)
                 {
                     PrintPreView printPreView = new PrintPreView(txtkhachhang.Text, diachi, txtghichu.Text, float.Parse(txtsotien.Text.ToString()), DocSoThanhChu.So_chu(Double.Parse(txtsotien.Text.ToString())), txttheochungtu.Text, txtphieuchi.Text, txtnhanvien.EditValue.ToString(), vaitro);
                     printPreView.ShowDialog();
                 }
                 else
                 {
                 }
             }
             else
             {
                 MessageBox.Show("Lưu Thông tin Phiếu Chi Thất Bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             Random rnd  = new Random();
             int    temp = rnd.Next(1, 100000);
             txtphieuchi.Text = PhieuChiTheoChungTuBUS.PhatSinhMaPhieuChi(maphieu, temp);
             MessageBox.Show("Mã Phiếu Chi Đã Tồn Tại, đã phát sinh mã phiếu mới", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     if (vaitro == 1)
     {
         if (PhieuChiTheoChungTuBUS.KiemTraMaPhieuThuDaTonTai(txtphieuchi.Text) < 1)
         {
             if (PhieuChiTheoChungTuBUS.LuuThongTinPhieuThu(txtphieuchi.Text, maphieu, txtngay_pc.EditValue.ToString(), makh, txtkhachhang.Text, float.Parse(txtsotien.Text.ToString()), txtghichu.Text) > 0)
             {
                 whenInsertSuccessed();
                 DialogResult dialogResult = MessageBox.Show("Bạn có muốn in không?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (dialogResult == DialogResult.Yes)
                 {
                     PrintPreView printPreView = new PrintPreView(txtkhachhang.Text, diachi, txtghichu.Text, float.Parse(txtsotien.Text.ToString()), DocSoThanhChu.So_chu(Double.Parse(txtsotien.Text.ToString())), txttheochungtu.Text, txtphieuchi.Text, txtnhanvien.EditValue.ToString(), vaitro);
                     printPreView.ShowDialog();
                 }
                 else
                 {
                 }
             }
             else
             {
                 MessageBox.Show("Lưu Thông tin Phiếu Thu Thất Bại.", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Mã Phiếu Thu Đã Tồn Tại, Đã Phát Sinh Mã Mới", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             Random rnd  = new Random();
             int    temp = rnd.Next(1, 100000);
             txtphieuchi.Text = PhieuChiTheoChungTuBUS.PhatSinhMaPhieuChi(maphieu, temp);
         }
     }
 }