private double TinhDiem_LoiNhuanGop_DoanhThu(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.HESO_LoiNhuanGop_DoanhThuThuan; long loiNhuanGop = 0; long doanhThuThuan = 0; for (int i = 0; i < 4; i++) { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); if (bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV == null || bcQuyHienTai.C1_DoanhThuBanHangVaCungcapDV == null) { break; } if (bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV <= 0 || bcQuyHienTai.C1_DoanhThuBanHangVaCungcapDV <= 0) { break; } loiNhuanGop += (long)bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV; doanhThuThuan += (long)bcQuyHienTai.C1_DoanhThuBanHangVaCungcapDV; LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); // Get quý trước đó } if (loiNhuanGop > 0 && doanhThuThuan > 0) { diem += (loiNhuanGop * 100 / doanhThuThuan) * heSo; } return(diem); }
private double TinhDiemChiPhiLaiVayTrenLoiNhuanGop(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.HESO_ChiPhiLaiVay_LoiNhuanGop; long loiNhuanGop = 0; long chiPhiLaiVay = 0; for (int i = 0; i < 4; i++) { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); if (bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV == null || bcQuyHienTai.C7_1_ChiPhiLaiVay == null) { break; } if (bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV <= 0) { break; } loiNhuanGop += (long)bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV; chiPhiLaiVay += (long)bcQuyHienTai.C7_1_ChiPhiLaiVay; LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); // Get quý trước đó } if (loiNhuanGop > 0) { diem += (100 - (chiPhiLaiVay) * 100 / loiNhuanGop) * heSo; } return(diem); }
private void CreateBctc_Button_Click(object sender, RoutedEventArgs e) { bctc baocao = new bctc(); try { baocao.quy = Convert.ToInt32(crQuy.Text); baocao.phiquanly = Convert.ToInt32(crPhiQuanLyDN.Text); baocao.nam = Convert.ToInt32(crNam.Text); baocao.mack = crMaCk.Text; baocao.loinhuantruocthue = Convert.ToInt32(crLNTruocThue.Text); baocao.loinhuansauthue = Convert.ToInt32(crLNSauThue.Text); baocao.loinhuankhac = Convert.ToInt32(crLNKhac.Text); baocao.giavon = Convert.ToInt32(crGiaVon.Text); baocao.doanhthuthuan = Convert.ToInt32(crDoanhThuThuan.Text); bool result = DataBase.CreateBctc(baocao); if (result) { MessageBox.Show("success"); } else { MessageBox.Show("Đã có bản ghi này rồi"); } } catch (Exception ex) { MessageBox.Show("Ngu! điền đầy đủ thông tin vào"); } }
private void SetErrorlog(long correctValue, long currentValue, bctc baoCao, string field) { if (correctValue != currentValue) { DataErrorLog.Add(baoCao.mack + "_" + baoCao.Quy + "_" + baoCao.Nam + "_" + field + "_" + correctValue); } }
private double TinhDiemDoanhThu(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.HESO_DOANH_THU; for (int i = 0; i < 4; i++) { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); bctc bcQuyTruoc = TimBaoCao(listBctc, currentQuy, currentYear - 1); if (bcQuyTruoc.C3_DoanhThuThuanVeBanHangVaCungCapDV == null || bcQuyHienTai.C3_DoanhThuThuanVeBanHangVaCungCapDV == null) { break; } if (bcQuyTruoc.C3_DoanhThuThuanVeBanHangVaCungCapDV <= 0 || bcQuyHienTai.C3_DoanhThuThuanVeBanHangVaCungCapDV <= 0) { break; } long doanhThuHienTai = (long)bcQuyHienTai.C3_DoanhThuThuanVeBanHangVaCungCapDV; long doanhThuQuyTruoc = (long)bcQuyTruoc.C3_DoanhThuThuanVeBanHangVaCungCapDV; if (doanhThuQuyTruoc != 0) { diem += (doanhThuHienTai - doanhThuQuyTruoc) * heSo * 100 / doanhThuQuyTruoc; } LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); } return(diem); }
private double TinhDiemLoiNhuan(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.HESO_LOI_NHUAN; for (int i = 0; i < 4; i++) { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); bctc bcQuyTruoc = TimBaoCao(listBctc, currentQuy, currentYear - 1); if (bcQuyTruoc.C18_LoiNhuanSauThueTNDN <= 0 || bcQuyHienTai.C18_LoiNhuanSauThueTNDN <= 0) { break; } if (bcQuyTruoc.C18_LoiNhuanSauThueTNDN == null || bcQuyHienTai.C18_LoiNhuanSauThueTNDN == null) { break; } long loiNhuanHienTai = (long)bcQuyHienTai.C18_LoiNhuanSauThueTNDN; long loiNhuanQuyTruoc = (long)bcQuyTruoc.C18_LoiNhuanSauThueTNDN; if (loiNhuanQuyTruoc != 0) { diem += (loiNhuanHienTai - loiNhuanQuyTruoc) * heSo * 100 / loiNhuanQuyTruoc; } LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); } return(diem); }
public static bool DelteBctc(int id) { bctc temp = dataBaseEntities.bctc.First(i => i.ID == id); if (temp == null) { return(false); } dataBaseEntities.bctc.Remove(temp); return(true); }
private void CompareValue(bctc baoCao, string contentVietStock, string contentVndirect) { CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.NoNganHan); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.NoDaiHan); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.VonGopCuaChuSoHuu); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.DoanhThuBanHangVaCungCapDichVu); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.LoiNhuanGop); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.ChiPhiLaiVay); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.ChiPhiBanHang); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.ChiPhiQuanLyDoanhNghiep); CompareOneValue(baoCao, contentVietStock, contentVndirect, Fields.LoiNhuanSauThue); }
private void UpdateRowData(string mack, int quy, int nam) { bctc baocao = DataBase.FindBctc(mack, quy, nam); udDoanhThuThuan.Text = baocao.doanhthuthuan.ToString(); udGiaVon.Text = baocao.giavon.ToString(); udPhiQuanLyDN.Text = baocao.phiquanly.ToString(); udLNTruocThue.Text = baocao.loinhuantruocthue.ToString(); udLNSauThue.Text = baocao.loinhuansauthue.ToString(); udLNKhac.Text = baocao.loinhuankhac.ToString(); bctcId.Content = baocao.ID; }
public static bool CreateBctc(bctc bctc) { List <bctc> temp = dataBaseEntities.bctc.ToList(); int count = temp.Count; for (int i = 0; i < count; i++) { if (temp[i].mack == bctc.mack && temp[i].nam == bctc.nam && temp[i].quy == bctc.quy) { return(false); } } dataBaseEntities.bctc.Add(bctc); dataBaseEntities.SaveChanges(); return(true); }
public void DoCompare() { Dictionary <string, List <string> > m_vietstockResult = ReadContentResult(Constants.CONTENT_RESULT_VIETSTOCK_FILE_NAME); Dictionary <string, List <string> > m_vndirectResult = ReadContentResult(Constants.CONTENT_RESULT_VNDIRECT_FILE_NAME); List <bctc> listBaoCao = DatabaseUtility.GetAllBctc2(); int count = listBaoCao.Count; for (int i = 0; i < count; i++) { bctc baoCao = listBaoCao[i]; string contentVietStock = FindResultString(m_vietstockResult[baoCao.mack], baoCao.mack, baoCao.Nam.ToString(), baoCao.Quy.ToString()); string contentVndirect = FindResultString(m_vndirectResult[baoCao.mack], baoCao.mack, baoCao.Nam.ToString(), baoCao.Quy.ToString()); CompareValue(baoCao, contentVietStock, contentVndirect); } }
public static bctc FindBctc(string mack, int quy, int nam) { List <bctc> temp = dataBaseEntities.bctc.ToList(); bctc result = new bctc(); int count = temp.Count; for (int i = 0; i < count; i++) { if (temp[i].mack.Equals(mack, StringComparison.InvariantCultureIgnoreCase) && temp[i].quy == quy && temp[i].nam == nam) { result = temp[i]; } } return(result); }
private double TinhDiem_NoNganHan_NoDaiHan(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.HESO_NoNganHan_NoDaiHan; long noNganHan = 0; long noDaiHan = 0; if (listBctc[0].mack == "BMP") { int x = 2; } for (int i = 0; i < 1; i++) // Nợ của quý hiện tại { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); if (bcQuyHienTai.C2_NoDaiHan == null) { break; } if (bcQuyHienTai.C1_NoNganHan < 0 || bcQuyHienTai.C2_NoDaiHan < 0) { break; } noNganHan += (long)bcQuyHienTai.C1_NoNganHan; noDaiHan += (long)bcQuyHienTai.C2_NoDaiHan; LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); // Get quý trước đó } if (noNganHan != 0 && noDaiHan != 0) { diem += (100 - noNganHan * 100 / noDaiHan) * heSo; } else if (noDaiHan == 0) { diem += 100 * heSo; } else if (noDaiHan == 0) { diem -= 50 * heSo; } return(diem); }
public static bool UpdateBctc(bctc baocao) { bctc temp = dataBaseEntities.bctc.First(i => i.ID == baocao.ID); if (temp == null) { return(false); } temp.giavon = baocao.giavon; temp.doanhthuthuan = baocao.doanhthuthuan; temp.loinhuankhac = baocao.loinhuankhac; temp.loinhuansauthue = baocao.loinhuansauthue; temp.loinhuantruocthue = baocao.loinhuantruocthue; temp.mack = baocao.mack; temp.nam = baocao.nam; temp.phiquanly = baocao.phiquanly; temp.quy = baocao.quy; return(true); }
private double TinhDiem_ROE(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.ROE; long loiNhuanSauThueTNDN = 0; long vonChuSoHuu = 0; for (int i = 0; i < 4; i++) { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); if (bcQuyHienTai.II_VonChuSoHuu == null || bcQuyHienTai.C18_LoiNhuanSauThueTNDN == null) { break; } if (bcQuyHienTai.II_VonChuSoHuu < 0 || bcQuyHienTai.C18_LoiNhuanSauThueTNDN < 0) { break; } loiNhuanSauThueTNDN += (long)bcQuyHienTai.C18_LoiNhuanSauThueTNDN; LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); // Get quý trước đó } currentYear = Constants.NAM_HIEN_TAI; currentQuy = Constants.QUY_HIEN_TAI; bctc bcQuyHienTai2 = TimBaoCao(listBctc, currentQuy, currentYear); if (bcQuyHienTai2.II_VonChuSoHuu == null) { return(0); } vonChuSoHuu += (long)bcQuyHienTai2.II_VonChuSoHuu; if (loiNhuanSauThueTNDN != 0 && vonChuSoHuu != 0) { diem += (loiNhuanSauThueTNDN * 100 / vonChuSoHuu) * heSo; } return(diem); }
private double TinhDiem_TangTruongEPS(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.HESO_PE; for (int i = 0; i < 4; i++) { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); bctc bcQuyTruoc = TimBaoCao(listBctc, currentQuy, currentYear - 1); if (bcQuyTruoc.C18_LoiNhuanSauThueTNDN == null || bcQuyHienTai.C18_LoiNhuanSauThueTNDN == null || bcQuyHienTai.C1_1_VonGopCuaChuSoHuu == null || bcQuyTruoc.C1_1_VonGopCuaChuSoHuu == null) { break; } if (bcQuyTruoc.C18_LoiNhuanSauThueTNDN <= 0 || bcQuyHienTai.C18_LoiNhuanSauThueTNDN <= 0 || bcQuyHienTai.C1_1_VonGopCuaChuSoHuu <= 0 || bcQuyTruoc.C1_1_VonGopCuaChuSoHuu <= 0) { break; } long loiNhuanHienTai = (long)bcQuyHienTai.C18_LoiNhuanSauThueTNDN; long soCpHienTai = (long)bcQuyHienTai.C1_1_VonGopCuaChuSoHuu / 10000; double peHienTai = loiNhuanHienTai / soCpHienTai; long loiNhuanQuyTruoc = (long)bcQuyTruoc.C18_LoiNhuanSauThueTNDN; long soCpQuyTruoc = (long)bcQuyTruoc.C1_1_VonGopCuaChuSoHuu / 10000; double peQuyTruoc = loiNhuanQuyTruoc / soCpQuyTruoc; if (peQuyTruoc > 0) { diem += (peHienTai - peQuyTruoc) * heSo * 100 / Math.Abs(peQuyTruoc); } LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); } return(Math.Round(diem, 0)); }
private double TinhDiemChiPhiQuanLyDn(List <bctc> listBctc) { double diem = 0; int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; int heSo = Constants.HESO_ChiPhiBanHangVaQuanLyDn_LoiNhuanGop; long loiNhuanGop = 0; long chiPhiQuanLyDN = 0; long chiPhiBanHang = 0; for (int i = 0; i < 4; i++) { bctc bcQuyHienTai = TimBaoCao(listBctc, currentQuy, currentYear); if (bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV == null || bcQuyHienTai.C10_ChiPhiQuanLyDoanhNghiep == null || bcQuyHienTai.C9_ChiPhiBanHang == null) { break; } if (bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV <= 0 || bcQuyHienTai.C10_ChiPhiQuanLyDoanhNghiep < 0 || bcQuyHienTai.C9_ChiPhiBanHang < 0) { break; } loiNhuanGop += (long)bcQuyHienTai.C5_LoiNhuanGopVeBanHangVaCungCapDV; chiPhiQuanLyDN += (long)bcQuyHienTai.C10_ChiPhiQuanLyDoanhNghiep; chiPhiBanHang += (long)bcQuyHienTai.C9_ChiPhiBanHang; LayQuyTruoc(ref currentQuy, ref currentYear, ref heSo); // Get quý trước đó } if (loiNhuanGop > 0) { diem += (100 - (chiPhiQuanLyDN + chiPhiBanHang) * 100 / loiNhuanGop) * heSo; } return(diem); }
private bool CheckBaoCao(List <bctc> listBctc) { int currentYear = Constants.NAM_HIEN_TAI; int currentQuy = Constants.QUY_HIEN_TAI; for (int i = 0; i < 8; i++) { bctc baocao = TimBaoCao(listBctc, currentQuy, currentYear); if (baocao.C3_DoanhThuThuanVeBanHangVaCungCapDV == null) { return(false); } if (currentQuy == 1) { currentQuy = 4; currentYear--; } else { currentQuy--; } } return(true); }
private void UpdateCongTy_Click(object sender, RoutedEventArgs e) { bctc baocao = DataBase.FindBctc(Convert.ToInt32(bctcId.Content)); }
private void CompareOneValue(bctc baoCao, string contentVietStock, string contentVndirect, string field) { long valueVietStock = 0; long valueVndirect = 0; valueVietStock = ExtractValue(contentVietStock, field); valueVndirect = ExtractValue(contentVndirect, field); long correctValue = 0; switch (field) { case Fields.NoNganHan: correctValue = GetCorrectValue(baoCao.C1_NoNganHan, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C1_NoNganHan, baoCao, field); baoCao.C1_NoNganHan = correctValue; break; case Fields.NoDaiHan: correctValue = GetCorrectValue((long)baoCao.C2_NoDaiHan, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C2_NoDaiHan, baoCao, field); baoCao.C2_NoDaiHan = correctValue; break; case Fields.VonGopCuaChuSoHuu: correctValue = GetCorrectValue((long)baoCao.C1_1_VonGopCuaChuSoHuu, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C1_1_VonGopCuaChuSoHuu, baoCao, field); baoCao.C1_1_VonGopCuaChuSoHuu = correctValue; break; case Fields.DoanhThuBanHangVaCungCapDichVu: correctValue = GetCorrectValue((long)baoCao.C1_DoanhThuBanHangVaCungcapDV, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C1_DoanhThuBanHangVaCungcapDV, baoCao, field); baoCao.C1_DoanhThuBanHangVaCungcapDV = correctValue; break; case Fields.LoiNhuanGop: correctValue = GetCorrectValue((long)baoCao.C5_LoiNhuanGopVeBanHangVaCungCapDV, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C5_LoiNhuanGopVeBanHangVaCungCapDV, baoCao, field); baoCao.C5_LoiNhuanGopVeBanHangVaCungCapDV = correctValue; break; case Fields.ChiPhiLaiVay: correctValue = GetCorrectValue((long)baoCao.C7_1_ChiPhiLaiVay, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C7_1_ChiPhiLaiVay, baoCao, field); baoCao.C7_1_ChiPhiLaiVay = correctValue; break; case Fields.ChiPhiBanHang: correctValue = GetCorrectValue((long)baoCao.C9_ChiPhiBanHang, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C9_ChiPhiBanHang, baoCao, field); baoCao.C9_ChiPhiBanHang = correctValue; break; case Fields.ChiPhiQuanLyDoanhNghiep: correctValue = GetCorrectValue((long)baoCao.C10_ChiPhiQuanLyDoanhNghiep, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C10_ChiPhiQuanLyDoanhNghiep, baoCao, field); baoCao.C10_ChiPhiQuanLyDoanhNghiep = correctValue; break; case Fields.LoiNhuanSauThue: correctValue = GetCorrectValue((long)baoCao.C18_LoiNhuanSauThueTNDN, valueVietStock, valueVndirect); SetErrorlog(correctValue, (long)baoCao.C18_LoiNhuanSauThueTNDN, baoCao, field); baoCao.C18_LoiNhuanSauThueTNDN = correctValue; break; } }