diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs index 755cfe27..109c8236 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs @@ -189,8 +189,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " d.EstimateTypeDesc MaterialGroup,\n" + " e.MaterialDesc ParentMaterialDesc,\n" + " c.InvoicePrice,\n" + -" ( c.InvoicePrice * a.qty ) InvoiceAmt,\n" + -" ( c.InvoicePrice * a.Qty ) SettleAmt,\n" + +" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" + +" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" + " a.Qty - IsNull( B.Qty, 0 ) DiffSettleFisQty,\n" + " 0 DiffSettleInvQty, \n" + " a.Qty InvoiceQty \n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs index 2bb8a899..bdfe7f08 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDiffDapperRepository.cs @@ -22,95 +22,95 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob : base(dbContextProvider) { } - public virtual List GetInvoiceSettledDiffReportList(string version,string year, string tablename ,string materialcode) + public virtual List GetInvoiceSettledDiffReportList(string version, string year, string tablename, string materialcode) { string sqlString = - "SELECT\n" + -" temp1.*, temp1.InvoicePrice - Isnull( temp2.Price, 0 ) DiffPrice , \n" + -" temp2.Price SalePrice\n" + -"FROM\n" + -" (\n" + -" SELECT\n" + -string.Format(" '{0}' as Version ,", version)+"\n" + -" b.*,\n" + -" ISnull(\n" + -" c.Qty,\n" + -" IsNull( d.qty, 0 )) SettleQty,\n" + -" CASE\n" + -" \n" + -" WHEN e.Type = 'CP7报废' THEN\n" + -" isnull( e.Qty, 0 ) ELSE 0 \n" + -" END AS CP7ScrapQty,\n" + -" CASE\n" + -" \n" + -" WHEN e.Type = '索赔' THEN\n" + -" isnull( e.Qty, 0 ) ELSE 0 \n" + -" END AS ClaimQty,\n" + -" (\n" + -" b.InvoiceQty - ISnull(\n" + -" c.Qty,\n" + -" IsNull( d.qty, 0 ))) DiffQty,\n" + - -" g.MaterialCode AS SapMaterialCode,\n" + -" g.MaterialDesc AS MaterialDesc, \n" + -" g.EstimateTypeDesc as SapMaterialGroup \n " + -" FROM\n" + -" (\n" + -" SELECT\n" + -" Factory,\n" + -" MaterialCode,\n" + -" SUM( QTY ) InvoiceQty,\n" + -" sum( amt ) InvoiceAmt,\n" + -" sum( amt )/ sum( Qty ) InvoicePrice \n" + -" FROM\n" + -" Set_Invoice \n" + -" WHERE\n" + -" version = '{0}' \n" + -" GROUP BY\n" + -" MaterialCode,\n" + -" Factory \n" + -" ) b\n" + -" LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" + -" LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" + -" LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" + -//" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode\n" + -" LEFT JOIN Set_material g ON b.MaterialCode = g.CustomerPartCode \n" + -" ) temp1\n" + -" LEFT JOIN (\n" + -" SELECT\n" + -" Price,\n" + -" MaterialCode \n" + -" FROM\n" + -" Set_PriceList \n" + -" WHERE\n" + -" version =(\n" + -" SELECT\n" + -" max( version ) \n" + -" FROM\n" + -" Set_PriceListVersion \n" + -" )) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode"; - - - - - - string _sql = string.Format(sqlString, version); - + "SELECT\n" + + " temp1.*, temp1.InvoicePrice - Isnull( temp2.Price, 0 ) DiffPrice , \n" + + " temp2.Price SalePrice\n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + string.Format(" '{0}' as Version ,", version) + "\n" + + " b.*,\n" + + " ISnull(\n" + + " c.Qty,\n" + + " IsNull( d.qty, 0 )) SettleQty,\n" + + " CASE\n" + + " \n" + + " WHEN e.Type = 'CP7报废' THEN\n" + + " isnull( e.Qty, 0 ) ELSE 0 \n" + + " END AS CP7ScrapQty,\n" + + " CASE\n" + + " \n" + + " WHEN e.Type = '索赔' THEN\n" + + " isnull( e.Qty, 0 ) ELSE 0 \n" + + " END AS ClaimQty,\n" + + " (\n" + + " b.InvoiceQty - ISnull(\n" + + " c.Qty,\n" + + " IsNull( d.qty, 0 ))) DiffQty,\n" + + + " g.MaterialCode AS SapMaterialCode,\n" + + " g.MaterialDesc AS MaterialDesc, \n" + + " g.EstimateTypeDesc as SapMaterialGroup \n " + + " FROM\n" + + " (\n" + + " SELECT\n" + + " Factory,\n" + + " MaterialCode,\n" + + " SUM( QTY ) InvoiceQty,\n" + + " sum( amt ) InvoiceAmt,\n" + + " sum( amt )/ sum( Qty ) InvoicePrice \n" + + " FROM\n" + + " Set_Invoice \n" + + " WHERE\n" + + " version = '{0}' \n" + + " GROUP BY\n" + + " MaterialCode,\n" + + " Factory \n" + + " ) b\n" + + " LEFT JOIN ( SELECT SUM( QTY ) Qty, MaterialCode FROM Set_settle WHERE version = '{0}' GROUP BY MaterialCode ) c ON b.MaterialCode = c.MaterialCode\n" + + " LEFT JOIN ( SELECT SUM( QTY ) qty, MaterialCode FROM Set_KanbanSettle WHERE version = '{0}' GROUP BY MaterialCode ) d ON b.MaterialCode = d.MaterialCode\n" + + " LEFT JOIN ( SELECT * FROM Set_ScrapClaims WHERE version = '{0}' ) e ON b.MaterialCode = e.MaterialCode\n" + + //" LEFT JOIN ( SELECT * FROM Set_PriceList WHERE version = '{0}' ) f ON b.MaterialCode = f.MaterialCode\n" + + " LEFT JOIN Set_material g ON b.MaterialCode = g.CustomerPartCode \n" + + " ) temp1\n" + + " LEFT JOIN (\n" + + " SELECT\n" + + " Price,\n" + + " MaterialCode \n" + + " FROM\n" + + " Set_PriceList \n" + + " WHERE\n" + + " version =(\n" + + " SELECT\n" + + " max( version ) \n" + + " FROM\n" + + " Set_PriceListVersion \n" + + " )) temp2 ON temp1.SapMaterialCode = temp2.MaterialCode"; + + + + + + string _sql = string.Format(sqlString, version); + var _query = DbConnection.Query(_sql); - var _list = _query.OrderBy(p=>p.Factory).ToList(); + var _list = _query.OrderBy(p => p.Factory).ToList(); + - return _list; } - + } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs index a048d225..043c1e72 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs @@ -86,8 +86,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " d.EstimateTypeDesc MaterialGroup,\n" + " '' ParentMaterialDesc,\n" + " c.InvoicePrice,\n" + -" ( c.InvoicePrice * a.qty ) InvoiceAmt,\n" + -" ( c.InvoicePrice * a.Qty ) SettleAmt,\n" + +" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" + +" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" + " a.Qty - IsNull( B.Qty, 0 ) DiffSettleFisQty,\n" + " 0 DiffSettleInvQty,\n" + " a.Qty InvoiceQty \n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs index 950df657..71dde7ac 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs @@ -149,15 +149,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report string sql1 = "SELECT\n" + " t1.*,\n" + -" isnull( t1.UNSettleQty, 0 ) * isnull( T2.Price, 0 ) AMT,\n" + +" Round(isnull( t1.UNSettleQty, 0 ) * isnull( T2.Price, 0 ),2) AMT,\n" + " T2.Price,\n" + " Qty -(\n" + " ISNULL( UnSettleQty, 0 )) DiffQty ,\n" + - - -" (Qty - (ISNULL(UnSettleQty, 0))) * isnull(T2.Price, 0) DiffAmt \n"+ - - +" Round((Qty - (ISNULL(UnSettleQty, 0))) * isnull(T2.Price, 0),2) DiffAmt \n"+ "FROM\n" + " (\n" + " SELECT\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs index cea2a3cd..ce81b4b1 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs @@ -61,7 +61,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " temp1.*,\n" + " temp2.Price,\n" + " ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT, \n" + -" ISNULL( temp1.DiffQty, 0 )* ISNULL( temp2.Price, 0 ) DiffAMT \n" + +" Round(ISNULL( temp1.DiffQty, 0 )* ISNULL( temp2.Price, 0 ),2) DiffAMT \n" + " FROM\n" + " (\n" + " SELECT\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs index 40b50115..3e9dffb6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs @@ -116,7 +116,7 @@ namespace SettleAccount.Job.Services foreach (var itm in _ls) { - itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice; + itm.InvocieAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice,2); itm.DiffPrice = itm.Price - itm.InvoicePrice; } _ls.AddRange(rangeList); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs index ff588b05..79d7326e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs @@ -48,9 +48,6 @@ namespace SettleAccount.Job.Services.Report var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value; var _ls = _dapper.GetKanbanReportList(version, begin,end); var _lst = _dapper.GetNoKanbanReportList(version, begin, end); - - - if (!string.IsNullOrEmpty(materialGroup)) { var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); @@ -75,8 +72,6 @@ namespace SettleAccount.Job.Services.Report _ls = _ls.Where(p => _groupList.Contains(p.SapCode)).ToList(); } } - - if (!string.IsNullOrEmpty(materialGroup)) { var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); @@ -101,8 +96,6 @@ namespace SettleAccount.Job.Services.Report _lst = _lst.Where(p => _groupList.Contains(p.SapCode)).ToList(); } } - - ExcelExporter _exporter = new ExcelExporter();//导出Excel var result = _exporter.Append(_ls.ToList(), "有看板号未结差异对比") .SeparateBySheet() diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs index 9ba1065e..1d35e4b6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs @@ -111,7 +111,7 @@ namespace SettleAccount.Job.Services.Report foreach (var itm in _ls) { - itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice; + itm.InvocieAmt =Math.Round(itm.InvoiceQty * itm.InvoicePrice,2); } _ls.AddRange(rangeList); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs index aa5812df..cf100c2e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs @@ -41,7 +41,7 @@ namespace SettleAccount.Job.Services.Report { var _first = _list.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode); _first.InvoicedQty = _first.InvoicedQty + itm.DiffQty;//开票数量(结算数量+差异) - _first.InvoiceMoney = _first.InvoicedQty * _first.InvoicePrice;//开票总金额(开票数量*开票单价) + _first.InvoiceMoney =Math.Round(_first.InvoicedQty * _first.InvoicePrice,2);//开票总金额(开票数量*开票单价) _first.SumDiffMoney = (_first.ReceiptQty * _first.Price) - _first.InvoiceMoney;//总金额差异(结算金额-开票金额) } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs index 7c83ba58..e443c5a3 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs @@ -89,7 +89,7 @@ namespace SettleAccount.Job.Services var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version); foreach (var itm in _ls) { - itm.InvocieAmt = itm.InvoiceQty * itm.InvoicePrice; + itm.InvocieAmt =Math.Round( itm.InvoiceQty * itm.InvoicePrice,2); itm.DiffPrice = itm.Price - itm.InvoicePrice; } _ls=_ls.OrderBy(p => p.ChassisNumber).ThenBy(p=>p.KENNCode).ThenBy(p=>p.SapMaterialCode).ToList(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs index 245905f8..20e95681 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs @@ -113,7 +113,7 @@ namespace SettleAccount.Job.Services.Report Qty = 1, UNSettleQty = !string.IsNullOrEmpty(tm1.ParentSapMaterialCode) ? 1 : 0, DiffQty = !string.IsNullOrEmpty(tm1.ParentSapMaterialCode) ? 0 : -1, - DiffAmt = !string.IsNullOrEmpty(tm1.ParentSapMaterialCode) ? 0 : (itm1.Qty * itm1.Price) + DiffAmt = !string.IsNullOrEmpty(tm1.ParentSapMaterialCode) ? 0 : Math.Round(itm1.Qty * itm1.Price) }; rangeList = query.ToList(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs index 8b6fc8e3..69e8be37 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs @@ -56,7 +56,7 @@ namespace SettleAccount.Job.Services.Report { p.Qty = 1; - p.DiffAMT = p.Qty * p.Price; + p.DiffAMT =Math.Round( p.Qty * p.Price,2); p.DiffQty = 1; } );