Esempio n. 1
0
        /// <summary>
        /// 得到已经认领的金额
        /// </summary>
        /// <param name="collecId"></param>
        /// <returns></returns>
        protected string GetHasAmount(object collectid)
        {
            To_ClaimDetailManager to_claimDetail = new To_ClaimDetailManager();
            double hasAmount = to_claimDetail.GetHasAmount(collectid.ToString());

            return(hasAmount.ToString("F2"));
        }
Esempio n. 2
0
        /// <summary>
        /// 得到可认领金额
        /// </summary>
        /// <param name="money"></param>
        /// <param name="collecId"></param>
        /// <param name="CusId"></param>
        /// <returns></returns>
        protected string GetCanAmount(object money, object collectid)
        {
            To_ClaimDetailManager to_claimDetail = new To_ClaimDetailManager();
            double hasAmount = to_claimDetail.GetHasAmount(collectid.ToString());
            double Amount    = double.Parse(money.ToString());

            if (Amount != 0)
            {
                return((Amount - hasAmount).ToString("F2"));
            }
            else
            {
                return(Amount.ToString());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到状态
        /// </summary>
        /// <param name="ordercolid"></param>
        /// <param name="money"></param>
        /// <returns></returns>
        public string getStatus(string ordercolid, string money)
        {
            To_ClaimDetailManager manager = new To_ClaimDetailManager();
            double hasAmount    = manager.GetHasAmount(ordercolid);
            double shouldAmount = 0;

            double.TryParse(money, out shouldAmount);
            if (hasAmount == 0)
            {
                return("0");
            }
            else
            {
                if (shouldAmount > hasAmount)
                {
                    return("1");
                }
                else
                {
                    return("2");
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 得到收款状态和收款金额
        /// </summary>
        /// <param name="orderid"></param>
        /// <param name="cusid"></param>
        /// <param name="money"></param>
        /// <returns></returns>
        private string GetColStatusAndAmount(string colid, string money)
        {
            To_ClaimDetailManager claimDetailManager = new To_ClaimDetailManager();
            double hasAmount    = claimDetailManager.GetHasAmount(colid);
            double shouldAmount = 0;

            double.TryParse(money, out shouldAmount);
            if (hasAmount == 0)
            {
                return("未收款," + hasAmount.ToString("F2"));
            }
            else
            {
                if (shouldAmount > hasAmount)
                {
                    return("部分收款," + hasAmount.ToString("F2"));
                }
                else
                {
                    return("完成收款," + hasAmount.ToString("F2"));
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 更新订单的收款信息
        /// </summary>
        /// <param name="dt"></param>
        private void UpdateOrderColect(DataTable dt)
        {
            To_ClaimDetailManager manage = new To_ClaimDetailManager();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                double hasAmount    = manage.GetHasAmount(dt.Rows[i]["orderCollectId"].ToString());
                double shouldAmount = Convert.IsDBNull(dt.Rows[i]["money"]) ? 0 : Convert.ToDouble(dt.Rows[i]["money"]);
                string getstatsu    = "";
                if (hasAmount == 0)
                {
                    getstatsu = "未收款";
                }
                else if (shouldAmount > hasAmount)
                {
                    getstatsu = "部分收款";
                }
                else
                {
                    getstatsu = "完成收款";
                }
                To_OrderCollectDetialManager.updateDetialStatusAndMoney(dt.Rows[i]["orderCollectId"].ToString(), getstatsu, hasAmount.ToString());
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 保存收款认领明细数据的方法
        /// </summary>
        /// <param name="claimId">收款认领单id</param>
        /// <param name="collectId">收款单id</param>
        private void SaveClaimDetail(int claimId, int collectId)
        {
            IList <string> orderColectIDs = new List <string>();

            To_CollectingManager.ChangeClaim(Convert.ToInt32(Request.QueryString["id"]), 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();
                    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];                 //备注

                            claimDetailManager.Add(claimDetail);
                        }
                    }
                }

                //更新收款信息明细表的收款状态和实际收款金额
                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());
                    }
                }
            }
        }