示例#1
0
        public String InsertLuuChuyenDongTienReturnId(String type, String data, String Ngay, String SoTien, String MaNganHangThu, String MaNganHangChi, String GhiChu, String IdKeToan)
        {
            try
            {
                //Ngay,IdNgayHD,SoTien,MaNganHang,MaGiaoDich,TinhTrang,GhiChu,LoaiThu,NgayTao,NguoiTao,IdKeToan

                DataObject.LuuChuyenDongTien ctt = new DataObject.LuuChuyenDongTien();
                ctt.Ngay = Convert.ToDateTime(Ngay != "" ? Ngay : DateTime.Now.ToShortDateString());
                if (SoTien != null && SoTien != "")
                {
                    ctt.SoTien = Convert.ToDecimal(SoTien);
                }
                else
                {
                    ctt.SoTien = Convert.ToDecimal("0");
                }
                ctt.MaNganHangThu = Convert.ToInt32(MaNganHangThu);
                ctt.MaNganHangChi = Convert.ToInt32(MaNganHangChi);
                ctt.GhiChu        = GhiChu;
                ctt.NgayTao       = DateTime.Now;
                ctt.NguoiTao      = "";
                ctt.IdKeToan      = Convert.ToInt32(IdKeToan);
                ctt.ID            = Convert.ToInt32(IdKeToan);
                int Id = Servies.KeToanServices.InsertLuuChuyenDongTienReturnId(ctt);
                return(Id.ToString());
            }
            catch (Exception e)
            {
                e.ToString();
                return("");
            }
        }
示例#2
0
        public static int InsertLuuChuyenDongTienReturnId(DataObject.LuuChuyenDongTien obj)
        {
            SqlConnection conn      = Common.Connection.SqlConnect();
            int           countId   = 0;
            String        select    = "Select count(*) from LuuChuyenDongTien where ID = " + obj.ID;
            SqlCommand    cmdSelect = new SqlCommand(select);

            cmdSelect.CommandType = CommandType.Text;
            cmdSelect.Connection  = conn;
            conn.Open();
            object count = cmdSelect.ExecuteScalar();

            countId = Convert.ToInt16(count);
            conn.Close();
            if (countId == 0)
            {
                String     Insert = "INSERT INTO LuuChuyenDongTien (Ngay,SoTien,MaNganHangChi,MaNganHangThu,GhiChu,NguoiTao,NgayTao,IdKeToan) VALUES (@Ngay,@SoTien,@MaNganHangChi,@MaNganHangThu,@GhiChu,@NguoiTao,@NgayTao,@IdKeToan);Select @@IDENTITY as newId";
                SqlCommand cmd    = new SqlCommand(Insert);
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = conn;
                cmd.Parameters.AddWithValue("@Ngay", obj.Ngay);
                cmd.Parameters.AddWithValue("@SoTien", obj.SoTien);
                cmd.Parameters.AddWithValue("@MaNganHangChi", obj.MaNganHangChi);
                cmd.Parameters.AddWithValue("@MaNganHangThu", obj.MaNganHangThu);
                cmd.Parameters.AddWithValue("@GhiChu", obj.GhiChu);
                cmd.Parameters.AddWithValue("@NguoiTao", obj.NguoiTao);
                cmd.Parameters.AddWithValue("@NgayTao", obj.NgayTao);
                cmd.Parameters.AddWithValue("@IdKeToan", obj.IdKeToan);
                conn.Open();
                object insertedID = cmd.ExecuteScalar();
                cmd.Connection.Close();
                conn.Close();
                return(Convert.ToInt32(insertedID));
            }
            else
            {
                String     Insert = "Update LuuChuyenDongTien SET Ngay = @Ngay ,SoTien = @SoTien ,MaNganHangChi = @MaNganHangChi ,MaNganHangThu = @MaNganHangThu ,GhiChu = @GhiChu where ID = @ID";
                SqlCommand cmd    = new SqlCommand(Insert);
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = conn;
                cmd.Parameters.AddWithValue("@Ngay", obj.Ngay);
                cmd.Parameters.AddWithValue("@SoTien", obj.SoTien);
                cmd.Parameters.AddWithValue("@MaNganHangChi", obj.MaNganHangChi);
                cmd.Parameters.AddWithValue("@MaNganHangThu", obj.MaNganHangThu);
                cmd.Parameters.AddWithValue("@GhiChu", obj.GhiChu);
                cmd.Parameters.AddWithValue("@ID", obj.ID);
                conn.Open();
                cmd.ExecuteNonQuery();
                cmd.Connection.Close();
                conn.Close();
                return(obj.ID);
            }
        }
示例#3
0
        /************* Update bảng kế toán **********/
        public static int UpdatteChiTietThuReturnId(DataObject.LuuChuyenDongTien obj)
        {
            String        Insert = "INSERT INTO ChiTietThu (Ngay,IdNgayHD,SoTien,MaNganHang,MaGiaoDich,TinhTrang,GhiChu,LoaiThu,NgayTao,NguoiTao,IdKeToan) VALUES (@Ngay,@IdNgayHD,@SoTien,@MaNganHang,@MaGiaoDich,@TinhTrang,@GhiChu,@LoaiThu,@NgayTao,@NguoiTao,@IdKeToan);Select @@IDENTITY as newId";
            String        Update = " Update ChiTietThu Set SoTien = @SoTien ,";
            SqlConnection conn   = Common.Connection.SqlConnect();
            SqlCommand    cmd    = new SqlCommand(Insert);

            cmd.CommandType = CommandType.Text;
            cmd.Connection  = conn;
            cmd.Parameters.AddWithValue("@Ngay", obj.Ngay);
            cmd.Parameters.AddWithValue("@SoTien", obj.SoTien);
            cmd.Parameters.AddWithValue("@MaNganHangChi", obj.MaNganHangChi);
            cmd.Parameters.AddWithValue("@MaNganHangThu", obj.MaNganHangThu);
            cmd.Parameters.AddWithValue("@GhiChu", obj.GhiChu);
            cmd.Parameters.AddWithValue("@NguoiTao", obj.NguoiTao);
            cmd.Parameters.AddWithValue("@NgayTao", obj.NgayTao);
            cmd.Parameters.AddWithValue("@IdKeToan", obj.IdKeToan);
            conn.Open();
            object insertedID = cmd.ExecuteScalar();

            cmd.Connection.Close();
            conn.Close();
            return(Convert.ToInt32(insertedID));
        }
示例#4
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                String type = context.Request.Form["type"].ToString();

                if (type == "viewManHinhThuCK")
                {
                    String    jsonData = context.Request.Form["data"].ToString();
                    String    Ngay     = context.Request.Form["Ngay"].ToString();
                    DataTable dt       = Servies.KeToanServices.viewManHinhThuCK(Ngay);
                    context.Response.ContentType = "application/json";
                    context.Response.Write(JsonConvert.SerializeObject(dt));
                }
                if (type == "viewManHinhThuTM")
                {
                    String    jsonData = context.Request.Form["data"].ToString();
                    String    Ngay     = context.Request.Form["Ngay"].ToString();
                    DataTable dt       = Servies.KeToanServices.viewManHinhThuTM(Ngay);
                    context.Response.ContentType = "application/json";
                    context.Response.Write(JsonConvert.SerializeObject(dt));
                }
                if (type == "viewManHinhChi")
                {
                    String    jsonData = context.Request.Form["data"].ToString();
                    String    Ngay     = context.Request.Form["Ngay"].ToString();
                    DataTable dt       = Servies.KeToanServices.viewManHinhChi(Ngay);
                    context.Response.ContentType = "application/json";
                    context.Response.Write(JsonConvert.SerializeObject(dt));
                }
                if (type == "viewManHinhLuuChuyenDongTien")
                {
                    String    jsonData = context.Request.Form["data"].ToString();
                    String    Ngay     = context.Request.Form["Ngay"].ToString();
                    DataTable dt       = Servies.KeToanServices.viewManHinhLuuChuyenDongTien(Ngay);
                    context.Response.ContentType = "application/json";
                    context.Response.Write(JsonConvert.SerializeObject(dt));
                }
                if (type == "InsertKeToanReturnId")
                {
                    String jsonData = context.Request.Form["data"].ToString();
                    String Ngay     = context.Request.Form["Ngay"].ToString();
                    int    Id       = Servies.KeToanServices.InsertKeToanReturnId(Ngay);
                    context.Response.ContentType = "text/plain";
                    context.Response.Write(Id);
                }
                if (type == "InsertChiTietThuReturnId")
                {
                    String jsonData = context.Request.Form["data"].ToString();
                    //Ngay,IdNgayHD,SoTien,MaNganHang,MaGiaoDich,TinhTrang,GhiChu,LoaiThu,NgayTao,NguoiTao,IdKeToan
                    String Ngay               = context.Request.Form["Ngay"].ToString();
                    String IdNgayHD           = context.Request.Form["IdNgayHD"].ToString();
                    String SoTien             = context.Request.Form["SoTien"].ToString();
                    String MaNganHang         = context.Request.Form["MaNganHang"].ToString();
                    String MaGiaoDich         = context.Request.Form["MaGiaoDich"].ToString();
                    String TinhTrang          = context.Request.Form["TinhTrang"].ToString();
                    String LoaiThu            = context.Request.Form["LoaiThu"].ToString();
                    String GhiChu             = context.Request.Form["GhiChu"].ToString();
                    String IdKeToan           = context.Request.Form["IdKeToan"].ToString();
                    DataObject.ChiTietThu ctt = new DataObject.ChiTietThu();
                    ctt.Ngay     = Convert.ToDateTime(Ngay != "" ? Ngay : DateTime.Now.ToShortDateString());
                    ctt.IdNgayHD = Convert.ToInt32(IdNgayHD);
                    if (SoTien != null && SoTien != "")
                    {
                        ctt.SoTien = Convert.ToDecimal(SoTien);
                    }
                    else
                    {
                        ctt.SoTien = Convert.ToDecimal("0");
                    }
                    ctt.MaNganHang = Convert.ToInt32(MaNganHang);
                    ctt.MaGiaoDich = MaGiaoDich;
                    ctt.TinhTrang  = Convert.ToInt32(TinhTrang);
                    ctt.LoaiThu    = Convert.ToInt32(LoaiThu);
                    ctt.GhiChu     = GhiChu;
                    ctt.NgayTao    = DateTime.Now;
                    ctt.NguoiTao   = "";
                    ctt.IdKeToan   = Convert.ToInt32(IdKeToan);
                    int Id = Servies.KeToanServices.InsertChiTietThuReturnId(ctt);
                    context.Response.ContentType = "text/plain";
                    context.Response.Write(Id);
                }
                if (type == "InsertChiTietThuTMReturnId")
                {
                    String jsonData = context.Request.Form["data"].ToString();
                    //Ngay,IdNgayHD,SoTien,MaNganHang,MaGiaoDich,TinhTrang,GhiChu,LoaiThu,NgayTao,NguoiTao,IdKeToan
                    String Ngay               = context.Request.Form["Ngay"].ToString();
                    String IdNgayHD           = context.Request.Form["IdNgayHD"].ToString();
                    String ID                 = context.Request.Form["ID"].ToString();
                    String SoTien             = context.Request.Form["SoTien"].ToString();
                    String MaNganHang         = context.Request.Form["MaNganHang"].ToString();
                    String MaGiaoDich         = context.Request.Form["MaGiaoDich"].ToString();
                    String TinhTrang          = context.Request.Form["TinhTrang"].ToString();
                    String LoaiThu            = context.Request.Form["LoaiThu"].ToString();
                    String GhiChu             = context.Request.Form["GhiChu"].ToString();
                    String IdKeToan           = context.Request.Form["IdKeToan"].ToString();
                    DataObject.ChiTietThu ctt = new DataObject.ChiTietThu();
                    ctt.Ngay     = Convert.ToDateTime(Ngay != "" ? Ngay : DateTime.Now.ToShortDateString());
                    ctt.IdNgayHD = Convert.ToInt32(IdNgayHD);
                    ctt.ID       = Convert.ToInt32(ID);
                    if (SoTien != null && SoTien != "")
                    {
                        ctt.SoTien = Convert.ToDecimal(SoTien);
                    }
                    else
                    {
                        ctt.SoTien = Convert.ToDecimal("0");
                    }
                    ctt.MaNganHang = Convert.ToInt32(MaNganHang);
                    ctt.MaGiaoDich = MaGiaoDich;
                    ctt.TinhTrang  = Convert.ToInt32(TinhTrang);
                    ctt.LoaiThu    = Convert.ToInt32(LoaiThu);
                    ctt.GhiChu     = GhiChu;
                    ctt.NgayTao    = DateTime.Now;
                    ctt.NguoiTao   = "";
                    ctt.IdKeToan   = Convert.ToInt32(IdKeToan);
                    int Id = Servies.KeToanServices.InsertChiTietThuTMReturnId(ctt);
                    context.Response.ContentType = "text/plain";
                    context.Response.Write(Id);
                }
                if (type == "InsertChiTietChiReturnId")
                {
                    String jsonData = context.Request.Form["data"].ToString();
                    //Ngay,NoiDungChi,SoTien,MaNganHang,GhiChu,NguoiTao,NgayTao,IdKeToan
                    String Ngay               = context.Request.Form["Ngay"].ToString();
                    String NoiDungChi         = context.Request.Form["NoiDungChi"].ToString();
                    String SoTien             = context.Request.Form["SoTien"].ToString();
                    String MaNganHang         = context.Request.Form["MaNganHang"].ToString();
                    String GhiChu             = context.Request.Form["GhiChu"].ToString();
                    String IdKeToan           = context.Request.Form["IdKeToan"].ToString();
                    DataObject.ChiTietChi ctt = new DataObject.ChiTietChi();
                    ctt.Ngay = Convert.ToDateTime(Ngay != "" ? Ngay : DateTime.Now.ToShortDateString());
                    if (SoTien != null && SoTien != "")
                    {
                        ctt.SoTien = Convert.ToDecimal(SoTien);
                    }
                    else
                    {
                        ctt.SoTien = Convert.ToDecimal("0");
                    }
                    ctt.NoiDungChi = NoiDungChi;
                    ctt.MaNganHang = Convert.ToInt32(MaNganHang);
                    ctt.GhiChu     = GhiChu;
                    ctt.NgayTao    = DateTime.Now;
                    ctt.NguoiTao   = "";
                    ctt.IdKeToan   = Convert.ToInt32(IdKeToan);
                    ctt.ID         = Convert.ToInt32(IdKeToan);
                    int Id = Servies.KeToanServices.InsertChiTietChiReturnId(ctt);
                    context.Response.ContentType = "text/plain";
                    context.Response.Write(Id);
                }
                if (type == "InsertLuuChuyenDongTienReturnId")
                {
                    String jsonData = context.Request.Form["data"].ToString();
                    //Ngay,SoTien,MaNganHangChi,MaNganHangThu,GhiChu,NguoiTao,NgayTao,IdKeToan
                    String Ngay                      = context.Request.Form["Ngay"].ToString();
                    String SoTien                    = context.Request.Form["SoTien"].ToString();
                    String MaNganHangThu             = context.Request.Form["MaNganHangThu"].ToString();
                    String MaNganHangChi             = context.Request.Form["MaNganHangChi"].ToString();
                    String GhiChu                    = context.Request.Form["GhiChu"].ToString();
                    String IdKeToan                  = context.Request.Form["IdKeToan"].ToString();
                    DataObject.LuuChuyenDongTien ctt = new DataObject.LuuChuyenDongTien();
                    ctt.Ngay = Convert.ToDateTime(Ngay != "" ? Ngay : DateTime.Now.ToShortDateString());
                    if (SoTien != null && SoTien != "")
                    {
                        ctt.SoTien = Convert.ToDecimal(SoTien);
                    }
                    else
                    {
                        ctt.SoTien = Convert.ToDecimal("0");
                    }
                    ctt.MaNganHangThu = Convert.ToInt32(MaNganHangThu);
                    ctt.MaNganHangChi = Convert.ToInt32(MaNganHangChi);
                    ctt.GhiChu        = GhiChu;
                    ctt.NgayTao       = DateTime.Now;
                    ctt.NguoiTao      = "";
                    ctt.IdKeToan      = Convert.ToInt32(IdKeToan);
                    ctt.ID            = Convert.ToInt32(IdKeToan);
                    int Id = Servies.KeToanServices.InsertLuuChuyenDongTienReturnId(ctt);
                    context.Response.ContentType = "text/plain";
                    context.Response.Write(Id);
                }

                if (type == "viewKeToanTongHopKy")
                {
                    String jsonData = context.Request.Form["data"].ToString();
                    //Ngay,SoTien,MaNganHangChi,MaNganHangThu,GhiChu,NguoiTao,NgayTao,IdKeToan
                    String flag = context.Request.Form["flag"].ToString();
                    List <DataObject.KeToanTongHop> viewKeToanTongHopKy = Servies.KeToanServices.viewKeToanTongHopKy(Convert.ToInt16(flag));
                    context.Response.ContentType = "application/json";
                    context.Response.Write(JsonConvert.SerializeObject(viewKeToanTongHopKy));
                }
            }
            catch (Exception e)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("0");
            }
        }