当前位置: 首页>>代码示例>>C#>>正文


C# Select.ExecuteAsCollection方法代码示例

本文整理汇总了C#中System.Data.Select.ExecuteAsCollection方法的典型用法代码示例。如果您正苦于以下问题:C# Select.ExecuteAsCollection方法的具体用法?C# Select.ExecuteAsCollection怎么用?C# Select.ExecuteAsCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.Select的用法示例。


在下文中一共展示了Select.ExecuteAsCollection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HuyXacNhanPhieuNhapKho

        /// <summary>
        /// hàm thực hiện việc xác nhận thông tin 
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <returns></returns>
        public ActionResult HuyXacNhanPhieuNhapKho(TPhieuNhapxuatthuoc objPhieuNhap, ref string errMsg)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {

                            ActionResult _Kiemtrathuochuyxacnhan = Kiemtrathuochuyxacnhan(objPhieuNhap, objPhieuNhapCt);
                            if (_Kiemtrathuochuyxacnhan != ActionResult.Success) return _Kiemtrathuochuyxacnhan;
                            //Xóa toàn bộ chi tiết trong TBiendongThuoc
                            new Delete().From(TBiendongThuoc.Schema)
                                .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu)
                                .And(TBiendongThuoc.IdPhieuChitietColumn).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet)
                                   .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();

                            new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(-1)
                                .Set(TPhieuNhapxuatthuocChitiet.Columns.NgayNhap).EqualTo(null)
                               .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();

                            StoredProcedure sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhonhap,objPhieuNhapCt.IdThuoc, objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                       Utility.DecimaltoDbnull(objPhieuNhap.Vat), objPhieuNhapCt.SoLuong,objPhieuNhapCt.IdThuockho,objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo,
                                                                       0, errMsg);

                            sp.Execute();
                        }

                        new Update(TPhieuNhapxuatthuoc.Schema)
                            .Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(-1)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0)
                            .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi hủy xác nhận nhập kho", ex);
                return ActionResult.Error;

            }
        }
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:58,代码来源:THUOC_NHAPKHO.cs

示例2: HuyXacNhanPhieuHuy_thanhly_Thuoc

        public ActionResult HuyXacNhanPhieuHuy_thanhly_Thuoc(TPhieuNhapxuatthuoc objPhieuNhap, ref string errMsg)
        {
            HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties;
            string errorMessage = "";
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {
                            long idthuockho = -1;
                            //Nhập lại kho thanh lý
                            StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                      objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                                      objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhoxuat, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo,
                                                                      objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, idthuockho, idthuockho, objPhieuNhapCt.NgayNhap, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);
                            sp.Execute();
                            idthuockho = Utility.Int64Dbnull(sp.OutputValues[0], -1);
                            if (idthuockho != objPhieuNhapCt.IdThuockho)//Nếu ai đó xóa bằng tay trong bảng thuốc kho thì cần update lại
                                new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(idthuockho)
                                    .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();
                        }
                        //Xóa toàn bộ chi tiết trong TBiendongThuoc
                        new Delete().From(TBiendongThuoc.Schema)
                            .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu)
                            .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();
                        new Update(TPhieuNhapxuatthuoc.Schema)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0)
                            .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu)
                            .And(TPhieuNhapxuatthuoc.LoaiPhieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi hủy xác nhận phiếu ",ex);
                return ActionResult.Error;
            }
        }
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:52,代码来源:XuatThuocAo.cs

示例3: cmdDungChuyenCLS_Click

 /// <summary>
 ///     hàm thực hiện việc hiển thị thông tin
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdDungChuyenCLS_Click(object sender, EventArgs e)
 {
     try
     {
         Utility.EnableButton(cmdDungChuyenCLS, false);
         Utility.WaitNow(this);
         SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema)
             .Where(KcbChidinhclsChitiet.Columns.IdChidinh).In(
                 new Select(KcbChidinhcl.Columns.IdChidinh).From(KcbChidinhcl.Schema).Where(
                     KcbChidinhcl.Columns.MaLuotkham)
                     .IsEqualTo(txtPatient_Code.Text)
                     .And(KcbChidinhcl.Columns.IdBenhnhan)
                     .IsEqualTo(Utility.Int32Dbnull(txtPatient_ID.Text)))
             .And(KcbChidinhclsChitiet.Columns.TrangThai).IsEqualTo(0)
             .And(KcbChidinhclsChitiet.Columns.TrangthaiChuyencls).IsEqualTo(1);
         if (sqlQuery.GetRecordCount() <= 0)
         {
             Utility.ShowMsg(
                 "Các chỉ định CLS đã được phòng Xét nghiệm nhận về nên bạn không thể hủy chuyển. Đề nghị liên hệ với phòng XN",
                 "Thông báo", MessageBoxIcon.Error);
             return;
         }
         var assignDetailCollection = sqlQuery.ExecuteAsCollection<KcbChidinhclsChitietCollection>();
         foreach (KcbChidinhclsChitiet assignDetail in assignDetailCollection)
         {
             assignDetail.TrangthaiChuyencls = (byte?)TrangThaiCLS.KhongChuyenCLS;
             assignDetail.NguoiSua = globalVariables.UserName;
             assignDetail.NgaySua = globalVariables.SysDate;
             //assignDetail.IpMacSua = globalVariables.IpMacAddress;
             //assignDetail.IpMaySua = globalVariables.IpAddress;
             new Update(KcbChidinhclsChitiet.Schema)
                 .Set(KcbChidinhclsChitiet.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                 .Set(KcbChidinhclsChitiet.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                 .Set(KcbChidinhclsChitiet.Columns.TrangthaiChuyencls).EqualTo(assignDetail.TrangthaiChuyencls)
                 .Where(KcbChidinhclsChitiet.Columns.IdChitietchidinh).IsEqualTo(assignDetail.IdChitietchidinh).Execute();
         }
         // assignDetailCollection.SaveAll();
         cmdChuyenCLS.Enabled = true;
         cmdDungChuyenCLS.Enabled = false;
     }
     catch (Exception exception)
     {
     }
     finally
     {
         Utility.EnableButton(cmdDungChuyenCLS, true);
         Utility.DefaultNow(this);
     }
 }
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:54,代码来源:frm_THANHTOAN_NGOAITRU_140811_truockhikichhoatphanHoadondo.cs

示例4: XacNhanPhieuXuatKho

        /// <summary>
        /// hàm thực hiện việc xác nhận thông tin 
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <returns></returns>
        public ActionResult XacNhanPhieuXuatKho(TPhieuNhapxuatthuoc objPhieuNhap,DateTime ngayxacnhan, ref string errMsg)
        {
            HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties;
            string errorMessage = "";
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();
                        objPhieuNhap.NgayXacnhan = ngayxacnhan;
                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {
                            //Kiểm tra đề phòng Kho A-->Xuất kho B. Kho B xác nhận-->Xuất kho C. Kho B hủy xác nhận. Kho C xác nhận dẫn tới việc kho B chưa có thuốc để trừ kho

                            ActionResult _Kiemtrathuocxacnhan = Kiemtrathuocxacnhan(objPhieuNhap, objPhieuNhapCt, ref errMsg);
                            if (_Kiemtrathuocxacnhan != ActionResult.Success) return _Kiemtrathuocxacnhan;

                            long idthuockho = -1;
                            StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                      objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                                      objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhonhap,
                                                                      objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo,
                                                                      objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, -1, idthuockho, ngayxacnhan, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);
                            sp.Execute();
                            idthuockho = Utility.Int64Dbnull(sp.OutputValues[0], -1);
                            sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhoxuat, objPhieuNhapCt.IdThuoc,
                                                          objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                          Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                          Utility.Int32Dbnull(objPhieuNhapCt.SoLuong), objPhieuNhapCt.IdChuyen,
                                                          objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo,
                                                          objHisDuocProperties.XoaDulieuKhiThuocDaHet ? 1 : 0, errorMessage);

                            sp.Execute();
                            new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(idthuockho)
                               .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();
                            objPhieuNhapCt.IdThuockho = idthuockho;
                            //Insert dòng kho nhập
                            TBiendongThuoc objXuatNhap = new TBiendongThuoc();
                            objXuatNhap.IdPhieu = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieu);
                            objXuatNhap.IdPhieuChitiet = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieuchitiet);
                            objXuatNhap.MaPhieu = Utility.sDbnull(objPhieuNhap.MaPhieu);
                            objXuatNhap.DonGia = Utility.DecimaltoDbnull(objPhieuNhapCt.DonGia);
                            objXuatNhap.GiaBan = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBan);
                            objXuatNhap.IdChuyen = objPhieuNhapCt.IdChuyen;
                            objXuatNhap.NgayNhap = objPhieuNhapCt.NgayNhap;
                            objXuatNhap.GiaNhap = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaNhap);
                            objXuatNhap.SoHoadon = Utility.sDbnull(objPhieuNhap.SoHoadon);
                            objXuatNhap.SoChungtuKemtheo = objPhieuNhap.SoChungtuKemtheo;
                            objXuatNhap.GiaBhyt = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBhyt);
                            objXuatNhap.GiaBhytCu = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBhytCu);
                            objXuatNhap.GiaPhuthuDungtuyen = objPhieuNhapCt.GiaPhuthuDungtuyen;
                            objXuatNhap.GiaPhuthuTraituyen = objPhieuNhapCt.GiaPhuthuTraituyen;
                            objXuatNhap.Noitru = objPhieuNhap.NoiTru;
                            objXuatNhap.QuayThuoc = 0;
                            objXuatNhap.ThuocVay = 0;
                            objXuatNhap.PhuThu = 0;
                            objXuatNhap.DuTru = objPhieuNhap.DuTru;
                            objXuatNhap.SoLuong = Utility.Int32Dbnull(objPhieuNhapCt.SoLuong);
                            objXuatNhap.NgayTao = globalVariables.SysDate;
                            objXuatNhap.NguoiTao = globalVariables.UserName;
                            objXuatNhap.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapCt.ThanhTien);
                            objXuatNhap.IdThuoc = Utility.Int32Dbnull(objPhieuNhapCt.IdThuoc);
                            objXuatNhap.IdThuockho = Utility.Int32Dbnull(objPhieuNhapCt.IdThuockho);
                            objXuatNhap.Vat = Utility.Int32Dbnull(objPhieuNhap.Vat);
                            objXuatNhap.IdNhanvien = Utility.Int16Dbnull(objPhieuNhap.IdNhanvien);
                            objXuatNhap.IdKho = Utility.Int16Dbnull(objPhieuNhap.IdKhonhap);
                            objXuatNhap.NgayHethan = objPhieuNhapCt.NgayHethan.Date;
                            objXuatNhap.MaNhacungcap = objPhieuNhapCt.MaNhacungcap;
                            objXuatNhap.SoDky = objPhieuNhapCt.SoDky;
                            objXuatNhap.SoQdinhthau = objPhieuNhapCt.SoQdinhthau;
                            objXuatNhap.SoLo = objPhieuNhapCt.SoLo;

                            objXuatNhap.MaLoaiphieu = (byte)LoaiPhieu.PhieuNhapKho;
                            objXuatNhap.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapKho);
                            objXuatNhap.NgayBiendong = objPhieuNhap.NgayXacnhan;
                            objXuatNhap.NgayHoadon = objPhieuNhap.NgayHoadon;
                            objXuatNhap.KieuThuocvattu = objPhieuNhapCt.KieuThuocvattu;
                            objXuatNhap.IsNew = true;
                            objXuatNhap.Save();
                            //Insert dòng của kho xuất
                            objXuatNhap = new TBiendongThuoc();
                            objXuatNhap.IdPhieu = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieu);
                            objXuatNhap.IdPhieuChitiet = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieuchitiet);
                            objXuatNhap.MaPhieu = Utility.sDbnull(objPhieuNhap.MaPhieu);
                            objXuatNhap.DonGia = Utility.DecimaltoDbnull(objPhieuNhapCt.DonGia);
                            objXuatNhap.NgayNhap = objPhieuNhapCt.NgayNhap;
                            objXuatNhap.GiaBan = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBan);
                            objXuatNhap.GiaNhap = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaNhap);
                            objXuatNhap.GiaBhyt = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBhyt);
                            objXuatNhap.GiaBhytCu = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBhytCu);
//.........这里部分代码省略.........
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:101,代码来源:XuatThuocAo.cs

示例5: HuyXacNhanPhieuTrathuocTutrucKhoaVeKho

        public ActionResult HuyXacNhanPhieuTrathuocTutrucKhoaVeKho(TPhieuNhapxuatthuoc objPhieuNhap, ref string errMsg)
        {
            HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties;
            string errorMessage = "";
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {
                            //Kiểm tra ở kho nhập xem thuốc đã sử dụng chưa
                            ActionResult _Kiemtrathuochuyxacnhan = Kiemtrathuochuyxacnhan(objPhieuNhap, objPhieuNhapCt, ref errMsg);
                            if (_Kiemtrathuochuyxacnhan != ActionResult.Success) return _Kiemtrathuochuyxacnhan;
                            //Xóa biến động kho nhập
                            new Delete().From(TBiendongThuoc.Schema)
                                .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu)
                                .And(TBiendongThuoc.IdPhieuChitietColumn).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet)
                                .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo((byte)LoaiPhieu.PhieuNhapTraKhoLe).Execute();
                            //Xóa biến động kho xuất
                            new Delete().From(TBiendongThuoc.Schema)
                               .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu)
                               .And(TBiendongThuoc.IdPhieuChitietColumn).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet)
                               .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo((byte)LoaiPhieu.PhieuNhapTraKhoLe).Execute();

                            //Cộng trả lại kho xuất
                            long idthuockho = -1;
                            //Nhập theo tủ trực theo số lượng chia
                            int SluongChia = Utility.Int32Dbnull(objPhieuNhapCt.SluongChia, 1);
                            if (SluongChia <= 0) SluongChia = 1;//Nếu lỗi do người dùng sửa tay thì tự động đặt=1
                            //Chú ý khi lập phiếu xuất thuốc tủ trực thì
                            //objPhieuNhapCt.SoLuong= số lượng đã chia-->Cần trừ số lượng trong kho xuất theo số lượng nguyên gốc. Tức là phải lấy số lượng này / số lượng chia
                            int Sluong = objPhieuNhapCt.SoLuong * SluongChia;//Số lượng thực sự bị mất khỏi kho xuất(khi xuất thuốc sang tủ trực)
                            StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                      Sluong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                                      objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhoxuat, objPhieuNhapCt.MaNhacungcap,
                                                                      objPhieuNhapCt.SoLo, objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, -1, idthuockho, objPhieuNhapCt.NgayNhap, objPhieuNhapCt.GiaBhyt,
                                                                      objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);
                            sp.Execute();
                            idthuockho = Utility.Int64Dbnull(sp.OutputValues[0], -1);
                           //Xuất thứ nguyên từ kho nhận
                            sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhonhap, objPhieuNhapCt.IdThuoc,
                                                          objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                          Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                          objPhieuNhapCt.SoLuong, objPhieuNhapCt.IdThuockho, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objHisDuocProperties.XoaDulieuKhiThuocDaHet ? 1 : 0, errorMessage);
                            sp.Execute();
                            //Cạp nhật lại id_thuockho =-1(giá trị này được update khi xác nhận phiếu). Giá trị id_chuyen cho biết chuyển từ id_thuockho của kho nội trú.
                            new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(-1)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();
                        }
                        new Update(TPhieuNhapxuatthuoc.Schema)
                            .Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0)
                            .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu)
                            .And(TPhieuNhapxuatthuoc.LoaiPhieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi hủy xác nhận phiếu trả thuốc từ tủ trực về kho lẻ nội trú",ex);
                return ActionResult.Error;
            }
        }
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:74,代码来源:CapphatThuocKhoa.cs

示例6: XacNhanPhieuTrathuocThuatukhoanoitruveKhoLeNoitru

        public ActionResult XacNhanPhieuTrathuocThuatukhoanoitruveKhoLeNoitru(TPhieuNhapxuatthuoc objPhieuNhap, DateTime ngayxacnhan, ref string errMsg)
        {
            HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties;
            string errorMessage = "";
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();
                        objPhieuNhap.NgayXacnhan = ngayxacnhan;
                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {
                            ActionResult _Kiemtrathuocxacnhan = ActionResult.Success;
                            if (_Kiemtrathuocxacnhan != ActionResult.Success) return _Kiemtrathuocxacnhan;
                            long idthuockho = -1;
                            //Nhập vào kho nhận
                            StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                      objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                                      objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhonhap,
                                                                      objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau,
                                                                      -1, idthuockho, ngayxacnhan, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);
                            sp.Execute();
                            //Lấy về Id_thuockho tương ứng trong tủ trực
                            idthuockho = Utility.Int64Dbnull(sp.OutputValues[0], -1);

                            if (idthuockho > 0)
                                new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(idthuockho)
                                   .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();
                            else
                                idthuockho = Utility.Int64Dbnull(objPhieuNhapCt.IdThuockho, -1);
                            objPhieuNhapCt.IdThuockho = idthuockho;
                            //Insert dòng kho nhập
                            TBiendongThuoc objXuatNhap = new TBiendongThuoc();
                            objXuatNhap.IdPhieu = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieu);
                            objXuatNhap.IdPhieuChitiet = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieuchitiet);
                            objXuatNhap.MaPhieu = Utility.sDbnull(objPhieuNhap.MaPhieu);
                            objXuatNhap.DonGia = Utility.DecimaltoDbnull(objPhieuNhapCt.DonGia);
                            objXuatNhap.GiaBan = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBan);

                            objXuatNhap.GiaPhuthuDungtuyen = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaPhuthuDungtuyen);
                            objXuatNhap.GiaPhuthuTraituyen = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaPhuthuTraituyen);
                            objXuatNhap.GiaBhyt = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBhyt);
                            objXuatNhap.GiaBhytCu = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBhytCu);

                            objXuatNhap.IdChuyen = objPhieuNhapCt.IdChuyen;
                            objXuatNhap.NgayNhap = objPhieuNhapCt.NgayNhap;
                            objXuatNhap.GiaNhap = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaNhap);
                            objXuatNhap.SoHoadon = Utility.sDbnull(objPhieuNhap.SoHoadon);
                            objXuatNhap.SoChungtuKemtheo = objPhieuNhap.SoChungtuKemtheo;
                            objXuatNhap.PhuThu = 0;
                            objXuatNhap.DuTru = objPhieuNhap.DuTru;
                            objXuatNhap.Noitru = 0;
                            objXuatNhap.QuayThuoc = 0;
                            objXuatNhap.SoLuong = Utility.Int32Dbnull(objPhieuNhapCt.SoLuong);
                            objXuatNhap.SluongChia = Utility.Int32Dbnull(objPhieuNhapCt.SluongChia, 1);
                            objXuatNhap.NgayTao = globalVariables.SysDate;
                            objXuatNhap.NguoiTao = globalVariables.UserName;
                            objXuatNhap.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapCt.ThanhTien);
                            objXuatNhap.IdThuoc = Utility.Int32Dbnull(objPhieuNhapCt.IdThuoc);
                            objXuatNhap.IdThuockho = Utility.Int32Dbnull(objPhieuNhapCt.IdThuockho);
                            objXuatNhap.Vat = Utility.Int32Dbnull(objPhieuNhap.Vat);
                            objXuatNhap.IdNhanvien = Utility.Int16Dbnull(objPhieuNhap.IdNhanvien);
                            objXuatNhap.IdKho = Utility.Int16Dbnull(objPhieuNhap.IdKhonhap);
                            objXuatNhap.NgayHethan = objPhieuNhapCt.NgayHethan.Date;
                            objXuatNhap.MaNhacungcap = objPhieuNhapCt.MaNhacungcap;
                            objXuatNhap.SoLo = objPhieuNhapCt.SoLo;
                            objXuatNhap.SoDky = objPhieuNhapCt.SoDky;
                            objXuatNhap.SoQdinhthau = objPhieuNhapCt.SoQdinhthau;
                            objXuatNhap.IdKhoaLinh = objPhieuNhap.IdKhoalinh;//Chính là khoa trả

                            objXuatNhap.MaLoaiphieu = (byte)LoaiPhieu.Phieutrathuocthua;
                            objXuatNhap.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.Phieutrathuocthua);
                            objXuatNhap.NgayBiendong = objPhieuNhap.NgayXacnhan;
                            objXuatNhap.NgayHoadon = objPhieuNhap.NgayHoadon;
                            objXuatNhap.KieuThuocvattu = objPhieuNhapCt.KieuThuocvattu;
                            objXuatNhap.IsNew = true;
                            objXuatNhap.Save();
                        }
                        new Update(TPhieuNhapxuatthuoc.Schema)
                            .Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(globalVariables.gv_intIDNhanvien)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(globalVariables.UserName)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(ngayxacnhan)
                            .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(1)
                            .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu)
                            .And(TPhieuNhapxuatthuoc.LoaiPhieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute();
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception ex)
            {
                Utility.CatchException("Lỗi khi xác nhận phiếu trả thuốc từ tủ trực khoa nội trú về kho lẻ", ex);
                return ActionResult.Error;
            }
//.........这里部分代码省略.........
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:101,代码来源:CapphatThuocKhoa.cs

示例7: PerformActionPaymentChoose

        public ActionResult PerformActionPaymentChoose(KcbThanhtoan objPayment, KcbLuotkham objLuotkham, KcbThanhtoanChitiet[] objArrPaymentDetail, ref int Payment_Id)
        {
            decimal PtramBHYT = 0;
            ///tổng tiền hiện tại truyền vào của lần payment đang thực hiện
            decimal v_TotalOrginPrice = 0;
            ///tổng tiền đã thanh toán
            decimal v_TotalPaymentDetail = 0;
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {
                        ///lấy tổng số Payment của mang truyền vào của pay ment hiện tại
                        v_TotalOrginPrice = SumOfPaymentDetail_NGOAITRU(objArrPaymentDetail);

                        KcbThanhtoanCollection paymentCollection =
                            new KcbThanhtoanController().FetchByQuery(
                                KcbThanhtoan.CreateQuery().AddWhere(KcbThanhtoan.Columns.MaLuotkham, Comparison.Equals,
                                                                objLuotkham.MaLuotkham).AND(
                                                                    KcbThanhtoan.Columns.IdBenhnhan, Comparison.Equals,
                                                                    objLuotkham.IdBenhnhan).
                                    AND(KcbThanhtoan.Columns.KieuThanhtoan, Comparison.Equals, 0).AND(
                                        KcbThanhtoan.Columns.TrangThai, Comparison.Equals, 0));

                        foreach (KcbThanhtoan Payment in paymentCollection)
                        {
                            KcbThanhtoanChitietCollection paymentDetailCollection = new Select().From(KcbThanhtoanChitiet.Schema)
                                .Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).IsEqualTo(Payment.IdThanhtoan)
                                .And(KcbThanhtoanChitiet.Columns.TrangthaiHuy).IsEqualTo(0).ExecuteAsCollection
                                <KcbThanhtoanChitietCollection>();

                            foreach (KcbThanhtoanChitiet paymentDetail in paymentDetailCollection)
                            {
                                if (paymentDetail.TuTuc == 0)
                                    v_TotalPaymentDetail += Utility.Int32Dbnull(paymentDetail.SoLuong) *
                                                            Utility.DecimaltoDbnull(paymentDetail.DonGia);

                            }
                        }
                        ///lấy thông tin chiết khấu xem đã thực hiện chưa
                        LayThongPtramBHYT(v_TotalOrginPrice + v_TotalPaymentDetail, objLuotkham, ref PtramBHYT);
                        ///hàm thực hiện việc xử lý lại thông tin
                        XuLyChiKhauDacBietBHYT(objLuotkham, PtramBHYT);

                        objPayment.TrangthaiIn = 0;
                        objPayment.KieuThanhtoan = 0;
                        objPayment.NguoiIn = string.Empty;
                        //objPayment.TrongGoi = 0;
                        //objPayment.IpMacTao = THU_VIEN_CHUNG.GetMACAddress();
                        //objPayment.IpMayTao = THU_VIEN_CHUNG.GetIP4Address();
                        objPayment.MaThanhtoan = THU_VIEN_CHUNG.TaoMathanhtoan(Convert.ToDateTime(objPayment.NgayThanhtoan));
                        objPayment.IsNew = true;
                        objPayment.MaKhoaThuchien = globalVariables.MA_KHOA_THIEN;
                        objPayment.Save();
                        //StoredProcedure sp = SPs.KcbThanhtoanThemmoi(objPayment.IdThanhtoan, objPayment.MaLuotkham, objPayment.IdBenhnhan,
                        //                  objPayment.NgayThanhtoan, objPayment.StaffId, objPayment.TrangThai,
                        //                  objPayment.NguoiTao, objPayment.CreatedDate, objPayment.NgaySua,
                        //                  objPayment.NguoiSua, objPayment.PaymentCode, objPayment.KieuThanhtoan,
                        //                  objPayment.DaIn, objPayment.NgayIn, objPayment.NgayTHop, objPayment.NguoiIn,
                        //                  objPayment.NguoiTHop, Utility.Int32Dbnull(objPayment.TrongGoi), objPayment.IpMayTao, objPayment.IpMacTao, globalVariables.MA_KHOA_THIEN);
                        //sp.Execute();
                        //objPayment.IdThanhtoan = Utility.Int32Dbnull(sp.OutputValues[0], -1);
                        //objPayment.IdThanhtoan = Utility.Int32Dbnull(_QueryPayment.GetMax(KcbThanhtoan.Columns.IdThanhtoan), -1);
                        log.Info("Lay ma thanh toan cua phan thanh toan Payment_ID={0}", objPayment.IdThanhtoan);
                        ///hàm thực hiện việc mảng thao tác mảng của chi tiết thanh toán

                        switch (LayChiKhauChiTiet())
                        {
                            case "KHONG":
                                objArrPaymentDetail =THU_VIEN_CHUNG.TinhPhamTramBHYT(objLuotkham, objArrPaymentDetail, PtramBHYT);
                                break;
                            case "CO":
                                objArrPaymentDetail = THU_VIEN_CHUNG.TinhPhamTramBHYT(objArrPaymentDetail, objLuotkham, PtramBHYT);
                                break;
                            default:
                                objArrPaymentDetail = THU_VIEN_CHUNG.TinhPhamTramBHYT(objLuotkham, objArrPaymentDetail, PtramBHYT);
                                break;
                        }
                        decimal BN_CT = 0m;
                        foreach (KcbThanhtoanChitiet objPaymentDetail in objArrPaymentDetail)
                        {

                            ///thanh toán phần thuốc);
                            if (THU_VIEN_CHUNG.LayMaDviLamViec() == "DETMAY")
                            {
                                if (objPaymentDetail.IdLoaithanhtoan == 3)
                                {
                                    new Update(KcbDonthuoc.Schema)
                                        .Set(KcbDonthuoc.Columns.TrangthaiThanhtoan).EqualTo(1)
                                        .Set(KcbDonthuoc.Columns.TrangThai).EqualTo(2)///nếu =2 đối với đơn thuốc ngoại trú
                                        .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objPaymentDetail.IdPhieu).Execute();

                                }
                            }

                            switch (THU_VIEN_CHUNG.GetThanhToan_TraiTuyen())
                            {
                                case "PHUTHU":
                                    if (objPaymentDetail.IdLoaithanhtoan == 1)
//.........这里部分代码省略.........
开发者ID:khaha2210,项目名称:VXIS,代码行数:101,代码来源:KCB_DANGKY.cs

示例8: GetData

        private void GetData()
        {
            string ReasonBy = "";

               string sAccountName = THU_VIEN_CHUNG.LayMaDviLamViec();
               LayThongTinPaymentDetail(sAccountName);
            //grdPaymentDetail.DataSource = m_dtPaymentDetail;

            SqlQuery sqlQuery = new Select().From(TPhieuthu.Schema)
                .Where(TPhieuthu.Columns.PaymentId).IsEqualTo(Utility.Int32Dbnull(txtPayment_ID.Text)).And(
                    TPhieuthu.Columns.LoaiPhieu).IsEqualTo(status);

            if (sqlQuery.GetRecordCount() <= 0)
            {
                TPayment objPayment = TPayment.FetchByID(Utility.Int32Dbnull(txtPayment_ID.Text, -1));
                if (objPayment != null)
                {
                    dtCreateDate.Value = Convert.ToDateTime(objPayment.PaymentDate);
                    txtPayment_ID.Text = Utility.sDbnull(objPayment.PaymentId, "-1");
                    txtMA_PTHU.Text = THU_VIEN_CHUNG.GetMaPhieuThu(dtCreateDate.Value,0);
                    Janus.Windows.GridEX.GridEXColumn gridExColumn = grdPaymentDetail.RootTable.Columns["TONG"];
                    txtSO_TIEN.Text = Utility.sDbnull(grdPaymentDetail.GetTotal(gridExColumn, Janus.Windows.GridEX.AggregateFunction.Sum));
                    txtSLUONG_CTU_GOC.Text = "1";
                    TPatientInfo objPatientInfo = TPatientInfo.FetchByID(objPayment.PatientId);
                    if (objPatientInfo != null)
                    {
                        txtNGUOI_NOP.Text = objPatientInfo.PatientName;
                        label9.Text = "Người nhận";
                    }
                    var query = (from loz in grdPaymentDetail.GetDataRows().AsEnumerable()
                                 let x=Utility.sDbnull(loz.Cells[TPaymentDetail.Columns.ServiceDetailName].Value)
                                 let y=loz.RowType
                                 where(x!="")  &&(y==Janus.Windows.GridEX.RowType.Record)
                                 select x).ToArray();
                    txtLDO_NOP.Text = string.Join(";", query);

                }
            }
            else
            {
                var objPhieuthu = sqlQuery.ExecuteSingle<TPhieuthu>();
                if (objPhieuthu != null)
                {
                    txtSLUONG_CTU_GOC.Text = Utility.sDbnull(objPhieuthu.SluongCtuGoc, 1);
                    txtMA_PTHU.Text = Utility.sDbnull(objPhieuthu.MaPthu, "");
                    txtNGUOI_NOP.Text = Utility.sDbnull(objPhieuthu.NguoiNop);
                    txtSO_TIEN.Text = Utility.sDbnull(objPhieuthu.SoTien);
                    txtTKHOAN_CO.Text = Utility.sDbnull(objPhieuthu.TkhoanCo, "");
                    txtTKHOAN_NO.Text = Utility.sDbnull(objPhieuthu.TkhoanNo, "");
                    txtLDO_NOP.Text = Utility.sDbnull(objPhieuthu.LdoNop);
                    dtCreateDate.Value = Convert.ToDateTime(objPhieuthu.NgayThien);
                }
            }
            sqlQuery = new Select().From(TPaymentDetail.Schema)
              .Where(TPaymentDetail.Columns.PaymentId).IsEqualTo(Utility.Int32Dbnull(txtPayment_ID.Text))
              .And(TPaymentDetail.Columns.IsCancel).IsEqualTo(0);
            TPaymentDetailCollection objPaymentDetailCollection = sqlQuery.ExecuteAsCollection<TPaymentDetailCollection>();
            txtSoTienGoc.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.OriginPrice));
            txtTienBHCT.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.DiscountRate));
            txtTienBNCT.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.DiscountPrice));
            txtTienPhuThu.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.Quantity * c.SurchargePrice));
            txtTienBNPhaiTra.Text =
                Utility.sDbnull(Utility.DecimaltoDbnull(txtTienPhuThu.Text) + Utility.DecimaltoDbnull(txtTienBNCT.Text));
            Utility.SetMessage(lblMoneyLetter, new MoneyByLetter().sMoneyToLetter(txtTienBNPhaiTra.Text), true);
        }
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:65,代码来源:frm_PHIEUTHU_DV.cs

示例9: HuyThongTinLanThanhToan

 public ActionResult HuyThongTinLanThanhToan(KcbThanhtoan objThanhtoan, KcbLuotkham objLuotkham, string lydohuy, int IdHdonLog, bool HuyBienlai)
 {
     try
     {
         decimal v_TotalPaymentDetail = 0;
         decimal v_DiscountRate = 0;
         using (var scope = new TransactionScope())
         {
             using (var dbscope = new SharedDbConnectionScope())
             {
                 if (Utility.Byte2Bool(objLuotkham.TrangthaiNoitru) && Utility.Byte2Bool(objThanhtoan.NoiTru))
                 {
                     if (THU_VIEN_CHUNG.Laygiatrithamsohethong("NOITRU_TUDONGHOANUNG_KHITHANHTOANNOITRU", "0", false) == "1")
                     SPs.NoitruHuyhoanung(objLuotkham.MaLuotkham, objLuotkham.IdBenhnhan,(byte)1).Execute();
                 }
                 else
                 {
                     if (THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_KICHHOAT_TAMUNG_NGOAITRU", "0", false) == "1")
                         if (THU_VIEN_CHUNG.Laygiatrithamsohethong("NGOAITRU_TUDONGHOANUNG_KHITHANHTOANNGOAITRU", "0", false) == "1")
                             SPs.NoitruHuyhoanung(objLuotkham.MaLuotkham, objLuotkham.IdBenhnhan, (byte)0).Execute();
                 }
                 if (IdHdonLog > 0)
                     if (HuyBienlai)
                         new Update(HoadonLog.Schema).Set(HoadonLog.Columns.TrangThai).EqualTo(1)
                             .Where(HoadonLog.Columns.IdHdonLog).IsEqualTo(IdHdonLog).Execute();
                     else
                         new Delete().From(HoadonLog.Schema)
                             .Where(HoadonLog.Columns.IdHdonLog).IsEqualTo(IdHdonLog).Execute();
                 SqlQuery sqlQuery =
                     new Select().From(KcbThanhtoanChitiet.Schema).Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).IsEqualTo(
                         objThanhtoan.IdThanhtoan);
                 KcbThanhtoanChitietCollection arrPaymentDetails = sqlQuery.ExecuteAsCollection<KcbThanhtoanChitietCollection>();
                 KcbLoghuy objKcbLoghuy = new KcbLoghuy();
                 objKcbLoghuy.IdBenhnhan = objThanhtoan.IdBenhnhan;
                 objKcbLoghuy.MaLuotkham = objThanhtoan.MaLuotkham;
                 objKcbLoghuy.IdNhanvien = globalVariables.gv_intIDNhanvien;
                 objKcbLoghuy.SotienHuy = objThanhtoan.TongTien;
                 objKcbLoghuy.LydoHuy = lydohuy;
                 objKcbLoghuy.NgayHuy = DateTime.Now;
                 objKcbLoghuy.NgayTao = DateTime.Now;
                 objKcbLoghuy.NguoiTao = globalVariables.UserName;
                 objKcbLoghuy.IsNew = true;
                 objKcbLoghuy.LoaiphieuHuy = Utility.ByteDbnull(objThanhtoan.KieuThanhtoan, 0);
                 objKcbLoghuy.Save();
                 if (objThanhtoan != null)
                     HUYTHONGTIN_THANHTOAN(arrPaymentDetails, objThanhtoan);
                 new Delete().From(KcbPhieuDct.Schema)
                     .Where(KcbPhieuDct.Columns.MaLuotkham).IsEqualTo(objThanhtoan.MaLuotkham)
                     .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(objThanhtoan.IdBenhnhan)
                     .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(objThanhtoan.KieuThanhtoan).Execute();
                 if (objLuotkham != null)
                 {
                     byte locked = (byte)(objLuotkham.MaDoituongKcb == "DV" ? objLuotkham.Locked : 0);
                     new Update(KcbLuotkham.Schema)
                         .Set(KcbLuotkham.Columns.NgayKetthuc).EqualTo(null)
                         .Set(KcbLuotkham.Columns.NguoiKetthuc).EqualTo(string.Empty)
                         .Set(KcbLuotkham.Columns.Locked).EqualTo(locked)
                         .Set(KcbLuotkham.Columns.TrangthaiNgoaitru).EqualTo(locked)
                         .Set(KcbLuotkham.Columns.TthaiThanhtoannoitru).EqualTo(0)
                         .Set(KcbLuotkham.Columns.LydoKetthuc).EqualTo("")
                         .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham)
                         .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan).Execute();
                 }
                 KcbThanhtoan.Delete(objThanhtoan.IdThanhtoan);
                 new Delete().From(KcbThanhtoanPhanbotheoPTTT.Schema).Where(KcbThanhtoanPhanbotheoPTTT.Columns.IdThanhtoan).IsEqualTo(objThanhtoan.IdThanhtoan).Execute();
                 if (objLuotkham != null) log.Info(string.Format("Phiếu thanh toán ID: {0} của bệnh nhân: {1} - ID Bệnh nhân: {2} đã được hủy bởi :{3} với lý do hủy :{4}", objThanhtoan.IdThanhtoan.ToString(), objLuotkham.MaLuotkham, objLuotkham.IdBenhnhan, globalVariables.UserName, lydohuy));
             }
             scope.Complete();
             return ActionResult.Success;
         }
     }
     catch (Exception exception)
     {
         log.Error("Loi trong qua trinh huy thong tin {0}", exception.ToString());
         return ActionResult.Error;
     }
 }
开发者ID:vmshis2020,项目名称:VMSHISServer,代码行数:77,代码来源:KCB_THANHTOAN.cs

示例10: frm_KiemTra_BHYT_Load

        /// <summary>
        /// hàm thưc hiện việc load thông tin của kiểm tra thông tin của bảo hiểm y tế khi laod form heienj tại
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frm_KiemTra_BHYT_Load(object sender, EventArgs e)
        {
            txtTieuDe.Text = Utility.sDbnull(tieude);
            if(objLuotkham!=null)
            {
                LayThongTinPaymentDetail();
                SqlQuery sqlQuery = new Select().From(KcbThanhtoanChitiet.Schema)
                    .Where(KcbThanhtoanChitiet.Columns.IdThanhtoan)
                    .In(
                        new Select(KcbThanhtoan.Columns.IdThanhtoan).From(KcbThanhtoan.Schema).Where(KcbThanhtoan.Columns.MaLuotkham).
                            IsEqualTo(
                                objLuotkham.MaLuotkham).And(KcbThanhtoan.Columns.IdBenhnhan).IsEqualTo(
                                    Utility.Int32Dbnull(objLuotkham.IdBenhnhan)).And(KcbThanhtoan.Columns.KieuThanhtoan).IsEqualTo(0))
                    .And(KcbThanhtoanChitiet.Columns.TrangthaiHuy).IsEqualTo(0)
                    .And(KcbThanhtoanChitiet.Columns.TuTuc).IsEqualTo(0);

                KcbThanhtoanChitietCollection objPaymentDetailCollection = sqlQuery.ExecuteAsCollection<KcbThanhtoanChitietCollection>();
                if (objPaymentDetailCollection.Count() > 0)
                {
                    txtSoTienGoc.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.SoLuong * c.DonGia));
                    txtTienBHCT.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.SoLuong * c.BhytChitra));
                    txtTienBNCT.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.SoLuong * c.BnhanChitra));
                    txtTienPhuThu.Text = Utility.sDbnull(objPaymentDetailCollection.Sum(c => c.SoLuong * c.PhuThu));
                    txtTienBNPhaiTra.Text =
                        Utility.sDbnull(Utility.DecimaltoDbnull(txtTienPhuThu.Text) + Utility.DecimaltoDbnull(txtTienBNCT.Text));
                    Utility.SetMsg(lblMoneyLetter, new MoneyByLetter().sMoneyToLetter(txtTienBNPhaiTra.Text), true);
                }
            }
        }
开发者ID:vmshis2020,项目名称:VMSHISServer,代码行数:34,代码来源:frm_KiemTra_BHYT.cs

示例11: XacNhanPhieuNhapKho

        /// <summary>
        /// hàm thực hiện việc xác nhận thông tin 
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <returns></returns>
        public ActionResult XacNhanPhieuNhapKho(TPhieuNhapxuatthuoc objPhieuNhap,DateTime ngayxacnhan)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        //Sẽ hướng đơn vị theo kiểu bốc thuốc trong bảng t_thuockho+Cho nhập giá BHYT,giá DV ngay tại chức năng nhập thuốc từ nhà cung cấp
                        bool BHYT_LUACHON_APDUNG = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_LUACHON_APDUNG", "0", false), 0) == 1;
                        bool TUDONG_CAPNHAT_GIADICHVU = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("TUDONG_CAPNHAT_GIADICHVU", "0", false), 0) == 1;
                        bool BHYT_CHOPHEPNHAPGIAPHUTHU = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_CHOPHEPNHAPGIAPHUTHU", "0", false), 0) == 1;

                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();
                        objPhieuNhap.NgayXacnhan = ngayxacnhan;
                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {

                            long idthuockho=-1;
                            StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                      objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhap.Vat),
                                                                      objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhonhap, objPhieuNhapCt.MaNhacungcap,
                                                                      objPhieuNhapCt.SoLo, objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau,
                                                                      -1, idthuockho, ngayxacnhan, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);

                            sp.Execute();
                            idthuockho=Utility.Int64Dbnull(sp.OutputValues[0],-1);
                            new Update(TPhieuNhapxuatthuocChitiet.Schema)
                                .Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(idthuockho)
                                .Set(TPhieuNhapxuatthuocChitiet.Columns.NgayNhap).EqualTo(ngayxacnhan.Date)
                                .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute();
                            TBiendongThuoc objXuatNhap = new TBiendongThuoc();
                            objXuatNhap.IdPhieu = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieu);
                            objXuatNhap.IdPhieuChitiet = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieuchitiet);
                            objXuatNhap.MaPhieu = Utility.sDbnull(objPhieuNhap.MaPhieu);
                            objXuatNhap.NgayNhap = ngayxacnhan.Date;
                            objXuatNhap.DonGia = Utility.DecimaltoDbnull(objPhieuNhapCt.DonGia);
                            objXuatNhap.GiaBan = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBan);
                            objXuatNhap.ThuocVay = objPhieuNhap.PhieuVay;
                            objXuatNhap.GiaNhap = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaNhap);
                            objXuatNhap.SoHoadon = Utility.sDbnull(objPhieuNhap.SoHoadon);
                            objXuatNhap.SoChungtuKemtheo = objPhieuNhap.SoChungtuKemtheo;
                            objXuatNhap.PhuThu = 0;
                            objXuatNhap.SoLuong = Utility.Int32Dbnull(objPhieuNhapCt.SoLuong);
                            objXuatNhap.NgayTao = globalVariables.SysDate;
                            objXuatNhap.NguoiTao = globalVariables.UserName;
                            objXuatNhap.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapCt.ThanhTien);
                            objXuatNhap.IdThuoc = Utility.Int32Dbnull(objPhieuNhapCt.IdThuoc);
                            objXuatNhap.Vat = Utility.Int32Dbnull(objPhieuNhap.Vat);
                            objXuatNhap.IdNhanvien = Utility.Int16Dbnull(objPhieuNhap.IdNhanvien);
                            objXuatNhap.IdKho = Utility.Int16Dbnull(objPhieuNhap.IdKhonhap);
                            objXuatNhap.NgayHethan = objPhieuNhapCt.NgayHethan.Date;
                            //objXuatNhap.IdNhaCcap = Utility.Int32Dbnull(objPhieuNhap.IdNhaCcap);
                            objXuatNhap.MaNhacungcap = objPhieuNhapCt.MaNhacungcap;
                            objXuatNhap.SoLo = objPhieuNhapCt.SoLo;
                            objXuatNhap.SoDky = objPhieuNhapCt.SoDky;
                            objXuatNhap.SoQdinhthau = objPhieuNhapCt.SoQdinhthau;
                            objXuatNhap.SoDky = objPhieuNhapCt.SoDky;
                            objXuatNhap.SoQdinhthau = objPhieuNhapCt.SoQdinhthau;
                            objXuatNhap.MaLoaiphieu = Utility.ByteDbnull(objPhieuNhap.LoaiPhieu);
                            objXuatNhap.TenLoaiphieu = Utility.sDbnull(objPhieuNhap.TenLoaiphieu);
                            objXuatNhap.NgayBiendong = objPhieuNhap.NgayXacnhan;
                            objXuatNhap.NgayHoadon = objPhieuNhap.NgayHoadon;
                            objXuatNhap.IdThuockho = idthuockho;

                            objXuatNhap.GiaBhyt = objPhieuNhapCt.GiaBhyt;
                            objXuatNhap.GiaBhytCu =objPhieuNhapCt.GiaBhytCu;
                            objXuatNhap.GiaPhuthuDungtuyen = objPhieuNhapCt.GiaPhuthuDungtuyen;
                            objXuatNhap.GiaPhuthuTraituyen = objPhieuNhapCt.GiaPhuthuTraituyen;
                            objXuatNhap.Noitru = 0;
                            objXuatNhap.QuayThuoc = 0;
                            objXuatNhap.DuTru = 0;
                            objXuatNhap.KieuThuocvattu = objPhieuNhap.KieuThuocvattu;
                            objXuatNhap.IsNew = true;
                            objXuatNhap.Save();

                            new Update(DmucThuoc.Schema)
                                       .Set(DmucThuoc.Columns.DonGia).EqualTo(objPhieuNhapCt.DonGia)
                                       .Set(DmucThuoc.Columns.GiaDv).EqualTo(objPhieuNhapCt.GiaBan)
                                       .Set(DmucThuoc.Columns.GiaBhyt).EqualTo(objPhieuNhapCt.GiaBhyt)
                                       .Set(DmucThuoc.Columns.PhuthuDungtuyen).EqualTo(objPhieuNhapCt.GiaPhuthuDungtuyen)
                                       .Set(DmucThuoc.Columns.PhuthuTraituyen).EqualTo(objPhieuNhapCt.GiaPhuthuTraituyen)
                                       .Where(DmucThuoc.Columns.IdThuoc).IsEqualTo(objPhieuNhapCt.IdThuoc).Execute();

                            if ((Utility.ByteDbnull(objPhieuNhapCt.CoBhyt, 0) == 1 && BHYT_LUACHON_APDUNG) || TUDONG_CAPNHAT_GIADICHVU)
                            {
                                DmucDoituongkcbCollection _lstdoituong = new Select().From(DmucDoituongkcb.Schema).ExecuteAsCollection<DmucDoituongkcbCollection>();
                                //DmucDoituongkcbCollection _kcb = new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.Columns.IdLoaidoituongKcb).IsEqualTo(0).ExecuteAsCollection<DmucDoituongkcbCollection>();
                                DmucThuoc _objThuoc = new Select().From(DmucThuoc.Schema).Where(DmucThuoc.Columns.IdThuoc).IsEqualTo(objPhieuNhapCt.IdThuoc).ExecuteSingle<DmucThuoc>();
                                if (_lstdoituong != null && _objThuoc != null )
                                {

//.........这里部分代码省略.........
开发者ID:vmshis2015,项目名称:VMSPharmacy,代码行数:101,代码来源:THUOC_NHAPKHO.cs

示例12: HuyXacNhanDonThuocBN_Tutruc

        public ActionResult HuyXacNhanDonThuocBN_Tutruc(KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDetails)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        HisDuocProperties objHisDuocProperties = new HisDuocProperties();
                        // if(objHisDuocProperties.KieuDuyetDonThuoc=="DONTHUOC")id_kho=Utility.Int32Dbnull(objDonthuoc.IdKho)
                        objHisDuocProperties = PropertyLib._HisDuocProperties;
                        int id_thuockho = -1;
                        foreach (KcbDonthuocChitiet objDetail in arrDetails)
                        {
                            SqlQuery sqlQuery = new Select().From(TPhieuXuatthuocBenhnhanChitiet.Schema)
                                .Where(TPhieuXuatthuocBenhnhanChitiet.Columns.IdPhieuChitiet).IsEqualTo(objDetail.IdChitietdonthuoc);
                            TPhieuXuatthuocBenhnhanChitietCollection objXuatBnhanCtCollection =
                                sqlQuery.ExecuteAsCollection<TPhieuXuatthuocBenhnhanChitietCollection>();
                            foreach (TPhieuXuatthuocBenhnhanChitiet PhieuXuatBnhanCt in objXuatBnhanCtCollection)
                            {
                                StoredProcedure sp = SPs.ThuocNhapkhoOutput(PhieuXuatBnhanCt.NgayHethan, PhieuXuatBnhanCt.DonGia, PhieuXuatBnhanCt.GiaBan,
                                                                 PhieuXuatBnhanCt.SoLuong, Utility.DecimaltoDbnull(PhieuXuatBnhanCt.Vat),
                                                                 PhieuXuatBnhanCt.IdThuoc, PhieuXuatBnhanCt.IdKho, PhieuXuatBnhanCt.MaNhacungcap,
                                                                 PhieuXuatBnhanCt.SoLo, PhieuXuatBnhanCt.SoDky, PhieuXuatBnhanCt.SoQdinhthau, -1, id_thuockho,
                                                                 objDonthuoc.NgayXacnhan, PhieuXuatBnhanCt.GiaBhyt,
                                                                 PhieuXuatBnhanCt.PhuthuDungtuyen, PhieuXuatBnhanCt.PhuthuTraituyen, objDonthuoc.KieuThuocvattu);

                                sp.Execute();
                                ///xóa thông tin bảng chi tiết
                                new Delete().From(TPhieuXuatthuocBenhnhanChitiet.Schema)
                                    .Where(TPhieuXuatthuocBenhnhanChitiet.Columns.IdPhieuChitiet).IsEqualTo(Utility.Int32Dbnull(PhieuXuatBnhanCt.IdPhieuChitiet))
                                    .Execute();

                                new Delete().From(TBiendongThuoc.Schema)
                                    .Where(TBiendongThuoc.Columns.IdPhieuChitiet).IsEqualTo(Utility.Int32Dbnull(PhieuXuatBnhanCt.IdPhieuChitiet))
                                    .And(TBiendongThuoc.Columns.MaLoaiphieu).IsEqualTo(3).Execute();

                                sqlQuery = new Select().From(TPhieuXuatthuocBenhnhanChitiet.Schema)
                                    .Where(TPhieuXuatthuocBenhnhanChitiet.Columns.IdPhieu).IsEqualTo(
                                        PhieuXuatBnhanCt.IdPhieu);
                                if (sqlQuery.GetRecordCount() <= 0)
                                {
                                    TPhieuXuatthuocBenhnhan.Delete(PhieuXuatBnhanCt.IdPhieu);
                                }
                            }
                            new Delete().From(TXuatthuocTheodon.Schema)
                                .Where(TXuatthuocTheodon.Columns.IdChitietdonthuoc).IsEqualTo(objDetail.IdChitietdonthuoc).Execute();
                            new Update(KcbDonthuocChitiet.Schema)
                                .Set(KcbDonthuocChitiet.Columns.TrangThai).EqualTo(0)
                                .Where(KcbDonthuocChitiet.Columns.IdChitietdonthuoc).IsEqualTo(objDetail.IdChitietdonthuoc).
                                Execute();

                        }
                        SqlQuery sqlQuery1 = new Select().From(KcbDonthuocChitiet.Schema)
                              .Where(KcbDonthuocChitiet.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc)
                              .And(KcbDonthuocChitiet.Columns.TrangThai).IsEqualTo(0);
                        int status = sqlQuery1.GetRecordCount() <= 0 ? 1 : 0;
                        new Update(KcbDonthuoc.Schema)
                                  .Set(KcbDonthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                                  .Set(KcbDonthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                                  .Set(KcbDonthuoc.Columns.TrangThai).EqualTo(status)
                                  .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc).Execute();

                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh xac nhan don thuoc :{0}", exception);
                return ActionResult.Error;

            }
        }
开发者ID:vmshis2020,项目名称:VMSHISServer,代码行数:75,代码来源:XuatThuoc.cs

示例13: GetObjThuocKhoCollection

 private TThuockhoCollection GetObjThuocKhoCollection(KcbDonthuocChitiet objDetail)
 {
     SqlQuery sqlQuery;
     sqlQuery = new Select().From(TThuockho.Schema)
         .Where(TThuockho.Columns.IdKho).IsEqualTo(objDetail.IdKho)
         .And(TThuockho.Columns.NgayHethan).IsGreaterThanOrEqualTo( globalVariables.SysDate.Date)
         .And(TThuockho.Columns.IdThuoc).IsEqualTo(objDetail.IdThuoc)
         .And(TThuockho.Columns.SoLuong).IsGreaterThan(0)
         .OrderAsc(TThuockho.Columns.NgayHethan)
         .OrderAsc(TThuockho.Columns.GiaNhap);
     return sqlQuery.ExecuteAsCollection<TThuockhoCollection>();
 }
开发者ID:vmshis2020,项目名称:VMSHISServer,代码行数:12,代码来源:XuatThuoc.cs

示例14: Linhthuocnoitru

        /// <summary>
        /// HÀM THỰC HIỆN VIECJ CHO PHÉP CẬP NHẬP ĐƠN THUỐC
        /// </summary>
        /// <returns></returns>
        public ActionResult Linhthuocnoitru(KcbDonthuoc objDonthuoc, TPhieuXuatthuocBenhnhan objXuatBnhan, int ID_KHO_XUAT, DateTime ngaythuchien)
        {
            try
            {
                using (var scope = new TransactionScope())
                {
                    string THUOC_NOITRU_XACNHANDALINH_KHIXACNHANDONTHUOC = THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_NOITRU_XACNHANDALINH_KHIXACNHANDONTHUOC", "0", false);
                    HisDuocProperties hisDuocProperties = new HisDuocProperties();
                    objXuatBnhan.IdBenhnhan = objDonthuoc.IdBenhnhan;
                    objXuatBnhan.MaLuotkham = objDonthuoc.MaLuotkham;
                    objXuatBnhan.MaPhieu = THU_VIEN_CHUNG.MaPhieuXuatBN();
                    objXuatBnhan.Noitru = Utility.ByteDbnull(objDonthuoc.Noitru);
                    objXuatBnhan.TenKhongdau = Utility.UnSignedCharacter(objXuatBnhan.TenBenhnhan);
                    objXuatBnhan.IdDonthuoc = Utility.Int32Dbnull(objDonthuoc.IdDonthuoc);
                    objXuatBnhan.IsNew = true;
                    objXuatBnhan.Save();
                    Int32 PtramBHYT = 0;
                    SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema).Where(
                        KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objDonthuoc.MaLuotkham)
                        .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objDonthuoc.IdBenhnhan);
                    KcbLuotkham objLuotkham = sqlQuery.ExecuteSingle<KcbLuotkham>();
                    if (objLuotkham != null)
                    {
                        PtramBHYT = Utility.Int32Dbnull(objLuotkham.PtramBhyt);
                    }
                    sqlQuery = new Select().From(TPhieuCapphatChitiet.Schema)
                        .Where(TPhieuCapphatChitiet.Columns.IdCapphat).IsEqualTo(objXuatBnhan.IdCapphat)
                        .And(TPhieuCapphatChitiet.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc);

                    TPhieuCapphatChitietCollection objDPhieuCapphatCtCollection =
                        sqlQuery.ExecuteAsCollection<TPhieuCapphatChitietCollection>();
                    foreach (TPhieuCapphatChitiet objCapphatDetail in objDPhieuCapphatCtCollection)
                    {
                        KcbDonthuocChitiet objDetail = new Select().From(KcbDonthuocChitiet.Schema)
                            .Where(KcbDonthuocChitiet.Columns.IdChitietdonthuoc).IsEqualTo(objCapphatDetail.IdChitietdonthuoc)
                            .ExecuteSingle<KcbDonthuocChitiet>();
                        if (objDetail == null) return ActionResult.Exceed;
                        objDetail.SetColumnValue("id_kho", ID_KHO_XUAT);
                        ActionResult actionResult = TruThuocTrongKho_Noitru(objDonthuoc,objCapphatDetail, objDetail, objXuatBnhan, ID_KHO_XUAT, ngaythuchien);
                        switch (actionResult)
                        {
                            case ActionResult.NotEnoughDrugInStock:
                                return actionResult;
                        }

                        TXuatthuocTheodon objThuocCt = new TXuatthuocTheodon();
                        objThuocCt.IdPhieuXuat = Utility.Int32Dbnull(objXuatBnhan.IdPhieu);
                        objThuocCt.IdThuoc = Utility.Int32Dbnull(objCapphatDetail.IdThuoc);
                        objThuocCt.NgayTao = globalVariables.SysDate;
                        objThuocCt.SoLuong = objCapphatDetail.SoLuong;
                        objThuocCt.NguoiTao = globalVariables.UserName;
                        objThuocCt.PhuThu = Utility.DecimaltoDbnull(objDetail.PhuThu);
                        objThuocCt.DonGia = Utility.DecimaltoDbnull(objDetail.DonGia);
                        objThuocCt.BnhanChitra = Utility.DecimaltoDbnull(objDetail.BnhanChitra);
                        objThuocCt.BhytChitra = Utility.DecimaltoDbnull(objDetail.BhytChitra);
                        objThuocCt.ChiDan = Utility.sDbnull(objDetail.MotaThem);
                        objThuocCt.ChidanThem = Utility.sDbnull(objDetail.ChidanThem);
                        objThuocCt.SolanDung = Utility.sDbnull(objDetail.SolanDung);
                        objThuocCt.SoluongDung = Utility.sDbnull(objDetail.SoluongDung);
                        objThuocCt.CachDung = Utility.sDbnull(objDetail.CachDung);
                        objThuocCt.PtramBhyt = PtramBHYT;
                        objThuocCt.IdChitietdonthuoc = Utility.Int32Dbnull(objCapphatDetail.IdChitietdonthuoc);
                        objThuocCt.IdDonthuoc = Utility.Int32Dbnull(objCapphatDetail.IdThuoc);
                        objThuocCt.IsNew = true;
                        objThuocCt.Save();
                        if (THUOC_NOITRU_XACNHANDALINH_KHIXACNHANDONTHUOC == "1")
                        {
                            objCapphatDetail.ThucLinh = objCapphatDetail.SoLuong;
                            objCapphatDetail.IsNew = false;
                            objCapphatDetail.MarkOld();
                            objCapphatDetail.Save();
                        }
                    }
                    byte DA_LINH = (byte)(THUOC_NOITRU_XACNHANDALINH_KHIXACNHANDONTHUOC == "1" ? 1 : 0);

                    new Update(TPhieuCapphatChitiet.Schema)
                        .Set(TPhieuCapphatChitiet.Columns.DaLinh).EqualTo(DA_LINH)

                        .Set(TPhieuCapphatChitiet.Columns.IdPhieuxuatthuocBenhnhan).EqualTo(objXuatBnhan.IdPhieu)
                        .Where(TPhieuCapphatChitiet.Columns.IdCapphat).IsEqualTo(objXuatBnhan.IdCapphat).Execute();
                    sqlQuery = new Select().From(KcbDonthuocChitiet.Schema)
                                .Where(KcbDonthuocChitiet.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc)
                                .And(KcbDonthuocChitiet.Columns.TrangThai).IsEqualTo(0);
                    int status = sqlQuery.GetRecordCount() <= 0 ? 1 : 0;
                    new Update(KcbDonthuoc.Schema)
                              .Set(KcbDonthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate)
                              .Set(KcbDonthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName)
                              .Set(KcbDonthuoc.Columns.TrangThai).EqualTo(status)
                              .Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(objDonthuoc.IdDonthuoc).Execute();
                    scope.Complete();
                }

                return ActionResult.Success;
            }
            catch (Exception exception)
            {
//.........这里部分代码省略.........
开发者ID:vmshis2020,项目名称:VMSHISServer,代码行数:101,代码来源:XuatThuoc.cs

示例15: HuyThongTinLanThanhToan_Donthuoctaiquay

 public ActionResult HuyThongTinLanThanhToan_Donthuoctaiquay(int id_thanhtoan, KcbLuotkham objLuotkham, string lydohuy, int IdHdonLog, bool HuyBienlai)
 {
     try
     {
         decimal v_TotalPaymentDetail = 0;
         decimal v_DiscountRate = 0;
         using (var scope = new TransactionScope())
         {
             using (var dbscope = new SharedDbConnectionScope())
             {
                 if (IdHdonLog > 0)
                     if (HuyBienlai)
                         new Update(HoadonLog.Schema).Set(HoadonLog.Columns.TrangThai).EqualTo(1)
                             .Where(HoadonLog.Columns.IdHdonLog).IsEqualTo(IdHdonLog).Execute();
                     else
                         new Delete().From(HoadonLog.Schema)
                             .Where(HoadonLog.Columns.IdHdonLog).IsEqualTo(IdHdonLog).Execute();
                 SqlQuery sqlQuery =
                     new Select().From(KcbThanhtoanChitiet.Schema).Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).IsEqualTo(
                         id_thanhtoan);
                 KcbThanhtoanChitietCollection arrPaymentDetails = sqlQuery.ExecuteAsCollection<KcbThanhtoanChitietCollection>();
                 KcbThanhtoan objThanhtoan = KcbThanhtoan.FetchByID(id_thanhtoan);
                 int id_donthuoc = -1;
                 if (arrPaymentDetails.Count > 0) id_donthuoc = arrPaymentDetails[0].IdPhieu;
                 if (objThanhtoan != null)
                     HUYTHONGTIN_THANHTOAN(arrPaymentDetails, objThanhtoan);
                 KcbDonthuoc objDonthuoc = KcbDonthuoc.FetchByID(id_donthuoc);
                 KcbDonthuocChitietCollection lstChitiet = new Select().From(KcbDonthuoc.Schema).Where(KcbDonthuoc.Columns.IdDonthuoc).IsEqualTo(id_donthuoc).ExecuteAsCollection<KcbDonthuocChitietCollection>();
                 ActionResult actionResult = ActionResult.Success;
                 if (objDonthuoc != null && lstChitiet.Count > 0)
                 {
                    actionResult= new XuatThuoc().HuyXacNhanDonThuocBN(id_donthuoc, Utility.Int16Dbnull(lstChitiet[0].IdKho, 0),DateTime.Now,lydohuy);
                     switch (actionResult)
                     {
                         case ActionResult.Success:
                             break;
                         case ActionResult.Error:
                             return actionResult;
                     }
                 }
                 KcbThanhtoan.Delete(id_thanhtoan);
             }
             scope.Complete();
             return ActionResult.Success;
         }
     }
     catch (Exception exception)
     {
         log.Error("Loi trong qua trinh huy thong tin {0}", exception.ToString());
         return ActionResult.Error;
     }
 }
开发者ID:khaha2210,项目名称:CodeNewHis,代码行数:52,代码来源:KCB_THANHTOAN.cs


注:本文中的System.Data.Select.ExecuteAsCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。