public TestReportDeduc(int payoffMasterId) { InitializeComponent(); using (var dbContext = new WiodySMContext()) { var defPayoffMaster = dbContext.PayoffMaster.Find(payoffMasterId); SelfDeduc(defPayoffMaster.Project.Contract.MasterContract.CONTRACT_PRICECUTRATE, payoffMasterId, defPayoffMaster.Project.Company.COMPANY_COMPANY_NAME, defPayoffMaster.PAYOFFMASTER_PROJECT_ID); var payoffList = dbContext.PayoffMaster.Where(x => x.PAYOFFMASTER_PROJECT_ID == defPayoffMaster.PAYOFFMASTER_PROJECT_ID && x.ID != payoffMasterId).OrderBy(x => x.ID).ToList(); foreach (var item in payoffList) { PayoffDeductionVM vm = new PayoffDeductionVM(); int index = payoffList.FindIndex(a => a.ID == item.ID); index = index + 1; var payoffMaster = dbContext.PayoffMaster.Find(item.ID); double toplam = Math.Round(dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId).Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP), 2); double tenzilat = Math.Round(toplam * payoffMaster.Project.Contract.MasterContract.CONTRACT_PRICECUTRATE / 100, 2); double tenzilatToplam = Math.Round(toplam - tenzilat, 2); var oldToplamData = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PayoffMaster.PAYOFFMASTER_PROJECT_ID == payoffMaster.PAYOFFMASTER_PROJECT_ID && x.PAYOFFCONTROL_PAYOFFMASTER_ID != payoffMasterId && x.PAYOFFCONTROL_PAYOFFMASTER_ID < payoffMasterId).ToList(); double oldToplam = oldToplamData == null ? 0 : Math.Round(oldToplamData.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP), 2); double odenecekTutar = Math.Round(tenzilatToplam - oldToplam, 2); double geciciKabulKesinti = Math.Round(tenzilatToplam * 0.025, 2); double kesinKabulKesinti = Math.Round(tenzilatToplam * 0.025, 2); totalTemp += geciciKabulKesinti; totalNet += kesinKabulKesinti; vm.Description = index + " Nolu Hakediş"; vm.TempDeduc = geciciKabulKesinti.ToString() + " TL"; vm.NetDeduc = kesinKabulKesinti.ToString() + " TL"; temp.Add(vm); } TotalDeduc(); objectDataSource1.DataSource = temp; } }
public PayoffExtractReport(int payoffMasterId) { InitializeComponent(); using (var dbContext = new WiodySMContext()) { PayoffIcmalVM vm = new PayoffIcmalVM(); vm.Tarih = DateTime.Now.ToShortDateString(); var payoffMaster = dbContext.PayoffMaster.Find(payoffMasterId); vm.Yıl = DateTime.Now.Year.ToString(); vm.GrupNo = payoffMaster.Project.PROJECT_GROUP; vm.PypNo = payoffMaster.Project.PROJECT_PYP_NO; vm.IsAdi = payoffMaster.Project.PROJECT_NAME; var mlz = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId && x.PAYOFFCONTROL_LB == "MLZ").ToList(); vm.Malzeme = mlz == null ? "0 TL" : mlz.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP).ToString() + " TL"; var mon = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId && x.PAYOFFCONTROL_LB == "MON").ToList(); vm.Montaj = mon == null ? "0 TL" : mon.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP).ToString() + " TL"; var deMon = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId && x.PAYOFFCONTROL_LB == "DM").ToList(); vm.DeMontaj = deMon == null ? "0 TL" : deMon.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP).ToString() + " TL"; var dmm = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId && x.PAYOFFCONTROL_LB == "DMM").ToList(); vm.DMM = dmm == null ? "0 TL" : dmm.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP).ToString() + " TL"; var ins = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId && x.PAYOFFCONTROL_LB == "İNS").ToList(); vm.Insaat = ins == null ? "0 TL" : ins.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP).ToString() + " TL"; vm.Total = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId).Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP).ToString() + " TL"; objectDataSource1.DataSource = vm; } }
public static List <StockDetailVM> GetItemStocksDetailAll() { using (var dbContext = new WiodySMContext()) { try { var result = dbContext.StockDetail.GroupBy(x => new StockDetailVMT { STOCKDETAIL_BARCODE_ID = x.STOCKDETAIL_BARCODE_ID, STOCKDETAIL_ITEM_NAME = x.Item.ITEM_NAME, STOCKDETAIL_ITEM_UNIT = x.Item.ParameterDetail_Item_Unit.PARAMETERDETAIL_NAME, STOCKDETAIL_STORE_NAME = x.ParameterDetail_StockDetail_Store.PARAMETERDETAIL_NAME, STOCKDETAIL_ITEM_CODE = x.Item.ITEM_CODE }).Select(g => new StockDetailVM { STOCKDETAIL_BARCODE_ID = g.Key.STOCKDETAIL_BARCODE_ID, STOCKDETAIL_ITEM_NAME = g.Key.STOCKDETAIL_ITEM_NAME, STOCKDETAIL_ITEM_UNIT = g.Key.STOCKDETAIL_ITEM_UNIT, STOCKDETAIL_ITEM_CODE = g.Key.STOCKDETAIL_ITEM_CODE, STOCKDETAIL_STORE_NAME = g.Key.STOCKDETAIL_STORE_NAME, STOCKDETAIL_QUANTITY = g.Sum(x => x.STOCKDETAIL_QUANTITY), }).ToList(); return(result); } catch (Exception ex) { throw; } } }
void TotalDeduc() { using (var dbContext = new WiodySMContext()) { PayoffDeductionVM vm = new PayoffDeductionVM(); vm.Description = "BU HAKEDİŞTE KESİLMESİ GEREKEN"; vm.TempDeduc = (currentTemp - totalTemp).ToString() + " TL"; vm.NetDeduc = (currentNet - totalNet).ToString() + " TL"; temp.Add(vm); } }
public static StockActionVM GetBarcodeDetail(string barcode, int storeId) { using (var dbContext = new WiodySMContext()) { return(dbContext.StockDetail.Where(x => x.STOCKDETAIL_BARCODE_ID == barcode && x.STOCKDETAIL_STORE_ID == storeId) .GroupBy(x => new { x.STOCKDETAIL_BARCODE_ID, x.STOCKDETAIL_ITEM_ID, x.Item.ITEM_NAME, x.STOCKDETAIL_STORE_ID, x.ParameterDetail_StockDetail_Store.PARAMETERDETAIL_NAME, x.STOCKDETAIL_RACK_ID }) .Select(g => new StockActionVM { Quantity = g.Sum(x => x.STOCKDETAIL_QUANTITY), Barcode = g.Key.STOCKDETAIL_BARCODE_ID, ItemName = g.Key.ITEM_NAME, ItemId = g.Key.STOCKDETAIL_ITEM_ID, RackId = g.Key.STOCKDETAIL_RACK_ID }).FirstOrDefault()); } }
public PayoffReportTotalEnd(int payoffMasterId) { InitializeComponent(); using (var dbContext = new WiodySMContext()) { PayoffReportVM vm = new PayoffReportVM(); var payoffMaster = dbContext.PayoffMaster.Find(payoffMasterId); var payoffList = dbContext.PayoffMaster.Where(x => x.PAYOFFMASTER_PROJECT_ID == payoffMaster.PAYOFFMASTER_PROJECT_ID).OrderBy(x => x.ID).ToList(); int index = payoffList.FindIndex(a => a.ID == payoffMasterId); index = index + 1; vm.HakNo = index + " Nolu Hakediş"; vm.Proje = payoffMaster.Project.PROJECT_NAME; vm.Firma = payoffMaster.Project.Company.COMPANY_COMPANY_NAME; vm.Tarih = payoffMaster.CREATED_DATE + " TARİHİNE KADAR YAPILAN İŞİN / HİZMETİN"; double toplam = Math.Round(dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId).Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP), 2); vm.Toplam = toplam.ToString() + " TL"; vm.TenzilatOran = payoffMaster.Project.Contract.MasterContract.CONTRACT_PRICECUTRATE / 100; vm.TenzilatOranText = payoffMaster.Project.Contract.MasterContract.CONTRACT_PRICECUTRATE.ToString() + "%"; double tenzilat = Math.Round(toplam * vm.TenzilatOran, 2); vm.Tenzilat = tenzilat.ToString() + " TL"; double tenzilatToplam = Math.Round(toplam - tenzilat, 2); vm.TenzilatToplam = tenzilatToplam.ToString() + " TL"; var oldToplamData = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PayoffMaster.PAYOFFMASTER_PROJECT_ID == payoffMaster.PAYOFFMASTER_PROJECT_ID && x.PAYOFFCONTROL_PAYOFFMASTER_ID != payoffMasterId && x.PAYOFFCONTROL_PAYOFFMASTER_ID < payoffMasterId).ToList(); double oldToplam = oldToplamData == null ? 0 : Math.Round(oldToplamData.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP), 2); vm.EskiTenzilatToplam = oldToplam.ToString() + " TL"; double odenecekTutar = Math.Round(tenzilatToplam - oldToplam, 2); vm.OdenecekTutar = odenecekTutar.ToString() + " TL"; double geciciKabulKesinti = Math.Round(tenzilatToplam * 0.025, 2); double kesinKabulKesinti = Math.Round(tenzilatToplam * 0.025, 2); vm.GeciciKabulKesintisi = (geciciKabulKesinti * -1).ToString() + " TL"; vm.KesinKabulKesintisi = (kesinKabulKesinti * -1).ToString() + " TL"; double kesintiler = Math.Round(payoffMaster.PAYOFFMASTER_PARAMETERCODE, 2); vm.Kesintiler = payoffMaster.PAYOFFMASTER_PARAMETERCODE.ToString() + " TL"; double hakedisToplam = Math.Round(odenecekTutar - (geciciKabulKesinti + kesinKabulKesinti + kesintiler), 2); vm.KesinOdenecekToplam = hakedisToplam.ToString() + " TL"; double kdv = Math.Round(hakedisToplam * 0.18, 2); vm.KDV = kdv.ToString() + " TL"; double tahakkukToplam = Math.Round(hakedisToplam + kdv, 2); vm.TahakkukToplam = tahakkukToplam.ToString() + " TL"; objectDataSource1.DataSource = vm; } }
public static List <StockDetailVM> GetStoreStocks(int storeId) { using (var dbContext = new WiodySMContext()) { try { var result = dbContext.StockDetail.Where(x => x.STOCKDETAIL_STORE_ID == storeId).GroupBy(x => new { x.STOCKDETAIL_BARCODE_ID, x.Item.ITEM_NAME, x.Item.ITEM_CODE }).Select(g => new StockDetailVM { STOCKDETAIL_BARCODE_ID = g.Key.STOCKDETAIL_BARCODE_ID, STOCKDETAIL_ITEM_NAME = g.Key.ITEM_NAME, STOCKDETAIL_ITEM_CODE = g.Key.ITEM_CODE, STOCKDETAIL_QUANTITY = g.Sum(x => x.STOCKDETAIL_QUANTITY), }).ToList(); return(result); } catch (Exception ex) { throw; } } }
void SelfDeduc(double rate, int payoffMasterId, string companyName, int projectId) { using (var dbContext = new WiodySMContext()) { PayoffDeductionVM vm = new PayoffDeductionVM(); double toplam = Math.Round(dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId).Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP), 2); double tenzilat = Math.Round(toplam * rate / 100, 2); double tenzilatToplam = Math.Round(toplam - tenzilat, 2); var oldToplamData = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PayoffMaster.PAYOFFMASTER_PROJECT_ID == projectId && x.PAYOFFCONTROL_PAYOFFMASTER_ID != payoffMasterId && x.PAYOFFCONTROL_PAYOFFMASTER_ID < payoffMasterId).ToList(); double oldToplam = oldToplamData == null ? 0 : Math.Round(oldToplamData.Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP), 2); double odenecekTutar = Math.Round(tenzilatToplam - oldToplam, 2); double geciciKabulKesinti = Math.Round(tenzilatToplam * 0.025, 2); double kesinKabulKesinti = Math.Round(tenzilatToplam * 0.025, 2); currentNet = kesinKabulKesinti; currentTemp = geciciKabulKesinti; vm.FirmaAdi = companyName; vm.Description = "BU HAKEDİŞ KESİLMESİ GEREKEN"; vm.TempDeduc = geciciKabulKesinti.ToString() + " TL"; vm.NetDeduc = kesinKabulKesinti.ToString() + " TL"; temp.Add(vm); } }
public static List <StockDetailVM> GetStoreStocksDetail(int storeId) { using (var dbContext = new WiodySMContext()) { try { var result = dbContext.StockDetail.Where(x => x.STOCKDETAIL_STORE_ID == storeId).GroupBy(x => new { x.STOCKDETAIL_BARCODE_ID, x.Item.ITEM_NAME, x.Item.ParameterDetail_Item_Unit.PARAMETERDETAIL_NAME, x.STOCKDETAIL_STORE_ID, x.Item.ITEM_CODE }).Select(g => new StockDetailVM { STOCKDETAIL_BARCODE_ID = g.Key.STOCKDETAIL_BARCODE_ID, STOCKDETAIL_ITEM_NAME = g.Key.ITEM_NAME, STOCKDETAIL_ITEM_CODE = g.Key.ITEM_CODE, STOCKDETAIL_ITEM_UNIT = g.Key.PARAMETERDETAIL_NAME, STOCKDETAIL_QUANTITY = g.Sum(x => x.STOCKDETAIL_QUANTITY), CREATED_DATE = dbContext.StockDetail.FirstOrDefault(x => x.STOCKDETAIL_STORE_ID == storeId && x.STOCKDETAIL_BARCODE_ID == g.Key.STOCKDETAIL_BARCODE_ID) == null ? DateTime.Now : dbContext.StockDetail.FirstOrDefault(x => x.STOCKDETAIL_STORE_ID == storeId && x.STOCKDETAIL_BARCODE_ID == g.Key.STOCKDETAIL_BARCODE_ID).CREATED_DATE, }).ToList(); return(result); } catch (Exception ex) { throw; } } }
public static StockDetailVM GetBarcodeStocksWithStore(string barcodeId, int storeId) { using (var dbContext = new WiodySMContext()) { try { var result = dbContext.StockDetail.Where(x => x.STOCKDETAIL_BARCODE_ID == barcodeId && x.STOCKDETAIL_STORE_ID == storeId).GroupBy(x => new { x.STOCKDETAIL_BARCODE_ID, x.Item.ITEM_NAME, x.STOCKDETAIL_STORE_ID, x.STOCKDETAIL_ITEM_ID, x.STOCKDETAIL_RACK_ID }).Select(g => new StockDetailVM { STOCKDETAIL_BARCODE_ID = g.Key.STOCKDETAIL_BARCODE_ID, STOCKDETAIL_ITEM_NAME = g.Key.ITEM_NAME, STOCKDETAIL_STORE_ID = g.Key.STOCKDETAIL_STORE_ID, STOCKDETAIL_RACK_ID = g.Key.STOCKDETAIL_RACK_ID, STOCKDETAIL_ITEM_ID = g.Key.STOCKDETAIL_ITEM_ID, STOCKDETAIL_QUANTITY = g.Sum(x => x.STOCKDETAIL_QUANTITY), }).Where(x => x.STOCKDETAIL_QUANTITY > 0).FirstOrDefault(); return(result); } catch (Exception ex) { throw; } } }
public PayoffCover(int payoffMasterId) { InitializeComponent(); using (var dbContext = new WiodySMContext()) { PayoffIcmalVM vm = new PayoffIcmalVM(); vm.Tarih = DateTime.Now.ToShortDateString(); var payoffMaster = dbContext.PayoffMaster.Find(payoffMasterId); var payoffList = dbContext.PayoffMaster.Where(x => x.PAYOFFMASTER_PROJECT_ID == payoffMaster.PAYOFFMASTER_PROJECT_ID).OrderBy(x => x.ID).ToList(); int index = payoffList.FindIndex(a => a.ID == payoffMasterId); index = index + 1; vm.HakNo = index + " Nolu Hakediş"; vm.Yıl = DateTime.Now.Year.ToString(); vm.GrupNo = payoffMaster.Project.PROJECT_GROUP; vm.PypNo = payoffMaster.Project.PROJECT_PYP_NO; vm.IsAdi = payoffMaster.Project.PROJECT_NAME; vm.FirmaAdi = payoffMaster.Project.Company.COMPANY_COMPANY_NAME; vm.Tenzilat = payoffMaster.Project.Contract.MasterContract.CONTRACT_PRICECUTRATE.ToString() + "%"; //vm.Toplam = dbContext.PayoffControl.Where(x => x.PAYOFFCONTROL_TYPE_ID == 1 && x.PAYOFFCONTROL_PAYOFFMASTER_ID == payoffMasterId).Sum(x => x.PAYOFFCONTROL_TOTALTENSIZUP); objectDataSource1.DataSource = vm; } }
public BaseForm() { dbContext = new WiodySMContext(); }
private async void frmLogin_Shown(object sender, EventArgs e) { int versionNew = 102; string connectionString = "Data Source = 185.248.57.239; User ID = wiody; Password = xrwatxN3MM4uEZyV; Initial Catalog = WiodyUpdate; MultipleActiveResultSets = True"; string query = "SELECT TOP 1 * FROM[WiodySMVersion] ORDER BY ID DESC"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(query, connection); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); List <string> list = new List <string>(); while (reader.Read()) { if (Convert.ToInt32(reader["VERSION"]) != versionNew && Convert.ToBoolean(reader["REQUIRE"]) == false) { var messageBox = XtraMessageBox.Show("ŞU AN KULLANDIĞINIZ SÜRÜM ESKİDİR. YENİSİNE GEÇMEK İÇİN EVET'E TIKLAYINIZ !", "YENİ SÜRÜM GELMİŞTİR.", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (messageBox == DialogResult.Yes) { ProcessStartInfo proc = new ProcessStartInfo { WorkingDirectory = Application.StartupPath, FileName = "WiodySMUpdater.exe", Verb = "runas" }; Process.Start(proc); Application.Exit(); break; } else if (messageBox == DialogResult.No) { break; } } else if (Convert.ToBoolean(reader["REQUIRE"]) == true && Convert.ToInt32(reader["VERSION"]) != versionNew) { var messageBox = XtraMessageBox.Show("ŞU AN KULLANDIĞINIZ SÜRÜM ESKİDİR. YENİSİNE GEÇMEK İÇİN EVET'E TIKLAYINIZ. AKSİ HALDE PROGRAM KAPANACAKTIR !!", "ZORUNLU SÜRÜM GÜNCELLEMESİ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (messageBox == DialogResult.Yes) { ProcessStartInfo proc = new ProcessStartInfo { WorkingDirectory = Application.StartupPath, FileName = "WiodySMUpdater.exe", Verb = "runas" }; Process.Start(proc); Application.Exit(); break; } else if (messageBox == DialogResult.No) { Application.Exit(); break; } } else if (Convert.ToInt32(reader["VERSION"]) == versionNew) { break; } } reader.Close(); connection.Close(); } catch (Exception) { XtraMessageBox.Show("Veri Tabanı Bağlantısı Başarısız. Lütfen sistem yöneticiniz ile iletişime geçin veya daha sonra tekrar deneyin", "Hata"); Application.Exit(); } } string buffer = ""; for (int i = 0; i < versionNew.ToString().Length; i++) { buffer += versionNew.ToString()[i] + "."; } lblnumberversion.Text = buffer.Remove(5, 1); using (var db = new WiodySMContext()) { System.Data.Common.DbConnection conn = db.Database.Connection; try { await conn.OpenAsync(); conn.Close(); btnLogin.Enabled = true; this.marqueeProgressBarControl1.Properties.Stopped = true; lblLoading.Text = "Bağlantı Başarılı."; } catch { this.marqueeProgressBarControl1.Properties.Stopped = true; lblLoading.Text = "Bağlantı Hatası."; XtraMessageBox.Show("Veri Tabanı Bağlantısı Başarısız. Lütfen sistem yöneticiniz ile iletişime geçin veya daha sonra tekrar deneyin", "Hata"); Application.Exit(); } } }