public static void Auto油费金额计算(ArchiveSeeForm masterForm) { (masterForm.ArchiveDetailForm as ArchiveDetailFormAuto).DataControlsCreated += new EventHandler(ArchiveDetailForm_DataControlsCreated); //((masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0] as IArchiveGrid).InsertionRow.Cells["付款金额"].DoubleClick += new EventHandler(油费金额计算); //((masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0] as IArchiveGrid).InsertionRow.Cells["收款金额"].DoubleClick += new EventHandler(油费金额计算); }
//public static bool 凭证金额判断汇率(凭证 entity) //{ // if (Feng.Windows.Forms.MessageForm.ShowYesNo("当前汇率为" + entity.会计金额.Value / entity.金额.数额.Value, "确认") // == System.Windows.Forms.DialogResult.No) // { // return false; // } // else // { // return true; // } //} public static void AutoExecute(ArchiveSeeForm masterForm) { ((masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[1] as IArchiveGrid).DisplayManager.SelectedDataValueChanged += new EventHandler <SelectedDataValueChangedEventArgs>(DisplayManagerPzsfmx_SelectedDataValueChanged); ((masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0] as IArchiveGrid).DisplayManager.SelectedDataValueChanged += new EventHandler <SelectedDataValueChangedEventArgs>(DisplayManagerPzfymx_SelectedDataValueChanged); ((masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0] as IArchiveGrid).InsertionRow.EditBegun += new EventHandler(InsertionRow_EditBegun); ((masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[1] as IArchiveGrid).InsertionRow.EditBegun += new EventHandler(InsertionRow2_EditBegun); (masterForm.ArchiveDetailForm as IArchiveDetailFormAuto).DataControlsCreated += new EventHandler(ArchiveDetailForm_DataControlsCreated); }
public static void 应收应付出凭证(ArchiveSeeForm masterForm) { if (masterForm.DisplayManager.CurrentItem == null) { MessageForm.ShowError("请选择相关人!"); return; } System.Data.DataRowView row = masterForm.DisplayManager.CurrentItem as System.Data.DataRowView; IControlManager cm = (masterForm.ArchiveDetailForm as IControlManagerContainer).ControlManager; cm.AddNew(); 凭证 pz = cm.DisplayManager.CurrentItem as 凭证; pz.凭证类别 = 凭证类别.付款凭证; //row["收付标志"].ToString() == "1" ? 凭证类别.收款凭证 : 凭证类别.付款凭证; pz.自动手工标志 = 自动手工标志.手工; pz.操作人 = "会计"; pz.相关人编号 = row["相关人"].ToString(); masterForm.ShowArchiveDetailForm(); }
public static void FyDoubleClick(object sender1, EventArgs e1) { Xceed.Grid.DataCell cell = sender1 as Xceed.Grid.DataCell; Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow; //if (row.ParentGrid.ReadOnly) // return; //IBoundGrid grid = (m_masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0]; ArchiveSeeForm masterForm = cell.GridControl.FindForm() as ArchiveSeeForm; if (masterForm == null) { // 通过DetailForm来的 masterForm = (cell.GridControl.FindForm() as ArchiveDetailForm).ParentForm as ArchiveSeeForm; } ArchiveOperationForm fydjForm = masterForm.Tag as ArchiveOperationForm; //if (cell.FieldName == "拟付金额" || cell.FieldName == "拟收金额" || cell.FieldName == "费用项") { if (fydjForm == null) { if (masterForm.Name == "内贸出港_票费用") { fydjForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("内贸出港_票费用项费用登记")) as ArchiveOperationForm; } else { fydjForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("业务财务_票费用项费用登记")) as ArchiveOperationForm; } masterForm.Tag = fydjForm; Dictionary <string, object> setDatanew = new Dictionary <string, object>(); fydjForm.Tag = setDatanew; (fydjForm.ControlManager.Dao as 业务费用Dao).TransactionBeginning += new EventHandler <OperateArgs <业务费用> >(delegate(object sender, OperateArgs <业务费用> e) { if (e.Entity.费用实体 == null) { 业务费用 fy = e.Entity as 业务费用; fy.费用实体 = e.Repository.Get <费用实体>(setDatanew["费用实体"]); fy.票 = fy.费用实体 as 普通票; fy.费用项编号 = (string)setDatanew["费用项"]; } }); fydjForm.DisplayManager.SearchManager.EnablePage = false; fydjForm.DisplayManager.SearchManager.DataLoaded += new EventHandler <DataLoadedEventArgs>(delegate(object sender, DataLoadedEventArgs e) { fydjForm.TopMost = true; fydjForm.Show(); }); fydjForm.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (!masterForm.IsDisposed) { if (masterForm is ArchiveOperationForm) { //(masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Items[(masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Position] = (fydjForm.DisplayManager.CurrentItem as 费用).费用实体; (masterForm as ArchiveOperationForm).ControlManager.DisplayManager.SearchManager.ReloadItem((masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Position); (masterForm as ArchiveOperationForm).ControlManager.OnCurrentItemChanged(); } //IBoundGrid grid = (masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0]; //ISearchManager sm = grid.DisplayManager.SearchManager; //System.Data.DataTable dt = (System.Data.DataTable)sm.FindData(new List<ISearchExpression> { }, null); //foreach (System.Data.DataRow i in dt.Rows) //{ // if (i["费用项"].ToString() == setDatanew["费用项"].ToString()) // { // object save = row.Cells["Submitted"].Value; // grid.SetDataRowsIListData(i, row); // row.Cells["Submitted"].Value = save; // break; // } //} e.Cancel = true; fydjForm.Hide(); } } }); } Dictionary <string, object> setData = fydjForm.Tag as Dictionary <string, object>; setData.Clear(); //进口_额外费用_委托人 费用项双击事件 if (masterForm.Text.Equals("进口_额外费用_委托人")) { //明细窗体 if (cell.ParentColumn.Title.Equals("费用项")) { setData["费用实体"] = (Guid)row.Cells["费用实体"].Value; setData["费用项"] = (string)row.Cells["费用项"].Value; } //主窗体 else { using (var rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <费用项>()) { IList <费用项> list = (rep as Feng.NH.INHibernateRepository).List <费用项>(NHibernate.Criterion.DetachedCriteria.For <费用项>() .Add(NHibernate.Criterion.Expression.Eq("名称", cell.ParentColumn.Title))); if (list != null && list.Count > 0) { setData["费用实体"] = (row.Tag as 进口票).ID; setData["费用项"] = list[0].编号; } } } } // 票费用登记窗体 else if (row.Cells["费用实体"] != null) { setData["费用实体"] = (Guid)row.Cells["费用实体"].Value; setData["费用项"] = (string)row.Cells["费用项"].Value; if (/*cell.FieldName == "已收金额" || cell.FieldName == "应收金额" || */ cell.FieldName == "拟收金额") { setData["收付标志"] = 收付标志.收; } else if (/*cell.FieldName == "已付金额" || cell.FieldName == "应付金额" || */ cell.FieldName == "拟付金额") { setData["收付标志"] = 收付标志.付; } } // 滞箱费 else { setData["费用实体"] = (row.Tag as 费用信息).票Id; setData["费用项"] = "167"; } NameValueMappingCollection.Instance["信息_箱号_动态"].Params["@票"] = (Guid)setData["费用实体"]; NameValueMappingCollection.Instance.Reload(fydjForm.DisplayManager.Name, "信息_箱号_动态"); ISearchExpression se = SearchExpression.And(SearchExpression.Eq("费用实体.ID", (Guid)setData["费用实体"]), SearchExpression.Eq("费用项编号", (string)setData["费用项"])); if (setData.ContainsKey("收付标志")) { se = SearchExpression.And(se, SearchExpression.Eq("收付标志", setData["收付标志"])); } fydjForm.ControlManager.DisplayManager.SearchManager.LoadData(se, null); } //Dictionary<string, bool?> submitted = new Dictionary<string, bool?>(); //foreach (Xceed.Grid.DataRow i in grid.DataRows) //{ // submitted[i.Cells["费用项"].Value.ToString()] = (bool?)i.Cells["Submitted"].Value; //} //(row.GridControl as IBoundGrid).ReloadData(); //foreach (Xceed.Grid.DataRow i in grid.DataRows) //{ // i.Cells["Submitted"].Value = submitted[i.Cells["费用项"].Value.ToString()]; //} }
public static void AutoExecute(ArchiveSeeForm masterForm) { (masterForm.ArchiveDetailForm as IArchiveDetailFormAuto).DataControlsCreated += new EventHandler(ArchiveDetailForm_DataControlsCreated); }
public static void FyDoubleClick(object sender1, EventArgs e1) { Xceed.Grid.DataCell cell = sender1 as Xceed.Grid.DataCell; Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow; ArchiveSeeForm masterForm = cell.GridControl.FindForm() as ArchiveSeeForm; if (masterForm == null) { // 通过DetailForm来的 masterForm = (cell.GridControl.FindForm() as ArchiveDetailForm).ParentForm as ArchiveSeeForm; } ArchiveOperationForm fydjForm = masterForm.Tag as ArchiveOperationForm; //if (cell.FieldName == "拟付金额" || cell.FieldName == "拟收金额" || cell.FieldName == "费用项") { if (fydjForm == null) { fydjForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("业务备案_车辆产值费用_双击")) as ArchiveOperationForm; masterForm.Tag = fydjForm; Dictionary <string, object> setDatanew = new Dictionary <string, object>(); fydjForm.Tag = setDatanew; (fydjForm.ControlManager.Dao as 业务费用Dao).TransactionBeginning += new EventHandler <OperateArgs <费用> >(delegate(object sender, OperateArgs <费用> e) { if (e.Entity.费用实体 == null) { 业务费用 fy = e.Entity as 业务费用; fy.费用实体 = e.Repository.Get <费用实体>(setDatanew["费用实体"]); fy.费用项编号 = (string)setDatanew["费用项"]; fy.车辆产值 = fy.费用实体 as 车辆产值; } }); fydjForm.DisplayManager.SearchManager.EnablePage = false; fydjForm.DisplayManager.SearchManager.DataLoaded += new EventHandler <DataLoadedEventArgs>(delegate(object sender, DataLoadedEventArgs e) { fydjForm.TopMost = true; fydjForm.Show(); }); fydjForm.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (!masterForm.IsDisposed) { if (masterForm is ArchiveOperationForm) { (masterForm as ArchiveOperationForm).ControlManager.DisplayManager.SearchManager.ReloadItem((masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Position); (masterForm as ArchiveOperationForm).ControlManager.OnCurrentItemChanged(); } e.Cancel = true; fydjForm.Hide(); } else { } } }); } Dictionary <string, object> setData = fydjForm.Tag as Dictionary <string, object>; setData.Clear(); // 票费用登记窗体 if (row.Cells["费用实体"] != null) { setData["费用实体"] = (Guid)row.Cells["费用实体"].Value; setData["费用项"] = (string)row.Cells["费用项"].Value; if (/*cell.FieldName == "已收金额" || cell.FieldName == "应收金额" || */ cell.FieldName == "拟收金额") { setData["收付标志"] = 收付标志.收; } else if (/*cell.FieldName == "已付金额" || cell.FieldName == "应付金额" || */ cell.FieldName == "拟付金额") { setData["收付标志"] = 收付标志.付; } } else { throw new ArgumentException("There must be a column named 费用实体!"); } //NameValueMappingCollection.Instance["信息_箱号_动态"].Params["@票"] = (Guid)setData["费用实体"]; //NameValueMappingCollection.Instance.Reload("信息_箱号_动态"); //Feng.Windows.Forms.MyObjectPicker op = (fydjForm.MasterGrid.GetInsertionRow().Cells["任务"].CellEditorManager as Feng.Grid.Editors.MyObjectPickerEditor).TemplateControl; //string exp = "车辆产值.ID = " + ((Guid)setData["费用实体"]).ToString(); //op.SearchExpressionParam = exp; Feng.Windows.Forms.MyObjectPicker op = (fydjForm.MasterGrid.Columns["任务"].CellEditorManager as Feng.Grid.Editors.MyObjectPickerEditor).TemplateControl; string exp = "车辆产值.ID = " + ((Guid)setData["费用实体"]).ToString(); op.SearchExpressionParam = exp; ISearchExpression se = SearchExpression.And(SearchExpression.Eq("费用实体.ID", (Guid)setData["费用实体"]), SearchExpression.Eq("费用项编号", (string)setData["费用项"])); if (setData.ContainsKey("收付标志")) { se = SearchExpression.And(se, SearchExpression.Eq("收付标志", setData["收付标志"])); } fydjForm.ControlManager.DisplayManager.SearchManager.LoadData(se, new List <ISearchOrder>()); } }
public static void EditLlz(ArchiveSeeForm masterForm) { Xceed.Grid.Row row = (masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0].CurrentRow; if (row == null) { throw new InvalidUserOperationException("请选择要编辑理论值的合同费用项!"); } 合同费用项 htfyx = (row as Xceed.Grid.DataRow).Tag as 合同费用项; using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <费用理论值信息>()) { rep.Initialize(htfyx.费用理论值, htfyx); } IList <string> llzs = new List <string>(); if (htfyx.费用理论值 != null) { foreach (费用理论值信息 i in htfyx.费用理论值) { llzs.Add(i.条件); llzs.Add(i.结果); } } Hd.Service.理论值编辑.FrmEditor form = new Hd.Service.理论值编辑.FrmEditor( new Dictionary <string, string> { { "委托人编号", "人员单位_委托人" }, { "船公司编号", "人员单位_船公司" }, { "箱型编号", "备案_箱型_全部" }, { "提箱地编号", "人员单位_港区堆场" }, { "费用项编号", "费用项_全部" } }, llzs); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IList <string> ret = form.GetResult(); using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <费用理论值信息>()) { try { rep.BeginTransaction(); foreach (费用理论值信息 i in htfyx.费用理论值) { rep.Delete(i); } htfyx.费用理论值.Clear(); for (int i = 0; i < ret.Count; i += 2) { 费用理论值信息 item = new 费用理论值信息(); item.合同费用项 = htfyx; item.结果 = ret[i + 1]; item.条件 = ret[i]; item.序号 = i / 2; (new HdBaseDao <费用理论值信息>()).Save(rep, item); htfyx.费用理论值.Add(item); } rep.CommitTransaction(); } catch (Exception ex) { rep.RollbackTransaction(); ServiceProvider.GetService <IExceptionProcess>().ProcessWithNotify(ex); } } } }