Beispiel #1
0
 public void UptChargeApplyMasterAndDetailToMobile(string strActionType, T_FB_CHARGEAPPLYMASTER chargeMaster,
                                                   List <T_FB_CHARGEAPPLYDETAIL> chargeDetail, List <T_FB_CHARGEAPPLYREPAYDETAIL> chargeRepDetail, ref string strMsg)
 {
     using (ChargeApplyMasterBLL chargeBLL = new ChargeApplyMasterBLL())
     {
         chargeBLL.UptChargeApplyMasterAndDetailForMobile(strActionType, chargeMaster, chargeDetail, chargeRepDetail, ref strMsg);
     }
 }
Beispiel #2
0
        public T_FB_CHARGEAPPLYMASTER GetChargeApplyMasterByID(string strChargeApplyMasterId)
        {
            T_FB_CHARGEAPPLYMASTER entRd = new T_FB_CHARGEAPPLYMASTER();

            using (ChargeApplyMasterBLL bllChargeApplyMaster = new ChargeApplyMasterBLL())
            {
                entRd = bllChargeApplyMaster.GetChargeApplyMasterByID(strChargeApplyMasterId);
                return(entRd);
            }
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (DaGr.SelectedItems.Count > 0)
            {
                string Result = "";
                string StrTip = "";
                DelInfosList = new ObservableCollection <string>();
                ComfirmWindow com = new ComfirmWindow();
                com.OnSelectionBoxClosed += (obj, result) =>
                {
                    for (int i = 0; i < DaGr.SelectedItems.Count; i++)
                    {
                        T_FB_CHARGEAPPLYMASTER tmpCharge = new T_FB_CHARGEAPPLYMASTER();
                        tmpCharge = DaGr.SelectedItems[i] as T_FB_CHARGEAPPLYMASTER;
                        string ChargeId = "";
                        ChargeId = tmpCharge.CHARGEAPPLYMASTERID;
                        //add zl 2012.2.9
                        if (tmpCharge.T_FB_EXTENSIONALORDER != null)
                        {
                            Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("TIPS"), "出差报销单不能进行删除!");
                            return;
                        }
                        //add end
                        if (!SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(tmpCharge, "T_FB_CHARGEAPPLYMASTER", OperationType.Delete, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID))
                        {
                            StrTip = "您不能删除您选中的第" + (i + 1).ToString() + "条,单据编号为" + tmpCharge.CHARGEAPPLYMASTERCODE + "的报销申请";
                            ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), StrTip, Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                            break;
                        }

                        if (!(DelInfosList.IndexOf(ChargeId) > -1))
                        {
                            if (tmpCharge.CHECKSTATES == (int)CheckStates.UnSubmit)
                            {
                                DelInfosList.Add(ChargeId);
                            }
                        }
                    }
                    if (DelInfosList.Count > 0)
                    {
                        client.DelChargeApplyMasterAndDetailAsync(DelInfosList);
                    }
                    else
                    {
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), "只能删除未提交的单据!",
                                                       Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    }
                };
                com.SelectionBox(Utility.GetResourceStr("DELETECONFIRM"), Utility.GetResourceStr("DELETEALTER"), ComfirmWindow.titlename, Result);
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "DELETE"), Utility.GetResourceStr("CONFIRMBUTTON"));
            }
        }
Beispiel #4
0
        public bool UpdateChargeApplyDetail(string strChargeMasterID, List <T_FB_CHARGEAPPLYDETAIL> detailList)
        {
            bool bRes = false;

            try
            {
                if (string.IsNullOrWhiteSpace(strChargeMasterID))
                {
                    return(bRes);
                }


                ChargeApplyMasterBLL   masterBLL = new ChargeApplyMasterBLL();
                T_FB_CHARGEAPPLYMASTER entMaster = masterBLL.GetChargeApplyMasterByID(strChargeMasterID);

                bRes = DelChargeApplyDetail(strChargeMasterID);

                foreach (T_FB_CHARGEAPPLYDETAIL item in detailList)
                {
                    if (item.EntityKey != null)
                    {
                        item.EntityKey = null;
                    }

                    item.CHARGEAPPLYDETAILID = System.Guid.NewGuid().ToString();
                    if (item.T_FB_CHARGEAPPLYMASTER == null)
                    {
                        item.T_FB_CHARGEAPPLYMASTER = entMaster;
                    }

                    item.T_FB_CHARGEAPPLYMASTER.EntityKey = new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_FB_CHARGEAPPLYMASTER", "CHARGEAPPLYMASTERID", entMaster.CHARGEAPPLYMASTERID);


                    if (item.T_FB_SUBJECT != null)
                    {
                        item.T_FB_SUBJECT.EntityKey = new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_FB_SUBJECT", "SUBJECTID", item.T_FB_SUBJECT.SUBJECTID);
                    }

                    if (item.T_FB_BORROWAPPLYDETAIL != null)
                    {
                        item.T_FB_BORROWAPPLYDETAIL.EntityKey = new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_FB_BORROWAPPLYDETAIL", "BORROWAPPLYDETAILID", item.T_FB_BORROWAPPLYDETAIL.BORROWAPPLYDETAILID);
                    }

                    Add(item);
                }
                bRes = true;
            }
            catch (Exception ex)
            {
                Tracer.Debug(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "调用函数 UpdateChargeApplyDetail 出现异常,异常信息为:" + ex.ToString());
                bRes = false;
            }

            return(bRes);
        }
Beispiel #5
0
 public bool AddChargeApplyMasterAndDetailMobile(T_FB_CHARGEAPPLYMASTER chargeMaster, List <T_FB_CHARGEAPPLYDETAIL> chargeDetail,
                                                 List <T_FB_CHARGEAPPLYREPAYDETAIL> chargeRepDetail, ref string strMsg)
 {
     using (ChargeApplyMasterBLL chargeBLL = new ChargeApplyMasterBLL())
     {
         bool re;
         re = chargeBLL.AddChargeApplyMasterAndDetailMobile(chargeMaster, chargeDetail, chargeRepDetail, ref strMsg);
         //re = chargeBLL.AddChargeApplyMasterAndDetail(chargeMaster, chargeDetail, chargeRepDetail);
         return(re);
     }
 }
Beispiel #6
0
        private void DaGr_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (DaGr.SelectedItems.Count == 0)
            {
                return;
            }
            //SelectMeeting = DaGr.SelectedItems[0] as V_BumfCompanySendDoc;
            DataGrid grid = sender as DataGrid;

            if (grid.SelectedItems.Count > 0)
            {
                ChargeEntity = grid.SelectedItem as T_FB_CHARGEAPPLYMASTER;
            }
        }
Beispiel #7
0
        public bool UptChargeApplyCheckState(T_FB_CHARGEAPPLYMASTER entity, List <T_FB_CHARGEAPPLYDETAIL> chargeDetail,
                                             List <T_FB_CHARGEAPPLYREPAYDETAIL> chargeRepDetail)
        {
            using (ChargeApplyMasterBLL chargeBLL = new ChargeApplyMasterBLL())
            {
                string strMsg = string.Empty;
                chargeBLL.UptChargeApplyCheckState(entity, chargeDetail, chargeRepDetail, ref strMsg);

                if (!string.IsNullOrWhiteSpace(strMsg))
                {
                    return(false);
                }

                return(true);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 检查是否显示当前表单的子列表是否显示DataGrid Toolbar
        /// </summary>
        private void IsVisibleToolBar()
        {
            DetailGrid dgrid = this.EditForm.FindControl("OrderGrid") as DetailGrid;

            if (dgrid != null)
            {
                if (dgrid.operationType == OperationTypes.Edit || dgrid.operationType == OperationTypes.ReSubmit)
                {
                    OrderEntity            orderEntity = dgrid.DataContext as OrderEntity;
                    T_FB_CHARGEAPPLYMASTER entCheck    = orderEntity.Entity as T_FB_CHARGEAPPLYMASTER;
                    if (entCheck.T_FB_BORROWAPPLYMASTER != null || entCheck.T_FB_BORROWAPPLYMASTERReference.EntityKey != null)
                    {
                        dgrid.ShowToolBar = false;
                    }
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// 将指定的单据记录存储到我的单据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public string SaveMyRecord(EntityObject entity)
        {
            string strTemp = string.Empty;

            try
            {
                if (entityTypeList.Count() == 0)
                {
                    InitEntityTypeList();
                }

                if (!entityTypeList.Contains(entity.GetType().Name))
                {
                    return(strTemp);
                }

                if (entity.GetType().Name == typeof(T_FB_PERSONMONEYASSIGNMASTER).Name)
                {
                    T_FB_PERSONMONEYASSIGNMASTER tempEntity = entity as T_FB_PERSONMONEYASSIGNMASTER;
                    if (tempEntity.APPLIEDTYPE.Equal(1) && tempEntity.APPLIEDTYPE.Equal(2) && tempEntity.APPLIEDTYPE.Equal(3))
                    {
                        return(strTemp);
                    }
                }

                if (entity.GetType().Name == typeof(T_FB_CHARGEAPPLYMASTER).Name)
                {
                    T_FB_CHARGEAPPLYMASTER entTemp = entity as T_FB_CHARGEAPPLYMASTER;
                    if (entTemp.CHARGEAPPLYMASTERCODE.ToUpper().StartsWith("CLBX"))
                    {
                        return(strTemp);
                    }
                }

                SMT.SaaS.BLLCommonServices.Utility.SubmitMyRecord <EntityObject>(entity);
            }
            catch (Exception ex)
            {
                strTemp = ex.ToString();
            }
            return(strTemp);
        }
Beispiel #10
0
        /// <summary>
        /// 根据扩展单据,生成其关联的费用报销单据(仅仅是保存,不冻结/扣除预算额度)
        /// </summary>
        /// <param name="entAdd"></param>
        private void SaveChargeRdByExtenOrder(string strFormType, T_FB_EXTENSIONALORDER entTemp)
        {
            //1.判定当前是否进行了月结
            bool bIsChecked = false;
            IsCheckedAccount(ref bIsChecked);
            if (!bIsChecked)
            {
                throw new Exception("本月尚未结算,无法提交!");
            }

            if (strFormType == Convert.ToInt32(FBAEnums.FormTypes.Resubmit).ToString())
            {
                CancelOldChargeRdByExtenOrder(entTemp.EXTENSIONALORDERID);
            }

            ChargeApplyMasterBLL bllCharge = new ChargeApplyMasterBLL();
            T_FB_CHARGEAPPLYMASTER entCharge = bllCharge.GetChargeApplyMasterByID(entTemp.INNERORDERID);

            if (entCharge == null)
            {
                entCharge = new T_FB_CHARGEAPPLYMASTER();
                entCharge.CHARGEAPPLYMASTERID = entTemp.INNERORDERID;
                entCharge.CHARGEAPPLYMASTERCODE = "自动生成";
                entCharge.BUDGETARYMONTH = System.DateTime.Now.Date;
                entCharge.PAYTYPE = 1;
            }
            
            entCharge.EDITSTATES = 1;
            entCharge.CHECKSTATES = entTemp.CHECKSTATES;

            entCharge.T_FB_EXTENSIONALORDER = entTemp;
            entCharge.BANKACCOUT = entTemp.BANKACCOUT;
            entCharge.BANK = entTemp.BANK;
            entCharge.RECEIVER = entTemp.RECEIVER;
            entCharge.PAYTARGET = entTemp.PAYTARGET;
            entCharge.TOTALMONEY = entTemp.TOTALMONEY.Value;
            entCharge.REMARK = entTemp.REMARK;

            entCharge.CREATECOMPANYID = entTemp.CREATECOMPANYID;
            entCharge.CREATEDEPARTMENTID = entTemp.CREATEDEPARTMENTID;
            entCharge.CREATEPOSTID = entTemp.CREATEPOSTID;
            entCharge.CREATEUSERID = entTemp.CREATEUSERID;
            entCharge.CREATEDATE = entTemp.CREATEDATE;

            entCharge.OWNERCOMPANYID = entTemp.OWNERCOMPANYID;
            entCharge.OWNERDEPARTMENTID = entTemp.OWNERDEPARTMENTID;
            entCharge.OWNERID = entTemp.OWNERID;
            entCharge.OWNERPOSTID = entTemp.OWNERPOSTID;

            entCharge.CREATECOMPANYNAME = entTemp.CREATECOMPANYNAME;
            entCharge.CREATEDEPARTMENTNAME = entTemp.CREATEDEPARTMENTNAME;
            entCharge.CREATEPOSTNAME = entTemp.CREATEPOSTNAME;
            entCharge.CREATEUSERNAME = entTemp.CREATEUSERNAME;

            entCharge.OWNERCOMPANYNAME = entTemp.OWNERCOMPANYNAME;
            entCharge.OWNERDEPARTMENTNAME = entTemp.OWNERDEPARTMENTNAME;
            entCharge.OWNERNAME = entTemp.OWNERNAME;
            entCharge.OWNERPOSTNAME = entTemp.OWNERPOSTNAME;

            entCharge.UPDATEUSERID = entTemp.UPDATEUSERID;
            entCharge.UPDATEDATE = entTemp.UPDATEDATE;
        }
Beispiel #11
0
        private void InitAudit(AuditOperation op)
        {
            EmployeerData auditor = null;

            if (op == AuditOperation.Add)
            {
                auditor = this.OrderEntity.GetOwnerInfo();
                string userID = Convert.ToString(auditor.Value);
                if (string.IsNullOrEmpty(userID) || userID == DataCore.SuperUser.Value.ToString())
                {
                    auditor = this.OrderEntity.LoginUser;
                }
            }
            else
            {
                auditor = this.OrderEntity.LoginUser;
            }

            // 提交前,需要对AuditEntity赋值 ,以下属性必填

            AuditEntity.CreateCompanyID    = auditor.Company.Value.ToString();
            AuditEntity.CreateDepartmentID = auditor.Department.Value.ToString();
            AuditEntity.CreatePostID       = auditor.Post.Value.ToString();
            AuditEntity.CreateUserID       = auditor.Value.ToString();
            AuditEntity.CreateUserName     = auditor.Text;
            AuditEntity.EditUserID         = auditor.Value.ToString();
            AuditEntity.EditUserName       = auditor.Text;

            AuditEntity.ModelCode = this.OrderEntity.OrderInfo.Type;
            AuditEntity.FormID    = this.OrderEntity.OrderID;

            // 如果这个单据是报销单,或借款单,且有外部扩展单据关联。重新赋FormID和ModelCode 和EditUserID= ""

            if (this.OrderEntity.OrderType != typeof(T_FB_CHARGEAPPLYMASTER) &&
                this.OrderEntity.OrderType != typeof(T_FB_BORROWAPPLYMASTER))
            {
                return;
            }

            if (this.OrderEntity.OrderType == typeof(T_FB_CHARGEAPPLYMASTER))
            {
                T_FB_CHARGEAPPLYMASTER entView = orderEntity.Entity as T_FB_CHARGEAPPLYMASTER;
                if (entView.T_FB_EXTENSIONALORDER == null)
                {
                    return;
                }


                if (entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE != null)
                {
                    AuditEntity.ModelCode = entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE.MODELCODE;
                    AuditEntity.FormID    = entView.T_FB_EXTENSIONALORDER.ORDERID;
                }
            }
            else if (this.OrderEntity.OrderType == typeof(T_FB_BORROWAPPLYMASTER))
            {
                T_FB_BORROWAPPLYMASTER entView = orderEntity.Entity as T_FB_BORROWAPPLYMASTER;
                if (entView.T_FB_EXTENSIONALORDER == null)
                {
                    return;
                }

                if (entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE != null)
                {
                    AuditEntity.ModelCode = entView.T_FB_EXTENSIONALORDER.T_FB_EXTENSIONALTYPE.MODELCODE;
                    AuditEntity.FormID    = entView.T_FB_EXTENSIONALORDER.ORDERID;
                }
            }
        }
Beispiel #12
0
 public void AddToT_FB_CHARGEAPPLYMASTER(T_FB_CHARGEAPPLYMASTER t_FB_CHARGEAPPLYMASTER)
 {
     base.AddObject("T_FB_CHARGEAPPLYMASTER", t_FB_CHARGEAPPLYMASTER);
 }
Beispiel #13
0
 /// <summary>
 /// 检查申请人的身份
 /// </summary>
 /// <param name="chargeMaster">chargeMaster</param>
 /// <returns></returns>
 private void SaveChargeApply(T_FB_CHARGEAPPLYMASTER chargeMaster)
 {
     PersonnelServiceClient psc = new PersonnelServiceClient();
     psc.GetEmployeeDetailByIDCompleted += (sender, e) =>
         {
             RefreshUI(RefreshedTypes.HideProgressBar);
             var employee = e.Result;
              var strMsgE = string.Empty;
             if (employee == null || employee.EMPLOYEEPOSTS == null)
             {
                 strMsgE = "申请人已不存在,请重新建单!";
             }
             else
             {
                 var find = employee.EMPLOYEEPOSTS.FirstOrDefault(item => item.T_HR_POST.POSTID == strOwnerPostID);
                 if (find == null)
                 {
                     strMsgE = "申请人已异动, 请重新建单!";
                 }
             }
             if (! string.IsNullOrEmpty(strMsgE))
             {
                 Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("TIPS"), strMsgE);
             }
             else
             {
                 // 没有错的情况再保存
                 InnerSaveChargeApply(ChargeMasterEntity);
             }
         };
     RefreshUI(RefreshedTypes.ShowProgressBar);
     psc.GetEmployeeDetailByIDAsync(strOwnerID);
    
 }
Beispiel #14
0
 public void UptChargeApplyMasterAndDetailToMobile(string strActionType, T_FB_CHARGEAPPLYMASTER chargeMaster,
     List<T_FB_CHARGEAPPLYDETAIL> chargeDetail, List<T_FB_CHARGEAPPLYREPAYDETAIL> chargeRepDetail, ref string strMsg)
 {
     using (ChargeApplyMasterBLL chargeBLL = new ChargeApplyMasterBLL())
     {
         chargeBLL.UptChargeApplyMasterAndDetailForMobile(strActionType, chargeMaster, chargeDetail, chargeRepDetail, ref strMsg);
     }
 }
Beispiel #15
0
 public string GetChargeOrderCode(T_FB_CHARGEAPPLYMASTER entity)
 {
     return new OrderCodeBLL().GetAutoOrderCode(entity);
 }
Beispiel #16
0
        public void PersonmoneyAssignSendTask(string strMasterID)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("【个人活动经费下拨审核通过 所有人发起待办】【MasterID:" + strMasterID + "】");
            try
            {
                PersonmoneyAssignDetailBLL    bll            = new PersonmoneyAssignDetailBLL();
                ChargeApplyMasterBLL          chargeApplyBLL = new ChargeApplyMasterBLL();
                EngineWcfGlobalFunctionClient engineClient   = new EngineWcfGlobalFunctionClient();
                var vResult = bll.GetPersonmoneyAssignDetailByMasterID(strMasterID);
                if (vResult != null && vResult.Count() > 0)
                {
                    //需要发送待办的下拨子表数据
                    List <T_FB_PERSONMONEYASSIGNDETAIL> listNeedSend = new List <T_FB_PERSONMONEYASSIGNDETAIL>();
                    //业务数据成功保存后 发待办的数据
                    Dictionary <string, T_FB_PERSONMONEYASSIGNDETAIL> savedListNeedSend = new Dictionary <string, T_FB_PERSONMONEYASSIGNDETAIL>();
                    List <string> listString = new List <string>();

                    foreach (var v in vResult)
                    {
                        listString.Add(v.OWNERID);
                        sb.AppendLine("【活动经费个人】【" + v.OWNERID + "】【" + v.OWNERNAME + "】");
                    }
                    string[] listhaveTask = engineClient.GetPersonFromDoTaskByTitle(listString.ToArray(), "您的个人活动经费已下拨,费用报销单还未提交,请及时处理!");

                    #region 循环保存业务数据

                    foreach (var ent in vResult)
                    {
                        //只给未存在下拨待办的人,发送待办
                        if (listhaveTask.Where(c => c.Contains(ent.OWNERID)).FirstOrDefault() == null)
                        {
                            //sb.AppendLine("【需要发送待办的个人】【" + ent.OWNERID + "】【" + ent.OWNERNAME + "】");
                            T_FB_CHARGEAPPLYMASTER chargeApplyMaster = new T_FB_CHARGEAPPLYMASTER();
                            chargeApplyMaster.CREATECOMPANYID      = ent.OWNERCOMPANYID;
                            chargeApplyMaster.CREATECOMPANYNAME    = ent.OWNERCOMPANYNAME;
                            chargeApplyMaster.CREATEDEPARTMENTID   = ent.OWNERDEPARTMENTID;
                            chargeApplyMaster.CREATEDEPARTMENTNAME = ent.OWNERDEPARTMENTNAME;
                            chargeApplyMaster.CREATEPOSTID         = ent.OWNERPOSTID;
                            chargeApplyMaster.CREATEPOSTNAME       = ent.OWNERPOSTNAME;
                            chargeApplyMaster.CREATEUSERID         = ent.OWNERID;
                            chargeApplyMaster.CREATEUSERNAME       = ent.OWNERNAME;
                            chargeApplyMaster.OWNERCOMPANYID       = ent.OWNERCOMPANYID;
                            chargeApplyMaster.OWNERCOMPANYNAME     = ent.OWNERCOMPANYNAME;
                            chargeApplyMaster.OWNERDEPARTMENTID    = ent.OWNERDEPARTMENTID;
                            chargeApplyMaster.OWNERDEPARTMENTNAME  = ent.OWNERDEPARTMENTNAME;
                            chargeApplyMaster.OWNERID               = ent.OWNERID;
                            chargeApplyMaster.OWNERNAME             = ent.OWNERNAME;
                            chargeApplyMaster.OWNERPOSTID           = ent.OWNERPOSTID;
                            chargeApplyMaster.OWNERPOSTNAME         = ent.OWNERPOSTNAME;
                            chargeApplyMaster.CHARGEAPPLYMASTERID   = string.Empty;
                            chargeApplyMaster.CHARGEAPPLYMASTERID   = Guid.NewGuid().ToString();
                            chargeApplyMaster.CHARGEAPPLYMASTERCODE = " ";
                            chargeApplyMaster.BUDGETARYMONTH        = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-1");
                            chargeApplyMaster.PAYTYPE               = 1;
                            chargeApplyMaster.TOTALMONEY            = 0;
                            chargeApplyMaster.REPAYMENT             = 0;
                            chargeApplyMaster.EDITSTATES            = 0;
                            chargeApplyMaster.CHECKSTATES           = 0;
                            chargeApplyMaster.PAYTARGET             = 1;
                            chargeApplyMaster.UPDATEUSERID          = ent.OWNERID;
                            chargeApplyMaster.UPDATEUSERNAME        = ent.OWNERNAME;
                            chargeApplyMaster.CREATEDATE            = DateTime.Now;
                            chargeApplyMaster.UPDATEDATE            = DateTime.Now;
                            bool saveResult = chargeApplyBLL.Add(chargeApplyMaster);
                            if (saveResult)
                            {
                                savedListNeedSend.Add(chargeApplyMaster.CHARGEAPPLYMASTERID, ent);
                            }
                            else
                            {
                                sb.AppendLine("【保存费用报销主数据失败】");
                            }
                        }
                    }
                    #endregion
                    #region  发送待办

                    List <SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK> tasks = new List <SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK>();

                    foreach (var v in savedListNeedSend)
                    {
                        SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK task = new SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK();
                        task.DOTASKID      = Guid.NewGuid().ToString();
                        task.COMPANYID     = v.Value.OWNERCOMPANYID;
                        task.ORDERID       = v.Key;
                        task.ORDERUSERID   = v.Value.OWNERID;
                        task.ORDERUSERNAME = v.Value.OWNERNAME;
                        task.ORDERSTATUS   = 0;
                        task.MESSAGEBODY   = "您的个人活动经费已下拨,费用报销单还未提交,请及时处理!";
                        string strUrl = "<?xml version=\"1.0\" encoding=\"utf-8\"?><System>" +
                                        "<AssemblyName>SMT.FBAnalysis.UI</AssemblyName>" +
                                        "<PublicClass>SMT.FBAnalysis.UI.Common.Utility</PublicClass>" +
                                        "<ProcessName>CreateFormFromEngine</ProcessName>" +
                                        "<PageParameter>SMT.FBAnalysis.UI.Form.ChargeApplyForm</PageParameter>" +
                                        "<ApplicationOrder>{0}</ApplicationOrder>" +
                                        "<FormTypes>Edit</FormTypes></System>";
                        task.APPLICATIONURL    = string.Format(strUrl, task.ORDERID);
                        task.RECEIVEUSERID     = v.Value.OWNERID;
                        task.BEFOREPROCESSDATE = DateTime.Now.AddDays(3);
                        task.DOTASKTYPE        = 4;
                        task.DOTASKSTATUS      = 0;
                        task.MAILSTATUS        = 0;
                        task.RTXSTATUS         = 0;
                        task.SYSTEMCODE        = "FB";
                        task.MODELCODE         = "T_FB_CHARGEAPPLYMASTER";
                        task.CREATEDATETIME    = DateTime.Now;
                        task.REMARK            = "未提交单据";
                        tasks.Add(task);
                        sb.AppendLine("【发送待办】【待办接收者:" + v.Value.OWNERNAME + "】【报销单号:" + task.ORDERID + "】");
                    }
                    if (tasks.Count > 0)
                    {
                        var sendResult = engineClient.AddDoTaskEntity(tasks.ToArray());
                        sb.AppendLine("【调用Engine[AddDoTaskEntity]】【结果:" + sendResult + "】");
                    }
                    else
                    {
                        sb.AppendLine("【不需要发送待办】");
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                sb.AppendLine("【异常】【" + ex.Message + "】");
            }
            SMT.Foundation.Log.Tracer.Debug(sb.ToString());
        }
Beispiel #17
0
        public void PersonmoneyAssignSendTask(string strMasterID)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("【个人活动经费下拨审核通过 所有人发起待办】【MasterID:" + strMasterID + "】");
            try
            {
                PersonmoneyAssignDetailBLL bll = new PersonmoneyAssignDetailBLL();
                ChargeApplyMasterBLL chargeApplyBLL = new ChargeApplyMasterBLL();
                EngineWcfGlobalFunctionClient engineClient = new EngineWcfGlobalFunctionClient();
                var vResult = bll.GetPersonmoneyAssignDetailByMasterID(strMasterID);
                if (vResult != null && vResult.Count() > 0)
                {
                  
                    //需要发送待办的下拨子表数据
                    List<T_FB_PERSONMONEYASSIGNDETAIL> listNeedSend = new List<T_FB_PERSONMONEYASSIGNDETAIL>();
                    //业务数据成功保存后 发待办的数据
                    Dictionary<string,T_FB_PERSONMONEYASSIGNDETAIL> savedListNeedSend = new Dictionary<string,T_FB_PERSONMONEYASSIGNDETAIL>();
                   List<string> listString = new List<string>();
                  
                    foreach(var v in vResult)
                    {
                        listString.Add(v.OWNERID);
                        sb.AppendLine("【活动经费个人】【" + v.OWNERID + "】【" + v.OWNERNAME + "】");
                    }
                    string[] listhaveTask = engineClient.GetPersonFromDoTaskByTitle(listString.ToArray(), "您的个人活动经费已下拨,费用报销单还未提交,请及时处理!");

                    #region 循环保存业务数据

                    foreach (var ent in vResult)
                    {
                        //只给未存在下拨待办的人,发送待办
                        if (listhaveTask.Where(c => c.Contains(ent.OWNERID)).FirstOrDefault() == null)
                        {
                            //sb.AppendLine("【需要发送待办的个人】【" + ent.OWNERID + "】【" + ent.OWNERNAME + "】");
                            T_FB_CHARGEAPPLYMASTER chargeApplyMaster = new T_FB_CHARGEAPPLYMASTER();
                            chargeApplyMaster.CREATECOMPANYID = ent.OWNERCOMPANYID;
                            chargeApplyMaster.CREATECOMPANYNAME = ent.OWNERCOMPANYNAME;
                            chargeApplyMaster.CREATEDEPARTMENTID = ent.OWNERDEPARTMENTID;
                            chargeApplyMaster.CREATEDEPARTMENTNAME = ent.OWNERDEPARTMENTNAME;
                            chargeApplyMaster.CREATEPOSTID = ent.OWNERPOSTID;
                            chargeApplyMaster.CREATEPOSTNAME = ent.OWNERPOSTNAME;
                            chargeApplyMaster.CREATEUSERID = ent.OWNERID;
                            chargeApplyMaster.CREATEUSERNAME = ent.OWNERNAME;
                            chargeApplyMaster.OWNERCOMPANYID = ent.OWNERCOMPANYID;
                            chargeApplyMaster.OWNERCOMPANYNAME = ent.OWNERCOMPANYNAME;
                            chargeApplyMaster.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID;
                            chargeApplyMaster.OWNERDEPARTMENTNAME = ent.OWNERDEPARTMENTNAME;
                            chargeApplyMaster.OWNERID = ent.OWNERID;
                            chargeApplyMaster.OWNERNAME = ent.OWNERNAME;
                            chargeApplyMaster.OWNERPOSTID = ent.OWNERPOSTID;
                            chargeApplyMaster.OWNERPOSTNAME = ent.OWNERPOSTNAME;
                            chargeApplyMaster.CHARGEAPPLYMASTERID = string.Empty;
                            chargeApplyMaster.CHARGEAPPLYMASTERID = Guid.NewGuid().ToString();
                            chargeApplyMaster.CHARGEAPPLYMASTERCODE = " ";
                            chargeApplyMaster.BUDGETARYMONTH = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-1");
                            chargeApplyMaster.PAYTYPE = 1;
                            chargeApplyMaster.TOTALMONEY = 0;
                            chargeApplyMaster.REPAYMENT = 0;
                            chargeApplyMaster.EDITSTATES = 0;
                            chargeApplyMaster.CHECKSTATES = 0;
                            chargeApplyMaster.PAYTARGET = 1;
                            chargeApplyMaster.UPDATEUSERID = ent.OWNERID;
                            chargeApplyMaster.UPDATEUSERNAME = ent.OWNERNAME;
                            chargeApplyMaster.CREATEDATE = DateTime.Now;
                            chargeApplyMaster.UPDATEDATE = DateTime.Now;
                            bool saveResult = chargeApplyBLL.Add(chargeApplyMaster);
                            if (saveResult)
                            {
                                savedListNeedSend.Add(chargeApplyMaster.CHARGEAPPLYMASTERID, ent);
                            }
                            else
                            {
                                sb.AppendLine("【保存费用报销主数据失败】");
                            }
                        }
                    }
                    #endregion
                    #region  发送待办
                  
                    List<SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK> tasks = new List<SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK>();
                      
                    foreach (var v in savedListNeedSend)
                    {
                         SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK task = new SMT.SaaS.BLLCommonServices.EngineConfigWS.T_WF_DOTASK();
                        task.DOTASKID = Guid.NewGuid().ToString();
                        task.COMPANYID = v.Value.OWNERCOMPANYID;
                        task.ORDERID = v.Key;
                        task.ORDERUSERID = v.Value.OWNERID;
                        task.ORDERUSERNAME = v.Value.OWNERNAME;
                        task.ORDERSTATUS = 0;
                        task.MESSAGEBODY = "您的个人活动经费已下拨,费用报销单还未提交,请及时处理!";
                        string strUrl = "<?xml version=\"1.0\" encoding=\"utf-8\"?><System>" +
                                            "<AssemblyName>SMT.FBAnalysis.UI</AssemblyName>" +
                                            "<PublicClass>SMT.FBAnalysis.UI.Common.Utility</PublicClass>" +
                                            "<ProcessName>CreateFormFromEngine</ProcessName>" +
                                            "<PageParameter>SMT.FBAnalysis.UI.Form.ChargeApplyForm</PageParameter>" +
                                            "<ApplicationOrder>{0}</ApplicationOrder>" +
                                         "<FormTypes>Edit</FormTypes></System>";
                        task.APPLICATIONURL = string.Format(strUrl, task.ORDERID);
                        task.RECEIVEUSERID = v.Value.OWNERID;
                        task.BEFOREPROCESSDATE = DateTime.Now.AddDays(3);
                        task.DOTASKTYPE = 4;
                        task.DOTASKSTATUS = 0;
                        task.MAILSTATUS = 0;
                        task.RTXSTATUS = 0;
                        task.SYSTEMCODE = "FB";
                        task.MODELCODE = "T_FB_CHARGEAPPLYMASTER";
                        task.CREATEDATETIME = DateTime.Now;
                        task.REMARK = "未提交单据";
                        tasks.Add(task);
                        sb.AppendLine("【发送待办】【待办接收者:" + v.Value.OWNERNAME + "】【报销单号:" + task.ORDERID + "】");
                    }
                    if (tasks.Count > 0)
                    {
                        var sendResult = engineClient.AddDoTaskEntity(tasks.ToArray());
                        sb.AppendLine("【调用Engine[AddDoTaskEntity]】【结果:" + sendResult + "】");
                    }
                    else
                    {
                        sb.AppendLine("【不需要发送待办】");
                    }
                    #endregion
                }

            }
            catch (Exception ex)
            {
                sb.AppendLine("【异常】【" + ex.Message + "】");
            }
            SMT.Foundation.Log.Tracer.Debug(sb.ToString());

        }
Beispiel #18
0
        void client_GetChargeApplyMasterByIDCompleted(object sender, GetChargeApplyMasterByIDCompletedEventArgs e)
        {
            try
            {
                if (e.Error == null)
                {
                    if (e.Result != null)
                    {
                        ChargeMasterEntity = e.Result;
                        personclient.GetEmployeePostBriefByEmployeeIDAsync(ChargeMasterEntity.OWNERID);
                        if (!string.IsNullOrEmpty(ChargeMasterEntity.CHARGEAPPLYMASTERCODE.Trim()))
                        {
                            txtCode.Text = ChargeMasterEntity.CHARGEAPPLYMASTERCODE;
                        }
                        else
                        {
                            hideCode();
                        }


                        if (!string.IsNullOrEmpty(ChargeMasterEntity.BANK))
                        {
                            txtItemID.Text = ChargeMasterEntity.BANK;
                            txtItemCode.Text = ChargeMasterEntity.BANKACCOUT;
                            hypItemCode.Content = ChargeMasterEntity.BANKACCOUT;
                        }
                        else if (types == FormTypes.Audit || types == FormTypes.Browse)
                        {
                            itemA.Visibility = System.Windows.Visibility.Collapsed;
                            itemB.Visibility = System.Windows.Visibility.Collapsed;
                        }
                        //txtPayInfo.Text = ChargeMasterEntity.PAYMENTINFO == null ? "" : ChargeMasterEntity.PAYMENTINFO;
                        txtRemark.Text = ChargeMasterEntity.REMARK == null ? "" : ChargeMasterEntity.REMARK;
                        txttotal.Text = ChargeMasterEntity.TOTALMONEY.ToString();
                        strOwnerCompanyID = ChargeMasterEntity.OWNERCOMPANYID;
                        strOwnerCompanyName = ChargeMasterEntity.OWNERCOMPANYNAME;
                        strOwnerDepartmentID = ChargeMasterEntity.OWNERDEPARTMENTID;
                        strOwnerDepartmentName = ChargeMasterEntity.OWNERDEPARTMENTNAME;
                        strOwnerPostID = ChargeMasterEntity.OWNERPOSTID;
                        strOwnerPostName = ChargeMasterEntity.OWNERPOSTNAME;
                        strOwnerID = ChargeMasterEntity.OWNERID;
                        strOwnerName = ChargeMasterEntity.OWNERNAME;
                        dgvRepayDetailList.Visibility = Visibility.Collapsed;
                        dgvRepayDetailList.IsEnabled = false;

                        SetPayInfo();
                        if (ChargeMasterEntity.PAYTYPE == 2)
                        {
                            txtTolRepayMon.Text = ChargeMasterEntity.REPAYMENT.ToString();
                            client.GetChargeApplyRepayDetailByMasterIDAsync(ChargeMasterEntity.CHARGEAPPLYMASTERID);
                        }
                        if (ChargeMasterEntity.T_FB_EXTENSIONALORDER != null)
                        {
                            tblExten.Visibility = Visibility.Visible;
                            hypExten.Visibility = Visibility.Visible;
                        }

                        if (Convert.ToString(e.UserState) == "Edit")
                        {
                            var arg = new GetChargeApplyDetailByMasterIDCompletedEventArgs(new object[]{ChargeMasterEntity.T_FB_CHARGEAPPLYDETAIL}, null, false, null);
                            client_GetChargeApplyDetailByMasterIDCompleted(null,arg);
                        }
                        else
                        {
                            ObservableCollection<object> chaMasterLst = new ObservableCollection<object>();
                            chaMasterLst.Add(ChargeMasterEntity.CHARGEAPPLYMASTERID);
                            client.GetChargeApplyDetailByMasterIDAsync(chaMasterLst);
                        }
                        if (ChargeMasterEntity.T_FB_EXTENSIONALORDER != null)
                        {
                            if (types == FormTypes.Resubmit)
                            {
                                EntityBrowser entBrowser = this.FindParentByType<EntityBrowser>();
                                entBrowser.FormType = FormTypes.Browse;
                                RefreshUI(RefreshedTypes.ToolBar);
                                types = FormTypes.Browse;
                                SetForms();
                                MessageBox.Show( "请在出差报销模块中尝试重新提交!", "提示", MessageBoxButton.OK);
                            }
                            client.GetExtensionalOrderByIDAsync(ChargeMasterEntity.T_FB_EXTENSIONALORDER.EXTENSIONALORDERID);

                        }
                        // 删除多余的
                        ChargeMasterEntity.T_FB_CHARGEAPPLYDETAIL = null;
                        //查看时如果是兼职 在线公司 也显示
                        if (types == FormTypes.Browse)
                        {
                            var ents = from ent in SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts
                                       where ent.CompanyID == smtonlineID
                                       select ent;
                            if (ents.Count() > 0)
                            {
                                if (ChargeMasterEntity.OWNERCOMPANYID == smtonlineID)
                                {
                                    this.rbPayFromA.Visibility = Visibility.Visible;
                                    this.rbPayFromB.Visibility = Visibility.Visible;
                                }
                            }
                        }
                    }
                }
                
            }
            catch (Exception ex)
            {
                RefreshUI(RefreshedTypes.HideProgressBar);
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.ToString());
            }
        }
Beispiel #19
0
        /// <summary>
        /// 冲借款报销单审核通过时扣掉T_FB_PERSONACCOUNT表借款金额
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="checkstate"></param>
        /// <returns></returns>
        public bool UptPersonAccountByChar(T_FB_CHARGEAPPLYMASTER entity, List <T_FB_CHARGEAPPLYREPAYDETAIL> detailList, decimal dCheckState)
        {
            bool               re;
            string             ErrInfo   = "";
            T_FB_PERSONACCOUNT entPerson = new T_FB_PERSONACCOUNT();

            try
            {
                IQueryable <T_FB_PERSONACCOUNT> qAccount = from a in dal.GetObjects()
                                                           where
                                                           a.OWNERID == entity.OWNERID &&
                                                           a.OWNERCOMPANYID == entity.OWNERCOMPANYID
                                                           select a;

                if (qAccount != null && qAccount.Count() > 0)
                {
                    ErrInfo = this.GetType().ToString() + "," + System.DateTime.Now.ToString() + " 报销单ID:" + entity.CHARGEAPPLYMASTERID;
                    T_FB_PERSONACCOUNT obj = qAccount.FirstOrDefault();
                    foreach (T_FB_CHARGEAPPLYREPAYDETAIL rep in detailList)
                    {
                        if (dCheckState == Convert.ToDecimal(FBAEnums.CheckStates.Approved))  //终审通过
                        {
                            if (rep.REPAYMONEY == 0)
                            {
                                continue;
                            }
                            if (rep.REPAYTYPE == 1)
                            {
                                obj.SIMPLEBORROWMONEY -= rep.REPAYMONEY;
                                ErrInfo += " 冲借款明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲借款终审通过时更新PersonAccount表,冲普通借款,扣减金额" + rep.REPAYMONEY + "||";
                            }
                            else if (rep.REPAYTYPE == 2)
                            {
                                obj.BACKUPBORROWMONEY -= rep.REPAYMONEY;
                                ErrInfo += " 冲借款明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲借款终审通过时更新PersonAccount表,冲备用金借款,扣减金额" + rep.REPAYMONEY + "||";
                            }
                            else if (rep.REPAYTYPE == 3)
                            {
                                obj.SPECIALBORROWMONEY -= rep.REPAYMONEY;
                                ErrInfo += " 冲借款明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲借款终审通过时更新PersonAccount表,冲专项借款,扣减金额" + rep.REPAYMONEY + "||";
                            }
                            obj.BORROWMONEY -= rep.REPAYMONEY;
                        }
                        //else if (dCheckState == Convert.ToDecimal(FBAEnums.CheckStates.UnApproved)) //审核不通过
                        //{
                        //    if (rep.REPAYTYPE == 1)
                        //    {
                        //        obj.SIMPLEBORROWMONEY += rep.REPAYMONEY;
                        //        ErrInfo += " 冲借款明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲借款审核不通过时更新PersonAccount表,冲普通借款,增加金额" + rep.REPAYMONEY + "||";
                        //    }
                        //    else if (rep.REPAYTYPE == 2)
                        //    {
                        //        obj.BACKUPBORROWMONEY += rep.REPAYMONEY;
                        //        ErrInfo += " 冲借款明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲借款审核不通过时更新PersonAccount表,冲备用金借款,增加金额" + rep.REPAYMONEY + "||";
                        //    }
                        //    else if(rep.REPAYTYPE == 3)
                        //    {
                        //        obj.SPECIALBORROWMONEY += rep.REPAYMONEY;
                        //        ErrInfo += " 冲借款明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲借款审核不通过时更新PersonAccount表,冲专项借款,增加金额" + rep.REPAYMONEY + "||";
                        //    }
                        //    obj.BORROWMONEY += rep.REPAYMONEY;
                        //}
                        obj.UPDATEUSERID = entity.UPDATEUSERID;
                        obj.UPDATEDATE   = DateTime.Now;

                        re = Update(obj);
                        if (!re)
                        {
                            ErrInfo += ", 失败!";
                            Tracer.Debug(ErrInfo);
                            return(false);
                        }
                        CreatePersonAccountWaterFlow(obj, rep);  //写流水
                    }
                }
                else
                {
                    ErrInfo = this.GetType().ToString() + "," + System.DateTime.Now.ToString() + " 报销单ID:" + entity.CHARGEAPPLYMASTERID + ", PersonAccount表中找不到相关数据。";
                    Tracer.Debug(ErrInfo);
                    return(false);
                }
                ErrInfo += ", 成功!";
                Tracer.Debug(ErrInfo);
                return(true);
            }
            catch (Exception ex)
            {
                ErrInfo = this.GetType().ToString() + ":UptPersonAccountByChar," + System.DateTime.Now.ToString() + "," + ex.Message;
                Tracer.Debug(ErrInfo);
                return(false);
            }
        }
Beispiel #20
0
        private void InitData()
        {
            if (types == FormTypes.New)
            {
                ChargeMasterEntity = new T_FB_CHARGEAPPLYMASTER();
                ChargeMasterEntity.CHARGEAPPLYMASTERID = System.Guid.NewGuid().ToString();
                ChargeMasterEntity.CHECKSTATES = 0;
                ChargeMasterEntity.PAYTYPE = 1;
                ChargeMasterEntity.PAYTARGET = 0;
                ChargeMasterEntity.PAYMENTINFO = this.PayMySelf;
                txPostLevel = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostLevel.ToString();
                SMT.FBAnalysis.UI.Common.Utility.InitFileLoad("ChargeApp", ChargeMasterEntity.CHARGEAPPLYMASTERID, types, uploadFile);
                
                SetPayInfo();
            }
            else
            {
                var id = chaID;
                string userState = null;
                if (types == FormTypes.Edit || types == FormTypes.Resubmit)
                {
                    id += ":Edit";
                    userState = "Edit";
                }
                client.GetChargeApplyMasterByIDAsync(id, userState);
                SMT.FBAnalysis.UI.Common.Utility.InitFileLoad("ChargeApp", chaID, types, uploadFile);
                RefreshUI(RefreshedTypes.ShowProgressBar);
            }

            SetForms();
        }
Beispiel #21
0
        private string GetXmlString(string StrSorce, T_FB_CHARGEAPPLYMASTER Info)
        {
            string goouttomeet = string.Empty;
            string privateaffair = string.Empty;
            string companycar = string.Empty;
            string isagent = string.Empty;
            List<object> ObjectList = new List<object>();

            SMT.SaaS.MobileXml.MobileXml mx = new MobileXml();
            SMT.SaaS.MobileXml.AutoDictionary ad = new AutoDictionary();
            List<SMT.SaaS.MobileXml.AutoDictionary> AutoList = new List<SMT.SaaS.MobileXml.AutoDictionary>();
            AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "PAYTARGET", Info.PAYTARGET.ToString(), "个人"));//付款方式

            string StrPayType = "";
            string StrEditState = "";
            string StrRepType = "";
            switch (Info.PAYTYPE.ToString())
            {
                case "1":
                    StrPayType = "个人费用报销";
                    break;
                case "2":
                    StrPayType = "冲借款";
                    break;
                case "3":
                    StrPayType = "冲预付款";
                    break;
                case "4":
                    StrPayType = "付客户款";
                    break;
                case "5":
                    StrPayType = "其他";
                    break;
            }
            switch (Info.EDITSTATES.ToString())
            {
                case "0":
                    StrEditState = "删除状态";
                    break;
                case "1":
                    StrEditState = "已生效";
                    break;
                case "2":
                    StrEditState = "未生效";
                    break;
                case "3":
                    StrEditState = "撤消中";
                    break;
                case "4":
                    StrEditState = "已撤消";
                    break;
            }
            
            
            AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "POSTLEVEL", txPostLevel, null));//POSTLEVEL

            AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "PAYTYPE", Info.PAYTYPE.ToString(), StrPayType));//付款类型
            AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "EDITSTATES", Info.EDITSTATES.ToString(), StrEditState));//编辑状态
            if (Info.T_FB_BORROWAPPLYMASTER != null)
            {
                AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "BORROWAPPLYMASTERID", Info.T_FB_BORROWAPPLYMASTER.BORROWAPPLYMASTERCODE, Info.T_FB_BORROWAPPLYMASTER.BORROWAPPLYMASTERCODE));
            }
            else
            {
                AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "BORROWAPPLYMASTERID", "", ""));
            }
            if (Info.OWNERID != null && !string.IsNullOrEmpty(strOwnerName))
            {
                AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "OWNERID", Info.OWNERID, strOwnerName + "-" + strOwnerPostName + "-" + strOwnerDepartmentName + "-" + strOwnerCompanyName));
            }
            if (Info.OWNERCOMPANYID != null && !string.IsNullOrEmpty(strOwnerCompanyName))
            {
                AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "OWNERCOMPANYID", Info.OWNERCOMPANYID, strOwnerCompanyName));
            }
            if (Info.OWNERDEPARTMENTID != null && !string.IsNullOrEmpty(strOwnerDepartmentName))
            {
                AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "OWNERDEPARTMENTID", Info.OWNERDEPARTMENTID, strOwnerDepartmentName));
            }
            if (Info.OWNERPOSTID != null && !string.IsNullOrEmpty(strOwnerPostName))
            {
                AutoList.Add(basedata("T_FB_CHARGEAPPLYMASTER", "OWNERPOSTID", Info.OWNERPOSTID, strOwnerPostName));
            }

            List<T_FB_CHARGEAPPLYDETAIL> objC;
            if (chargeDtlList != null && chargeDtlList.Count > 0)
            {
                objC = chargeDtlList.ToList();
            }
            else
            {
                objC = chaDtlobj.ToList();
            }
            foreach (T_FB_CHARGEAPPLYDETAIL objDetail in objC)
            {
                if (objDetail.T_FB_SUBJECT != null)
                {
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYDETAIL", "SUBJECTID", objDetail.T_FB_SUBJECT.SUBJECTID, objDetail.T_FB_SUBJECT.SUBJECTID, objDetail.CHARGEAPPLYDETAILID));
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYDETAIL", "SUBJECTCODE", objDetail.T_FB_SUBJECT.SUBJECTCODE, objDetail.T_FB_SUBJECT.SUBJECTCODE, objDetail.CHARGEAPPLYDETAILID));
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYDETAIL", "SUBJECTNAME", objDetail.T_FB_SUBJECT.SUBJECTNAME, objDetail.T_FB_SUBJECT.SUBJECTNAME, objDetail.CHARGEAPPLYDETAILID));
                }
                if (objDetail.T_FB_BORROWAPPLYDETAIL != null)
                {
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYDETAIL", "BORROWAPPLYDETAILID", objDetail.T_FB_BORROWAPPLYDETAIL.BORROWAPPLYDETAILID, objDetail.T_FB_BORROWAPPLYDETAIL.BORROWAPPLYDETAILID, objDetail.CHARGEAPPLYDETAILID));
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYDETAIL", "BORROWMONEY", objDetail.T_FB_BORROWAPPLYDETAIL.BORROWMONEY.ToString(), objDetail.T_FB_BORROWAPPLYDETAIL.BORROWMONEY.ToString(), objDetail.CHARGEAPPLYDETAILID));
                }
                if (objDetail.T_FB_CHARGEAPPLYMASTER != null)
                {
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYDETAIL", "CHARGEAPPLYMASTERID", objDetail.T_FB_CHARGEAPPLYMASTER.CHARGEAPPLYMASTERID, objDetail.T_FB_CHARGEAPPLYMASTER.CHARGEAPPLYMASTERID, objDetail.CHARGEAPPLYDETAILID));
                }
                if (objDetail.CHARGETYPE != null)
                {
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYDETAIL", "CHARGETYPE", objDetail.CHARGETYPE.ToString(), objDetail.CHARGETYPE.ToString() == "1" ? "个人预算费用" : "公共预算费用", objDetail.CHARGEAPPLYDETAILID));
                }
                ObjectList.Add(objDetail);
            }
            //add zl 2012.2.15
            List<T_FB_CHARGEAPPLYREPAYDETAIL> objR;
            if (chaRepayDetailData != null && chaRepayDetailData.Count > 0)
            {
                objR = chaRepayDetailData.ToList();
            }
            else
            {
                objR = chaRepDtlobj.ToList();
            }
            foreach (T_FB_CHARGEAPPLYREPAYDETAIL objReDetail in objR)
            {
                switch (objReDetail.REPAYTYPE.ToString())
                {
                    case "1":
                        StrRepType = "普通借款";
                        break;
                    case "2":
                        StrRepType = "备用金借款";
                        break;
                    case "3":
                        StrRepType = "专项借款";
                        break;
                }
                if (objReDetail.T_FB_CHARGEAPPLYMASTER != null)
                {
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYREPAYDETAIL", "CHARGEAPPLYMASTERID", objReDetail.T_FB_CHARGEAPPLYMASTER.CHARGEAPPLYMASTERID, objReDetail.T_FB_CHARGEAPPLYMASTER.CHARGEAPPLYMASTERID, objReDetail.CHARGEAPPLYREPAYDETAILID));
                }
                if (objReDetail.REPAYTYPE != 0)
                {
                    AutoList.Add(basedataForChild("T_FB_CHARGEAPPLYREPAYDETAIL", "REPAYTYPE", objReDetail.REPAYTYPE.ToString(), StrRepType, objReDetail.CHARGEAPPLYREPAYDETAILID));
                }
                ObjectList.Add(objReDetail);
            }
            //add end
            string a = mx.TableToXml(Info, ObjectList, StrSorce, AutoList);
            XElement xe = XElement.Parse(a);
            if (!string.IsNullOrEmpty(Info.BANK))
            {
                xe.Element("Object").Add(new XElement("Attribute",
                    new XAttribute("Name", "LINK"),
                    new XAttribute("LableResourceID", "LINK"),
                    new XAttribute("Description", "事项审批编号"),
                    new XAttribute("DataType", "string"),
                    new XAttribute("DataValue", Info.RECEIVER + "|" + Info.BANK + "|" + Info.BANKACCOUT),
                    new XAttribute("DataText", "")));   
            }   
            xe.Element("Object").Elements("ObjectList").ToArray()[1].Elements().ForEach(item =>
                {
                    var Attr_REPAYTYPE = item.Elements().Where(itemA => itemA.Attribute("Name").Value == "REPAYTYPE").FirstOrDefault();
                    var dataText = "";
                    switch (Attr_REPAYTYPE.Attribute("DataValue").Value)
                    {
                        case "1":
                            dataText = "普通借款";
                            break;
                        case "2":
                            dataText = "备用金借款";
                            break;
                        case "3":
                            dataText = "专项借款";
                            break;
                    }
                    Attr_REPAYTYPE.Attribute("DataText").Value = dataText;
                });
            return xe.ToString();
        }
Beispiel #22
0
        /// <summary>
        /// 保存费用报销
        /// </summary>
        /// <param name="chargeMaster"></param>
        private void InnerSaveChargeApply(T_FB_CHARGEAPPLYMASTER chargeMaster)
        {
            // chargeMaster.BUDGETARYMONTH = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-1");
            chargeMaster.CREATECOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            chargeMaster.CREATECOMPANYNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
            chargeMaster.CREATEDATE = DateTime.Now;
            chargeMaster.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
            chargeMaster.CREATEDEPARTMENTNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
            chargeMaster.CREATEPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
            chargeMaster.CREATEPOSTNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostName;
            chargeMaster.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            chargeMaster.CREATEUSERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
            chargeMaster.EDITSTATES = 0;
            chargeMaster.OWNERCOMPANYID = strOwnerCompanyID;
            chargeMaster.OWNERCOMPANYNAME = strOwnerCompanyName;
            chargeMaster.OWNERDEPARTMENTID = strOwnerDepartmentID;
            chargeMaster.OWNERDEPARTMENTNAME = strOwnerDepartmentName;
            chargeMaster.OWNERID = strOwnerID;
            chargeMaster.OWNERNAME = strOwnerName;
            chargeMaster.OWNERPOSTID = strOwnerPostID;
            chargeMaster.OWNERPOSTNAME = strOwnerPostName;
            chargeMaster.PAYTYPE = nChargeType;
            if (txtCode.Text.IndexOf('>') > 0)
            {
                chargeMaster.CHARGEAPPLYMASTERCODE = " ";
            }
            else
            {
                chargeMaster.CHARGEAPPLYMASTERCODE = txtCode.Text;
            }
         
            if (nChargeType==1)//1为费用报销
            {
                #region 费用报销情况
                if (this.rbPayMySelft.IsChecked.Value)
                {
                    chargeMaster.PAYTARGET = 0;//2013/12/16号起PAYTARGET字段意思:0付本人,1原始值,目前不用,2付多人
                }
                else
                {
                    chargeMaster.PAYTARGET = 2;
                }
                #endregion
            }
            else
            {
                chargeMaster.PAYTARGET = 1;//不是费用报销则保留原来存值为1
            }
            chargeMaster.PAYMENTINFO = GetPayInfo();
            if (!string.IsNullOrEmpty(txtItemID.Text))
            {
                
                // Bank 字段用于做事项审批关联
                chargeMaster.BANK = txtItemID.Text;
                chargeMaster.BANKACCOUT = txtItemCode.Text;
                chargeMaster.RECEIVER = "T_OA_APPROVALINFO";
            }
            else
            {
                chargeMaster.BANK = null;
                chargeMaster.BANKACCOUT = null;
                chargeMaster.RECEIVER = null;
            }
            chargeMaster.REMARK = txtRemark.Text;
            chargeMaster.TOTALMONEY = decimal.Parse(txttotal.Text.ToString());
            chargeMaster.UPDATEDATE = DateTime.Now;
            chargeMaster.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            chargeMaster.UPDATEUSERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
            if (rabPayBor.IsChecked == true)    //如果是冲借款就保存冲款金额
            {
                chargeMaster.REPAYMENT = decimal.Parse(txtTolRepayMon.Text);
                //chargeMaster.TOTALMONEY += decimal.Parse(txtTolRepayMon.Text);

                chaRepayDetailData.Clear();
                foreach (object obj in dgvRepayDetailList.ItemsSource)
                {
                    T_FB_CHARGEAPPLYREPAYDETAIL ent = obj as T_FB_CHARGEAPPLYREPAYDETAIL;
                    T_FB_CHARGEAPPLYREPAYDETAIL chaRepay = new T_FB_CHARGEAPPLYREPAYDETAIL();
                    chaRepay.CHARGEAPPLYREPAYDETAILID = System.Guid.NewGuid().ToString();
                    chaRepay.UPDATEDATE = DateTime.Now;
                    chaRepay.CREATEDATE = DateTime.Now;
                    chaRepay.T_FB_CHARGEAPPLYMASTER = chargeMaster;
                    chaRepay.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    chaRepay.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    chaRepay.BORROWMONEY = ent.BORROWMONEY;
                    chaRepay.REPAYTYPE = ent.REPAYTYPE;

                    if (dgvRepayDetailList.Columns[2].GetCellContent(obj) != null)
                    {
                        TextBox txtMark = dgvRepayDetailList.Columns[2].GetCellContent(obj).FindName("txtRepRemark") as TextBox;
                        chaRepay.REMARK = txtMark.Text;
                    }
                    if (dgvRepayDetailList.Columns[3].GetCellContent(obj) != null)
                    {
                        TextBox tbMon = dgvRepayDetailList.Columns[3].GetCellContent(obj).FindName("txtRepMon") as TextBox;
                        chaRepay.REPAYMONEY = decimal.Parse(string.IsNullOrEmpty(tbMon.Text.ToString()) == true ? "0" : tbMon.Text.ToString());
                    }
                    chaRepayDetailData.Add(chaRepay);
                }
            }
            else
            {
                chargeMaster.REPAYMENT = 0;
                //chargeMaster.REPAYTYPE = null;
            }

          
            chargeDtlList.Clear();
            //chaDtlobj.Clear();
            if (dgvChargeDetailList.ItemsSource != null)
            {
                foreach (object obj in dgvChargeDetailList.ItemsSource)
                {
                    T_FB_CHARGEAPPLYDETAIL ent = obj as T_FB_CHARGEAPPLYDETAIL;
                    T_FB_CHARGEAPPLYDETAIL charge = new T_FB_CHARGEAPPLYDETAIL();
                    charge.CHARGEAPPLYDETAILID = System.Guid.NewGuid().ToString();
                    charge.CHARGETYPE = ent.CHARGETYPE;
                    charge.CREATEDATE = DateTime.Now;
                    charge.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    charge.T_FB_BORROWAPPLYDETAIL = ent.T_FB_BORROWAPPLYDETAIL;
                    charge.T_FB_CHARGEAPPLYMASTER = chargeMaster;
                    charge.T_FB_SUBJECT = ent.T_FB_SUBJECT;
                    charge.UPDATEDATE = DateTime.Now;
                    charge.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    charge.USABLEMONEY = ent.USABLEMONEY;

                    if (dgvChargeDetailList.Columns[4].GetCellContent(obj) != null)
                    {
                        TextBox txtMark = dgvChargeDetailList.Columns[4].GetCellContent(obj).FindName("txtRemark") as TextBox;
                        charge.REMARK = txtMark.Text;
                    }
                    if (dgvChargeDetailList.Columns[5].GetCellContent(obj) != null)
                    {
                        TextBox tbMon = dgvChargeDetailList.Columns[5].GetCellContent(obj).FindName("txtMon") as TextBox;
                        charge.CHARGEMONEY = decimal.Parse(string.IsNullOrEmpty(tbMon.Text.ToString()) == true ? "0" : tbMon.Text.ToString());
                    }
                    chargeDtlList.Add(charge);
                }
            }

            RefreshUI(RefreshedTypes.ShowProgressBar);
            string strMsg = string.Empty;
            if (types == FormTypes.New)
            {
                client.AddChargeApplyMasterAndDetailAsync(chargeMaster, chargeDtlList, chaRepayDetailData);
            }
            else if (types == FormTypes.Edit)
            {
                string op = needsubmit == false ? "Edit" : "Submit";
                client.UptChargeApplyMasterAndDetailAsync(op, chargeMaster, chargeDtlList, chaRepayDetailData, strMsg, op);
            }
            else if (types == FormTypes.Resubmit)
            {
                client.UptChargeApplyMasterAndDetailAsync("ReSubmit", chargeMaster, chargeDtlList, chaRepayDetailData, strMsg, "ReSubmit");
            }
        }
Beispiel #23
0
        /// <summary>
        /// 根据扩展单据,生成其关联的费用报销单据(仅仅是保存,不冻结/扣除预算额度)
        /// </summary>
        /// <param name="entAdd"></param>
        private void SaveChargeRdByExtenOrder(string strFormType, T_FB_EXTENSIONALORDER entTemp)
        {
            //1.判定当前是否进行了月结
            bool bIsChecked = false;

            IsCheckedAccount(ref bIsChecked);
            if (!bIsChecked)
            {
                throw new Exception("本月尚未结算,无法提交!");
            }

            if (strFormType == Convert.ToInt32(FBAEnums.FormTypes.Resubmit).ToString())
            {
                CancelOldChargeRdByExtenOrder(entTemp.EXTENSIONALORDERID);
            }

            ChargeApplyMasterBLL   bllCharge = new ChargeApplyMasterBLL();
            T_FB_CHARGEAPPLYMASTER entCharge = bllCharge.GetChargeApplyMasterByID(entTemp.INNERORDERID);

            if (entCharge == null)
            {
                entCharge = new T_FB_CHARGEAPPLYMASTER();
                entCharge.CHARGEAPPLYMASTERID   = entTemp.INNERORDERID;
                entCharge.CHARGEAPPLYMASTERCODE = "自动生成";
                entCharge.BUDGETARYMONTH        = System.DateTime.Now.Date;
                entCharge.PAYTYPE = 1;
            }

            entCharge.EDITSTATES  = 1;
            entCharge.CHECKSTATES = entTemp.CHECKSTATES;

            entCharge.T_FB_EXTENSIONALORDER = entTemp;
            entCharge.BANKACCOUT            = entTemp.BANKACCOUT;
            entCharge.BANK       = entTemp.BANK;
            entCharge.RECEIVER   = entTemp.RECEIVER;
            entCharge.PAYTARGET  = entTemp.PAYTARGET;
            entCharge.TOTALMONEY = entTemp.TOTALMONEY.Value;
            entCharge.REMARK     = entTemp.REMARK;

            entCharge.CREATECOMPANYID    = entTemp.CREATECOMPANYID;
            entCharge.CREATEDEPARTMENTID = entTemp.CREATEDEPARTMENTID;
            entCharge.CREATEPOSTID       = entTemp.CREATEPOSTID;
            entCharge.CREATEUSERID       = entTemp.CREATEUSERID;
            entCharge.CREATEDATE         = entTemp.CREATEDATE;

            entCharge.OWNERCOMPANYID    = entTemp.OWNERCOMPANYID;
            entCharge.OWNERDEPARTMENTID = entTemp.OWNERDEPARTMENTID;
            entCharge.OWNERID           = entTemp.OWNERID;
            entCharge.OWNERPOSTID       = entTemp.OWNERPOSTID;

            entCharge.CREATECOMPANYNAME    = entTemp.CREATECOMPANYNAME;
            entCharge.CREATEDEPARTMENTNAME = entTemp.CREATEDEPARTMENTNAME;
            entCharge.CREATEPOSTNAME       = entTemp.CREATEPOSTNAME;
            entCharge.CREATEUSERNAME       = entTemp.CREATEUSERNAME;

            entCharge.OWNERCOMPANYNAME    = entTemp.OWNERCOMPANYNAME;
            entCharge.OWNERDEPARTMENTNAME = entTemp.OWNERDEPARTMENTNAME;
            entCharge.OWNERNAME           = entTemp.OWNERNAME;
            entCharge.OWNERPOSTNAME       = entTemp.OWNERPOSTNAME;

            entCharge.UPDATEUSERID = entTemp.UPDATEUSERID;
            entCharge.UPDATEDATE   = entTemp.UPDATEDATE;
        }
Beispiel #24
0
 private void DaGr_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (DaGr.SelectedItems.Count == 0)
     {
         return;
     }
     //SelectMeeting = DaGr.SelectedItems[0] as V_BumfCompanySendDoc;
     DataGrid grid = sender as DataGrid;
     if (grid.SelectedItems.Count > 0)
     {
         ChargeEntity = grid.SelectedItem as T_FB_CHARGEAPPLYMASTER;
     }
 }
Beispiel #25
0
 public T_FB_CHARGEAPPLYMASTER GetChargeApplyMasterByID(string strChargeApplyMasterId)
 {
     T_FB_CHARGEAPPLYMASTER entRd = new T_FB_CHARGEAPPLYMASTER();
     using (ChargeApplyMasterBLL bllChargeApplyMaster = new ChargeApplyMasterBLL())
     {
         entRd = bllChargeApplyMaster.GetChargeApplyMasterByID(strChargeApplyMasterId);
         return entRd;
     }
 }
Beispiel #26
0
        /// <summary>
        /// 报销冲借款审核中时检查冲款金额是否大于借款余额
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="detailList"></param>
        /// <param name="dCheckState"></param>
        /// <returns></returns>
        public string CheckRepMoneyForCharge(T_FB_CHARGEAPPLYMASTER entity, List <T_FB_CHARGEAPPLYREPAYDETAIL> detailList, decimal dCheckState)
        {
            string             sResult   = "";
            string             ErrInfo   = "";
            T_FB_PERSONACCOUNT entPerson = new T_FB_PERSONACCOUNT();

            try
            {
                IQueryable <T_FB_PERSONACCOUNT> qAccount = from a in dal.GetObjects()
                                                           where
                                                           a.OWNERID == entity.OWNERID &&
                                                           a.OWNERCOMPANYID == entity.OWNERCOMPANYID
                                                           select a;

                if (qAccount != null && qAccount.Count() > 0)
                {
                    ErrInfo = this.GetType().ToString() + "," + System.DateTime.Now.ToString() + " 报销单ID:" + entity.CHARGEAPPLYMASTERID;
                    T_FB_PERSONACCOUNT obj = qAccount.FirstOrDefault();
                    foreach (T_FB_CHARGEAPPLYREPAYDETAIL rep in detailList)
                    {
                        if (dCheckState == Convert.ToDecimal(FBAEnums.CheckStates.Approving) || dCheckState == Convert.ToDecimal(FBAEnums.CheckStates.Approved))
                        {
                            if (rep.REPAYTYPE == 1)
                            {
                                if (obj.SIMPLEBORROWMONEY < rep.REPAYMONEY)
                                {
                                    ErrInfo += " 明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲普通借款审核中时还款金额 " + rep.REPAYMONEY + " 大于借款余额 " + obj.SIMPLEBORROWMONEY + " 审核终止 ||";
                                    Tracer.Debug(ErrInfo);
                                    sResult = "冲借款金额不能大于借款余额,请修改后再操作。";
                                    return(sResult);
                                }
                            }
                            else if (rep.REPAYTYPE == 2)
                            {
                                if (obj.BACKUPBORROWMONEY < rep.REPAYMONEY)
                                {
                                    ErrInfo += " 明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲备用金借款审核中时还款金额 " + rep.REPAYMONEY + " 大于借款余额 " + obj.BACKUPBORROWMONEY + " 审核终止 ||";
                                    Tracer.Debug(ErrInfo);
                                    sResult = "冲借款金额不能大于借款余额,请修改后再操作。";
                                    return(sResult);
                                }
                            }
                            else if (rep.REPAYTYPE == 3)
                            {
                                if (obj.SPECIALBORROWMONEY < rep.REPAYMONEY)
                                {
                                    ErrInfo += " 明细ID:" + rep.CHARGEAPPLYREPAYDETAILID + ", 报销冲专项借款审核中时还款金额 " + rep.REPAYMONEY + " 大于借款余额 " + obj.SPECIALBORROWMONEY + " 审核终止 ||";
                                    Tracer.Debug(ErrInfo);
                                    sResult = "冲借款金额不能大于借款余额,请修改后再操作。";
                                    return(sResult);
                                }
                            }
                        }
                    }
                }
                else
                {
                    ErrInfo = this.GetType().ToString() + "," + System.DateTime.Now.ToString() + " 报销单ID:" + entity.CHARGEAPPLYMASTERID + ", PersonAccount表中找不到相关数据。";
                    Tracer.Debug(ErrInfo);
                    sResult = "没有找到相应的借款总账数据,审核终止!";
                    return(sResult);
                }
                return("");
            }
            catch (Exception ex)
            {
                ErrInfo = this.GetType().ToString() + ":CheckRepMoneyForCharge," + System.DateTime.Now.ToString() + "," + ex.Message;
                Tracer.Debug(ErrInfo);
                sResult = "还款金额检查程序异常,审核终止!";
                return(sResult);
            }
        }
Beispiel #27
0
 public bool AddChargeApplyMasterAndDetailMobile(T_FB_CHARGEAPPLYMASTER chargeMaster, List<T_FB_CHARGEAPPLYDETAIL> chargeDetail,
     List<T_FB_CHARGEAPPLYREPAYDETAIL> chargeRepDetail,ref string strMsg)
 {
     using (ChargeApplyMasterBLL chargeBLL = new ChargeApplyMasterBLL())
     {
         bool re;
         re = chargeBLL.AddChargeApplyMasterAndDetailMobile(chargeMaster, chargeDetail, chargeRepDetail,ref strMsg);
         //re = chargeBLL.AddChargeApplyMasterAndDetail(chargeMaster, chargeDetail, chargeRepDetail);
         return re;
     }
 }
Beispiel #28
0
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            T_FB_CHARGEAPPLYMASTER entCheck = this.OrderEntity.Entity as T_FB_CHARGEAPPLYMASTER;

            if (entCheck.T_FB_BORROWAPPLYMASTER != null && entCheck.PAYTYPE != 2)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage("必须选择冲借款!");
                return;
            }

            if (entCheck.PAYTYPE == 2 && entCheck.T_FB_BORROWAPPLYMASTER == null)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage("请确认已填入借款单!");
                return;
            }

            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_CHARGEAPPLYDETAIL).Name);

            if (details.Count == 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(ErrorMessage.NoDetailInfo);
                return;
            }

            if (details.Count > 5)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(ErrorMessage.OverDetailInfo);
                return;
            }

            #region 去掉无关的关联
            details.ToList().ForEach(item =>
            {
                T_FB_CHARGEAPPLYDETAIL detail = item.Entity as T_FB_CHARGEAPPLYDETAIL;
                detail.T_FB_SUBJECT.T_FB_BORROWAPPLYDETAIL.Clear();
                detail.T_FB_SUBJECT.T_FB_BUDGETACCOUNT.Clear();
                detail.T_FB_SUBJECT.T_FB_CHARGEAPPLYDETAIL.Clear();
            });
            #endregion



            List <string> msgs = new List <string>();

            details.ToList().ForEach(item =>
            {
                T_FB_CHARGEAPPLYDETAIL detail = item.Entity as T_FB_CHARGEAPPLYDETAIL;
                if (detail.CHARGEMONEY <= 0)
                {
                    string errorMessage = string.Format(ErrorMessage.ChargeMoneyZero, detail.T_FB_SUBJECT.SUBJECTNAME);
                    msgs.Add(errorMessage);
                }
                //if (detail.USABLEMONEY.LessThan(detail.CHARGEMONEY))
                //{
                //    msgs.Add(string.Format(ErrorMessage.ChargeMoneyBigger, detail.T_FB_SUBJECT.SUBJECTNAME));
                //}
            });

            //
            var items = from item in details
                        group item by new
            {
                item.GetEntity <T_FB_CHARGEAPPLYDETAIL>().T_FB_SUBJECT.SUBJECTNAME,
                item.GetEntity <T_FB_CHARGEAPPLYDETAIL>().CHARGETYPE,
                item.GetEntity <T_FB_CHARGEAPPLYDETAIL>().USABLEMONEY
            } into g
            where g.Sum(item => item.GetEntity <T_FB_CHARGEAPPLYDETAIL>().CHARGEMONEY) > g.Key.USABLEMONEY
            select new { g.Key, totalCharge = g.Sum(item => item.GetEntity <T_FB_CHARGEAPPLYDETAIL>().CHARGEMONEY) };


            foreach (var item in items)
            {
                msgs.Add(string.Format(ErrorMessage.ChargeMoneyBigger, item.Key.SUBJECTNAME));
            }
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }
        }
Beispiel #29
0
        public bool UptChargeApplyCheckState(T_FB_CHARGEAPPLYMASTER entity, List<T_FB_CHARGEAPPLYDETAIL> chargeDetail,
            List<T_FB_CHARGEAPPLYREPAYDETAIL> chargeRepDetail)
        {
            using (ChargeApplyMasterBLL chargeBLL = new ChargeApplyMasterBLL())
            {
                string strMsg = string.Empty;
                chargeBLL.UptChargeApplyCheckState(entity, chargeDetail, chargeRepDetail, ref strMsg);

                if (!string.IsNullOrWhiteSpace(strMsg))
                {
                    return false;
                }

                return true;
            }

        }
Beispiel #30
0
 public string GetChargeOrderCode(T_FB_CHARGEAPPLYMASTER entity)
 {
     return(new OrderCodeBLL().GetAutoOrderCode(entity));
 }
Beispiel #31
0
 public static T_FB_CHARGEAPPLYMASTER CreateT_FB_CHARGEAPPLYMASTER(
             string cHARGEAPPLYMASTERID, 
             string cHARGEAPPLYMASTERCODE, 
             global::System.DateTime bUDGETARYMONTH, 
             decimal pAYTYPE, 
             decimal tOTALMONEY, 
             decimal eDITSTATES, 
             decimal cHECKSTATES, 
             string oWNERID, 
             string oWNERPOSTID, 
             string oWNERDEPARTMENTID, 
             string oWNERCOMPANYID, 
             string cREATEUSERID, 
             global::System.DateTime cREATEDATE, 
             string cREATECOMPANYID, 
             string cREATEDEPARTMENTID, 
             string cREATEPOSTID, 
             string uPDATEUSERID, 
             global::System.DateTime uPDATEDATE)
 {
     T_FB_CHARGEAPPLYMASTER t_FB_CHARGEAPPLYMASTER = new T_FB_CHARGEAPPLYMASTER();
     t_FB_CHARGEAPPLYMASTER.CHARGEAPPLYMASTERID = cHARGEAPPLYMASTERID;
     t_FB_CHARGEAPPLYMASTER.CHARGEAPPLYMASTERCODE = cHARGEAPPLYMASTERCODE;
     t_FB_CHARGEAPPLYMASTER.BUDGETARYMONTH = bUDGETARYMONTH;
     t_FB_CHARGEAPPLYMASTER.PAYTYPE = pAYTYPE;
     t_FB_CHARGEAPPLYMASTER.TOTALMONEY = tOTALMONEY;
     t_FB_CHARGEAPPLYMASTER.EDITSTATES = eDITSTATES;
     t_FB_CHARGEAPPLYMASTER.CHECKSTATES = cHECKSTATES;
     t_FB_CHARGEAPPLYMASTER.OWNERID = oWNERID;
     t_FB_CHARGEAPPLYMASTER.OWNERPOSTID = oWNERPOSTID;
     t_FB_CHARGEAPPLYMASTER.OWNERDEPARTMENTID = oWNERDEPARTMENTID;
     t_FB_CHARGEAPPLYMASTER.OWNERCOMPANYID = oWNERCOMPANYID;
     t_FB_CHARGEAPPLYMASTER.CREATEUSERID = cREATEUSERID;
     t_FB_CHARGEAPPLYMASTER.CREATEDATE = cREATEDATE;
     t_FB_CHARGEAPPLYMASTER.CREATECOMPANYID = cREATECOMPANYID;
     t_FB_CHARGEAPPLYMASTER.CREATEDEPARTMENTID = cREATEDEPARTMENTID;
     t_FB_CHARGEAPPLYMASTER.CREATEPOSTID = cREATEPOSTID;
     t_FB_CHARGEAPPLYMASTER.UPDATEUSERID = uPDATEUSERID;
     t_FB_CHARGEAPPLYMASTER.UPDATEDATE = uPDATEDATE;
     return t_FB_CHARGEAPPLYMASTER;
 }
Beispiel #32
0
        private void OnBorrowIDChanged <TEntity>() where TEntity : EntityObject
        {
            DetailGrid dgrid = this.EditForm.FindControl("OrderGrid") as DetailGrid;

            if (dgrid != null)
            {
                dgrid.ShowToolBar = false;
            }

            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(TEntity).Name);

            details.Clear();

            T_FB_BORROWAPPLYMASTER borrowMaster = this.OrderEntity.GetObjValue(typeof(T_FB_BORROWAPPLYMASTER).Name.ToEntityString()) as T_FB_BORROWAPPLYMASTER;

            if (borrowMaster == null)
            {
                return;
            }

            int iPayType = 0;

            int.TryParse(this.OrderEntity.GetObjValue("Entity.PAYTYPE").ToString(), out iPayType);
            if (iPayType != 2)
            {
                this.OrderEntity.ReferencedData["Entity.PAYTYPE"] = DataCore.FindRefData("PayTypeData", 2);
            }

            T_FB_CHARGEAPPLYMASTER chargeMaster = this.OrderEntity.Entity as T_FB_CHARGEAPPLYMASTER;

            if (chargeMaster.OWNERID == borrowMaster.OWNERID)
            {
                if (chargeMaster.OWNERPOSTID != borrowMaster.OWNERPOSTID)
                {
                    chargeMaster.OWNERPOSTID   = borrowMaster.OWNERPOSTID;
                    chargeMaster.OWNERPOSTNAME = borrowMaster.OWNERPOSTNAME;
                }

                if (chargeMaster.OWNERDEPARTMENTID != borrowMaster.OWNERDEPARTMENTID)
                {
                    chargeMaster.OWNERDEPARTMENTID   = borrowMaster.OWNERDEPARTMENTID;
                    chargeMaster.OWNERDEPARTMENTNAME = borrowMaster.OWNERDEPARTMENTNAME;
                }

                if (chargeMaster.OWNERCOMPANYID != borrowMaster.OWNERCOMPANYID)
                {
                    chargeMaster.OWNERCOMPANYID   = borrowMaster.OWNERCOMPANYID;
                    chargeMaster.OWNERCOMPANYNAME = borrowMaster.OWNERCOMPANYNAME;
                }
            }

            QueryExpression qeBorrow    = QueryExpressionHelper.Equal("T_FB_BORROWAPPLYMASTER.BORROWAPPLYMASTERID", borrowMaster.BORROWAPPLYMASTERID);
            QueryExpression qeOwner     = this.OrderEntity.GetQueryExpression(FieldName.OwnerID);
            QueryExpression qeOwnerPost = this.OrderEntity.GetQueryExpression(FieldName.OwnerPostID);

            qeBorrow.QueryType         = typeof(TEntity).Name;
            qeBorrow.RelatedExpression = qeOwner;
            qeOwner.RelatedExpression  = qeOwnerPost;

            FBEntityService service = new FBEntityService();

            service.QueryFBEntitiesCompleted += (o, ea) =>
            {
                ea.Result.ToList().ForEach(item =>
                {
                    details.Add(item);
                    item.FBEntityState = FBEntityState.Added;
                });
            };
            service.QueryFBEntities(qeBorrow);
        }
Beispiel #33
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (DaGr.SelectedItems.Count > 0)
            {
                string Result = "";
                string StrTip = "";
                DelInfosList = new ObservableCollection<string>();
                ComfirmWindow com = new ComfirmWindow();
                com.OnSelectionBoxClosed += (obj, result) =>
                {
                    for (int i = 0; i < DaGr.SelectedItems.Count; i++)
                    {
                        T_FB_CHARGEAPPLYMASTER tmpCharge = new T_FB_CHARGEAPPLYMASTER();
                        tmpCharge = DaGr.SelectedItems[i] as T_FB_CHARGEAPPLYMASTER;
                        string ChargeId = "";
                        ChargeId = tmpCharge.CHARGEAPPLYMASTERID;
                        //add zl 2012.2.9
                        if (tmpCharge.T_FB_EXTENSIONALORDER != null)
                        {
                            Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("TIPS"), "出差报销单不能进行删除!");
                            return;
                        }
                        //add end
                        if (!SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(tmpCharge, "T_FB_CHARGEAPPLYMASTER", OperationType.Delete, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID))
                        {
                            StrTip = "您不能删除您选中的第" + (i + 1).ToString() + "条,单据编号为" + tmpCharge.CHARGEAPPLYMASTERCODE + "的报销申请";
                            ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), StrTip, Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                            break;
                        }

                        if (!(DelInfosList.IndexOf(ChargeId) > -1))
                        {
                            if (tmpCharge.CHECKSTATES == (int)CheckStates.UnSubmit)
                            {
                                DelInfosList.Add(ChargeId);
                            }
                        }
                    }
                    if (DelInfosList.Count > 0)
                    {
                        client.DelChargeApplyMasterAndDetailAsync(DelInfosList);
                    }
                    else
                    {
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), "只能删除未提交的单据!",
                   Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    }

                };
                com.SelectionBox(Utility.GetResourceStr("DELETECONFIRM"), Utility.GetResourceStr("DELETEALTER"), ComfirmWindow.titlename, Result);
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "DELETE"), Utility.GetResourceStr("CONFIRMBUTTON"));
            }
        }
Beispiel #34
0
        private void OnQueryCompleted(FBEntity queryEntity)
        {
            try {
                if (queryEntity == null) // 新增
                {
                    this.ExtensionalOrder.EXTENSIONALORDERID    = Guid.NewGuid().ToString();
                    this.ExtensionalOrderFBEntity               = ToFBEntity(this.ExtensionalOrder);
                    this.ExtensionalOrderFBEntity.FBEntityState = FBEntityState.Added;

                    this.ExtensionalOrder.APPLYTYPE = 1;
                    this.ExtensionalOrder.PAYTARGET = 1;
                }
                else
                {
                    this.ExtensionalOrderFBEntity = queryEntity;
                    var curEntity = this.ExtensionalOrderFBEntity.Entity as T_FB_EXTENSIONALORDER;
                    if (this.ExtensionalOrderFBEntity.FBEntityState == FBEntityState.Added)
                    {
                        curEntity.CREATECOMPANYID      = this.ExtensionalOrder.CREATECOMPANYID;
                        curEntity.CREATECOMPANYNAME    = this.ExtensionalOrder.CREATECOMPANYNAME;
                        curEntity.CREATEDEPARTMENTID   = this.ExtensionalOrder.CREATEDEPARTMENTID;
                        curEntity.CREATEDEPARTMENTNAME = this.ExtensionalOrder.CREATEDEPARTMENTNAME;
                        curEntity.CREATEPOSTID         = this.ExtensionalOrder.CREATEPOSTID;
                        curEntity.CREATEPOSTNAME       = this.ExtensionalOrder.CREATEPOSTNAME;
                        curEntity.CREATEUSERID         = this.ExtensionalOrder.CREATEUSERID;
                        curEntity.CREATEUSERNAME       = this.ExtensionalOrder.CREATEUSERNAME;


                        curEntity.OWNERCOMPANYID      = this.ExtensionalOrder.OWNERCOMPANYID;
                        curEntity.OWNERCOMPANYNAME    = this.ExtensionalOrder.OWNERCOMPANYNAME;
                        curEntity.OWNERDEPARTMENTID   = this.ExtensionalOrder.OWNERDEPARTMENTID;
                        curEntity.OWNERDEPARTMENTNAME = this.ExtensionalOrder.OWNERDEPARTMENTNAME;
                        curEntity.OWNERPOSTID         = this.ExtensionalOrder.OWNERPOSTID;
                        curEntity.OWNERPOSTNAME       = this.ExtensionalOrder.OWNERPOSTNAME;
                        curEntity.OWNERID             = this.ExtensionalOrder.OWNERID;
                        curEntity.OWNERNAME           = this.ExtensionalOrder.OWNERNAME;

                        curEntity.UPDATEUSERID   = this.ExtensionalOrder.UPDATEUSERID;
                        curEntity.UPDATEUSERNAME = this.ExtensionalOrder.UPDATEUSERNAME;
                    }
                    this.ExtensionalOrder = curEntity;
                }

                this.DeleteList       = GetRelationFBEntities(this.ExtensionalOrderFBEntity, "_Delete");
                this.ListExtOrderType = GetRelationFBEntities(this.ExtensionalOrderFBEntity, typeof(T_FB_EXTENSIONALTYPE).Name);
                this.ExtensionalOrderDetailFBEntityList = GetRelationFBEntities(this.ExtensionalOrderFBEntity, typeof(T_FB_EXTENSIONORDERDETAIL).Name);
                var masterList     = GetRelationFBEntities(this.ExtensionalOrderFBEntity, typeof(T_FB_CHARGEAPPLYMASTER).Name);
                var masterFBEntity = masterList.FirstOrDefault();
                if (masterFBEntity != null)
                {
                    ChargeApplyMaster     = masterFBEntity.Entity as T_FB_CHARGEAPPLYMASTER;
                    this.ListBorrowDetail = ChargeApplyMaster.T_FB_CHARGEAPPLYREPAYDETAIL;
                }
                else
                {
                    ChargeApplyMaster     = new T_FB_CHARGEAPPLYMASTER();
                    this.ListBorrowDetail = new ObservableCollection <T_FB_CHARGEAPPLYREPAYDETAIL>();
                }

                HandleSpecialSubject();
                this.CountTotalMoney();
                this.ExtensionalOrderDetailFBEntityList.CollectionChanged += new NotifyCollectionChangedEventHandler(FBEntities_CollectionChanged);
                this.ExtensionalOrderDetailFBEntityList.ForEach(detail =>
                {
                    this.RegisterFBEntity(detail);
                });

                if (ListExtOrderType.Count() > 0)
                {
                    (this.ExtensionalOrderFBEntity.Entity as T_FB_EXTENSIONALORDER).T_FB_EXTENSIONALTYPE = ListExtOrderType.FirstOrDefault().Entity as T_FB_EXTENSIONALTYPE;
                }

                QueryDataCompletedInitControl();

                if (InitDataComplete != null)
                {
                    List <string> messages = new List <string>();
                    if (this.TravelSubject != null && this.TravelSubject.SpecialListDetail.Count == 0)
                    {
                        string msg = "当前申请人没有出差的预算额度";
                        if (!IsFromFB)
                        {
                            msg = "工作计划出差单:" + msg;
                        }
                        messages.Add(msg);
                    }
                    InitDataComplete(this, new InitDataCompletedArgs(messages));
                }
            }catch (Exception ex)
            {
                MessageBox.Show("工作计划出差单OnQueryCompleted err:" + ex.ToString());
            }
        }