Ejemplo n.º 1
0
        public T_FB_CHARGEAPPLYDETAIL GetChargeApplyDetailByID(string strChargeApplyDetailId)
        {
            T_FB_CHARGEAPPLYDETAIL entRd = new T_FB_CHARGEAPPLYDETAIL();

            using (ChargeApplyDetailBLL bllChargeApplyDetail = new ChargeApplyDetailBLL())
            {
                entRd = bllChargeApplyDetail.GetChargeApplyDetailByID(strChargeApplyDetailId);
                return(entRd);
            }
        }
Ejemplo n.º 2
0
 public void AddToT_FB_CHARGEAPPLYDETAIL(T_FB_CHARGEAPPLYDETAIL t_FB_CHARGEAPPLYDETAIL)
 {
     base.AddObject("T_FB_CHARGEAPPLYDETAIL", t_FB_CHARGEAPPLYDETAIL);
 }
Ejemplo n.º 3
0
 public static T_FB_CHARGEAPPLYDETAIL CreateT_FB_CHARGEAPPLYDETAIL(string cHARGEAPPLYDETAILID, decimal cHARGEMONEY, string cREATEUSERID, global::System.DateTime cREATEDATE, string uPDATEUSERID, global::System.DateTime uPDATEDATE)
 {
     T_FB_CHARGEAPPLYDETAIL t_FB_CHARGEAPPLYDETAIL = new T_FB_CHARGEAPPLYDETAIL();
     t_FB_CHARGEAPPLYDETAIL.CHARGEAPPLYDETAILID = cHARGEAPPLYDETAILID;
     t_FB_CHARGEAPPLYDETAIL.CHARGEMONEY = cHARGEMONEY;
     t_FB_CHARGEAPPLYDETAIL.CREATEUSERID = cREATEUSERID;
     t_FB_CHARGEAPPLYDETAIL.CREATEDATE = cREATEDATE;
     t_FB_CHARGEAPPLYDETAIL.UPDATEUSERID = uPDATEUSERID;
     t_FB_CHARGEAPPLYDETAIL.UPDATEDATE = uPDATEDATE;
     return t_FB_CHARGEAPPLYDETAIL;
 }
Ejemplo n.º 4
0
 public T_FB_CHARGEAPPLYDETAIL GetChargeApplyDetailByID(string strChargeApplyDetailId)
 {
     T_FB_CHARGEAPPLYDETAIL entRd = new T_FB_CHARGEAPPLYDETAIL();
     using (ChargeApplyDetailBLL bllChargeApplyDetail = new ChargeApplyDetailBLL())
     {
         entRd = bllChargeApplyDetail.GetChargeApplyDetailByID(strChargeApplyDetailId);
         return entRd;
     }
 }
Ejemplo n.º 5
0
        void browser_ReloadDataEvent()
        {
            if (frmU._lstSubjectApply_Add == null)
            {
                Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("CAUTION"), "请选择要报销的科目");
                return;
            }

            budgetList = frmU._lstSubjectApply_Add;

            foreach (T_FB_BUDGETACCOUNT obj in budgetList)
            {
                T_FB_CHARGEAPPLYDETAIL chaent = new T_FB_CHARGEAPPLYDETAIL();
                chaent.CHARGEAPPLYDETAILID = System.Guid.NewGuid().ToString();

                if (obj.ACCOUNTOBJECTTYPE == 3)         //个人费用报销
                {
                    chaent.CHARGETYPE = 1;
                }
                else if (obj.ACCOUNTOBJECTTYPE == 2)    //部门费用报销
                {
                    chaent.CHARGETYPE = 2;
                }

                chaent.CREATEDATE = DateTime.Now;
                chaent.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                chaent.T_FB_SUBJECT = obj.T_FB_SUBJECT;
                chaent.UPDATEDATE = DateTime.Now;
                chaent.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                chaent.USABLEMONEY = obj.USABLEMONEY;      //据万要求显示可用结余
                //chaent.USABLEMONEY = obj.ACTUALMONEY;    //据万要求显示实际结余
                chaDtlobj.Add(chaent);
            }
            dgvChargeDetailList.ItemsSource = chaDtlobj;

        }
Ejemplo n.º 6
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");
            }
        }
Ejemplo n.º 7
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);
            }
        }