软件使用场景:
假如你是一个小老板,跟多个合伙人管理多家门店,门店之间的员工存在相互支援工作,A门店的员工可能到B门店做业绩,每天就需要统计每个门店收了多少现金,收了多少网银,需要统计每个门店和每个员工的业绩,多个门店数据也需要汇总。月底了需要给员工发工资,需要看到每家门店的经营情况,甚至需要记录员工的迟到、早退、罚款等情况。门店和员工稍微一多,传统的办法统计业绩和计算工资就会很痛苦,需要专门的财务人员,无形之前又增加了人力成本。许多老板就想到了开发一款记账的软件,很多网络公司的记账软件又不能满足个性化需求,有的价格甚至很高,难以接受,高昂的服务器费用更是难以承受,在这种情况下,非常适合夜鹰教程网的记账结算软件商业版。
先来一波界面截图:
记账的时候多个人的账单一次性的post到后端,实现当天数据批量保存。
记账核心前端代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TbAddBill.aspx.cs" Inherits="TbAddBill" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>
</title>
<script src="My97DatePicker/WdatePicker.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="css/comm.css" />
<style type="text/css">
.formtable {
width:calc(100% - 6px);
margin:0 auto;
border-collapse:collapse;
margin-top:10px;
}
.formtable td {
height:30px;
line-height:30px;
border:solid 1px #333;
padding:0 5px;
}
.formtable td.lable {
text-align:right;
}
.path {
border:solid 1px #333;
height:35px;
line-height:35px;
margin:2px;
padding-left:2px;
position:relative;
}
.lable {
width:235px;
text-align:right;
}
.formtable b{
color:red;
}
table tr:hover{
background-color:lightgreen!important;
}
</style>
</head>
<body data-rolename="<%=BasePage.GetCurrentRoleName()%>">
<form id="form1" runat="server">
<div class="path">当前位置:记账管理 >> 新增记账 </div>
<table class="formtable">
<tr><td class="lable">门店</td><td><asp:DropDownList ID="ddl_Departments" runat="server"></asp:DropDownList></td></tr>
<tr><td class="lable">记账时间</td><td><asp:TextBox ID="tbBillTime" runat="server" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" CssClass="Wdate"></asp:TextBox></td></tr>
</table>
<table class="formtable" id="personbox">
<tr><td class="lable">姓名</td><td>个人业绩</td></tr>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<tr class="depart-<%#Eval("DepartId")%>" style="background-color:<%#Eval("BgColor")%>;"><td class="lable">[<%#Eval("DepartName")%>]<%#Eval("TrueName")%></td><td><input type="text" value="" data-userid="<%#Eval("ID")%>" data-truename="<%#Eval("TrueName")%>" class="pp1" name="personmoney"/> <input type="checkbox" value="1" name="iswork"/> 是否上班 </td></tr>
</ItemTemplate>
</asp:Repeater>
</table>
<table class="formtable">
<tr><td class="lable">网银收入</td><td><asp:TextBox ID="tbIncomeBank" runat="server" style="width:200px;" CssClass="initem"></asp:TextBox> <b>*必填</b></td></tr>
<tr><td class="lable">调货收入网银</td><td><asp:TextBox ID="tbGoodsBank" runat="server" style="width:200px;" CssClass="initem" ></asp:TextBox> <b>*必填</b></td></tr>
<tr><td class="lable">调货收入现金</td><td><asp:TextBox ID="tbGoodsCash" runat="server" style="width:200px;" CssClass="initem"></asp:TextBox> <b>*必填</b></td></tr>
<tr><td class="lable">支出网银</td><td><asp:TextBox ID="tbOutBank" runat="server" style="width:200px;" CssClass="initem"></asp:TextBox> <b>*必填</b> 支出原因<asp:TextBox ID="tbReasonBank" runat="server" style="width:300px;"></asp:TextBox></td></tr>
<tr><td class="lable">支出现金</td><td><asp:TextBox ID="tbOutCash" runat="server" style="width:200px;" CssClass="initem"></asp:TextBox> <b>*必填</b> 支出原因<asp:TextBox ID="tbReasonCash" runat="server" style="width:300px;"></asp:TextBox></td></tr>
<tr><td class="lable">纯毛利</td><td><asp:TextBox ID="tbCunProfits" runat="server" style="width:200px;" Enabled="false"></asp:TextBox> 备注:个人业绩总和</td></tr>
<tr><td class="lable">成本</td><td><asp:TextBox ID="tbcengben" runat="server" style="width:200px;" CssClass="initem" ></asp:TextBox> <b>*必填</b></td></tr>
<tr><td class="lable">总业绩</td><td><asp:TextBox ID="tbAllYeJi" runat="server" style="width:200px;" Enabled="false"></asp:TextBox> 备注:个人业绩+成本</td></tr>
<tr><td class="lable">应收现金</td><td><asp:TextBox ID="tbYingShou" runat="server" style="width:200px;" Enabled="false" ></asp:TextBox> 备注:总业绩-网银收入 </td></tr>
<tr><td class="lable">差额销账</td><td><asp:TextBox ID="tbCha" runat="server" style="width:200px;" Enabled="false"></asp:TextBox> 备注:实收现金 - 应收现金 <b style="color:red; display:none; ">(如果差额不为0,将显示为红色,差额大于<span id="maxchavaluebox"><asp:Literal ID="ltr_max" runat="server"></asp:Literal> </span>,将不能保存)</b></td></tr>
<tr><td class="lable">实收现金</td><td><asp:TextBox ID="tbShiJi" runat="server" style="width:200px;" CssClass="initem"></asp:TextBox> <b>*必填</b></td></tr>
<tr><td class="lable">实际总业绩</td><td><asp:TextBox ID="tbShiJiAll" runat="server" style="width:200px;" Enabled="false" ></asp:TextBox> 备注:总业绩 - 差额 </td></tr>
<tr><td> </td><td><input type="button" value="保存" id="btnsave" /></td></tr>
</table>
<script src="js/jquery-1.11.0.js"></script>
<script>
//计算总业绩
function zongyeji() {
var sum = 0;//个人业绩+成本
var personsum = 0;//个人业绩总和
$("#personbox input[name='iswork']:checked").each(function (index,item) {
var v = $(item).parent().find("input[name='personmoney']").val();
console.log(v);
if (v==""||isNaN(v)) {
v = 0;
}
v = parseFloat(v);
sum += v;
personsum += v;
});
$("#tbCunProfits").val(personsum);
var chengben = $("#tbcengben").val();
console.log("成本"+chengben);
if (chengben==""||isNaN(chengben)) {
chengben = 0;
console.log("===============");
}
chengben = parseFloat(chengben);
sum += chengben;
console.log(sum);
$("#tbAllYeJi").val(sum);
}
//计算应收现金
function yingshouxianjin() {
var allv = $("#tbAllYeJi").val();
var IncomeBankv = $("#tbIncomeBank").val();
allv = parseFloat(allv);
IncomeBankv = parseFloat(IncomeBankv);
var yingshou = allv - IncomeBankv;
$("#tbYingShou").val(yingshou);
}
//计算差额销账
function chaxiaozhang() {
var shijiv = $("#tbShiJi").val();
var YingShouv = $("#tbYingShou").val();
shijiv = parseFloat(shijiv);
YingShouv = parseFloat(YingShouv);
var cha = shijiv - YingShouv;
console.log(cha);
$("#tbCha").val(cha);
shijizongyeji();
}
//计算实际总业绩
function shijizongyeji() {
var zongyeji = $("#tbAllYeJi").val();
var Cha = $("#tbCha").val();
zongyeji = parseFloat(zongyeji);
Cha = parseFloat(Cha);
var shijizongyeji = zongyeji + Cha;
console.log(shijizongyeji);
$("#tbShiJiAll").val(shijizongyeji);
}
$("#personbox input[name='personmoney']").on("input",function () {
zongyeji();
yingshouxianjin();
chaxiaozhang();
});
$("input[name='iswork']").click(function () {
zongyeji();
yingshouxianjin();
chaxiaozhang();
});
$(".initem").on("input", function () {
zongyeji();
yingshouxianjin();
chaxiaozhang();
});
$("#tbIncomeBank").on("input", function () {
zongyeji();
yingshouxianjin();
chaxiaozhang();
});
$("#tbShiJi").on("input", function () {
zongyeji();
yingshouxianjin();
chaxiaozhang();
});
$("#btnsave").click(function (e) {
var flag = true;//验证是否通过
var issavemsg = true;
var msg = "";
//验证时间必须填写
var createtime = $("#tbBillTime").val();
if (!(createtime.length > 0)) {
msg = "请选择记账时间";
$("#tbBillTime").focus();
flag = false;
issavemsg = false;
}
//验证个人业绩
$(".pp1").each(function (index, item) {
if ($(item).parent().find("input[name='iswork']").is(":checked")&& (!($(item).val().length > 0))) {
flag = false;
if (issavemsg) {
msg = "请填写" + $(item).parent().parent().find("td.lable").text()+"的业绩";
$(item).focus();
issavemsg = false;
}
}
});
//验证填写了业绩,必须勾选上班。
$("input[name='personmoney']").each(function (indexp, itemp) {
if (issavemsg) {
if ($(itemp).val().length > 0) {
if (!($(itemp).siblings("input[name='iswork']").is(":checked"))) {
flag = false;
msg = "填写了业绩就必须勾选上班选项!";
$(itemp).focus();
issavemsg = false;
}
}
}
});
//验证必填项目
$(".initem").each(function (index2,item2) {
if(!($(item2).val().length > 0))
{
flag = false;
if (issavemsg) {
msg = "请填写" + $(item2).parent().parent().find("td.lable").text();
$(item2).focus();
issavemsg = false;
}
}
});
var chavalue = $("#tbCha").val();
var maxchavalue = $("#maxchavaluebox").text();
//chavalue = parseFloat(Math.abs(chavalue));
chavalue = parseFloat(chavalue);
maxchavalue = parseFloat(maxchavalue);
if (chavalue<maxchavalue) {
if (!($("body").attr("data-rolename") == "超级管理员" || $("body").attr("data-rolename") == "一级店长")) {
flag = false;
//msg = "差额销账中的差额不能大于" + maxchavalue;
msg = "差额销账项不能保存,请联系一级店长!";
}
}
if (!flag) {
alert(msg);
return false;
}
else {
savedata();
}
});
function savedata() {
var PersonArrayObjs = [];
$("#personbox input[name='iswork']:checked").each(function (index, item) {
var v = $(item).parent().find("input[name='personmoney']").val();
var truename = $(item).parent().find("input[name='personmoney']").attr("data-truename");
var userid = $(item).parent().find("input[name='personmoney']").attr("data-userid");
if (v == "" || isNaN(v)) {
v = 0;
}
v = parseFloat(v);
var itemobj = {};
itemobj["YeJi"] = v;
itemobj["userid"] = userid;
itemobj["truename"] = truename;
PersonArrayObjs.push(itemobj);
console.log(itemobj);
});
var billobj = {};
billobj["DepartId"] = $("#ddl_Departments").val();
billobj["BillTime"] = $("#tbBillTime").val();
billobj["IncomeBank"] = $("#tbIncomeBank").val();
billobj["GoodsBank"] = $("#tbGoodsBank").val();
billobj["GoodsCash"] = $("#tbGoodsCash").val();
billobj["OutBank"] = $("#tbOutBank").val();
billobj["OutCash"] = $("#tbOutCash").val();
billobj["CunProfits"] = $("#tbCunProfits").val();
billobj["BillChengBen"] = $("#tbcengben").val();
billobj["AllYeJi"] = $("#tbAllYeJi").val();
billobj["IncomeCashYingShou"] = $("#tbYingShou").val();
billobj["BillCha"] = $("#tbCha").val();
billobj["IncomeCashShiji"] = $("#tbShiJi").val();
billobj["OutAll"] = $("#tbShiJiAll").val();
billobj["ReasonBank"] = $("#tbReasonBank").val();
billobj["ReasonCash"] = $("#tbReasonCash").val();
console.log(billobj);
//店长保存每天的数据
$.ajax({
type: "post",
url: "Ajax.ashx",
data: { w: "savedatabydianzhang", jsondatastr: JSON.stringify(PersonArrayObjs), billobjstr: JSON.stringify(billobj)},
timeout:10000,
dataType: "json",
async:true,//默认设置为true,所有请求均为异步请求
cache: false,//默认为true(当dataType为script时,默认为false)设置为false将不会从浏览器缓存中加载请求信息。
success: function (data) {
console.log(data);
alert(data.result);
if (data.isrepeat == "0") {
location.reload();
}
}
});
}
</script>
</form>
</body>
</html>
记账核心代码部分:源码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Text;
namespace YYCMS
{
/// <summary>
///TbBillRecords类
/// </summary>
public class TbBillRecords
{
public TbBillRecords()
{ }
#region Model
public int ID { set; get; }
public string CreateTime { set; get; }
public string BillTime { set; get; }
public int? UserId { set; get; }
public string UserName { set; get; }
public int? DepartsId { set; get; }
public decimal? IncomeBank { set; get; }
public decimal? GoodsBank { set; get; }
public decimal? GoodsCash { set; get; }
public decimal? OutBank { set; get; }
public decimal? OutCash { set; get; }
public decimal? CunProfits { set; get; }
public decimal? BillChengBen { set; get; }
public decimal? AllYeJi { set; get; }
public decimal? IncomeCashYingShou { set; get; }
public decimal? BillCha { set; get; }
public decimal? IncomeCashShiji { set; get; }
public decimal? OutAll { set; get; }
public string ReasonBank { set; get; }
public string ReasonCash { set; get; }
#endregion Model
#region 方法成员
/// <summary>
/// 增加一条数据
/// </summary>
public int Add()
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into TbBillRecords(");
strSql.Append("CreateTime,BillTime,UserId,UserName,DepartsId,IncomeBank,GoodsBank,GoodsCash,OutBank,OutCash,CunProfits,BillChengBen,AllYeJi,IncomeCashYingShou,BillCha,IncomeCashShiji,OutAll,ReasonBank,ReasonCash");
strSql.Append(") values (");
strSql.Append("@CreateTime,@BillTime,@UserId,@UserName,@DepartsId,@IncomeBank,@GoodsBank,@GoodsCash,@OutBank,@OutCash,@CunProfits,@BillChengBen,@AllYeJi,@IncomeCashYingShou,@BillCha,@IncomeCashShiji,@OutAll,@ReasonBank,@ReasonCash");
strSql.Append(")");
strSql.Append(";select @@IDENTITY");
SqlParameter[] parameters = {
new SqlParameter("@CreateTime",SqlDbType.NVarChar,50),
new SqlParameter("@BillTime",SqlDbType.NVarChar,50),
new SqlParameter("@UserId",SqlDbType.Int),
new SqlParameter("@UserName",SqlDbType.NVarChar,50),
new SqlParameter("@DepartsId",SqlDbType.Int),
new SqlParameter("@IncomeBank",SqlDbType.Decimal),
new SqlParameter("@GoodsBank",SqlDbType.Decimal),
new SqlParameter("@GoodsCash",SqlDbType.Decimal),
new SqlParameter("@OutBank",SqlDbType.Decimal),
new SqlParameter("@OutCash",SqlDbType.Decimal),
new SqlParameter("@CunProfits",SqlDbType.Decimal),
new SqlParameter("@BillChengBen",SqlDbType.Decimal),
new SqlParameter("@AllYeJi",SqlDbType.Decimal),
new SqlParameter("@IncomeCashYingShou",SqlDbType.Decimal),
new SqlParameter("@BillCha",SqlDbType.Decimal),
new SqlParameter("@IncomeCashShiji",SqlDbType.Decimal),
new SqlParameter("@OutAll",SqlDbType.Decimal),
new SqlParameter("@ReasonBank",SqlDbType.NVarChar,50),
new SqlParameter("@ReasonCash",SqlDbType.NVarChar,50)
};
parameters[0].Value = CreateTime;
parameters[1].Value = BillTime;
parameters[2].Value = UserId;
parameters[3].Value = UserName;
parameters[4].Value = DepartsId;
parameters[5].Value = IncomeBank;
parameters[6].Value = GoodsBank;
parameters[7].Value = GoodsCash;
parameters[8].Value = OutBank;
parameters[9].Value = OutCash;
parameters[10].Value = CunProfits;
parameters[11].Value = BillChengBen;
parameters[12].Value = AllYeJi;
parameters[13].Value = IncomeCashYingShou;
parameters[14].Value = BillCha;
parameters[15].Value = IncomeCashShiji;
parameters[16].Value = OutAll;
parameters[17].Value = ReasonBank;
parameters[18].Value = ReasonCash;
object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
if (obj == null)
{
return 1;
}
else
{
return Convert.ToInt32(obj);
}
}
/// <summary>
/// 修改一条数据
/// </summary>
public int UpdateYeJi()
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update TbBillRecords set ");
strSql.Append("IncomeBank=@IncomeBank,");
strSql.Append("GoodsBank=@GoodsBank,");
strSql.Append("GoodsCash=@GoodsCash,");
strSql.Append("OutBank=@OutBank,");
strSql.Append("OutCash=@OutCash,");
strSql.Append("CunProfits=@CunProfits,");
strSql.Append("BillChengBen=@BillChengBen,");
strSql.Append("AllYeJi=@AllYeJi,");
strSql.Append("IncomeCashYingShou=@IncomeCashYingShou,");
strSql.Append("BillCha=@BillCha,");
strSql.Append("IncomeCashShiji=@IncomeCashShiji,");
strSql.Append("BillTime=@BillTime,");
strSql.Append("OutAll=@OutAll,");
strSql.Append("ReasonBank=@ReasonBank,");
strSql.Append("ReasonCash=@ReasonCash");
strSql.Append(" where ID=@Id");
SqlParameter[] parameters = {
new SqlParameter("@ID",SqlDbType.Int),
new SqlParameter("@IncomeBank",SqlDbType.Decimal),
new SqlParameter("@GoodsBank",SqlDbType.Decimal),
new SqlParameter("@GoodsCash",SqlDbType.Decimal),
new SqlParameter("@OutBank",SqlDbType.Decimal),
new SqlParameter("@OutCash",SqlDbType.Decimal),
new SqlParameter("@CunProfits",SqlDbType.Decimal),
new SqlParameter("@BillChengBen",SqlDbType.Decimal),
new SqlParameter("@AllYeJi",SqlDbType.Decimal),
new SqlParameter("@IncomeCashYingShou",SqlDbType.Decimal),
new SqlParameter("@BillCha",SqlDbType.Decimal),
new SqlParameter("@IncomeCashShiji",SqlDbType.Decimal),
new SqlParameter("@BillTime",SqlDbType.NVarChar),
new SqlParameter("@OutAll",SqlDbType.Decimal),
new SqlParameter("@ReasonBank",SqlDbType.NVarChar,50),
new SqlParameter("@ReasonCash",SqlDbType.NVarChar,50)
};
parameters[0].Value = ID;
parameters[1].Value = IncomeBank;
parameters[2].Value = GoodsBank;
parameters[3].Value = GoodsCash;
parameters[4].Value = OutBank;
parameters[5].Value = OutCash;
parameters[6].Value = CunProfits;
parameters[7].Value = BillChengBen;
parameters[8].Value = AllYeJi;
parameters[9].Value = IncomeCashYingShou;
parameters[10].Value = BillCha;
parameters[11].Value = IncomeCashShiji;
parameters[12].Value = BillTime;
parameters[13].Value = OutAll;
parameters[14].Value = ReasonBank;
parameters[15].Value = ReasonCash;
return DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
}
/// <summary>
/// 修改一条数据
/// </summary>
public int Update()
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update TbBillRecords set ");
strSql.Append("CreateTime=@CreateTime,");
strSql.Append("BillTime=@BillTime,");
strSql.Append("UserId=@UserId,");
strSql.Append("UserName=@UserName,");
strSql.Append("DepartsId=@DepartsId,");
strSql.Append("IncomeBank=@IncomeBank,");
strSql.Append("GoodsBank=@GoodsBank,");
strSql.Append("GoodsCash=@GoodsCash,");
strSql.Append("OutBank=@OutBank,");
strSql.Append("OutCash=@OutCash,");
strSql.Append("CunProfits=@CunProfits,");
strSql.Append("BillChengBen=@BillChengBen,");
strSql.Append("AllYeJi=@AllYeJi,");
strSql.Append("IncomeCashYingShou=@IncomeCashYingShou,");
strSql.Append("BillCha=@BillCha,");
strSql.Append("IncomeCashShiji=@IncomeCashShiji,");
strSql.Append("OutAll=@OutAll,");
strSql.Append("ReasonBank=@ReasonBank,");
strSql.Append("ReasonCash=@ReasonCash");
strSql.Append(" where ID=@Id");
SqlParameter[] parameters = {
new SqlParameter("@ID",SqlDbType.Int),
new SqlParameter("@CreateTime",SqlDbType.NVarChar,50),
new SqlParameter("@BillTime",SqlDbType.NVarChar,50),
new SqlParameter("@UserId",SqlDbType.Int),
new SqlParameter("@UserName",SqlDbType.NVarChar,50),
new SqlParameter("@DepartsId",SqlDbType.Int),
new SqlParameter("@IncomeBank",SqlDbType.Decimal),
new SqlParameter("@GoodsBank",SqlDbType.Decimal),
new SqlParameter("@GoodsCash",SqlDbType.Decimal),
new SqlParameter("@OutBank",SqlDbType.Decimal),
new SqlParameter("@OutCash",SqlDbType.Decimal),
new SqlParameter("@CunProfits",SqlDbType.Decimal),
new SqlParameter("@BillChengBen",SqlDbType.Decimal),
new SqlParameter("@AllYeJi",SqlDbType.Decimal),
new SqlParameter("@IncomeCashYingShou",SqlDbType.Decimal),
new SqlParameter("@BillCha",SqlDbType.Decimal),
new SqlParameter("@IncomeCashShiji",SqlDbType.Decimal),
new SqlParameter("@OutAll",SqlDbType.Decimal),
new SqlParameter("@ReasonBank",SqlDbType.NVarChar,50),
new SqlParameter("@ReasonCash",SqlDbType.NVarChar,50)
};
parameters[0].Value = ID;
parameters[1].Value = CreateTime;
parameters[2].Value = BillTime;
parameters[3].Value = UserId;
parameters[4].Value = UserName;
parameters[5].Value = DepartsId;
parameters[6].Value = IncomeBank;
parameters[7].Value = GoodsBank;
parameters[8].Value = GoodsCash;
parameters[9].Value = OutBank;
parameters[10].Value = OutCash;
parameters[11].Value = CunProfits;
parameters[12].Value = BillChengBen;
parameters[13].Value = AllYeJi;
parameters[14].Value = IncomeCashYingShou;
parameters[15].Value = BillCha;
parameters[16].Value = IncomeCashShiji;
parameters[17].Value = OutAll;
parameters[18].Value = ReasonBank;
parameters[19].Value = ReasonCash;
return DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
}
/// <summary>
/// 删除一条数据
/// </summary>
public int delete()
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from TbBillRecords ");
strSql.Append(" where ID=@ID ");
SqlParameter[] parameters = {
new SqlParameter("@ID", SqlDbType.Int,4)
};
parameters[0].Value = ID;
return DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
}
/// <summary>
/// 获取数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql = new StringBuilder();
strSql.Append(" select * from TbBillRecords ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
return DbHelperSQL.Query(strSql.ToString());
}
/// <summary>
/// 分页查询
/// </summary>
/// <param name="PageIndex">当前第几页</param>
/// <param name="PageSize">每页条数</param>
/// <param name="strWhere">条件</param>
/// <param name="Recordcount">记录总条数</param>
/// <returns></returns>
public DataSet Pager(int PageIndex, int PageSize, string strWhere, out int Recordcount)
{
string strSql = string.Empty;
if (string.IsNullOrEmpty(strWhere))
{
strWhere = " 1=1 ";
}
strSql = string.Format("select top {0} * from V_TbBillRecords where id not in (select top {1} id from V_TbBillRecords where {2} order by BillTime desc) and ({2}) order by BillTime desc", PageSize, PageSize * (PageIndex - 1), strWhere);
DataSet ds = DbHelperSQL.Query(strSql);
string strSql2 = string.Format("select id from V_TbBillRecords where {0}", strWhere);
DataSet dsCount = DbHelperSQL.Query(strSql2);
try
{
Recordcount = dsCount.Tables[0].Rows.Count;
}
catch
{
Recordcount = 0;
}
return DbHelperSQL.Query(strSql.ToString());
}
/// <summary>
/// 批量删除数据
/// </summary>
public int BatchDelete(string _idstr)
{
StringBuilder strSql = new StringBuilder();
strSql.Append(" delete from TbBillRecords ");
strSql.Append(string.Format(" where ID in ({0}) ", _idstr));
return DbHelperSQL.ExecuteSql(strSql.ToString());
}
#endregion 方法成员
}
}