private void frmTimBaoCao_Load(object sender, EventArgs e)
 {
     makNgaybatdau.Text  = new Common.Utilities().XuLy(2, DateServer.Date().ToString());
     makNgayketthuc.Text = new Common.Utilities().XuLy(2, DateServer.Date().ToString());
     layBang();
     this.cbxLoaibaocao.Items.AddRange(new object[] { "Xuất Hàng Theo Từng Kho", "Xuất Hàng Theo Từng Nhóm Hàng", "Xuất Hàng Theo Từng Mặt Hàng" });
     this.cbxLoaibaocao.Text = "Chọn báo cáo cần hiển thị";
     this.cbxNam.Items.AddRange(new object[] { "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2020" });
     if (rdoTheoquy.Checked == true)
     {
         cbxNam.Enabled         = true;
         cbxThang_Quy.Enabled   = true;
         makNgaybatdau.Enabled  = false;
         makNgayketthuc.Enabled = false;
         lblThang_Quy.Text      = "Quý:";
         this.cbxThang_Quy.Items.AddRange(new object[] { "1", "2", "3", "4" });
         this.cbxThang_Quy.Text = "Chọn quý";
     }
     if (rdoTheothang.Checked == true)
     {
         cbxNam.Enabled         = true;
         cbxThang_Quy.Enabled   = true;
         makNgaybatdau.Enabled  = false;
         makNgayketthuc.Enabled = false;
         lblThang_Quy.Text      = "Tháng:";
         this.cbxThang_Quy.Items.AddRange(new object[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
     }
 }
        public static DateTime GetDateTimeNow(string select)
        {
            if (string.IsNullOrEmpty(select))
            {
                select = "server";
            }
            DateTime dateTime = new DateTime(1753, 1, 1);
            //check kết nối mạng
            //if (Klib2.InternetConnection.IsConnectedToInternet()) dateTime = Klib2.KUtilsTime.GetTimeInternet();
            bool a = dateTime.Date == (new DateTime(1753, 1, 1)).Date;
            bool b = dateTime.Date == (new DateTime()).Date;
            bool c = a || b;

            if (c && select.Equals("client"))
            {
                try
                { dateTime = DateServer.Date(); }
                catch
                { dateTime = DateTime.Now; }
            }
            else if (c && select.Equals("server"))
            {
                dateTime = DateTime.Now;
            }
            return(dateTime);
        }
Beispiel #3
0
 public frmBCTonKhoTheoKho()
 {
     InitializeComponent(); datesv = DateServer.Date();
     KhoHang();
     TonKho();
     HienThiTongThe();
 }
        public frmBCNhapHangTheoMatHang()
        {
            try
            {
                InitializeComponent(); datesv = DateServer.Date();
                nam           = datesv.Year;
                thang         = datesv.Month;
                cbbthang.Text = thang.ToString();
                cbbnam.Text   = nam.ToString();

                HoaDonNhap();
                ChiTietHoaDonNhap();

                KhachHangTraLai();
                ChiTietKhachHangTraLai();
                HangHoa();
                GoiHang();
                ChiTietGoiHang();
                PhieuDieuChuyenKhoNoiBo();
                ChiTietPhieuDieuChuyenKho();

                NhapHangTheoMatHang();
            }
            catch
            {
            }
        }
        public void hienthi()
        {
            Server_Client.Client cl = new Server_Client.Client();
            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            Pdck         = new PhieuDieuChuyenKhoNoiBo("Select", 1, "a", DateServer.Date(), "a", "a ", "a", "a", "a", false, "a", false);
            clientstrem  = cl.SerializeObj(this.client1, "PhieuDieuCHuyenKhoNoiBo", Pdck);

            PhieuDieuChuyenKhoNoiBo[] pdck1 = new PhieuDieuChuyenKhoNoiBo[1];
            pdck1[0] = new PhieuDieuChuyenKhoNoiBo(1, "a", DateServer.Date(), "a", "a", "a", false, "a", false);
            pdck1    = (PhieuDieuChuyenKhoNoiBo[])cl.DeserializeHepper1(clientstrem, pdck1);


            if (pdck1 == null)
            {
                Entities.PhieuDieuChuyenKhoNoiBo[] a = new PhieuDieuChuyenKhoNoiBo[0];
                PDCK_Search           = a;
                dgvHienThi.DataSource = a;
                FixDataGridView();
                toolStripStatus_Sua.Enabled = false;
                toolStripStatus_Xoa.Enabled = false;
            }
            else
            {
                PDCK_Search           = pdck1;
                dgvHienThi.DataSource = pdck1;
                FixDataGridView();
                toolStripStatus_Sua.Enabled = true;
                toolStripStatus_Xoa.Enabled = true;
            }
        }
 public frmBCXuatNhapTonPhieuXuatNhap()
 {
     try
     {
         InitializeComponent();
         nam           = DateServer.Date().Year;
         thang         = DateServer.Date().Month;
         cbbthang.Text = thang.ToString();
         cbbnam.Text   = nam.ToString();
         PhieuXuatHuy();
         ChiTietXuatHuy();
         HDBanHang();
         ChiTietHDBanHang();
         HoaDonNhap();
         ChiTietHoaDonNhap();
         TraLaiNCC();
         ChiTietTraLaiNCC();
         KhachHangTraLai();
         ChiTietKhachHangTraLai();
         HangHoa();
         SoDuKho();
         GoiHang();
         ChiTietGoiHang();
         TongTienNhanVien();
     }
     catch
     {
     }
 }
        public frmBCXuatHangTheoThoiGian()
        {
            InitializeComponent();
            try
            {
                datesv = DateServer.Date();
                for (int i = 0; i < cbbthang.Items.Count; i++)
                {
                    if (cbbthang.Items[i].ToString() == datesv.Month.ToString())
                    {
                        cbbthang.SelectedIndex = i;
                        break;
                    }
                }
                for (int i = 0; i < cbbnam.Items.Count; i++)
                {
                    if (cbbnam.Items[i].ToString() == datesv.Year.ToString())
                    {
                        cbbnam.SelectedIndex = i;
                        break;
                    }
                }

                cbbnam.Text   = datesv.Year.ToString();
                cbbthang.Text = datesv.Month.ToString();
                batdau        = new DateTime(Convert.ToInt32(cbbnam.Text), Convert.ToInt32(cbbthang.Text), 1).ToString();
                ketthuc       = new DateTime(Convert.ToInt32(cbbnam.Text), Convert.ToInt32(cbbthang.Text), DateTime.DaysInMonth(Convert.ToInt32(cbbnam.Text), Convert.ToInt32(cbbthang.Text))).ToString();
                //batdau = new Common.Utilities().MyDateConversion("01/" + cbbthang.Text + "/" + cbbnam.Text);
                //if (cbbthang.Text == "12")
                //    ketthuc = new Common.Utilities().MyDateConversion("01/01/" + (Convert.ToInt32(cbbnam.Text) + 1).ToString());
                //else
                //    ketthuc = new Common.Utilities().MyDateConversion("01/" + (Convert.ToInt32(cbbthang.Text) + 1).ToString() + "/" + cbbnam.Text);
                truoc = Convert.ToDateTime(batdau);
                sau   = Convert.ToDateTime(ketthuc);

                nam           = datesv.Year;
                thang         = datesv.Month;
                cbbthang.Text = thang.ToString();
                cbbnam.Text   = nam.ToString();
                //Xuất hủy
                PhieuXuatHuy();
                ChiTietXuatHuy();
                //Hóa đơn bán hàng
                HDBanHang1();
                ChiTietHDBanHang();
                //Trả lại nhà cung cấp
                TraLaiNCC();
                ChiTietTraLaiNCC();

                HangHoa1();
                GoiHang();
                ChiTietGoiHang();

                TongTienNhanVien();
            }
            catch
            {
            }
        }
Beispiel #8
0
 public frmKetChuyenSoDu()
 {
     InitializeComponent();
     datesv        = DateServer.Date();
     cbbnam.Text   = datesv.Year.ToString();
     cbbthang.Text = datesv.Month.ToString();
     SelectData();
 }
Beispiel #9
0
 public frmBCThue()
 {
     InitializeComponent(); datesv = DateServer.Date();
     datesv = DateServer.Date();
     truoc  = sau = datesv;
     SelectData();
     dtgvhienthi.DataSource = new Entities.BCThue[0];
     fix();
 }
 public frmKetChuyenSoDuCongNo()
 {
     InitializeComponent();
     datesv                    = DateServer.Date();
     cbbnam.Text               = datesv.Year.ToString();
     cbbthang.Text             = datesv.Month.ToString();
     cbbdoituong.SelectedIndex = 0;
     SelectData();
 }
 private void frmBCTienTonKho_Load(object sender, EventArgs e)
 {
     try
     {
         DateTime hientai = DateServer.Date();
         DateTime truoc   = new DateTime(hientai.Year, hientai.Month, 1);
         Xuly(truoc, hientai);
     }
     catch { }
 }
 private void toolStripStatusLabel1_Click(object sender, EventArgs e)
 {
     //Nạp Lại
     try
     {
         DateTime hientai = DateServer.Date();
         DateTime truoc   = new DateTime(hientai.Year, hientai.Month, 1);
         Xuly(truoc, hientai);
     }
     catch { }
 }
 private void frmBCThuTienTheGiaTri_Load(object sender, EventArgs e)
 {
     try
     {
         DateTime hientai = DateServer.Date();
         DateTime truoc   = new DateTime(hientai.Year, hientai.Month, 1);
         DateTime sau     = new DateTime(hientai.Year, hientai.Month, DateTime.DaysInMonth(hientai.Year, hientai.Month));
         Xuly(truoc, sau);
     }
     catch { }
 }
Beispiel #14
0
 /// <summary>
 /// xử lý khi truyền giá trị tới
 /// </summary>
 public frmQuanLyBanBuon()
 {
     InitializeComponent();
     datesv = DateServer.Date();
     makho  = new Common.Utilities().CaiDatKho("View", "", "").Giatritruyen;
     if (string.IsNullOrEmpty(makho))
     {
         MessageBox.Show("Chưa cài đặt kho", "Hệ thống cảnh báo");
     }
     truoc = sau = datesv;
 }
Beispiel #15
0
 public frmSoDuSoQuy()
 {
     try
     {
         InitializeComponent(); datesv = DateServer.Date();
         cbbnam.Text   = datesv.Year.ToString();
         cbbthang.Text = datesv.Month.ToString();
         SelectData();
     }
     catch
     {
     }
 }
Beispiel #16
0
 public void CheckDataGridCongSL(DataGridView dgv, string maKho)
 {
     if (dgv.RowCount != 0)
     {
         try
         {
             Server_Client.Client cl = new Server_Client.Client();
             this.client1 = cl.Connect(Luu.IP, Luu.Ports);
             Entities.ChiTietKhoHangTheoHoaHonNhap nv = new Entities.ChiTietKhoHangTheoHoaHonNhap("Select");
             clientstrem = cl.SerializeObj(this.client1, "ChiTietKho", nv);
             Entities.ChiTietKhoHangTheoHoaHonNhap[] kh1 = new Entities.ChiTietKhoHangTheoHoaHonNhap[1];
             kh1 = (Entities.ChiTietKhoHangTheoHoaHonNhap[])cl.DeserializeHepper1(clientstrem, kh1);
             List <Entities.ChiTietKhoHangTheoHoaHonNhap> ctList = new List <Entities.ChiTietKhoHangTheoHoaHonNhap>();
             for (int i = 0; i < dgv.RowCount; i++)
             {
                 bool retVal = false;
                 foreach (Entities.ChiTietKhoHangTheoHoaHonNhap item in kh1)
                 {
                     if (dgv["MaHangHoa", i].Value.ToString().ToUpper().Equals(item.Mahanghoa.ToUpper()) && maKho.Equals(item.Makho))
                     {
                         retVal = true;
                         break;
                     }
                 }
                 if (!retVal)
                 {
                     Entities.ChiTietKhoHangTheoHoaHonNhap ct = new Entities.ChiTietKhoHangTheoHoaHonNhap();
                     ct.Hanhdong  = "Insert";
                     ct.Mahanghoa = dgv["MaHangHoa", i].Value.ToString();
                     ct.Makho     = maKho;
                     ct.Ngaynhap  = DateServer.Date();
                     DateTime ngayHetHan = DateTime.Now;
                     if (dgv["NgayHetHan", i] != null)
                     {
                         ngayHetHan = (DateTime)dgv["NgayHetHan", i].Value;
                     }
                     ct.Ngayhethan = ngayHetHan;
                     ct.Soluong    = int.Parse(dgv["SoLuong", i].Value.ToString());
                     ct.Ghichu     = "";
                     ctList.Add(ct);
                 }
             }
             Server_Client.Client cl1 = new Server_Client.Client();
             this.client1 = cl1.Connect(Luu.IP, Luu.Ports);
             clientstrem  = cl1.SerializeObj(this.client1, "ThemChiTietKhoHang", ctList.ToArray());
         }
         catch (Exception)
         {
         }
     }
 }
 public frmBCXuatHuyHangHoa()
 {
     InitializeComponent();
     truoc = sau = DateServer.Date();
     SelectData();
     dtgvhienthi.DataSource = new Entities.BCXuatHuyHangHoa[0];
     makho = new Common.Utilities().CaiDatKho("View", "", "").Giatritruyen;
     if (makho == "")
     {
         MessageBox.Show("Bạn chưa cài đặt kho - Xin hãy kiểm tra lại", "Hệ thống cảnh báo");
     }
     TongTienNhanVien();
     fix();
 }
 public frmSoDuKhoHang()
 {
     InitializeComponent();
     try
     {
         datesv = DateServer.Date();
         LayHangHoa();
         toolStrip1.Enabled = false;
         LayKhoHang();
         cbbkhohang.DataSource    = khohang;
         cbbkhohang.DisplayMember = "TenKho";
     }
     catch { }
 }
 public frmSoDuKhachHang()
 {
     try
     {
         InitializeComponent(); datesv = DateServer.Date();
         cbbnam.Text               = datesv.Year.ToString();
         cbbthang.Text             = datesv.Month.ToString();
         cbbdoituong.SelectedIndex = 0;
         SelectData();
     }
     catch
     {
     }
 }
Beispiel #20
0
        public void hienthi()
        {
            Server_Client.Client cl = new Server_Client.Client();
            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            Pdck         = new PhieuDieuChuyenKhoNoiBo("Select", 1, "a", DateServer.Date(), "a", "a", "a", "a", "a", false, "a", false);
            clientstrem  = cl.SerializeObj(this.client1, "PhieuDieuCHuyenKhoNoiBo", Pdck);

            PhieuDieuChuyenKhoNoiBo[] pdck1 = new PhieuDieuChuyenKhoNoiBo[1];
            pdck1[0] = new PhieuDieuChuyenKhoNoiBo(1, "a", DateServer.Date(), "a", "a", "a", false, "a", false);
            pdck1    = (PhieuDieuChuyenKhoNoiBo[])cl.DeserializeHepper1(clientstrem, pdck1);


            ////PDCK_Search = pdck1;
            if (pdck1 == null)
            {
                Entities.PhieuDieuChuyenKhoNoiBo[] a = new PhieuDieuChuyenKhoNoiBo[0];
                dgvHienThi.DataSource = a;
                PDCK_Search           = a;
                FixDataGridView();
                toolStripStatus_Sua.Enabled     = false;
                toolStripStatus_ChiTiet.Enabled = false;
            }
            else
            {
                int count = 0;
                for (int i = 0; i < pdck1.Length; i++)
                {
                    if (pdck1[i].XacNhan == false)
                    {
                        count++;
                    }
                }
                PhieuDieuChuyenKhoNoiBo[] pdck2 = new PhieuDieuChuyenKhoNoiBo[count];
                count = 0;
                for (int i = 0; i < pdck1.Length; i++)
                {
                    if (pdck1[i].XacNhan == false)
                    {
                        pdck2[count] = pdck1[i];
                        count++;
                    }
                }
                PDCK_Search           = pdck2;
                dgvHienThi.DataSource = pdck2;

                FixDataGridView();
                toolStripStatus_Sua.Enabled     = true;
                toolStripStatus_ChiTiet.Enabled = true;
            }
        }
 private void frmTimKiemChungTu_Load(object sender, EventArgs e)
 {
     try
     {
         truoc = DateServer.Date();
         sau   = DateServer.Date();
         HienThi();
         fixChiTiet();
         fixHienThi();
         label1.Text = "Tìm Kiếm Chứng Từ " + new Common.Utilities().XuLy(2, truoc.ToShortDateString()) + " đến ngày " + new Common.Utilities().XuLy(2, sau.ToShortDateString());
     }
     catch
     {
     }
 }
Beispiel #22
0
        public frmBCMucTonToiThieuToiDa()
        {
            try
            {
                InitializeComponent(); datesv = DateServer.Date();

                KhoHang();
                ChiTietKhoHang();
                HangHoa();
                dtgvhienthi.DataSource = khohang;
                fix();
            }
            catch
            {
            }
        }
Beispiel #23
0
 public frmSoquy(string nam, string thang)
 {
     InitializeComponent();
     try
     {
         datesv        = DateServer.Date();
         batdau        = true;
         cbbnam.Text   = datesv.Year.ToString();
         cbbthang.Text = datesv.Month.ToString();
         month         = thang;
         year          = nam;
     }
     catch { }
     SelectSoQuy();
     HienThiTongThe();
 }
Beispiel #24
0
 public frmBCXuatNhapTonNhomHang()
 {
     try
     {
         InitializeComponent();
         nam           = DateServer.Date().Year;
         thang         = DateServer.Date().Month;
         cbbthang.Text = thang.ToString();
         cbbnam.Text   = nam.ToString();
         SelectData();
         TongTienNhanVien();
     }
     catch
     {
     }
 }
Beispiel #25
0
 public frmXuLyNhaCungCap(string str1, string str2, DataGridViewRow dgvNCC)
 {
     try
     {
         InitializeComponent();
         datesv = DateServer.Date();
         XuLyString(str1, str2);
         id          = dgvNCC.Cells["NhaCungCapID"].Value.ToString();
         mancc       = txtMaNCC.Text = dgvNCC.Cells["MaNhaCungCap"].Value.ToString();
         tenncc      = txtTenNCC.Text = dgvNCC.Cells["TenNhaCungCap"].Value.ToString();
         diachi      = txtDiaChi.Text = dgvNCC.Cells["DiaChi"].Value.ToString();
         dienthoai   = mktxtdienthoai.Text = dgvNCC.Cells["DienThoai"].Value.ToString();
         fax         = txtFax.Text = dgvNCC.Cells["Fax"].Value.ToString();
         email       = txtEmail.Text = dgvNCC.Cells["Email"].Value.ToString();
         website     = txtWebsite.Text = dgvNCC.Cells["Website"].Value.ToString();
         mst         = txtMasothue.Text = dgvNCC.Cells["MST"].Value.ToString();
         nguoilienhe = txtNguoilienhe.Text = dgvNCC.Cells["NguoiLienHe"].Value.ToString();
         ghichu      = txtGhichu.Text = dgvNCC.Cells["GhiChu"].Value.ToString();
         duno        = txtduno.Text = dgvNCC.Cells["DuNo"].Value.ToString();
         Entities.DonHangNCC[] lay = new Entities.DonHangNCC[0];
         dataGridView1.DataSource = lay;
         for (int j = 1; j < dataGridView1.ColumnCount; j++)
         {
             dataGridView1.Columns[j].Visible = false;
         }
         dataGridView1.RowHeadersVisible     = false;
         dataGridView1.Columns[0].Visible    = false;
         dataGridView1.Columns[1].Visible    = true;
         dataGridView1.Columns[1].HeaderText = "Mã Đơn Đặt Hàng";
         dataGridView1.Columns[2].Visible    = true;
         dataGridView1.Columns[2].HeaderText = "Mã Nhà Cung Cấp";
         dataGridView1.Columns[3].Visible    = true;
         dataGridView1.Columns[3].HeaderText = "Ngày Đơn Hàng";
         dataGridView1.Columns[4].Visible    = true;
         dataGridView1.Columns[4].HeaderText = "Trạng Thái Đơn Hàng";
         dataGridView1.Columns[5].Visible    = true;
         dataGridView1.Columns[5].HeaderText = "Hình Thức Thanh Toán";
         dataGridView1.Columns[6].HeaderText = "Tổng Tiền";
         dataGridView1.Columns[6].Visible    = true;
         dataGridView1.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.Fill;
         dataGridView1.AllowUserToAddRows    = false;
         dataGridView1.AllowUserToDeleteRows = false;
         dataGridView1.AllowUserToResizeRows = false;
     }
     catch { }
 }
        public frm_Xuly_XacNhanDieuChuyenKho(DataGridViewRow dgvr)
        {
            InitializeComponent(); datesv = DateServer.Date();
            LayKhoHang(cbxTukho, dgvr.Cells[4].Value.ToString());
            LayKhoHang(cbxDenkho, dgvr.Cells[6].Value.ToString());
            HienThi(dgvr);

            if (txtSochungtunhap.Text == "")
            {
                HienThiChiTietTheoPDCK(txtSochungtu.Text);
            }
            else
            {
                if (txtSochungtunhap.Text != "")
                {
                    HienThiChiTiet(txtSochungtunhap.Text, cbxTukho.Text);
                }
            }
        }
Beispiel #27
0
 public frmBCLaiLo()
 {
     try
     {
         InitializeComponent();
         datesv        = DateServer.Date();
         nam           = datesv.Year;
         thang         = datesv.Month;
         cbbthang.Text = thang.ToString();
         cbbnam.Text   = nam.ToString();
         giaVon        = GiaVon();
         HDBanHang();
         ChiTietHDBanHang();
         HangHoa();
         GoiHang();
         TongTienNhanVien();
     }
     catch
     {
     }
 }
 public frmBCDoanhThuHangHoa()
 {
     try
     {
         InitializeComponent();
         SelectAll();
         datesv        = DateServer.Date();
         cbbnam.Text   = datesv.Year.ToString();
         cbbthang.Text = datesv.Month.ToString();
         cbbngay.Text  = datesv.Day.ToString();
         batdau        = Convert.ToDateTime(cbbthang.Text + "/" + cbbngay.Text + "/" + cbbnam.Text).ToShortDateString();
         ketthuc       = batdau;
         truoc         = Convert.ToDateTime(batdau);
         sau           = Convert.ToDateTime(ketthuc);
         TongTienHangHoa(truoc, sau);
         fix();
     }
     catch
     {
     }
 }
 public frmBCCongNoKhachHang()
 {
     InitializeComponent();
     try
     {
         datesv = DateServer.Date();
         batdau = new Common.Utilities().MyDateConversion("01/" + datesv.Month.ToString() + "/" + datesv.Year.ToString());
         if (datesv.Month.ToString() == "12")
         {
             ketthuc = new Common.Utilities().MyDateConversion("01/01/" + (Convert.ToInt32(datesv.Year.ToString()) + 1).ToString());
         }
         else
         {
             ketthuc = new Common.Utilities().MyDateConversion("01/" + (Convert.ToInt32(datesv.Month.ToString()) + 1).ToString() + "/" + datesv.Year.ToString());
         }
         truoc = Convert.ToDateTime(batdau);
         sau   = Convert.ToDateTime(ketthuc);
     }
     catch
     {
     }
 }
        public frmBCNhapHangTheoNhom()
        {
            try
            {
                InitializeComponent();

                datesv        = DateServer.Date();
                nam           = datesv.Year;
                thang         = datesv.Month;
                cbbthang.Text = thang.ToString();
                cbbnam.Text   = nam.ToString();

                //DateTime a = DateTime.Now;
                BCNhapHangTheoNhomHang();
                //DateTime b = DateTime.Now;
                //double c = (b - a).TotalMilliseconds;   //498.0285  415.0238    449.0256

                //DateTime aa = DateTime.Now;
                TinhToan();
                //DateTime bb = DateTime.Now;
                //double cc = (bb - aa).TotalMilliseconds;   //177.0102

                //HoaDonNhap();
                //ChiTietHoaDonNhap();
                //PhieuDieuChuyenKhoNoiBo();
                //ChiTietPhieuDieuChuyenKho();
                //KhachHangTraLai();
                //ChiTietKhachHangTraLai();
                //HangHoa();
                //NhomHang();
                //GoiHang();
                //ChiTietGoiHang();

                //TongTienNhanVien();
            }
            catch { }
        }