<!-- #include file="../conn.asp" -->
<!-- #include file="../const.asp" -->
<%
otable=request("otable")
field_table=request("otable")
set rs_temp=conn.execute("select * from config_print where print_table='"&request("otable")&"'")
print_head_text=rs_temp("print_head_text")
print_head_style=rs_temp("print_head_style")
print_head2_style=rs_temp("print_head2_style")
print_foot_text=rs_temp("print_foot_text")
print_foot_style=rs_temp("print_foot_style")
print_maxrecord=rs_temp("print_maxrecord")
print_title_style=rs_temp("print_title_style")
print_body_style=rs_temp("print_body_style")
rs_temp.close()
set rs_temp=nothing
startdate=request("startdate")
enddate=request("enddate")
bianhao_type=request("bianhao_type")
bianhao=request("bianhao")
contacts_id=request("contacts_id")
contacts_name=request("contacts_name")
house_id=request("house_id")
house_name=request("house_name")
login_id=request("login_id")
person_id=request("person_id")
person_name=request("person_name")
person2_id=request("person2_id")
person2_name=request("person2_name")
search_code=request("search_code")
search_name=request("search_name")
memo=request("memo")
memo2=request("memo2")
sort_name=request("sort_name")
sort_align=request("sort_align")
getback=request("getback")
set rs =server.createobject("ADODB.RecordSet")
'采购退货明细
elseif request("otable")="buy_back_goods" then
sql="select * from buy_goods where 1=1"
if bianhao<>"" then
sql=sql&" and bianhao like '%"&bianhao&"%'"
end if
if startdate<>"" then
sql=sql&" and datediff(d,'"&startdate&"',ru_datetime)>=0"
else
sql=sql&" and 1=2"
end if
if enddate<>"" then
sql=sql&" and datediff(d,'"&enddate&"',ru_datetime)<=0"
end if
if contacts_id<>"" then
sql=sql&" and contacts_id="&contacts_id
end if
if house_id<>"" then
sql=sql&" and house_id="&house_id
end if
if login_id<>"" then
sql=sql&" and login_id="&login_id
end if
if person_id<>"" then
sql=sql&" and person_id="&person_id
end if
if person2_id<>"" then
sql=sql&" and person2_id="&person2_id
end if
if search_code<>"" then
sql=sql&" and goods_code like '%"&search_code&"%'"
end if
if search_name<>"" then
sql=sql&" and goods_name like '%"&search_name&"%'"
end if
sql=sql&" and bianhao_type='采购退货' and isok=1 and chong=0"
if const_quanxian5_10="0" and const_user_id<>"1" then
sql=sql&" and login_id="&const_user_id
end if
if request("sort_name")<>"" then
sql=sql&" order by "&request("sort_name")&" "&request("sort_align")
else
sql=sql&" order by ru_datetime desc"
end if
end if
rs.open sql,conn,1,1
%>
<HTML><HEAD><TITLE>打印</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312;">
<SCRIPT language=javascript src="../js/soft.js"></SCRIPT>
<LINK rel="stylesheet" href="../css/main.css" type="text/css">
<LINK rel="stylesheet" href="../css/print.css" type="text/css">
<SCRIPT language=javascript src="../js/print.js"></SCRIPT>
</HEAD>
<BODY style="BACKGROUND: #ffffff" leftMargin=0 topMargin=0>
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0 style="display:none;" class="ipt"></OBJECT>
<FORM name=form_excel class="ipt" action="excel2.asp">
<INPUT type=hidden name=search_code value="<%=search_code%>">
<INPUT type=hidden name=search_name value="<%=search_name%>">
<INPUT type=hidden name=startdate value="<%=startdate%>">
<INPUT type=hidden name=enddate value="<%=enddate%>">
<INPUT type=hidden name=bianhao_type value="<%=bianhao_type%>">
<INPUT type=hidden name=bianhao value="<%=bianhao%>">
<INPUT type=hidden name=contacts_id value="<%=contacts_id%>">
<INPUT type=hidden name=contacts_name value="<%=contacts_name%>">
<INPUT type=hidden name=house_id value="<%=house_id%>">
<INPUT type=hidden name=house_name value="<%=house_name%>">
<INPUT type=hidden name=login_id value="<%=login_id%>">
<INPUT type=hidden name=person_id value="<%=person_id%>">
<INPUT type=hidden name=person_name value="<%=person_name%>">
<INPUT type=hidden name=person2_id value="<%=person2_id%>">
<INPUT type=hidden name=person2_name value="<%=person2_name%>">
<INPUT type=hidden name=memo value="<%=memo%>">
<INPUT type=hidden name=memo2 value="<%=memo2%>">
<INPUT type=hidden name=getback value="<%=getback%>">
<INPUT type=hidden name=otable value="<%=otable%>">
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0 class="ipt">
<TBODY>
<TR height=1>
<TD bgColor=#aca899></TD></TR>
<TR height=1>
<TD bgColor=#ffffff></TD></TR></TBODY></TABLE>
<%
if otable="into_out_goods_des" then
field_table="buy_goods"
end if
set rs_field=server.createobject("ADODB.RecordSet")
sql="select * from field where field_print=1"
sql=sql&" and field_table='"&field_table&"'"
sql=sql&" order by field_order"
rs_field.open sql,conn,1,1
field_width_print_sum=0
do while rs_field.eof=false
field_width_print_sum=field_width_print_sum+rs_field("field_width_print")
rs_field.movenext
loop
%>
<%
temp_total_number=0
temp_total_money=0
temp_total_youhui=0
temp_total_fukuan=0
temp_total_fukuan_no=0
temp_total_money_chengben=0
temp_total_money_account=0
x=0
page=FIX(rs.recordcount/print_maxrecord)+Sgn(rs.recordcount/print_maxrecord-FIX(rs.recordcount/print_maxrecord))
for y=1 to page
%>
<TABLE class=dataprint_table cellSpacing=0 cellPadding=0 width="<%=field_width_print_sum+40%>" align=center
border=0>
<TR>
<TD colspan="<%=rs_field.recordcount+1%>">
<TABLE class=dataprint_table cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<tr>
<td style="<%=print_head_style%>"><%=replace(replace(print_head_text&""," "," "),chr(13),"<br>")%></td>
</tr>
</TABLE>
</TD>
</TR>
<TR>
<TD colspan="<%=rs_field.recordcount+1%>" align="right">【日期:<%=startdate%> 至 <%=enddate%>】</TD>
</TR>
<TR>
<TD class=dataprint_title style="<%=print_title_style%>;text-align:center" align=center width=40> </TD>
<%
if rs_field.recordcount<>0 then
rs_field.movefirst
end if
do while rs_field.eof=false
%>
<TD class=dataprint_title style="<%=print_title_style%>" align=center width="<%=rs_field("field_width_print")%>"><%=rs_field("field_name")%></TD>
<%
rs_field.movenext
loop
%>
</TR>
<%
xx=0
do while rs.eof=false
x=x+1
xx=xx+1
if request("otable")="sell_goods" then
if getback="ok" then
temp_number=cdbl(rs("goods_number"))-cdbl(rs("goods_number_back"))
else
temp_number=cdbl(rs("goods_number"))
end if
temp_price=cdbl(rs("goods_price"))
'temp_money=cdbl(rs("goods_money"))
temp_money=temp_number*temp_price
temp_unit=rs("goods_unit1")
if rs("goods_unit_show")="2" then
temp_number=temp_number/cdbl(rs("goods_num"))
temp_price=cdbl(rs("goods_price"))*cdbl(rs("goods_num"))
temp_unit=rs("goods_unit2")
end if
elseif request("otable")="sell_goods_account" then
if getback="ok" then
temp_number=cdbl(rs("goods_number"))-cdbl(rs("goods_number_back"))
else
temp_number=cdbl(rs("goods_number"))
end if
temp_price=cdbl(rs("goods_price"))
temp_price_chengben=cdbl(rs("goods_price_chengben"))
'temp_money=cdbl(rs("goods_money"))
'temp_money_chengben=cdbl(rs("goods_money_chengben"))
temp_money=temp_number*temp_price
temp_money_chengben=temp_number*temp_price_chengben
temp_unit=rs("goods_unit1")
if rs("goods_unit_show")="2" then
temp_number=temp_number/cdbl(rs("goods_num"))
temp_price=cdbl(rs("goods_price"))*cdbl(rs("goods_num"))
temp_price_chengben=cdbl(rs("goods_price_chengben"))*cdbl(rs("goods_num"))
temp_unit=rs("goods_unit2")
end if
temp_money_account=temp_money-temp_money_chengben
if temp_money<>0 then
temp_lilv=temp_money_account/temp_money
else
temp_lilv=0
end if
elseif request("otable")="sell_account" then
temp_number=cdbl(rs("sum_number"))
temp_money=cdbl(rs("sum_money"))
temp_youhui=cdbl(rs("sum_youhui"))
temp_money_chengben=cdbl(rs("sum_money_chengben"))
temp_money_account=temp_money-temp_money_chengben-temp_youhui
if temp_money<>0 then
temp_lilv=temp_money_account/temp_money
else
temp_lilv=0
end if
elseif request("otable")="buy_goods" or request("otable")="sell_back_goods" then
temp_number=cdbl(rs("goods_number"))
temp_price=cdbl(rs("goods_price"))
temp_money=cdbl(rs("goods_money"))
temp_unit=rs("goods_unit1")
if rs("goods_unit_show")="2" then
temp_number=cdbl(rs("goods_number"))/cdbl(rs("goods_num"))
temp_price=cdbl(rs("goods_price"))*cdbl(rs("goods_num"))
temp_unit=rs("goods_unit2")
end if
elseif request("otable")="into_out_goods_des" then
if rs("bianhao_type")="采购退货" or rs("bianhao_type")="销售" then
temp_number=cdbl(rs("goods_number"))
temp_money=cdbl(rs("goods_money"))
elseif rs("bianhao_type")="采购" or rs("bianhao_type")="销售退货" then
temp_number=-cdbl(rs("goods_number"))
temp_money=-cdbl(rs("goods_money"))
end if
temp_price=cdbl(rs("goods_price"))
temp_unit=rs("goods_unit1")
if rs("goods_unit_show")="2" then
temp_number=temp_number/cdbl(rs("goods_num"))
temp_price=cdbl(rs("goods_price"))*cdbl(rs("goods_num"))
temp_unit=rs("goods_unit2")
end if
else
temp_number=cdbl(rs("sum_number"))
temp_money=cdbl(rs("sum_money"))
temp_youhui=cdbl(rs("sum_youhui"))
temp_fukuan=cdbl(rs("sum_fukuan"))
temp_fukuan_no=cdbl(rs("sum_money"))-cdbl(rs("sum_fukuan2"))-cdbl(rs("sum_youhui"))
end if
temp_total_number=temp_total_number+temp_number
temp_total_money=temp_total_money+temp_money
temp_total_youhui=temp_total_youhui+temp_youhui
temp_total_fukuan=temp_total_fukuan+temp_fukuan
temp_total_fukuan_no=temp_total_fukuan_no+temp_fukuan_no
temp_total_money_chengben=temp_total_money_chengben+temp_money_chengben
temp_total_money_account=temp_total_money_account+temp_money_account
if temp_total_money<>0 then
temp_total_lilv=temp_total_money_account/temp_total_money
else
temp_total_lilv=0
end if
%>
<TR>
<TD class=dataprint_line style="<%=print_body_style%>;text-align:center" align=center width=40><%=x%></TD>
////////省
</BODY></HTML>