瀏覽代碼

PostGroupStatementDetails
Update 2

leiy 1 年之前
父節點
當前提交
eaef1cc88a
共有 1 個文件被更改,包括 88 次插入40 次删除
  1. 88 40
      OASystem/OASystem.Api/Controllers/StatisticsController.cs

+ 88 - 40
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -566,7 +566,94 @@ namespace OASystem.API.Controllers
                 //    GWCAveragePrice = (GWCCNYTotalPrice / GWCPeopleNum).ConvertToDecimal1();
                 //}
                
-                
+                int Index = 0;
+                foreach (var item in groupAirFeeViews)
+                {
+                    if (item.AirId > 2924)
+                    {
+                        string itemClientName = "";
+                        if (!string.IsNullOrEmpty(item.ClientName))
+                        {
+                            string[] clientIds = new string[] { };
+                            if (item.ClientName.Contains(','))
+                            {
+                                clientIds = item.ClientName.Split(',');
+                            }
+                            else
+                            {
+                                clientIds = new string[] { item.ClientName };
+                            }
+                            if (clientIds.Length > 0)
+                            {
+                                int[] output = Array.ConvertAll<string, int>(clientIds, delegate (string s) { return int.Parse(s); });
+
+                                if (output.Contains(-1))
+                                {
+                                    itemClientName += $@"行程单";
+                                    output = output.Where(val => val != -1).ToArray();
+                                }
+
+                                var clients = _clientDatas.Where(it => output.Contains(it.Id)).ToList();
+                                decimal unitCost = 0.00M;
+                                unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1();
+
+                                int clienIndex = 1;
+                                foreach (var client in clients)
+                                {
+                                    airClientPris.Add(new {
+                                        CnName = client.LastName+client.FirstName,
+                                        EnName = client.Pinyin,
+                                        Price = unitCost,
+                                        AirType = item.AirTypeName
+                                    });
+
+                                    string six = "";
+                                    if (client.Sex == 0) six = "Mr";
+                                    else if (client.Sex == 1) six = "Ms";
+
+                                    itemClientName += string.Format(@"{0}.{1} {2};", clienIndex, client.LastName + client.FirstName, six);
+                                    clienIndex++;
+                                }
+                            }
+                        }
+                        item.ClientName = itemClientName;
+                    }
+                    else
+                    {
+                        string clientPinYinName = "";
+                        decimal unitCost = 0.00M;
+                        unitCost = (item.PayMoney / item.ClientNum).ConvertToDecimal1();
+
+                        string[] clientNames = item.ClientName.Split('.');
+                        for (int i = 0; i < item.ClientNum; i++)
+                        {
+                            string name = "";
+                            if (clientNames.Length > 0)
+                            {
+                                int index = i + 1;
+                                if (index < clientNames.Length)
+                                {
+                                    name = clientNames[index].Replace("MR","").Replace("MS","");
+                                    if (name.Length > 0)
+                                    {
+                                        string nameLastStr = name[name.Length - 1].ToString();
+                                        if (nameLastStr.IsNumeric())
+                                        {
+                                            name = name.Substring(0, name.Length - 1).Trim();
+                                        }
+                                    }
+                                }
+                            }
+                            
+                            clientPinYinName += string.Format(@"{0}.{1}出票价为:{2} CNY;", Index+1, name, unitCost);
+                        }
+                    }
+                    if (!string.IsNullOrEmpty(item.AuditGMDate))
+                    {
+                        item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                    AirCNYTotalPrice += item.CNYPrice;
+                }
 
                 _geView.GroupAirFeeViews = groupAirFeeViews;
                 if (airClientPris.Count > 0)
@@ -625,46 +712,7 @@ namespace OASystem.API.Controllers
                     }
                 }
 
-                //if (string.IsNullOrEmpty(str))
-                //{
-                //    List<string> _clientNames = new List<string>();
-                //    foreach (var item in groupAirFeeViews)
-                //    {
-                //        Regex r = new Regex("[0-9]");
-                //        string[] ClientName = r.Replace(item.ClientName, "|").Split('|');
-
-                //        foreach (var C in ClientName)
-                //        {
-                //            if (!string.IsNullOrWhiteSpace(C) && !C.Trim().Contains("行程单"))
-                //            {
-                //                string C1 = C.Replace("Mr", "").Replace("MR", "").Replace("mR", "").Replace("mr", "").Replace("Ms", "").Replace("MS", "").Replace("mS", "").Replace("ms", "");
-                //                C1 = C1.Replace(".", "").Trim();
-                //                if (!_clientNames.Contains(C1))
-                //                {
-                //                    _clientNames.Add(C1);
-                //                }
-                                
-                //            }
-                //        }
-                //    }
-
-                //    int index = 1;
-                //    foreach (var item in _clientNames)
-                //    {
-                //        decimal CountCost = 0.00M;
-                //        foreach (var Air in groupAirFeeViews)
-                //        {
-                //            if (Air.ClientName.Trim().Contains(item))
-                //            {
-                //                CountCost += Convert.ToDecimal((Air.PayMoney * Air.DayRate).ToString(").00"));
-                //            }
-                //        }
-                //        index++;
-
-                //        str += $"{index}. {item} 出票价为: { CountCost.ToString("#0.00")}CNY;";
-                //    }
 
-                //}
 
                 _geView.GroupAirFeeStr = $@"人民币总费用:{AirCNYTotalPrice.ToString("#0.00")} CNY\r\n{str}\r\n经济舱均价为:{JJCAveragePrice.ToString("#0.00")}CNY/人;公务舱均价为:{GWCAveragePrice.ToString("#0.00")}CNY/人;";
                 #endregion