Exemple #1
0
    protected void btnCreateRecvInvoice_Click(object sender, EventArgs e)
    {
        StringBuilder sb = new StringBuilder();
        // input array
        foreach (GridViewRow row in lstOrders.Rows)
        {
            CheckBox cb = row.FindControl("cbSele") as CheckBox;
            if (cb != null && cb.Checked)
            {
                sb.Append(cb.Text);
                sb.Append(',');
            }
        }
        if (sb.Length > 1) sb.Remove(sb.Length - 1, 1);

        int agentID = PageTools.GetSavedId("AgentID", null);
        AgentOrderBiz biz = new AgentOrderBiz();
        int r = biz.NewReceiveInvoice(PageLogic.CurrentUserID, agentID, sb.ToString());
        if (r == 0)
        {
            Response.Write(@"
        <script type='text/javascript'>
        alert('Create Receive Invoice ERROR! Please Check.');
        location = 'AgentOrders.aspx';
        </script>");
            Response.End();
        }
        else
            Response.Redirect("AgentRecvInvoice.aspx?recv=" + r.ToString());
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int recv = PageTools.ParseInt(Request.QueryString["recv"]);
         if (recv > 0)
         {
             AgentOrderBiz aobiz = new AgentOrderBiz();
             DataSet ds = aobiz.GetAgentRecvInvoice(recv);
             if (ds != null)
             {
                 int agentID = (int)(ds.Tables[0].Rows[0]["agentID"]);
                 if (agentID > 0)
                 {
                     AdminCompanyBiz biz = new AdminCompanyBiz();
                     DS_Companys.CompanyDetailDataTable dt = biz.GetCompanyDetail(agentID);
                     if (dt != null && dt.Rows.Count > 0)
                     {
                         DS_Companys.CompanyDetailRow crow = dt.Rows[0] as DS_Companys.CompanyDetailRow;
                         lbAgentName.Text = crow.companyName + " / " + crow.companyName_cn;
                         lbAgentAddress.Text = crow.address + " <br /> " + crow.city + ", " + crow.state + " " + crow.zip + "<br />" + crow.country;
                         lbAgentTel.Text = crow.telephone;
                         lbAgentFax.Text = crow.fax;
                     }
                 }
                 lbCreateDate.Text = ((DateTime)ds.Tables[0].Rows[0]["createDate"]).ToShortDateString();
                 lbInvoiceNumber.Text = recv.ToString();
             }
         }
     }
 }
 protected void btnChange_Click(object sender, EventArgs e)
 {
     int orderID = PageTools.GetSavedId("orderID", null);
     AgentOrderBiz biz = new AgentOrderBiz();
     if (biz.ChangeAgentTransfor(orderID, PageTools.ParseInt(seleAgent.SelectedValue)))
         Response.Redirect("OrderDetail.aspx");
     else
         lbMsg.Text = "修改Agent失敗,請檢查!";
 }
Exemple #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        StringBuilder sb = new StringBuilder();

        // check change list
        int cnt = 0;
        AgentOrderBiz biz = new AgentOrderBiz();
        foreach (GridViewRow row in lstOrders.Rows)
        {
            HyperLink lbID = row.FindControl("lnkOrderID") as HyperLink;
            Label lbCustomer = row.FindControl("lbCustomer") as Label;
            TextBox txtAgentCmt = row.FindControl("txtAgentCmt") as TextBox;
            HiddenField hdAgentCmt = row.FindControl("hdAgentCmt") as HiddenField;

            int orderID = PageTools.ParseInt(lbID.Text);
            decimal oldCmt = PageTools.ParseDecimal(hdAgentCmt.Value);
            decimal newCmt = PageTools.ParseDecimal(txtAgentCmt.Text);
            if (orderID>0 && newCmt != oldCmt)
            {
                cnt++;
                bool r = biz.ChangeOrderCommission(orderID, oldCmt, newCmt);
                sb.Append("<tr><td>");
                sb.Append(orderID);
                sb.Append("</td><td>");
                sb.Append(lbCustomer.Text);
                sb.Append("</td><td>&nbsp;");
                sb.Append(oldCmt.ToString("N2"));
                sb.Append(" ==&gt; ");
                sb.Append(newCmt.ToString("N2"));
                sb.Append("</td><td>");
                if (r)
                    sb.Append("<font color='darkGreen'>修改成功!</font>");
                else
                    sb.Append("<font color='darkRed'>修改失敗!</font>");
                sb.Append("</td></tr>");
            }
        }

        if (cnt > 0)
        {
            sb.Insert(0, @"
        共修改 " + cnt.ToString() + @" 條記錄。
        <table cellpadding=4 cellspacing=0 border=1 class=DataList>
        <tr class=list_head align=middle>
        <td>Order#</td>
        <td>Customer</td>
        <td>Agent Commission</td>
        <td>修改狀態</td>
        </tr>");
            sb.Append("</table>");

            lbMsg.Text = sb.ToString();
            lstOrders.DataBind();
        }
        else
            lbMsg.Text = "沒有記錄被修改。";
    }
    private void ResetAgentID()
    {
        int orderID = PageTools.GetSavedId("orderID", null);
        AdminOrderBiz biz = new AdminOrderBiz();
        int agentID = biz.GetAgentID(orderID);

        AgentOrderBiz abiz = new AgentOrderBiz();
        bool isChangeable = abiz.IsOrderMatched(orderID);

        seleAgent.SelectedValue = agentID.ToString();
        if (isChangeable)
        {
            btnChange.Enabled = true;
            lbMsg.Text = "";
        }
        else
        {
            btnChange.Enabled = false;
            lbMsg.Text = "已經進行Invoice Match的訂單不能再修改Agent Transfor。";
        }
    }
Exemple #6
0
    private void ResetAgentID()
    {
        int orderID = PageTools.GetSavedId("orderID", null);
        AdminOrderBiz biz = new AdminOrderBiz();
        int agentID = biz.GetAgentID(orderID);

        AgentOrderBiz abiz = new AgentOrderBiz();
        bool isChangeable = abiz.IsAgentChangeable(orderID);

        seleAgent.SelectedValue = agentID.ToString();
        if (isChangeable)
        {
            btnChange.Enabled = true;
            lbMsg.Text = "";
        }
        else
        {
            btnChange.Enabled = false;
            lbMsg.Text = "不能修改Agent!請先撤銷此Order對應的收付賬單。";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            AgentOrderBiz biz = new AgentOrderBiz();
            DataSet ds = biz.GetAgentRecvInvoice(PageTools.ParseInt(Request.QueryString["recv"]));
            if (ds != null)
            {
                AgentInfoCtl1.AgentID = PageTools.GetSavedId("agentID", ds.Tables[0].Rows[0]["agentID"].ToString());
                lnkPrint.NavigateUrl = "AgentRecvInvoice_prn.aspx?recv=" + Request.QueryString["recv"];
                lnkAgentOrders.NavigateUrl = "AgentOrders.aspx";
            }
        }

        // add summary
        GridViewHelper helper = new GridViewHelper(this.lstPayment);
        //helper.RegisterGroup("orderID", true, true);
        //helper.GroupHeader += new GroupEvent(helper_GroupHeader);
        //helper.ApplyGroupSort();
        helper.RegisterSummary("payAmount", SummaryOperation.Sum);
        helper.GeneralSummary += new FooterEvent(helper_SummaryFooter);
    }