Example #1
0
        private decimal TinhTongTienVaCongNo()
        {
            decimal ltongTien = 0;

            if (dgvNhapHang.Rows.Count == 0)
            {
                txtTongCong.Text = TienIch.ChuyenSoSangVND(ltongTien);
                return(ltongTien);
            }
            foreach (DataGridViewRow dgvRow in dgvNhapHang.Rows)
            {
                ltongTien += Convert.ToDecimal(dgvRow.Cells[4].Value.ToString());
            }
            if (cboHinhThucTra.SelectedIndex == 1)
            {
                if (Convert.ToDecimal(TienIch.HuyDinhDangSo(txtTraTruoc.Text == "" ? "0" : txtTraTruoc.Text)) <= ltongTien)
                {
                    ltongTien       -= Convert.ToDecimal(TienIch.HuyDinhDangSo(txtTraTruoc.Text == "" ? "0" : txtTraTruoc.Text));
                    txtTongCong.Text = TienIch.ChuyenSoSangVND(ltongTien);
                    return(ltongTien);
                }
            }
            txtTongCong.Text = TienIch.ChuyenSoSangVND(ltongTien);
            return(ltongTien);
        }
Example #2
0
        private void TinhTongTien()
        {
            long ltongTien = 0;

            foreach (DataGridViewRow dgvRow in dgvBanHang.Rows)
            {
                ltongTien += Convert.ToInt64(dgvRow.Cells[4].Value.ToString());
            }
            txtTongCong.Text = TienIch.ChuyenSoSangVND(ltongTien);
        }
Example #3
0
        private void TinhTongLoiNhuan()
        {
            decimal dTongLoiNhuan = 0;

            foreach (DataGridViewRow dgvRow in dgvLoiNhuanTongQuan.Rows)
            {
                dTongLoiNhuan += Convert.ToDecimal(dgvRow.Cells["colLoiNhuan"].Value.ToString());
            }
            txtTongLoiNhuan.Text = TienIch.ChuyenSoSangVND(dTongLoiNhuan);
        }
Example #4
0
        private void TinhTongDoanhThu()
        {
            decimal dTongDoanhthu = 0;

            foreach (DataGridViewRow dgvRow in dgvThongKeDoanhThu.Rows)
            {
                dTongDoanhthu += Convert.ToDecimal(dgvRow.Cells["colDoanhThu"].Value.ToString());
            }
            txtTongDoanhThu.Text = TienIch.ChuyenSoSangVND(dTongDoanhthu);
        }
Example #5
0
        private void TaiDuLieu()
        {
            dtSanPham = _SanPhamBUS.LayBangSanPham();
            dtSanPham.Columns.Add("TongTriGia", typeof(System.Int64));

            long lSL         = 0;
            long lTongTriGia = 0;

            foreach (DataRow dr in dtSanPham.Rows)
            {
                dr["TongTriGia"] = Convert.ToInt64(dr["SoLuong"]) * Convert.ToInt64(dr["GiaMua"]);
            }
            foreach (DataRow dr in dtSanPham.Rows)
            {
                lSL         += Convert.ToInt64(dr["SoLuong"]);
                lTongTriGia += Convert.ToInt64(dr["TongTriGia"]);
            }

            txtTongSL.Text     = lSL.ToString();
            txtTongTriGia.Text = TienIch.ChuyenSoSangVND(lTongTriGia);

            dgvTonKho.DataSource = dtSanPham;
        }