public async void ReportPrint(LocationLotParkingReport objPrintReport) { try { ShowLoading(true); string printerName = string.Empty; await Task.Run(() => { printerName = ObjblueToothDevicePrinting.GetBlueToothDevices(); if (printerName != string.Empty && printerName != "") { List <string> lstPritnText = new List <string>(); string reportDate = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"); lstPritnText.Add("\x1B\x21\x19" + "Parking: " + objReportUser.LocationParkingLotID.LocationParkingLotName + "\x1B\x21\x00" + "\n\n"); lstPritnText.Add("\x1B\x21\x09" + "User :"******"\x1B\x21\x00" + "\n\n"); lstPritnText.Add("\x1B\x21\x07" + " " + reportDate + "\x1B\x21\x00\n\n"); lstPritnText.Add("\x1B\x21\x07" + "From :" + objReportUser.LoginTime + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x01" + " To :" + objReportUser.LogoutTime + "\x1B\x21\x00\n\n"); if (objPrintReport.LotParkingReportList.Count > 0) { foreach (var item in objPrintReport.LotParkingReportList) { if (item.VehicleType.ToUpper() == "2W") { lstPritnText.Add("\x1B\x21\x20" + "BIKE " + "\x1B\x21\x00" + "\n"); lstPritnText.Add("\x1B\x21\x07" + " Total CheckIn :" + item.TotalIn + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + "Total CheckOut :" + item.TotalOut + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " FOC :" + item.TotalFOC + "\x1B\x15\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " Cash :" + item.TotalCash + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " EPay :" + item.TotalEpay + "\x1B\x21\x00\n"); lstPritnText.Add("" + "\n"); lstPritnText.Add("" + "\n"); } if (item.VehicleType.ToUpper() == "4W") { lstPritnText.Add("\x1B\x21\x20" + "CAR " + "\x1B\x21\x00" + "\n"); lstPritnText.Add("\x1B\x21\x07" + " Total CheckIn :" + item.TotalIn + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + "Total CheckOut :" + item.TotalOut + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " FOC :" + item.TotalFOC + "\x1B\x15\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " Cash :" + item.TotalCash + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " EPay :" + item.TotalEpay + "\x1B\x21\x00\n"); lstPritnText.Add("" + "\n"); lstPritnText.Add("" + "\n"); } } } if (objPrintReport.GetLocationLotPassesReport() != null) { var passesreport = objPrintReport.GetLocationLotPassesReport(); lstPritnText.Add("\x1B\x21\x20" + "PASS " + "\x1B\x21\x00" + "\n"); lstPritnText.Add("\x1B\x21\x07" + "Total Sold :" + passesreport.TotalSold + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " Total NFC :" + passesreport.TotalNFC + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " Cash :" + Convert.ToDecimal(passesreport.TotalCash).ToString("N2") + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " EPay :" + passesreport.TotalEPay.ToString("N2") + "\x1B\x21\x00\n"); lstPritnText.Add("" + "\n"); lstPritnText.Add("" + "\n"); } if (objPrintReport.GetLocationLotViolationReport() != null) { var violationreport = objPrintReport.GetLocationLotViolationReport(); lstPritnText.Add("\x1B\x21\x20" + "Violation " + "\x1B\x21\x00" + "\n"); lstPritnText.Add("\x1B\x21\x07" + "Warning Clamp :" + violationreport.TotalWarningClamps + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " UnPaid :" + violationreport.TotalUnPaidClamps + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " Paid :" + violationreport.TotalPaidClamps + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " Cash :" + violationreport.TotalCash.ToString("N2") + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " EPay :" + violationreport.TotalEPay.ToString("N2") + "\x1B\x21\x00\n"); lstPritnText.Add("" + "\n"); lstPritnText.Add("" + "\n"); } var objStationVehicles = objlot.GetLocationLotTotalRevenue(); lstPritnText.Add("\x1B\x21\x07" + " Total Cash :" + objStationVehicles.StationVehicleCash.ToString("N2") + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x07" + " Total EPay :" + objStationVehicles.StationVehicleEPay.ToString("N2") + "\x1B\x21\x00\n"); lstPritnText.Add("\x1B\x21\x08" + " Total Amount :" + (objStationVehicles.StationVehicleCash + objStationVehicles.StationVehicleEPay).ToString("N2") + "\x1B\x21\x00\n\n"); lstPritnText.Add("" + "\n\n"); lstPritnText.Add("" + "\n\n"); if (lstPritnText.Count > 0) { for (var l = 0; l < lstPritnText.Count; l++) { string printtext = lstPritnText[l].ToString(); if (printtext != "") { ObjblueToothDevicePrinting.PrintCommand(printerName, printtext); } } } } }); ShowLoading(false); } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ReportPage.xaml.cs", "", "ReportPrint"); } }
public async void GenerateAppReport() { try { objlot = null; if (DeviceInternet.InternetConnected()) { objReportUser = new User(); VMLocationLots objselectedlot = (VMLocationLots)pickerLocationLot.SelectedItem; if (objselectedlot != null) { objReportUser.LocationParkingLotID.LocationID.LocationID = objselectedlot.LocationID; objReportUser.LocationParkingLotID.LocationParkingLotID = objselectedlot.LocationParkingLotID; objReportUser.LocationParkingLotID.LocationParkingLotName = objselectedlot.LocationParkingLotName; objReportUser.LocationParkingLotID.LocationID.LocationName = objselectedlot.LocationName; if (pickerOperator.SelectedItem != null) { var objselectedOperator = (User)pickerOperator.SelectedItem; if (objselectedOperator.UserCode.Contains("ALL")) { var userobj = (User)App.Current.Properties["LoginUser"]; objReportUser.UserID = 0; objReportUser.UserCode = userobj.UserCode; } else { objReportUser.UserID = objselectedOperator.UserID; objReportUser.UserCode = objselectedOperator.UserCode; } } else { var userobj = (User)App.Current.Properties["LoginUser"]; objReportUser.UserID = userobj.UserID; objReportUser.UserCode = userobj.UserCode; } if (objselectedlot.LocationID == 0 && objselectedlot.LocationParkingLotID == 0 && objselectedlot.LotName == "ALL") { var userobj = (User)App.Current.Properties["LoginUser"]; objReportUser.UserID = userobj.UserID; objReportUser.UserCode = "ALL"; } } ShowLoading(true); await Task.Run(() => { if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken")) { DateTime fromDate = new DateTime(datePickerFromDate.Date.Year, datePickerFromDate.Date.Month, datePickerFromDate.Date.Day, datePickerFromTime.Time.Hours, datePickerFromTime.Time.Minutes, 0); objReportUser.LoginTime = fromDate; objReportUser.LogoutTime = new DateTime(datePickerToDate.Date.Year, datePickerToDate.Date.Month, datePickerToDate.Date.Day, datePickerToTime.Time.Hours, datePickerToTime.Time.Minutes, 0);; objlot = new LocationLotParkingReport(Convert.ToString(App.Current.Properties["apitoken"]), objReportUser); } }); if (objlot != null) { lvSummaryReports.BindingContext = objlot; lstvwStationPassesReport.BindingContext = objlot.GetLocationLotPassesReport(); lstvwStationViolationReport.BindingContext = objlot.GetLocationLotViolationReport(); StationVehicles objStationVehicles = objlot.GetLocationLotTotalRevenue(); TotalStationVehicleCash.Text = objStationVehicles.StationVehicleCash.ToString("N2"); TotalStationVehicleEpay.Text = objStationVehicles.StationVehicleEPay.ToString("N2"); } ShowLoading(false); } else { await DisplayAlert("Alert", "Please check your Internet connection", "Ok"); ShowLoading(false); } } catch (Exception ex) { dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ReportPage.xaml.cs", "", "ButtonGenerateReport_Clicked"); } }