예제 #1
0
 private List <stp_GetIncomeSummaryResult> GetDataSource(DateTime?fromDate, DateTime?tillDate, int companyId, int driverId, int FleetMasterId)
 {
     using (TaxiDataContext db = new TaxiDataContext())
     {
         return(db.stp_GetIncomeSummary(fromDate, tillDate, companyId, driverId, FleetMasterId).ToList());
     }
 }
예제 #2
0
        private void ViewReport()
        {
            try
            {
                DateTime?fromDate = (dtpFromDate.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime();
                DateTime?tillDate = (dtpTillDate.Value.ToDate() + dtptilltime.Value.Value.TimeOfDay).ToDateTime();

                string error = string.Empty;


                if (fromDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : From Date";
                }

                if (tillDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : To Date";
                }

                if (!string.IsNullOrEmpty(error))
                {
                    ENUtils.ShowMessage(error);
                    return;
                }


                int companyId     = ddlCompany.SelectedValue.ToInt();
                int driverId      = ddlDriver.SelectedValue.ToInt();
                int FleetMasterId = ddlCompanyVehicle.SelectedValue.ToInt();


                using (TaxiDataContext db = new TaxiDataContext())
                {
                    grdLister.DataSource = db.stp_GetIncomeSummary(fromDate.Value, tillDate.Value, companyId, driverId, FleetMasterId).ToList();;
                }


                (grdLister.Columns["InvoiceDate"] as GridViewDateTimeColumn).CustomFormat = "dd/MM/yyyy";
                (grdLister.Columns["InvoiceDate"] as GridViewDateTimeColumn).FormatString = "{0:dd/MM/yyyy}";

                grdLister.Font = new Font("Tahoma", 9, FontStyle.Bold);
                grdLister.Columns["Id"].IsVisible           = false;
                grdLister.Columns["InvId"].IsVisible        = false;
                grdLister.Columns["InvoiceDate"].HeaderText = "Date";
                grdLister.Columns["InvoiceDate"].Width      = 180;
                grdLister.Columns["Description"].Width      = 220;
                grdLister.Columns["Income"].Width           = 120;
                grdLister.Columns["Expense"].Width          = 120;


                grdLister.AllowEditRow = false;
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }