Ejemplo n.º 1
0
        /// <summary>
        /// hàm thực hiện việc cập nhập thông tin nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult UpdatePhieuNhapKho(TPhieuNhapxuatthuoc objPhieuNhap, List <TPhieuNhapxuatthuocChitiet> arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgaySua  = globalVariables.SysDate;
                        objPhieuNhap.NguoiSua = globalVariables.UserName;
                        objPhieuNhap.TongTien = arrPhieuNhapCts.Sum(c => c.ThanhTien);
                        objPhieuNhap.Save();

                        new Delete().From(TPhieuNhapxuatthuocChitiet.Schema)
                        .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in arrPhieuNhapCts)
                        {
                            objPhieuNhapCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                            objPhieuNhapCt.IsNew   = true;
                            objPhieuNhapCt.Save();
                        }
                    }
                    Scope.Complete();
                    return(ActionResult.Success);
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh sua phieu nhap kho :{0}", exception);
                return(ActionResult.Error);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult ThemPhieuNhapKho(TPhieuNhapxuatthuoc objPhieuNhap, List <TPhieuNhapxuatthuocChitiet> arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgayTao  = globalVariables.SysDate;
                        objPhieuNhap.NguoiTao = globalVariables.UserName;
                        objPhieuNhap.MaPhieu  = Utility.sDbnull(THU_VIEN_CHUNG.MaNhapKho(Utility.Int32Dbnull(objPhieuNhap.LoaiPhieu)));
                        objPhieuNhap.TongTien = arrPhieuNhapCts.Sum(c => c.ThanhTien);
                        objPhieuNhap.IsNew    = true;
                        objPhieuNhap.Save();

                        //StoredProcedure sp = SPs.ThuocPhieunhapThemmoi(objPhieuNhap.IdPhieu,
                        //                                          Utility.sDbnull(objPhieuNhap.MaPhieu),
                        //                                          Utility.sDbnull(objPhieuNhap.SoHoaDon),
                        //                                          objPhieuNhap.NgayNhapHdon, objPhieuNhap.IdKhonhap,
                        //                                          objPhieuNhap.IdKhoxuat, objPhieuNhap.Vat,
                        //                                          objPhieuNhap.IdNhaCcap, objPhieuNhap.GhiChu,
                        //                                          objPhieuNhap.NguoiGiao, objPhieuNhap.IdNhanvien,
                        //                                          objPhieuNhap.HienThi, objPhieuNhap.TrangThai,
                        //                                          objPhieuNhap.Ngaytao, objPhieuNhap.NguoiTao,
                        //                                          objPhieuNhap.NguoiSua, objPhieuNhap.NgaySua,
                        //                                          objPhieuNhap.IpMayTao, objPhieuNhap.IpMaySua,
                        //                                          objPhieuNhap.TongTien, objPhieuNhap.LoaiPhieu,
                        //                                          objPhieuNhap.MaKieuPhieu, objPhieuNhap.IdNvienXacNhan, objPhieuNhap.NguoiXacnhan, objPhieuNhap.NgayXacnhan, objPhieuNhap.IdKhoaLinh);
                        //sp.Execute();
                        //objPhieuNhap.IdPhieu = Utility.Int32Dbnull(sp.OutputValues[0]);
                        //objPhieuNhap = TPhieuNhapxuatthuoc.FetchByID(objPhieuNhap.IdPhieu);
                        if (objPhieuNhap != null)
                        {
                            foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in arrPhieuNhapCts)
                            {
                                objPhieuNhapCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                                objPhieuNhapCt.IsNew   = true;
                                objPhieuNhapCt.Save();
                            }
                        }
                    }
                    Scope.Complete();
                    return(ActionResult.Success);
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh them phieu nhap kho :{0}", exception);
                return(ActionResult.Error);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult ThemPhieuTraLaiKho(TPhieuNhapxuatthuoc objPhieuNhap, TPhieuNhapxuatthuocChitiet[] arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgayTao = globalVariables.SysDate;
                        objPhieuNhap.NguoiTao = globalVariables.UserName;
                        objPhieuNhap.MaPhieu = Utility.sDbnull(THU_VIEN_CHUNG.MaTraLaiKho());
                        objPhieuNhap.IsNew = true;
                        objPhieuNhap.Save();
                        if (objPhieuNhap != null)
                        {
                          
                            foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapTraCt in arrPhieuNhapCts)
                            {
                                objPhieuNhapTraCt.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapTraCt.GiaNhap) *
                                                          Utility.Int32Dbnull(objPhieuNhapTraCt.SoLuong);
                                objPhieuNhapTraCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                                objPhieuNhapTraCt.IsNew = true;
                                objPhieuNhapTraCt.Save();
                            }
                        }

                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh them phieu nhap kho :{0}", exception);
                return ActionResult.Error;

            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult ThemPhieuXuatKho(TPhieuNhapxuatthuoc objPhieuNhap, TPhieuNhapxuatthuocChitiet[] arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgayTao  = globalVariables.SysDate;
                        objPhieuNhap.NguoiTao = globalVariables.UserName;
                        objPhieuNhap.MaPhieu  = Utility.sDbnull(THU_VIEN_CHUNG.MaNhapKho(Utility.Int32Dbnull(objPhieuNhap.LoaiPhieu)));
                        objPhieuNhap.TongTien = arrPhieuNhapCts.Sum(c => c.ThanhTien);
                        objPhieuNhap.IsNew    = true;
                        objPhieuNhap.Save();

                        objPhieuNhap = TPhieuNhapxuatthuoc.FetchByID(objPhieuNhap.IdPhieu);
                        if (objPhieuNhap != null)
                        {
                            foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in arrPhieuNhapCts)
                            {
                                objPhieuNhapCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                                objPhieuNhapCt.IsNew   = true;
                                objPhieuNhapCt.Save();
                            }
                        }
                    }
                    Scope.Complete();
                    return(ActionResult.Success);
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh them :{0}", exception);
                return(ActionResult.Error);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// hàm thực hiện việc cập nhập thông tin nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult UpdatePhieuTraLaiKho(TPhieuNhapxuatthuoc objPhieuNhap, TPhieuNhapxuatthuocChitiet[] arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgaySua =  globalVariables.SysDate;
                        objPhieuNhap.NguoiSua = globalVariables.UserName;
                        objPhieuNhap.MarkOld();
                        objPhieuNhap.IsNew = false;
                        objPhieuNhap.Save();
                        new Delete().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapTraCt in arrPhieuNhapCts)
                        {
                            objPhieuNhapTraCt.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapTraCt.GiaNhap)*
                                                          Utility.Int32Dbnull(objPhieuNhapTraCt.SoLuong);
                            objPhieuNhapTraCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                            objPhieuNhapTraCt.IsNew = true;
                            objPhieuNhapTraCt.Save();
                        }
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh sua phieu nhap kho :{0}", exception);
                return ActionResult.Error;

            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// hàm thực hiện việc cập nhập thông tin nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult UpdatePhieuXuatKho(TPhieuNhapxuatthuoc objPhieuNhap, TPhieuNhapxuatthuocChitiet[] arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgaySua =  globalVariables.SysDate;
                        objPhieuNhap.NguoiSua = globalVariables.UserName;
                        objPhieuNhap.TongTien = arrPhieuNhapCts.Sum(c => c.ThanhTien);
                        objPhieuNhap.Save();

                        new Delete().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in arrPhieuNhapCts)
                        {
                            objPhieuNhapCt.IdPhieu= Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                            objPhieuNhapCt.IsNew = true;
                            objPhieuNhapCt.Save();
                        }
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh sua phieu nhap kho :{0}", exception);
                return ActionResult.Error;

            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult ThemPhieuXuatKho(TPhieuNhapxuatthuoc objPhieuNhap, TPhieuNhapxuatthuocChitiet[] arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgayTao = globalVariables.SysDate;
                        objPhieuNhap.NguoiTao = globalVariables.UserName;
                        objPhieuNhap.MaPhieu = Utility.sDbnull(THU_VIEN_CHUNG.MaNhapKho(Utility.Int32Dbnull(objPhieuNhap.LoaiPhieu)));
                        objPhieuNhap.TongTien = arrPhieuNhapCts.Sum(c => c.ThanhTien);
                        objPhieuNhap.IsNew = true;
                        objPhieuNhap.Save();

                        objPhieuNhap = TPhieuNhapxuatthuoc.FetchByID(objPhieuNhap.IdPhieu);
                        if (objPhieuNhap != null)
                        {
                            foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in arrPhieuNhapCts)
                            {
                                objPhieuNhapCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                                objPhieuNhapCt.IsNew = true;
                                objPhieuNhapCt.Save();
                            }
                        }
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh them :{0}", exception);
                return ActionResult.Error;

            }
        }
        public void Insert(string MaPhieu,string SoHoadon,DateTime NgayHoadon,short? IdKhonhap,short? IdKhoxuat,decimal? Vat,string MaNhacungcap,string MotaThem,string NguoiGiao,string NguoiNhan,string NguoiHuy,short? IdNhanvien,byte? SttHthi,byte? TrangThai,DateTime? NgayTao,string NguoiTao,string NguoiSua,DateTime? NgaySua,decimal? TongTien,byte? LoaiPhieu,string TenLoaiphieu,short? IdNhanvienXacnhan,string NguoiXacnhan,DateTime? NgayXacnhan,short? IdKhoalinh,string KieuThuocvattu,string SoChungtuKemtheo,byte? PhieuVay,string TkNo,string TkCo,byte? DuTru,byte? NoiTru,string HoidongThanhly,string DiadiemThanhly,string YkienDexuat,DateTime? ThoigianThanhlyTu,DateTime? ThoigianThanhlyDen)
        {
            TPhieuNhapxuatthuoc item = new TPhieuNhapxuatthuoc();

            item.MaPhieu = MaPhieu;

            item.SoHoadon = SoHoadon;

            item.NgayHoadon = NgayHoadon;

            item.IdKhonhap = IdKhonhap;

            item.IdKhoxuat = IdKhoxuat;

            item.Vat = Vat;

            item.MaNhacungcap = MaNhacungcap;

            item.MotaThem = MotaThem;

            item.NguoiGiao = NguoiGiao;

            item.NguoiNhan = NguoiNhan;

            item.NguoiHuy = NguoiHuy;

            item.IdNhanvien = IdNhanvien;

            item.SttHthi = SttHthi;

            item.TrangThai = TrangThai;

            item.NgayTao = NgayTao;

            item.NguoiTao = NguoiTao;

            item.NguoiSua = NguoiSua;

            item.NgaySua = NgaySua;

            item.TongTien = TongTien;

            item.LoaiPhieu = LoaiPhieu;

            item.TenLoaiphieu = TenLoaiphieu;

            item.IdNhanvienXacnhan = IdNhanvienXacnhan;

            item.NguoiXacnhan = NguoiXacnhan;

            item.NgayXacnhan = NgayXacnhan;

            item.IdKhoalinh = IdKhoalinh;

            item.KieuThuocvattu = KieuThuocvattu;

            item.SoChungtuKemtheo = SoChungtuKemtheo;

            item.PhieuVay = PhieuVay;

            item.TkNo = TkNo;

            item.TkCo = TkCo;

            item.DuTru = DuTru;

            item.NoiTru = NoiTru;

            item.HoidongThanhly = HoidongThanhly;

            item.DiadiemThanhly = DiadiemThanhly;

            item.YkienDexuat = YkienDexuat;

            item.ThoigianThanhlyTu = ThoigianThanhlyTu;

            item.ThoigianThanhlyDen = ThoigianThanhlyDen;

            item.Save(UserName);
        }
        public void Insert(string MaPhieu, string SoHoadon, DateTime NgayHoadon, short?IdKhonhap, short?IdKhoxuat, decimal?Vat, string MaNhacungcap, string MotaThem, string NguoiGiao, string NguoiNhan, string NguoiHuy, short?IdNhanvien, byte?SttHthi, byte?TrangThai, DateTime?NgayTao, string NguoiTao, string NguoiSua, DateTime?NgaySua, decimal?TongTien, byte?LoaiPhieu, string TenLoaiphieu, short?IdNhanvienXacnhan, string NguoiXacnhan, DateTime?NgayXacnhan, short?IdKhoalinh, string KieuThuocvattu, string SoChungtuKemtheo, byte?PhieuVay, string TkNo, string TkCo, byte?DuTru, byte?NoiTru, string HoidongThanhly, string DiadiemThanhly, string YkienDexuat, DateTime?ThoigianThanhlyTu, DateTime?ThoigianThanhlyDen)
        {
            TPhieuNhapxuatthuoc item = new TPhieuNhapxuatthuoc();

            item.MaPhieu = MaPhieu;

            item.SoHoadon = SoHoadon;

            item.NgayHoadon = NgayHoadon;

            item.IdKhonhap = IdKhonhap;

            item.IdKhoxuat = IdKhoxuat;

            item.Vat = Vat;

            item.MaNhacungcap = MaNhacungcap;

            item.MotaThem = MotaThem;

            item.NguoiGiao = NguoiGiao;

            item.NguoiNhan = NguoiNhan;

            item.NguoiHuy = NguoiHuy;

            item.IdNhanvien = IdNhanvien;

            item.SttHthi = SttHthi;

            item.TrangThai = TrangThai;

            item.NgayTao = NgayTao;

            item.NguoiTao = NguoiTao;

            item.NguoiSua = NguoiSua;

            item.NgaySua = NgaySua;

            item.TongTien = TongTien;

            item.LoaiPhieu = LoaiPhieu;

            item.TenLoaiphieu = TenLoaiphieu;

            item.IdNhanvienXacnhan = IdNhanvienXacnhan;

            item.NguoiXacnhan = NguoiXacnhan;

            item.NgayXacnhan = NgayXacnhan;

            item.IdKhoalinh = IdKhoalinh;

            item.KieuThuocvattu = KieuThuocvattu;

            item.SoChungtuKemtheo = SoChungtuKemtheo;

            item.PhieuVay = PhieuVay;

            item.TkNo = TkNo;

            item.TkCo = TkCo;

            item.DuTru = DuTru;

            item.NoiTru = NoiTru;

            item.HoidongThanhly = HoidongThanhly;

            item.DiadiemThanhly = DiadiemThanhly;

            item.YkienDexuat = YkienDexuat;

            item.ThoigianThanhlyTu = ThoigianThanhlyTu;

            item.ThoigianThanhlyDen = ThoigianThanhlyDen;


            item.Save(UserName);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// hàm thực hiện việc thêm phiếu nhập kho thuốc
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <param name="arrPhieuNhapCts"></param>
        /// <returns></returns>
        public ActionResult ThemPhieuNhapKho(TPhieuNhapxuatthuoc objPhieuNhap, List<TPhieuNhapxuatthuocChitiet> arrPhieuNhapCts)
        {
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        objPhieuNhap.NgayTao = globalVariables.SysDate;
                        objPhieuNhap.NguoiTao = globalVariables.UserName;
                        objPhieuNhap.MaPhieu = Utility.sDbnull(THU_VIEN_CHUNG.MaNhapKho(Utility.Int32Dbnull(objPhieuNhap.LoaiPhieu)));
                        objPhieuNhap.TongTien = arrPhieuNhapCts.Sum(c => c.ThanhTien);
                        objPhieuNhap.IsNew = true;
                        objPhieuNhap.Save();

                        //StoredProcedure sp = SPs.ThuocPhieunhapThemmoi(objPhieuNhap.IdPhieu,
                        //                                          Utility.sDbnull(objPhieuNhap.MaPhieu),
                        //                                          Utility.sDbnull(objPhieuNhap.SoHoaDon),
                        //                                          objPhieuNhap.NgayNhapHdon, objPhieuNhap.IdKhonhap,
                        //                                          objPhieuNhap.IdKhoxuat, objPhieuNhap.Vat,
                        //                                          objPhieuNhap.IdNhaCcap, objPhieuNhap.GhiChu,
                        //                                          objPhieuNhap.NguoiGiao, objPhieuNhap.IdNhanvien,
                        //                                          objPhieuNhap.HienThi, objPhieuNhap.TrangThai,
                        //                                          objPhieuNhap.Ngaytao, objPhieuNhap.NguoiTao,
                        //                                          objPhieuNhap.NguoiSua, objPhieuNhap.NgaySua,
                        //                                          objPhieuNhap.IpMayTao, objPhieuNhap.IpMaySua,
                        //                                          objPhieuNhap.TongTien, objPhieuNhap.LoaiPhieu,
                        //                                          objPhieuNhap.MaKieuPhieu, objPhieuNhap.IdNvienXacNhan, objPhieuNhap.NguoiXacnhan, objPhieuNhap.NgayXacnhan, objPhieuNhap.IdKhoaLinh);
                        //sp.Execute();
                        //objPhieuNhap.IdPhieu = Utility.Int32Dbnull(sp.OutputValues[0]);
                        //objPhieuNhap = TPhieuNhapxuatthuoc.FetchByID(objPhieuNhap.IdPhieu);
                        if (objPhieuNhap != null)
                        {
                            foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in arrPhieuNhapCts)
                            {
                                objPhieuNhapCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1);
                                objPhieuNhapCt.IsNew = true;
                                objPhieuNhapCt.Save();
                            }
                        }

                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi trong qua trinh them phieu nhap kho :{0}", exception);
                return ActionResult.Error;

            }
        }