⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendsubadd.aspx

📁 本系统主要内容是围绕图书销售管理系统而展开讨论的
💻 ASPX
📖 第 1 页 / 共 2 页
字号:
        cmd.executenonquery
    
        bindgrid1()
    End Sub
    
    Sub Save_Click(Sender As Object, E As EventArgs)
    '    Response.write (Server.HtmlDecode("<script language=javascript>alert('数据保存成功!');</script>"))
        dim myDataRowCollection as datarowcollection
        dim theRow as datarow
        dim theTag as Integer
        dim theBookCode as String
        dim theSubNum as Integer
        dim UnitCode as String
        dim DataR as SqlDataReader
        dim theDate as date
        dim BuyerCode as String=selbuyer.selecteditem.value
        dim Sql as String
        if not isdate(ddate.text) then
            page.registerstartupscript("",getalertinfo("错误的日期!"))
            exit sub
        end if
        thedate=cdate(ddate.text.tostring())
        mydatarowcollection=dtable.rows
        if mydatarowcollection.count=0 then
            Page.RegisterStartupScript("",getalertinfo("没有添加数据,无法保存!"))
        else
            thetag=0
            cnn=new sqlconnection(configurationsettings.appsettings("connection"))
            cnn.open
            unitcode=trim(right(year(now),2)) & trim(format(month(now),"00")) & trim(format(day(now),"00"))
            sql="select * from sendsubsheet where left(code,6)='" & trim(unitcode) & "' order by code desc"
            cmd=new sqlcommand(sql,cnn)
            datar=cmd.executereader()
            if datar.read() then
                unitcode=trim(unitcode) & trim(format(cint(right(datar("code").tostring,3))+1,"000"))
            else
                unitcode=trim(unitcode) & "001"
            end if
            datar.close()
            for each theRow In mydatarowcollection
                if not isdbnull(therow(7)) then
                    if cint(therow(7))<>0 then
                        thebookcode=therow(0).tostring
                        thesubnum=therow(7)
                        sql="insert into sendsubsheet(code,ddate,providercode,bookcode,subnum) values('" & trim(unitcode) & "','" & thedate & "','" & buyercode & "','" & thebookcode & "'," & thesubnum & ")"
                        cmd=new sqlcommand(sql,cnn)
                        cmd.executeNonQuery
                        theTag=1
                     end if
                end if
            next
            if thetag<>1 then
                page.registerstartupscript("",getalertinfo("没有添加订数,无法保存!"))
            else
                mydatarowcollection.clear()
                page.registerstartupscript("",getalertinfo("数据保存成功!"))
                bindgrid1()
            end if
        end if
    End Sub
    
    Sub grid_delete(Sender as object,E as DataGridCommandEventArgs)
        dim theNo as string=E.Item.Cells(0).Text
        dim myDataRowCollection as datarowcollection
        dim theRow as datarow
        mydatarowcollection=dtable.rows
        if mydatarowcollection.Contains(theno) then
           therow=mydatarowcollection.Find(theno)
           mydatarowcollection.Remove(theRow)
           bindgrid1()
        end if
    End Sub
    
    Sub Grid_Update(Sender as object,E as DataGridCommandEventArgs)
        dim SubNumStr As string=CType(E.Item.Cells(7).Controls(0),TextBox).Text
        dim theNo as string=E.Item.Cells(0).Text
        dim myDataRowCollection as datarowcollection
        dim theRow as datarow
        if Isnumeric(subnumstr) then
            mydatarowcollection=dtable.rows
            if mydatarowcollection.Contains(theno) then
                therow=mydatarowcollection.Find(theno)
                therow(7)=cint(subnumstr)
                if therow.haserrors then
                    dtable.RejectChanges
                else
                    dtable.AcceptChanges
                end if
            end if
        end if
        DataGrid2.EditItemIndex=-1
        BindGrid1()
    End Sub
    
    Sub Grid_Cancel(Sender as object,E as DataGridCommandEventArgs)
        datagrid2.EditItemIndex=-1
        BindGrid1()
    End Sub
    
    Sub Grid_Edit(Sender as object,E as DataGridCommandEventArgs)
        DataGrid2.EditItemIndex=E.Item.ItemIndex
        BindGrid1()
    End Sub
    
    Sub Grid1_PageIndexChanged(Sender As Object, E As DataGridPageChangedEventArgs)
        datagrid1.CurrentPageIndex = e.NewPageIndex
        BindGrid()
    End Sub
    
    Sub Grid2_PageIndexChanged(Sender As Object, E As DataGridPageChangedEventArgs)
        datagrid2.CurrentPageIndex = e.NewPageIndex
        BindGrid1()
    End Sub
    
    Function GetAlertInfo(byval str1 as string) as String
        dim Str2 as String
        str2="<script language='javascript'>alert('" & str1 & "')<"
        str2+="/"
        str2+="script>"
        return trim(str2)
    End Function

</script>
<html>
<head>
    <title>图书信息</title>
    <link href="../Main.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form runat="server">
        <b>报订信息</b> 
        <hr size="1" />
        <table id="search" cellspacing="1" cellpadding="0" width="100%" align="center" border="0">
            <tbody>
                <tr class="tr2">
                    <td style="PADDING-LEFT: 5px" width="30%" height="25">
                        报订时间: 
                        <asp:TextBox class="input_text" id="DDate" runat="server" width="100"></asp:TextBox>
                        <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="必  填" ControlToValidate="DDate"></asp:RequiredFieldValidator>
                    </td>
                    <td style="PADDING-LEFT: 5px" width="35%" height="25">
                        供 应 商: 
                        <asp:DropDownList class="input_text" id="SelBuyer" runat="server" width="200"></asp:DropDownList>
                    </td>
                    <td style="PADDING-RIGHT: 5px" align="right" width="35%" height="25">
                        <asp:button class="input_button" id="ClearBtn" onclick="Clear_Click" runat="server" text="清  除" CausesValidation="False"></asp:button>
                        &nbsp;&nbsp; 
                        <asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保  存"></asp:button>
                        &nbsp;&nbsp; 
                        <asp:button class="input_button" id="JhBtn" onclick="JH_Click" runat="server" text="调入计划"></asp:button>
                    </td>
                </tr>
                <tr>
                    <td style="PADDING-LEFT: 5px" colspan="3" height="25">
                        <asp:DataGrid id="DataGrid2" runat="server" width="100%" OnPageIndexChanged="Grid2_PageIndexChanged" AllowSorting="True" AllowPaging="True" Font-Names="verdana" bordercolor="Black" cellpadding="2" font-name="verdana" font-size="8pt" headerstyle-backcolor="#F8FAFC" OnEditCommand="Grid_Edit" OnCancelCommand="Grid_Cancel" OnupdateCommand="Grid_Update" OnDeletecommand="Grid_Delete" AutoGenerateColumns="False" PageSize="6">
                            <HeaderStyle font-bold="True" horizontalalign="Center" verticalalign="Middle" backcolor="#F8FAFC"></HeaderStyle>
                            <PagerStyle nextpagetext="下一页" font-names="宋体" font-bold="True" prevpagetext="上一页" horizontalalign="Right" forecolor="Blue" position="Top" mode="NumericPages"></PagerStyle>
                            <EditItemStyle backcolor="#E9F0F8"></EditItemStyle>
                            <Columns>
                                <asp:BoundColumn Visible="False" DataField="Code" ReadOnly="True" HeaderText="图书编号"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Name" ReadOnly="True" HeaderText="图书名称"></asp:BoundColumn>
                                <asp:BoundColumn DataField="cbs" ReadOnly="True" HeaderText="版别"></asp:BoundColumn>
                                <asp:BoundColumn DataField="author" ReadOnly="True" HeaderText="作者"></asp:BoundColumn>
                                <asp:BoundColumn DataField="price" ReadOnly="True" HeaderText="定价" DataFormatString="{0:C}"></asp:BoundColumn>
                                <asp:BoundColumn DataField="recnum" ReadOnly="True" HeaderText="收订数"></asp:BoundColumn>
                                <asp:BoundColumn DataField="hadsubnum" ReadOnly="True" HeaderText="已订数"></asp:BoundColumn>
                                <asp:BoundColumn DataField="subnum" HeaderText="报订数"></asp:BoundColumn>
                                <asp:BoundColumn DataField="kcnum" ReadOnly="True" HeaderText="库存"></asp:BoundColumn>
                                <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="更新" HeaderText="编辑" CancelText="取消" EditText="编辑"></asp:EditCommandColumn>
                                <asp:ButtonColumn Text="删除" HeaderText="删除" CommandName="Delete"></asp:ButtonColumn>
                            </Columns>
                        </asp:DataGrid>
                    </td>
                </tr>
            </tbody>
        </table>
        <br />
        <b>图书信息查询</b> 
        <hr size="1" />
        <table class="" id="search" cellspacing="1" cellpadding="0" width="100%" align="center" border="0">
            <tbody>
                <tr class="tr2">
                    <td style="PADDING-LEFT: 5px" height="25">
                        检索条件: 
                        <asp:DropDownList class="input_text" id="query_tj" runat="server" width="97">
                            <asp:ListItem Value="name" Selected="True">图书名称</asp:ListItem>
                            <asp:ListItem Value="ISBN">图书ISBN</asp:ListItem>
                            <asp:ListItem Value="author">作者</asp:ListItem>
                            <asp:ListItem Value="selfcode">自编码</asp:ListItem>
                            <asp:ListItem Value="memo">备注</asp:ListItem>
                        </asp:DropDownList>
                        &nbsp;&nbsp;检索内容: 
                        <asp:TextBox class="input_text" id="query_content" runat="server" width="120"></asp:TextBox>
                        &nbsp;&nbsp; 
                        <asp:button class="input_button" id="QueryBtn" onclick="Query_Click" runat="server" text="查  询" CausesValidation="False"></asp:button>
                        <br />
                    </td>
                </tr>
                <tr>
                    <td style="PADDING-LEFT: 5px" height="25">
                        <asp:DataGrid id="DataGrid1" runat="server" width="100%" OnPageIndexChanged="Grid1_PageIndexChanged" AllowSorting="True" AllowPaging="True" Font-Names="verdana" bordercolor="Black" cellpadding="2" font-name="verdana" font-size="8pt" headerstyle-backcolor="#F8FAFC" AutoGenerateColumns="False" PageSize="3" OnItemCommand="AddToSub_Click">
                            <HeaderStyle font-bold="True" horizontalalign="Center" verticalalign="Middle" backcolor="#F8FAFC"></HeaderStyle>
                            <PagerStyle nextpagetext="下一页" font-names="宋体" font-bold="True" prevpagetext="上一页" horizontalalign="Right" forecolor="Blue" mode="NumericPages"></PagerStyle>
                            <Columns>
                                <asp:BoundColumn Visible="False" DataField="Code" ReadOnly="True" HeaderText="图书编号"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Name" HeaderText="图书名称">
                                    <HeaderStyle width="130px"></HeaderStyle>
                                </asp:BoundColumn>
                                <asp:BoundColumn DataField="abbrname" ReadOnly="True" HeaderText="版别">
                                    <HeaderStyle width="40px"></HeaderStyle>
                                </asp:BoundColumn>
                                <asp:BoundColumn DataField="price" HeaderText="定价" DataFormatString="{0:C}">
                                    <HeaderStyle width="30px"></HeaderStyle>
                                </asp:BoundColumn>
                                <asp:BoundColumn DataField="author" HeaderText="作者">
                                    <HeaderStyle width="40px"></HeaderStyle>
                                </asp:BoundColumn>
                                <asp:BoundColumn DataField="version" HeaderText="版次"></asp:BoundColumn>
                                <asp:BoundColumn DataField="storeamountz" ReadOnly="True" HeaderText="总店库存">
                                    <HeaderStyle width="60px"></HeaderStyle>
                                </asp:BoundColumn>
                                <asp:BoundColumn DataField="storeamounta" ReadOnly="True" HeaderText="门市库存">
                                    <HeaderStyle width="60px"></HeaderStyle>
                                </asp:BoundColumn>
                                <asp:ButtonColumn Text="添加至订单" HeaderText="操作" CommandName="addtosub"></asp:ButtonColumn>
                            </Columns>
                        </asp:DataGrid>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -