Example #1
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            MKingDeeProof model = new MKingDeeProof();

            if (GetModel(model))
            {
                AjaxResponse(UtilsCommons.AjaxReturnJson(new BFinance().AddOrUpdKingDeeProof(model) ? "1" : "-1", "保存失败!"));
            }
            else
            {
                AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "保存失败!已导出凭证不能修改!"));
            }
        }
Example #2
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="model"></param>
        /// <param name="msg"></param>
        private bool GetModel(MKingDeeProof model)
        {
            model.KingDeeProofDetailLst = null;
            //系统公司
            model.FCompanyId = CurrentUserCompanyID;
            //凭证日期
            model.FDate = Utils.GetDateTime(Utils.GetFormValue("txt_FDate"));
            //业务日期
            model.FTransDate = DateTime.Now;
            //序号(此处序号是浮云)
            model.FSerialNum = 0;
            //制单人
            model.FPreparerId = SiteUserInfo.Name;

            //操作者部门编号
            model.DeptId = SiteUserInfo.DeptId;

            //操作者编号
            model.OperatorId = SiteUserInfo.UserId;

            MTourBaseInfo tourModel = new BTour().GetBasicTourInfo(Utils.GetFormValue("tourId"));

            if (tourModel != null)
            {
                model.FTourCode = tourModel.TourCode;
            }
            model.FTourId = Utils.GetFormValue("tourId") != "" ? Utils.GetFormValue("tourId") : Utils.GetFormValue("KeyId");
            model.FItemId = Utils.GetFormValue("KeyId");
            //凭证类型 团队状态为 封团之后的的类型为 后期收款,其余用传值
            model.FItemType = (DefaultProofType)Utils.GetInt(Utils.GetFormValue("DefaultProofType"));
            if (model.FItemType == DefaultProofType.单团核算)
            {
                model.FItemId = model.FTourId;
            }
            IList <MKingDeeProofDetail> ls = new List <MKingDeeProofDetail>();

            string[] fExplanation = Utils.GetFormValues("txtZy");
            string[] fAccountNum  = Utils.GetFormValues("hide_KmCode");
            string[] fAccountName = Utils.GetFormValues("hide_KmName");
            string[] fItem        = Utils.GetFormValues("hide_Xm");
            string[] fDebit       = Utils.GetFormValues("txtJieFang");
            string[] fCredit      = Utils.GetFormValues("txtDaiFang");
            string[] fId          = Utils.GetFormValues("hide_KmID");
            if (fExplanation.Length > 0)
            {
                model.FId = fId[0];
                for (int i = 0; i < fExplanation.Length; i++)
                {
                    MKingDeeProofDetail detailModel = new MKingDeeProofDetail();
                    if (fAccountNum[i].Split('|').Length > 1)
                    {
                        detailModel.FDetailId   = Utils.GetInt(fAccountNum[i].Split('|')[0]);
                        detailModel.FAccountNum = fAccountNum[i].Split('|')[1];
                    }
                    detailModel.FAccountName = fAccountName[i];
                    detailModel.FExplanation = fExplanation[i];
                    detailModel.FDebit       = Utils.GetDecimal(fDebit[i]);
                    detailModel.FCredit      = Utils.GetDecimal(fCredit[i]);
                    detailModel.FAmountFor   = detailModel.FDebit + detailModel.FCredit;
                    detailModel.FEntryId     = i;
                    detailModel.FItem        = GetJsonByForm(fItem[i]);
                    ls.Add(detailModel);
                }
                model.KingDeeProofDetailLst = ls;
            }
            return(model.KingDeeProofDetailLst != null && model.KingDeeProofDetailLst.Count > 0);
        }