Example #1
0
        public static void 撤销提交(ArchiveOperationForm masterForm)
        {
            调节款 tjk = masterForm.ControlManager.DisplayManager.CurrentItem as 调节款;
            if (tjk == null)
                return;

            using (IRepository rep = RepositoryFactory.GenerateRepository<调节款>())
            {
                try
                {
                    rep.BeginTransaction();
                    tjk.Submitted = false;
                    rep.Update(tjk);

                    IList<应收应付款> list = rep.Session.CreateCriteria<应收应付款>()
                        .Add(NHibernate.Criterion.Expression.Eq("应收应付源", tjk))
                        .List<应收应付款>();
                    foreach (应收应付款 i in list)
                    {
                        rep.Delete(i);
                    }
                    rep.CommitTransaction();
                }
                catch (Exception)
                {
                    rep.RollbackTransaction();
                }
            }
        }
Example #2
0
        public static void 生成凭证(ArchiveOperationForm masterForm)
        {
            IList<费用> list = GetSelectedFee4Pz(masterForm);
            if (list.Count == 0)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("请选择未出凭证的费用!");
                return;
            }

            if (!MessageForm.ShowYesNo("是否要生成选中项相应的凭证?", "确认"))
            {
                return;
            }

            ArchiveOperationForm masterFormKj = ServiceProvider.GetService<IApplication>().ExecuteAction("资金票据_凭证") as ArchiveOperationForm;
            if (masterFormKj != null)
            {
                if (masterFormKj.DoAdd())
                {
                    ArchiveDetailForm detailFormKj = masterFormKj.ArchiveDetailForm as ArchiveDetailForm;

                    IControlManager<凭证费用明细> detailCmKj = (((IArchiveDetailFormWithDetailGrids)detailFormKj).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
                    IRelationalDao masterDao = masterFormKj.ControlManager.Dao as IRelationalDao;
                    MemoryDao<凭证费用明细> memoryBll = (masterDao.GetRelationalDao(0) as IMemoriedRelationalDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
                    //MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMemoriedMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

                    process_pz.AddFees(masterFormKj.DisplayManager.CurrentItem as 凭证, list, detailCmKj);
                }
            }
        }
Example #3
0
        public static void 提交(ArchiveOperationForm masterForm)
        {
            调节款 tjk = masterForm.ControlManager.DisplayManager.CurrentItem as 调节款;
            if (tjk == null)
                return;

            using (IRepository rep = RepositoryFactory.GenerateRepository<调节款>())
            {
                try
                {
                    rep.BeginTransaction();
                    tjk.Submitted = true;
                    rep.Update(tjk);

                    rep.Initialize(tjk, tjk.调节款明细);
                    foreach (调节款明细 i in tjk.调节款明细)
                    {
                        应收应付款 j = i.Clone() as 应收应付款;
                        j.应收应付源 = tjk;
                        rep.Save(j);
                    }

                    rep.CommitTransaction();
                }
                catch (Exception)
                {
                    rep.RollbackTransaction();
                }
            }
        }
Example #4
0
        public static void 批量添加费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加非业务费用");
            if (selectForm.ShowDialog() == DialogResult.OK)
            {
                ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm;

                if (form != null && form.ShowDialog() == DialogResult.OK)
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        非业务费用 newItem = new 非业务费用();

                        if (i is 费用实体)
                        {
                            newItem.费用实体 = i as 费用实体;
                        }
                        else
                        {
                            System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                        }

                        cm.AddNew();
                        cm.DisplayManager.Items[cm.DisplayManager.Position] = newItem;
                        cm.EndEdit();

                        //string filter = "现有费用实体类型 LIKE '%" + (int)item.费用实体.费用实体类型 + ",%'";
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_非业务", filter);
                    }
                }
            }
        }
Example #5
0
        public static void 自动填备注(ArchiveOperationForm masterForm)
        {
            int successCount = 0, skipCount = 0;

            ProgressAsyncHelper asyncHelper = new ProgressAsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
                {
                    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<业务费用>())
                    {
                        rep.BeginTransaction();
                        foreach (Xceed.Grid.DataRow row in masterForm.MasterGrid.GridControl.SelectedRows)
                        {
                            if (!row.Cells["状态"].Value.ToString().Contains("95")) // 只有“未对账”的费用才会自动填备注
                            {
                                if (MessageForm.ShowYesNo("第 " + row.Cells["ID"].Value.ToString() + " 条不是未对账费用!" + Environment.NewLine
                                    + "提单号:" + row.Cells["提单号"].Value.ToString()
                                    + " 箱号:" + row.Cells["箱号"].Value.ToString()
                                    + " 费用项:" + row.Cells["费用项"].Value.ToString()
                                    + Environment.NewLine + "“是”跳过继续,“否”取消所有操作?", "提示"))
                                {
                                    skipCount++;
                                    continue;
                                }
                                else
                                {
                                    successCount = skipCount = 0;
                                    rep.RollbackTransaction();
                                    return null;
                                }
                            }

                            IList<业务费用> ywfy = (rep as Feng.NH.INHibernateRepository).List<业务费用>(NHibernate.Criterion.DetachedCriteria.For<业务费用>()
                                .Add(NHibernate.Criterion.Expression.Eq("车辆产值.ID", new Guid(row.Cells["车辆产值"].Value.ToString())))
                                .Add(NHibernate.Criterion.Expression.Eq("任务.ID", new Guid(row.Cells["任务"].Value.ToString())))
                                .Add(NHibernate.Criterion.Expression.Eq("费用项编号", row.Cells["费用项"].Value.ToString()))
                                .Add(NHibernate.Criterion.Expression.Eq("相关人编号", row.Cells["相关人"].Value.ToString()))
                                .Add(NHibernate.Criterion.Expression.Eq("金额", (decimal)row.Cells["金额"].Value)));

                            if (ywfy.Count > 1)
                            {
                                rep.RollbackTransaction();
                                throw new NullReferenceException("第 " + row.Cells["ID"].Value.ToString() + " 条对应了" + ywfy.Count + "条财务费用"
                                    + Environment.NewLine + "可能由于重复登记,请先查看删除多余记录");
                            }

                            ywfy[0].备注 += row.Cells["备注"].Value.ToString();
                            new 业务费用Dao().Update(rep, ywfy[0]);
                            successCount++;
                        }

                        rep.CommitTransaction();
                    }
                    return null;
                }),
                    new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
                    {
                        MessageForm.ShowInfo("成功" + successCount + "条, 跳过" + skipCount + "条");
                    }), masterForm, "执行");
        }
Example #6
0
 public static void 撤销车辆作业(ArchiveOperationForm masterForm)
 {
     if (masterForm.DisplayManager.CurrentItem != null)
     {
         撤销专家任务的车辆作业(masterForm.DisplayManager.CurrentItem as 专家任务);
         任务管理.ResetRowData(masterForm);
     }
 }
Example #7
0
 public static void 撤销预发送(ArchiveOperationForm masterForm)
 {
     if (masterForm.DisplayManager.CurrentItem != null)
     {
         撤销任务预发送(masterForm.DisplayManager.CurrentItem as 任务);
         ResetRowData(masterForm);
     }
 }
Example #8
0
 public static void 批量添加转账支票(ArchiveOperationForm masterForm)
 {
     frm_cw_cn_zp_addall form = new frm_cw_cn_zp_addall(true, false);
     if (form.ShowDialog() == DialogResult.OK)
     {
         masterForm.ControlManager.DisplayManager.SearchManager.LoadData(null, null);
     }
 }
Example #9
0
 public static void ResetRowData(ArchiveOperationForm masterForm)
 {
     DataUnboundGrid m_grid = masterForm.MasterGrid as DataUnboundGrid;
     if (m_grid != null)
     {
         m_grid.ResetRowData(m_grid.CurrentDataRow);
     }
 }
        public static void ReadCk(ArchiveOperationForm masterForm)
        {
            IControlManager masterCm = masterForm.ControlManager;

            if (masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue == null)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("请输入提单号!");
                return;
            }

            string tdh = masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue.ToString().Trim();
            m_nbeportGrab.SetLoginInfo(SystemProfileFile.DefaultUserProfile.GetValue("Hd.Options", "NetReadUserName", ""),
                SystemProfileFile.DefaultUserProfile.GetValue("Hd.Options", "NetReadPassword", ""));
            IList<集装箱数据> boxList = m_nbeportGrab.查询集装箱数据(ImportExportType.出口集装箱, tdh);

            if (boxList.Count <= 0)
            {
                return;
            }

            AskToReplace(masterCm, "船名航次", boxList[0].船舶英文名称 + "/" + boxList[0].航次);
            AskToReplace(masterCm, "进港地编号", NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", boxList[0].堆场区));
            AskToReplace(masterCm, "离港时间", boxList[0].进场时间);
            AskToReplace(masterCm, "提单号", boxList[0].提单号);
            AskToReplace(masterCm, "箱量", boxList.Count);

            IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

            foreach (集装箱数据 data in boxList)
            {
                bool have = false;
                foreach (Xceed.Grid.DataRow row in ((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0].DataRows)
                {
                    if (row.Cells["箱号"].Value != null && row.Cells["箱号"].Value.ToString().Trim() == data.集装箱号.Trim())
                    {
                        have = true;
                        break;
                    }
                }
                if (!have)
                {
                    出口箱 newItem = new 出口箱
                    {
                        箱号 = data.集装箱号,
                        箱型 = Feng.Utils.ConvertHelper.ChangeType(data.箱型, typeof(箱型)) as 箱型,
                        装货地编号 = (string)NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", data.堆场区),
                        进港时间 = data.Real进场时间,
                        提箱时间 = data.Real提箱时间
                    };

                    detailCm.AddNew();
                    detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = newItem;
                    detailCm.EndEdit();
                }
            }
        }
Example #11
0
        public static void 打印对账单(ArchiveOperationForm masterForm)
        {
            对账单 entity = masterForm.DisplayManager.CurrentItem as 对账单;
            if (entity == null)
            {
                MessageForm.ShowError("请选择要打印的对账单!");
                return;
            }

            ReflectionHelper.RunStaticMethod("Hd.Report", "Hd.Report.ReportPrint", "打印对账单", new object[] { entity.编号 });
        }
Example #12
0
        public static void 作废凭证(ArchiveOperationForm masterForm)
        {
            // Todo: 作废是否更新费用
            工资单 gzd = masterForm.DisplayManager.CurrentItem as 工资单;
            费用 fy = RepositoryHelper.GetByProperty<费用>("费用实体.Id", gzd.Id);
            fy.凭证费用明细 = null;
            (new 费用Bll()).Update(fy);

            凭证 pz = RepositoryHelper.GetByProperty<凭证>("凭证号", gzd.凭证号);
            pz.是否作废 = true;

            process_pz.作废凭证(pz);
        }
Example #13
0
        void TaskPane_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e)
        {
            Xceed.SmartUI.SmartItem item = sender as Xceed.SmartUI.SmartItem;
            TaskInfo info = item.Tag as TaskInfo;

            IArchiveMasterForm   seeForm  = ServiceProvider.GetService <IApplication>().ExecuteAction(info.Action.Name) as IArchiveMasterForm;
            ArchiveOperationForm operForm = seeForm as ArchiveOperationForm;

            if (seeForm == null)
            {
                MessageForm.ShowError("未能创建目标窗体!");
                return;
            }
            switch (info.TaskType)
            {
            case TaskType.Add:
                operForm.DoAdd();
                break;

            case TaskType.Edit:
                ISearchManager smSrc;
                if (m_sms.ContainsKey(info.Name))
                {
                    smSrc = m_sms[info.Name];
                }
                else
                {
                    smSrc = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(info.SearchManagerClassName, info.SearchManagerClassParams);
                }

                ISearchManager smDest = seeForm.DisplayManager.SearchManager;
                if (smSrc.GetType() == smDest.GetType())
                {
                    smDest.LoadData(SearchExpression.Parse(EntityHelper.ReplaceExpression(info.SearchExpression)), null);
                }
                else
                {
                    smSrc.EnablePage = false;
                    object dataSource = smSrc.GetData(SearchExpression.Parse(EntityHelper.ReplaceExpression(info.SearchExpression)), null);

                    IDisplayManager dm = seeForm.DisplayManager;
                    dm.SetDataBinding(dataSource, string.Empty);
                    dm.SearchManager.OnDataLoaded(new DataLoadedEventArgs(dataSource, 0));
                }
                break;

            default:
                throw new NotSupportedException("Invalide TaskType");
            }
        }
Example #14
0
        public static void 撤销托收贴现(ArchiveOperationForm masterForm)
        {
            承兑汇票 entity = masterForm.DisplayManager.CurrentItem as 承兑汇票;
            if (entity == null)
                return;
            if (entity.Submitted)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此承兑汇票已操作完全!");
                return;
            }

            if (!entity.托收贴现.HasValue)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此承兑汇票未进行托收贴现操作!");
                return;
            }

            if (!MessageForm.ShowYesNo("是否确认撤销?", "确认"))
            {
                return;
            }

            //Dictionary<string, object> saved = new Dictionary<string, object>();
            //saved["托收贴现"] = entity.托收贴现;
            //saved["出去时间"] = entity.出去时间;
            //saved["出去经手人编号"] = entity.出去经手人编号;
            //saved["经办人编号"] = entity.经办人编号;

            //entity.Submitted = false;
            //entity.托收贴现 = null;
            //entity.出去时间 = null;
            //entity.出去经手人编号 = null;
            //entity.经办人编号 = null;

            //masterForm.ControlManager.DisplayManager.DisplayCurrent();
            //masterForm.ControlManager.EditCurrent();
            //masterForm.ControlManager.EndEdit();

            entity.Submitted = false;
            entity.托收贴现 = null;
            entity.出去时间 = null;
            entity.出去经手人编号 = null;
            entity.经办人编号 = null;
            (new 承兑汇票Bll()).Update(entity);
            masterForm.ControlManager.OnCurrentItemChanged();
        }
Example #15
0
        public static void 生成费用(ArchiveOperationForm masterForm)
        {
            foreach (Xceed.Grid.DataRow row in masterForm.ActiveGrid.SelectedRows)
            {
                工资单 gzd = row.Tag as 工资单;

            }

            //frm_cw_fkpz_kj_detail form = ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetFormInfo(201)) as frm_cw_fkpz_kj_detail;
            //form.ControlManager.AddNew();
            //凭证 pz = form.ControlManager.DisplayManager.CurrentItem as 凭证;
            //pz.日期 = System.DateTime.Today;
            //pz.相关人编号 = gzd.员工编号;
            //pz.金额.数额 = gzd.工资小计;
            //pz.金额.币制编号 = "CNY";

            //form.UpdateContent();
            //form.AddFees(new List<费用> { fy });
            //form.ShowDialog();
        }
Example #16
0
        public static void 打印货代报关部委托运输联系单(ArchiveOperationForm masterForm)
        {
            进口票过程转关标志 pz = masterForm.DisplayManager.CurrentItem as 进口票过程转关标志;
            进口票 entity = pz.票;

            if (entity == null)
            {
                MessageForm.ShowError("请选择要打印的票!");
                return;
            }

            using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<进口票>())
            {
                rep.Initialize(entity.箱, entity);
            }
            MyReportForm form = new MyReportForm("报表_货代报关部委托运输联系单_进口");
            form.FillDataSet(0, new List<进口票> { entity });
            form.FillDataSet(1, entity.箱);

            form.Show();
        }
Example #17
0
        public static void 托收(ArchiveOperationForm masterForm)
        {
            承兑汇票 entity = masterForm.DisplayManager.CurrentItem as 承兑汇票;
            if (entity == null)
                return;
            if (entity.Submitted)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此承兑汇票已操作完全!");
                return;
            }
            if (entity.托收贴现.HasValue)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此承兑汇票已" + entity.托收贴现.Value + "!");
                return;
            }
            masterForm.DoEdit();

            entity.托收贴现 = 托收贴现.托收;

            masterForm.ControlManager.OnCurrentItemChanged();
        }
Example #18
0
        public static void 批量添加内贸出港费用(ArchiveOperationForm masterForm)
        {
            int cnt = 0;
            ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_内贸出港票")) as ArchiveCheckForm;
            if (form.ShowDialog() == DialogResult.OK)
            {
                foreach (object i in form.SelectedEntites)
                {
                    //普通票 entity = i as 普通票;
                    内贸出港票 entity2 = i as 内贸出港票;

                    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<内贸出港票>())
                    {
                        rep.Initialize(entity2.箱, entity2);

                        cnt += 批量生成费用(rep, 15/*费用实体类型.内贸出港*/, entity2, entity2.箱, null, null);
                    }
                }

                MessageForm.ShowInfo("已生成" + cnt + "条收款费用!");
            }
        }
Example #19
0
        public static void 作废支票(ArchiveOperationForm masterForm)
        {
            支票 entity = masterForm.DisplayManager.CurrentItem as 支票;
            if (entity == null)
                return;
            if (entity.Submitted)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此支票不能作废!");
                return;
            }
            if (entity.是否作废)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此支票已作废!");
                return;
            }

            masterForm.DoEdit();

            entity.是否作废 = true;

            masterForm.ControlManager.OnCurrentItemChanged();
        }
Example #20
0
        public static void 生成收款相应费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.MasterGrid.GridControl.SelectedRows.Count == 0)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("请选择付款费用!");
                return;
            }
            if (!MessageForm.ShowYesNo("是否要生成选中项相应的收款费用?", "确认"))
            {
                return;
            }

            int cnt = 0;
            using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<业务费用>())
            {
                foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
                {
                    Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                    if (dataRow == null)
                        continue;

                    业务费用 entity = dataRow.Tag as 业务费用;
                    if (entity.收付标志 == 收付标志.收)
                        continue;

                    rep.Initialize(entity.票, entity);

                    业务费用 item = new 业务费用();
                    item.收付标志 = 收付标志.收;
                    item.费用实体 = entity.费用实体;
                    item.费用项编号 = entity.费用项编号;
                    //item.费用信息 = entity.费用信息;
                    item.费用类别编号 = entity.费用类别编号;
                    item.金额 = entity.金额;
                    item.箱Id = entity.箱Id;
                    item.相关人编号 = entity.票.委托人编号;
                    item.票 = entity.票;
                    item.箱 = entity.箱;

                    object newEntity = masterForm.ControlManager.AddNew();
                    if (newEntity != null)
                    {
                        masterForm.ControlManager.DisplayManager.Items[masterForm.ControlManager.DisplayManager.Position] = item;
                        masterForm.ControlManager.EndEdit();
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = dataRow.Cells["费用项编号"].CellEditorManager;
                        cnt++;
                    }
                    else
                    {
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }
            MessageForm.ShowInfo("已生成" + cnt + "条收款费用!");
        }
Example #21
0
 public static void AutoExecute(ArchiveOperationForm masterForm)
 {
     masterForm.MasterGrid.DataRowTemplate.BeginningEdit += new System.ComponentModel.CancelEventHandler(DataRowTemplate_BeginningEdit);
 }
Example #22
0
        public static void 批量添加进口费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口票")) as ArchiveCheckForm;

            if (form != null && form.ShowDialog() == DialogResult.OK)
            {
                foreach (object i in form.SelectedEntites)
                {
                    业务费用 item = new 业务费用();
                    if (i is 普通票)
                    {
                        item.票 = i as 普通票;
                        item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 };
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                    }

                    object entity = cm.AddNew();
                    if (entity != null)
                    {
                        cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                        cm.EndEdit();
                    }
                    else
                    {
                        // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }
        }
Example #23
0
        public static void 批量添加进口箱费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口箱")) as ArchiveCheckForm;

            if (form != null && form.ShowDialog() == DialogResult.OK)
            {
                foreach (object i in form.SelectedEntites)
                {
                    业务费用 item = new 业务费用();
                    if (i is 普通箱)
                    {
                        普通箱 xiang = i as 普通箱;

                        // it must have piao
                        item.票 = xiang.GetType().InvokeMember("票",
                            BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, xiang, null) as 普通票;

                        item.箱 = (i == null ? null : xiang);
                        item.箱Id = i == null ? null : (Guid?)xiang.ID;
                        item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 };
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                    }

                    object entity = cm.AddNew();
                    if (entity != null)
                    {
                        cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                        cm.EndEdit();
                    }
                    else
                    {
                        // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }
        }
Example #24
0
        public static void 撤销操作支票(ArchiveOperationForm masterForm)
        {
            支票 entity = masterForm.DisplayManager.CurrentItem as 支票;
            if (entity == null)
                return;
            if (!entity.Submitted && !entity.是否作废)
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此支票未进行操作!");
                return;
            }

            if (entity.Submitted && !string.IsNullOrEmpty(entity.支付凭证号))
            {
                ServiceProvider.GetService<IMessageBox>().ShowWarning("此支票已支付!");
                return;
            }

            if (!MessageForm.ShowYesNo("是否确认撤销?", "确认"))
            {
                return;
            }

            Dictionary<string, object> saved = new Dictionary<string, object>();
            saved["日期"] = entity.日期;

            if (entity is 转账支票)
            {
                saved["入款账户编号"] = (entity as 转账支票).入款账户编号;
            }

            entity.Submitted = false;
            entity.是否作废 = false;
            entity.日期 = null;

            masterForm.ControlManager.Dao.Update(entity);

            // 不能采用这种方式,EndEdit()会把界面上的值保存到Entity中
            //masterForm.ControlManager.EditCurrent();
            //masterForm.ControlManager.EndEdit();

            masterForm.ControlManager.OnCurrentItemChanged();
        }
Example #25
0
        ///// <summary>
        ///// 应收调节款
        ///// </summary>
        ///// <param name="masterForm"></param>
        ///// <param name="detailForm"></param>
        //public static void 选择应收调节款箱(ArchiveOperationForm masterForm)
        //{
        //    ArchiveSelectForm selectForm = new ArchiveSelectForm("调节款");
        //    if (selectForm.ShowDialog() == DialogResult.OK)
        //    {
        //        ArchiveCheckForm checkForm = selectForm.SelectedForm as ArchiveCheckForm;
        //        Dictionary<string, object> dict = new Dictionary<string, object>();
        //        dict["相关人编号"] = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue;
        //        ArchiveCheckForm form = ProcessSelect.Execute(masterForm.ArchiveDetailForm.ControlManager.DisplayManager, checkForm, dict);
        //        if (form != null)
        //        {
        //            IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;
        //            using (var rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<业务费用>())
        //            {
        //                foreach (object i in form.SelectedEntites)
        //                {
        //                    业务费用 item = new 业务费用();
        //                    DataRow row = i as DataRowView;
        //                    item.箱Id = (Guid)row["箱"];
        //                    item.箱 = rep.Session.Get<普通箱>((Guid)row["箱"]);
        //                    item.票 = rep.Session.Get<普通票>((Guid)row["票"]);
        //                    item.费用实体 = item.票;
        //                    item.相关人编号 = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue.ToString();
        //                    item.费用项编号 = "146";    // 调节业务款
        //                    item.收付标志 = 收付标志.收;
        //                    detailCm.AddNew();
        //                    detailCm.SetItem(detailCm.DisplayManager.Position, item);
        //                    detailCm.EndEdit();
        //                }
        //            }
        //        }
        //    }
        //}
        public static void 选择内贸出港应收对账单费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue == null)
            {
                MessageForm.ShowError("请先填写费用项编号!");
                return;
            }
            if (masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue == null)
            {
                MessageForm.ShowError("请先填写相关人编号!");
                return;
            }
            masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].ReadOnly = true;
            masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].ReadOnly = true;
            EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "费用项编号", masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue);
            EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "相关人编号", masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue);

            string type = (string)masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue;
            ArchiveCheckForm form = null;

            Dictionary<string, object> dict = new Dictionary<string, object>();
            dict["相关人编号"] = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue;
            if (type ==  "000")
            {
                form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_内贸出港_应收对账单_常规费用", dict);
            }
            else if (type == "001")
            {
                form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_内贸出港_应收对账单_额外费用", dict);
            }

            if (form != null)
            {
                IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

                foreach (object i in form.SelectedEntites)
                {
                    业务费用 item = i as 业务费用;
                    item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单;
                    detailCm.AddNew();
                    detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                    detailCm.EndEdit();
                }
            }
        }
Example #26
0
 private static IList<费用> GetSelectedFee4Pz(ArchiveOperationForm masterForm)
 {
     IList<费用> list = new List<费用>();
     foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
     {
         Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
         if (dataRow == null)
             continue;
         业务费用 item = dataRow.Tag as 业务费用;
         if (item.凭证费用明细 == null && item.对账单 == null)
         {
             // 界面之间跳转的,不共用数据,用复制数据,这样数据不会搞混
             // 例如这里,生成凭证,费用的凭证费用明细字段设置了,但如果凭证地方取消,凭证费用明细字段却没清空
             // 如果是用公用数据的话,会对这里产生影响。
             list.Add(item.Clone() as 业务费用);
         }
     }
     return list;
 }
Example #27
0
        private static bool InternalExecuteWindowMenu2(IControlManager cm, WindowMenuInfo info, Form parentForm)
        {
            object entity = cm.DisplayManager.CurrentItem;
            int    pos    = cm.DisplayManager.Position;

            //ArchiveOperationForm opForm = masterForm as ArchiveOperationForm;
            switch (info.Type)
            {
            case WindowMenuType.Add:
            {
                ArchiveOperationForm.DoAddS(cm);
            }
            break;

            case WindowMenuType.Edit:
            {
                ArchiveOperationForm.DoEditS(cm, (parentForm as IGridNamesContainer).GridNames[0]);
            }
            break;

            case WindowMenuType.Delete:
            {
                ArchiveOperationForm.DoDeleteS(cm, (parentForm as IGridNamesContainer).GridNames[0]);
            }
            break;

            case WindowMenuType.Confirm:
            {
                parentForm.ValidateChildren();
                ArchiveDetailForm.DoSaveS(cm);
            }
            break;

            case WindowMenuType.Cancel:
            {
                ArchiveDetailForm.DoCancelS(cm);
            }
            break;

            case WindowMenuType.Submit:
            {
                if (entity == null)
                {
                    MessageForm.ShowError("请选择要提交的项!");
                    return(true);
                }
                if (!MessageForm.ShowYesNo("是否确认提交?"))
                {
                    return(true);
                }

                ISubmittedEntity se = entity as ISubmittedEntity;
                if (se == null)
                {
                    throw new ArgumentException("Submit Entity should be ISubmittedEntity!");
                }
                if (string.IsNullOrEmpty(info.ExecuteParam))
                {
                    cm.EditCurrent();
                    se.Submitted = true;
                    cm.EndEdit();
                }
                else
                {
                    ISubmittedEntityDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ISubmittedEntityDao;
                    if (dao == null)
                    {
                        throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ISubmittedEntityDao!");
                    }

                    using (IRepository rep = dao.GenerateRepository())
                    {
                        try
                        {
                            se.Submitted = true;
                            rep.BeginTransaction();
                            dao.Submit(rep, entity);
                            rep.CommitTransaction();
                            cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos));
                        }
                        catch (Exception ex)
                        {
                            se.Submitted = false;
                            rep.RollbackTransaction();
                            ExceptionProcess.ProcessWithNotify(ex);
                        }
                    }
                }
            }
            break;

            case WindowMenuType.Unsubmit:
            {
                if (entity == null)
                {
                    MessageForm.ShowError("请选择要撤销提交的项!");
                    return(true);
                }
                if (!MessageForm.ShowYesNo("是否确认撤销提交?", "确认", true))
                {
                    return(true);
                }

                ISubmittedEntity se = entity as ISubmittedEntity;
                if (se == null)
                {
                    throw new ArgumentException("Submit Entity should be ISubmittedEntity!");
                }
                if (string.IsNullOrEmpty(info.ExecuteParam))
                {
                    cm.EditCurrent();
                    se.Submitted = false;
                    cm.EndEdit();
                }
                else
                {
                    ISubmittedEntityDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ISubmittedEntityDao;
                    if (dao == null)
                    {
                        throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ISubmittedEntityDao!");
                    }

                    using (IRepository rep = dao.GenerateRepository())
                    {
                        try
                        {
                            se.Submitted = false;
                            rep.BeginTransaction();
                            dao.Unsubmit(rep, entity);
                            rep.CommitTransaction();
                            cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos));
                        }
                        catch (Exception ex)
                        {
                            se.Submitted = true;
                            rep.RollbackTransaction();
                            ExceptionProcess.ProcessWithNotify(ex);
                        }
                    }
                }
            }
            break;

            case WindowMenuType.SubmitMulti:
            {
                if (cm.DisplayManager.Count == 0)
                {
                    MessageForm.ShowError("请选择要提交的项!");
                    return(true);
                }
                if (!MessageForm.ShowYesNo("是否确认提交(当前全部)?"))
                {
                    return(true);
                }

                ISubmittedEntity se = entity as ISubmittedEntity;
                if (se == null)
                {
                    throw new ArgumentException("Submit Entity should be ISubmittedEntity!");
                }
                if (string.IsNullOrEmpty(info.ExecuteParam))
                {
                    IBatchDao batchDao = cm.Dao as IBatchDao;
                    if (batchDao != null)
                    {
                        batchDao.SuspendOperation();
                    }

                    for (int i = 0; i < cm.DisplayManager.Count; ++i)
                    {
                        cm.DisplayManager.Position = i;
                        cm.EditCurrent();
                        (cm.DisplayManager.Items[i] as ISubmittedEntity).Submitted = true;
                        cm.EndEdit();
                    }

                    if (batchDao != null)
                    {
                        batchDao.ResumeOperation();
                    }
                }
                else
                {
                    ISubmittedEntityDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ISubmittedEntityDao;
                    if (dao == null)
                    {
                        throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ISubmittedEntityDao!");
                    }

                    using (IRepository rep = dao.GenerateRepository())
                    {
                        try
                        {
                            rep.BeginTransaction();
                            for (int i = 0; i < cm.DisplayManager.Count; ++i)
                            {
                                (cm.DisplayManager.Items[i] as ISubmittedEntity).Submitted = true;
                                dao.Submit(rep, cm.DisplayManager.Items[i]);
                            }
                            rep.CommitTransaction();
                            cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos));
                        }
                        catch (Exception ex)
                        {
                            se.Submitted = false;
                            rep.RollbackTransaction();
                            ExceptionProcess.ProcessWithNotify(ex);
                        }
                    }
                }
            }
            break;

            case WindowMenuType.Cancellate:
            {
                if (entity == null)
                {
                    MessageForm.ShowError("请选择要作废的项!");
                    return(true);
                }
                if (!MessageForm.ShowYesNo("是否确认作废?", "确认", true))
                {
                    return(true);
                }

                ICancellateDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(info.ExecuteParam) as ICancellateDao;
                if (dao == null)
                {
                    throw new ArgumentException("Submit windowMenuType's ExecuteParam should be ICancellateDao!");
                }
                using (IRepository rep = dao.GenerateRepository())
                {
                    try
                    {
                        rep.BeginTransaction();
                        dao.Cancellate(rep, entity);
                        rep.CommitTransaction();
                        cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos));
                    }
                    catch (Exception ex)
                    {
                        rep.RollbackTransaction();
                        ExceptionProcess.ProcessWithNotify(ex);
                    }
                }
            }
            break;

            case WindowMenuType.DaoProcess:
            {
                if (entity == null)
                {
                    MessageForm.ShowError("请选择要操作的项!");
                    return(true);
                }
                if (!MessageForm.ShowYesNo("是否要执行" + info.Text + "?"))
                {
                    return(true);
                }

                string[] ss = info.ExecuteParam.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length != 2)
                {
                    throw new ArgumentException("DaoProcess windowMenuType's ExecuteParam should be IDao;MethodName!");
                }
                IRepositoryDao dao = Feng.Utils.ReflectionHelper.CreateInstanceFromName(ss[0].Trim()) as IRepositoryDao;
                if (dao == null)
                {
                    throw new ArgumentException("DaoProcess windowMenuType's ExecuteParam's first part should be IDao!");
                }

                using (IRepository rep = dao.GenerateRepository())
                {
                    try
                    {
                        rep.BeginTransaction();
                        Feng.Utils.ReflectionHelper.RunInstanceMethod(ss[0].Trim(), ss[1].Trim(), dao, new object[] { rep, entity });
                        rep.CommitTransaction();
                        cm.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, pos));
                    }
                    catch (Exception ex)
                    {
                        rep.RollbackTransaction();
                        ExceptionProcess.ProcessWithNotify(ex);
                    }
                }
            }
            break;

            case WindowMenuType.Select:
            {
                string[] ss = info.ExecuteParam.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length == 0)
                {
                    throw new ArgumentException("WindowMenu's ExecuteParam is Invalid of WindowMenu " + info.Name);
                }
                ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(ss[0])) as ArchiveCheckForm;
                if (ss.Length > 1)
                {
                    string exp = ss[1];
                    exp = EntityHelper.ReplaceEntity(exp, new EntityHelper.GetReplaceValue(delegate(string paramName)
                        {
                            Tuple <string, object> t = EventProcessUtils.GetDataControlValue(paramName, cm.DisplayManager);
                            if (t.Item2 == null)
                            {
                                throw new InvalidUserOperationException(string.Format("请先填写{0}!", paramName));
                            }
                            cm.DisplayManager.DataControls[t.Item1].ReadOnly = true;
                            // save controlValue to entity because readonly will not save
                            EntityScript.SetPropertyValue(cm.DisplayManager.CurrentItem, t.Item1, t.Item2);

                            return(t.Item2);
                        }));
                    if (string.IsNullOrEmpty(form.DisplayManager.SearchManager.AdditionalSearchExpression))
                    {
                        form.DisplayManager.SearchManager.AdditionalSearchExpression = exp;
                    }
                    else
                    {
                        form.DisplayManager.SearchManager.AdditionalSearchExpression = "(" + form.DisplayManager.SearchManager.AdditionalSearchExpression + ") and " + exp;
                    }
                }

                int detailGridIdx = 0;
                if (ss.Length > 2)
                {
                    detailGridIdx = Feng.Utils.ConvertHelper.ToInt(ss[2]).Value;
                }
                if (form.ShowDialog(parentForm) == System.Windows.Forms.DialogResult.OK)
                {
                    IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)(parentForm as IArchiveMasterForm).ArchiveDetailForm).DetailGrids[detailGridIdx] as IArchiveGrid).ControlManager;

                    var nowList = detailCm.DisplayManager.Items;
                    foreach (object i in form.SelectedEntites)
                    {
                        if (nowList.Contains(i))
                        {
                            continue;
                        }

                        detailCm.AddNew();
                        detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = i;
                        detailCm.EndEdit();
                    }
                }
                form.Dispose();
            }
            break;

            case WindowMenuType.Input:
                throw new NotSupportedException("Not supported now!");

            case WindowMenuType.ManyToOneWindow:
            {
                if (cm.DisplayManager.CurrentItem == null)
                {
                    MessageForm.ShowInfo("无当前项,不能操作!");
                    return(true);
                }
                string[] ss = info.ExecuteParam.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length < 2)
                {
                    throw new ArgumentException("WindowMenu's ExecuteParam is Invalid of WindowMenu " + info.Name);
                }
                ArchiveDetailForm selectForm   = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(ss[0])) as ArchiveDetailForm;
                string            propertyName = ss[1];
                object            masterEntity = EntityScript.GetPropertyValue(cm.DisplayManager.CurrentItem, propertyName);
                if (masterEntity == null)
                {
                    ArchiveOperationForm.DoAddS(selectForm.ControlManager);
                    selectForm.UpdateContent();
                    if (selectForm.ShowDialog(parentForm) == System.Windows.Forms.DialogResult.OK)
                    {
                        cm.EditCurrent();
                        EntityScript.SetPropertyValue(cm.DisplayManager.CurrentItem, propertyName, selectForm.DisplayManager.CurrentItem);
                        cm.EndEdit();

                        cm.OnCurrentItemChanged();
                    }
                }
                else
                {
                    selectForm.ControlManager.AddNew();
                    selectForm.DisplayManager.Items[selectForm.DisplayManager.Position] = masterEntity;
                    selectForm.ControlManager.EndEdit(false);
                    ArchiveOperationForm.DoEditS(selectForm.ControlManager, selectForm.GridName);
                    selectForm.UpdateContent();

                    if (selectForm.ShowDialog(parentForm) == System.Windows.Forms.DialogResult.OK)
                    {
                        ((parentForm as IArchiveMasterForm).MasterGrid as IBoundGrid).ReloadData();
                    }
                }
                selectForm.Dispose();
            }
            break;

            default:
                return(false);
            }
            return(true);
        }
Example #28
0
        public static void 生成开票税(ArchiveOperationForm masterForm)
        {
            decimal sl = Convert.ToDecimal(ServiceProvider.GetService<IDefinition>().TryGetValue("开票税率"));

            if (sl == 0)
            {
                throw new InvalidUserOperationException("当前开票税率值无效!");
            }

            if (MessageForm.ShowYesNo("是否自动生成开票税?当前税率: " + sl * 100 + "%", "提示"))
            {
                int count = 0;

               try
               {
                   if (masterForm.DisplayManager.Items != null && masterForm.DisplayManager.Items.Count > 0)
                   {
                        foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
                        {
                            Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                            if (dataRow == null)
                                continue;

                            业务费用 fy = dataRow.Tag as 业务费用;

                            if ((fy.费用项编号 == "102" || fy.费用项编号 == "103") && fy.费用归属 == 费用归属.委托人 && fy.收付标志 == 收付标志.收)
                            {
                                业务费用 kps = masterForm.ControlManager.AddNew() as 业务费用;

                                kps.费用归属 = 费用归属.对外;
                                kps.收付标志 = 收付标志.付;
                                kps.相关人编号 = "900130";
                                kps.费用项编号 = "335";
                                kps.金额 = decimal.Multiply(fy.金额.Value, sl);

                                kps.费用实体 = fy.费用实体;
                                kps.车辆产值 = fy.车辆产值;
                                kps.车辆编号 = fy.车辆编号;
                                kps.任务 = fy.任务;

                                masterForm.DisplayManager.DisplayCurrent();
                                masterForm.ControlManager.EndEdit(true);
                                count++;
                            }
                        }

                        //for (int i = 0; i < masterForm.DisplayManager.Items.Count; i++)
                        //{
                        //    masterForm.DisplayManager.Position = i;
                        //    业务费用 fy = masterForm.DisplayManager.CurrentItem as 业务费用;

                        //    // 当 费用项=运费   费用归属=委托人  收款记录  生成:
                        //    // 费用归属=对外 付  相关人=税务局   费用项=开票税  金额=运费*开票税率
                        //    if (fy.费用项编号 == "102" && fy.费用归属 == 费用归属.委托人 && fy.收付标志 == 收付标志.收)
                        //    {
                        //        业务费用 kps = masterForm.ControlManager.AddNew() as 业务费用;

                        //        kps.费用归属 = 费用归属.对外;
                        //        kps.收付标志 = 收付标志.付;
                        //        kps.相关人编号 = "900130";
                        //        kps.费用项编号 = "335";
                        //        kps.金额 = decimal.Multiply(fy.金额.Value, sl);

                        //        kps.费用实体 = fy.费用实体;
                        //        kps.车辆编号 = fy.车辆编号;
                        //        kps.任务 = fy.任务;

                        //        masterForm.DisplayManager.DisplayCurrent();
                        //        masterForm.ControlManager.EndEdit(true);
                        //        count++;
                        //    }
                        //}
                    }
               }
               catch (Exception ex)
               {
                   throw new InvalidUserOperationException(ex.Message);
               }
               finally
               {
                   MessageForm.ShowInfo("已生成 " + count + " 条开票税!");
               }
            }
        }
Example #29
0
        public static void 批量添加费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加业务费用");
            if (selectForm.ShowDialog() == DialogResult.OK)
            {
                ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm;

                if (form != null && form.ShowDialog() == DialogResult.OK)
                {
                    foreach (object i in form.SelectedEntites)
                    {

                        业务费用 item = new 业务费用();
                        if (i is 普通票)
                        {
                            item.票 = i as 普通票;
                            item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 };
                        }
                        else if (i is 普通箱)
                        {
                            普通箱 xiang = i as 普通箱;

                            // it must have piao
                            item.票 = xiang.GetType().InvokeMember("票",
                                BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, xiang, null) as 普通票;

                            item.箱 = (i == null ? null : xiang);
                            item.箱Id = i == null ? null : (Guid?)xiang.ID;
                            item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 };
                        }
                        else
                        {
                            System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                        }

                        object entity = cm.AddNew();
                        if (entity != null)
                        {
                            cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                            cm.EndEdit();
                        }
                        else
                        {
                            // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                            masterForm.ControlManager.CancelEdit();
                            break;
                        }

                        //bool isPiao = (i is 普通票);
                        //string filter = "现有费用实体类型 LIKE '%" + (int)item.票.费用实体类型;
                        //if (isPiao)
                        //{
                        //    filter += ",%' AND 票 = " + isPiao;
                        //}
                        //else
                        //{
                        //    filter += ",%' AND 箱 = " + !isPiao;
                        //}
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_业务", filter);
                    }
                }
            }
        }
Example #30
0
        public static void 选择进口其他业务应收对账单费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue == null)
            {
                MessageForm.ShowError("请先填写相关人编号!");
                return;
            }
            masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].ReadOnly = true;
            EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "相关人编号", masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue);

            Dictionary<string, object> dict = new Dictionary<string, object>();
            dict["相关人编号"] = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue;
            ArchiveCheckForm form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_进口其他业务_应收对账单_费用", dict);

            if (form != null)
            {
                IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

                using (var rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<业务费用>())
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        业务费用 item = i as 业务费用;
                        item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单;
                        detailCm.AddNew();
                        detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                        detailCm.EndEdit();
                    }
                }
            }
        }
Example #31
0
        public static void 批量添加费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加业务费用");
            if (selectForm.ShowDialog() == DialogResult.OK)
            {
                ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm;

                if (form != null && form.ShowDialog() == DialogResult.OK)
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        业务费用 item = new 业务费用();
                        if (i is 车辆产值)
                        {
                            车辆产值 tang = i as 车辆产值;
                            item.车辆 = (i == null ? null : tang.车辆);
                            item.车辆编号 = i == null ? null : (Guid?)tang.车辆编号;
                            item.费用实体 = tang;
                            item.车辆产值 = tang;
                        }
                        else if (i is 任务)
                        {
                            任务 xiang = i as 任务;

                            // it must have piao
                            //item.车辆产值 = xiang.车辆产值;
                            item.任务 = (i == null ? null : xiang);
                            item.车辆 = (i == null ? null : xiang.车辆产值.车辆);
                            item.车辆编号 = i == null ? null : (Guid?)xiang.车辆产值.车辆编号;
                            item.费用实体 = xiang.车辆产值;// new 车辆产值 { ID = item.车辆产值.ID, Version = item.车辆产值.Version };
                            item.车辆产值 = xiang.车辆产值;
                        }
                        else
                        {
                            System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                        }

                        object entity = cm.AddNew();
                        if (entity != null)
                        {
                            cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                            cm.EndEdit();
                        }
                        else
                        {
                            // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                            masterForm.ControlManager.CancelEdit();
                            break;
                        }

                        //bool isPiao = (i is 普通票);
                        //string filter = "现有费用实体类型 LIKE '%" + (int)item.票.费用实体类型;
                        //if (isPiao)
                        //{
                        //    filter += ",%' AND 票 = " + isPiao;
                        //}
                        //else
                        //{
                        //    filter += ",%' AND 箱 = " + !isPiao;
                        //}
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_业务", filter);
                    }
                }
            }
        }
Example #32
0
        public static void 选择固定资产(ArchiveOperationForm masterForm)
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();
            ArchiveCheckForm form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_非业务财务_固定资产折旧", dict);

            if (form != null)
            {
                IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

                using (var rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<非业务费用>())
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        非业务费用 item = i as 非业务费用;
                        item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单;
                        detailCm.AddNew();
                        detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                        detailCm.EndEdit();
                    }

                    //foreach (object i in form.SelectedEntites)
                    //{
                    //    非业务费用 item = new 非业务费用();
                    //    DataRowView row = i as DataRowView;
                    //    item.费用实体 = rep.Get<费用实体>((Guid)row["Id"]);
                    //    item.相关人编号 = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue.ToString();
                    //    item.费用项编号 = "387";        // 固定资产折旧
                    //    item.收付标志 = 收付标志.付;

                    //    detailCm.AddNew();
                    //    detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                    //    detailCm.EndEdit();
                    //}
                }
            }
        }