Ejemplo n.º 1
0
        /// <summary>
        ///  根据税区和条目税种计算税额
        /// </summary>
        private void GetTaxSum(HttpContext context, long tax_id, string accDedIds)
        {
            if (tax_id == 0 || string.IsNullOrEmpty(accDedIds))
            {
                context.Response.Write("0.00");
                return;
            }

            decimal totalMoney = 0;
            // 所有需要计算的条目的Id的集合
            var accDedIdList = accDedIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            if (accDedIdList != null && accDedIdList.Count() > 0)
            {
                var adDal = new crm_account_deduction_dal();
                foreach (var accDedId in accDedIdList)
                {
                    var accDedList = adDal.GetInvDedDtoList($" and id={accDedId}");
                    var thisAccDed = adDal.FindNoDeleteById(long.Parse(accDedId));
                    if (accDedList != null && accDedList.Count > 0)
                    {
                        var accDed = accDedList.FirstOrDefault(_ => _.id.ToString() == accDedId);
                        if (accDed.tax_category_id != null)
                        {
                            var thisTax = new d_tax_region_cate_dal().GetSingleTax(tax_id, (long)accDed.tax_category_id);
                            if (thisTax != null && thisAccDed.extended_price != null)
                            {
                                totalMoney += (decimal)(thisAccDed.extended_price * thisTax.total_effective_tax_rate);
                            }
                        }
                    }
                }
            }
            context.Response.Write(totalMoney.ToString("#0.00"));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 根据报价税区 和税种 返回税率
 /// </summary>
 public void GetTax(HttpContext context)
 {
     var quote_id = context.Request.QueryString["quote_id"];
     var tax_cate_id = context.Request.QueryString["tax_cate_id"];
     if (!string.IsNullOrEmpty(quote_id) && !string.IsNullOrEmpty(tax_cate_id))
     {
         var thisQuote = new crm_quote_dal().FindNoDeleteById(long.Parse(quote_id));
         if (thisQuote != null && thisQuote.tax_region_id != null)
         {
             var taxCate = new d_tax_region_cate_dal().GetSingleTax((long)thisQuote.tax_region_id,long.Parse(tax_cate_id));
             if (taxCate != null)
             {
                 context.Response.Write(taxCate.total_effective_tax_rate);
             }
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 返回一个d_tax_region_cate对象
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="bid"></param>
        /// <returns></returns>
        public d_tax_region_cate GetTaxRegion(int aid, int bid)
        {
            var data = new d_tax_region_cate_dal().FindSignleBySql <d_tax_region_cate>(@"select * from d_tax_region_cate  where tax_region_id=" + aid + " and tax_cate_id=" + bid + "");

            return(data);
        }