精简包装情况-统计代码

今晚突然有个想法,发现原来的装箱情况。代码有点多,判断输出太多。现在精简为如下2010年4月26日。

旧代码→执行部分

'重新生成 装箱信息  Beging      接受数据过来
ordersum         = Split(Request("order_sl"),",")
orderproduction  = Split(Replace(Request("cp_sum"),"p",""),",")
For iii=0 To Ubound(orderproduction)  
    Set Rss = conn.execute ("Order_Update 'production_show','','"&orderproduction(iii)&"'")
    meas = Replace(Rss("production_meas"),"*","_")
    meas = Replace(meas,".","")       
    Call js("order_"&Rss("production_class")&"_"&meas,rss("production_nw"),Rss("production_gw"))Next
Call ajax_show()


旧代码→显示部分

Sub js_show()
'显示采血器(100支/箱)__数量
   order_Text_9_275_22_22="<tr height=""26""><td height=""26""  class=""td_br"">采血器(100支/箱)</td>"& vbCrlf
   order_split=split(order_production_9_275_22_22/10000,".")
   If order_split(0)="" then
      order_split_show="0."&order_split(1)
   Else
      order_split_show=order_production_9_275_22_22/10000
   End If
   order_Text_9_275_22_22=order_Text_9_275_22_22&"<td class=""td_br"">"&order_split_show&"</td>"& vbCrlf
   order_split=InStr(order_package_9_275_22_22,".")
   If order_split="0" then
      order_split_show=order_package_9_275_22_22
   Else
      order_split_show=int(order_package_9_275_22_22)+1
   End If
   order_Text_9_275_22_22=order_Text_9_275_22_22&"<td class=""td_br"">"&order_split_show&"</td>"& vbCrlf
   order_Text_9_275_22_22=order_Text_9_275_22_22&"<td class=""td_br"">"&order_meas_9_275_22_22&"</td>"& vbCrlf
   If int(order_split_show)=0 Then
      order_split_show=1
   End If
   order_nw=Round(order_nw_9_275_22_22/int(order_split_show),1)
   order_gw=Round(order_gw_9_275_22_22/int(order_split_show),1)
   order_Text_9_275_22_22=order_Text_9_275_22_22&"<td class=""td_br"">"&order_nw&"</td>"& vbCrlf
   order_Text_9_275_22_22=order_Text_9_275_22_22&"<td class=""td_br"">"&order_gw&"</td>"& vbCrlf
   order_Text_9_275_22_22=order_Text_9_275_22_22&"<td class=""td_br""> </td></tr>"& vbCrlf


新代码→显示部分

Sub js_show(ID)
   Select Case ID
       Case "order_9_275_22_22"
         '显示采血器(100支/箱)__数量
            outtext = outtext & "<tr height=""26""><td height=""26""  class=""td_br"">采血器(100支/箱)</td>"& vbCrlf
            order_split=split(order_production_9_275_22_22/10000,".")
            If order_split(0)="" then
               order_split_show="0."&order_split(1)
            Else
            order_split_show=order_production_9_275_22_22/10000
            End If
            outtext = outtext & "<td class=""td_br"">"&order_split_show&"</td>"& vbCrlf
            order_split=InStr(order_package_9_275_22_22,".")
            If order_split="0" then
               order_split_show=order_package_9_275_22_22
            Else
               order_split_show=int(order_package_9_275_22_22)+1
            End If
            outtext = outtext & "<td class=""td_br"">"&order_split_show&"</td>"& vbCrlf
            outtext = outtext & "<td class=""td_br"">"&order_meas_9_275_22_22&"</td>"& vbCrlf
            If int(order_split_show)=0 Then
               order_split_show=1
            End If
            order_nw=Round(order_nw_9_275_22_22/int(order_split_show),1)
            order_gw=Round(order_gw_9_275_22_22/int(order_split_show),1)
            outtext = outtext & "<td class=""td_br"">"&order_nw&"</td>"& vbCrlf
            outtext = outtext & "<td class=""td_br"">"&order_gw&"</td>"& vbCrlf
            outtext = outtext & "<td class=""td_br""> </td></tr>"& vbCrlf

       Case "22222222"
         '显示刀片__数量
         .......................
   End Select

End Sub


新代码→显示部分

'重新生成 装箱信息  Beging      接受数据过来
Dim P_temp,outtext
ordersum         = Split(Request("order_sl"),",")
orderproduction  = Split(Replace(Request("cp_sum"),"p",""),",")
For iii=0 To Ubound(orderproduction)  
    Set Rss = conn.execute ("Order_Update 'production_show','','"&orderproduction(iii)&"'")
    meas = Replace(Rss("production_meas"),"*","_")
    meas = Replace(meas,".","")       
    Call js("order_"&Rss("production_class")&"_"&meas,rss("production_nw"),Rss("production_gw"))
    P_temp = P_temp & ("order_"&Rss("production_class")&"_"&meas &","
Next
P_temp = Split(Left(P_temp,Len(P_temp)-1),",")
For iii=0 To Ubound(P_temp)  
    Call ajax_show(P_temp(iii))
Next

Response.Write (outtext)

Tags:Asp  Ajaxweb  JS  客户管理  
点击这里获取该日志的TrackBack引用地址
收藏到网摘:
分类: 系统备忘 | 评论: 3 | 引用: 0 |

相关文章:
无限极分类  (2009-12-7 16:10:6)
ie浏览器下的js脚本调试工具 Microsoft Script Debugger收藏  (2009-5-9 23:1:47)
合同错误  (2009-5-5 19:13:35)
js replace 使用  (2009-4-27 16:31:50)
js 获取 option 显示内容  (2008-11-28 11:3:32)
Location.reload 详解  (2008-11-21 16:31:59)
ASP两种生成静态文件时如何设定编码输出格式  (2008-11-1 10:3:9)
汉字转拼音(JS版)  (2008-10-20 14:0:54)
中文转换拼音(ASP版)  (2008-10-20 13:58:18)
把ASP编写成DLL  (2008-1-7 20:44:26)

www.rgjg.gov.cn  Website   Mail   [2011-7-19 16:53:53]  Reply  #3
 
    您是代码狂人啊 我现在看代码就想吐了
 
淘宝刷钻  Website   Mail   [2011-7-19 16:52:39]  Reply  #2
 
    这样弄确实好很多
 
奢侈品  Website   Mail   [2011-7-13 18:33:59]  Reply  #1
 
     吓一跳
 
Name(*):
Mail:
Website:
Verify(*): 看不清,就点我!
Content(*):