Example #1
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<费用>;

                    (masterFormKj.DisplayManager.CurrentItem as 凭证).凭证类别 = 凭证类别.付款凭证;
                    detailFormKj.UpdateContent();

                    process_pz.AddFees(masterFormKj.DisplayManager.CurrentItem as 凭证, list, detailCmKj);
                }
            }
        }
Example #2
0
        //public static void 审核(ArchiveOperationForm masterForm)
        //{
        //    if (MessageForm.ShowYesNo("是否确认审核?", "确认") == System.Windows.Forms.DialogResult.No)
        //        return;

        //    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<凭证>())
        //    {
        //        (new 凭证Dao()).Audit(rep, masterForm.DisplayManager.CurrentItem as 凭证);
        //    }
        //    masterForm.ControlManager.RaiseEntityChangedEvent(true);
        //}

        //public static void 撤销审核(ArchiveOperationForm masterForm)
        //{
        //    if (MessageForm.ShowYesNo("是否确认撤销审核?", "确认") == System.Windows.Forms.DialogResult.No)
        //        return;
        //    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<凭证>())
        //    {
        //        (new 凭证Dao()).Unaudit(rep, masterForm.DisplayManager.CurrentItem as 凭证);
        //    }
        //    masterForm.ControlManager.RaiseEntityChangedEvent(true);
        //}

        #region "凭证费用明细审核"
        //public static void 审核费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao;
        //    MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
        //    MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }

        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000")
        //    {
        //        审核不核销费用(masterForm, detailForm, windowMenuInfo);
        //    }
        //    else
        //    {
        //        RepositoryHelper.Initialize(detailCm.DisplayManagerT.CurrentEntity.费用项, detailCm.DisplayManagerT.CurrentEntity);

        //        detailCm.DisplayManagerT.CurrentEntity.费用项 = EntityBufferCollection.Instance["费用项"].Get(detailCm.DisplayManagerT.CurrentEntity.费用项编号) as 费用项;

        //        凭证费用明细 entity = detailCm.DisplayManagerT.CurrentEntity;
        //        int? 费用类别编号 = entity.收付标志 == 收付标志.收 ? entity.费用项.收入类别 : entity.费用项.支出类别;

        //        if (费用类别编号.HasValue)
        //        {
        //            费用类别 费用类别 = EntityBufferCollection.Instance["费用类别"].Get(费用类别编号.Value) as 费用类别;
        //            if (费用类别.大类 == "业务常规" || 费用类别.大类 == "业务额外")
        //            {
        //                审核业务核销费用(masterForm, detailForm, windowMenuInfo);
        //            }
        //            else
        //            {
        //                审核非业务核销费用(masterForm, detailForm, windowMenuInfo);
        //            }
        //        }
        //        else
        //        {
        //            throw new ArgumentException("无有效费用类别!");
        //        }
        //    }
        //}


        //public static void 审核不核销费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao;
        //    MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
        //    MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }
        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 != "000")
        //    {
        //        MessageForm.ShowError("此项目不为应收应付款,不能核销!");
        //        return;
        //    }
        //    detailCm.DisplayManagerT.CurrentEntity.审核状态 = true;
        //    detailCm.RaiseEntityChangedEvent(true);

        //    memoryBll.Update(detailCm.DisplayManagerT.CurrentEntity);
        //}

        //public static void 审核业务核销费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao;
        //    MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
        //    MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }
        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000")
        //    {
        //        MessageForm.ShowError("此项目为应收应付款,不能核销!");
        //        return;
        //    }

        //    ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(108)) as ArchiveCheckForm;
        //    ISearchControl fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["相关人编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.相关人编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["费用项编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.费用项编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["收付标志"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.收付标志 };
        //    fc.ReadOnly = true;

        //    if (form.ShowDialog() == DialogResult.OK)
        //    {
        //        IList<费用> list = new List<费用>();
        //        foreach (object i in form.SelectedEntites)
        //        {
        //            list.Add(i as 费用);
        //        }

        //        AddFees(masterForm.DisplayManager.CurrentItem as 凭证, list, detailCm, memoryBll, memoryBll2, false);
        //    }
        //}


        //public static void 审核非业务核销费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao;
        //    MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
        //    MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }
        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000")
        //    {
        //        MessageForm.ShowError("此项目为应收应付款,不能核销!");
        //        return;
        //    }

        //    ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(109)) as ArchiveCheckForm;
        //    ISearchControl fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["相关人编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.相关人编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["费用项编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.费用项编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["收付标志"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.收付标志 };
        //    fc.ReadOnly = true;

        //    if (form.ShowDialog() == DialogResult.OK)
        //    {
        //        IList<费用> list = new List<费用>();
        //        foreach (object i in form.SelectedEntites)
        //        {
        //            list.Add(i as 费用);
        //        }

        //        AddFees(masterForm.DisplayManager.CurrentItem as 凭证, list, detailCm, memoryBll, memoryBll2, false);
        //    }
        //}

        //public static void 清空审核数据(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao;
        //    MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
        //    MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }

        //    if (MessageForm.ShowYesNo("是否要清空审核数据?", "确认") == DialogResult.No)
        //    {
        //        return;
        //    }

        //    RepositoryHelper.Initialize(detailCm.DisplayManagerT.CurrentEntity.费用, detailCm.DisplayManagerT.CurrentEntity);
        //    foreach (费用 i in detailCm.DisplayManagerT.CurrentEntity.费用)
        //    {
        //        i.凭证费用明细 = null;
        //        memoryBll2.Delete(i);
        //    }
        //    detailCm.DisplayManagerT.CurrentEntity.费用.Clear();

        //    detailCm.DisplayManagerT.CurrentEntity.审核状态 = false;
        //    detailCm.RaiseEntityChangedEvent(true);

        //    memoryBll.Update(detailCm.DisplayManagerT.CurrentEntity);
        //}
        #endregion

        public static void 新增成本发票(ArchiveOperationForm masterForm)
        {
            ArchiveDetailForm form = Feng.Windows.Utils.ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("非业务财务_成本发票"), null);

            form.ControlManager.AddNew();
            form.UpdateContent();
            form.ControlManager.DisplayManager.DataControls["金额"].SelectedDataValue  = masterForm.ControlManager.DisplayManager.DataControls["金额.数额"].SelectedDataValue;
            form.ControlManager.DisplayManager.DataControls["凭证号"].SelectedDataValue = masterForm.ControlManager.DisplayManager.DataControls["凭证号"].SelectedDataValue;

            DialogResult ret = form.ShowDialog();
        }
Example #3
0
        void DataRowTemplate_EditEnded(object sender, EventArgs e)
        {
            Xceed.Grid.DataRow row = sender as Xceed.Grid.DataRow;
            if (row.Cells["费用项"].Value != null)
            {
                if (row.Cells["费用项"].Value.ToString() == "011")
                {
                    ArchiveDetailForm detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("资金票据_凭证_会计付款_固定资产"));
                    if (detailForm != null)
                    {
                        detailForm.ControlManager.AddNew();
                        detailForm.UpdateContent();
                        detailForm.DisplayManager.DataControls["购入金额"].SelectedDataValue = row.Cells["金额"].Value;
                        Hd.Model.Kj.固定资产 entity = detailForm.DisplayManager.CurrentItem as Hd.Model.Kj.固定资产;
                        if (this.DisplayManager.DataControls["日期"].SelectedDataValue != null)
                        {
                            entity.购入时间 = (DateTime)this.DisplayManager.DataControls["日期"].SelectedDataValue;
                        }
                        else
                        {
                            entity.购入时间 = System.DateTime.Today;
                        }

                        detailForm.ShowDialog();
                    }
                }
                else if (row.Cells["费用项"].Value.ToString() == "012")
                {
                    ArchiveDataControlForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("资金票据_凭证_会计付款_结算期限")) as ArchiveDataControlForm;
                    if (form != null)
                    {
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            row.Cells["结算期限"].Value = form.DataControls["结算期限"].SelectedDataValue;
                            row.Cells["业务分类"].Value = form.DataControls["业务分类"].SelectedDataValue;
                        }
                    }
                }
            }
        }
Example #4
0
        public static void 添加新建非业务费用(ArchiveOperationForm masterForm)
        {
            IControlManager <凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>;
            //IDao masterDao = masterForm.ControlManager.Dao;
            //MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
            //MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

            ArchiveDetailForm form = Feng.Windows.Utils.ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("非业务财务_借贷"), null);

            form.ControlManager.AddNew();

            form.UpdateContent();
            if (form.ShowDialog() == DialogResult.OK)
            {
                费用实体 entity = form.ControlManager.DisplayManager.CurrentItem as 费用实体;
                if (entity == null)
                {
                    throw new ArgumentNullException("invalid 费用实体");
                }
                AddFees(masterForm.DisplayManager.CurrentItem as 凭证, entity.费用, detailCm);
            }
        }
Example #5
0
        /// <summary>
        /// CreateWindow
        /// </summary>
        /// <param name="windowInfo"></param>
        /// <returns></returns>
        public object CreateWindow(WindowInfo windowInfo)
        {
            MyForm returnForm = null;

            switch (windowInfo.WindowType)
            {
            case WindowType.Maintain:
            case WindowType.Transaction:
            {
                returnForm = new GeneratedArchiveOperationForm(windowInfo);
            }
            break;

            case WindowType.Query:
            {
                // decide gridType
                IList <WindowTabInfo>  tabInfos    = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name);
                IList <GridColumnInfo> gridColumns = ADInfoBll.Instance.GetGridColumnInfos(tabInfos[0].GridName);
                foreach (GridColumnInfo info in gridColumns)
                {
                    if (!string.IsNullOrEmpty(info.ParentPropertyName))
                    {
                        returnForm = new GeneratedArchiveSeeForm(windowInfo, DataGridType.DataUnboundGridLoadOnce);
                    }
                }
                returnForm = new GeneratedArchiveSeeForm(windowInfo);
            }
            break;

            case WindowType.QueryBound:
            {
                returnForm = new GeneratedArchiveSeeForm(windowInfo, DataGridType.DataBoundGridLoadOnDemand);
            }
            break;

            case WindowType.TransactionBound:
            {
                returnForm = new GeneratedArchiveOperationForm(windowInfo, ArchiveGridType.ArchiveBoundGrid);
            }
            break;

            case WindowType.Select:
            {
                returnForm = new GeneratedArchiveCheckForm(windowInfo);
            }
            break;

            case WindowType.DatabaseReport:
            {
                returnForm = new GeneratedArchiveDatabaseReportForm(windowInfo);
            }
            break;

            case WindowType.DataSetReport:
            {
                returnForm = new GeneratedArchiveDataSetReportForm(windowInfo);
            }
            break;

            case WindowType.SelectWindow:
            {
                using (ArchiveSelectForm selectForm = new ArchiveSelectForm(windowInfo.Name))
                {
                    if (selectForm.ShowDialog() == DialogResult.OK)
                    {
                        returnForm = selectForm.SelectedForm;
                    }
                    else
                    {
                        returnForm = null;
                    }
                }
            }
            break;

            case WindowType.DetailTransaction:
            {
                ArchiveDetailForm form = ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo(windowInfo.Name), null);
                form.Load += new EventHandler(delegate(object sender, System.EventArgs e)
                    {
                        form.UpdateContent();
                        form.SetMenuState();
                    });
                form.SetAsMdiChild();
                //// 创建TaskPane
                //GridRelatedControl gridRelatedControl = null;
                //form.SetGridRelatedPanel(() =>
                //    {
                //        if (gridRelatedControl == null)
                //        {
                //            gridRelatedControl = new GridRelatedControl(form.GridName, form.DisplayManager, form);
                //        }
                //        return gridRelatedControl;
                //    });

                form.GenerateWindowMenu(ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name));
                form.Disposed += new EventHandler(delegate(object sender, System.EventArgs e)
                    {
                        form.DisposeWindowMenu();
                    });
                returnForm = form;
            }
            break;

            case WindowType.DataControl:
            {
                returnForm = new GeneratedArchiveDataControlForm(windowInfo);
            }
            break;

            case WindowType.ExcelOperation:
            {
                returnForm = new GeneratedArchiveExcelForm(windowInfo);
            }
            break;

            default:
                throw new ArgumentException("Invalid WindowType in WindowInfo");
            }

            if (WindowCreated != null)
            {
                WindowCreated(returnForm, System.EventArgs.Empty);
            }

            return(returnForm);
        }