private void LoadAdvanceDetails() { stock = new StockController(); if (SupplierNo == 0 || DebitAcc.Trim().Length == 0 || Advance == 0) { MessageBox.Show(" No supplier selected for the display", "No Suppliet", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } UnitCost = new DataTable(); UnitCost = stock.GetAdvanceDetail(SupplierNo, DebitAcc); ShowSupplierHead(); ShowTimePeriod(); dgvAdvDetail.DataSource = UnitCost; }
private void ShowTimePeriod() { string strtime = DebitAcc.Substring((DebitAcc.IndexOf('_')), (DebitAcc.Length - DebitAcc.IndexOf('_'))); string stryear = strtime.Substring(strtime.IndexOf(' ') + 1); string strmonth = strtime.Substring(1, strtime.IndexOf(' ')); DateTime fromDate;//= new DateTime(int.Parse(stryear),1,1); int month = 0, year = int.Parse(stryear); switch (strmonth.Trim()) { case "JANUARY": month = 1; break; case "FEBRUARY": month = 2; break; case "MARCH": month = 3; break; case "APRIL": month = 4; break; case "MAY": month = 5; break; case "JUNE": month = 6; break; case "JULY": month = 7; break; case "AUGUST": month = 8; break; case "SEPTEMBER": month = 9; break; case "OCTOBER": month = 10; break; case "NOVEMBER": month = 11; break; case "DECEMBER": month = 12; break; } fromDate = new DateTime(int.Parse(stryear), month, 1); dtFrom.Value = fromDate; dtTo.Value = fromDate.AddMonths(1).AddDays(-1); //throw new NotImplementedException(); }