Exemple #1
0
        private void save()
        {
            PhieuGachNo iPhieuGachNo = new PhieuGachNo();

            iPhieuGachNo.PhieuGachNoID = PhieuGachNoController.TaoMaPhieuGachNo("GN", 8);
            iPhieuGachNo.KhachHangID   = txtKhachHangID.Text;
            iPhieuGachNo.TenKhachHang  = txtTenKhachHang.Text;
            iPhieuGachNo.TienNoHienTai = calcEditConNo.Value;
            iPhieuGachNo.TienThu       = calcEditSoTienThu.Value;
            iPhieuGachNo.NguoiDungID   = txtNhanVien.Text;
            iPhieuGachNo.NgayGachNo    = dateEditNgayThu.DateTime;
            List <PhieuGachNoChiTiet> ListPhieu = new List <PhieuGachNoChiTiet>();

            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (Convert.ToBoolean(gridView1.GetRowCellValue(i, "Chon")))
                {
                    PhieuGachNoChiTiet newitem = new PhieuGachNoChiTiet();
                    newitem.DonHangID     = gridView1.GetRowCellValue(i, "DonHangID").ToString();
                    newitem.PhieuGachNoID = iPhieuGachNo.PhieuGachNoID;
                    newitem.TienNo        = Convert.ToDecimal(gridView1.GetRowCellValue(i, "ConNo"));
                    ListPhieu.Add(newitem);
                }
            }
            PhieuGachNoController.Add(iPhieuGachNo, ListPhieu);
            //fanit82 modify for v3
            //đưa tiền gạch nợ vào quỹ tiền mặt
            QuyTienMatController.NhapQuyTienMat(iPhieuGachNo.PhieuGachNoID, iPhieuGachNo.NgayGachNo, iPhieuGachNo.TienThu, "GN", "Khách trả tiền nợ");
            txtSoPhieu.Text = iPhieuGachNo.PhieuGachNoID;
            strTrangThai    = "view";
            DieuKhienTrangThai();
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            decimal decTongTienTra = 0;

            if (itemDonHang == null)
            {
                MessageBox.Show("Chưa tìm thấy đơn hàng cần trả");
                return;
            }
            List <TraHangChiTiet> ListTraHang = new List <TraHangChiTiet>();

            if ((tblDS == null) || (tblDS.Rows.Count == 0))
            {
                MessageBox.Show("Chưa tìm thấy đơn hàng cần trả");
                return;
            }
            else
            {
                foreach (DataRow item in tblDS.Rows)
                {
                    TraHangChiTiet newitem = new TraHangChiTiet();
                    newitem.SanPhamID = item["SanPhamID"].ToString();
                    int intSoLuongBan = 0;
                    int.TryParse(item["SoLuong"].ToString(), out intSoLuongBan);
                    newitem.SoLuongBan = intSoLuongBan;

                    int intSoLuongTra = 0;
                    int.TryParse(item["SLTraLai"].ToString(), out intSoLuongTra);
                    newitem.SoLuongTra = intSoLuongTra;
                    newitem.TenSanPham = item["TenSanPham"].ToString();
                    decimal decDonGia = 0;
                    decimal.TryParse(item["DonGia"].ToString(), out decDonGia);
                    newitem.DonGia = decDonGia;

                    decimal decDonGiaTra = 0;
                    decimal.TryParse(item["DonGiaTra"].ToString(), out decDonGiaTra);
                    newitem.DonGiaTra = decDonGiaTra;
                    decTongTienTra   += decDonGiaTra * intSoLuongTra;
                    ListTraHang.Add(newitem);
                }
            }
            TraHangItem              = new TraHang();
            TraHangItem.DonHangID    = txtDonHangID.Text;
            TraHangItem.NgayTra      = DateTime.Now;
            TraHangItem.NgayBan      = itemDonHang.NgayBan;
            TraHangItem.KhachHangID  = itemDonHang.KhachHangID;
            TraHangItem.TenKhachHang = itemDonHang.TenKhachHang;
            TraHangItem.NhanVienID   = Utility.NguoiSuDung.NguoiDungID;
            TraHangItem.TenNhanVien  = Utility.NguoiSuDung.TenNguoiDung;
            TraHangItem.GhiChu       = txtGhiChu.Text;
            TraHangItem.TongTienTra  = decTongTienTra;
            using (TransactionScope TScope = new TransactionScope())
            {
                TraHangController.Add(TraHangItem, ListTraHang);
                QuyTienMatController.XuatQuyTienMat(TraHangItem.TraHangID, TraHangItem.NgayTra, decTongTienTra, "RT", "Khách trả lại hàng");
                btnSave.Enabled = false;
                MessageBox.Show("Đã ghi thành công");
                TScope.Complete();
            }
        }
Exemple #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //string strPhanLoai = cbbPhanLoai.SelectedIndex == 0 ? "NT" : "XT";
            if (cbbPhanLoai.SelectedIndex == 0) //nhap
            {
                QuyTienMatController.NhapQuyTienMat(string.Empty, txtNgay.DateTime, txtSoTien.Value, "NT", txtGhiChu.Text);
            }
            else
            {
                QuyTienMatController.XuatQuyTienMat(string.Empty, txtNgay.DateTime, txtSoTien.Value, "XT", txtGhiChu.Text);
            }

            LockForm();
        }
Exemple #4
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            DateTime  dtBegin   = txtBegin.DateTime.Date;
            DateTime  dtEnd     = txtEnd.DateTime.Date.AddSeconds(86399);
            DataTable tblLichSu = QuyTienMatController.LichSuGiaoDich(dtBegin, dtEnd);

            gridControl1.DataSource = tblLichSu;
            gridView1.BestFitColumns();
            //if (tblLichSu.Rows.Count>0)
            //{
            //    txtDauNgay.EditValue = Convert.ToDecimal(tblLichSu.Rows[tblLichSu.Rows.Count - 1]["TienDauKy"].ToString());
            //    txtHienTai.EditValue = Convert.ToDecimal(tblLichSu.Rows[0]["TienCuoiKy"].ToString());
            //}
        }