Browse Source

付款申请-日付申请

jiangjc 11 months ago
parent
commit
a938d2776f

+ 110 - 18
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -1109,18 +1109,6 @@ namespace OASystem.API.Controllers
 
         #region 应收报表
 
-        ///// <summary>
-        ///// 应收报表
-        ///// 查询 根据日期范围
-        ///// </summary>
-        ///// <param name="dto"></param>
-        ///// <returns></returns>
-        //[HttpPost]
-        //[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        //public async Task<IActionResult> ExcelSyntheticalReceivable(PostSyntheticalReceivableByDateRangeDto dto)
-        //{
-        //}
-
         /// <summary>
         /// 应收报表
         /// 查询 根据日期范围
@@ -1148,7 +1136,7 @@ namespace OASystem.API.Controllers
                 }
                 else
                 {
-                    sqlWhere += string.Format(@" And di.VisitDate >= '{0}' ", dto.beginDt);
+                    sqlWhere += string.Format(@" And di.VisitDate >= '{0} 00:00:00' ", dto.beginDt);
                 }
             }
 
@@ -1160,7 +1148,7 @@ namespace OASystem.API.Controllers
                 }
                 else
                 {
-                    sqlWhere += string.Format(@" And di.VisitDate <= '{0}' ", dto.endDt);
+                    sqlWhere += string.Format(@" And di.VisitDate <= '{0} 23:59:59' ", dto.endDt);
                 }
             }
 
@@ -1191,7 +1179,7 @@ namespace OASystem.API.Controllers
                     decimal balance = 0M;
                     string str_schedule = string.Empty;
 
-                    //1.
+                    //1. 缺超支费用!!!!!!!!!!!!!!!!!!!!
                     string sql_fr = string.Format(@" Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0} ", diId);
                     List<Fin_ForeignReceivables> list_fr = _sqlSugar.SqlQueryable<Fin_ForeignReceivables>(sql_fr).ToList();
                     sum_fr = list_fr.Sum(s => s.ItemSumPrice);
@@ -1222,9 +1210,11 @@ namespace OASystem.API.Controllers
                     item_rst.frPrice = sum_fr.ToString("#0.00");
                     item_rst.prPrice = (sum_pr - sum_other).ToString("#0.00");
                     item_rst.balPrice = (sum_fr - (sum_pr - sum_other)).ToString("#0.00");
-                    item_rst.clientUnit = str_client;
+                    item_rst.prClient = str_client;
                     item_rst.schedule = str_schedule;
 
+                    string tempVisitDate = Convert.ToDateTime(item_rst.visitDate).ToString("yyyy-MM-dd");
+
                     sumAll_fr += sum_fr;
                     sumAll_pr += (sum_pr - sum_other);
                     sumAll_balance += (sum_fr - (sum_pr - sum_other));
@@ -1241,7 +1231,8 @@ namespace OASystem.API.Controllers
                 {
                     return Ok(JsonView(true, "请求成功", result, list_rst.Count));
                 }
-                else {
+                else
+                {
                     //----------------------------
                     List<Excel_SyntheticalReceivableByDateRange> list_Ex = new List<Excel_SyntheticalReceivableByDateRange>();
                     WorkbookDesigner designer = new WorkbookDesigner();
@@ -1295,7 +1286,7 @@ namespace OASystem.API.Controllers
 
 
                 }
-                
+
             }
 
 
@@ -1304,5 +1295,106 @@ namespace OASystem.API.Controllers
         }
 
         #endregion
+
+        #region 付款申请
+
+        /// <summary>
+        /// 应收报表
+        /// 查询 根据日期范围
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostPayRequest_Center(PostPayRequestByDateRangeDto dto)
+        {
+            tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(dto.beginDt, dto.endDt);
+
+
+            return Ok(JsonView(true, "获取成功", new { daily = dailyResult }));
+
+            return Ok(JsonView(false, "获取失败"));
+        }
+
+        /// <summary>
+        /// 付款申请
+        /// 查询 根据日期范围
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        private tree_Fin_DailyFeePaymentResult PayRequest_DailyByDateRange(string beginDt, string endDt)
+        {
+            #region sql条件处理
+            string sqlWhere = string.Format(@" And dfp.CreateTime between '{0} 00:00:00' And '{1} 23:59:59' ", beginDt, endDt);
+
+            string sql_1 = string.Format(@"Select * From (	
+                                                Select row_number() over (order by dfp.Id Desc) as RowNumber,
+                                                    dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
+                                                    dfp.CreateUserId,u.CnName CreateUser,dfp.CreateTime,dfp.FAudit,dfp.MAudit,
+                                                    dfp.PriceTypeId,dfp.TransferTypeId 
+                                                From Fin_DailyFeePayment dfp
+                                                Inner Join Sys_Company c On dfp.CompanyId = c.Id
+                                                Left Join Sys_Users u On dfp.CreateUserId = u.Id
+                                                Where dfp.IsDel=0 {0} And dfp.FAudit = 1 And dfp.MAudit = 1
+                                                ) temp ", sqlWhere);
+            #endregion
+
+            List<tree_Fin_DailyFeePaymentPageListView> DailyFeePaymentData = _sqlSugar.SqlQueryable<tree_Fin_DailyFeePaymentPageListView>(sql_1).ToList();
+
+            Dictionary<int, string> dic_setData = new Dictionary<int, string>();
+
+            foreach (var item in DailyFeePaymentData)
+            {
+                if (dic_setData.ContainsKey(item.PriceTypeId))
+                {
+                    item.priceTypeStr = dic_setData[item.PriceTypeId];
+                }
+                else
+                {
+                    Sys_SetData sd_priceType = _daiRep.Query<Sys_SetData>(s => s.Id == item.PriceTypeId).First();
+                    if (sd_priceType != null)
+                    {
+                        item.priceTypeStr = sd_priceType.Name;
+                        dic_setData.Add(item.PriceTypeId, sd_priceType.Name);
+                    }
+                }
+
+                if (dic_setData.ContainsKey(item.transferTypeId))
+                {
+                    item.transferTypeIdStr = dic_setData[item.transferTypeId];
+                    Sys_SetData sd_transfer = _daiRep.Query<Sys_SetData>(s => s.Id == item.transferTypeId).First();
+                    if (sd_transfer != null)
+                    {
+                        item.transferParentId = sd_transfer.STid;
+                        item.transferParentIdStr = sd_transfer.STid == 62 ? "公转" : sd_transfer.STid == 63 ? "私转" : "";
+                    }
+                }
+                else
+                {
+                    Sys_SetData sd_transfer = _daiRep.Query<Sys_SetData>(s => s.Id == item.transferTypeId).First();
+                    if (sd_transfer != null)
+                    {
+                        item.transferTypeIdStr = sd_transfer.Name;
+                        item.transferParentId = sd_transfer.STid;
+                        item.transferParentIdStr = sd_transfer.STid == 62 ? "公转" : sd_transfer.STid == 63 ? "私转" : "";
+                        dic_setData.Add(item.transferTypeId, sd_transfer.Name);
+                    }
+                }
+
+                string feeContentSql = string.Format(@"Select * From Fin_DailyFeePaymentContent 
+                                                        Where IsDel=0 And DFPId = {0} ", item.Id);
+                item.childList = _sqlSugar.SqlQueryable<Fin_DailyFeePaymentContentInfolView>(feeContentSql).ToList();
+
+            }
+
+            decimal total_gz = DailyFeePaymentData.Where(s => s.transferParentId == 62).Sum(d => d.SumPrice ?? 0M);
+            decimal total_sz = DailyFeePaymentData.Where(s => s.transferParentId == 63).Sum(d => d.SumPrice ?? 0M);
+
+            var result = new tree_Fin_DailyFeePaymentResult() { gz = total_gz, sz = total_sz, dataList = DailyFeePaymentData };
+
+            return result;
+        }
+
+        #endregion
     }
 }

+ 14 - 0
OASystem/OASystem.Domain/Dtos/Financial/PostPayRequestByDateRangeDto.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Financial
+{
+    public class PostPayRequestByDateRangeDto:PortDtoBase
+    {
+        public string beginDt { get; set; }
+        public string endDt { get; set; }
+    }
+}

+ 27 - 4
OASystem/OASystem.Domain/ViewModels/Financial/Fin_DailyFeePaymentView.cs

@@ -12,8 +12,8 @@ namespace OASystem.Domain.ViewModels.Financial
     /// <summary>
     /// 日付申请 View
     /// </summary>
-    public class Fin_DailyFeePaymentView:Fin_DailyFeePayment
-    {}
+    public class Fin_DailyFeePaymentView : Fin_DailyFeePayment
+    { }
 
 
     public class Fin_DailyFeePaymentPageCount
@@ -88,9 +88,9 @@ namespace OASystem.Domain.ViewModels.Financial
             {
                 string str = "未审核";
                 if (FAudit == 0) str = "未审核";
-                else if (FAudit == 1) 
+                else if (FAudit == 1)
                 {
-                    str = "已通过"; 
+                    str = "已通过";
                     FAuditName = "朱成梅";
                 }
                 else if (FAudit == 2)
@@ -329,4 +329,27 @@ namespace OASystem.Domain.ViewModels.Financial
     {
         public List<Fin_DailyFeePaymentPagePriceSubTypeView> SubDatas { get; set; }
     }
+
+    public class tree_Fin_DailyFeePaymentPageListView : Fin_DailyFeePaymentPageListView
+    {
+        public List<Fin_DailyFeePaymentContentInfolView> childList { get; set; }
+        public string priceTypeStr { get; set; }
+
+        public int transferTypeId { get; set; }
+        public string transferTypeIdStr { get; set; }
+        /// <summary>
+        /// 公转:62,私转:63
+        /// </summary>
+        public int transferParentId { get; set; }
+        public string transferParentIdStr { get; set; }
+    }
+
+    public class tree_Fin_DailyFeePaymentResult : tree_Fin_DailyFeePaymentPageListView 
+    {
+        public decimal gz { get; set; } = 0M;
+        public decimal sz { get; set; } = 0M;
+
+        public List<tree_Fin_DailyFeePaymentPageListView> dataList { get; set; }
+    }
+
 }