public List <clsBaoCaoKeToan> PhatHanhQuocTe(DateTime rNgay) { //Dich vu List <clsDichVu> lstDV = new List <clsDichVu>(); daDichVu dDV = new daDichVu(); lstDV = dDV.LayDanhSach("BCCP"); List <clsBaoCaoKeToan> lst = new List <clsBaoCaoKeToan>(); clsBaoCaoKeToan pt; List <clsDuLieuBCCP> lstNT; using (var db = new LiteDatabase(dCli.TenFileDuLieuBCCP)) { var col = db.GetCollection <clsDuLieuBCCP>(dCli.BangDuLieuBCCP); foreach (clsDichVu pDV in lstDV) { lstNT = col.Find(tm => tm.NgayPhatHanh.Value.ToShortDateString() == rNgay.ToShortDateString() && tm.MaNuocPhat != null && tm.MaDichVu == pDV.Ma).ToList(); pt = new clsBaoCaoKeToan(); pt.Ma = pDV.Ma; pt.Ten = pDV.Ten; pt.SoLuong = lstNT.Count; pt.KhoiLuong = lstNT.Sum(x => x.TrongLuongQuiDoi.Value); pt.TongCuoc = lstNT.Sum(x => x.TongCuoc.Value); pt.CuocCOD = lstNT.Sum(x => x.CuocCOD.Value); pt.VAT = lstNT.Sum(x => x.VAT.Value); pt.ThanhTien = lstNT.Sum(x => x.ThanhTien.Value); pt.ThanhTienCOD = lstNT.Sum(x => x.CuocCODVAT.Value); lst.Add(pt); } } return(lst); }
public DataTable TaoBang() { DataTable Bang = new DataTable(); Bang.Columns.Add("MaDichVu", typeof(string)); Bang.Columns.Add("MaDichVuCT", typeof(string)); Bang.Columns.Add("Ten", typeof(string)); Bang.Columns.Add("SoLuongNT", typeof(int)); Bang.Columns.Add("TrongNT", typeof(decimal)); Bang.Columns.Add("CuocNT", typeof(decimal)); Bang.Columns.Add("CuocCODNT", typeof(decimal)); Bang.Columns.Add("SoLuongLT", typeof(int)); Bang.Columns.Add("TrongLT", typeof(decimal)); Bang.Columns.Add("CuocLT", typeof(decimal)); Bang.Columns.Add("CuocCODLT", typeof(decimal)); Bang.Columns.Add("SoLuongQT", typeof(int)); Bang.Columns.Add("TrongQT", typeof(decimal)); Bang.Columns.Add("CuocQT", typeof(decimal)); Bang.Columns.Add("CuocCODQT", typeof(decimal)); DataTable dtNT; //daLayBangCuoc dLay = new daLayBangCuoc(); List <clsDichVu> lstDV = new List <clsDichVu>(); daDichVu dDV = new daDichVu(); lstDV = dDV.LayDanhSach("BCCP"); string _TenDV; //for (int k = 0; k < dtNT.Rows.Count; k++) foreach (clsDichVu dv in lstDV) { _TenDV = dv.Ten.Split('-')[0].Trim(); if (dv.Ma == "E") { Bang.Rows.Add(dv.Ma, "", _TenDV, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); Bang.Rows.Add(dv.Ma, "COD", _TenDV + " _ COD", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); Bang.Rows.Add(dv.Ma, "HT", _TenDV + " _ Hỏa Tốc", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } else { if (dv.Ma == "C" || dv.Ma == "R") { Bang.Rows.Add(dv.Ma, "", _TenDV, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); Bang.Rows.Add(dv.Ma, "COD", _TenDV + " _ COD", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } else { Bang.Rows.Add(dv.Ma, "", _TenDV, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } } } return(Bang); }
public DataTable BaoCaoNgay(DateTime rNgay) { //Dich vu List <clsDichVu> lstDV = new List <clsDichVu>(); daDichVu dDV = new daDichVu(); lstDV = dDV.LayDanhSach("BCCP"); //=========== List <clsBaoCaoKeToanTien> lst = new List <clsBaoCaoKeToanTien>(); List <clsDuLieuBCCP> lstTM; List <clsDuLieuBCCP> lstGN; clsBaoCaoKeToanTien cBCKTT; using (var db = new LiteDatabase(dCli.TenFileDuLieuBCCP)) { var col = db.GetCollection <clsDuLieuBCCP>(dCli.BangDuLieuBCCP); foreach (clsDichVu pDV in lstDV) { lstTM = col.Find(tm => tm.GhiNo == false && tm.NgayPhatHanh.Value.ToShortDateString() == rNgay.ToShortDateString() && tm.MaDichVu == pDV.Ma).ToList(); lstGN = col.Find(tm => tm.GhiNo == true && tm.NgayPhatHanh.Value.ToShortDateString() == rNgay.ToShortDateString() && tm.MaDichVu == pDV.Ma).ToList(); cBCKTT = new clsBaoCaoKeToanTien(); cBCKTT.Ma = pDV.Ma; cBCKTT.Ten = pDV.Ten; cBCKTT.SoLuong = lstTM.Count; cBCKTT.KhoiLuong = lstTM.Sum(x => x.TrongLuongQuiDoi.Value); cBCKTT.TongCuoc = lstTM.Sum(x => x.TongCuoc.Value); cBCKTT.CuocCOD = lstTM.Sum(x => x.CuocCOD.Value); cBCKTT.VAT = lstTM.Sum(x => x.VAT.Value); cBCKTT.ThanhTien = lstTM.Sum(x => x.ThanhTien.Value); cBCKTT.ThanhTienCOD = lstTM.Sum(x => x.CuocCODVAT.Value); cBCKTT.SoLuongGNo = lstGN.Count; cBCKTT.KhoiLuongGNo = lstGN.Sum(x => x.TrongLuongQuiDoi.Value); cBCKTT.TongCuocGNo = lstGN.Sum(x => x.TongCuoc.Value); cBCKTT.CuocCODGNo = lstGN.Sum(x => x.CuocCOD.Value); cBCKTT.VATGNo = lstGN.Sum(x => x.VAT.Value); cBCKTT.ThanhTienGNo = lstGN.Sum(x => x.ThanhTien.Value); cBCKTT.ThanhTienCODGNo = lstGN.Sum(x => x.CuocCODVAT.Value); lst.Add(cBCKTT); } } return(daTienIch.ToDataTable(lst)); }