예제 #1
0
 private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (e.Column.FieldName == "MaSP")
     {
         var value = gridView1.GetRowCellValue(e.RowHandle, e.Column);
         var dt = hh.GetSPTheoMaHang((string)value);
         if (dt != null)
         {
             string tenSP = (string)dt.Rows[0]["TenSP"];
             gridView1.SetRowCellValue(e.RowHandle, "TenSP", tenSP);
             gridView1.SetRowCellValue(e.RowHandle, "DonVi", dt.Rows[0]["DonVi"]);
             gridView1.SetRowCellValue(e.RowHandle, "DonGia", dt.Rows[0]["GiaMua"]);
         }
     }
 }
예제 #2
0
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "MaSP")
            {
                var value = gridView1.GetRowCellValue(e.RowHandle, e.Column);
                var dt    = hh.GetSPTheoMaHang((string)value);
                if (dt != null)
                {
                    string tenSP = (string)dt.Rows[0]["TenSP"];
                    gridView1.SetRowCellValue(e.RowHandle, "TenSP", tenSP);
                    gridView1.SetRowCellValue(e.RowHandle, "DonVi", dt.Rows[0]["DonVi"]);
                    gridView1.SetRowCellValue(e.RowHandle, "DonGia", dt.Rows[0]["GiaMua"]);
                }
            }

            if (e.Column.FieldName == "SoLuong")
            {
                ck  = Convert.ToDecimal(txtCK.EditValue) / 100;
                vat = Convert.ToDecimal(txtVAT.EditValue) / 100;

                soluong   = Convert.ToDecimal(gridView1.GetFocusedRowCellValue(colSoLuong));
                dongia    = Convert.ToDecimal(gridView1.GetFocusedRowCellValue(colDonGia));
                thanhtien = soluong * dongia;

                if (ck != 0 && vat != 0)
                {
                    thanhtien = (thanhtien + (thanhtien * vat)) - (thanhtien * ck);
                }
                else if (ck == 0 && vat != 0)
                {
                    thanhtien = thanhtien + (thanhtien * vat);
                }

                int tt = (int)thanhtien;

                gridView1.SetFocusedRowCellValue(colThanhTien, thanhtien);

                for (int i = 0; i < gridView1.DataRowCount; i++)
                {
                    tt += Convert.ToInt32(gridView1.GetRowCellValue(i, "ThanhTien"));
                }

                txtThanhToan.EditValue = tt.ToString();
            }
        }
예제 #3
0
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "MaSP")
            {
                var value = gridView1.GetRowCellValue(e.RowHandle, e.Column);
                var dt    = hh.GetSPTheoMaHang((string)value);
                if (dt != null)
                {
                    string tenSP = (string)dt.Rows[0]["TenSP"];
                    gridView1.SetRowCellValue(e.RowHandle, "TenSP", tenSP);
                    gridView1.SetRowCellValue(e.RowHandle, "DonVi", dt.Rows[0]["DonVi"]);
                    gridView1.SetRowCellValue(e.RowHandle, "DonGia", dt.Rows[0]["GiaMua"]);
                }
            }

            if (e.Column.FieldName == "SoLuong")
            {
                soluong   = Convert.ToDecimal(gridView1.GetFocusedRowCellValue(colSoLuong));
                dongia    = Convert.ToDecimal(gridView1.GetFocusedRowCellValue(colDonGia));
                thanhtien = soluong * dongia;
                gridView1.SetFocusedRowCellValue(colThanhTien, thanhtien);
            }
        }