//票据数据源 protected void RepeaterBillDataBind() { Repeater_Bill.DataSource = CostReportBillInfoList.OrderByDescending(p => p.OperatingTime).ThenByDescending(p => p.IsPay); Repeater_Bill.DataBind(); lit_SumNoTaxAmount.Text = WebControl.RemoveDecimalEndZero(CostReportBillInfoList.Sum(p => p.NoTaxAmount)) + "元"; lit_SumTax.Text = WebControl.RemoveDecimalEndZero(CostReportBillInfoList.Sum(p => p.Tax)) + "元"; lit_SumTaxAmount.Text = WebControl.RemoveDecimalEndZero(CostReportBillInfoList.Sum(p => p.TaxAmount)) + "元"; }
protected void VoucherPay(CostReportInfo model, bool need, string payBankAccount) { if (need) { model.State = (int)CostReportState.Complete; model.FinishDate = DateTime.Now; model.Memo = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]"); } else { model.State = (int)CostReportState.Pay; model.Memo = WebControl.RetrunUserAndTime("[【待付款】:待支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;]"); } }
/// <summary> /// /// </summary> /// <param name="currentNotolled"></param> /// <param name="nonceTotolled"></param> /// <param name="isChecked"></param> /// <returns></returns> public string ShowCurrentNotolled(object currentNotolled, object nonceTotolled, object isChecked) { if (RTVCompanyCussent.SelectedNode == null) { return("-"); } string toolTips = RTVCompanyCussent.SelectedNode.ToolTip; if (!string.IsNullOrWhiteSpace(toolTips) && toolTips == "Filiale" && Convert.ToInt32(isChecked) == 1) { var current = Convert.ToDecimal(currentNotolled); var nonce = Convert.ToDecimal(nonceTotolled); if (current != nonce && current != 0) { return(string.Format("<font color='red'>{0}</font>", WebControl.RemoveDecimalEndZero(Convert.ToDecimal(currentNotolled)))); } return(WebControl.RemoveDecimalEndZero(Convert.ToDecimal(currentNotolled))); } return("0.00"); }
protected void FeeIncome(CostReportInfo model, string payBankAccount) { model.State = (int)CostReportState.Complete; model.FinishDate = DateTime.Now; model.Memo = WebControl.RetrunUserAndTime("[【已收款】:已收入" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]"); }
protected void BeforeLoan(CostReportInfo model, bool need, string payBankAccount, out bool execute) { execute = false; if (need || (model.IsSystem && model.RealityCost < 0)) { if (model.Deposit.Equals(1)) { model.State = (int)CostReportState.Complete; model.FinishDate = DateTime.Now; model.DepositNo = new CodeManager().GetCode(CodeType.RE); model.Memo = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]"); } else { if (model.IsSystem) { if (model.RealityCost > 0) { model.Memo = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]"); } else if (model.RealityCost < 0) { execute = true; model.Memo = WebControl.RetrunUserAndTime("[【已收款】:已收入" + WebControl.RemoveDecimalEndZero(Math.Abs(model.RealityCost)) + "元;结算账号:" + payBankAccount + ";]"); } model.State = (int)CostReportState.Complete; model.FinishDate = DateTime.Now; } else if (model.IsLastTime) { model.Memo = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]"); //预借款时,可能出现(“票据金额”=“申请金额”,“票据金额”>“申请金额”,“票据金额”<“申请金额”)三种情况 var difference = model.ApplyForCost - model.ActualAmount;//“票据金额”和“申请金额”的差额 if (difference == 0 || difference > 0) { model.RealityCost = difference; model.State = (int)CostReportState.Complete; model.FinishDate = DateTime.Now; } else if (difference < 0) { model.RealityCost = difference; model.ReportMemo = "打款金额多了" + ERP.UI.Web.Common.WebControl.RemoveDecimalEndZero(Math.Abs(difference)) + "元"; model.State = (int)CostReportState.WaitVerify; #region 插入系统生成的金额 CostReportAmountInfoList = _costReportAmount.GetmShop_CostReportAmountByReportId(model.ReportId).Where(p => !p.IsSystem).ToList(); var maxNum = CostReportAmountInfoList.Any() ? CostReportAmountInfoList.Select(p => p.Num).Max() : 0; CostReportAmountInfoList.Add(new CostReportAmountInfo { AmountId = Guid.NewGuid(), ReportId = Guid.Empty, Num = maxNum + 1, Amount = difference, IsPay = true, IsSystem = true }); model.IsSystem = true; #endregion } } else { model.ApplyNumber = ++model.ApplyNumber; model.State = (int)CostReportState.CompletedMayApply; model.Memo = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]"); } } } else { model.State = (int)CostReportState.Pay; model.Memo = WebControl.RetrunUserAndTime("[【待付款】:待支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;]"); } }
protected void PayVerification(CostReportInfo model) { model.State = (int)CostReportState.NoAuditing;//状态:票据待受理 #region 结算账号 IBankAccounts bankAccounts = new BankAccounts(GlobalConfig.DB.FromType.Read); var bankAccountInfo = bankAccounts.GetBankAccounts(model.PayBankAccountId); string payBankAccount = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】"); #endregion model.Memo = WebControl.RetrunUserAndTime("[【审核】:审核通过;审核说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]") + WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]"); }
//申请金额数据源 protected void RepeaterAmountDataBind() { Repeater_Amount.DataSource = CostReportAmountInfoList.OrderBy(p => p.Num); Repeater_Amount.DataBind(); lit_SumAmount.Text = WebControl.RemoveDecimalEndZero(CostReportAmountInfoList.Sum(p => p.Amount)) + "元"; }
//初始化页面数据 protected void LoadReportData(CostReportInfo model) { rbl_ReportKind.SelectedValue = model.ReportKind.ToString(); ddl_AssumeBranch.SelectedValue = model.AssumeBranchId.Equals(Guid.Empty) ? string.Empty : model.AssumeBranchId.ToString(); ddl_AssumeGroup.SelectedValue = model.AssumeGroupId.Equals(Guid.Empty) ? string.Empty : model.AssumeGroupId.ToString(); ddl_AssumeShop.SelectedValue = model.AssumeShopId.Equals(Guid.Empty) ? string.Empty : model.AssumeShopId.ToString(); txt_GoodsCode.Text = model.GoodsCode; if ((model.ReportKind.Equals((int)CostReportKind.Before) && model.IsLastTime) || model.ReportKind.Equals((int)CostReportKind.Later)) { if (model.CostsVarieties.Equals(0)) { CompanyClass.Visible = ImgCompanyClass.Visible = true; } else if (model.CostsVarieties.Equals(1)) { GoodsCode.Visible = txtGoodsCode.Visible = true; } } txt_CompanyClass.Text = Cost.ReadInstance.GetCompanyName(model.CompanyClassId, model.CompanyId); rbl_UrgentOrDefer.SelectedValue = model.UrgentOrDefer.ToString(); txt_UrgentReason.Text = model.UrgentReason; txt_ReportName.Text = model.ReportName + (model.ApplyNumber > 1 ? " " + WebControl.ConvertToChnName(model.ApplyNumber) + "期" : string.Empty); if (model.ReportKind.Equals((int)CostReportKind.Before)) { lit_ReportName.Text = "借款内容"; } txt_StartTime.Text = model.StartTime.ToString("yyyy年MM月"); txt_EndTime.Text = model.EndTime.ToString("yyyy年MM月"); txt_PayCompany.Text = model.PayCompany; //“申报类型”是费用收入时,“收款人”变成“付款人” if (model.ReportKind.Equals((int)CostReportKind.FeeIncome)) { lit_PayCompany.Text = "付款"; } else { #region 预借款、凭证报销、已扣款核销 有“票据类型” BillType.Visible = true; txt_InvoiceTitle.ToolTip = txt_InvoiceTitle.Text = model.InvoiceTitle; rbl_InvoiceType.SelectedValue = string.Format("{0}", model.InvoiceType); if (model.InvoiceType.Equals((int)CostReportInvoiceType.Invoice) || model.InvoiceType.Equals((int)CostReportInvoiceType.VatInvoice)) { InvoiceType.InnerText = "发票"; InvoiceTitle.InnerHtml = "发票抬头:"; BillNo.InnerText = "发票号码"; BillCode.Visible = true; TaxAmount.InnerText = "含税金额"; if (model.InvoiceType.Equals((int)CostReportInvoiceType.Invoice)) { NoTaxAmount.Visible = Tax.Visible = false; } else if (model.InvoiceType.Equals((int)CostReportInvoiceType.VatInvoice)) { NoTaxAmount.Visible = Tax.Visible = true; } } else if (model.InvoiceType.Equals((int)CostReportInvoiceType.Voucher)) { InvoiceType.InnerText = "收据"; InvoiceTitle.InnerHtml = "收据抬头:"; BillNo.InnerText = "收据号码"; BillCode.Visible = false; TaxAmount.InnerText = "金额"; NoTaxAmount.Visible = Tax.Visible = false; } #endregion } if (model.ReportKind.Equals((int)CostReportKind.Before)) { lit_ReportCost.Text = "预估申报"; } txt_ReportCost.Text = WebControl.RemoveDecimalEndZero(Math.Abs(model.ReportCost)); Lit_CapitalAmount.Text = Math.Abs(model.ReportCost).ToString(CultureInfo.InvariantCulture); rbl_CostType.SelectedValue = model.CostType.ToString(); if (model.CostType.Equals(2))//转账 { if (!string.IsNullOrEmpty(model.BankAccountName)) { txt_BankName.Text = model.BankAccountName.Split(',')[0]; txt_SubBankName.Text = model.BankAccountName.Split(',')[1]; } if (model.ReportKind.Equals((int)CostReportKind.Before) || model.ReportKind.Equals((int)CostReportKind.Later)) { txt_BankAccount.Text = model.BankAccount; BankName.Visible = txtBankName.Visible = SubBankName.Visible = txtSubBankName.Visible = BankAccount.Visible = txtBankAccount.Visible = true; } else if (model.ReportKind.Equals((int)CostReportKind.Paying) || model.ReportKind.Equals((int)CostReportKind.FeeIncome)) { BankName.Visible = txtBankName.Visible = SubBankName.Visible = txtSubBankName.Visible = true; } } if (model.ReportKind.Equals((int)CostReportKind.Before) || model.ReportKind.Equals((int)CostReportKind.Later)) { lit_BankName.Text = lit_SubBankName.Text = "收款"; } else if (model.ReportKind.Equals((int)CostReportKind.Paying) || model.ReportKind.Equals((int)CostReportKind.FeeIncome)) { lit_BankName.Text = lit_SubBankName.Text = "付款"; PayBankAccountAndAssumeFiliale.Visible = true; if (!model.PayBankAccountId.Equals(Guid.Empty)) { var bankAccountInfo = _bankAccounts.GetBankAccounts(model.PayBankAccountId); string payBankAccount = bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】"; txt_PayBankAccount.ToolTip = txt_PayBankAccount.Text = payBankAccount; txt_AssumeFiliale.Text = CacheCollection.Filiale.GetFilialeNameAndFilialeId(model.PayBankAccountId).Split(',')[0]; } } //押金回收生成的“凭证报销”和“费用收入”有押金编号,此处要显示 if (!string.IsNullOrEmpty(model.DepositNo)) { DepositNo.Visible = txtDepositNo.Visible = true; txt_DepositNo.Text = model.DepositNo; } txt_ReportMemo.Text = model.ReportMemo; #region 广告使用图片(广告费=>推广费用) if (!model.InvoiceId.Equals(Guid.Empty)) { var costReportInvoice = _costReportInvoice.GetInvoice(model.InvoiceId); if (costReportInvoice != null && !costReportInvoice.InvoiceId.Equals(Guid.Empty)) { PreA.HRef = costReportInvoice.ImagePath; PreA.Visible = true; UploadImgName.Text = costReportInvoice.ImagePath.Substring(costReportInvoice.ImagePath.LastIndexOf('/') + 1); } } #endregion #region 差旅费 if (((model.ReportKind.Equals((int)CostReportKind.Before) && model.IsLastTime) || model.ReportKind == (int)CostReportKind.Later) && !model.CompanyId.Equals(Guid.Empty) && model.CompanyId.Equals(new Guid(CostReport_TravelExpenses))) { //获取差旅费 CostReportTravelInfoList = _costReportTravel.GetlmShop_CostReportTravelByReportId(model.ReportId); if (CostReportTravelInfoList.Any()) { LoadTravelData(CostReportTravelInfoList); } //获取起讫 CostReportTerminiInfoList = _costReportTermini.GetmShop_CostReportTerminiByReportId(model.ReportId); if (CostReportTerminiInfoList.Any()) { RepeaterTerminiDataBind(); } txt_CompanyClass.Style["color"] = "red"; txt_CompanyClass.Style["font-weight"] = "bold"; MessageBox.AppendScript(this, "$(\"#TraveA\").show();$(\"#TraveDetail\").show();$(\"input[id$='Hid_Travel']\").val(\"0\");"); } #endregion if (model.ReportKind.Equals((int)CostReportKind.Before)) { if (!model.PayCost.Equals(0)) { IsLastTime.Visible = true; rb_IsLastTime.SelectedValue = model.IsLastTime.ToString(); if (bool.Parse(rb_IsLastTime.SelectedValue)) { #region 是否终结 rbIsEndTitle.Visible = rbIsEnd.Visible = true; rb_IsEnd.SelectedValue = model.IsEnd.ToString(); #endregion } } #region 申请金额 //获取申请金额 CostReportAmountInfoList = _costReportAmount.GetmShop_CostReportAmountByReportId(model.ReportId).Where(p => !p.IsSystem).ToList(); if (CostReportAmountInfoList.Any()) { RepeaterAmountDataBind(); Amount.Visible = true; } #endregion } if (string.IsNullOrEmpty(model.DepositNo) && (model.ReportKind.Equals((int)CostReportKind.FeeIncome) || model.CompanyClassId.Equals(new Guid(CostReport_DepositMargins)))) { Amount.Visible = false; } #region 票据类型相关 //获取票据 CostReportBillInfoList = _costReportBill.Getlmshop_CostReportBillByReportId(model.ReportId); if (CostReportBillInfoList.Any()) { RepeaterBillDataBind(); Bill.Visible = true; } #endregion #region 是否有权限更改“申报部门” var isEnabled = GetPowerOperationPoint("SetAssume"); ddl_AssumeBranch.Enabled = isEnabled; ddl_AssumeGroup.Enabled = isEnabled; ddl_AssumeShop.Enabled = isEnabled; #endregion Hid_ReportPersonnelId.Value = model.ReportPersonnelId.ToString(); }
protected void FeeIncome(CostReportInfo model, string payBankAccount) { model.State = (int)CostReportState.Complete; model.FinishDate = DateTime.Now; model.Memo = WebControl.RetrunUserAndTime("[【已收款】:已收入" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";收款说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]"); }