protected void Page_Load(object sender, EventArgs e) { string sqlcmd = Request["SqlCmd"]; List <CashFlowInfo> result = CashFlowInfo.GetFilerResult(sqlcmd); CashFlowRowsTemp.Text = transResult(ref result); }
protected void cashierButton_Click(object sender, EventArgs e) { CashFlowInfo tran = new CashFlowInfo(); int recordID = Convert.ToInt32(Request["RecordID"]); tran.RecordID = recordID; tran.HappenDate = Convert.ToDateTime(happenDate.Text); tran.ProjectCode = projectCode.Text; tran.ProjectAccount = accountList.SelectedValue; tran.CashType = "费用报销"; tran.Income = 0; tran.Expense = Convert.ToDouble(allExpense.Text); tran.Department = department.Text; tran.Summary = ""; tran.Remark = remark.Text; tran.Handler = staffName.Text; Session["CashierDetail"] = tran; Users usr = (Users)Session["Identify"]; BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID); updateApprove("同意", getNextApprover(info), info, false); Response.Redirect("~/Finance/CashCheckin.aspx"); }
/// <summary> /// 新增收支情况 /// </summary> /// <param name="ci"></param> /// <param name="recordid">该笔收支在相应明细表里ID</param> public static void SetCashFlow(CashFlowInfo ci, int recordid) { SqlConnection conn = new SqlConnection(connString); SqlCommand cmd; if (HasCashFlowInfo(recordid, ci.cashType)) { cmd = new SqlCommand("UPDATE [AllCashFlow] SET [HappenDate]=@HappenDate, [ProjectCode]=@ProjectCode, [ProjectAccount]=@ProjectAccount, [Income]=@Income, [Expense]=@Expense, [Department]=@Department, [Summary]=@Summary, [Remark]=@Remark, [Handler]=@Handler, [VoucherID]=@VoucherID, [AccountID]=@AccountID WHERE [RecordID] = @RecordID AND [CashType]=@CashType", conn); } else { cmd = new SqlCommand("INSERT INTO [AllCashFlow] ([RecordID], [HappenDate], [ProjectCode], [ProjectAccount], [CashType], [Income], [Expense], [Department], [Summary], [Remark], [Handler], [VoucherID], [AccountID]) VALUES (@RecordID, @HappenDate, @ProjectCode, @ProjectAccount, @CashType, @Income, @Expense, @Department, @Summary, @Remark, @Handler, @VoucherID, @AccountID)", conn); } cmd.Parameters.Add("@RecordID", SqlDbType.Int).Value = recordid; cmd.Parameters.Add("@HappenDate", SqlDbType.DateTime).Value = ci.happendDate; cmd.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value = ci.projectCode; cmd.Parameters.Add("@ProjectAccount", SqlDbType.VarChar).Value = ci.projectAccount; cmd.Parameters.Add("@CashType", SqlDbType.VarChar).Value = ci.cashType; cmd.Parameters.Add("@Income", SqlDbType.Float).Value = ci.income; cmd.Parameters.Add("@Expense", SqlDbType.Float).Value = ci.expense; cmd.Parameters.Add("@Department", SqlDbType.VarChar).Value = ci.department; cmd.Parameters.Add("@Summary", SqlDbType.VarChar).Value = ci.summary; cmd.Parameters.Add("@Remark", SqlDbType.VarChar).Value = ci.remark; cmd.Parameters.Add("@Handler", SqlDbType.VarChar).Value = ci.handler; cmd.Parameters.Add("@VoucherID", SqlDbType.VarChar).Value = ci.voucherID; cmd.Parameters.Add("@AccountID", SqlDbType.VarChar).Value = ci.accountID; conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); }
protected void linkExport_Click(object sender, EventArgs e) { string sqlcmd = Request["SqlCmd"]; DataTable result = CashFlowInfo.GetFilterResultExecl(sqlcmd); //DataTable2Excel(result);//可用 //ExcelImport(result,"testOA"); //Export(creatView(result)); ExportExcel(result);//可用 }
protected void agreeButton_Click(object sender, EventArgs e) { CashFlowInfo ci = (CashFlowInfo)Session["CashierDetail"]; ci.HappenDate = DateTime.Today;//按日期指的是学校通过记账之后日期 ci.VoucherID = voucherID.Value; ci.AccountID = accountIDList.SelectedValue; CashFlowInfo.SetCashFlow(ci, ci.RecordID); Response.Redirect("~/Account/ApplyListPage.aspx"); }
protected void confirm_Click(object sender, EventArgs e) { PayAssign pi = new PayAssign(); pi.School = schoolList.SelectedValue; pi.ProjectName = projectNameList.SelectedValue; pi.StaffName = staffName.Text; pi.Payee = payee.Value; pi.Payed = Convert.ToDouble(payed.Text); pi.Income = Convert.ToDouble(income.Text); pi.Assigned = Convert.ToDouble(assigned.Text); pi.Instrument = instrument.Text; pi.Hardware = hardware.Text; pi.FundingID = fundingID.Value; pi.ToUniversity = Convert.ToDouble(toUniversity.Text); pi.ToUniversityDetail = toUniversityDetail.Value; pi.ToSchool = Convert.ToDouble(toSchool.Text); pi.ToSchoolDetail = toSchoolDetail.Value; pi.Fundings = Convert.ToDouble(fundings.Text); pi.FundingsDetail = fundingsDetail.Value; pi.Welfare = Convert.ToDouble(welfare.Text); pi.WelfareDetail = welfareDetail.Value; pi.Note = note.Text; pi.ApproveProcess = ""; PayAssign.SetPayAssignOutSchool(-1, pi); CashFlowInfo tran = new CashFlowInfo(); int recordID = Convert.ToInt32(Request["RecordID"]); tran.RecordID = recordID; tran.HappenDate = Convert.ToDateTime(DateTime.Today); tran.ProjectCode = ProjectInfo.GetProjectInfoByName(pi.ProjectName).ProjectCode; tran.ProjectAccount = ProjectInfo.GetProjectInfoByName(pi.ProjectName).ProjectAccount; tran.CashType = "到款分配-校外"; tran.Income = pi.Income; tran.Expense = 0; tran.Department = ""; tran.Summary = ""; tran.Remark = ""; tran.Handler = pi.StaffName; tran.AccountID = "应收账款"; tran.VoucherID = "暂无"; CashFlowInfo.SetCashFlow(tran, tran.RecordID); Response.Redirect("~/Account/ApplyListPage.aspx"); }
protected void confirm_Click(object sender, EventArgs e) { PayAssign pi = new PayAssign(); pi.School = schoolList.SelectedValue; pi.ProjectName = projectNameList.SelectedValue; pi.StaffName = staffName.Text; pi.Payee = payee.Value; pi.Payed = Convert.ToDouble(payed.Text); pi.Income = Convert.ToDouble(income.Text); pi.Assigned = Convert.ToDouble(assigned.Text); pi.Instrument = instrument.Text; pi.Hardware = hardware.Text; pi.FundingID = fundingID.Value; pi.Management = Convert.ToDouble(management.Text); pi.Labor = Convert.ToDouble(labor.Text); pi.Consult = Convert.ToDouble(consult.Text); pi.BusinessTax = Convert.ToDouble(businessTax.Text); pi.AddedValueTax = Convert.ToDouble(addedValueTax.Text); pi.Note = note.Text; pi.ApproveProcess = ""; PayAssign.SetPayAssignInSchool(-1, pi); CashFlowInfo tran = new CashFlowInfo(); int recordID = Convert.ToInt32(Request["RecordID"]); tran.RecordID = recordID; tran.HappenDate = Convert.ToDateTime(DateTime.Today); tran.ProjectCode = ProjectInfo.GetProjectInfoByName(pi.ProjectName).ProjectCode; tran.ProjectAccount = ProjectInfo.GetProjectInfoByName(pi.ProjectName).ProjectAccount; tran.CashType = "到款分配-校内"; tran.Income = pi.Income; tran.Expense = 0; tran.Department = ""; tran.Summary = ""; tran.Remark = ""; tran.Handler = pi.StaffName; tran.AccountID = "应收账款"; tran.VoucherID = "暂无"; CashFlowInfo.SetCashFlow(tran, tran.RecordID); Response.Redirect("~/Account/ApplyListPage.aspx"); }
protected void Page_Load(object sender, EventArgs e) { CashFlowInfo ci = (CashFlowInfo)Session["CashierDetail"]; happenDate.Text = ci.HappenDate.ToShortDateString(); projectCode.Text = ci.ProjectCode; projectAccount.Text = ci.ProjectAccount; cashType.Text = ci.CashType; income.Text = ci.Income.ToString(); expense.Text = ci.Expense.ToString(); department.Text = ci.Department; summary.Text = ci.Summary; handler.Text = ci.Handler; if (!IsPostBack) { DataSet allAcc = AccountList.GetAllAccount(); accountIDList.DataSource = allAcc.Tables[0].DefaultView; accountIDList.DataTextField = "AccountName"; accountIDList.DataValueField = "AccountName"; accountIDList.DataBind(); } }
/// <summary> /// 根据筛选条件,返回结果集 /// </summary> /// <param name="sql"></param> /// <returns></returns> public static List <CashFlowInfo> GetFilerResult(string sql) { List <CashFlowInfo> result = new List <CashFlowInfo>(); SqlConnection conn = new SqlConnection(connString); SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); SqlDataReader sdr = cmd.ExecuteReader(); CashFlowInfo ci = null; while (sdr.Read()) { ci = new CashFlowInfo(); ci.recordID = (int)sdr["RecordID"]; ci.happendDate = (DateTime)sdr["HappenDate"]; ci.projectCode = (string)sdr["ProjectCode"]; ci.projectAccount = (string)sdr["ProjectAccount"]; ci.cashType = (string)sdr["CashType"]; ci.income = (double)sdr["Income"]; ci.expense = (double)sdr["Expense"]; ci.department = (string)sdr["Department"]; ci.summary = (string)sdr["Summary"]; ci.remark = (string)sdr["Remark"]; ci.handler = (string)sdr["Handler"]; ci.voucherID = sdr["VoucherID"] == DBNull.Value?"":(string)sdr["VoucherID"]; ci.accountID = sdr["AccountID"] == DBNull.Value ? "" : (string)sdr["AccountID"]; result.Add(ci); } sdr.Close(); conn.Close(); return(result); }