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

📄 outstoreadd.aspx

📁 本系统主要内容是围绕图书销售管理系统而展开讨论的
💻 ASPX
📖 第 1 页 / 共 2 页
字号:
        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 outstoresheetz 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
                        if isdbnull(therow(8)) then
                            thediscount=1
                        else
                            if isnumeric(therow(8)) then
                                thediscount=csng(therow(8))
                            else
                                thediscount=1
                            end if
                        end if
                        thebookcode=therow(0).tostring
                        theoutnum=therow(7)
                        sql="insert into outstoresheetz(code,ddate,buyercode,bookcode,outstorenum,outdiscountz,memo) values('" & trim(unitcode) & "','" & thedate & "','" & buyercode & "','" & thebookcode & "'," & theoutnum & "," & thediscount & ",'" & strmemo & "')"
                        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()
                bindgrid()
                memo.text=""
            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 OutNumStr As string=CType(E.Item.Cells(8).Controls(0),TextBox).Text
        dim strdiscount 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(outnumstr) then
            mydatarowcollection=dtable.rows
            if mydatarowcollection.Contains(theno) then
                therow=mydatarowcollection.Find(theno)
                therow(7)=cint(outnumstr)
                if not isdbnull(strdiscount) and isnumeric(strdiscount) then
                    if csng(strdiscount)>0 and csng(strdiscount)<=1 then
                        therow(8)=csng(strdiscount)
                    else
                        therow(8)=1
                    end if
                else
                    therow(8)=1
                end if
                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>
    <link href="../Main.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form runat="server">
        <b>出库单信息</b>&nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:button class="input_button" id="ClearBtn" onclick="Clear_Click" runat="server" text="清  除" CausesValidation="False"></asp:button>
        &nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保  存"></asp:button>
        &nbsp;&nbsp;&nbsp;&nbsp; 
        <asp:button class="input_button" id="JHBtn" onclick="CKJH_Click" runat="server" text="调入计谋"></asp:button>
        <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-LEFT: 5px" width="35%" height="25">
                        备&nbsp;&nbsp;注: 
                        <asp:TextBox class="input_text" id="memo" runat="server" width="200"></asp:TextBox>
                    </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="subnum" ReadOnly="True" HeaderText="订数"></asp:BoundColumn>
                                <asp:BoundColumn DataField="hadout" ReadOnly="True" HeaderText="已出库"></asp:BoundColumn>
                                <asp:BoundColumn DataField="discount" HeaderText="折扣"></asp:BoundColumn>
                                <asp:BoundColumn DataField="outnum" 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="addtoout"></asp:ButtonColumn>
                            </Columns>
                        </asp:DataGrid>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
</body>
</html>

⌨️ 快捷键说明

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