User Profile & Activity

Frank Bruce Member
Page
of 15
Posted: December 14, 2010 8:55 PM

I am  sorry,you demo can not meet my need.
Please See the picture below,my need has described by the picture.Thank you.

It such as:

    function wcCategory_OnKeyDown(controlId, keyValue) {
            var wcCategory = ISGetObject("wcCategory");

            if (keyValue == 13 && wcCategory.Value!="") {
                var wcProduct = ISGetObject("wcProduct");

                window.setTimeout(function () {
                    wcProduct.SetFocus();
                }, 1);
            }

            return true;
        }
Posted: December 13, 2010 4:43 AM

My page  has UpdatePanel 、ajaxPro2.0.
when I Clear "  <asp:ScriptManager ID="ScriptManager2" runat="server" />
      <asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>

</ContentTemplate>
    </asp:UpdatePanel>"  it will display normal.But when  I refresh the page,it will cause js error:

  对象不支持此属性或方法  core.ashx, 行509 字符3




  Html:
<asp:ScriptManager ID="ScriptManager2" runat="server" /> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <ISWebDesktop:WebDialogBox ID="WebDialogBox1" runat="server" Height="420px" Width="410px" DialogBoxImage="None"> <WindowSettings > <WindowStyle> <Normal BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" Font-Names="Tahoma" Font-Size="8pt"> </Normal> <Active BaseStyle="Normal" BorderColor="Gray"> </Active> </WindowStyle> <CaptionStyle> <Normal Cursor="Default" BackColor2="Gainsboro" BackColor="Gray" Font-Bold="True" Font-Names="Tahoma" Font-Size="10pt" ForeColor="White"> <Padding Top="2px" Left="2px" Right="2px" Bottom="2px"></Padding> </Normal> <Active BackColor2="192, 192, 255" BaseStyle="Normal" BackColor="Navy"> </Active> </CaptionStyle> <CaptionButtonStyle> <Normal Overflow="Hidden" OverflowY="Hidden" OverflowX="Hidden" BorderColor="White" BorderStyle="Solid" BorderWidth="1px" Height="17px"> </Normal> <Over BaseStyle="Normal"> <BorderSettings> <Bottom Color="Gray"></Bottom> <Right Color="Gray"></Right> </BorderSettings> </Over> <Active BaseStyle="Normal"> <BorderSettings> <Left Color="Gray"></Left> <Top Color="Gray"></Top> </BorderSettings> </Active> </CaptionButtonStyle> <ContainerStyle BackColor="White" Font-Names="Tahoma" Font-Size="8pt" Height="100%" Width="100%"> <Padding Top="4px" Left="4px" Right="4px" Bottom="4px"></Padding> </ContainerStyle> <CommandButtonStyle> <Normal BackColor="Control" BorderColor="ControlDarkDark" BorderStyle="Solid" BorderWidth="1px" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma" Font-Size="8pt" Font-Underline="False"> </Normal> <Over BaseStyle="Normal" BackColor="#C5C2AF"> </Over> <Active BaseStyle="Normal" BackColor="#8A887B" ForeColor="White"> </Active> </CommandButtonStyle> <CommandButtonDisabledStyle BackgroundImage="" CustomRules="" BackColor="Control" BorderColor="ControlDarkDark" BorderStyle="Solid" BorderWidth="1px" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma" Font-Size="8pt" Font-Underline="False" ForeColor="Gray"> </CommandButtonDisabledStyle> </WindowSettings> <ContentTemplate> <table width="375px"> <tr> <td width="45px"> 关键字 </td> <td> <ISWebInput:WebInput Width="116px" ID="WebInput1" runat="server"> </ISWebInput:WebInput> </td> <td> <ISWebDesktop:WebButton ID="WebButton2" runat="server" Height="20px" Text="查找" Width="50px" OnClientClick="sendRuquest" AutoPostback="true" PostBackMode="FlyPostBack"> </ISWebDesktop:WebButton> </td> <td width="162px" align="right"> <ISWebDesktop:WebButton ID="WebButton4" runat="server" Height="20px" Text="关闭" Width="50px" OnClientClick="closeDialog" > <ButtonStyle Normal-BackColor="White" Normal-BorderWidth="0" Over-BorderWidth="0" Over-BackColor="Red" > </ButtonStyle> </ISWebDesktop:WebButton> </td> </tr> <tr> <td colspan="4"> <ISWebGrid:WebGrid ID="WebGrid2" runat="server" Height="315px" UseDefaultStyle="True" Width="371px" DefaultStyleMode="Elegant" OnInitializeDataSource="WebGrid2_InitializeDataSource" OnInitializePostBack="WebGrid2_InitializePostBack"> <LayoutSettings AlternatingColors="false" AllowContextMenu="False"> <ClientSideEvents OnKeyDown="DbclickAutoFill()" /> <SelectedRowStyle BackColor="#FFBD69" /> </LayoutSettings> <RootTable DataKeyField="tradecode"> <Columns> <ISWebGrid:WebGridColumn Caption="商品编号" DataMember="tradecode" Name="tradecode" Width="70px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="商品名称" DataMember="fullname" Name="fullname" Width="70px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="商品单位" DataMember="unit" Name="unit" Width="70px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="库存数量" DataMember="qty" DataType="System.Double" Name="qty" Width="70px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="单价/元" DataFormatString="##,###.00" DataMember="price" DataType="System.Double" Name="price" Width="70px"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> </ISWebGrid:WebGrid> </td> </tr> </table> </ContentTemplate> </ISWebDesktop:WebDialogBox> </ContentTemplate> </asp:UpdatePanel>
C#
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class AddBuysBill : System.Web.UI.Page
{
    operateClass.BaseInfo dbcon = new operateClass.BaseInfo();
    operateClass.BaseInfo.cBillInfo billinfo = new operateClass.BaseInfo.cBillInfo();
    operateClass.BaseInfo.cStockInfo stockinfo = new operateClass.BaseInfo.cStockInfo();
    operateClass.BaseInfo.cCurrentAccount currentAccount = new operateClass.BaseInfo.cCurrentAccount();
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(AddBuysBill));
        if (!IsPostBack)
        {          
            dbcon.deleteTempStock();//清空进货单临时表
            WebInput2.Value = "0";
            DataSet ds = null;
            string P_Str_newBillCode = "";
            int P_Int_newBillCode = 0;
            ds = dbcon.getWarehouseMain(); //获取进货主表      
            if (ds.Tables[0].Rows.Count == 0)
            {
                WebInputId.Text = DateTime.Now.ToString("yyyyMMdd") + "JH" + "1000001";
            }
            else
            {
                P_Str_newBillCode = Convert.ToString(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["billcode"]);
                P_Int_newBillCode = Convert.ToInt32(P_Str_newBillCode.Substring(10, 7)) + 1;
                P_Str_newBillCode = DateTime.Now.ToString("yyyyMMdd") + "JH" + P_Int_newBillCode.ToString();
                WebInputId.Text = P_Str_newBillCode;
            }

        }
    }
    protected void WebGrid1_CustomAggregate(object sender, ISNet.WebUI.WebGrid.CustomAggregateArgs e)
    {
        double sum1 = 0;
        double sum2 = 0;
        double PaySum = 0;
        if (e.Column.Name == "tsum")
        {
            for (int i = 0; i < WebGrid1.RootTable.Rows.Count; i++)
            {
                sum1 = Convert.ToDouble(WebGrid1.RootTable.Rows[i].Cells.GetNamedItem("qty").Text);
                sum2 = Convert.ToDouble(WebGrid1.RootTable.Rows[i].Cells.GetNamedItem("price").Text);
                PaySum += sum1 * sum2;
            }

            e.AggregateResult = PaySum;
        }

    }  
    protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
        if (e.Row.Type == ISNet.WebUI.WebGrid.RowType.Record)
        {
            e.Row.Cells.GetNamedItem("idxBox").Text = (e.Row.Position + 1).ToString();
            e.Row.Cells.GetNamedItem("idxBox").Value = (e.Row.Position + 1).ToString();
            e.Row.Cells.GetNamedItem("tsum").Text = (Convert.ToDouble(e.Row.Cells.GetNamedItem("qty").Value) * Convert.ToDouble(e.Row.Cells.GetNamedItem("price").Value)).ToString().Trim();
            e.Row.Cells.GetNamedItem("tsum").Value = Convert.ToDouble(e.Row.Cells.GetNamedItem("qty").Value) * Convert.ToDouble(e.Row.Cells.GetNamedItem("price").Value);

        }   
    }
    protected void WebGrid2_InitializePostBack(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e)
    {
        if (e.Action == ISNet.WebUI.WebGrid.PostBackAction.Custom)
        {
            WebGrid2.ClientAction.Refresh();
        }
    }
    protected void WebGrid2_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
    {
        e.DataSource = dbcon.getStockByName(WebInput1.Text); 
    }
    [AjaxPro.AjaxMethod]
    public int saveBuyBill()
    {
        //向进货表(主表)信息
        billinfo.BillDate = Convert.ToDateTime(WebInputDate.Text);
        billinfo.BillCode = WebInputId.Text;
        billinfo.Handle = WebComName.Text;
        billinfo.Units = WebComUnit.Text;
        billinfo.Summary = WebInputSummary.Text;
        billinfo.FullPayment = Convert.ToSingle(payTxt.Text);
        billinfo.Payment = Convert.ToSingle(WebInput2.Text);
        int i = dbcon.AddBuyBill(billinfo);
        //int i = dbcon.AddBuyBill();      
        return i;
    }

    //保存到进货单主表
    [AjaxPro.AjaxMethod]
    public int saveWaremain(string date, string billcode, string handle, string unit, string summary, double fullpay, double pay)
    {
        billinfo.BillDate = Convert.ToDateTime(date);
        billinfo.BillCode = billcode;
        billinfo.Handle = handle;
        billinfo.Units = unit;
        billinfo.Summary = summary;
        billinfo.FullPayment = fullpay;
        billinfo.Payment = pay;
        int k = dbcon.AddBuyBill(billinfo);
        return k;
    }
    //保存到进货单详细表
    [AjaxPro.AjaxMethod]
    public int saveWareDetail(string billcode, string tradecode, string fullname, string unit, int qty, double price, double tsum, string billdate)
    {
        billinfo.BillCode = billcode;
        billinfo.TradeCode = tradecode;
        billinfo.FullName = fullname;
        billinfo.Units = unit;
        billinfo.Qty = qty;
        billinfo.Price = price;
        billinfo.TSum = tsum;
        billinfo.BillDate = Convert.ToDateTime(billdate);
        int k = dbcon.AddBilldetail(billinfo);
        return k;
    }
    //更改库存数量和加权平均价格
    [AjaxPro.AjaxMethod]
    public int updateQtyPrice(string tradeCode, int qty, double price)
    {
        //billinfo.Qty = 20;///////////////
        //billinfo.Price = 50;stockinfo.Price =500;////需要提前设置这3个参数
        billinfo.Qty = qty;
        billinfo.Price = price;
        stockinfo.TradeCode = tradeCode;
        DataSet ds = null;
        ds = dbcon.GetStockByTradeCode(stockinfo);
        stockinfo.Qty = Convert.ToInt32(ds.Tables[0].Rows[0]["qty"]);
        stockinfo.Price = Convert.ToInt32(ds.Tables[0].Rows[0]["price"]);
        stockinfo.AveragePrice = Convert.ToDouble(ds.Tables[0].Rows[0]["averageprice"]);
        //处理--加权平均价格
        if (stockinfo.Price == 0)
        {
            stockinfo.AveragePrice = billinfo.Price;   //第一次进货时,加权平均价格等于进货价格
            stockinfo.Price = billinfo.Price;
        }
        else
        {
            //加权平均价格=(加权平均价*库存总数量+本次进货价格*本次进货数量)/(库存总数量+本次进货数量)
            stockinfo.AveragePrice = ((stockinfo.AveragePrice * stockinfo.Qty + billinfo.Price * billinfo.Qty) / (stockinfo.Qty + billinfo.Qty));
        }
        //更新--商品库存数量
        stockinfo.Qty = stockinfo.Qty + billinfo.Qty;
        int k = dbcon.UpdateStock_QtyAndAveragerprice(stockinfo);
        return k;
    }
    //向往来单位明细表--录入数据--这样以来为分析
    [AjaxPro.AjaxMethod]
    public int addCurrentAccount(string date, string billcode, double fullpay, double pay, double balance, string unit)
    {
        currentAccount.BillDate = Convert.ToDateTime(date);
        currentAccount.BillCode = billcode;
        currentAccount.ReduceGathering = fullpay;//应付
        currentAccount.FactReduceGathering = pay;//实付      
        currentAccount.Balance = balance;
        currentAccount.Units = unit;
        //执行添加
        int k = dbcon.AddCurrentAccount(currentAccount);
        return k;
    }

}

Posted: December 12, 2010 8:13 PM

Can everyone help me ?thanks!

Posted: December 9, 2010 11:49 AM

I t is a pity to hear that,but thank you  all the same!

Posted: December 6, 2010 9:00 PM

I am sorry,I want to achieve the function  such as ISDataSource >General>UsingFilterParameters.aspx
But when I click the button ,it will refresh the all page,using updatepannel can solve(It will run slowly)
How can I custom filter on client-side????
(when I click button ,it won't refresh the page)

Posted: December 6, 2010 2:11 AM

thank you,Martin Lie.
IT WORKS NOW

Posted: December 2, 2010 11:00 PM

  protected void WebGrid1_DeleteRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
        WebGrid1.ClientAction.Refresh();
      }

Posted: December 2, 2010 8:09 PM

Does everyone  help me????

Posted: December 2, 2010 12:02 AM
          var grid = ISGetObject("WebGrid1");
          var table = grid.GetRootTable();
          var htmlTable = table.GetElement(WG40.COLFOOTER, WG40.HTMLTABLE);
          var fotter1 = htmlTable.cells[2];//column1 one
var fotter2 = htmlTable.cells[3];//column1 two
alert(fotter1.innerHTML);
Posted: December 1, 2010 10:29 PM

Any way,thanks Handy!

All times are GMT -5. The time now is 2:27 AM.
Previous Next