// GET: Pathology/Assession public async Task <ActionResult> SampleCollectionList(WorkOrderFilter filter) { ViewBag.main_department_id = main_department_id; ViewBag.ShowInQueueBillNotPaid = new LabsDataAccess.CareSoftLabsEntities().PathKeyValuePairs.FirstOrDefault(e => e.Key_.Equals("ShowInQueueBillNotPaid")).Value; ViewBag.Accession_Status = new SelectList(db.Departments.Where(e => e.DepartmentRadPath.Equals(main_department_id)), "Id", "Department1"); var Todate = filter.ToDate.Date.AddDays(1); var workOrders = db.WorkOrders.Where(e => e.ShowInSpecimentCollection == true && (e.CreatedUtc >= filter.FromDate && e.CreatedUtc <= Todate) && e.WorkOrderTests.Any(w => w.LabTest.DepartmentRadPath.Equals(main_department_id))); if (filter.PatientId > 0) { var patientopd = db2.OpdRegisters.FirstOrDefault(e => e.Id == filter.PatientId); if (patientopd != null) { var patientOPDs = (patientopd.Patient.OpdRegisters.Select(g => g.Id)).ToList(); workOrders = db.WorkOrders.Where(e => e.WorkOrderTests.Any(w => w.LabTest.DepartmentRadPath.Equals(main_department_id)) && patientOPDs.Contains((int)e.OPDNo)); } else { workOrders.Where(e => e.Id == 0); } } else if (filter.BarCode != null && filter.BarCode.Length > 0) { //workOrders = db.WorkOrders.Where(e => e.WorkOrderTests.Equals(1)); } if (filter.AccessionStatus.Equals("Done")) { workOrders = workOrders.Where(e => e.ShowInSpecimentResultEnty == true); } else if (filter.AccessionStatus.Equals("Pending")) { workOrders = workOrders.Where(e => (e.ShowInSpecimentResultEnty == null || e.ShowInSpecimentResultEnty == false) && e.ShowInSpecimentCollection == true); } else { } if (filter.PatientType.Trim().Equals("All")) { return(PartialView(await workOrders.Where(e => e.WorkOrderTests.Any(w => w.LabTest.DepartmentRadPath.Equals(main_department_id))).OrderByDescending(e => e.Id).OrderByDescending(e => e.Id).ToListAsync())); } else { return(PartialView(await workOrders.Where(e => e.OPDType.Equals(filter.PatientType)).OrderByDescending(e => e.Id). OrderByDescending(e => e.Id).ToListAsync())); } }
public IEnumerable <WorkOrderView> GetReportData([FromBody] WorkOrderFilter value) { try { return(db.GetFilteredOrders(value)); } catch (Exception) { throw; } }
public async Task <ActionResult> RejectedSamplesList(WorkOrderFilter filter) { var Todate = filter.ToDate.Date.AddDays(1); var workOrdersTests = db.WorkOrderTests.Where(e => e.DepartmentRadPath.Equals(main_department_id) && (e.CreatedUtc >= filter.FromDate && e.CreatedUtc <= Todate) && e.WorkOrder1.Accession_Status == db.Status.FirstOrDefault(f => f.StatusValue.Equals("Rejected")).Id); if (filter.PatientId != null && filter.PatientId > 0) { workOrdersTests = workOrdersTests.Where(e => e.WorkOrder1.OPDNo == filter.PatientId); } if (filter.LabNo != null && filter.LabNo.Length > 0) { workOrdersTests = workOrdersTests.Where(e => e.WorkOrder1.LabNo == filter.LabNo); } if (filter.FinancialYear != null && filter.FinancialYear.Length > 0) { workOrdersTests = workOrdersTests.Where(e => e.WorkOrder1.Financial_Year == filter.FinancialYear); } return(PartialView(await workOrdersTests.ToListAsync())); }
//public IEnumerable<WorkOrderView> GetFilteredOrders(WorkOrderFilter filter) //{ // var query = new StringBuilder("select * from erp.v_work_orders where 1=1 "); // if (filter.StatusId.HasValue) query.Append($"and StatusId={filter.StatusId.Value} "); // if (filter.TargetDateFrom.HasValue) query.Append($"and TargetDate>='{filter.TargetDateFrom.Value}' "); // if (filter.TargetDateTo.HasValue) query.Append($"and TargetDate<='{filter.TargetDateTo.Value}' "); // query.Append(";"); //} public IEnumerable <WorkOrderView> GetFilteredOrders(WorkOrderFilter filter) { var query = new StringBuilder("select * from erp.v_work_orders where 1=1 "); if (!string.IsNullOrEmpty(filter.CustomerName)) { query.Append($"and Name like '%{filter.CustomerName}%' "); } if (!string.IsNullOrEmpty(filter.MobileNo)) { query.Append($"and MobileNo like '%{filter.MobileNo}%' "); } if (!string.IsNullOrEmpty(filter.Email)) { query.Append($"and EmailId like '%{filter.Email}%' "); } if (filter.CreatedOn.HasValue) { query.Append($"and date(Timestamp) = '{filter.CreatedOn.Value.ToString("yyyy/MM/dd")}' "); } else { if (filter.CreatedFrom.HasValue) { query.Append($"and date(Timestamp) > '{filter.CreatedFrom.Value.ToString("yyyy/MM/dd")}' "); } if (filter.CreatedTo.HasValue) { query.Append($"and date(Timestamp) < '{filter.CreatedTo.Value.ToString("yyyy/MM/dd")}' "); } } query.Append(";"); var report = dbContext.GetList <WorkOrderView>(query.ToString()); return(report); }
public async Task <IActionResult> Reports([FromBody] WorkOrderFilter model) { var result = await api.Post <WorkOrderFilter, IEnumerable <WorkOrderView> >("WorkOrder/GetReportData", model); return(Json(result)); }