private void btnSendEmail_Click(object sender, EventArgs e) { int driverId = ddl_Driver.SelectedValue.ToInt(); int userId = ddlController.SelectedValue.ToInt(); string userName = ddlController.Text.Trim(); DateTime?fromDate = dtpFromDate.Value.ToDate(); DateTime?tillDate = dtpTillDate.Value.ToDate(); 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 reportType = eReportType.ALL; if (optReject.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { reportType = eReportType.REJECTED; } else if (optNotAcceped.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { reportType = eReportType.NOTACCEPTED; } else if (optRecover.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { reportType = eReportType.RECOVER; } rptfrmSinBinReport frm = new rptfrmSinBinReport(); frm.DataSource = GetDataSource(driverId, reportType, fromDate, tillDate, userName); frm.Criteria = "For the Period : " + Environment.NewLine + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate); frm.GenerateReport(); frm.SendEmail(); }
public void GenerateReport() { try { reportViewer1.LocalReport.EnableExternalImages = true; //UM_Form_Template objTemplate = General.GetObject<UM_Form_Template>(c => c.UM_Form.FormName == this.Name && c.IsDefault == true); //if (objTemplate == null) //{ // ENUtils.ShowMessage("Report Template is not defined in Settings"); // return; //} //string className = "Taxi_AppMain.ReportDesigns." + objTemplate.TemplateName.ToStr() + "_"; //if (objTemplate.TemplateName.ToStr() == "Template1") //{ // this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns." + "rptDriverCommisionExpenses.rdlc"; //} //else if (objTemplate.TemplateName.ToStr() == "Template2" || objTemplate.TemplateName.ToStr() == "Template3") //{ // this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverCommisionExpenses.rdlc"; // //rptDriverCommisionExpenses //} Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[31]; string address = AppVars.objSubCompany.Address; string telNo = string.Empty; string sortCode = AppVars.objSubCompany.SortCode.ToStr(); string accountNo = AppVars.objSubCompany.AccountNo.ToStr(); string accountTitle = AppVars.objSubCompany.AccountTitle.ToStr(); string bank = AppVars.objSubCompany.BankName.ToStr(); string hasBankDetails = "1"; if (string.IsNullOrEmpty(sortCode) && string.IsNullOrEmpty(accountNo) && string.IsNullOrEmpty(accountTitle) && string.IsNullOrEmpty(bank)) { hasBankDetails = "0"; } if (!string.IsNullOrEmpty(sortCode)) { sortCode = "Sort Code : " + sortCode; } if (!string.IsNullOrEmpty(accountTitle)) { accountTitle = "Account Title : " + accountTitle; } string website = AppVars.objSubCompany.WebsiteUrl.ToStr(); if (!string.IsNullOrEmpty(website)) { website += " , "; } website += "Email:" + AppVars.objSubCompany.EmailAddress.ToStr(); string companyNumber = AppVars.objSubCompany.CompanyNumber.ToStr(); if (!string.IsNullOrEmpty(companyNumber)) { companyNumber = "Company Number: " + companyNumber; } string vatNumber = AppVars.objSubCompany.CompanyVatNumber.ToStr(); if (!string.IsNullOrEmpty(vatNumber)) { vatNumber = "VAT Number: " + vatNumber; } param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address); param[18] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Footer", AppVars.objSubCompany.WebsiteUrl.ToStr()); param[14] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_MobileNo", "Mobile: " + AppVars.objSubCompany.EmergencyNo.ToStr()); param[15] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Website", website); param[16] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Email", "Email: " + AppVars.objSubCompany.EmailAddress.ToStr()); param[20] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyNumber", companyNumber); param[21] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VATNumber", vatNumber); param[7] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_SortCode", sortCode); param[9] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountTitle", accountTitle); param[10] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Bank", bank); List <ClsLogo> objLogo = new List <ClsLogo>(); objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); string path = @"File:"; param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Path", path); param[6] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeader", AppVars.objSubCompany.CompanyName.ToStr()); int?driverId = this.DataSource.FirstOrDefault().DefaultIfEmpty().DriverId; var data = this.DataSource.FirstOrDefault().DefaultIfEmpty(); telNo = "Telephone: " + AppVars.objSubCompany.TelephoneNo + ", Fax: " + AppVars.objSubCompany.Fax + ", E-mail: " + AppVars.objSubCompany.EmailAddress + ", Website:" + AppVars.objSubCompany.WebsiteUrl; if (!string.IsNullOrEmpty(accountNo)) { accountNo = "Account No : " + accountNo; } // string className = "Taxi_AppMain.ReportDesigns."; //if (IsCheck == 1) //{ // if (IsFareAndWaitingWise) // { // this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverCommisionTrasaction3.rdlc"; // } // else // { // this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverCommisionTrasaction4.rdlc"; // } //} //else //{ // this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverCommisionTrasaction2.rdlc"; //} param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo); param[8] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountNo", accountNo); string vat = "0"; decimal discountAmount = 0.00m; decimal valueAddedTax = 0.0m; string discount = string.Format("{0:c}", discountAmount); discount = discount.Substring(1); string grandTotal = ""; param[17] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Discount", discount); param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_InvoiceTotal", grandTotal); param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasVat", vat); param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VAT", valueAddedTax.ToStr()); param[11] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasDepartment", "0"); param[12] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Net", "0"); param[13] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasCostCenter", "0"); param[19] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasBankDetails", hasBankDetails); string AccountBooking = string.Empty; string CashBooking = string.Empty; Fleet_Driver obj = General.GetObject <Fleet_Driver>(c => c.Id == driverId); decimal DriverCommision = obj.DriverCommissionPerBooking.ToDecimal(); decimal JobTotal = 0; if (this.IsFareAndWaitingWise) { AccountBooking = string.Format("{0:£ #.##}", this.DataSource.Where(c => c.CompanyId != null && c.BookingTypeId.ToInt() == Enums.ACCOUNT_TYPE.ACCOUNT).Sum(c => c.FareRate.ToDecimal() + c.WaitingCharges.ToDecimal())); CashBooking = string.Format("{0:£ #.##}", this.DataSource.Where(c => c.CompanyId == null || c.BookingTypeId.ToInt() == Enums.ACCOUNT_TYPE.CASH).Sum(c => c.FareRate.ToDecimal() + c.WaitingCharges.ToDecimal())); JobTotal = this.DataSource.Sum(c => c.FareRate.Value.ToDecimal() + c.WaitingCharges.ToDecimal()); } else { AccountBooking = string.Format("{0:£ #.##}", this.DataSource.Where(c => c.CompanyId != null && c.BookingTypeId.ToInt() == Enums.ACCOUNT_TYPE.ACCOUNT).Sum(c => c.FareRate.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal())); CashBooking = string.Format("{0:£ #.##}", this.DataSource.Where(c => c.CompanyId == null || c.BookingTypeId.ToInt() == Enums.ACCOUNT_TYPE.CASH).Sum(c => c.FareRate.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal())); JobTotal = this.DataSource.Sum(c => c.FareRate.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal()); } param[22] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountJobTotal", AccountBooking); param[23] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CashJobTotal", CashBooking); string BalanceType = string.Empty; int DriverId = this.DataSource.FirstOrDefault().DriverId.ToInt(); int Id = this.DataSource.FirstOrDefault().Id.ToInt();; var query = General.GetObject <Fleet_DriverCommision>(c => c.DriverId == DriverId && c.Id < Id); string StatementDate = string.Empty; if (query == null) { BalanceType = "Initial Balance"; StatementDate = string.Format("{0:dd/MM}", this.DataSource.FirstOrDefault().TransDate); } else { BalanceType = "Balance from statement " + query.TransNo; StatementDate = string.Format("{0:dd/MM}", query.TransDate); } string Commision = (JobTotal * DriverCommision / 100).ToStr(); decimal AccountTotal = (this.DataSource.Sum(c => c.AccountJobsTotal)).ToDecimal(); // decimal AccountCommision=(25*AccountTotal/100); decimal CashTotal = (this.DataSource.Sum(c => c.CashJobsTotal)).ToDecimal(); // decimal CashCommision=(25*CashTotal/100); // decimal TotalDebit = this.DataSource2.Sum(c => c.Debit).ToDecimal(); // decimal TotalCredit = this.DataSource2.Sum(c=>c.Credit).ToDecimal(); // decimal commissionTotal = this.data // var objRecord= General.GetObject<Fleet_DriverCommision>(c => c.Id == Id); //if (objRecord != null) //{ // commissionTotal = objRecord.CommissionTotal.ToDecimal() + objRecord.AgentFeesTotal.ToDecimal(); //} if (AppVars.objPolicyConfiguration.PriceRangeWiseCommission.ToBool()) { List <Fleet_Driver_CommissionRange> listofRange = obj.Fleet_Driver_CommissionRanges.ToList(); if (listofRange.Count == 0) { listofRange = GetSystemCommissionRange(); } Commision = Math.Round(this.DataSource .Sum(c => c.IsCommissionWise.ToBool() ? (c.DriverCommissionType == "Percent" ? ((c.TotalCharges * c.DriverCommissionOnBooking) / 100) : c.DriverCommissionOnBooking) : (((c.FareRate * listofRange.FirstOrDefault(a => c.TotalCharges >= a.FromPrice && c.FareRate <= a.ToPrice).DefaultIfEmpty().CommissionValue.ToDecimal()) / 100))).ToDecimal(), 2).ToStr(); } param[24] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Commision", Commision); string DriverGrandTotal = ""; if (this.DataSource != null) { DriverGrandTotal = (this.DataSource[0].DriverCommision + this.DataSource[0].Extra + this.DataSource[0].fuel + this.DataSource[0].OldBalance).ToStr(); } param[25] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_GrandTotal", DriverGrandTotal); int cnt = this.DataSource.Count; decimal AccountExpenses = 0.00m; // decimal DropOfCharges=this.DataSource.Sum(c=>c.ExtraDropOfCharges).ToDecimal(); // decimal PickUpCharges=this.DataSource.Sum(c=>c.ExtraPickUpCharges).ToDecimal(); // AccountExpenses=(DropOfCharges+PickUpCharges); param[26] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_jobCount", cnt.ToStr()); param[27] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_BalanceType", BalanceType); param[28] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountExpenses", AccountExpenses.ToStr()); param[29] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_StatementDate", StatementDate); //Report_Parameter_StatementDate string balance = string.Empty; decimal bal = this.DataSource.FirstOrDefault().DefaultIfEmpty().Balance.ToDecimal(); if (bal >= 0) { balance = "You are due to receive £" + string.Format("{0:f2}", bal); } else { balance = "You are due to Pay £" + string.Format("{0:f2}", bal); balance = balance.Replace("-", "").Trim(); } param[30] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Balance", balance); // string strCommissionTotal = string.Format("{0:f2}", commissionTotal); // param[31] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CommissionTotal", strCommissionTotal); //int minRows = 12; //if (cnt < minRows) //{ // for (int i = 0; i < minRows - cnt; i++) // { // this.DataSource.Add(new vu_DriverCommisionExpenses2 { Id = data.Id, BookingId = data.BookingId, });//, Passenger = data.Passenger, FromAddress = data.FromAddress, ToAddress = data.ToAddress }); // } //} reportViewer1.LocalReport.SetParameters(param); this.vu_DriverCommisionExpenses2BindingSource.DataSource = this.DataSource; this.vu_FleetDriverCommissionExpenseBindingSource.DataSource = this.DataSource2; this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void DisplayRecord() { try { int DriverId = 0; CommissionId = 0; lblTitle.Visible = false; lblTransactionNo.Visible = false; //txtRentPaid.Visible = false; //txtRentPaidSign.Visible = false; //txtIsPaid.Visible = false; rdoCredit.IsChecked = true; spnCommissionPay.Value = 0; txtReason.Text = ""; // ddlCommissionPayReason.SelectedIndex = 0; DriverId = ddlDrivers.SelectedValue.ToInt(); var item = (from a in General.GetQueryable <Fleet_DriverCommision>(c => c.DriverId == DriverId) orderby a.Id descending select new { Id = a.Id, BalanceDue = a.Balance, DriverCommission = a.DriverOwed, TransactionNo = a.TransNo, PeriodFrom = a.FromDate, PeriodTo = a.ToDate, CommisionPaid = a.CommisionPay, PayHistory = a.DriverCommission_PaymentHistories //a.DriverRent_PaymentHistories }).FirstOrDefault(); if (item != null) { lblerror.Visible = false; lblTitle.Visible = true; lblTransactionNo.Visible = true; objDriverCommision.GetByPrimaryKey(item.Id); //lblRentDue.Text = item.BalanceDue.ToStr(); //numCurrBalance.Value = item.BalanceDue.ToDecimal(); //lblCommissionDue.Text = item.DriverCommission.ToStr(); lblCommissionDue.Text = item.BalanceDue.ToStr(); lblerror.Text = item.DriverCommission.ToStr(); //numCurrBalance.Value = item.DriverCommission.ToDecimal(); numCurrBalance.Value = item.BalanceDue.ToDecimal(); CommissionId = item.Id; lblTitle.Text = "Statement No:"; lblTransactionNo.Text = item.TransactionNo; if (item.PeriodFrom != null) { lblTransactionNo.Text += " , Period : " + string.Format("{0:dd/MM/yyyy}", item.PeriodFrom); } if (item.PeriodTo != null) { lblTransactionNo.Text += " to : " + string.Format("{0:dd/MM/yyyy}", item.PeriodTo); } //if (item.CommisionPaid.ToDecimal() > 0) //{ // //txtRentPaid.Visible = true; // //txtRentPaidSign.Visible = true; // //txtIsPaid.Visible = true; // //txtRentPaid.Text = item.CommisionPaid.ToStr(); //} btnSave.Enabled = true; ShowPaymentHistory(item.PayHistory.ToList()); var list = (from a in General.GetQueryable <Fleet_DriverCommissionExpense>(c => c.CommissionId == CommissionId && (c.IsPaid == true)) //where a.IsPaid == true select new { Id = a.Id, CommissionId = a.CommissionId, Credit = a.Credit, Debit = a.Debit, Date = a.Date, Type = a.Credit > 0.00m ? "Credit" : "Debit", Amount = a.Amount, Description = a.Description, Balance = a.Fleet_DriverCommision.Balance }).ToList(); grdPaymentHistory.Rows.Clear(); grdPaymentHistory.RowCount = list.Count; for (int i = 0; i < list.Count; i++) { grdPaymentHistory.Rows[i].Cells[COLS.Id].Value = list[i].Id; grdPaymentHistory.Rows[i].Cells[COLS.Credit].Value = list[i].Credit; grdPaymentHistory.Rows[i].Cells[COLS.Debit].Value = list[i].Debit; grdPaymentHistory.Rows[i].Cells[COLS.Type].Value = list[i].Type; grdPaymentHistory.Rows[i].Cells[COLS.Date].Value = list[i].Date; grdPaymentHistory.Rows[i].Cells[COLS.Description].Value = list[i].Description; grdPaymentHistory.Rows[i].Cells[COLS.Balance].Value = list[i].Balance; grdPaymentHistory.Rows[i].Cells[COLS.CommissionId].Value = list[i].CommissionId; grdPaymentHistory.Rows[i].Cells[COLS.Amount].Value = list[i].Amount; } } else { lblCommissionDue.Text = "0"; numCurrBalance.Value = 0.00m; spnCommissionPay.Value = 0; lblerror.Visible = true; lblerror.ForeColor = Color.Red; lblerror.Text = "Driver Commission is not generated"; btnSave.Enabled = false; grdPaymentHistory.Rows.Clear(); //txtRentPaid.Visible = false; //txtRentPaidSign.Visible = false; //txtIsPaid.Visible = false; //txtRentPaid.Text = string.Empty; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void bg_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.btnExport.Enabled = true; this.radProgressBar1.Value1 = 0; ENUtils.ShowMessage("Export successfully."); }
public void CopyCompanyFares(int CompanyId) { try { // int VehicleTypeId = cVehicleTypeId; if (SaveFares == false) { int FareId = 0; var Query = General.GetObject <Fare>(c => c.CompanyId == CompanyId); if (CompanyId == 0 && Vechileid > 0) { var Query2 = General.GetObject <Fare>(c => c.VehicleTypeId == Vechileid); if (Query2 != null) { FareId = Query2.Id; } } if (Query != null) { FareId = Query.Id; } var FareList = (from a in General.GetQueryable <Fare_ChargesDetail>(c => c.FareId == FareId) select new { Id = a.Id, FareId = a.FareId, OriginLocationTypeId = a.OriginLocationTypeId, DestinationLocationTypeId = a.DestinationLocationTypeId, OriginId = a.OriginId, DestinationId = a.DestinationId, FromAddress = a.FromAddress, ToAddress = a.ToAddress, Rate = a.Rate, NightTimeRate = HasOffPeakRate ? a.NightTimeRate : 0, }).ToList(); ChargesDetail.Clear(); foreach (var item in FareList) { decimal Rate = item.Rate.ToDecimal(); if (ApplyAdditionOrSubtractionOnFareRates) { decimal Amount = 0.00m; decimal PercentValue = numPercent.Value.ToDecimal(); if (rbtnAdd.IsChecked) { Amount = ((Rate * PercentValue) / 100); Rate = (Rate + Amount); } else { Amount = ((Rate * PercentValue) / 100); Rate = (Rate - Amount); } } ChargesDetail.Add(new Fare_ChargesDetail { Id = item.Id, FareId = item.FareId, OriginLocationTypeId = item.OriginLocationTypeId, DestinationLocationTypeId = item.DestinationLocationTypeId, OriginId = item.OriginId, DestinationId = item.DestinationId, FromAddress = item.FromAddress, ToAddress = item.ToAddress, Rate = Rate, NightTimeRate = item.NightTimeRate }); } var OtherChargesList = (from a in General.GetQueryable <Fare_OtherCharge>(c => c.FareId == FareId) select new { Id = a.Id, FareId = a.FareId, FromMile = a.FromMile, ToMile = a.ToMile, Rate = a.Rate, FromStartTime = HasOffPeakRate ? a.FromStartTime : null, TillStartTime = HasOffPeakRate ? a.TillStartTime : null, FromEndTime = HasOffPeakRate ? a.FromEndTime : null, TillEndTime = HasOffPeakRate ? a.TillEndTime : null, PeakTimeRate = HasOffPeakRate ? a.PeakTimeRate : 0, OffPeakTimeRate = HasOffPeakRate ? a.OffPeakTimeRate : 0, NightTimeRate = HasOffPeakRate ? a.NightTimeRate : 0, }).ToList(); OtherCharge.Clear(); foreach (var item in OtherChargesList) { OtherCharge.Add(new Fare_OtherCharge { Id = item.Id, FareId = item.FareId, FromMile = item.FromMile, ToMile = item.ToMile, Rate = item.Rate, FromStartTime = item.FromStartTime, TillStartTime = item.TillStartTime, FromEndTime = item.TillEndTime, TillEndTime = item.TillEndTime, PeakTimeRate = item.PeakTimeRate, OffPeakTimeRate = item.OffPeakTimeRate, NightTimeRate = item.NightTimeRate }); } var PDAMeterList = (from a in General.GetQueryable <Fare_PDAMeter>(c => c.FareId == FareId) select new { Id = a.Id, FareId = a.FareId, FromMile = a.FromMile, ToMile = a.ToMile, Rate = a.Rate, FromStartTime = HasOffPeakRate ? a.FromStartTime : null, TillStartTime = HasOffPeakRate ? a.TillStartTime : null, FromEndTime = HasOffPeakRate ? a.FromEndTime : null, TillEndTime = HasOffPeakRate ? a.TillEndTime : null, PeakTimeRate = HasOffPeakRate ? a.PeakTimeRate : 0, OffPeakTimeRate = HasOffPeakRate ? a.OffPeakTimeRate : 0, NightTimeRate = HasOffPeakRate ? a.NightTimeRate : 0, }).ToList(); PDAMeter.Clear(); foreach (var item in PDAMeterList) { PDAMeter.Add(new Fare_PDAMeter { Id = item.Id, FareId = item.FareId, FromMile = item.FromMile, ToMile = item.ToMile, Rate = item.Rate, FromStartTime = item.FromStartTime, TillStartTime = item.TillStartTime, FromEndTime = item.FromEndTime, TillEndTime = item.TillEndTime, PeakTimeRate = item.PeakTimeRate, OffPeakTimeRate = item.OffPeakTimeRate, NightTimeRate = item.NightTimeRate }); } var ZoneWisePricingList = (from a in General.GetQueryable <Fare_ZoneWisePricing>(c => c.FareId == FareId) select new { Id = a.Id, FareId = a.FareId, FromZoneId = a.FromZoneId, ToZoneId = a.ToZoneId, Price = a.Price, }).ToList(); ZoneWisePricing.Clear(); foreach (var item in ZoneWisePricingList) { ZoneWisePricing.Add(new Fare_ZoneWisePricing { Id = item.Id, FareId = item.FareId, FromZoneId = item.FromZoneId, ToZoneId = item.ToZoneId, Price = item.Price }); } var AirportAndStationList = (from a in General.GetQueryable <Gen_Company_AgentCommission>(c => c.FareId == FareId) select new { Id = a.Id, a.CompanyId, FareId = a.FareId, LocationId = a.LocationId, LocationTypeId = a.LocationTypeId, CommissionPercent = a.CommissionPercent, CommissionAmount = a.CommissionAmount, CommissionOnPercent = a.CommissionOnPercent, DayWise = a.DayWise, NightWise = a.NightWise, VehicleTypeId = a.VehicleTypeId, CompanyPrice = a.CompanyPrice, DriverPrice = a.DriverPrice, CustomerPrice = a.CustomerPrice }).ToList(); CompanyAirportandStation.Clear(); foreach (var item in AirportAndStationList) { CompanyAirportandStation.Add(new Gen_Company_AgentCommission { Id = item.Id, FareId = item.FareId, CompanyId = item.CompanyId, LocationId = item.LocationId, LocationTypeId = item.LocationTypeId, CommissionAmount = item.CommissionAmount, CommissionOnPercent = item.CommissionOnPercent, CommissionPercent = item.CommissionPercent, CompanyPrice = item.CompanyPrice, CustomerPrice = item.CustomerPrice, DayWise = item.DayWise, NightWise = item.NightWise, DriverPrice = item.DriverPrice, VehicleTypeId = item.VehicleTypeId }); } } else { var CompanyList = (from a in General.GetQueryable <Gen_Company>(null) select new { Id = a.Id, CompanyName = a.CompanyName }).ToList(); var queryy = CompanyList.Where(item => selectlist.Contains(item.Id)); foreach (var item in queryy) { if (objMaster.PrimaryKeyValue == null) { objMaster.New(); } else { objMaster.Edit(); } objMaster.Current.VehicleTypeId = Vechileid; // objMaster.Current.VehicleTypeId = VehicleTypeId.ToInt(); objMaster.Current.CompanyId = item.Id; objMaster.Current.IsCompanyWise = true; objMaster.Current.AddOn = DateTime.Now; objMaster.Current.AddBy = AppVars.LoginObj.LuserId.ToIntorNull(); objMaster.Current.StartRate = numStartRate.Value; objMaster.Current.StartRateValidMiles = numStartRateValidMiles.Value; string[] skipProperties = { "Gen_Company", "Gen_Location", "Gen_Location1", "Gen_LocationType", "Gen_LocationType1", "Fare", "Gen_Zone1", "Gen_Zone", "Fare_ZoneWisePricing1","Fare_ZoneWisePricing", "Fleet_VehicleType" }; IList <Fare_ChargesDetail> savedList = objMaster.Current.Fare_ChargesDetails; List <Fare_ChargesDetail> ListDetail = (from a in ChargesDetail select new Fare_ChargesDetail { Id = a.Id, FareId = objMaster.Current.Id, OriginLocationTypeId = a.OriginLocationTypeId, DestinationLocationTypeId = a.OriginLocationTypeId, OriginId = a.OriginId, DestinationId = a.DestinationId, FromAddress = a.FromAddress, ToAddress = a.ToAddress, Rate = a.Rate, NightTimeRate = a.NightTimeRate }).ToList(); Utils.General.SyncChildCollection(ref savedList, ref ListDetail, "Id", skipProperties); // OtherCharge IList <Fare_OtherCharge> savedList2 = objMaster.Current.Fare_OtherCharges; List <Fare_OtherCharge> listofOtherDetail = (from a in OtherCharge select new Fare_OtherCharge { Id = a.Id, FareId = a.FareId, FromMile = a.FromMile, ToMile = a.ToMile, Rate = a.Rate, FromStartTime = HasOffPeakRate ? a.FromStartTime : null, TillStartTime = HasOffPeakRate ? a.TillStartTime : null, FromEndTime = HasOffPeakRate ? a.FromEndTime : null, TillEndTime = HasOffPeakRate ? a.TillEndTime : null, PeakTimeRate = HasOffPeakRate ? a.PeakTimeRate : 0, OffPeakTimeRate = HasOffPeakRate ? a.OffPeakTimeRate : 0, NightTimeRate = HasOffPeakRate ? a.NightTimeRate : 0 }).ToList(); Utils.General.SyncChildCollection(ref savedList2, ref listofOtherDetail, "Id", skipProperties); // PDA METER IList <Fare_PDAMeter> savedList3 = objMaster.Current.Fare_PDAMeters; List <Fare_PDAMeter> listofpdaOtherDetail = (from a in PDAMeter select new Fare_PDAMeter { Id = a.Id, FareId = a.FareId, FromMile = a.FromMile, ToMile = a.ToMile, Rate = a.Rate, FromStartTime = HasOffPeakRate ? a.FromStartTime : null, TillStartTime = HasOffPeakRate ? a.TillStartTime : null, FromEndTime = HasOffPeakRate ? a.FromEndTime : null, TillEndTime = HasOffPeakRate ? a.TillEndTime : null, PeakTimeRate = HasOffPeakRate ? a.PeakTimeRate : 0, OffPeakTimeRate = HasOffPeakRate ? a.OffPeakTimeRate : 0, NightTimeRate = HasOffPeakRate ? a.NightTimeRate : 0 }).ToList(); Utils.General.SyncChildCollection(ref savedList3, ref listofpdaOtherDetail, "Id", skipProperties); IList <Fare_ZoneWisePricing> saveList4 = objMaster.Current.Fare_ZoneWisePricings; List <Fare_ZoneWisePricing> listofDetail4 = (from a in ZoneWisePricing select new Fare_ZoneWisePricing { Id = a.Id, FareId = a.FareId, FromZoneId = a.FromZoneId, ToZoneId = a.ToZoneId, Price = a.Price, }).ToList(); Utils.General.SyncChildCollection(ref saveList4, ref listofDetail4, "Id", skipProperties); //HP IList <Gen_Company_AgentCommission> saveList5 = objMaster.Current.Gen_Company_AgentCommissions; List <Gen_Company_AgentCommission> listofDetail5 = (from a in CompanyAirportandStation select new Gen_Company_AgentCommission { Id = a.Id, FareId = a.FareId, LocationId = a.LocationId, LocationTypeId = a.LocationTypeId, CommissionPercent = a.CommissionPercent, CommissionAmount = a.CommissionAmount, CommissionOnPercent = a.CommissionOnPercent, DayWise = a.DayWise, NightWise = a.NightWise, VehicleTypeId = a.VehicleTypeId, CompanyPrice = a.CompanyPrice, DriverPrice = a.DriverPrice, CustomerPrice = a.CustomerPrice, CompanyId = item.Id }).ToList(); Utils.General.SyncChildCollection(ref saveList5, ref listofDetail5, "Id", skipProperties); // objMaster.Save(); objMaster.Clear(); objMaster = new FareBO(); FaresSaved(item.Id); } } } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }
private void Display() { try { if (grdDriver.CurrentRow != null && grdDriver.CurrentRow is GridViewRowInfo) { int Id = grdDriver.CurrentRow.Cells["Id"].Value.ToInt(); string Driver = grdDriver.CurrentRow.Cells[COLS.DriverNo].Value + "-" + grdDriver.CurrentRow.Cells[COLS.Driver].Value + " Shifts"; radLabel24.Text = Driver; // grdDriverShift.Rows.Clear(); for (int i = 0; i < grdShift.RowCount; i++) { grdShift.Rows[i].Cells[COLS.Check].Value = false; grdShift.Rows[i].Cells[COLS.Id].Value = null;//list.FirstOrDefault(c => c.Driver_Shift_ID.ToInt() == grdShift.Rows[i].Cells[COLS.Driver_Shift_ID].Value.ToInt()).Id; } var list = (from a in General.GetQueryable <Fleet_Driver_Shift>(c => c.DriverId == Id) select new { a.Id, a.DriverId, a.Driver_Shift_ID, //ShiftName = a.Driver_Shift_ID != null ? a.Driver_Shift.ShiftName : "", //FromTime = a.Driver_Shift.FromTime, //TillTime = a.Driver_Shift.TillTime, //ShiftStart = a.Driver_Shift.ShiftStart, //ShiftEnd = a.Driver_Shift.ShiftEnd }).ToList(); int newIndex = 0; for (int i = 0; i < grdShift.RowCount; i++) { if (list.Count(c => c.Driver_Shift_ID.ToInt() == grdShift.Rows[i].Cells[COLS.Driver_Shift_ID].Value.ToInt()) > 0) { grdShift.Rows[i].Cells[COLS.Check].Value = true; grdShift.Rows[i].Cells[COLS.Id].Value = list.FirstOrDefault(c => c.Driver_Shift_ID.ToInt() == grdShift.Rows[i].Cells[COLS.Driver_Shift_ID].Value.ToInt()).Id; int oldIndex = grdShift.Rows[i].Index; grdShift.Rows.Move(oldIndex, newIndex); newIndex++; } } //grdDriverShift.Rows.Clear(); //grdDriverShift.RowCount = list.Count; //for (int i = 0; i < list.Count; i++) //{ // grdDriverShift.Rows[i].Cells[COLS.Id].Value = list[i].Id; // grdDriverShift.Rows[i].Cells[COLS.DriverId].Value = list[i].DriverId; // grdDriverShift.Rows[i].Cells[COLS.Driver_Shift_ID].Value = list[i].Driver_Shift_ID; // grdDriverShift.Rows[i].Cells[COLS.ShiftName].Value = list[i].ShiftName; // grdDriverShift.Rows[i].Cells[COLS.FromTime].Value = list[i].FromTime; // //StartShiftDay = ShowDayName(list[i].ShiftStart.ToInt()); // //EndShiftDay = ShowDayName(list[i].ShiftEnd.ToInt()); // //if ((ToDay == StartShiftDay || ToDay == EndShiftDay) && (StartTime >= Shiftlist[i].FromTime || StartTime <= Shiftlist[i].TillTime)) // //{ // // grdShift.Rows[i].Cells[COLS.Check].Value = true; // //} // //else // //{ // // grdShift.Rows[i].Cells[COLS.Check].Value = false; // //} // grdDriverShift.Rows[i].Cells[COLS.ShiftStarts].Value = ShowDayName(list[i].ShiftStart.ToInt()) + " " + string.Format("{0:HH:mm}", list[i].FromTime); // grdDriverShift.Rows[i].Cells[COLS.ShiftEnds].Value = ShowDayName(list[i].ShiftEnd.ToInt()) + " " + string.Format("{0:HH:mm}", list[i].TillTime); //} } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
public void GenerateReport() { try { if (ddlCompany.SelectedValue == null) { pnlCriteria.Visible = false; } reportViewer1.LocalReport.EnableExternalImages = true; Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[23]; string address = AppVars.objSubCompany.Address; string telNo = string.Empty; string sortCode = AppVars.objSubCompany.SortCode.ToStr(); string accountNo = AppVars.objSubCompany.AccountNo.ToStr(); string accountTitle = AppVars.objSubCompany.AccountTitle.ToStr(); string bank = AppVars.objSubCompany.BankName.ToStr(); string hasBankDetails = "1"; if (string.IsNullOrEmpty(sortCode) && string.IsNullOrEmpty(accountNo) && string.IsNullOrEmpty(accountTitle) && string.IsNullOrEmpty(bank)) { hasBankDetails = "0"; } if (!string.IsNullOrEmpty(sortCode)) { sortCode = "Sort Code : " + sortCode; } if (!string.IsNullOrEmpty(accountTitle)) { accountTitle = "Account Title : " + accountTitle; } string website = AppVars.objSubCompany.WebsiteUrl.ToStr(); if (!string.IsNullOrEmpty(website)) { website += " , "; } website += "Email:" + AppVars.objSubCompany.EmailAddress.ToStr(); string companyNumber = AppVars.objSubCompany.CompanyNumber.ToStr(); if (!string.IsNullOrEmpty(companyNumber)) { companyNumber = "Company Number: " + companyNumber; } string vatNumber = AppVars.objSubCompany.CompanyVatNumber.ToStr(); if (!string.IsNullOrEmpty(vatNumber)) { vatNumber = "VAT Number: " + vatNumber; } param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address); param[18] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Footer", AppVars.objSubCompany.WebsiteUrl.ToStr()); param[14] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_MobileNo", "Mobile: " + AppVars.objSubCompany.EmergencyNo.ToStr()); param[15] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Website", website); param[16] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Email", "Email: " + AppVars.objSubCompany.EmailAddress.ToStr()); param[20] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyNumber", companyNumber); param[21] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VATNumber", vatNumber); param[7] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_SortCode", sortCode); param[9] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountTitle", accountTitle); param[10] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Bank", bank); List <ClsLogo> objLogo = new List <ClsLogo>(); objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); string path = @"File:"; param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Path", path); param[6] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeader", AppVars.objSubCompany.CompanyName.ToStr()); param[22] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeading", this.CompanyHeader); int?driverId = this.DataSource.FirstOrDefault().DefaultIfEmpty().DriverId; var data = this.DataSource.FirstOrDefault().DefaultIfEmpty(); telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo; if (!string.IsNullOrEmpty(accountNo)) { accountNo = "Account No : " + accountNo; } var objTemplate = General.GetObject <UM_Form_Template>(c => c.UM_Form.FormName == this.Name && c.IsDefault == true); string className = "Taxi_AppMain.ReportDesigns."; if (objTemplate != null) { if (objTemplate.TemplateName == "Template1") { this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverRentTrasaction.rdlc"; } else if (objTemplate.TemplateName == "Template2") { this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverRentTrasaction2.rdlc"; } else if (objTemplate.TemplateName == "Template3") { this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverRentTrasaction3.rdlc"; } else if (objTemplate.TemplateName == "Template4") { this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptDriverRentTrasaction4.rdlc"; } } param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo); param[8] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountNo", accountNo); string vat = "0"; decimal discountAmount = 0.00m; decimal valueAddedTax = 0.0m; string discount = string.Format("{0:c}", discountAmount); discount = discount.Substring(1); string grandTotal = ""; param[17] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Discount", discount); param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_InvoiceTotal", grandTotal); param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasVat", vat); param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VAT", valueAddedTax.ToStr()); param[11] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasDepartment", "0"); param[12] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Net", "0"); param[13] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasCostCenter", "0"); param[19] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasBankDetails", hasBankDetails); reportViewer1.LocalReport.SetParameters(param); int cnt = this.DataSource.Count; this.vu_DriverRentBindingSource.DataSource = this.DataSource; this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
public void LoadReport() { try { this.reportViewer1.LocalReport.EnableExternalImages = true; TimeSpan tillTime = TimeSpan.Zero; TimeSpan.TryParse("23:59:59", out tillTime); DateTime?dtFromDate = dtpFromDate.Value.ToDate(); DateTime?dtTillDate = dtpTillDate.Value.ToDate() + tillTime; if (dtFromDate > dtTillDate) { ENUtils.ShowMessage("From Date can't greater then Till Date"); return; } this.stp_OperatorPerformanceResultBindingSource.DataSource = GetData(dtFromDate, dtTillDate).ToList(); //select new stp_OperatorPerformanceResult //{ // Id = a.Id, // CLICalls = a.CLICalls, // CLICleared = a.CLICleared, // JobsBooked = a.JobsBooked, // JobsCancelled = a.JobsCancelled, // JobsCompletetd = a.JobsCompletetd, // LateDespatch = a.LateDespatch, // LoggedIn = a.LoggedIn, // MailSent = a.MailSent, // UserName = a.UserName //}).ToList(); Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[2]; // string address = AppVars.objSubCompany.Address; // string telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo; string heading = string.Empty; //if (dtFrom != null && dtTill != null) //{ heading = "Operator Performance for period " + string.Format("{0:dd/MM/yy}", dtpFromDate.Value) + " to " + string.Format("{0:dd/MM/yy}", dtpTillDate.Value); // } string PrintedOn = string.Empty; PrintedOn = "Printed on " + string.Format("{0:dd/MM/yy}", DateTime.Now) + " at " + string.Format("{0:HH:mm}", DateTime.Now); //Printed on 22/04/2016 at 16:40 param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Period", heading); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_PrintedOn", PrintedOn); //List<ClsLogo> objLogo = new List<ClsLogo>(); //objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); //ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); //this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); IsReportLoaded = true; } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void GenerateReport() { try { int SubCompanyId = ddSubCompany.SelectedValue.ToInt(); if (chkAllSubCompany.Checked == false && SubCompanyId == 0) { ENUtils.ShowMessage("Required : Sub Company"); return; } if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753) { dtpFromDate.Value = null; } if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753) { dtpTillDate.Value = null; } DateTime?fromDate = dtpFromDate.Value.ToDateorNull(); DateTime?tillDate = dtpTillDate.Value.ToDateorNull(); if (tillDate != null) { tillDate = tillDate + TimeSpan.Parse("23:59:59"); } bool ShowDetail = chkDetailReport.Checked.ToBool(); using (TaxiDataContext db = new TaxiDataContext()) { var list = db.stp_GetBookingByCallHistory(fromDate, tillDate, SubCompanyId, ShowDetail).ToList();; this.stp_GetBookingByCallHistoryResultBindingSource.DataSource = list; } if (ShowDetail) { this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns.rptCallHistoryBookingDetail.rdlc"; } else { this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns.rptCallHistoryBookingCount.rdlc"; } Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[4]; string address = AppVars.objSubCompany.Address; string telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo; param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Header", AppVars.objSubCompany.CompanyName.ToStr()); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo); ////Report_Parameter_AverageJobsPerDay string heading = string.Empty; if (fromDate != null && tillDate != null) { heading = string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate); } param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Criteria", heading); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void PopulateJobsPool() { try { var row = grdAcceptorPooljobs.Rows.AddNew(); //for (int i = 0; i < jobpool.Count; i++) //{ string vehicle = string.Empty; using (TaxiDataContext db = new TaxiDataContext()) { vehicle = db.Fleet_VehicleTypes.FirstOrDefault(c => c.Id == objBooking.VehicleTypeId.ToInt()).DefaultIfEmpty().VehicleType.ToStr(); } row.Cells["RefNumber"].Value = objBooking.BookingNo; ; // row.Cells["PickupDateTime"].Value = objBooking.PickupDateTime; row.Cells["PickUpDate"].Value = objBooking.PickupDateTime; // row.Cells["Time"].Value = objBooking.Time; row.Cells["Passenger"].Value = objBooking.CustomerName; row.Cells["From"].Value = objBooking.FromAddress; row.Cells["To"].Value = objBooking.ToAddress; row.Cells["Vehicle"].Value = vehicle; row.Cells["Account"].Value = objBooking.CompanyCreditCardDetails; // row.Cells["Account"].Value = objBooking.Account; row.Cells["Notes"].Value = objBooking.SpecialRequirements.ToStr(); row.Cells["OfferPrice"].Value = objBooking.FareRate.ToDecimal(); row.Cells["Bid"].Value = objBooking.FareRate.ToDecimal(); row.Cells["Provider"].Value = objBooking.ClientName.ToStr(); this.FormTitle = "Job Request By : " + objBooking.ClientName.ToStr(); // row.Cells["Status"].Value = objBooking.Status; // row.Cells["DriverNo"].Value = objBooking.DriverNo; // row.Cells["Accept"].Value = objBooking.Accept; // } //var jobpool = (from a in this.objBooking // select new // { // Id = a.Id, // RefNumber = a.BookingNo, // PickupDateTemp = a.PickupDateTime, // PickUpDate = string.Format("{0:dd/MM/yyyy}", a.PickupDateTime), // Time = string.Format("{0:HH:mm}", a.PickupDateTime), // Passenger = a.CustomerName, // From = a.FromDoorNo != string.Empty ? a.FromDoorNo + " - " + a.FromAddress : a.FromAddress, // To = a.ToDoorNo != string.Empty ? a.ToDoorNo + " - " + a.ToAddress : a.ToAddress, // //Fare = a.FareRate, // Vehicle = a.Fleet_VehicleType.VehicleType, // Account = a.Gen_Company != null ? a.Gen_Company.CompanyName : "", // Notes = a.NotesString, // OfferPrice = a.FareRate, // Provider = "", // Status = a.BookingStatus.StatusName, // DriverNo = a.DriverId > 0 ? a.Fleet_Driver.DriverNo : "", // Accept = "Accepted" // }).ToList(); // grdAcceptorPooljobs.DataSource = jobpool; // FormatJobPoolsGrid(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void PlotDriver(int?driverId, int?zoneId, int?FleetId) { DriverQueueBO objMaster = null; try { Fleet_DriverQueueList objPlottedDriver = General.GetObject <Fleet_DriverQueueList>(c => c.Status == true && c.DriverId == driverId); objMaster = new DriverQueueBO(); if (objPlottedDriver == null) { objMaster.New(); objMaster.Current.LoginDateTime = DateTime.Now; } else { objMaster.GetByPrimaryKey(objPlottedDriver.Id); } objMaster.Current.FleetMasterId = FleetId; objMaster.Current.ZoneId = zoneId; objMaster.Current.DriverId = driverId; objMaster.Current.Status = true; if (objMaster.Current.Fleet_Driver == null || objMaster.Current.Fleet_Driver.HasPDA.ToBool() == false) { objMaster.Current.QueueDateTime = DateTime.Now; } objMaster.Save(); if (objMaster.Current.Fleet_Driver.HasPDA.ToBool()) { if (zoneId != null) { string zoneName = ddlZone.Text.ToUpper().Trim(); if (objMaster.Current.CurrentJobId != null) { string msg = string.Empty; string pickUpPlot = string.Empty; string dropOffPlot = string.Empty; if (AppVars.objPolicyConfiguration.DefaultClientId.ToStr() == "AbbeyCarsleeds") { pickUpPlot = objMaster.Current.ZoneId != null ? "<<<" + objMaster.Current.Booking.Gen_Zone1.ZoneName.ToStr() : ""; if (zoneName.Contains("(")) { zoneName = zoneName.Remove(zoneName.IndexOf("(")); } if (zoneName.Contains(".")) { zoneName = zoneName.Substring(zoneName.IndexOf(".") + 1); } dropOffPlot = objMaster.Current.Booking.DropOffZoneId != null ? "<<<" + zoneName.Trim() : ""; } string mobNo = objMaster.Current.Booking.CustomerMobileNo; if (string.IsNullOrEmpty(mobNo)) { mobNo = " "; } msg = (!string.IsNullOrEmpty(objMaster.Current.Booking.FromDoorNo) ? objMaster.Current.Booking.FromDoorNo + "-" + objMaster.Current.Booking.FromAddress + pickUpPlot : objMaster.Current.Booking.FromAddress + pickUpPlot) + ">>" + (!string.IsNullOrEmpty(objMaster.Current.Booking.ToDoorNo) ? objMaster.Current.Booking.ToDoorNo + "-" + objMaster.Current.Booking.ToAddress + dropOffPlot : objMaster.Current.Booking.ToAddress + dropOffPlot) + ">>" + string.Format("{0:dd/MM/yyyy HH:mm}", objMaster.Current.Booking.PickupDateTime) + ">>" + objMaster.Current.Booking.CustomerName + ">>" + mobNo; // For TCP Connection if (AppVars.objPolicyConfiguration.IsListenAll.ToBool() && !string.IsNullOrEmpty(AppVars.objPolicyConfiguration.ListenerIP.ToStr().Trim())) { new Thread(delegate() { General.SendMessageToPDA("request pda=" + driverId + "=" + objMaster.Current.CurrentJobId + "=" + "Update Job>>" + driverId + ">>" + objMaster.Current.CurrentJobId + ">>" + msg + "=8"); }).Start(); } new TaxiDataContext().stp_UpdateJobDropOffPlot(objMaster.Current.CurrentJobId, driverId, zoneId); new BroadcasterData().BroadCastToAll(RefreshTypes.REFRESH_DASHBOARD_DRIVER); } } } else { General.RefreshListWithoutSelected <frmDriverLoginList>("frmDriverLoginList1"); // General.RefreshWaitingDrivers(); } this.PlottedDriverId = driverId; this.Plotted = true; this.Close(); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }
private void btnPickBooking_Click(object sender, EventArgs e) { try { int bookingTypeId = ddlBookingType.SelectedValue.ToInt(); int companyId = ddlCompany.SelectedValue.ToInt(); DateTime?fromDate = dtpFromDate.Value.ToDate(); DateTime?tillDate = dtpTillDate.Value.ToDate(); long departmentId = ddlDepartment.SelectedValue.ToLong(); int costcenterId = ddlCostCenter.SelectedValue.ToInt(); string error = string.Empty; if (companyId == 0) { error += "Required : Company"; } 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; } string[] hiddenColumns = null; hiddenColumns = new string[] { "Id", "CompanyId", "CompanyName", "Parking", "Destination", "Waiting", "ExtraDrop", "MeetAndGreet", "Congtion", "Total", "OrderNo", "PupilNo", "BookingDate", "Description", "Fare", "AccountType", "PaymentTypeId" }; bool IsDepartmentWise = chkDepartmentWise.Checked; bool IsCostCenterWise = chkCostCenterWise.Checked; string orderNo = ddlOrderNo.SelectedValue.ToStr().Trim(); Func <Booking, bool> _conditionDate = null; if (ddlPickType.SelectedIndex == 0) { _conditionDate = b => b.PickupDateTime.Value.Date >= fromDate && b.PickupDateTime.Value.Date <= tillDate; } else { _conditionDate = b => b.BookingDate.Value.Date >= fromDate && b.BookingDate.Value.Date <= tillDate; } List <object[]> list = General.ShowBookingMultiLister(c => c.CompanyId == companyId && (c.BookingStatusId == Enums.BOOKINGSTATUS.WAITING) && (orderNo == "" || c.OrderNo == orderNo) && ((IsDepartmentWise && c.DepartmentId == departmentId) || (IsDepartmentWise == false)) && ((IsCostCenterWise && c.CostCenterId == costcenterId) || (IsCostCenterWise == false)) , a => a.InvoiceId != null, hiddenColumns, _conditionDate); GridViewRowInfo row; int cnt = list.Count; //foreach (object[] obj in list) //{ // long bookingId = obj[0].ToLong(); // if (grdLister.Rows.Count(c => c.Cells[COLS.BookingId].Value.ToLong() == bookingId) > 0) // continue; // row = grdLister.Rows.AddNew(); // row.Cells[COLS.BookingId].Value = obj[0].ToLongorNull(); // row.Cells[COLS.RefNumber].Value = obj[3].ToStr(); // row.Cells[COLS.PickupDate].Value = obj[2].ToDateTime(); // row.Cells[COLS.Vehicle].Value = obj[4].ToStr(); // row.Cells[COLS.OrderNo].Value = obj[5].ToStr(); // row.Cells[COLS.PupilNo].Value = obj[6].ToStr(); // row.Cells[COLS.Passenger].Value = obj[7].ToStr(); // row.Cells[COLS.PickupPoint].Value = obj[8].ToStr(); // row.Cells[COLS.Destination].Value = obj[9].ToStr(); // row.Cells[COLS.Charges].Value = obj[10].ToDecimal(); // row.Cells[COLS.Parking].Value = obj[13].ToDecimal(); // row.Cells[COLS.Waiting].Value = obj[14].ToDecimal(); // row.Cells[COLS.ExtraDrop].Value = obj[15].ToDecimal(); // row.Cells[COLS.MeetAndGreet].Value = obj[16].ToDecimal(); // row.Cells[COLS.CongtionCharge].Value = obj[17].ToDecimal(); // row.Cells[COLS.Total].Value = obj[19].ToDecimal(); // row.Cells[COLS.RemovalDescription].Value = obj[18].ToStr(); // row.Cells[COLS.BookedBy].Value = obj[20].ToStr(); //} var existBookingId = grdLister.Rows.Select(c => c.Cells[COLS.BookingId].Value.ToLong()).ToList <long>(); //int newCnt= list.Select(c=>c[0].ToLong()).Except(existBookingId).Count(); //grdLister.RowCount += newCnt; list.RemoveAll(c => existBookingId.Contains(c[0].ToLong())); cnt = list.Count; for (int i = 0; i < cnt; i++) { // long bookingId = list[i][0].ToLong(); //if (grdLister.Rows.Count(c => c.Cells[COLS.BookingId].Value.ToLong() == bookingId) > 0) //continue; row = grdLister.Rows.AddNew(); row.Cells[COLS.BookingId].Value = list[i][0].ToLongorNull(); row.Cells[COLS.RefNumber].Value = list[i][3].ToStr(); row.Cells[COLS.PickupDate].Value = list[i][2].ToDateTime(); row.Cells[COLS.Vehicle].Value = list[i][4].ToStr(); row.Cells[COLS.OrderNo].Value = list[i][5].ToStr(); row.Cells[COLS.PupilNo].Value = list[i][6].ToStr(); row.Cells[COLS.Passenger].Value = list[i][7].ToStr(); row.Cells[COLS.PickupPoint].Value = list[i][8].ToStr(); row.Cells[COLS.Destination].Value = list[i][9].ToStr(); row.Cells[COLS.Charges].Value = list[i][10].ToDecimal(); row.Cells[COLS.Parking].Value = list[i][13].ToDecimal(); row.Cells[COLS.Waiting].Value = list[i][14].ToDecimal(); row.Cells[COLS.ExtraDrop].Value = list[i][15].ToDecimal(); row.Cells[COLS.MeetAndGreet].Value = list[i][16].ToDecimal(); row.Cells[COLS.CongtionCharge].Value = list[i][17].ToDecimal(); row.Cells[COLS.Total].Value = list[i][19].ToDecimal(); row.Cells[COLS.RemovalDescription].Value = list[i][18].ToStr(); row.Cells[COLS.BookedBy].Value = list[i][20].ToStr(); } CalculateTotal(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void OnSave() { try { if (objMaster.PrimaryKeyValue == null) { objMaster.New(); objMaster.Current.InvoicePaymentTypeID = 1; } else { objMaster.Edit(); } objMaster.Current.BookingTypeId = ddlBookingType.SelectedValue.ToIntorNull(); objMaster.Current.InvoiceDate = dtpInvoiceDate.Value.ToDate(); objMaster.Current.CompanyId = ddlCompany.SelectedValue.ToIntorNull(); objMaster.Current.DepartmentId = ddlDepartment.SelectedValue.ToLongorNull(); objMaster.Current.DepartmentWise = chkDepartmentWise.Checked; objMaster.Current.CostCenterId = ddlCostCenter.SelectedValue.ToIntorNull(); objMaster.Current.CostCenterWise = chkCostCenterWise.Checked; objMaster.Current.DueDate = dtpDueDate.Value.ToDate(); objMaster.Current.InvoiceTypeId = Enums.INVOICE_TYPE.PRE_INVOICE_ACCOUNT; objMaster.Current.InvoiceTotal = grdLister.Rows.Sum(c => c.Cells[COLS.Total].Value.ToDecimal()); // var distinctRows= grdLister.Rows.Select(c => c.Cells[COLS.BookingId].ToLong()).Distinct(); string[] skipProperties = { "Invoice", "Booking" }; IList <Invoice_Charge> savedList = objMaster.Current.Invoice_Charges; List <Invoice_Charge> listofDetail = (from r in grdLister.Rows select new Invoice_Charge { Id = r.Cells[COLS.ID].Value.ToLong(), InvoiceId = r.Cells[COLS.InvoiceId].Value.ToLong(), BookingId = r.Cells[COLS.BookingId].Value.ToLongorNull(), }).ToList(); Utils.General.SyncChildCollection(ref savedList, ref listofDetail, "Id", skipProperties); objMaster.Save(); objMaster.GetByPrimaryKey(objMaster.PrimaryKeyValue); DisplayRecord(); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }
private void LoadReport() { try { DateTime?dtFrom = dtpFrom.Value.ToDateorNull(); DateTime?dtTill = dtpTill.Value.ToDateorNull();; string error = string.Empty; if (dtFrom == null) { if (string.IsNullOrEmpty(error)) { //error += Environment.NewLine; error += "Required : From Date"; } } if (dtTill == null) { if (!string.IsNullOrEmpty(error)) { error += Environment.NewLine; } error += "Required : To Date"; } if (!string.IsNullOrEmpty(error)) { ENUtils.ShowMessage(error); return; } this.reportViewer1.LocalReport.EnableExternalImages = true; this.stp_DriverAccountBookingsResultBindingSource.DataSource = GetData(dtFrom, dtTill + TimeSpan.Parse("23:59:59")); Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[4]; string heading = string.Empty; //heading = "From: "+string.Format("{0:dd/MM/yyyy}", dtFrom) + " To: " + string.Format("{0:dd/MM/yyyy}", dtTill); string From = string.Format("{0:dd/MM/yyyy}", dtFrom); string To = string.Format("{0:dd/MM/yyyy}", dtTill); param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyName", AppVars.objSubCompany.CompanyName); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_FromDate", From); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_ToDate", To); param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_ReportDate", string.Format("{0:dd MMMM yyyy}", DateTime.Now)); //List<ClsLogo> objLogo = new List<ClsLogo>(); //objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); //ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); //this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); reportViewer1.LocalReport.SetParameters(param); if (IsExcelReport) { this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns.rptDriverAccountBookings_excel.rdlc"; } else { this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns.rptDriverAccountBookings.rdlc"; } this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); IsReportLoaded = true; } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void PrintStatement() { try { if (grdDriverRentLastStatement.Rows.Where(c => c.Cells["Check"].Value.ToBool() == true).Count() > 0) { //foreach (var item in grdDriverRentLastStatement.Rows.Where(c => c.Cells["Check"].Value.ToBool() == true)) //{ // long Id = item.Cells[COLS.Id].Value.ToLong(); // ReportPrintDocument rpt = null; // frmDriverCommisionTransactionExpensesReport3 frm = null; // if (Id > 0) // { // frm = new frmDriverCommisionTransactionExpensesReport3(1); // var list = General.GetQueryable<vu_DriverCommisionExpenses2>(a => a.Id == Id).OrderBy(c => c.PickupDate).ToList(); // int count = list.Count; // frm.DataSource = list; // var list2 = General.GetQueryable<vu_FleetDriverCommissionExpense>(c => c.CommissionId == Id).OrderBy(c => c.Date).ToList(); // frm.DataSource2 = list2; // frm.IsFareAndWaitingWise = this.IsFareAndWaitingWiseComm; // frm.GenerateReport(); // rpt = new ReportPrintDocument(frm.reportViewer1.LocalReport); // rpt.Print(); // rpt.Dispose(); // } //} var rows = grdDriverRentLastStatement.Rows.Where(c => c.Cells["Check"].Value.ToBool() == true).ToList(); var list = (from a in rows.Where(c => c.Cells[COLS.Id].Value.ToInt() > 0) select new { Id = a.Cells[COLS.Id].Value.ToInt(), CompanyId = a.Cells[COLS.DriverId].Value.ToInt(), Driver = a.Cells[COLS.DriverNo].Value.ToStr() }).ToList(); frmInvoiceReport frm = new frmInvoiceReport(); ReportPrintDocument rpt = null; foreach (var item in list) { if (item.Id > 0) { using (TaxiDataContext db = new TaxiDataContext()) { var listInv = db.vu_Invoices.Where(a => a.Id == item.Id).OrderBy(c => c.PickupDate).ToList(); frm.DataSource = listInv; var Invoice = db.Invoices.Where(c => c.Id == item.Id).FirstOrDefault(); frm.ObjInvoice = Invoice; //var Inv= //frm.ObjInvoice = listInv.; frm.GenerateReport(); rpt = new ReportPrintDocument(frm.reportViewer1.LocalReport); rpt.Print(); rpt.Dispose(); } } } //if (list.Count > 0) //{ // frmDriverCommisionTransactionExpensesReport4 frm = new frmDriverCommisionTransactionExpensesReport4(list, DateTime.Now.ToDate(), DateTime.Now.ToDate()); // frm.ShowDialog(); // frm.Dispose(); //} } else { ENUtils.ShowMessage("Please select statement to Print"); } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
//Save public override void Save() { try { if (objMaster.PrimaryKeyValue == null) { objMaster.New(); } else { objMaster.Edit(); } objMaster.Current.ComplainDateTime = txtComplainDate.Value.ToDate(); objMaster.Current.IncidentDateTime = txtincidentDate.Value.ToDate(); objMaster.Current.CustomerName = txtCustomerName.Text.Trim(); objMaster.Current.CustomerAddress = txtAddressDetail.Text.Trim(); objMaster.Current.CustomerPhoneNo = txtPhoneNo.Text.Trim(); objMaster.Current.JobDetail = txtJobDetail.Text.Trim(); objMaster.Current.ControllerName = txtControlerName.Text.Trim(); objMaster.Current.CustomerPhoneNo = txtPhoneNo.Text.Trim(); objMaster.Current.ComplainDescription = txtComplain.Text.Trim(); objMaster.Current.DealtWith = txtDealt.Text.Trim(); objMaster.Current.ResultDescription = txtResult.Text.Trim(); int?driverId = null; int?companyId = null; if (rdoDriver.IsChecked == true) { driverId = ddlDriver.SelectedValue.ToIntorNull(); } else if (rdoAccount.IsChecked == true) { companyId = ddlAccount.SelectedValue.ToIntorNull(); } objMaster.Current.CompanyId = companyId; objMaster.Current.DriverId = driverId; long BookingId = txtJobRef.Tag.ToLong(); if (BookingId > 0 && txtJobRef.Text.Trim() != string.Empty) { objMaster.Current.BookingId = BookingId; } else { objMaster.Current.BookingId = null; } if (txtControlerName.Visible == true) { objMaster.Current.ControllerName = txtControlerName.Text.Trim(); } else { objMaster.Current.ControllerName = ""; } if (rdoDriver.IsChecked == true) { objMaster.Current.ComplaintBy = 1; } else { objMaster.Current.ComplaintBy = 0; } //New Code 15 Aprail if (rdoAccount.IsChecked == true) { objMaster.Current.ComplaintBy = 2; } // objMaster.Save(); savedId = objMaster.Current.Id; txtRefno.Text = objMaster.Current.RefNo.ToStr(); if (IsHidePopulateDate == false) { PopulateData(); } } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }
public void LoadReport() { try { DateTime?dtFrom = dtpFromDate.Value.ToDateorNull(); DateTime?dtTill = dtpTillDate.Value.ToDateorNull(); int CompanyId = ddlCompany.SelectedValue.ToInt(); int SubCompanyId = ddlSubCompany.SelectedValue.ToInt(); int PaymentType = 0; if (rdoCash.IsChecked) { PaymentType = 1; } else if (rdoAccount.IsChecked) { PaymentType = 2; } else { PaymentType = 0; } string Error = string.Empty; if (dtFrom == null) { Error = "Required: From Date"; } if (dtTill == null) { if (string.IsNullOrEmpty(Error)) { Error = "Required: To Date"; } else { Error += Environment.NewLine + "Required: To Date"; } } if (CompanyId == 0) { if (string.IsNullOrEmpty(Error)) { Error = "Required: Company"; } else { Error += Environment.NewLine + "Required: Company"; } } if (!string.IsNullOrEmpty(Error)) { ENUtils.ShowMessage(Error); return; } this.reportViewer1.LocalReport.EnableExternalImages = true; var list = (new Taxi_Model.TaxiDataContext().stp_CompanyIncomeStatement(PaymentType, dtFrom, dtTill + TimeSpan.Parse("23:59:59"), CompanyId, SubCompanyId)).ToList(); // var list2 = (list.AsEnumerable().OrderBy(item => item.DriverNo, new NaturalSortComparer<string>())).ToList(); this.stp_CompanyIncomeStatementResultBindingSource.DataSource = list; Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[1]; string heading = string.Empty; heading = "For the Period " + string.Format("{0:dd/MM/yyyy}", dtFrom) + " to " + string.Format("{0:dd/MM/yyyy}", dtTill); //heading = "From: "+string.Format("{0:dd/MM/yyyy}", dtFrom) + " To: " + string.Format("{0:dd/MM/yyyy}", dtTill); // string EndDate = string.Format("{0:dd/MM/yyyy}", DateTime.Now); //string To = string.Format("{0:dd/MM/yyyy}", dtTill); param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Period", heading); //List<ClsLogo> objLogo = new List<ClsLogo>(); //objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); //ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); //this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); IsReportLoaded = true; } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void btnExport_Click(object sender, EventArgs e) { try { if (DialogResult.OK == saveFileDialog1.ShowDialog()) { radGridView1.Columns.Clear(); radGridView1.Rows.Clear(); radGridView1.Columns.Add(new GridViewTextBoxColumn("RefNo", "RefNo")); radGridView1.Columns.Add(new GridViewTextBoxColumn("ComplainDate", "ComplainDate")); radGridView1.Columns.Add(new GridViewTextBoxColumn("CustomerName", "CustomerName")); radGridView1.Columns.Add(new GridViewTextBoxColumn("PhoneNumber", "PhoneNumber")); radGridView1.Columns.Add(new GridViewTextBoxColumn("ResultDescription", "ResultDescription")); radGridView1.Columns.Add(new GridViewTextBoxColumn("ComplainDescription", "ComplainDescription")); radGridView1.Columns.Add(new GridViewTextBoxColumn("ComplaintAgainst", "ComplaintAgainst")); // radGridView1.Columns.Add(new GridViewTextBoxColumn("PhoneNumber", "PhoneNumber")); string searchTxt = txtSearch.Text.ToStr().ToLower().Trim(); string col = ddlColumns.Text.ToStr().Trim().ToLower(); if (searchTxt.Length < 3) { searchTxt = string.Empty; } bool col_ref = false; bool col_name = false; bool col_date = false; if (col == "refrence no") { col_ref = true; } if (col == "controller name") { col_name = true; } if (col == "complain date") { col_date = true; } var data1 = listOfBookingComplaints != null?listOfBookingComplaints.AsEnumerable() : General.GetQueryable <Complaint>(null).AsEnumerable(); var query = (from a in data1 where (col_ref && (a.RefNo.ToLower().Contains(searchTxt) || searchTxt == string.Empty)) || (col_name && (a.CustomerName.ToLower().Contains(searchTxt) || searchTxt == string.Empty)) || (col_date && (a.ComplainDateTime.ToStr().Contains(searchTxt) || searchTxt == string.Empty)) select new { //string.Format("{0:dd/MMM/yyyy}", a.LostDate).ToStr(), RefNo = a.RefNo, ComplainDate = " " + string.Format(" {0:dd/MM/yyyy} ", a.ComplainDateTime) + " ", CustomerName = a.CustomerName, PhoneNumber = a.CustomerPhoneNo, ComplainDescription = a.ComplainDescription, ResultDescription = a.ResultDescription, ComplaintAgainst = a.ComplaintBy == 1 ? "Driver - " + a.Fleet_Driver.DriverNo : a.ComplaintBy == 2 ? "Controller - " + a.ControllerName : "Account - " + a.Gen_Company.CompanyName }).OrderByDescending(c => c.ComplainDate).ToList(); radGridView1.RowCount = query.Count; for (int i = 0; i < query.Count; i++) { radGridView1.Rows[i].Cells["RefNo"].Value = query[i].RefNo; radGridView1.Rows[i].Cells["ComplainDate"].Value = query[i].ComplainDate; radGridView1.Rows[i].Cells["CustomerName"].Value = query[i].CustomerName; radGridView1.Rows[i].Cells["PhoneNumber"].Value = query[i].PhoneNumber; radGridView1.Rows[i].Cells["ComplaintAgainst"].Value = query[i].ComplaintAgainst; radGridView1.Rows[i].Cells["ResultDescription"].Value = query[i].ResultDescription; radGridView1.Rows[i].Cells["ComplainDescription"].Value = query[i].ComplainDescription; //radGridView1.Rows[i].Cells["PhoneNumber"].Value = query[i].PhoneNumber; } exporter = new RadGridViewExcelExporter(); BackgroundWorker worker = new BackgroundWorker(); // worker.DoWork += new DoWorkEventHandler(worker_DoWork); // worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.RunWorkerAsync(saveFileDialog1.FileName); exporter.Progress += new ProgressHandler(exportProgress); this.btnExport.Enabled = false; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
public void LoadDriverAndShifts() { try { using (TaxiDataContext db = new TaxiDataContext()) { var list2 = (from a in db.Fleet_Drivers.Where(x => x.IsActive == true) //(from a in General.GetQueryable<Fleet_Driver>(c => c.IsActive == true) // var list2 = (from a in General.GetQueryable<Fleet_Driver>(c => c.IsActive == true) select new { Id = a.Id, DriverNo = a.DriverNo, //+ "-" + a.DriverName, DriverName = a.DriverName }).ToList(); var list = (list2.AsEnumerable().OrderBy(item => item.DriverNo, new NaturalSortComparer <string>())).ToList(); grdDriver.RowCount = list.Count; for (int i = 0; i < list.Count; i++) { grdDriver.Rows[i].Cells[COLS.Id].Value = list[i].Id; grdDriver.Rows[i].Cells[COLS.DriverNo].Value = list[i].DriverNo; grdDriver.Rows[i].Cells[COLS.Driver].Value = list[i].DriverName; } var Shiftlist = (from a in db.Driver_Shifts select new { a.Id, a.ShiftName, a.FromTime, a.TillTime, a.ShiftStart, a.ShiftEnd }).OrderBy(a => a.ShiftName).ToList(); grdShift.RowCount = Shiftlist.Count; string ToDay = string.Format("{0:dddd}", DateTime.Now); DateTime StartTime = new DateTime(1900, 1, 1, DateTime.Now.Hour, DateTime.Now.Minute, 0); for (int i = 0; i < Shiftlist.Count; i++) { grdShift.Rows[i].Cells[COLS.Driver_Shift_ID].Value = Shiftlist[i].Id; grdShift.Rows[i].Cells[COLS.ShiftName].Value = Shiftlist[i].ShiftName; grdShift.Rows[i].Cells[COLS.FromTime].Value = Shiftlist[i].FromTime; grdShift.Rows[i].Cells[COLS.TillTime].Value = Shiftlist[i].TillTime; //StartShiftDay = ShowDayName(Shiftlist[i].ShiftStart.ToInt()); //EndShiftDay = ShowDayName(Shiftlist[i].ShiftEnd.ToInt()); //if ((ToDay == StartShiftDay || ToDay == EndShiftDay) && (StartTime >= Shiftlist[i].FromTime || StartTime <= Shiftlist[i].TillTime)) //{ // grdShift.Rows[i].Cells[COLS.Check].Value = true; //} //else //{ // grdShift.Rows[i].Cells[COLS.Check].Value = false; //} grdShift.Rows[i].Cells[COLS.ShiftStarts].Value = ShowDayName(Shiftlist[i].ShiftStart.ToInt()) + " " + string.Format("{0:HH:mm}", Shiftlist[i].FromTime); grdShift.Rows[i].Cells[COLS.ShiftEnds].Value = ShowDayName(Shiftlist[i].ShiftEnd.ToInt()) + " " + string.Format("{0:HH:mm}", Shiftlist[i].TillTime); } } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
//private void AddAvailability() //{ // //DateTime? becameAvail = dtpAvailDate.Value; // //DateTime? endDate = dtpEndingDate.Value; // DateTime? From = dtpFromTime.Value; // DateTime? To = dtpTOTime.Value.Value; // int? DriverShiftID = ddlShifts.SelectedValue.ToInt(); // string DriverShift = ddlShifts.SelectedItem.Text.ToStr(); // string error = string.Empty; // if (From == null) // { // error += "Required : Became Available Date"; // } // //if (To != null && To < from) // if (To < From) // { // error += "Required : TO Time must be greater than End Time"; // } // if (!string.IsNullOrEmpty(error)) // { // ENUtils.ShowMessage(error); // return; // } // GridViewRowInfo row = null; // if (grdAvailability.CurrentRow != null) // { // row = grdAvailability.CurrentRow; // } // else // { // row = grdAvailability.Rows.AddNew(); // } // row.Cells[COL_SHIFT.SHIFT_ID].Value = DriverShiftID; // row.Cells[COL_SHIFT.SHIFT].Value = DriverShift; // row.Cells[COL_SHIFT.FROMTIME].Value = From; // row.Cells[COL_SHIFT.TOTIME].Value = To; // ClearAvailability(); //} private void AddShift() { try { DateTime?From = dtpFromTime.Value; DateTime?To = dtpTOTime.Value; int? DriverShiftID = ddlShifts.SelectedValue.ToInt(); string DriverShift = ddlShifts.SelectedItem.Text.ToStr(); string error = string.Empty; if (From == null) { error += "Required : From Time"; } if (To == null) { error += "Required : To Time"; } if (DriverShiftID == 0) { error += "Required : Driver Shift"; } //if (To != null && To < from) if (To < From) { error += "Required : TO Time must be greater than End Time"; } if (!string.IsNullOrEmpty(error)) { ENUtils.ShowMessage(error); return; } GridViewRowInfo row = null; if (grdShifts.CurrentRow != null) { row = grdShifts.CurrentRow; } else { if (grdShifts.Rows.Count > 0) { for (int index = 0; index < grdShifts.Rows.Count; index++) { int?ShiftID = grdShifts.Rows[index].Cells["SHIFT_ID"].Value.ToInt(); TimeSpan TimeNow = DateTime.Now.TimeOfDay; DateTime FTime = grdShifts.Rows[index].Cells["FROMTIME"].Value.ToDateTime(); TimeSpan FromTime; FromTime = FTime.TimeOfDay; DateTime TTime = grdShifts.Rows[index].Cells["TOTIME"].Value.ToDateTime(); TimeSpan ToTime; ToTime = TTime.TimeOfDay; DateTime DTPF = dtpFromTime.Value.ToDateTime(); TimeSpan DTPFROM; DTPFROM = DTPF.TimeOfDay; DateTime DTPT = dtpTOTime.Value.ToDateTime(); TimeSpan DTPTO; DTPTO = DTPT.TimeOfDay; if (DriverShiftID == 7) { if (grdShifts.Rows.Count > 0) { ENUtils.ShowMessage("Please Remove All Driver Shift."); return; } } if (ShiftID == DriverShiftID) { ENUtils.ShowMessage("Shift Already In a List"); FormateGride(); return; } if (ToTime > DTPFROM) { ENUtils.ShowMessage("This timings already in " + grdShifts.Rows[index].Cells["SHIFT"].Value.ToString() + " Shift."); FormateGride(); return; } if (ShiftID == 7) { ENUtils.ShowMessage("Please Remove Any Time Shift"); return; } } } row = grdShifts.Rows.AddNew(); } row.Cells[COL_SHIFT.SHIFT_ID].Value = DriverShiftID; row.Cells[COL_SHIFT.SHIFT].Value = DriverShift; row.Cells[COL_SHIFT.FROMTIME].Value = From; row.Cells[COL_SHIFT.TOTIME].Value = To; ClearShift(); FormateGride(); } catch (Exception ex) { } }
public override void PopulateData() { try { string Message = string.Empty; DateTime?dtFrom = dtpFromDate.Value.ToDateorNull(); DateTime?dtTill = dtpToDate.Value.ToDateorNull(); int BookingStatusId = 0; string MonthCommencing = string.Empty; if (dtFrom.Value == null) { Message = "Required : From Date"; } if (dtTill.Value == null) { if (!string.IsNullOrEmpty(Message)) { Message = "Required : To Date"; } else { Message += Environment.NewLine;// "Required : To Date"; Message += "Required : To Date"; } } if (!string.IsNullOrEmpty(Message)) { ENUtils.ShowMessage(Message); return; } MonthCommencing = string.Format("{0:dd/MM/yyyy}", dtFrom.Value) + "-" + string.Format("{0:dd/MM/yyyy}", dtTill.Value); if (opAll.IsChecked) { BookingStatusId = 0; } if (opCompleted.IsChecked) { BookingStatusId = Enums.BOOKINGSTATUS.DISPATCHED.ToInt(); } if (opCancelled.IsChecked) { BookingStatusId = Enums.BOOKINGSTATUS.CANCELLED.ToInt(); } using (TaxiDataContext db = new TaxiDataContext()) { var list = db.stp_OperatorPrivateHireDriverRecord(ddlSubCompany.SelectedValue.ToInt(), dtFrom.Value, dtTill.Value + TimeSpan.Parse("23:59:59"), BookingStatusId, MonthCommencing).ToList(); grdLister.DataSource = list; } grdLister.Columns["Id"].IsVisible = false; grdLister.Columns["BookingNo"].IsVisible = false; grdLister.Columns["DriverId"].IsVisible = false; grdLister.Columns["MonthCommencing"].HeaderText = "Month Commencing"; grdLister.Columns["OperatorLicenceNumber"].HeaderText = "Operator Licence Number"; grdLister.Columns["OperatorLicenceNumber"].Width = 200; grdLister.Columns["MonthCommencing"].Width = 160; grdLister.Columns["OperatorName"].HeaderText = "Operator Name"; grdLister.Columns["PrivateHireLicenceNumber"].HeaderText = "Private Hire Licence Number"; grdLister.Columns["FirstName"].HeaderText = "First Name"; grdLister.Columns["OperatorName"].Width = 170; grdLister.Columns["FirstName"].Width = 150; grdLister.Columns["PrivateHireLicenceNumber"].Width = 210; //grdLister.Columns["Surname"].HeaderText = "First Name"; grdLister.Columns["Surname"].Width = 120; //grdLister.Columns["Total"].Width = 130; //grdLister.Columns["DriverNo"].Width = 120; //Active } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
void btnExportXL_Click(object sender, EventArgs e) { if (grdDriverJobsList.Rows.Count == 0) { return; } try { saveFileDialog1.Filter = "Excel File (*.xls)|*.xls|AdvExcel File (*.xlsx)|*.xlsx"; saveFileDialog1.Title = "Save File"; saveFileDialog1.FileName = "Driver Booking Stats"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { //grdLister.Columns["IsPaid"].IsVisible = false; //grdLister.Columns["Paid"].IsVisible = true; ////grdLister.Columns["btnUpdate"].IsVisible = false; //grdLister.Columns[COLS.Active].Width = 50; //grdLister.Columns[COLS.Rent].Width = 60; //grdLister.Columns[COLS.DriverNo].Width = 50; //grdLister.Columns[COLS.PreviousBalance].Width = 85; //grdLister.Columns[COLS.Adjustment].Width = 60; //grdLister.Columns[COLS.Collection].Width = 60; //grdLister.Columns[COLS.AgentCommission].Width = 70; //grdLister.Columns[COLS.OldAgentBalance].Width = 90; //grdLister.Columns[COLS.Total].Width = 45; //grdLister.Columns[COLS.Paid].Width = 35; //var row = grdLister.Rows.OrderByDescending(c => c.Cells["ToDate"].Value.ToDate()).FirstOrDefault(); //DateTime? dtCurrent = row.Cells["FromDate"].Value.ToDate(); //DateTime dtEnd = row.Cells["ToDate"].Value.ToDate(); Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[1]; string heading = string.Empty; heading = "" + string.Format("from {0:dd/MM/yyyy}", dtpFromDate.Value) + " till " + string.Format("{0:dd/MM/yyyy}", dtpTillDate.Value); ClsExportGridView obj = new ClsExportGridView(grdDriverJobsList, saveFileDialog1.FileName); obj.ApplyCellFormatting = true; obj.ApplyCustomCellFormatting = true; obj.Heading = heading; obj.ExportExcelAsync(radProgressBar1); //obj.ConditionalFormattingObject = new StyleDataRowConditionalFormattingObject(); //obj.ConditionalFormattingObject.ConditionFormattingColumnName = "Paid"; //obj.ConditionalFormattingObject.RowBackColor = Color.LightGreen; //obj.ConditionalFormattingObject.RowForeColor = Color.Black; //obj.ConditionalFormattingObject.TValue = "Paid"; //if (obj.ExportExcel()) //{ // RadDesktopAlert alert = new RadDesktopAlert(); // alert.CaptionText = "Export"; // alert.ContentText = "<html> <b><span style=font-size:medium><color=Blue>Export Successfully</span></b></html>"; // alert.Show(); //} //grdLister.Columns["IsPaid"].IsVisible = true; //grdLister.Columns["Paid"].IsVisible = false; // grdLister.Columns["IsPaid"].IsVisible = false; // grdLister.Columns["Paid"].IsVisible = true; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } finally { SetDefaultColumnSettings(); } }
void btnExport_Click(object sender, EventArgs e) { try { if (DialogResult.OK == saveFileDialog1.ShowDialog()) { if (radGridView1 == null) { InitializeExportGrid(); } radGridView1.Columns.Clear(); radGridView1.Columns.Add(new GridViewTextBoxColumn("MonthCommencing", "MonthCommencing")); radGridView1.Columns.Add(new GridViewTextBoxColumn("OperatorLicenceNumber", "OperatorLicenceNumber")); radGridView1.Columns.Add(new GridViewTextBoxColumn("OperatorName", "OperatorName")); radGridView1.Columns.Add(new GridViewTextBoxColumn("PrivateHireLicenceNumber", "PrivateHireLicenceNumber")); radGridView1.Columns.Add(new GridViewTextBoxColumn("FirstName", "FirstName")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Surname", "Surname")); // string Message = string.Empty; DateTime?dtFrom = dtpFromDate.Value.ToDateorNull(); DateTime?dtTill = dtpToDate.Value.ToDateorNull(); int BookingStatusId = 0; string MonthCommencing = string.Empty; if (dtFrom.Value == null) { Message = "Required : From Date"; } if (dtTill.Value == null) { if (!string.IsNullOrEmpty(Message)) { Message = "Required : To Date"; } else { Message += Environment.NewLine;// "Required : To Date"; Message += "Required : To Date"; } } if (!string.IsNullOrEmpty(Message)) { ENUtils.ShowMessage(Message); return; } MonthCommencing = string.Format("{0:dd/MM/yyyy}", dtFrom.Value) + "-" + string.Format("{0:dd/MM/yyyy}", dtTill.Value); if (opAll.IsChecked) { BookingStatusId = 0; } if (opCompleted.IsChecked) { BookingStatusId = Enums.BOOKINGSTATUS.DISPATCHED.ToInt(); } if (opCancelled.IsChecked) { BookingStatusId = Enums.BOOKINGSTATUS.CANCELLED.ToInt(); } // using (TaxiDataContext db = new TaxiDataContext()) { var list = db.stp_OperatorPrivateHireDriverRecord(ddlSubCompany.SelectedValue.ToInt(), dtFrom.Value, dtTill.Value + TimeSpan.Parse("23:59:59"), BookingStatusId, MonthCommencing).ToList(); // grdLister.DataSource = list; radGridView1.RowCount = list.Count; for (int i = 0; i < list.Count; i++) { radGridView1.Rows[i].Cells["MonthCommencing"].Value = list[i].MonthCommencing; radGridView1.Rows[i].Cells["OperatorLicenceNumber"].Value = list[i].OperatorLicenceNumber; radGridView1.Rows[i].Cells["OperatorName"].Value = list[i].OperatorName; radGridView1.Rows[i].Cells["PrivateHireLicenceNumber"].Value = list[i].PrivateHireLicenceNumber; radGridView1.Rows[i].Cells["FirstName"].Value = list[i].FirstName; radGridView1.Rows[i].Cells["Surname"].Value = list[i].Surname; } } ExportToExcelML export = new ExportToExcelML(this.radGridView1); export.ExportVisualSettings = true; export.HiddenColumnOption = HiddenOption.ExportAsHidden; export.HiddenColumnOption = Telerik.WinControls.UI.Export.HiddenOption.DoNotExport; export.ExcelCellFormatting += new Telerik.WinControls.UI.Export.ExcelML.ExcelCellFormattingEventHandler(export_ExcelCellFormatting); // // //radGridView1.Columns["PickupDate"].HeaderText = "Pickup Date-Time"; //radGridView1.Columns["From"].HeaderText = "Pick-up Address"; //radGridView1.Columns["To"].HeaderText = "Drop-off Address"; radGridView1.Columns["MonthCommencing"].HeaderText = "Month Commencing"; radGridView1.Columns["OperatorLicenceNumber"].HeaderText = "Operator Licence Number"; radGridView1.Columns["OperatorName"].HeaderText = "Operator Name"; radGridView1.Columns["PrivateHireLicenceNumber"].HeaderText = "Private Hire Licence Number"; radGridView1.Columns["FirstName"].HeaderText = "First Name"; //CompanyName exporter = new RadGridViewExcelExporter(); BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted); worker.RunWorkerAsync(saveFileDialog1.FileName); exporter.Progress += new ProgressHandler(exportProgress); this.btnExport.Enabled = false; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void GenerateReport() { try { bool isMissed = optMissedCalls.Checked; if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753) { dtpFromDate.Value = null; } if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753) { dtpTillDate.Value = null; } DateTime?fromDate = dtpFromDate.Value.ToDateorNull(); DateTime?tillDate = dtpTillDate.Value.ToDateorNull(); string phone = txtPhone.Text.Trim(); string name = txtName.Text.Trim().ToLower(); string Line = txtLine.Text.ToStr(); string Stn = txtStn.Text.ToStr(); var list = (from a in GeneralBLL.GetQueryable <CallHistory>(null) where (fromDate == null || a.CallDateTime.Value.Date >= fromDate) && (tillDate == null || a.CallDateTime.Value.Date <= tillDate) && (name == string.Empty || a.Name.Trim().ToLower().StartsWith(name)) && (phone == string.Empty || a.PhoneNumber.Trim() == phone) && (Line == string.Empty || a.Line == Line) && (Stn == string.Empty || a.STN == Stn) && (isMissed == false || (a.IsAccepted != null && a.IsAccepted == true)) orderby a.CallDateTime descending select new { Name = a.Name, PhoneNumber = a.PhoneNumber, CallDateTime = a.CallDateTime, Line = a.Line, STN = a.STN }).ToList(); CallHistoryBindingSource.DataSource = list; Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[6]; string address = AppVars.objSubCompany.Address; string telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo; param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Header", AppVars.objSubCompany.CompanyName.ToStr()); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo); string heading = string.Empty; if (fromDate != null && tillDate != null) { heading = string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate); } param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Criteria", heading); param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_TotalCalls", list.Count.ToStr()); CallerIdType_Configuration obj = General.GetObject <CallerIdType_Configuration>(c => c.Id != null); string DigitalCLIType = obj.DigitalCLIType.ToStr(); param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_DigitalCLIType", DigitalCLIType == "" ? "0" : DigitalCLIType); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void PrintDocument(long TransId) { try { try { List <GridViewRowInfo> rows = null; if (TransId == 0) { rows = grdDriverCommission.Rows.Where(c => c.Cells["Check"].Value.ToBool() == true).ToList(); } else { rows = grdDriverCommission.Rows.Where(c => c.Cells["CommissionId"].Value.ToLong() == TransId).ToList(); } List <long> invoiceIds = new List <long>(); if (TransId == 0) { invoiceIds = rows.Select(c => c.Cells["CommissionId"].Value.ToLong()).ToList <long>(); } else { invoiceIds = new List <long>(); invoiceIds.Add(TransId); } if (invoiceIds.Count > 0) { frmDriverCommisionTransactionExpensesReport3 frm = new frmDriverCommisionTransactionExpensesReport3(1); frm.CompanyHeader = AppVars.objSubCompany.CompanyName.ToStr().Trim(); var list = General.GetQueryable <vu_DriverCommisionExpenses2>(a => invoiceIds.Contains(a.Id)).ToList(); var list2 = General.GetQueryable <vu_FleetDriverCommissionExpense>(a => invoiceIds.Contains(a.Id)).ToList(); List <Fleet_Driver> driversList = General.GetGeneralList <Fleet_Driver>(c => c.DriverTypeId == 2); frmEmail frmEmail = new frmEmail(null, "", ""); foreach (var item in rows) { frm.DataSource = list.Where(c => c.Id == item.Cells["CommissionId"].Value.ToLong()).OrderBy(c => c.PickupDate).ToList(); frm.DataSource2 = list2.Where(c => c.CommissionId == item.Cells["CommissionId"].Value.ToLong()).OrderBy(c => c.Date).ToList(); frm.GenerateReport(); ReportPrintDocument rpt = new ReportPrintDocument(frm.reportViewer1.LocalReport); rpt.Print(); rpt.Dispose(); } } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } } catch (Exception ex) { } }
private void GenerateReport() { try { int driverid = ddl_Driver.SelectedValue.ToInt(); int vehicleId = ddlVehicle.SelectedValue.ToInt(); string Error = ""; if (driverid == 0 && !chkAllDriver.Checked) { Error = "Required : Driver"; } if (vehicleId == 0) { if (string.IsNullOrEmpty(Error)) { Error = "Required : Vehicle"; } else { Error += Environment.NewLine + "Required : Vehicle"; } } if (!string.IsNullOrEmpty(Error)) { ENUtils.ShowMessage(Error); return; } if (dtpFromDate.Value != null && dtpFromDate.Value.Value.Year == 1753) { dtpFromDate.Value = null; } if (dtpTillDate.Value != null && dtpTillDate.Value.Value.Year == 1753) { dtpTillDate.Value = null; } DateTime?fromDate = dtpFromDate.Value.ToDateorNull(); DateTime?tillDate = dtpTillDate.Value.ToDateorNull(); if (tillDate != null) { tillDate = tillDate + TimeSpan.Parse("23:59:59"); } using (TaxiDataContext db = new TaxiDataContext()) { this.stp_JobHIstoryResultBindingSource.DataSource = db.stp_JobHIstory(fromDate, tillDate, driverid, vehicleId).ToList().OrderByDescending(c => c.BookingDate); } Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[4]; string address = AppVars.objSubCompany.Address; string telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo; param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Header", AppVars.objSubCompany.CompanyName.ToStr()); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo); string heading = string.Empty; if (fromDate != null && tillDate != null) { heading = string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate); } param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Criteria", heading); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void EmailInvoices(long TransId) { bool IsSuccess = false; try { string subject = txtSubject.Text.Trim(); if (string.IsNullOrEmpty(subject)) { ENUtils.ShowMessage("Required : Email Subject"); return; } List <GridViewRowInfo> rows = null; if (TransId == 0) { rows = grdDriverCommission.Rows.Where(c => c.Cells["Check"].Value.ToBool() == true).ToList(); } else { rows = grdDriverCommission.Rows.Where(c => c.Cells["CommissionId"].Value.ToLong() == TransId).ToList(); } //List<long> invoiceIds = rows.Select(c => c.Cells["CommissionId"].Value.ToLong()).ToList<long>(); List <long> invoiceIds = new List <long>(); if (TransId == 0) { invoiceIds = rows.Select(c => c.Cells["CommissionId"].Value.ToLong()).ToList <long>(); } else { invoiceIds = new List <long>(); invoiceIds.Add(TransId); } if (invoiceIds.Count > 0) { frmDriverCommisionTransactionExpensesReport3 frm = new frmDriverCommisionTransactionExpensesReport3(1); var list = General.GetQueryable <vu_DriverCommisionExpenses2>(a => invoiceIds.Contains(a.Id)).ToList(); var list2 = General.GetQueryable <vu_FleetDriverCommissionExpense>(a => invoiceIds.Contains(a.Id)).ToList(); List <Fleet_Driver> driversList = General.GetQueryable <Fleet_Driver>(c => c.DriverTypeId == 2).ToList(); frmEmail frmEmail = new frmEmail(null, "", ""); Fleet_Driver objDriver = null; foreach (var item in rows.Where(c => c.Cells["Check"].Value.ToBool())) { frm.DataSource = list.Where(c => c.Id == item.Cells["CommissionId"].Value.ToLong()).OrderBy(c => c.PickupDate).ToList(); frm.DataSource2 = list2.Where(c => c.CommissionId == item.Cells["CommissionId"].Value.ToLong()).OrderBy(c => c.Date).ToList(); frm.GenerateReport(); objDriver = driversList.FirstOrDefault(c => c.Id == item.Cells["DriverId"].Value.ToInt()); //string email = driversList.FirstOrDefault(c => c.Id == item.Cells[COLS.Id].Value.ToInt()).DefaultIfEmpty().Email.ToStr().Trim(); string email = objDriver.Email.ToStr().Trim(); if (!string.IsNullOrEmpty(email)) { IsSuccess = frm.SendEmailInternally(frmEmail, subject, objDriver.DriverNo.ToStr().Trim(), email); } } if (frmEmail != null && frmEmail.IsDisposed == false) { frmEmail.Close(); GC.Collect(); } if (IsSuccess) { RadDesktopAlert alert = new RadDesktopAlert(); alert.ContentText = "Email has been sent successfully"; alert.Show(); } // ENUtils.ShowMessage("Email has been sent successfully"); } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void btnExportPDF_Click(object sender, EventArgs e) { try { rptfrmJobPaymentViewer frm = new rptfrmJobPaymentViewer(); DateTime?fromDate = dtpFromDate.Value.ToDateorNull(); DateTime?toDate = dtpToDate.Value.ToDateorNull(); if (fromDate != null && dtpFromTime.Value != null && dtpFromTime.Value.Value != null) { fromDate = (fromDate.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime(); } if (toDate != null && dtptilltime.Value != null && dtptilltime.Value.Value != null) { toDate = (toDate.Value.ToDate() + dtptilltime.Value.Value.TimeOfDay).ToDateTime(); } //var data1 = General.GetQueryable<Vu_BookingBase>(c => c.PaymentTypeId == Enums.PAYMENT_TYPES.CREDIT_CARD) // .OrderByDescending(c => c.PickupDateTime); int DriverId = ddlDrivers.SelectedValue.ToInt(); bool AuthCode = chkAuthCode.Checked; string Auth = ""; if (AuthCode) { Auth = "auth"; } //var data1 = General.GetQueryable<Vu_BookingBase>(c => c.PaymentTypeId == Enums.PAYMENT_TYPES.CREDIT_CARD ) // .OrderByDescending(c => c.PickupDateTime); var data1 = General.GetQueryable <Vu_BookingBase>(c => (c.PaymentTypeId == Enums.PAYMENT_TYPES.CREDIT_CARD) && (DriverId == 0 || c.DriverId == DriverId) && (Auth != "" ? (c.AuthCode != null && c.AuthCode != "") : (c.AuthCode == "" || c.AuthCode == null || c.AuthCode != ""))) .OrderByDescending(c => c.PickupDateTime); var list = (from a in data1 where ((fromDate == null || a.PickupDateTime.Value.Date >= fromDate) && (toDate == null || a.PickupDateTime.Value.Date <= toDate)) select a).ToList(); frm.ReportHeading = "Date Range : " + string.Format("{0:dd/MM/yyyy HH:mm}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy HH:mm}", toDate); frm.DataSource = list; frm.GenerateReport(); frm.ExportReport(); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
void grdPaymentHistory_CommandCellClick(object sender, EventArgs e) { try { //if (grdPaymentHistory.CurrentRow != null && grdPaymentHistory.CurrentRow is GridViewDataRowInfo) //{ // long paymentId = grdPaymentHistory.CurrentRow.Cells["Id"].Value.ToLong(); // if (grdPaymentHistory.Rows.Count > 1 && paymentId < grdPaymentHistory.Rows.Where(c => c.Index != grdPaymentHistory.CurrentRow.Index) // .OrderByDescending((c => c.Cells["Id"].Value.ToLong())).FirstOrDefault().Cells["Id"].Value.ToLong()) // { // ENUtils.ShowMessage("Payment History will be Delete in Reverse Order"); // return; // } // else // { // decimal commissionPay=grdPaymentHistory.CurrentRow.Cells["CommissionPay"].Value.ToDecimal(); // using (TaxiDataContext db = new TaxiDataContext()) // { // db.stp_UpdateDriverCommissionPayment(CommissionId, paymentId, commissionPay); // } // grdPaymentHistory.CurrentRow.Delete(); // DisplayRecord(); // } //} GridCommandCellElement gridCell = (GridCommandCellElement)sender; if (gridCell.ColumnInfo.Name.ToLower() == "btndelete") { if (DialogResult.Yes == RadMessageBox.Show("Are you sure you want to delete a Record ? ", "", MessageBoxButtons.YesNo, RadMessageIcon.Question)) { long Id = grdPaymentHistory.CurrentRow.Cells["Id"].Value.ToLong(); if (grdPaymentHistory.CurrentRow != null && grdPaymentHistory.CurrentRow is GridViewDataRowInfo) { if (grdPaymentHistory.Rows.Count > 1 && Id < grdPaymentHistory.Rows.Where(c => c.Index != grdPaymentHistory.CurrentRow.Index) .OrderByDescending((c => c.Cells["Id"].Value.ToLong())).FirstOrDefault().Cells["Id"].Value.ToLong()) { ENUtils.ShowMessage("Expenses History will be Delete in Reverse Order"); return; } } string Type = grdPaymentHistory.CurrentRow.Cells[COLS.Type].Value.ToStr().ToLower(); decimal Amount = grdPaymentHistory.CurrentRow.Cells[COLS.Amount].Value.ToDecimal(); decimal CurrentBalance = numCurrBalance.Value.ToDecimal(); grdPaymentHistory.CurrentRow.Delete(); if (Type == "credit") { //if (CurrentBalance > 0) //{ numCurrBalance.Value = (CurrentBalance - Amount); } else { //if (CurrentBalance > 0) //{ numCurrBalance.Value = (CurrentBalance + Amount); } objDriverCommision.GetByPrimaryKey(CommissionId); objDriverCommision.Edit(); objDriverCommision.Current.Balance = numCurrBalance.Value.ToDecimal(); objDriverCommision.Save(); using (TaxiDataContext db = new TaxiDataContext()) { var query = db.Fleet_DriverCommissionExpenses.Single(c => c.Id == Id); db.Fleet_DriverCommissionExpenses.DeleteOnSubmit(query); db.SubmitChanges(); } DisplayRecord(); } } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
public override void Print() { int driverId = ddl_Driver.SelectedValue.ToInt(); int userId = ddlController.SelectedValue.ToInt(); string userName = ddlController.Text.Trim(); DateTime?fromDate = dtpFromDate.Value.ToDate(); DateTime?tillDate = dtpTillDate.Value.ToDate(); 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 reportType = eReportType.ALL; if (optReject.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { reportType = eReportType.REJECTED; } else if (optNotAcceped.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { reportType = eReportType.NOTACCEPTED; } else if (optRecover.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { reportType = eReportType.RECOVER; } rptfrmSinBinReport frm = new rptfrmSinBinReport(); frm.DataSource = GetDataSource(driverId, reportType, fromDate, tillDate, userName); frm.Criteria = "For the Period : " + Environment.NewLine + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate); // frm.StatementType = statementType; frm.GenerateReport(); DockWindow doc = UI.MainMenuForm.MainMenuFrm.GetDockByName("rptfrmSinBinReport1"); if (doc != null) { doc.Close(); } UI.MainMenuForm.MainMenuFrm.ShowForm(frm); }