Esempio n. 1
0
        public void GetThongTin()
        {
            var dt = ExecSQL.ExecProcedureDataFistOrDefault <PhieuNhapXuat>("pro_ct_phieunhapxuat", new { option = 1, maphieu = txt_maphieu.Text });

            cbo_donvi.EditValue     = dt.madonvi;
            cbo_kho.EditValue       = dt.makho;
            cbo_loaiphieu.EditValue = dt.idloaiphieunhapxuat;
            txt_diengiai.Text       = dt.diengiai;
            txt_ngaynhap.EditValue  = dt.ngaynhap;
        }
Esempio n. 2
0
        private void cbo_donvi_EditValueChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cbo_donvi.Text))
            {
                return;
            }
            var dt = ExecSQL.ExecProcedureDataFistOrDefault <DonVi>("pro_get_donvi", new { option = 4, madonvi = cbo_donvi.EditValue });

            txt_donvi.Text  = dt.donvi;
            txt_diachi.Text = dt.diachi;
        }
Esempio n. 3
0
        private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            if (string.IsNullOrEmpty(txt_maphieu.Text))
            {
                Form1.Default.ShowMessageWarning("Bạn vui lòng nhập vào mã phiếu để tiếp tục.");
                return;
            }
            var view = (GridView)sender;
            var i    = view.FocusedRowHandle;

            switch (view.FocusedColumn.FieldName)
            {
            case "matruyen":
                var dt = ExecSQL.ExecProcedureDataFistOrDefault <TenTruyen>("pro_get_tentruyen", new { option = 2, matruyen = e.Value.ToString() });
                if (dt == null)
                {
                    return;
                }
                view.SetRowCellValue(i, "donvitinh", dt.donvitinh);
                view.SetRowCellValue(i, "tuatruyen", dt.tuatruyen);
                view.SetRowCellValue(i, "tentruyen", dt.tentruyen);
                view.SetRowCellValue(i, "tap", dt.tap);
                view.SetRowCellValue(i, "dongia", dt.giabia);
                view.SetRowCellValue(i, "slxuat", 1);
                view.SetRowCellValue(i, "thanhtien2", dt.giabia);
                break;

            case "slxuat":
                view.SetRowCellValue(i, "thanhtien2", Convert.ToInt32(e.Value) * Convert.ToInt32(view.GetRowCellValue(i, "dongia")));
                break;

            case "giabia":
                view.SetRowCellValue(i, "thanhtien2", Convert.ToInt32(e.Value) * Convert.ToInt32(view.GetRowCellValue(i, "slxuat")));
                break;
            }
        }