2024-05-18 15:28:29 +08:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Web ;
using System.Web.UI ;
using System.Web.UI.WebControls ;
using System.Collections ;
using System.Data ;
using Ajax ;
public partial class OrderCollect_list : CommonPage
{
//创建一个共用的编码bll层
Maticsoft . BLL . nr_sys_bianma bm = new Maticsoft . BLL . nr_sys_bianma ( ) ;
//创建一个共用的类型BLL层
Maticsoft . BLL . nr_sys_leixing bmlx = new Maticsoft . BLL . nr_sys_leixing ( ) ;
//创建一个操作记录bll
Maticsoft . BLL . nr_sys_rizhi rizhibll = new Maticsoft . BLL . nr_sys_rizhi ( ) ;
//创建一个操作记录模板
Maticsoft . Model . nr_sys_rizhi rizhi = new Maticsoft . Model . nr_sys_rizhi ( ) ;
int jsid = 0 ;
Maticsoft . Model . nr_z_dd_fysk ddskmodel = new Maticsoft . Model . nr_z_dd_fysk ( ) ;
Maticsoft . BLL . nr_z_dd_fysk ddskbll = new Maticsoft . BLL . nr_z_dd_fysk ( ) ;
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
if ( Session [ "user" ] = = null )
{
Response . Redirect ( "../index.aspx" ) ;
}
binddata ( ) ;
Maticsoft . Model . nr_z_yhzh user = ( Maticsoft . Model . nr_z_yhzh ) ( Session [ "user" ] ) ;
hiddenid . Value = user . juese . ToString ( ) ;
Hiddenname . Value = user . zhanghao ;
fkr . Text = user . zhanghao ;
jsr . Text = user . zhanghao ;
jsid = user . juese ;
pdquanxian ( jsid ) ;
}
Utility . RegisterTypeForAjax ( typeof ( OrderCollect_list ) ) ;
}
#region 数 据 加 载 输 出
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string page_change ( int pg , int pageitem , string paixu , string tiaojian )
{
Maticsoft . Model . nr_z_yhzh zhanghao = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string htmlcode = "" ;
string isexits = string . Format ( "select count(*) from nr_lt_paixu where userid='{0}' and tblname='{1}'" , zhanghao . id , "view_nr_z_dd_wfkd" ) ;
int exitscount = DBHlper . getcount ( isexits ) ;
if ( exitscount > 0 )
{
string paixuselct = string . Format ( "select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu " , zhanghao . id , "view_nr_z_dd_wfkd" , 1 ) ;
DataTable dtselect = DBHlper . Execute ( paixuselct ) . Tables [ 0 ] ;
string wherecode = string . Format ( "select top {0} " , pageitem ) ;
foreach ( DataRow dtr in dtselect . Rows )
{
wherecode + = dtr [ "lieming" ] + "," ;
}
wherecode + = "id" ;
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( zhanghao . juese , "订单收款" , "nr_z_dd_fysk" , "增加全部订单收款" ) )
2024-05-18 15:28:29 +08:00
{
wherecode + = string . Format ( " from view_nr_z_dd_wfkd where " + tiaojian + " id not in(select top ({0}*{1}) id from view_nr_z_dd_wfkd where " + tiaojian + " 1=1 " + paixu + ")" + paixu , pg , pageitem ) ;
}
2024-05-21 15:05:24 +08:00
else if ( DBHlper . GetPermission ( zhanghao . juese , "订单收款" , "nr_z_dd_fysk" , "增加个人订单收款" ) )
2024-05-18 15:28:29 +08:00
{
wherecode + = string . Format ( " from view_nr_z_dd_wfkd where ywy='" + zhanghao . zhanghao + "' and " + tiaojian + " id not in(select top ({0}*{1}) id from view_nr_z_dd_wfkd where " + tiaojian + " 1=1 " + paixu + ")" + paixu , pg , pageitem ) ;
}
DataTable dt_paixu = DBHlper . Execute ( wherecode ) . Tables [ 0 ] ;
if ( dt_paixu . Rows . Count = = 0 )
{
return "<tr><td>   没有数据</td></tr>" ;
}
for ( int i = 0 ; i < dt_paixu . Rows . Count ; i + + )
{
htmlcode + = "<tr tag='" + dt_paixu . Rows [ i ] [ "id" ] + "' name='" + dt_paixu . Rows [ i ] [ "fylx" ] + "'>" ;
htmlcode + = " <td style='width:20px'><input type='checkbox' onclick='selectAllQ(this)' class='xz'/></td>" ;
for ( int j = 0 ; j < dt_paixu . Columns . Count - 1 ; j + + )
{
htmlcode + = "<td><span>" + dt_paixu . Rows [ i ] [ j ] + "</span></td>" ;
}
htmlcode + = "</tr>" ;
}
return htmlcode ;
}
else
{
string lieselect = string . Format ( "select * from nr_sys_lieming where tblname='{0}' ORDER BY xh" , "view_nr_z_dd_wfkd" ) ;
DataTable liedt = DBHlper . Execute ( lieselect ) . Tables [ 0 ] ;
int lieshuixu = 0 ;
foreach ( DataRow liedr in liedt . Rows )
{
lieshuixu + + ;
string cmdinsert = string . Format ( "insert into nr_lt_paixu values('{0}','{1}','{2}','{3}',{4},{5})" , zhanghao . id , "view_nr_z_dd_wfkd" , liedr [ "ywlieming" ] , liedr [ "zwlieming" ] , lieshuixu , 1 ) ;
DBHlper . excutecmd ( cmdinsert ) ;
}
return "" ;
}
}
#endregion
#region 传 入 条 数 返 回 页 数 以 便 前 台 调 用
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public int maxpage ( int count , string tj )
{
int fanhuizhi = 0 ;
string cmd = string . Format ( "select count(*) from view_nr_z_dd_wfkd " + tj ) ;
Maticsoft . Model . nr_z_yhzh yhzh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
2024-05-21 15:05:24 +08:00
if ( ! DBHlper . GetPermission ( yhzh . juese , "订单收款" , "nr_z_dd_fysk" , "增加全部订单收款" ) )
2024-05-18 15:28:29 +08:00
{
if ( tj = = "" )
{
cmd + = " where ywy='" + yhzh . zhanghao + "'" ;
}
else
{
cmd + = " and ywy='" + yhzh . zhanghao + "'" ;
}
}
int sumcount = DBHlper . getcount ( cmd ) ;
if ( sumcount > count )
{
fanhuizhi = sumcount / count ;
}
return fanhuizhi ;
}
#endregion
#region 获 取 页 面 参 数 赋 值 model对象
private void getmd ( )
{
ddskmodel . fkr = fkr . Text ;
ddskmodel . jsr = jsr . Text ;
ddskmodel . skrq = Convert . ToDateTime ( fkrq . Text ) ;
ddskmodel . skfs = fkfs . SelectedItem . Text ;
ddskmodel . fplx = fplx . SelectedItem . Text ;
ddskmodel . fph = fph . Text ;
ddskmodel . bz = bz . Text ;
ddskmodel . zt = "待确认" ;
ddskmodel . fpje = 0 ;
ddskmodel . shuilv = Convert . ToDecimal ( shuilv . Text ) ;
//给日志模板赋值
rizhi . riqi = DateTime . Now ;
rizhi . leixing = "订单收款" ;
}
#endregion
#region 数 据 排 序
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public void itempaixu ( string code )
{
Maticsoft . Model . nr_z_yhzh yhzh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string [ ] pxzu = code . Split ( ';' ) ;
string [ ] codezu = new string [ 4 ] ;
foreach ( string px in pxzu )
{
codezu = px . Split ( '/' ) ;
string cmdexits = string . Format ( "select id from nr_lt_paixu where userid='{0}' and tblname='{1}' and lieming='{2}'" , yhzh . id , "view_nr_z_dd_wfkd" , codezu [ 2 ] ) ;
DataTable paixutable = DBHlper . Execute ( cmdexits ) . Tables [ 0 ] ;
if ( paixutable . Rows . Count > 0 )
{
int idfanhui = Convert . ToInt32 ( paixutable . Rows [ 0 ] [ 0 ] ) ;
string updatepaixu = string . Format ( "update nr_lt_paixu set shuixu={0},isxianshi={1} where id={2}" , codezu [ 0 ] , codezu [ 3 ] , idfanhui ) ;
DBHlper . excutecmd ( updatepaixu ) ;
}
else
{
string paixuinsert = string . Format ( "insert into nr_paixu (userid,tblname,lieming,zhongwen,shuixu,isxianshi) values('{0}','{1}','{2}','{3}',{4},{5})" , yhzh . id , "view_nr_z_dd_wfkd" , codezu [ 2 ] , codezu [ 1 ] , codezu [ 0 ] , codezu [ 3 ] ) ;
DBHlper . excutecmd ( paixuinsert ) ;
}
}
}
#endregion
#region 列 头 排 序
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string paixu ( )
{
Maticsoft . Model . nr_z_yhzh zhanghao = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string paixuselct = string . Format ( "select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu " , zhanghao . id , "view_nr_z_dd_wfkd" , 1 ) ;
DataTable dtselect = DBHlper . Execute ( paixuselct ) . Tables [ 0 ] ;
string htmlcode = "<td style='width:20px'><input onclick='selectall()' title='全选' type='checkbox' style='width:20px' id='cbo_selectall'/></td>" ;
foreach ( DataRow dr in dtselect . Rows )
{
htmlcode + = string . Format ( "<td tag='{0}'>{1}</td>" , dr [ "lieming" ] , dr [ "zhongwen" ] ) ;
}
return htmlcode ;
}
#endregion
#region 获 取 隐 藏 的 列
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string yincanglie ( int endid )
{
Maticsoft . Model . nr_z_yhzh zhanghao = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
endid = endid - 1 ;
string displaycmd = "select * from nr_lt_paixu where isxianshi=0 and tblname='view_nr_z_dd_wfkd' and userid='" + zhanghao . id + "'" ;
DataTable distable = DBHlper . Execute ( displaycmd ) . Tables [ 0 ] ;
string htmlcode = "" ;
foreach ( DataRow dr in distable . Rows )
{
endid + + ;
htmlcode + = "<tr class='tr_item' id='tr_" + endid + "'><td style='width:30%'>" + endid + "</td><td style='width:30%' tag=" + dr [ "lieming" ] + ">" + dr [ "zhongwen" ] + "</td><td style='width:30%'><input type='checkbox'/></td> </tr>" ;
}
return htmlcode ;
}
#endregion
#region 查 询 数 据 总 数
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public int sumitem ( string wheretj )
{
string selectcmd = "select count(*) from view_nr_z_dd_wfkd " + wheretj ;
Maticsoft . Model . nr_z_yhzh yhzh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
2024-05-21 15:05:24 +08:00
if ( ! DBHlper . GetPermission ( yhzh . juese , "订单收款" , "nr_z_dd_fysk" , "增加全部订单收款" ) )
2024-05-18 15:28:29 +08:00
{
if ( wheretj = = "" )
{
selectcmd + = " where ywy='" + yhzh . zhanghao + "'" ;
}
else
{
selectcmd + = " and ywy='" + yhzh . zhanghao + "'" ;
}
}
int sumcount = DBHlper . getcount ( selectcmd ) ;
return sumcount ;
}
#endregion
#region 日 期 查 询
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string nowdaycount ( string wheretj , int selmonth )
{
DateTime nowdt = DateTime . Now ;
int days = DateTime . DaysInMonth ( nowdt . Year , selmonth ) ;
string yuechu = nowdt . Year + "-" + selmonth + "-" + "1" ;
string yuemo = Convert . ToDateTime ( nowdt . Year + "-" + selmonth + "-" + days ) . AddDays ( 1 ) . ToString ( "yyyy-MM-dd" ) ;
DateTime yc = Convert . ToDateTime ( yuechu ) ;
string cmd = "" ;
if ( wheretj = = "" )
{
cmd = string . Format ( "select CONVERT(varchar(12),xdrq,111) as 'riqi' from view_nr_z_dd_wfkd where xdrq>='{0}' and xdrq<='{1}'" , yuechu , yuemo ) ;
}
else
{
cmd = string . Format ( "select CONVERT(varchar(12),xdrq,111) as 'riqi' from view_nr_z_dd_wfkd where " + wheretj + " xdrq>='{0}' and xdrq<='{1}'" , yuechu , yuemo ) ;
}
Maticsoft . Model . nr_z_yhzh yhzh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
2024-05-21 15:05:24 +08:00
if ( ! DBHlper . GetPermission ( yhzh . juese , "订单收款" , "nr_z_dd_fysk" , "增加全部订单收款" ) )
2024-05-18 15:28:29 +08:00
{
cmd + = " and ywy='" + yhzh . zhanghao + "'" ;
}
DataTable dt = DBHlper . Execute ( cmd ) . Tables [ 0 ] ;
var biao = "<table class='lbrilitb' id='tbl_yueli'>"
+ "<tr class='lbrilitbtou'><td width='50px' ><span>日期</span><div><span class='cursor' onclick='yl_up()' title='上月'><</span> <span id='yl_nowmonth' title='" + selmonth + "月'>" + selmonth + "</span> <span class='cursor' onclick='yl_next()' title='下月'>></span></div></td>" ;
for ( var x = 1 ; x < = days ; x + + )
{
biao + = "<td width='50px'>" + x + "</td>" ;
}
biao + = "</tr><tr style='width:100%;height:37px;cursor:pointer'><td width='50px' id='td_sum' onclick='selectallday()' title='全部'>数量</td>" ;
for ( var x = 1 ; x < = days ; x + + )
{
string str = yc . ToShortDateString ( ) ;
int lenth = dt . Select ( "riqi='" + yc . ToShortDateString ( ) + "'" ) . Length ;
string everday = yc . Year . ToString ( ) ;
if ( yc . Month < 10 )
{
everday + = "/0" + yc . Month ;
}
else
{
everday + = "/" + yc . Month ;
}
if ( yc . Day < 10 )
{
everday + = "/0" + yc . Day ;
}
else
{
everday + = "/" + yc . Day ;
}
biao + = "<td width='50px' onclick='selectnowday(this)' tag='" + everday + "'>" + dt . Select ( "riqi='" + everday + "'" ) . Length + "</td>" ;
yc = yc . AddDays ( 1 ) ;
}
biao + = "</tr></table>" ;
return biao ;
}
#endregion
#region 用 来 初 始 化 绑 定 下 拉 框 等 值
private void binddata ( )
{
fkrq . Text = DateTime . Now . Year + "-" + DateTime . Now . Month + "-" + DateTime . Now . Day + " " + DateTime . Now . Hour + ":" + DateTime . Now . Minute ;
DataSet hylx = bmlx . GetAllList ( ) ;
DataRow [ ] dr = hylx . Tables [ 0 ] . Select ( "leixing='付款方式'" ) ;
if ( dr ! = null & & dr . Length > 0 )
{
DataSet hy = bm . GetList ( "zhongleiid='" + dr [ 0 ] [ "id" ] + "'" ) ;
if ( hy ! = null )
{
fkfs . DataSource = hy . Tables [ 0 ] . DefaultView ;
fkfs . DataValueField = "mingcheng" ;
fkfs . DataTextField = "mingcheng" ;
fkfs . DataBind ( ) ;
}
}
dr = hylx . Tables [ 0 ] . Select ( "leixing='发票类型'" ) ;
if ( dr ! = null & & dr . Length > 0 )
{
DataSet xz = bm . GetList ( "zhongleiid='" + dr [ 0 ] [ "id" ] + "'" ) ;
if ( xz ! = null )
{
fplx . DataSource = xz . Tables [ 0 ] . DefaultView ;
fplx . DataValueField = "mingcheng" ;
fplx . DataTextField = "mingcheng" ;
fplx . DataBind ( ) ;
}
}
}
#endregion
#region 敏 感 权 限 查 看
void pdquanxian ( int juese )
{
Maticsoft . Model . nr_z_yhzh user = ( Maticsoft . Model . nr_z_yhzh ) ( Session [ "user" ] ) ;
if ( DBHlper . getzt ( user . id ) ! = 1 )
{
Response . Redirect ( "../index.aspx" ) ;
}
2024-05-21 15:05:24 +08:00
if ( ! DBHlper . GetPermission ( juese , "订单收款" , "nr_z_dd_fysk" , "增加全部订单收款" ) & & ! DBHlper . GetPermission ( juese , "订单收款" , "nr_z_dd_fysk" , "增加个人订单收款" ) )
2024-05-18 15:28:29 +08:00
{
Response . Redirect ( "../Common/nopower.htm" ) ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "订单收款" , "nr_z_dd_fysk" , "导出" ) )
2024-05-18 15:28:29 +08:00
{
xiazai . Visible = true ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( juese , "订单收款" , "nr_z_dd_fysk" , "配置" ) )
2024-05-18 15:28:29 +08:00
{
leiset . Visible = true ;
}
}
#endregion
#region 判 断 查 看 权 限
[Ajax.AjaxMethod]
public string isquanxian ( int uid )
{
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( uid , "订单收款" , "nr_z_dd_fysk" , "增加全部订单收款" ) )
2024-05-18 15:28:29 +08:00
{
return "1" ;
}
2024-05-21 15:05:24 +08:00
else if ( DBHlper . GetPermission ( uid , "订单收款" , "nr_z_dd_fysk" , "增加个人订单收款" ) )
2024-05-18 15:28:29 +08:00
{
return "0" ;
}
else
{
return "" ;
}
}
#endregion
#region 下 载 方 法
public void DownLoad ( object o , EventArgs e )
{
Maticsoft . Model . nr_z_yhzh zhanghao = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string selectid = this . selectid . Value ;
string colmn = "" ;
ArrayList sList = new ArrayList ( ) ;
DataTable dtcolmnname = DBHlper . Execute ( "select lieming,zhongwen from nr_lt_paixu where tblname='view_nr_z_dd_wfkd' and isxianshi=1 and userid='" + ( ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ) . id + "' order by shuixu" ) . Tables [ 0 ] ;
string tj = strwhere . Value ;
foreach ( DataRow r in dtcolmnname . Rows )
{
colmn + = r [ "lieming" ] . ToString ( ) + ',' ;
sList . Add ( r [ "zhongwen" ] . ToString ( ) ) ;
}
colmn = colmn . TrimEnd ( ',' ) ;
string selectcode = "select " + colmn + " from view_nr_z_dd_wfkd where 1=1 " ;
if ( tj ! = "" )
{
selectcode + = " and " + tj + " 1=1 " ;
}
if ( selectid ! = "" )
{
selectcode + = " and id in(" + selectid . TrimEnd ( ',' ) + ")" ;
}
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( zhanghao . juese , "订单收款" , "nr_z_dd_fysk" , "增加全部订单收款" ) )
2024-05-18 15:28:29 +08:00
{
}
2024-05-21 15:05:24 +08:00
else if ( DBHlper . GetPermission ( zhanghao . juese , "订单收款" , "nr_z_dd_fysk" , "增加个人订单收款" ) )
2024-05-18 15:28:29 +08:00
{
selectcode + = " and zdr='" + zhanghao . zhanghao + "'" ;
}
DataTable dt = DBHlper . Execute ( selectcode + " order by id desc" ) . Tables [ 0 ] ;
DBHlper . ExportByWeb ( dt , "订单待收款" + DateTime . Now , sList ) ;
}
#endregion
protected void btn_fksave ( object o , EventArgs e )
{
try
{
string [ ] ids = cgrkid . Value . Split ( ',' ) ;
decimal wsje = 0 ;
decimal fkzje = 0 ;
try
{
fkzje = Convert . ToDecimal ( fkje . Text . Replace ( "¥" , "" ) ) ;
} catch
{
fkzje = Convert . ToDecimal ( fkje . Text . Replace ( "¥" , "" ) ) ; ;
}
decimal fpzje = 0 ;
try
{
fpzje = Convert . ToDecimal ( fpje . Text ) ;
}
catch
{
}
decimal ycje = 0 ;
try
{
ycje = Convert . ToDecimal ( syycje . Text ) ;
}
catch
{
}
decimal mzjes = 0 ;
try
{
mzjes = Convert . ToDecimal ( mzje . Text ) ;
}
catch
{
}
int ci = 0 ;
getmd ( ) ;
foreach ( string id in ids )
{
DataSet skf = DBHlper . Execute ( "select * from view_nr_z_dd_wfkd where id=" + id . Split ( '?' ) [ 0 ] + " and fylx='" + id . Split ( '?' ) [ 1 ] + "'" ) ;
wsje = Convert . ToDecimal ( skf . Tables [ 0 ] . Rows [ 0 ] [ "wsje" ] ) ;
if ( fkzje + mzjes > 0 | | fpzje > 0 )
{
ddskmodel . ddid = Convert . ToInt32 ( id . Split ( '?' ) [ 0 ] ) ;
ddskmodel . fylx = id . Split ( '?' ) [ 1 ] ;
if ( fkzje - wsje > = 0 )
{
ddskmodel . skje = wsje ;
if ( ci = = ids . Length - 1 )
{
ddskmodel . skje = fkzje ;
}
fkzje = fkzje - wsje ;
}
else
{
ddskmodel . skje = fkzje ;
if ( mzjes > 0 )
{
if ( mzjes - wsje + fkzje > 0 )
{
ddskmodel . mzje = wsje - fkzje ;
if ( ci = = ids . Length - 1 )
{
ddskmodel . mzje = mzjes ;
}
mzjes = mzjes - wsje + fkzje ;
}
else
{
ddskmodel . mzje = mzjes ;
mzjes = 0 ;
}
}
else
{
ddskmodel . mzje = mzjes ;
mzjes = 0 ;
}
fkzje = 0 ;
}
if ( fpzje > 0 )
{
if ( fpzje - wsje > 0 )
{
ddskmodel . fpje = wsje ;
if ( ci = = ids . Length - 1 )
{
ddskmodel . fpje = fpzje ;
}
ddskmodel . shsr = ddskmodel . fpje - ddskmodel . fpje / ( 1 + ddskmodel . shuilv / 100 ) ;
fpzje = fpzje - wsje ;
}
else
{
ddskmodel . fpje = fpzje ;
ddskmodel . shsr = ddskmodel . fpje - ddskmodel . fpje / ( 1 + ddskmodel . shuilv / 100 ) ;
fpzje = 0 ;
}
}
if ( ycje > 0 )
{
if ( ycje - wsje + fkzje > 0 )
{
ddskmodel . syycje = wsje ;
if ( ci = = ids . Length - 1 )
{
ddskmodel . syycje = ycje ;
}
ycje = ycje - wsje ;
}
else
{
ddskmodel . syycje = ycje ;
ycje = 0 ;
}
}
else
{
ddskmodel . syycje = ycje ;
ycje = 0 ;
}
int s = ddskbll . Add ( ddskmodel ) ;
if ( s > 0 )
{
//将session转换对象取值
Maticsoft . Model . nr_z_yhzh zh = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
rizhi . yonghuming = zh . zhanghao ;
//拼接字符串插入日志
rizhi . jilu = zh . zhanghao + "进行了订单收款,收款对象为:" + skf . Tables [ 0 ] . Rows [ 0 ] [ "kh_bh" ] + ";收款金额为:¥" + ddskmodel . skje + ";发票金额为:¥" + ddskmodel . fpje ;
rizhibll . Add ( rizhi ) ;
ci + = 1 ;
}
}
}
Response . Write ( "<script Language='javascript'>alert('本次共收款" + ci + "笔!');window.location.href='OrderCollect_list.aspx';</script>" ) ;
}
catch
{
z_error . Text = "收款失败" ;
}
}
#region 汇 总
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string gethuizong ( string tiaojian , string [ ] hzlie )
{
Maticsoft . Model . nr_z_yhzh zhanghao = ( Maticsoft . Model . nr_z_yhzh ) Session [ "user" ] ;
string code = "<td></td>" ;
string paixuselct = string . Format ( "select * from nr_lt_paixu where userid='{0}' and tblname='{1}' and isxianshi={2} order by shuixu " , zhanghao . id , "view_nr_z_dd_wfkd" , 1 ) ;
DataTable dtselect = DBHlper . Execute ( paixuselct ) . Tables [ 0 ] ;
string datacolmn = "" ;
string wherecode = "" ;
int exits = 0 ;
string hzval = "" ;
foreach ( DataRow dr in dtselect . Rows )
{
exits = 0 ;
foreach ( string lie in hzlie )
{
if ( dr [ "zhongwen" ] . ToString ( ) = = lie )
{
exits + + ;
}
}
if ( exits = = 0 )
{
code + = "<td></td>" ;
}
else
{
datacolmn = dr [ "lieming" ] . ToString ( ) ;
wherecode = "select sum(" + datacolmn + ") " ;
2024-05-21 15:05:24 +08:00
if ( DBHlper . GetPermission ( zhanghao . juese , "订单收款" , "nr_z_dd_fysk" , "查看全部" ) )
2024-05-18 15:28:29 +08:00
{
wherecode + = " from view_nr_z_dd_wfkd where " + tiaojian ;
}
2024-05-21 15:05:24 +08:00
else if ( DBHlper . GetPermission ( zhanghao . juese , "订单收款" , "nr_z_dd_fysk" , "查看个人" ) )
2024-05-18 15:28:29 +08:00
{
wherecode + = " from view_nr_z_dd_wfkd where yewuyuan='" + zhanghao . zhanghao + "' and " + tiaojian ;
}
wherecode + = " 1=1 " ;
hzval = DBHlper . getfirstcolmn ( wherecode ) ;
code + = "<td class='blue' title='" + hzval + "'>" + hzval + "</td>" ;
}
}
return code ;
}
#endregion
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string getyck ( double syje , string kh_bh ) {
string jg = "" ;
DataSet ds = DBHlper . Execute ( "select khyck from view_nr_z_kehu where bianhao='" + kh_bh + "'" ) ;
if ( ds ! = null & & ds . Tables [ 0 ] . Rows . Count > 0 ) {
double sjyc = Convert . ToDouble ( ds . Tables [ 0 ] . Rows [ 0 ] [ 0 ] . ToString ( ) ) ;
if ( syje < = sjyc )
{
jg = "ok" ;
}
else {
jg = "no" ;
}
}
return jg ;
}
}