partial void DeleteCHUNG_TU_THU_CHI(CHUNG_TU_THU_CHI instance);
 partial void UpdateCHUNG_TU_THU_CHI(CHUNG_TU_THU_CHI instance);
Exemple #3
0
        private void bbiLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!Kiem_Tra())
            {
                return;
            }

            string phan_loai = "";
            string ma_phan_loai = "";
            switch (cbLoai.Text)
            {
                case "Thu tiền khách chuộc đồ":
                    phan_loai = "Chuộc";
                    ma_phan_loai = "Chuoc";
                    break;
                case "Thu tiền khách trả tiền lời":
                    phan_loai = "Trả tiền lời";
                    ma_phan_loai = "Loi";
                    break;
                case "Thu tiền khách trả bớt tiền":
                    phan_loai = "Trả bớt tiền";
                    ma_phan_loai = "Bot";
                    break;
                default:
                    phan_loai = "Thu khác";
                    ma_phan_loai = "Thu Khac";
                    break;
            }

            try
            {
                DB_Quan_Ly_Cam_DoDataContext db = new DB_Quan_Ly_Cam_DoDataContext(SqlHelper.ConnectionString);
                if (tinh_trang == "them")
                {
                    CHUNG_TU_THU_CHI cttc = new CHUNG_TU_THU_CHI();
                    cttc.Ma = txtMa.Text;
                    cttc.Ngay = txtNgay.DateTime;
                    cttc.Ngay_Ghi_So = txtNgayGhiSo.DateTime;
                    cttc.Ma_Chung_Tu_Cam_Do = txtMaChungTuCamDo.Text;
                    cttc.Loai = "Thu";
                    cttc.Ma_Phan_Loai = ma_phan_loai;
                    cttc.Phan_Loai = phan_loai;
                    cttc.Ten_Loai = cbLoai.Text;
                    cttc.So_Tien_Cam = txtSoTienCam.Value;
                    cttc.Tien_Lai = txtTienLai.Value;
                    cttc.So_Tien_Thu = txtSoTien.Value;
                    cttc.So_Tien_Chi = 0;
                    cttc.Ghi_Chu = txtGhi_Chu.Text;
                    cttc.Sap_Xep = 0;

                    db.CHUNG_TU_THU_CHIs.InsertOnSubmit(cttc);
                }
                else
                {
                    var cttc = (from ct in db.CHUNG_TU_THU_CHIs
                               where ct.Ma == txtMa.Text
                               select ct).FirstOrDefault();

                    cttc.Ma = txtMa.Text;
                    cttc.Ngay = txtNgay.DateTime;
                    cttc.Ngay_Ghi_So = txtNgayGhiSo.DateTime;
                    cttc.Ma_Chung_Tu_Cam_Do = txtMaChungTuCamDo.Text;
                    cttc.Loai = "Thu";
                    cttc.Ma_Phan_Loai = ma_phan_loai;
                    cttc.Phan_Loai = phan_loai;
                    cttc.Ten_Loai = cbLoai.Text;
                    cttc.So_Tien_Cam = txtSoTienCam.Value;
                    cttc.Tien_Lai = txtTienLai.Value;
                    cttc.So_Tien_Thu = txtSoTien.Value;
                    cttc.So_Tien_Chi = 0;
                    cttc.Ghi_Chu = txtGhi_Chu.Text;
                    cttc.Sap_Xep = 0;
                }

                db.SubmitChanges();

                CapNhatCMNDPhieuCamDo();

                RaiseReloadEventHander();
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 partial void InsertCHUNG_TU_THU_CHI(CHUNG_TU_THU_CHI instance);
Exemple #5
0
        private void bbiLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!Kiem_Tra())
            {
                return;
            }

            string phan_loai = "";
            string ma_phan_loai = "";
            switch (cbLoai.Text)
            {
                case "Chi tiền khách lấy thêm tiền":
                    phan_loai = "Lấy thêm tiền";
                    ma_phan_loai = "Them";
                    break;
                default:
                    phan_loai = "Chi khác";
                    ma_phan_loai = "Chi Khac";
                    break;
            }

            try
            {
                if (tinh_trang == "them")
                {
                    CHUNG_TU_THU_CHI cttc = new CHUNG_TU_THU_CHI();
                    cttc.Ma = txtMa.Text;
                    cttc.Ngay = txtNgay.DateTime;
                    cttc.Ngay_Ghi_So = txtNgayGhiSo.DateTime;
                    cttc.Ma_Chung_Tu_Cam_Do = txtMa_Chung_Tu_Cam_Do.Text;
                    cttc.Loai = "Chi";
                    cttc.Ma_Phan_Loai = ma_phan_loai;
                    cttc.Phan_Loai = phan_loai;
                    cttc.Ten_Loai = cbLoai.Text;
                    cttc.So_Tien_Thu = 0;
                    cttc.So_Tien_Chi = txtSoTien.Value;
                    cttc.Ghi_Chu = txtGhi_Chu.Text;
                    cttc.Sap_Xep = 0;

                    db.CHUNG_TU_THU_CHIs.InsertOnSubmit(cttc);
                }
                else
                {
                    var cttc = (from ct in db.CHUNG_TU_THU_CHIs
                               where ct.Ma == txtMa.Text
                               select ct).FirstOrDefault();

                    cttc.Ma = txtMa.Text;
                    cttc.Ngay = txtNgay.DateTime;
                    cttc.Ngay_Ghi_So = txtNgayGhiSo.DateTime;
                    cttc.Ma_Chung_Tu_Cam_Do = txtMa_Chung_Tu_Cam_Do.Text;
                    cttc.Loai = "Chi";
                    cttc.Ma_Phan_Loai = ma_phan_loai;
                    cttc.Phan_Loai = phan_loai;
                    cttc.Ten_Loai = cbLoai.Text;
                    cttc.So_Tien_Thu = 0;
                    cttc.So_Tien_Chi = txtSoTien.Value;
                    cttc.Ghi_Chu = txtGhi_Chu.Text;
                    cttc.Sap_Xep = 0;
                }

                db.SubmitChanges();
                RaiseReloadEventHander();
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }