예제 #1
0
 private void InThongTinKiemKe()
 {
     try
     {
         Entities.ThongTinKiemKeKho[] row = new Entities.ThongTinKiemKeKho[dgvInsertOrder.RowCount];
         for (int k = 0; k < dgvInsertOrder.RowCount; k++)
         {
             Entities.ThongTinKiemKeKho banghi = new Entities.ThongTinKiemKeKho();
             banghi.Mahang = dgvInsertOrder.Rows[k].Cells[0].Value.ToString();
             banghi.Tenhang = dgvInsertOrder.Rows[k].Cells[1].Value.ToString();
             banghi.Tonsosach = dgvInsertOrder.Rows[k].Cells[2].Value.ToString();
             banghi.Tonthucte = dgvInsertOrder.Rows[k].Cells[3].Value.ToString();
             banghi.Chenhlech = dgvInsertOrder.Rows[k].Cells[4].Value.ToString();
             banghi.Lydo = dgvInsertOrder.Rows[k].Cells[5].Value.ToString();
             banghi.Giavon = dgvInsertOrder.Rows[k].Cells[6].Value.ToString();
             banghi.Giachechlech = dgvInsertOrder.Rows[k].Cells[7].Value.ToString();
             row[k] = banghi;
         }
         Entities.KiemKeKho kiemke = new Entities.KiemKeKho();
         kiemke.MaKiemKe = txtSochungtu.Text;
         kiemke.NgayKiemKe = Utils.StringToDateTime(makNgaychungtu.Text);
         //kiemke.NgayKiemKe = DateTime.Parse(new Common.Utilities().KiemTraDinhDangNgayThangNam("ThangNgayNam", makNgaychungtu.Text, '/'));
         kiemke.Tenkho = cbxKhoban.Text;
         kiemke.GhiChu = new Common.Utilities().FormatMoney(Double.Parse(txtTienhang.Text));
         kiemke.Hanhdong = "Hóa Đơn Kiểm Kê Kho";
         Entities.ThongTinCongTy conty = Congty("");
         if (row.Length > 0 && kiemke != null && conty != null)
         {
             frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang("In", Common.Utilities.User.TenNhanVien, row, kiemke, conty, string.Empty);
             frm.ShowDialog();
         }
         else
         { MessageBox.Show("Không có dữ liệu"); return; }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
예제 #2
0
 private void InThongTinTraLaiNhaCungCap()
 {
     try
     {
         Entities.BaoCaoHoaDonNhap[] hoadon = new Entities.BaoCaoHoaDonNhap[dgvXemthongtin.RowCount];
         for (int k = 0; k < dgvXemthongtin.RowCount; k++)
         {
             Entities.BaoCaoHoaDonNhap row = new Entities.BaoCaoHoaDonNhap
             (
                 dgvXemthongtin.Rows[k].Cells[0].Value.ToString(),
                 dgvXemthongtin.Rows[k].Cells[1].Value.ToString(),
                 Double.Parse(dgvXemthongtin.Rows[k].Cells[3].Value.ToString()),
                 int.Parse(dgvXemthongtin.Rows[k].Cells[2].Value.ToString()),
                 int.Parse(dgvXemthongtin.Rows[k].Cells[4].Value.ToString()),
                 Double.Parse(dgvXemthongtin.Rows[k].Cells[5].Value.ToString()),
                 Double.Parse(dgvXemthongtin.Rows[k].Cells[7].Value.ToString()),
                 Double.Parse(dgvXemthongtin.Rows[k].Cells[6].Value.ToString())
             );
             hoadon[k] = row;
         }
         Entities.TruyenGiaTriVaoBaoCao baocao = new Entities.TruyenGiaTriVaoBaoCao();
         baocao.Giatri1 = "Hóa Đơn Trả Lại Nhà Cung Cấp";
         baocao.Giatri2 = DateServer.Date().ToString("dd/MM/yyyy");
         baocao.Giatri3 = txtSodonhang.Text;
         baocao.Giatri4 = Common.Utilities.User.TenNhanVien;
         baocao.Giatri5 = makNgaydonhang.Text;
         baocao.Giatri6 = txtMakhachhang.Text;
         baocao.Giatri7 = makHanthanhtoan.Text;
         baocao.Giatri8 = cbxKhoHang.Text;
         string chuoi = loaihoadon(rdoBanbuon, rdoBanle);
         if (chuoi == "BanBuon")
         {
             baocao.Giatri9 = rdoBanbuon.Text;
         }
         if (chuoi == "BanLe")
         {
             baocao.Giatri9 = rdoBanle.Text;
         }
         baocao.Giatri10 = txtChungtugoc.Text;
         baocao.Giatri11 = cbxHinhthucthanhtoan.Text;
         baocao.Giatri12 = new Common.Utilities().FormatMoney(Double.Parse(txtThanhtoanngay.Text));
         baocao.Giatri13 = new Common.Utilities().FormatMoney(Double.Parse(txtChietkhau.Text));
         baocao.Giatri14 = txtTongtienthanhtoan.Text;
         baocao.Giatri16 = txtGiatrigiatang.Text;
         baocao.Giatri17 = new Common.Utilities().FormatMoney(Double.Parse(txtConphaitra.Text));
         frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang("TraLaiNhaCungCap", hoadon, baocao, Congty(""));
         frm.ShowDialog();
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
예제 #3
0
 private void ExportWord(string hanhdong,string filter)
 {
     try
     {
         string ID = getID();
         switch (reportName)
         {
             case "BaoCaoNhapTheoKhoHang":
                 {
                     this.Enabled = false;
                     LocBaoCaoTheoKhoHang(ID);
                     this.Enabled = true;
                     saveFile.Filter = filter;
                     string ky = cbxThang.SelectedItem.ToString() + " - " + cbxNam.SelectedItem.ToString();
                     string maNV = Common.Utilities.User.TenNhanVien;
                     if (theokho.Length > 0 && thongtin != null && ID != "" && maNV != "" && ky != "")
                     {
                         if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                         {
                             frmBaoCaoNhapHang a = new frmBaoCaoNhapHang(hanhdong, this.theokho, this.thongtin, saveFile.FileName, ky, ID, maNV, "Báo Cáo Nhập Hàng Theo Kho Theo Kỳ");
                         }
                     }
                     else
                     {
                         MessageBox.Show("Không có dữ liệu");
                     }
                 } break;
             case "BaoCaoNhapTheoNhomHang":
                 {
                     this.Enabled = false;
                     LocNhapHangTheoNhom(ID);
                     this.Enabled = true;
                     saveFile.Filter = filter;
                     string ky = cbxThang.SelectedItem.ToString() + " - " + cbxNam.SelectedItem.ToString();
                     string maNV = Common.Utilities.User.TenNhanVien;
                     if (baocaotheonhom.Length > 0 && thongtin.TenCongTy.Length > 0 && ID != "" && ky.Length > 3 && tenNhom.Length > 0 && maNV != "")
                     {
                         if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                         {
                             frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang(hanhdong, saveFile.FileName, thongtin, baocaotheonhom, ky, ID, maNV, "Báo Cáo Nhập Hàng Theo Nhóm Hàng", tenNhom);
                         }
                     }
                     else
                     {
                         MessageBox.Show("Không có dữ liệu");
                     }
                 } break;
             case "BaoCaoNhapTheoMatHang":
                 {
                     this.Enabled = false;
                     LocBaoCaoMatHang(ID);
                     this.Enabled = true;
                     saveFile.Filter = filter;
                     string ky = cbxThang.SelectedItem.ToString() + " - " + cbxNam.SelectedItem.ToString();
                     string maNV = Common.Utilities.User.TenNhanVien;
                     if (theoMatHang.Length > 0 && thongtin.TenCongTy.Length > 0 && ID.Length > 0 && maNV != "" && ky.Length > 3 && tenNhom != "")
                     {
                         if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                         {
                             frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang(hanhdong, saveFile.FileName, thongtin, theoMatHang, ky, ID, maNV, "Báo Cáo Nhập Hàng Theo Mặt Hàng Theo Kỳ", tenNhom);
                         }
                     }
                     else
                     {
                         MessageBox.Show("Không có dữ liệu");
                     }
                 } break;
             case "XuatNhapTonTheoNhomHang":
                 {
                     this.Enabled = false;
                     HienThi_XuatNhapTonTheoNhom(ID);
                     this.Enabled = true;
                     saveFile.Filter = filter;
                     string ky = cbxThang.SelectedItem.ToString() + " - " + cbxNam.SelectedItem.ToString();
                     string maNV = Common.Utilities.User.TenNhanVien;
                     if (baocaonhomhang.Length > 0 && thongtin.TenCongTy.Length > 0 && ID != "" && ky.Length > 3 && tenNhom.Length > 0 && maNV != "")
                     {
                         if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                         {
                             frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang(hanhdong, saveFile.FileName, thongtin, baocaonhomhang, ky, ID, maNV, "Báo Cáo Xuất Nhập Tồn Theo Nhóm Hàng", tenNhom);
                         }
                     }
                     else
                     {
                         MessageBox.Show("Không có dữ liệu");
                     }
                 } break;
             default: break;
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ma"></param>
 /// <param name="congty"></param>
 private void PrintNhom(string ma, Entities.ThongTinCongTy congty,string ten)
 {
     try
     {
         string ky = cbxThang.SelectedItem.ToString() + " - " + cbxNam.SelectedItem.ToString();
         string maNV = Common.Utilities.User.TenNhanVien;
         if (baocaotheonhom.Length > 0 && congty.TenCongTy.Length > 0 && ma != "" && ky.Length > 3 && tenNhom.Length > 0 && maNV != "")
         {
             frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang("NhomHang", congty, baocaotheonhom, ky, ma, maNV, "Báo Cáo Nhập Hàng Theo Nhóm Hàng", tenNhom);
             frm.ShowDialog();
         }
         else
         {
             MessageBox.Show("Không có dữ liệu");
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
예제 #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ma"></param>
 private void PrintKho(string ma, Entities.ThongTinCongTy congty)
 {
     try
     {
         string ky = cbxThang.SelectedItem.ToString() + " - " + cbxNam.SelectedItem.ToString();
         string maNV = Common.Utilities.User.TenNhanVien;
         if (theokho.Length > 0 && congty!=null && ma!="" && maNV !="" && ky!="")
         {
             frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang("KhoHang", congty, theokho, ky, ma, maNV, "Báo Cáo Nhập Hàng Theo Kỳ");
             frm.ShowDialog();
         }
         else
         {
             MessageBox.Show("Không có dữ liệu");
         }
     }
     catch (Exception ex)
     { string s = ex.Message; MessageBox.Show("Thất bại"); }
 }
예제 #6
0
 private void InThongTinDonHang()
 {
     try
     {
         Entities.BaoCaoHoaDonNhap[] hoadon = new Entities.BaoCaoHoaDonNhap[dgvInsertOrder.RowCount];
         for (int k = 0; k < dgvInsertOrder.RowCount; k++)
         {
             Entities.BaoCaoHoaDonNhap row = new Entities.BaoCaoHoaDonNhap
             (
                 dgvInsertOrder.Rows[k].Cells[1].Value.ToString(),
                 dgvInsertOrder.Rows[k].Cells[2].Value.ToString(),
                 Double.Parse(dgvInsertOrder.Rows[k].Cells[4].Value.ToString()),
                 int.Parse(dgvInsertOrder.Rows[k].Cells[3].Value.ToString()),
                 int.Parse(dgvInsertOrder.Rows[k].Cells[7].Value.ToString()),
                 Double.Parse(dgvInsertOrder.Rows[k].Cells[9].Value.ToString()),
                 Double.Parse(dgvInsertOrder.Rows[k].Cells[8].Value.ToString()),
                 Double.Parse(dgvInsertOrder.Rows[k].Cells[11].Value.ToString())
             );
             hoadon[k] = row;
         }
         Entities.TruyenGiaTriVaoBaoCao baocao = new Entities.TruyenGiaTriVaoBaoCao();
         baocao.Giatri1 = "Hóa Đơn Nhập Kho";
         baocao.Giatri2 = this.Date.ToString("dd/MM/yyyy");
         baocao.Giatri3 = txtSodonhang.Text;
         baocao.Giatri4 = Common.Utilities.User.TenNhanVien;
         baocao.Giatri5 = makNgaydonhang.Text;
         baocao.Giatri6 = txtManhacungcap.Text;
         baocao.Giatri7 = makHanthanhtoan.Text;
         baocao.Giatri8 = cbxKhoHang.Text;
         baocao.Giatri9 = chekChonLoai.Text;
         string chuoi = "Không theo đơn";
         if (txtMadondathang.Text.Length > 0)
         { chuoi = txtMadondathang.Text; }
         baocao.Giatri10 = chuoi;
         baocao.Giatri11 = cbxHinhthucthanhtoan.Text;
         baocao.Giatri12 = new Common.Utilities().FormatMoney(Double.Parse(txtThanhtoanngay.Text.Replace(",", "")));
         baocao.Giatri13 = new Common.Utilities().FormatMoney(Double.Parse(txtTienCKTM0.Text));
         baocao.Giatri14 = txtTongThanhToan.Text;
         baocao.Giatri15 = txtChietkhau.Text;
         baocao.Giatri16 = txtGiatrigiatang.Text;
         baocao.Giatri17 = new Common.Utilities().FormatMoney(Double.Parse(txtTienTraLai.Text));
         frmBaoCaoNhapHang frm = new frmBaoCaoNhapHang("HoaDonNhap", hoadon, baocao, Congty(""));
         frm.ShowDialog();
     }
     catch { }
 }