private void GetDirectSalesOrderUnapproved() { int[] approvalstates = { (int)Models.ApprovalStatus.NonApproval, (int)Models.ApprovalStatus.Reject }; Business.Models.DirectSalesQueryModel dsq = new Business.Models.DirectSalesQueryModel(); dsq.ApprovalStatus = approvalstates; dsq.CheckedStatusValue = (int)Models.DirectSalesSatus.UnChecked; dsq.Edt = DateTime.Now.AddDays(1).Date; dsq.Sdt = DateTime.Now.AddYears(-10).Date; var c = this.PharmacyDatabaseService.GetDirectSalesModelByApprovalStatus(dsq, out msg).OrderByDescending(r => r.Createtime); this.dataGridView2.DataSource = new BindingCollection <Business.Models.DirectSalesModel>(c.ToList()); }
public Form_DrugInfo(Business.Models.DirectSalesQueryModel qm) { InitializeComponent(); this.toolStripTextBox1.Text = qm.Keyword; this.toolStripTextBox1.Focus(); this._DruginfoModel = qm; this.dataGridView1.AutoGenerateColumns = false; this.dataGridView1.CellDoubleClick += dataGridView1_CellDoubleClick; if (!string.IsNullOrEmpty(qm.Keyword)) { this.Search(false); } this.DialogResult = System.Windows.Forms.DialogResult.Cancel; }
void textBox3_KeyDown(object sender, KeyEventArgs e) { Business.Models.DirectSalesQueryModel dsq = new Business.Models.DirectSalesQueryModel(); dsq.Keyword = this.textBox3.Text.Trim(); if (this._PurchaseUnit == null) { MessageBox.Show("请先选择直调购货单位!"); return; } if (this._SupplyUnit == null) { MessageBox.Show("请先选择直调供货单位!"); return; } dsq.PurchaseUnitId = this._PurchaseUnit.Id; dsq.SupplyUnitId = this._SupplyUnit.Id; dsq.Keyword = this.textBox3.Text.Trim(); if (e.KeyCode != Keys.Return) { return; } using (Form_DrugInfo frm = new Form_DrugInfo(dsq)) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Business.Models.DirectSalesOrderDetailModel dsod = new Business.Models.DirectSalesOrderDetailModel { Id = Guid.NewGuid(), ProducGeneralName = frm._DI.ProductGeneralName, Dosage = frm._DI.DictionaryDosageCode, Specific = frm._DI.DictionarySpecificationCode, PermitNumber = frm._DI.LicensePermissionNumber, MeasurementUnitCode = frm._DI.DictionaryMeasurementUnitCode, FactoryName = frm._DI.FactoryName, Amount = 0, DrugInfoId = frm._DI.Id, SalePrice = 0m, SupplyPrice = 0m, SaleWholePrice = 0m, SupplyWholePrice = 0m, DirectDiffPrice = 0m }; this._ListDirectSalesDetail.Add(dsod); } } }
/// <summary> /// 直调药品过滤 /// </summary> /// <param name="m"></param> /// <returns></returns> public Models.DrugInfo[] GetDrugInfoByKeyword(Business.Models.DirectSalesQueryModel m) { var d = this.Queryable.AsEnumerable().Where(r => !r.Deleted && r.Valid); if (m.PurchaseUnitId != null) { //待处理 } if (m.SupplyUnitId != null) { //待处理 } if (!string.IsNullOrEmpty(m.Keyword)) { d = d.Where(r => r.Pinyin != null).Where(r => r.ProductGeneralName.Contains(m.Keyword) || r.Pinyin.ToUpper().Contains(m.Keyword.ToUpper())); } return(d.OrderBy(r => r.ProductGeneralName).ToArray()); }
public Business.Models.DirectSalesModel[] GetDirectSalesModelByApprovalStatus(Business.Models.DirectSalesQueryModel dsq) { var c = this.Queryable.Where(r => !r.Deleted); //是否验收状态查询 if (dsq.CheckedStatusValue >= 0) { c = c.Where(r => r.CheckStatusValue == dsq.CheckedStatusValue); } c = c.Where(r => dsq.ApprovalStatus.Contains(r.ApprovalStatusValue)).OrderBy(r => r.DocumentNumber); if (dsq.Sdt != null && dsq.Edt != null)//时间查询 { c = c.Where(r => r.CreateTime >= dsq.Sdt.Date && r.CreateTime <= dsq.Edt.Date); } if (!string.IsNullOrEmpty(dsq.DocumentNumber))//单号查询 { c = c.Where(r => r.DocumentNumber.Contains(dsq.DocumentNumber)); } var result = from i in c join j in RepositoryProvider.Db.PurchaseUnits on i.PurchaseUnitId equals j.Id where j.Deleted == false join k in RepositoryProvider.Db.SupplyUnits on i.SupplyUnitId equals k.Id where k.Deleted == false join u in RepositoryProvider.Db.Users.Include(r => r.Employee) on i.CreateUserId equals u.Id select new Business.Models.DirectSalesModel { ApprovalStatus = i.ApprovalStatusValue == 0?"未提交审批": i.ApprovalStatusValue == 1 ? "待审" : i.ApprovalStatusValue == 2 ? "审核通过" : i.ApprovalStatusValue == 4 ? "审核不通过" : "其他", Checker = i.CheckUserName, CheckMethod = i.CheckUserId == Guid.Empty ? "委托验收" : "派驻验收", Createtime = i.CreateTime, DocumentNumber = i.DocumentNumber, PurchaseUnitName = j.Name, PurchaseUnitPY = j.PinyinCode, SupplyUnitName = k.Name, SupplyUnitPY = k.PinyinCode, Invoicer = u.Employee.Name, ReceivingAddress = j.ReceiveAddress, CheckAddress = i.CheckAddress, DirectSalesOrderId = i.Id, SupplyUnitId = k.Id, PurchaseUnitId = j.Id, Memo = i.Memo, TotalSalePrice = i.DirectSalesOrderDetails.Where(r => !r.Deleted).Sum(r => r.Amount * r.SalePrice), TotalSupplyPrice = i.DirectSalesOrderDetails.Where(r => !r.Deleted).Sum(r => r.Amount * r.SupplyPrice), TotalAmount = i.DirectSalesOrderDetails.Where(r => !r.Deleted).Sum(r => r.Amount), CheckStatus = i.CheckStatusValue }; if (!string.IsNullOrEmpty(dsq.SupplyUnitKW))//供货企业关键字 { result = result.Where(r => r.SupplyUnitPY != null).Where(r => r.SupplyUnitName.Contains(dsq.SupplyUnitKW) || r.SupplyUnitPY.ToUpper().Contains(dsq.SupplyUnitKW.ToUpper())); } if (!string.IsNullOrEmpty(dsq.PurchaseUnitKW))//购货单位关键字 { result = result.Where(r => r.PurchaseUnitPY != null).Where(r => r.PurchaseUnitName.Contains(dsq.PurchaseUnitKW) || r.PurchaseUnitPY.ToUpper().Contains(dsq.PurchaseUnitKW.ToUpper())); } return(result.ToArray()); }