收款单设计界面如下:
要求实现如下功能;
1.初始登录时候自动赋值界面上的一些值。
2.选择币别后,输入账号只能选择该币别的账号。
3选择往来单位后grid自动填充该客户该币别的应收记录。
4审核的时候,自动更新结算账户余额,并更改应收清单记录。
5反审核的时候回写到审核前状态,结算账户和应收清单记录都要。
6.可以看到该客户的历史收款记录。
客户端代码:
/// <summary> /// 收款单基类 /// </summary> class SCMShoufuKuanBaseBill : Jeez.MulEntityInput.BaseBillUI { //控件声明定义 private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txWLDW;//往来单位 private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txOrg;//组织机构 private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txDept;//部门 private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txEmployee;//业务员 private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txZH;//结算账户 private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txBibie;//币别 private Jeez.Control.JeezNumberTextBox.JeezNumberTextBox txRat;//汇率 private Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox txYBMoney;//原币金额 private Jeez.Control.JeezUltraCalendarCombo.JeezUltraCalendarCombo dtDate;//日期 private Jeez.Control.JeezGrid.JeezGrid gridZY;//明细grid private Jeez.Control.JeezUltraTabControl.JeezUltraTabControl pagecontrol1 = null;//下方页框控件 private Jeez.Control.JeezGrid.JeezGrid gridBaojiaHistory;//历史 private bool isLoading = true; //定义几个初始化常见的值 private static int BibieID = 0;//默认币别ID private static int WLDWID = 0;//默认往来单位ID private bool isSelect = true;//是否选单 /// <summary> /// 加载控件,以及控件相关事件定义 /// </summary> /// <returns></returns> public override bool LoadUI() { bool b = base.LoadUI(); if (b) { txWLDW = base.GetControlByName("JeezTextBox5") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txOrg = base.GetControlByName("JeezTextBox2") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txDept = base.GetControlByName("JeezTextBox3") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txEmployee = base.GetControlByName("JeezTextBox4") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txBibie = base.GetControlByName("JeezTextBox6") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txZH = base.GetControlByName("JeezTextBox7") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txRat = base.GetControlByName("JeezNumberTextBox1") as Jeez.Control.JeezNumberTextBox.JeezNumberTextBox; txYBMoney = base.GetControlByName("JeezCurrencyTextBox1") as Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox; dtDate = base.GetControlByName("JeezCalendarCombo1") as Jeez.Control.JeezUltraCalendarCombo.JeezUltraCalendarCombo; pagecontrol1 = base.GetControlByName("JeezTabControl1") as Jeez.Control.JeezUltraTabControl.JeezUltraTabControl; gridZY = base.GetControlByName("JeezGrid1") as Jeez.Control.JeezGrid.JeezGrid; gridBaojiaHistory = base.GetControlByName("gridRefHistory") as Jeez.Control.JeezGrid.JeezGrid; pagecontrol1.SelectedTabChanged += new Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventHandler(pagecontrol1_SelectedTabChanged); txBibie.ValueChanged +=new EventHandler(txBibie_ValueChanged); txWLDW.ValueChanged += new EventHandler(txWLDW_ValueChanged); gridZY.AfterCellUpdate += new CellEventHandler(gridZY_AfterCellUpdate); } return b; } /// <summary> /// 更改Grid的构建方式 /// </summary> /// <param name="CTL"></param> /// <param name="EOL"></param> /// <param name="IsDeleteChildEntity"></param> protected override void FillGridDataToEntity(Jeez.ControlManager.ControlHelper CTL, EntityObjectList EOL, bool IsDeleteChildEntity) { base.FillGridDataToEntity(CTL, EOL, false); } /// <summary> /// 页框轮换点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void pagecontrol1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (e.Tab.Index == 1) { if (gridBaojiaHistory != null) { if (txWLDW.Tag != null && (int)txWLDW.Tag != 0 && txBibie.Tag != null && (int)txBibie.Tag != 0) { DataTable dt = new DataTable(); DataSet ds = new DataSet(); Jeez.Core.NativeQueryCommand cmd; Jeez.Core.INativeQuery quary = Jeez.Login.RemoteCall.GetNativeQuery(); cmd = new NativeQueryCommand(); cmd.CommandText = string.Format(@"select a.BillNO as 单号,a.Date as 日期, e.Number as 客户编号,e.Name as 客户,f.Name as 币别, a.Rate as 汇率, a.Amount as 金额 from jzShoukuanBill a left join jzRefUnit e on e.ID=a.RefUnitID left join jzCurrency f on f.ID=a.CurrencyID where e.ID={0} and f.ID={1} ", (int)txWLDW.Tag, (int)txBibie.Tag); try { dt = quary.GetDataTable(this.objContext.ConnectionString, cmd); ds = new System.Data.DataSet(); ds.Tables.Add(dt); gridBaojiaHistory.DataSource = ds.Tables[0]; gridBaojiaHistory.FixCol = 3;//设置表格固定列为第三列 } catch (Exception ex) { Jeez.Common.UI.MsgBox.Show(ex.Message.ToString()); } } } } } /// <summary> /// 设置菜单控件状态 /// </summary> public override void SetMenuStatus() { base.SetMenuStatus(); } /// <summary> /// 保存前检查事件 /// </summary> /// <returns></returns> protected override bool BeforeSaveCheck() { bool b = base.BeforeSaveCheck(); if (b) { CalAmount(); } return b; } /// <summary> /// 新增事件 /// </summary> protected override void AddNew() { base.AddNew(); if (this.entityobject == null) { InitByDefine(); } } void txWLDW_ValueChanged(object sender, EventArgs e) { if (!isLoading) return; //下推过程中以下推传过来的数据为主,不然会被冲掉 if (UserData != null) return; if (!isSelect) return; FillYingshouYingfu(); } /// <summary> /// 币别变化事件,要自动算出该币别该单据的汇率,是固定汇率还是浮动汇率,还要调整子表的物料单价 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void txBibie_ValueChanged(object sender, EventArgs e) { if (!isLoading) return; //下推过程中以下推传过来的数据为主,不然会被冲掉 if (UserData != null) return; if (!isSelect) return; CalRat(); if(txBibie.Tag!=null) txZH.AutoDropdownListFilter=string.Format(@"CurrencyID={0}",(int)txBibie.Tag); FillYingshouYingfu(); } void FillYingshouYingfu() { if (txWLDW.Tag != null && txBibie.Tag != null) { EntityObjectList eol = EntityObjectFactory.GetInstance(objContext, EntityIDEnum.Yingshou).Find("RefUnitID={0} and WAmount!=0 and CurrencyID={1}", txWLDW.Tag, txBibie.Tag); this.gridZY.DeleteAllRow(); foreach (EntityObject eo in eol) { this.gridZY.InsertRow(this.gridZY.Rows.Count); Infragistics.Win.UltraWinGrid.UltraGridRow row = this.gridZY.Rows[this.gridZY.Rows.Count - 1]; row.Cells["YingshouID"].Tag = eo.PrimaryKeyValue; row.Cells["YingshouID"].Value = eo.ToString(); row.Cells["BAmount"].Value = eo.GetProperty("WAmount"); } } } /// <summary> /// 计算汇率 /// </summary> void CalRat() { if ((int)txBibie.Tag != 0 && (int)txBibie.PropertyPage.Value.IndexOf("RMB") < 0 && txBibie.PropertyPage.Value.ToString() != "") { //如果不是人民币 if (dtDate.PropertyPage.Datetime == Jeez.Core.Toolkit.GetDateTimeDefaultValue()) { Jeez.Common.UI.MsgBox.Show("请先输入单据日期,因为单据日期决定了币别汇率!"); return; } if (txOrg.Tag == null) { Jeez.Common.UI.MsgBox.Show("请先输入组织机构,因为汇率不同组织机构可能都有差异!"); return; } EntityObjectFactory eofBibi = EntityObjectFactory.GetInstance(objContext, EntityIDEnum.Currency); EntityObject eoBibie = eofBibi.FindObject((int)txBibie.Tag); if (eoBibie != null) { bool IsFixRat = (bool)eoBibie.GetProperty("IsFixRate"); if (IsFixRat) { //如果是固定汇率 EntityObjectList eolFixRat = eoBibie.GetChildEntityObjects(EntityIDEnum.FixedRate); EntityObject eoFixRat = eolFixRat.FindFirst("Year={0} and Period={1} and OrganizationID={2}", (int)dtDate.PropertyPage.Datetime.Year, (int)dtDate.PropertyPage.Datetime.Month, (int)txOrg.Tag); if (eoFixRat != null) { txRat.PropertyPage.Value = (decimal)eoFixRat.GetProperty("AccountBookRate"); } else { Jeez.Common.UI.MsgBox.Show("请先在系统维护,基础资料,币别中输入该币别该期间的固定汇率"); return; } } else { //如果是浮动汇率 EntityObjectList eolFixRat = eoBibie.GetChildEntityObjects(EntityIDEnum.FloatingRate); EntityObject eoFixRat = eolFixRat.FindFirst("OrganizationID={0} and ", (int)txOrg.Tag, dtDate.PropertyPage.Datetime); if (eoFixRat != null) { txRat.PropertyPage.Value = (decimal)eoFixRat.GetProperty("FloatRate"); } else { Jeez.Common.UI.MsgBox.Show("请先在系统维护,基础资料,币别中输入该币别该期间的浮动汇率"); return; } } } } else { txRat.PropertyPage.Value = 1.0m; } } /// <summary> /// 单元格值变化事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void gridZY_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (!isLoading) return; //下推过程中以下推传过来的数据为主,不然会被冲掉 if (UserData != null) return; if (!isSelect) return; if (e.Cell.Column.Key.ToLower() == "wamount") { e.Cell.Row.Cells["BAmount"].Value = e.Cell.Value; } if (e.Cell.Column.Key.ToLower() == "bamount") { //计算汇总将子表的金额合计汇总到父表 CalAmount(); } } /// <summary> /// 自动计算价格汇总 /// </summary> protected virtual void CalAmount() { decimal amount = 0; if (txYBMoney != null) { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in gridZY.Rows) { amount += Convert.ToDecimal(BaseFunc.IsNull(row.Cells["BAmount"].Value, 0)); } txYBMoney.PropertyPage.Value = amount; } } /// <summary> /// 弹出窗体事件, /// </summary> /// <param name="sender"></param> /// <param name="EntityID"></param> /// <param name="RunTimeFilter"></param> protected override void ShowUISelectedForm(object sender, int EntityID, ArrayList RunTimeFilter) { //如果是往来单位表 if (EntityID == EntityIDEnum.RefUnit) { ArrayList ar = new ArrayList(); //过滤只有客户的往来单位 Jeez.Runtime.Base.General.RunTimefilterDefine fd; fd = new Jeez.Runtime.Base.General.RunTimefilterDefine("{jzRefUnit.IsCustomer}", 0, 0, Jeez.FormProperty.FilterDefineCompare.Equals, Jeez.FormProperty.FilterDefineLogic.NONE, 1); ar.Add(fd); base.ShowUISelectedForm(sender, EntityID, ar); } //如果是账户 else if (EntityID == EntityIDEnum.BankAcount) { ArrayList ar = new ArrayList(); //过滤只有客户的往来单位 Jeez.Runtime.Base.General.RunTimefilterDefine fd; fd = new Jeez.Runtime.Base.General.RunTimefilterDefine("{jzBankAcount.CurrencyID}", 0, 0, Jeez.FormProperty.FilterDefineCompare.Equals, Jeez.FormProperty.FilterDefineLogic.NONE, (int)txBibie.Tag); ar.Add(fd); base.ShowUISelectedForm(sender, EntityID, ar); } else if (EntityID == EntityIDEnum.Yingshou) { ArrayList ar = new ArrayList(); //过滤只有客户的往来单位 Jeez.Runtime.Base.General.RunTimefilterDefine fd; fd = new Jeez.Runtime.Base.General.RunTimefilterDefine("{jzYingshou.CurrencyID}", 0, 0, Jeez.FormProperty.FilterDefineCompare.Equals, Jeez.FormProperty.FilterDefineLogic.AND, (int)txBibie.Tag); ar.Add(fd); fd = new Jeez.Runtime.Base.General.RunTimefilterDefine("{jzYingshou.RefUnitID}", 0, 0, Jeez.FormProperty.FilterDefineCompare.Equals, Jeez.FormProperty.FilterDefineLogic.NONE, (int)txWLDW.Tag); ar.Add(fd); base.ShowUISelectedForm(sender, EntityID, ar); } else { base.ShowUISelectedForm(sender, EntityID, RunTimeFilter); } } protected override void BillUI_Load(object sender, EventArgs e) { base.BillUI_Load(sender, e); if (this.entityobject == null) { //公共的初始化值 InitByDefine(); } } /// <summary> /// 将实体数据banding到控件上的事件 /// </summary> protected override void LoadEntityDataToControl() { isLoading = false; base.LoadEntityDataToControl(); isLoading = true; } protected override void SetInvokeBusiLogicName(out string ServerDllName, out string ServerClassName) { ServerDllName = "FolyerERPServer.dll"; ServerClassName = "FolyerERPServer.FolyerERPServer_SCM.ShoukuanServer"; } /// <summary> /// 自定义初始化控件上的一些值 /// </summary> void InitByDefine() { //实现往来单位只能选择客户数据 txWLDW.AutoDropdownListFilter = string.Format("IsCustomer=1"); //实现自动将当前登录用户所对应的职员信息的部门,组织机构,本身职员信息填充到界面上的三个控件减少输入 EntityObjectFactory eofEmployee = EntityObjectFactory.GetInstance(objContext, EntityIDEnum.Employee); EntityObject eoEmp = eofEmployee.FindFirst("SysUserID={0}", Jeez.Login.Environment.UserID); if (eoEmp != null && txEmployee != null) { txEmployee.Tag = eoEmp.PrimaryKeyValue; txEmployee.VALUE = eoEmp.ToString(); txOrg.Tag = eoEmp.GetRelatedObject("OrganizationID").PrimaryKeyValue; txOrg.VALUE = eoEmp.GetRelatedObject("OrganizationID").ToString(); txDept.Tag = eoEmp.GetRelatedObject("DepartMentID").PrimaryKeyValue; txDept.VALUE = eoEmp.GetRelatedObject("DepartMentID").ToString(); } //默认登录的时候币别为系统默认的币别 ////默认登录的时候往来单位ID获取 EntityObjectFactory eofInnit = EntityObjectFactory.GetInstance(objContext, EntityIDEnum.SystemInit); EntityObject eoInit = eofInnit.FindFirst("ID>0"); EntityObject eoBibie = eoInit.GetRelatedObject("CurrencyID"); if (eoBibie != null) { txBibie.Tag = eoBibie.PrimaryKeyValue; txBibie.VALUE = eoBibie.ToString(); txRat.PropertyPage.Value = 1.0m; BibieID = (int)eoBibie.PrimaryKeyValue; } EntityObject eoWLDW = eoInit.GetRelatedObject("RefUnitID"); if (eoWLDW != null) { txWLDW.Tag = eoWLDW.PrimaryKeyValue; txWLDW.VALUE = eoWLDW.ToString(); WLDWID = (int)eoWLDW.PrimaryKeyValue; } EntityObject eoZH = eoInit.GetRelatedObject("BankAcountID"); if (eoZH != null) { txZH.Tag = eoZH.PrimaryKeyValue; txZH.VALUE = eoZH.ToString(); } this.gridZY.RowCount = 5;//默认设置5行 } /// <summary> /// 菜单事件的扩展 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <param name="Tool"></param> public override void ResponseMenuToolClickEvent(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e, object Tool) { Jeez.FormProperty.JeezTool tool = Tool as Jeez.FormProperty.JeezTool; if (tool == null) return; this.Cursor = Jeez.Common.UI.Waitcursor.WaitCursor; switch (tool.Name) { default: break; } base.ResponseMenuToolClickEvent(sender, e, Tool); this.Cursor = Jeez.Common.UI.Waitcursor.Default; } }
服务端代码:
/// <summary> /// 收款服务端类 /// </summary> class ShoukuanServer : Jeez.Runtime.BusiLogic.RuntimeBusiLogic { protected override bool CheckValidate(EntityObject eo, bool IsCheck, ref string strMessage) { bool b = base.CheckValidate(eo, IsCheck, ref strMessage); if (b) { //return ERPServerFunc.Shoukuan(Context, eo, EntityIDEnum.ShoukuanDetail, IsCheck, ref strMessage); try { if (IsCheck) { //更新即时账户余额 EntityObject eoAccount = eo.GetRelatedObject("BankAcountID"); if (eoAccount != null) { decimal oldMoney = (decimal)eoAccount.GetProperty("Amount"); eoAccount.SetProperty("Amount", oldMoney + (decimal)eo.GetProperty("Amount")); } //更新应收清单已收金额未收金额 foreach (EntityObject eod in eo.GetChildEntityObjects(EntityIDEnum.ShoukuanDetail)) { EntityObject eoAp = eod.GetRelatedObject("YingshouID"); if (eoAp != null) { if ((decimal)eod.GetProperty("BAmount") > 0) { if ((decimal)eoAp.GetProperty("WAmount") < (decimal)eod.GetProperty("BAmount")) { strMessage = string.Format("{0}的收款余额小于本次收款金额", eoAp.ToString()); return false; } } else { if ((decimal)eoAp.GetProperty("WAmount") > (decimal)eod.GetProperty("BAmount")) { strMessage = string.Format("{0}的收款余额小于本次收款金额", eoAp.ToString()); return false; } } eoAp.SetProperty("YAmount", (decimal)eoAp.GetProperty("YAmount") + (decimal)eod.GetProperty("BAmount")); eoAp.SetProperty("WAmount", (decimal)eoAp.GetProperty("WAmount") - (decimal)eod.GetProperty("BAmount")); } } Context.SaveChanges(); } else { //反审核 //更新即时账户余额 EntityObject eoAccount = eo.GetRelatedObject("BankAcountID"); if (eoAccount != null) { decimal oldMoney = (decimal)eoAccount.GetProperty("Amount"); if (oldMoney < (decimal)eo.GetProperty("Amount")) { strMessage = "账户余额不足,不足以完成此次反审核"; return false; } eoAccount.SetProperty("Amount", oldMoney - (decimal)eo.GetProperty("Amount")); } //更新应收清单已收金额未收金额 foreach (EntityObject eod in eo.GetChildEntityObjects(EntityIDEnum.ShoukuanDetail)) { EntityObject eoAp = eod.GetRelatedObject("YingshouID"); if (eoAp != null) { eoAp.SetProperty("YAmount", (decimal)eoAp.GetProperty("YAmount") - (decimal)eod.GetProperty("BAmount")); eoAp.SetProperty("WAmount", (decimal)eoAp.GetProperty("WAmount") + (decimal)eod.GetProperty("BAmount")); } } Context.SaveChanges(); } } catch (Exception ex) { strMessage = ex.Message.ToString(); return false; } return true; } return b; } }
极致平台开发十大特点:
1. 一个数据库下可以同时进行N套业务系统开发,开发出来的产品可以根据您客户的需要按模块界面组发布,客户想要啥模块就可以给啥模块。而且一个数据库下开发所有功能,当客户需要从你的人力资源增加客户关系管理模块的时候,你只要做个升级包就可以了。解决企业多个业务系统信息孤岛问题。
2. 智能升级功能,当客户从A模块增加B模块的时候,您只需要做一个升级包即可,给客户升级后,客户原来录入的数据不会有影响,而且所有客户端都是智能感应智能升级,大大节省您的部署成本。
3. 工作流套打报表均可以运行时候自定义,比如费用报销单,您100家客户就有一百种费用报销的流程,套打的格式,用我们平台您只需要设计好这个费用报销单,至于哪个客户走什么流程,完全可以让客户自己去定义,而不需要像传统开发那样,提前在开发中设置好,100个客户就维护100套代码。套打也是如此。
4. 支持数据授权,当您开发多组织架构的系统的时候,我们只要业务单据引用组织机构即可,然后组织机构支持数据授权,这样就可以不需要编写任何一行代码就可以做到,组织与组织之间数据彼此隔离,我想给哪个用户看哪个组织的数据只要给这个用户这个组织的数据权限即可。
5. 支持字段授权,对于一些表的核心字段对用户进行屏蔽直接利用我们平台的字段授权功能即可,比如职员薪酬字段进行字段授权,让有的用户在看职员信息的时候,自动隐藏薪酬的数据。这也是无需编写任何一行代码。
6. 单据界面自动生成,我们开发的时候只要设计好实体,也就是传统开发所说的表结构即可,还可以设置哪些字段是必录,可见,不允许重复,在界面生成的时候,会自动生成一个界面,而且这个界面的增删改查是无需写一行代码的,您只要对您特有业务逻辑编码即可,相对传统开发,你代码量可以节省2/3,开发周期缩短2/3
7.一次开发同时具有单机局域互联网三个版本,客户想要单机就给单机想要互联网版就给互联网版。
8.强大的公式引擎,让您可以灵活设计计算类的项目,比如工资,预算。
9.包含强大的各种控件,比如文本控件支持F8调用,编码名称自动带出。Grid控件支持表头过滤,单元格融合,固定列,表格列,表格行各种公式汇总,复合表头,表格宽度可以自己随意调整,而且关闭后会自动记录之前的宽度。还支持表格列随意调整顺序。
10.平台内置很多基础功能,比如权限管理,用户角色管理,还有实施的一些导入导出工具都能帮助客户大大提高一个项目验收进度。
官网:www.jeez.com.cn
平台介绍:www.jeez.com.cn/jbf
平台下载地址:http://www.jeez.com.cn/upfiles/jbfsetuppro.rar
(下载即可有3个月免费试用)
联系电话:13826519021 18988763421 QQ:180315586 420977542 (加我注明极致软件即可)
平台销售经理:李先生
将互联网时代的管理软件做到极致!
==================================================================