Exemple #1
0
        /// <summary>
        /// 取消认领
        /// </summary>
        /// <param name="id"></param>
        private void CancelClaim(int id)
        {
            To_ClaimManager       b_claim       = new To_ClaimManager();
            To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();


            string claimID = b_claim.GetID(id);


            if (claimID != "" && b_claim.Delete(int.Parse(claimID)))
            {
                b_claimDetail.DeleteByClaim(claimID);
            }

            To_CollectingManager.ChangeClaim(id, 0);
        }
        /// <summary>
        /// 取消认领
        /// </summary>
        /// <param name="id"></param>
        private void CancelClaim(int id)
        {
            To_ClaimManager       b_claim       = new To_ClaimManager();
            To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();


            string claimID = b_claim.GetID(id);

            DataTable dt = b_claimDetail.GetHasDetail(" claimID=" + claimID);


            if (claimID != "" && b_claim.Delete(int.Parse(claimID)))
            {
                b_claimDetail.DeleteByClaim(claimID);
            }

            To_CollectingManager.ChangeClaim(id, 0);

            UpdateOrderColect(dt);
        }
        protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e)
        {
            string delId = "";

            //先遍历取得选中项

            for (int i = 0; i < this.rpCollecting.Items.Count; i++)
            {
                CheckBox cbx = (CheckBox)(rpCollecting.Items[i].FindControl("cbx"));
                Label    lbl = (Label)rpCollecting.Items[i].FindControl("lbl");
                if (cbx != null || cbx.Text != "")
                {
                    if (cbx.Checked)
                    {
                        delId += lbl.Text + ",";
                    }
                }
            }
            //去掉最后一个,
            delId = (delId + ")").Replace(",)", "");
            IList check = delId.Split(',');

            To_ClaimManager       b_claim       = new To_ClaimManager();
            To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();

            for (int i = 0; i < check.Count; i++)
            {
                To_Collecting to_Collecting = To_CollectingManager.getTo_CollectingById(Convert.ToInt32(check[i]));
                if (to_Collecting != null)
                {
                    To_CollectingManager.deleteTo_Collecting(Convert.ToInt32(check[i]));
                }
                string claimID = b_claim.GetID(Convert.ToInt32(check[i]));
                if (claimID != "" && b_claim.Delete(int.Parse(claimID)))
                {
                    b_claimDetail.DeleteByClaim(claimID);
                }
            }
            dataBind();
        }
        protected void rpCollecting_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int                   id            = Convert.ToInt32(e.CommandArgument);
                int                   count         = To_CollectingManager.deleteTo_Collecting(id);
                To_ClaimManager       b_claim       = new To_ClaimManager();
                To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();

                if (count <= 0)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('删除失败')", true);
                    return;
                }
                string claimID = b_claim.GetID(id);
                if (claimID != "" && b_claim.Delete(int.Parse(claimID)))
                {
                    b_claimDetail.DeleteByClaim(claimID);
                }
            }
            dataBind();
        }
Exemple #5
0
        /// <summary>
        /// 保存收款认领明细数据
        /// </summary>
        /// <param name="claimId"></param>
        /// <param name="collectId"></param>
        private int SaveClaimDetail(int claimId, int collectId)
        {
            int            result         = 1;
            IList <string> orderColectIDs = new List <string>();

            To_CollectingManager.ChangeClaim(Convert.ToInt32(Request.QueryString["collectId"]), chkFinish.Checked ? 2 : 1);
            if (chkFinish.Checked)
            {
                SendMessage(collectId, LblMaker.Text, 1);
            }
            else
            {
                SendMessage(collectId, LblMaker.Text, 0);
            }

            if (HidClaimDetail.Value.Trim() != string.Empty)
            {
                To_ClaimDetailManager claimDetailManager = new To_ClaimDetailManager();
                string[] items = HidClaimDetail.Value.Trim().TrimEnd('@').Split('@');
                if (items.Length > 0)
                {
                    To_ClaimDetail claimDetail = new To_ClaimDetail();
                    claimDetailManager.DeleteByClaim(claimId.ToString()); //先删除这条认领单的以前的认领明细数据
                    foreach (string item in items)
                    {
                        string[] detail = item.Trim().Split('$');
                        if (detail.Length > 0)
                        {
                            claimDetail.claimID        = claimId;              //收款单id
                            claimDetail.orderCollectId = int.Parse(detail[0]); //订单表收款单位明细表id
                            if (!orderColectIDs.Contains(detail[0]))
                            {
                                orderColectIDs.Add(detail[0]);
                            }
                            claimDetail.orderCusId    = int.Parse(hidComID.Value); //付款单位id
                            claimDetail.orderNum      = detail[1];                 //订单编号
                            claimDetail.receiptAmount = decimal.Parse(detail[2]);  //应收金额
                            claimDetail.realAmount    = decimal.Parse(detail[3]);  //本次收款金额
                            claimDetail.mark          = detail[4];                 //备注

                            if (claimDetailManager.Add(claimDetail) < 1)
                            {
                                result = 0;
                            }
                        }
                    }
                }

                //更新收款信息明细表的收款状态和实际收款金额
                for (int i = 0; i < orderColectIDs.Count; i++)
                {
                    if (orderColectIDs[i] != "")
                    {
                        double hasAmount    = claimDetailManager.GetHasAmount(orderColectIDs[i]);                                            //得到该收款信息明细表关联的所有认领过的金额
                        double shouldAmount = To_OrderCollectDetialManager.getTo_OrderCollectDetialById(int.Parse(orderColectIDs[i])).Money; //得到应收金额
                        string getstatus    = "";
                        if (hasAmount == 0)
                        {
                            getstatus = "未收款";
                        }
                        else if (shouldAmount > hasAmount)
                        {
                            getstatus = "部分收款";
                        }
                        else
                        {
                            getstatus = "完成收款";
                        }
                        To_OrderCollectDetialManager.updateDetialStatusAndMoney(orderColectIDs[i], getstatus, hasAmount.ToString());
                    }
                }
            }
            else
            {
                result = 0;
            }

            return(result);
        }
        //private bool IsLimit(int id)
        //{
        //    To_ClaimManager b_claim = new To_ClaimManager();
        //    DataTable claim = b_claim.GetList(1, " collectingID=" + id.ToString() + " ", "id");

        //    int makerID = Convert.ToInt32(claim.Rows[0]["makerID"]);

        //    int userID = (Session["login"] as LoginInfo).Id;

        //    return makerID != userID;
        //}

        protected void BtnSubmit_Click(object sender, ImageClickEventArgs e)
        {
            To_ClaimManager b_claim = new To_ClaimManager();
            To_Claim        m_claim = new To_Claim();

            int collectingID = Convert.ToInt32(Request.QueryString["id"]);

            m_claim.collectingID = collectingID;
            m_claim.costType     = HidReceiptType.Value;
            m_claim.payer        = HidPayer.Value;
            m_claim.payerID      = int.Parse(HidPayerID.Value);
            m_claim.payerType    = int.Parse(HidPayerType.Value);
            m_claim.salesman     = HidSalesman.Value;
            m_claim.salesmanID   = int.Parse(HidSalesmanID.Value);

            int claimID = 0;

            int.TryParse(b_claim.GetID(collectingID), out claimID);
            if (claimID != 0)
            {
                To_CollectingManager.ChangeClaim(Convert.ToInt32(Request.QueryString["id"]), chkFinish.Checked ? 2 : 1);

                if (chkFinish.Checked)
                {
                    SendMessage(m_claim.collectingID, HidSalesman.Value, 1);
                }
                else
                {
                    SendMessage(m_claim.collectingID, HidSalesman.Value, 0);
                }

                To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();
                b_claimDetail.DeleteByClaim(claimID.ToString());

                if (HidClaimDetail.Value.Trim() != string.Empty)
                {
                    string[] items = HidClaimDetail.Value.Trim().TrimEnd('@').Split('@');

                    if (items.Length > 0)
                    {
                        To_ClaimDetail m_claimDetail = new To_ClaimDetail();

                        foreach (string item in items)
                        {
                            string[] detail = item.Trim().Split('$');
                            if (detail.Length > 0)
                            {
                                int     policyID   = int.Parse(detail[0].Trim());
                                decimal amount     = decimal.Parse(detail[1].Trim().TrimStart('¥').TrimStart('¥'));
                                decimal realAmount = decimal.Parse(detail[2].Trim().TrimStart('¥').TrimStart('¥'));

                                m_claimDetail.claimID           = claimID;
                                m_claimDetail.mark              = "";
                                m_claimDetail.policyID          = policyID;
                                m_claimDetail.realAmount        = realAmount;
                                m_claimDetail.receiptAmount     = amount;
                                m_claimDetail.receiptStatusCode = 0;

                                b_claimDetail.Add(m_claimDetail);
                            }
                        }
                    }
                }


                ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('认领成功');self.location.href='../FundsAllocation.aspx';", true);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('认领失败,该收款记录没有被认领过,不能编辑');self.location.href='../FundsAllocation.aspx';", true);
            }
        }