惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
N
Netflix TechBlog - Medium
D
Docker
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
U
Unit 42
Recorded Future
Recorded Future
G
Google Developers Blog
T
Threatpost
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
The Blog of Author Tim Ferriss
C
Cyber Attacks, Cyber Crime and Cyber Security
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
V
Vulnerabilities – Threatpost
Project Zero
Project Zero
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
M
MIT News - Artificial intelligence
月光博客
月光博客
Spread Privacy
Spread Privacy
Know Your Adversary
Know Your Adversary
人人都是产品经理
人人都是产品经理
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Hacker News
The Hacker News
K
Kaspersky official blog
Simon Willison's Weblog
Simon Willison's Weblog
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
I
Intezer
Y
Y Combinator Blog
P
Proofpoint News Feed
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
Schneier on Security
Schneier on Security
B
Blog
Jina AI
Jina AI
V2EX - 技术
V2EX - 技术
雷峰网
雷峰网
Last Week in AI
Last Week in AI
V
V2EX
Martin Fowler
Martin Fowler
P
Palo Alto Networks Blog
Latest news
Latest news
Google DeepMind News
Google DeepMind News
L
Lohrmann on Cybersecurity
The Last Watchdog
The Last Watchdog

博客园 - 信息化建设

SAP 开发环境搭建入门 老程序员转测试 配置测试环境设置共享文件 提高团队效率 Visual Studio 2017十五项新功能体验 管理软件公司与互联网公司的区别 ERP程序开发中遇到的六种错误 ERP软件的价格设计 设计C/S架构应用程序的并发功能 C/S架构应用程序开发培训笔记 Enterprise Solution 进销存管理软件 C/S架构,支持64位系统 物流,资金流,信息流全面集成 Enterprise Solution 企业资源计划管理软件 C/S架构,支持64位系统,企业全面应用集成,制造业信息化 Enterprise Solution 3.1 企业应用开发框架 .NET ERP/CRM/MIS 开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms .NET 程序集单元测试工具 SmokeTest 应用指南 LLBL Gen Pro 5.0 企业应用开发入门 CRM/ERP 企业管理软件中常见的七种程序设计模式 解析大型.NET ERP系统 电子邮件系统帐户集成 工作流系统中的语法标记系统 通用附件管理功能改善 规范数据库表字段大小写 小写字段名全部更改为大写 Enterprise Solution 虚拟测试环境
财务模块功能中的凭证预览功能
信息化建设 · 2016-05-10 · via 博客园 - 信息化建设

当ERP的财务模块与生产,供应链模块集成时,这些模块过帐时会产生会计凭证。如果能在产生会计凭证前可预览一下凭证,那对用户而言是一个很友好的设计。如下图所示,贷项通知单过帐前,可通过预览凭证,知晓即将产生的会计凭证。

image

点击预览凭证按钮,可看到即将产生的会计凭证:

image

为达到此目的,分享一下对系统的修改。

首先是业务单据重写按钮事件,

protected override void OnPreviewVoucher(Dictionary<string, VoucherEntity> voucherList)
{
     base.OnPreviewVoucher(voucherList);
     if (_expenseRemibursementEntity.Amount > 0)
     {
         VoucherEntity voucher = _expenseRemibursementManager.CreateExpenseRemibursementVoucherForPreview( _expenseRemibursementEntity);
         if (voucher != null)
             voucherList.Add(VOUCHER_KEY, voucher);
     }
}

通过重写这个方法,基类可获取当前业务单据产生的会计凭证。产生会计凭证的方法原型如下:

public VoucherEntity CreateExpenseRemibursementVoucherForPreview(ExpenseRemibursementEntity ExpenseRemibursement)
{
     VoucherEntity voucher = null;
     using (DataAccessAdapter adapter = GetCompanyDataAccessAdapter(sessionId))
     {
          try
          {
              adapter.StartTransaction(IsolationLevel.ReadCommitted, "CreateExpenseRemibursementVoucherForPreview");
              ExpenseRemibursementEntity clonedAdjustment = (ExpenseRemibursementEntity)Shared.CloneEntity(ExpenseRemibursement);
              IFiscalPeriodManager fiscalPeriodManager = ClientProxyFactory.CreateProxyInstance<IFiscalPeriodManager>();
              ExcludeIncludeFieldsList fieldsList = new ExcludeIncludeFieldsList(false);
              fieldsList.Add(FiscalPeriodFields.Period);
              fieldsList.Add(FiscalPeriodFields.FiscalYear);
              fieldsList.Add(FiscalPeriodFields.PeriodNo);
              FiscalPeriodEntity fiscalPeriod = fiscalPeriodManager.GetValidFiscalPeriod(sessionId, clonedAdjustment.AppliedDate, fieldsList, true);
             
              clonedAdjustment.Period = fiscalPeriod.Period;
              clonedAdjustment.FiscalYear = fiscalPeriod.FiscalYear;
              clonedAdjustment.PeriodNo = fiscalPeriod.PeriodNo;
              voucher=GenerateVoucher(sessionId, clonedAdjustment);
            }
            finally
            {
                adapter.Rollback();
            }
      }
      return voucher;
}

这里有一个细节是并没有对当前的业务实体(business object)直接操作,而是对它的一个深拷贝进行操作。这样对这个拷贝的对象进行的操作都不会影响到原来的业务实体。

其次,需要增加一个MDI界面,主界面用于承载会计凭证界面,子窗体为会计凭证界面。为达到这个目的,我们将会计凭证界面作为子窗体载入到一个新创建的MDI主窗体界面中:

standardFunctionForm = null;
Form form = ComponentCommon.MainForm.GetStandardFunctionForm(primaryKeys[0]);
if (form != null)
  standardFunctionForm = form as FunctionFormBase;
standardFunctionForm.Owner = this;
standardFunctionForm.TopLevel = false;
standardFunctionForm.AutoScroll = true;
standardFunctionForm.HideBindingNavigator = true;
standardFunctionForm.HideStatusStrip = true;
standardFunctionForm.AllowAdd = false;
standardFunctionForm.AllowDelete = false;
standardFunctionForm.AllowEdit = false;
standardFunctionForm.AllowPost = false;
standardFunctionForm.SupportAdd = false;
standardFunctionForm.SupportDelete = false;
standardFunctionForm.SupportEdit = false;
standardFunctionForm.SupportApproval = false;
standardFunctionForm.SupportPost = false;
standardFunctionForm.SupportImport = false;
standardFunctionForm.SupportExport = false;
standardFunctionForm.Show();
standardFunctionForm.SaveLayoutOnClose = SaveLayouts.Never;
Dictionary<string, string> refNo = new Dictionary<string, string>();
refNo.Add(primaryKeys[1], RefNo);
standardFunctionForm.FindAndLoadData(refNo);

这里面可以看到,为什么要用一个MDI主界面来载入会计凭证窗体,是为了在不破坏原有功能的情况下,可定制它的部分功能。比如这个预览凭证窗体,不需要保存数据或过帐等操作,于是看到上面的代码中,我们将SupportEdit=false表示不需要编辑功能。

最后三句是MDI子窗体载入数据,通过传入键值对来完成数据的加载。FindAndLoadData方法会调用内部LoadData:

protected override EntityBase2 LoadData(Dictionary<string, string> refNo)
{
    base.LoadData(refNo);
    string RefNo = string.Empty;
    if (refNo.TryGetValue("RefNo", out RefNo))
    {
         IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.ExpenseRemibursementEntity);
         prefetchPath.Add(ExpenseRemibursementEntity.PrefetchPathExpenseRemibursementDetail);
         _expenseRemibursementEntity = _expenseRemibursementManager.GetExpenseRemibursement(Shared.CurrentUserSessionId, RefNo, prefetchPath);
    }
    else
    {
        _expenseRemibursementEntity = new ExpenseRemibursementEntity();
    }
    return _expenseRemibursementEntity;
}
这样我们就完成了财务模块的凭证预览功能。