protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var idNull = string.IsNullOrEmpty(id); using (var con = DAL.con()) { var thuChi = ThuChiDal.SelectById(con, Convert.ToInt64(id)); Item = PhoiDal.SelectById(con, thuChi.PHOI_ID); var Xe = XeDal.SelectById(con, Item.XE_ID); var LaiXe = LaiXeDal.SelectById(con, Item.LAIXE_ID); var LoaiBieuDo = LoaiBieuDoDal.SelectById(con, Xe.BIEUDO_ID); var Tuyen = TuyenDal.SelectById(con, Xe.TUYEN_ID); var TruyThuItem = TruyThuDal.SelectByPhoiId(con, Convert.ToInt64(Item.ID)); var XeVaoBen = XeVaoBenDal.SelectByPhoiId(con, Item.ID); Item.TruyThuItem = TruyThuItem; Item.XeVaoBen = XeVaoBen; Xe.LaiXe = LaiXe; Item.LaiXe = LaiXe; Xe.LoaiBieuDo = LoaiBieuDo; Xe.Tuyen = Tuyen; Item.Xe = Xe; PhoiNgoaiTinh.Item = Item; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var dichVuList = new List <PhieuDichVuDichVu>(); var listDuyetAnh = new List <DuyetAnh>(); var listBaiHat = new List <BaiHat>(); var listThuChi = new List <ThuChi>(); using (var con = DAL.con()) { if (string.IsNullOrEmpty(id)) { Item = PhieuDichVuDal.SelectDraff(con); Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1; Item.ID = Guid.NewGuid(); } else { Item = PhieuDichVuDal.SelectById(con, new Guid(id)); dichVuList = PhieuDichVuDichVuDal.SelectByPdvId(con, id); listDuyetAnh = DuyetAnhDal.SelectByPdvId(con, id); listBaiHat = BaiHatDal.SelectByPdvId(con, id); listThuChi = ThuChiDal.SelectByPdvId(con, Item.ID); } Add.ListDichVu = dichVuList; Add.Item = Item;; Add.ListDuyetAnh = listDuyetAnh; Add.ListBaiHat = listBaiHat; Add.ListThuChi = listThuChi; Add.ListUrl = "/lib/pages/ThungRac/PhieuDichVu.aspx"; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var khId = Request["KH_ID"]; var pdvId = Request["PDV_ID"]; using (var con = DAL.con()) { if (string.IsNullOrEmpty(id)) { Item = ThuChiDal.SelectByDraff(con, false); if (khId != null && khId.Length > 36) { khId = khId.Substring(khId.LastIndexOf(',') + 1); var kh = KhachHangDal.SelectById(new Guid(khId), con); Item.P_Ten = kh.Ten; Item.P_ID = kh.ID; } } else { Item = ThuChiDal.SelectById(con, new Guid(id)); } var listLoai = DanhMucDal.SelectByLDMMa(con, "NDTC-CHI"); AddChi.ListLoai = listLoai; AddChi.Item = Item; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var khId = Request["KH_ID"]; var list = new List <PhieuXuatNhapSanPhamChiTiet>(); var listThuChi = new List <ThuChi>(); using (var con = DAL.con()) { if (string.IsNullOrEmpty(id)) { Item = ChoThueVayDal.SelectDraff(con); Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1; Item.ID = Guid.NewGuid(); if (!string.IsNullOrEmpty(khId)) { var kh = KhachHangDal.SelectById(new Guid(khId), con); Item.KH_ID = kh.ID; Item.KH_Ten = kh.Ten; } } else { Item = ChoThueVayDal.SelectById(con, new Guid(id)); list = PhieuXuatNhapSanPhamChiTietDal.SelectByPxnSpId(con, id); listThuChi = ThuChiDal.SelectByCtvId(con, Item.ID); } Add.ListThuChi = listThuChi; Add.List = list; Add.Item = Item;; } }
protected void Page_Load(object sender, EventArgs e) { var q = Request["q"]; var khId = Request["KH_ID"]; var ndtcId = Request["NDTC_ID"]; var size = Request["size"]; if (string.IsNullOrEmpty(size)) { size = "10"; } var url = string.Format("?q={0}&size={1}&NDTC_ID={2}&", q, size, ndtcId) + "{1}={0}"; var tuNgay = Request["TuNgay"]; var denNgay = Request["DenNgay"]; if (!string.IsNullOrEmpty(tuNgay)) { if (string.IsNullOrEmpty(denNgay)) { tuNgay = Server.UrlDecode(tuNgay); var d = Convert.ToDateTime(tuNgay, new CultureInfo("Vi-vn")); tuNgay = d.AddDays(-1).ToString("yyyy-MM-dd"); denNgay = d.AddDays(1).ToString("yyyy-MM-dd"); } else { tuNgay = Server.UrlDecode(tuNgay); var d = Convert.ToDateTime(tuNgay, new CultureInfo("Vi-vn")); tuNgay = d.ToString("yyyy-MM-dd"); denNgay = Server.UrlDecode(denNgay); var d1 = Convert.ToDateTime(denNgay, new CultureInfo("Vi-vn")); denNgay = d1.ToString("yyyy-MM-dd"); } } using (var con = DAL.con()) { var listLoai = DanhMucDal.SelectByLDMMa(con, "NDTC-THU"); DM_ID.List = listLoai; var pg = ThuChiDal.pagerNormal(con, url, false, "TC_SoPhieu desc", q, Convert.ToInt32(size), true, ndtcId, tuNgay, denNgay); List.List = pg.List; paging = pg.Paging; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var listThuChi = new List <ThuChi>(); using (var con = DAL.con()) { if (string.IsNullOrEmpty(id)) { Item = PhieuBaoHongDal.SelectDraff(con); Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1; Item.ID = Guid.NewGuid(); } else { Item = PhieuBaoHongDal.SelectById(con, new Guid(id)); listThuChi = ThuChiDal.SelectByCtvId(con, Item.ID); } Add.Item = Item;; Add.ListThuChi = listThuChi; } }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var idNull = string.IsNullOrEmpty(id); using (var con = DAL.con()) { if (idNull) { Item = ThuChiDal.SelectByLastest(con, Security.CqId); } else { Item = ThuChiDal.SelectById(con, Convert.ToInt64(id)); var phoi = PhoiDal.SelectById(Item.PHOI_ID); var xe = XeDal.SelectById(phoi.XE_ID); phoi.Xe = xe; Item.Phoi = phoi; } } ThuCapPhoiAdd.Item = Item; }
protected void Page_Load(object sender, EventArgs e) { var q = Request["q"]; var size = Request["size"]; var bienSo = Request["bienSo"]; var xeId = string.Empty; if (string.IsNullOrEmpty(size)) { size = "10"; } var url = string.Format("?q={0}&size={1}&bienSo={2}&", q, size, bienSo) + "?page={0}"; using (var con = DAL.con()) { if (!string.IsNullOrEmpty(bienSo)) { if (bienSo.Length > 4 && bienSo.IndexOf(" ") > 0) { var spacePosition = bienSo.IndexOf(" "); var bienSoChu = bienSo.Substring(0, spacePosition); var bienSoSo = bienSo.Substring(spacePosition + 1); var xe = XeDal.SelectByBienSo(con, bienSoChu, bienSoSo); if (xe.ID > 0) { xeId = xe.ID.ToString(); } } } var pg = ThuChiDal.PagerByUser(con, url, Security.Username, xeId, "TC_ID desc", q, Convert.ToInt32(20)); ThuCapPhoiList.Pager = pg; } }
protected void Page_Load(object sender, EventArgs e) { var NDTC_ID = Request["NDTC_ID"]; var CQ_ID = Request["CQ_ID"]; var MaPhieu = Request["MaPhieu"]; var SoPhieu = Request["SoPhieu"]; var SoPhieuAll = Request["SoPhieuAll"]; var SoTien = Request["SoTien"]; var Mota = Request["Mota"]; var NgayTrenPhieu = Request["NgayTrenPhieu"]; var NgayTao = Request["NgayTao"]; var NguoiTao = Request["NguoiTao"]; var NgayCapNhat = Request["NgayCapNhat"]; var NguoiCapNhat = Request["NguoiCapNhat"]; var LoaiQuy = Request["LoaiQuy"]; var LoaiCandoi = Request["LoaiCandoi"]; var isCandoi = Request["isCandoi"]; var Thu = Request["Thu"]; var XN_ID = Request["XN_ID"]; var P_ID = Request["P_ID"]; var PDV_ID = Request["PDV_ID"]; var CTV_ID = Request["CTV_ID"]; var PGV_ID = Request["PGV_ID"]; var PBH_ID = Request["PBH_ID"]; var Xoa = Request["Xoa"]; var XoaAdm = Request["XoaAdm"]; XoaAdm = string.IsNullOrEmpty(XoaAdm) ? "false" : "true"; Xoa = string.IsNullOrEmpty(Xoa) ? "false" : "true"; var logged = Security.IsAuthenticated(); var Id = Request["ID"]; var IdNull = string.IsNullOrEmpty(Id); var refUrl = Request["refUrl"]; if (!string.IsNullOrEmpty(refUrl)) { refUrl = Server.UrlDecode(refUrl); } switch (subAct) { case "save": #region Thêm Thu chi if (logged) { var item = ThuChiDal.SelectById(new Guid(Id)); IdNull = item.ID == Guid.Empty; if (IdNull) { item = new ThuChi { ID = new Guid(Id), NgayTao = DateTime.Now, NguoiTao = Security.UserId, NguoiCapNhat = Security.UserId, NgayCapNhat = DateTime.Now }; } else { item.NgayCapNhat = DateTime.Now; item.NguoiCapNhat = Security.UserId; } item.isCandoi = false; if (!string.IsNullOrEmpty(LoaiQuy)) { item.LoaiQuy = Convert.ToInt32(LoaiQuy); } if (!string.IsNullOrEmpty(NgayTrenPhieu)) { item.NgayTrenPhieu = Convert.ToDateTime(NgayTrenPhieu, new CultureInfo("vi-vn")); } if (!string.IsNullOrEmpty(SoTien)) { item.SoTien = Convert.ToDouble(SoTien); } if (!string.IsNullOrEmpty(P_ID)) { item.P_ID = new Guid(P_ID); } if (!string.IsNullOrEmpty(PDV_ID)) { item.PDV_ID = new Guid(PDV_ID); } if (!string.IsNullOrEmpty(CTV_ID)) { item.CTV_ID = new Guid(CTV_ID); } if (!string.IsNullOrEmpty(PGV_ID)) { item.PGV_ID = new Guid(PGV_ID); } if (!string.IsNullOrEmpty(PBH_ID)) { item.PBH_ID = new Guid(PBH_ID); } if (!string.IsNullOrEmpty(NDTC_ID)) { item.NDTC_ID = new Guid(NDTC_ID); } if (!string.IsNullOrEmpty(SoPhieu)) { item.SoPhieu = Convert.ToInt32(SoPhieu); } item.Thu = Convert.ToBoolean(Thu); item.Mota = Mota; if (IdNull) { item = ThuChiDal.Insert(item); #region log LogDal.log(item, new Log() { Checked = false , Info = string.Format("{1} thêm mới phiếu thu: {0}", item.Ma, Security.Username) , NgayTao = DateTime.Now , Username = Security.Username , PRowId = item.ID , PTen = item.Ma , RequestIp = Request.UserHostAddress , RawUrl = refUrl , LLOG_ID = 1 , Ten = "Thêm" }); #endregion } else { item = ThuChiDal.Update(item); #region log LogDal.log(item, new Log() { Checked = false , Info = string.Format("{1} sửa phiếu thu: {0}", item.Ma, Security.Username) , NgayTao = DateTime.Now , Username = Security.Username , PRowId = item.ID , PTen = item.Ma , RequestIp = Request.UserHostAddress , RawUrl = refUrl , LLOG_ID = 2 , Ten = "Sửa" }); #endregion } //SearchManager.Add(Ten, item.IndexNoiDung, item.IndexContent, Ten, item.ID.ToString(), item.Url, typeof(SuKien).Name); TimKiemDal.Add(item, item.ID); rendertext(item.ID.ToString()); } break; #endregion case "remove": #region Xóa if (Security.IsAuthenticated()) { var item = ThuChiDal.SelectById(new Guid(Id)); if (item.NguoiTao == Security.UserId) { ThuChiDal.DeleteById(new Guid(Id)); //SearchManager.Remove(Id); TimKiemDal.DeleteByPRowId(DAL.con(), item.ID); #region log LogDal.log(item, new Log() { Checked = false , Info = string.Format("{1} xóa thu: {0}", item.Ma, Security.Username) , NgayTao = DateTime.Now , Username = Security.Username , PRowId = item.ID , PTen = item.Ma , RequestIp = Request.UserHostAddress , RawUrl = refUrl , LLOG_ID = 3 , Ten = "Xóa" }); #endregion rendertext("1"); } else { rendertext("0"); } } break; #endregion default: break; } }
protected override void Render(HtmlTextWriter writer) { var sb = new StringBuilder(); var cs = this.Page.ClientScript; #region Tham số HttpContext c = HttpContext.Current; var ID = c.Request["ID"]; var NDTC_ID = c.Request["NDTC_ID"]; var SoPhieu = c.Request["SoPhieu"]; var SoTien = c.Request["SoTien"]; var Mota = c.Request["Mota"]; var NgayTao = c.Request["NgayTao"]; var NguoiTao = c.Request["NguoiTao"]; var NgaySua = c.Request["NgaySua"]; var NguoiSua = c.Request["NguoiSua"]; var LoaiQuy = c.Request["LoaiQuy"]; var LoaiCandoi = c.Request["LoaiCandoi"]; var isCandoi = c.Request["isCandoi"]; var Thu = c.Request["Thu"]; var XN_ID = c.Request["XN_ID"]; var P_ID = c.Request["P_ID"]; var DV_ID = c.Request["DV_ID"]; var TuNgay = c.Request["TuNgay"]; var DenNgay = c.Request["DenNgay"]; var _q = c.Request["q"]; List <jgridRow> ListRow = new List <jgridRow>(); var danhMucKyHieu = DanhMucDal.SelectByMa("TC-THU"); var danhMucReportHeader = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI"); var danhMucReportFooter = DanhMucDal.SelectByMa("BAOCAO-FOOTER-THUCHI"); var draff = Request["draff"]; var isThu = true; #endregion switch (subAct) { case "get": #region lấy dữ liệu cho grid var pagerGet = ThuChiDal.pagerTuNgayDenNgay(jgrsidx + " " + jgrsord, _q, Convert.ToInt32(jgRows), isThu, TuNgay, DenNgay, NDTC_ID, null, true); string prefixMas = danhMucKyHieu.KyHieu; foreach (var item in pagerGet.List) { ListRow.Add(new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString() , item.NDTC_Ten , prefixMas + item.SoPhieu , item.P_Ten , item.Mota , item.NgayTao.ToString("dd-MM-yyyy") , Lib.TienVietNam(item.SoTien) , item.NguoiTao_Ten , (item.NguoiTao == Security.Username).ToString() , (item.XN_ID != Guid.Empty).ToString() , (item.DV_ID != Guid.Empty).ToString() })); } jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage , pagerGet.TotalPages.ToString() , pagerGet.Total.ToString() , ListRow); sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm)); break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(ID)) { ThuChiDal.DeleteById(new Guid(ID)); } break; #endregion case "edit": #region chỉnh sửa if (!string.IsNullOrEmpty(ID)) { var item = ThuChiDal.SelectById(new Guid(ID)); string prefixMa = danhMucKyHieu.KyHieu; item.SoPhieu = prefixMa + item.SoPhieu; sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(item)); } break; #endregion case "draff": #region draff if (Security.IsAuthenticated()) { var item = ThuChiDal.SelectByDraff(isThu); string prefixMa = danhMucKyHieu.KyHieu; item.SoPhieu = prefixMa + item.SoPhieu; sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(item)); } break; #endregion case "save": #region save if (Security.IsAuthenticated()) { var item = draff == "1" ? new ThuChi() : ThuChiDal.SelectById(new Guid(ID)); var prefixMa = danhMucKyHieu.KyHieu; SoPhieu = SoPhieu.Replace(prefixMa, ""); item.SoPhieu = SoPhieu; if (!string.IsNullOrEmpty(DV_ID)) { item.DV_ID = new Guid(DV_ID); } item.LoaiCandoi = Convert.ToInt32(LoaiCandoi); item.LoaiQuy = Convert.ToInt32(LoaiQuy); item.Mota = Mota; if (!string.IsNullOrEmpty(NDTC_ID)) { item.NDTC_ID = new Guid(NDTC_ID); } item.NgaySua = DateTime.Now; item.NguoiSua = Security.Username; if (!string.IsNullOrEmpty(P_ID)) { item.P_ID = new Guid(P_ID); } item.SoTien = Convert.ToDouble(SoTien); item.Thu = isThu; if (!string.IsNullOrEmpty(XN_ID)) { item.XN_ID = new Guid(XN_ID); } item.isCandoi = true; item.NgayTao = Convert.ToDateTime(NgayTao, new CultureInfo("vi-Vn")); if (draff == "1") { item.ID = new Guid(ID); item.NguoiTao = NguoiTao; item = ThuChiDal.Insert(item); } else { item = ThuChiDal.Update(item); } // TODO: Tiếp tục phần thu chi sb.Append("1"); } break; #endregion case "reports": #region bao cao if (!string.IsNullOrEmpty(ID)) { var itemIn = Lib.GetResource(Assembly.GetExecutingAssembly(), "quanLyThuDauKy.in-natural.htm"); var item = ThuChiDal.SelectById(new Guid(ID)); sb.AppendFormat(itemIn , string.Format("Ngày {4}{0} tháng {3}{1} năm {2}", item.NgayTao.Day, item.NgayTao.Month, item.NgayTao.Year, item.NgayTao.Month < 10 ? "0" : "", item.NgayTao.Day < 10 ? "0" : "") , item.NDTC_Ten , string.Format("{0}{1}", danhMucKyHieu.KyHieu, item.SoPhieu) , (item.LoaiQuy == 1 ? "Tài khoản" : "Tiền mặt") , Lib.TienVietNam(item.SoTien) , Lib.So_chu(item.SoTien) , item.P_Ten , item.NguoiTao_Ten , item.Mota , domain , danhMucReportHeader.Description , danhMucReportFooter.Description); } break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThuDauKy.JScript1.js")); //sb.AppendFormat(@"{0}" // , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThuDauKy.Publish.js")); break; #endregion default: #region nạp var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "quanLyThuDauKy.mdl.htm")); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThuDauKy.JScript1.js") , "{quanLyThuDauKyDauKyFn.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; var khId = Request["KH_ID"]; var pdvId = Request["PDV_ID"]; var ctvId = Request["CTV_ID"]; var pgvId = Request["PGV_ID"]; var pbhId = Request["PBH_ID"]; using (var con = DAL.con()) { if (string.IsNullOrEmpty(id)) { Item = ThuChiDal.SelectByDraff(con, true); if (khId != null && khId.Length >= 36) { khId = khId.Substring(khId.LastIndexOf(',') + 1); var kh = KhachHangDal.SelectById(new Guid(khId), con); Item.P_Ten = kh.Ten; Item.P_ID = kh.ID; } if (pdvId != null && pdvId.Length >= 36) { pdvId = pdvId.Substring(pdvId.LastIndexOf(',') + 1); var pdv = PhieuDichVuDal.SelectById(con, new Guid(pdvId)); Item.PDV_ID = pdv.ID; Item.PDV_Ma = pdv.Ma; var kh = KhachHangDal.SelectById(pdv.KH_ID, con); Item.P_Ten = kh.Ten; Item.P_ID = kh.ID; } if (ctvId != null && ctvId.Length >= 36) { ctvId = ctvId.Substring(ctvId.LastIndexOf(',') + 1); var ctv = ChoThueVayDal.SelectById(con, new Guid(ctvId)); Item.CTV_ID = ctv.ID; Item.CTV_Ma = ctv.Ma; var kh = KhachHangDal.SelectById(ctv.KH_ID, con); Item.P_Ten = kh.Ten; Item.P_ID = kh.ID; } if (pgvId != null && pgvId.Length >= 36) { pgvId = pgvId.Substring(pgvId.LastIndexOf(',') + 1); var pgv = PhieuGiatVayDal.SelectById(con, new Guid(pgvId)); Item.PGV_ID = pgv.ID; Item.PGV_Ma = pgv.Ma; } if (pbhId != null && pbhId.Length >= 36) { pbhId = pbhId.Substring(pgvId.LastIndexOf(',') + 1); var pbh = PhieuBaoHongDal.SelectById(con, new Guid(pbhId)); Item.PBH_ID = pbh.ID; Item.PBH_Ma = pbh.Ma; } } else { Item = ThuChiDal.SelectById(con, new Guid(id)); } var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description; InPhieuChi.LogoStr = logoStr; var listLoai = DanhMucDal.SelectByLDMMa(con, "NDTC-CHI"); InPhieuChi.ListLoai = listLoai; InPhieuChi.Item = Item; } }
protected void Page_Load(object sender, EventArgs e) { var loggedIn = Security.IsAuthenticated(); var Id = Request["Id"]; var PHOI_ID = Request["PHOI_ID"]; var STTBX = Request["STTBX"]; var STTALL = Request["STTALL"]; var XE_ID = Request["XE_ID"]; var Ngay = Request["Ngay"]; var Tien = Request["Tien"]; var XVB_ID = Request["XVB_ID"]; var Inserted = string.IsNullOrEmpty(Id); switch (subAct) { case "save": #region save if (loggedIn) { var Item = Inserted ? ThuChiDal.SelectByLastest(DAL.con(), Security.CqId) : ThuChiDal.SelectById(Convert.ToInt32(Id)); if (!string.IsNullOrEmpty(Tien)) { Item.Tien = Convert.ToDouble(Tien); } Item.CQ_ID = Security.CqId; if (!string.IsNullOrEmpty(PHOI_ID)) { Item.PHOI_ID = Convert.ToInt64(PHOI_ID); var phoi = PhoiDal.SelectById(Item.PHOI_ID); Item.XE_ID = Convert.ToInt32(phoi.XE_ID); } if (!string.IsNullOrEmpty(Ngay)) { Item.Ngay = Convert.ToDateTime(Ngay, new CultureInfo("vi-vn")); } if (Inserted) { Item.NguoiTao = Security.Username; Item.NgayTao = DateTime.Now; Item.RowId = Guid.NewGuid(); } if (Inserted) { var giaoCa = GiaoCaDal.Current(Security.CqId, Security.Username); Item.GIAOCA_ID = giaoCa.ID; giaoCa.DoanhThu += Item.Tien; giaoCa.NgayCapNhat = DateTime.Now; GiaoCaDal.Update(giaoCa); } Item.NgayCapNhat = DateTime.Now; Item.XVB_ID = Convert.ToInt64(XVB_ID); Item = Inserted ? ThuChiDal.Insert(Item) : ThuChiDal.Update(Item); if (Inserted) { if (!string.IsNullOrEmpty(XVB_ID)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(XVB_ID)); xvb.TC_ID = Item.ID; xvb.TrangThai = 800; xvb.NguoiXuLyThanhToan = Security.Username; xvb.NgayThanhToanXong = xvb.NgayCapNhat = DateTime.Now; XeVaoBenDal.Update(xvb); } var chamCongByPhoiId = ChamCongDal.SelectByPhoiId(Item.PHOI_ID); foreach (var item in chamCongByPhoiId) { item.NgayCapNhat = DateTime.Now; item.Draff = false; ChamCongDal.Update(item); } } rendertext(Item.ID.ToString()); } rendertext("0"); break; #endregion case "remove": #region remove if (loggedIn) { var Item = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); if (Item.Username == Security.Username) { LaiXeDal.DeleteById(Item.ID); rendertext("0"); } } rendertext("-1"); break; #endregion case "getLatest": #region getLatest if (loggedIn) { var item = ThuChiDal.SelectByLastest(DAL.con(), Security.CqId); rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(item))); } rendertext("-1"); break; #endregion case "search": #region search #endregion default: break; } }
protected override void Render(HtmlTextWriter writer) { var sb = new StringBuilder(); var cs = this.Page.ClientScript; #region Tham số var _ID = Request["ID"]; if (string.IsNullOrEmpty(_ID)) { _ID = Guid.Empty.ToString(); } var No = Request["No"]; HttpContext c = HttpContext.Current; var listRow = new List <jgridRow>(); #endregion switch (subAct) { case "get": #region lấy dữ liệu cho grid foreach (var item in KhachHangDal.SelectCongNo(No)) { listRow.Add(new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString() , item.Ten , Lib.TienVietNam(item.CongNoDauKy) , Lib.TienVietNam(item.TongNhap) , Lib.TienVietNam(item.TongXuat) , Lib.TienVietNam(item.TongThu) , Lib.TienVietNam(item.TongChi) , Lib.TienVietNam(item.TongDichVu) , Lib.TienVietNam(item.CongNo) })); } var gridSpAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage , "1" , "1000" , listRow); sb.Append(JavaScriptConvert.SerializeObject(gridSpAdm)); break; #endregion case "getSubXuat": #region getSubXuat if (!string.IsNullOrEmpty(_ID)) { var danhMucLoaiXuatNhap = DanhMucDal.SelectByMa("LXN-X"); var pagerGet = XuatNhapDal.pagerXuatNhap(true.ToString(), false.ToString(), false.ToString(), false.ToString(), _ID, jgrsidx + " " + jgrsord, string.Empty, Convert.ToInt32(jgRows)); string prefixMas = danhMucLoaiXuatNhap.KyHieu; foreach (var item in pagerGet.List) { listRow.Add(new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString() , item.LOAI_Ten , prefixMas + item.Ma , item.KH_Ten , item.NgayHoaDon.ToString("dd-MM-yyyy") , Lib.TienVietNam(item.CongTienHang) , Lib.TienVietNam(item.VAT) , Lib.TienVietNam(item.ChietKhau) , Lib.TienVietNam(item.CongTienHang + item.VAT - item.ChietKhau) , Lib.TienVietNam(item.ThanhToan) , Lib.TienVietNam(item.ConNo) , string.Format("{0:dd/MM/yy}", item.NgayCapNhat) })); } jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage , pagerGet.TotalPages.ToString() , pagerGet.Total.ToString() , listRow); sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm)); } break; #endregion case "getSubNhap": #region getSubNhap if (!string.IsNullOrEmpty(_ID)) { var danhMucLoaiXuatNhap = DanhMucDal.SelectByMa("LXN-N"); var pagerGet = XuatNhapDal.pagerXuatNhap(false.ToString(), false.ToString(), false.ToString(), false.ToString(), _ID, jgrsidx + " " + jgrsord, string.Empty, Convert.ToInt32(jgRows)); string prefixMas = danhMucLoaiXuatNhap.KyHieu; foreach (var item in pagerGet.List) { listRow.Add(new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString() , item.LOAI_Ten , prefixMas + item.Ma , item.KH_Ten , item.NgayHoaDon.ToString("dd-MM-yyyy") , Lib.TienVietNam(item.CongTienHang) , Lib.TienVietNam(item.VAT) , Lib.TienVietNam(item.ChietKhau) , Lib.TienVietNam(item.CongTienHang + item.VAT - item.ChietKhau) , Lib.TienVietNam(item.ThanhToan) , Lib.TienVietNam(item.ConNo) , string.Format("{0:dd/MM/yy}", item.NgayCapNhat) })); } jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage , pagerGet.TotalPages.ToString() , pagerGet.Total.ToString() , listRow); sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm)); } break; #endregion case "getSubThu": #region getSubThu if (!string.IsNullOrEmpty(_ID)) { var pagerGet = ThuChiDal.pagerTuNgayDenNgay(jgrsidx + " " + jgrsord, null, Convert.ToInt32(jgRows), true, null, null, null, _ID); var danhMucKyHieu = DanhMucDal.SelectByMa("TC-THU"); string prefixMas = danhMucKyHieu.KyHieu; foreach (var item in pagerGet.List) { listRow.Add(new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString() , item.NDTC_Ten , prefixMas + item.SoPhieu , item.P_Ten , item.Mota , item.NgayTao.ToString("dd-MM-yyyy") , Lib.TienVietNam(item.SoTien) , item.NguoiTao_Ten , (item.NguoiTao == Security.Username).ToString() , (item.XN_ID != Guid.Empty).ToString() , (item.DV_ID != Guid.Empty).ToString() })); } jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage , pagerGet.TotalPages.ToString() , pagerGet.Total.ToString() , listRow); sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm)); } break; #endregion case "getSubChi": #region lấy dữ liệu cho getSubThu if (!string.IsNullOrEmpty(_ID)) { var pagerGet = ThuChiDal.pagerTuNgayDenNgay(jgrsidx + " " + jgrsord, null, Convert.ToInt32(jgRows), false, null, null, null, _ID); var danhMucKyHieu = DanhMucDal.SelectByMa("TC-CHI"); string prefixMas = danhMucKyHieu.KyHieu; foreach (var item in pagerGet.List) { listRow.Add(new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString() , item.NDTC_Ten , prefixMas + item.SoPhieu , item.P_Ten , item.Mota , item.NgayTao.ToString("dd-MM-yyyy") , Lib.TienVietNam(item.SoTien) , item.NguoiTao_Ten , (item.NguoiTao == Security.Username).ToString() , (item.XN_ID != Guid.Empty).ToString() , (item.DV_ID != Guid.Empty).ToString() })); } jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage , pagerGet.TotalPages.ToString() , pagerGet.Total.ToString() , listRow); sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm)); } break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoNo.JScript1.js")); //sb.AppendFormat(@"{0}" // , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoNo.Publish.js")); break; #endregion default: #region nạp var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "baoCaoNo.mdl.htm")); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoNo.JScript1.js") , "{baoCaoNoFn.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }
protected void Page_Load(object sender, EventArgs e) { var loggedIn = Security.IsAuthenticated(); var Id = Request["Id"]; var uname = Security.Username; switch (subAct) { case "GetNewers": if (loggedIn) { var list = XeVaoBenDal.ListTsLenPhoi(DAL.con(), Security.CqId, 100); if (list.Any()) { ListTodayAjax.List = list; ListTodayAjax.Visible = true; } else { rendertext(""); } } break; case "GetChoThanhToan": if (loggedIn) { var list = XeVaoBenDal.ListTsChoThanhToan(DAL.con(), Security.CqId, 100); if (list.Any()) { TS_XeChoThanhToanAjax.List = list; TS_XeChoThanhToanAjax.Visible = true; } else { rendertext(""); } } break; case "GetDaThanhToan": if (loggedIn) { var list = XeVaoBenDal.ListTsDaThanhToan(DAL.con(), Security.CqId, 100); if (list.Any()) { TS_XeDaThanhToanAjax.List = list; TS_XeDaThanhToanAjax.Visible = true; } else { rendertext(""); } } break; case "GetYeuCauThanhToan": if (loggedIn) { var list = XeVaoBenDal.ListTsChoThanhToan(DAL.con(), Security.CqId, 100).OrderByDescending(x => x.TrangThai). ThenByDescending(x => x.ID).ToList(); if (list.Any()) { AjaxListYeuCauThanhToanHangDoi.List = list; AjaxListYeuCauThanhToanHangDoi.Visible = true; } else { rendertext(""); } } break; case "ListDuyetDeNghiTruyThu": if (loggedIn) { var list = XeVaoBenDal.ListTruyThu(DAL.con(), Security.CqId, 100).OrderByDescending(x => x.TrangThai). ThenByDescending(x => x.ID).ToList(); if (list.Any()) { AjaxListDuyetDeNghiTruyThu.List = list; AjaxListDuyetDeNghiTruyThu.Visible = true; } else { rendertext(""); } } break; case "GetYeuCauXuLyListByUsername": if (loggedIn) { var list = XeVaoBenDal.ListTsLenPhoi(DAL.con(), Security.CqId, 100).OrderByDescending(x => x.TrangThai). ThenByDescending(x => x.XE_GioXuatBen).ToList(); if (!list.Any()) { rendertext(""); } AjaxListYeuCauXuLyHangDoi.List = list; AjaxListYeuCauXuLyHangDoi.Visible = true; } break; case "YeuCauXuLy": if (!string.IsNullOrEmpty(Id)) { var item = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); item.TrangThai = 200; item.NgayYeuCauXuLy = item.NgayCapNhat = DateTime.Now; item = XeVaoBenDal.Update(item); } break; case "YeuCauXuatBen": if (!string.IsNullOrEmpty(Id)) { var item = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); item.TrangThai = 820; item.NgayCapNhat = DateTime.Now; item = XeVaoBenDal.Update(item); } break; case "YeuCauThanhToan": if (!string.IsNullOrEmpty(Id)) { var item = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); item.TrangThai = 600; item.NgayYeuCauThanhToan = item.NgayCapNhat = DateTime.Now; item = XeVaoBenDal.Update(item); } break; case "RestoreXeChuaXuLy": if (!string.IsNullOrEmpty(Id)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); xvb.TrangThai = 100; xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); } break; case "RestoreXeChuaThanhToan": if (!string.IsNullOrEmpty(Id)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); xvb.TrangThai = 400; xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); } break; case "NhanYeuCauThanhToan": if (!string.IsNullOrEmpty(Id)) { var xvb = XeVaoBenDal.SelectById(Convert.ToInt64(Id)); xvb.TrangThai = 700; xvb.NguoiNhanYeuCauThanhToan = Security.Username; xvb.NgayNhanYeuCauThanhToan = xvb.NgayCapNhat = DateTime.Now; xvb = XeVaoBenDal.Update(xvb); var thuChi = ThuChiDal.SelectByLastest(DAL.con(), Security.CqId); var phoi = PhoiDal.SelectById(xvb.PHOI_ID); var xe = XeDal.SelectById(phoi.XE_ID); thuChi.XeVaoBen = xvb; phoi.Xe = xe; thuChi.Phoi = phoi; rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(thuChi))); } break; case "GetCurrentCapPhoi": if (loggedIn) { var item = XeVaoBenDal.ListByCurrentCapPhoiByUser(DAL.con(), Security.CqId, Security.Username).FirstOrDefault(); if (item != null) { rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(item))); } rendertext(""); } break; case "GetCurrentThuCapPhoi": if (loggedIn) { var item = XeVaoBenDal.ListByCurrentThuCapPhoiByUser(DAL.con(), Security.CqId, Security.Username).FirstOrDefault(); if (item != null) { var thuChi = ThuChiDal.SelectByLastest(DAL.con(), Security.CqId); var phoi = PhoiDal.SelectById(item.PHOI_ID); var xe = XeDal.SelectById(phoi.XE_ID); thuChi.XeVaoBen = item; phoi.Xe = xe; thuChi.Phoi = phoi; rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(thuChi))); } rendertext(""); } break; default: break; } }