This commit is contained in:
liqionghai 2025-08-22 19:30:10 +08:00
parent 71e191408d
commit 75b43e53c2
5 changed files with 83 additions and 24 deletions

View File

@ -94,7 +94,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivableStatements
header.AddChild("PPBillingAmount", new LocaleValue("星空普票开票金额"), SqlStorageType.SqlDecimal); header.AddChild("PPBillingAmount", new LocaleValue("星空普票开票金额"), SqlStorageType.SqlDecimal);
header.AddChild("ZPBillingDate", new LocaleValue("专票开票日期"), SqlStorageType.Sqlvarchar); header.AddChild("ZPBillingDate", new LocaleValue("专票开票日期"), SqlStorageType.Sqlvarchar);
header.AddChild("ZPBillingAmount", new LocaleValue("星空专票开票金额"), SqlStorageType.SqlDecimal); header.AddChild("ZPBillingAmount", new LocaleValue("星空专票开票金额"), SqlStorageType.SqlDecimal);
header.AddChild("BillingAmount", new LocaleValue("总票金额"), SqlStorageType.SqlDecimal); header.AddChild("BillingAmount", new LocaleValue("总票金额"), SqlStorageType.SqlDecimal);
header.AddChild("PaymentDate", new LocaleValue("回款日期"), SqlStorageType.Sqlvarchar); header.AddChild("PaymentDate", new LocaleValue("回款日期"), SqlStorageType.Sqlvarchar);
header.AddChild("PaymentAmount", new LocaleValue("回款金额"), SqlStorageType.SqlDecimal); header.AddChild("PaymentAmount", new LocaleValue("回款金额"), SqlStorageType.SqlDecimal);
header.AddChild("ShippedDebt", new LocaleValue("已出货欠款"), SqlStorageType.SqlDecimal); header.AddChild("ShippedDebt", new LocaleValue("已出货欠款"), SqlStorageType.SqlDecimal);

View File

@ -35,7 +35,18 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
// 判断 应收对账单【明细版】按钮 // 判断 应收对账单【明细版】按钮
if (e.BarItemKey == "Test_Button_1") if (e.BarItemKey == "Test_Button_1")
{ {
string FPath = "应收账款对账单【明细版】.xlsx"; var reportModel = this.SysReportModel;
//单据头
var rptTitles = reportModel.ReportTitles;
string fClient = rptTitles.FirstOrDefault(a => a.TitleKey == "FClient").TitleValue.ToString();
string fDate = rptTitles.FirstOrDefault(a => a.TitleKey == "FDate").TitleValue.ToString();
string fProject = rptTitles.FirstOrDefault(a => a.TitleKey == "FProject").TitleValue.ToString();
string FState = rptTitles.FirstOrDefault(a => a.TitleKey == "FState").TitleValue.ToString();
string F_SFYJKH = rptTitles.FirstOrDefault(a => a.TitleKey == "F_SFYJKH").TitleValue.ToString();
//string FPath = "应收账款对账单【明细版】.xlsx";
string FPath = string.Format("{0}-{1}-应收账款对账单【明细版】.xlsx", DateTime.Now.ToString("yyyyMMdd"), fClient);
// 在临时文件目录,生成一个完整的文件名: C:\Program Files\Kingdee\K3Cloud\WebSite\...\JD.xls // 在临时文件目录,生成一个完整的文件名: C:\Program Files\Kingdee\K3Cloud\WebSite\...\JD.xls
string filePath = PathUtils.GetPhysicalPath(KeyConst.TEMPFILEPATH, Path.GetFileName(FPath)); string filePath = PathUtils.GetPhysicalPath(KeyConst.TEMPFILEPATH, Path.GetFileName(FPath));
@ -49,15 +60,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
//显示 //显示
this.View.ShowForm(showParameter); this.View.ShowForm(showParameter);
var reportModel = this.SysReportModel;
//单据头
var rptTitles = reportModel.ReportTitles;
string fClient = rptTitles.FirstOrDefault(a => a.TitleKey == "FClient").TitleValue.ToString();
string fDate = rptTitles.FirstOrDefault(a => a.TitleKey == "FDate").TitleValue.ToString();
string fProject = rptTitles.FirstOrDefault(a => a.TitleKey == "FProject").TitleValue.ToString();
string FState = rptTitles.FirstOrDefault(a => a.TitleKey == "FState").TitleValue.ToString();
string F_SFYJKH = rptTitles.FirstOrDefault(a => a.TitleKey == "F_SFYJKH").TitleValue.ToString();
//单据体 //单据体
var list = reportModel.DataSource.Rows; var list = reportModel.DataSource.Rows;
@ -110,7 +113,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.Alignment = HorizontalAlignment.Center;
// 设置垂直居中对齐 // 设置垂直居中对齐
cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center;
//设置数值格式保留两位小数
cellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("0.00"); cellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("0.00");
// 创建一个单元格样式--------------------------------- // 创建一个单元格样式---------------------------------
@ -169,6 +172,21 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
// 将字体应用到单元格样式 // 将字体应用到单元格样式
style3.SetFont(font3); style3.SetFont(font3);
// 创建一个单元格样式-------------------------------
ICellStyle style4 = workbook.CreateCellStyle();
// 设置边框样式
style4.BorderTop = BorderStyle.Thin;
style4.BorderBottom = BorderStyle.Thin;
style4.BorderLeft = BorderStyle.Thin;
style4.BorderRight = BorderStyle.Thin;
// 设置水平居中对齐
style4.Alignment = HorizontalAlignment.Left;
// 设置垂直居中对齐
style4.VerticalAlignment = VerticalAlignment.Center;
// 将字体应用到单元格样式
style4.SetFont(font3);
style4.DataFormat = workbook.CreateDataFormat().GetFormat("0.00");
#endregion #endregion
#region #region
@ -183,7 +201,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
{ {
YFHpriceSum = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2); YFHpriceSum = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2);
YFPpriceSum = Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2); YFPpriceSum = Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
priceSum = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]) + Convert.ToDecimal(list[i]["InvoicedDebt"]), 2); //priceSum = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]) + Convert.ToDecimal(list[i]["InvoicedDebt"]), 2);
priceSum = Math.Round(Convert.ToDecimal(list[i]["OwedTickets"]), 2);
} }
} }
@ -244,7 +263,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
string BillingDate = string.IsNullOrWhiteSpace(list[i]["ZPBillingDate"].ToString()) ? "" : list[i]["ZPBillingDate"].ToString().Split(' ')[0]; string BillingDate = string.IsNullOrWhiteSpace(list[i]["ZPBillingDate"].ToString()) ? "" : list[i]["ZPBillingDate"].ToString().Split(' ')[0];
string ReturnDate = string.IsNullOrWhiteSpace(list[i]["ReturnDate"].ToString()) ? "" : list[i]["ReturnDate"].ToString().Split(' ')[0]; string ReturnDate = string.IsNullOrWhiteSpace(list[i]["ReturnDate"].ToString()) ? "" : list[i]["ReturnDate"].ToString().Split(' ')[0];
BillingDate += string.IsNullOrWhiteSpace(list[i]["PPBillingDate"].ToString()) ? "" : (string.IsNullOrWhiteSpace(BillingDate) ?"":",")+list[i]["PPBillingDate"].ToString().Split(' ')[0]; //BillingDate += string.IsNullOrWhiteSpace(list[i]["PPBillingDate"].ToString()) ? "" : (string.IsNullOrWhiteSpace(BillingDate) ?"":",")+list[i]["PPBillingDate"].ToString().Split(' ')[0];
//将合计行放到最下方 //将合计行放到最下方
IRow rowi = sheet.CreateRow(j + i); IRow rowi = sheet.CreateRow(j + i);
@ -271,7 +290,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
if(!string.IsNullOrWhiteSpace(list[i]["FTaxPrice"].ToString())) if(!string.IsNullOrWhiteSpace(list[i]["FTaxPrice"].ToString()))
{ {
decimal FTaxPrice = Math.Round(Convert.ToDecimal(list[i]["FTaxPrice"]), 2); decimal FTaxPrice = Math.Round(Convert.ToDecimal(list[i]["FTaxPrice"]), 2);
c7.SetCellValue("" + FTaxPrice + ""); c7.CellStyle = cellStyle; c7.SetCellValue(Convert.ToDouble(FTaxPrice )); c7.CellStyle = cellStyle;
} }
ICell c8 = rowi.CreateCell(7); c8.SetCellValue(""); c8.CellStyle = cellStyle; ICell c8 = rowi.CreateCell(7); c8.SetCellValue(""); c8.CellStyle = cellStyle;
@ -458,9 +477,9 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
ICell cc1 = rr1.GetCell(6); ICell cc1 = rr1.GetCell(6);
ICell cc2 = rr2.GetCell(6); ICell cc2 = rr2.GetCell(6);
ICell cc3 = rr3.GetCell(6); ICell cc3 = rr3.GetCell(6);
cc1.SetCellValue("" + YFHpriceSum + ""); cc1.SetCellValue(Convert.ToDouble(YFHpriceSum));
cc2.SetCellValue("" + YFPpriceSum + ""); cc2.SetCellValue(Convert.ToDouble(YFPpriceSum));
cc3.SetCellValue("" + priceSum + ""); cc3.SetCellValue(Convert.ToDouble(priceSum));
#endregion #endregion
@ -492,10 +511,15 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
} }
ICell CR1 = r1.CreateCell(i); ICell CR1 = r1.CreateCell(i);
CR1.SetCellValue(test1); CR1.SetCellValue(test1);
if (i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9) if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
{ {
CR1.CellStyle = style; CR1.CellStyle = style;
} }
else if (i == 6)
{
CR1.SetCellValue(Convert.ToDouble(test1));
CR1.CellStyle = style4;
}
else else
{ {
CR1.CellStyle = style2; CR1.CellStyle = style2;
@ -512,10 +536,15 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
} }
ICell CR1 = r2.CreateCell(i); ICell CR1 = r2.CreateCell(i);
CR1.SetCellValue(test1); CR1.SetCellValue(test1);
if (i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9) if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
{ {
CR1.CellStyle = style; CR1.CellStyle = style;
} }
else if (i == 6)
{
CR1.SetCellValue(Convert.ToDouble(test1));
CR1.CellStyle = style4;
}
else else
{ {
CR1.CellStyle = style2; CR1.CellStyle = style2;
@ -532,10 +561,15 @@ namespace Pilot.Report.Exploitation.AccountsReceivable
} }
ICell CR1 = r3.CreateCell(i); ICell CR1 = r3.CreateCell(i);
CR1.SetCellValue(test1); CR1.SetCellValue(test1);
if (i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9) if (i == 4 || i == 5 || i == 7 || i == 8 || i == 9)
{ {
CR1.CellStyle = style; CR1.CellStyle = style;
} }
else if (i == 6)
{
CR1.SetCellValue(Convert.ToDouble(test1));
CR1.CellStyle = style4;
}
else else
{ {
CR1.CellStyle = style2; CR1.CellStyle = style2;

View File

@ -193,7 +193,8 @@ WHERE B.
SELECT SELECT
A.FID, A.FID,
A.FENTRYID, A.FENTRYID,
SUM(ISNULL(A.ZPBillingAmount,0)) + SUM(ISNULL(A.PPBillingAmount,0)) + SUM(ISNULL(A.K3רƱ½ðî,0)) + SUM(ISNULL(A.K3ÆÕƱ½ðî,0)) AS 'רƱ½ð¶î' --SUM(ISNULL(A.ZPBillingAmount,0)) + SUM(ISNULL(A.PPBillingAmount,0)) + SUM(ISNULL(A.K3רƱ½ðî,0)) + SUM(ISNULL(A.K3ÆÕƱ½ðî,0)) AS 'רƱ½ð¶î'
SUM(ISNULL(A.ZPBillingAmount,0)) + SUM(ISNULL(A.K3רƱ½ðî,0)) AS 'רƱ½ð¶î'
INTO #TEMP3 INTO #TEMP3
FROM YingShouZhanKuanMX_GZTH A FROM YingShouZhanKuanMX_GZTH A
WHERE A.[ÊÇ·ñK3Êý¾Ý] = 0 WHERE A.[ÊÇ·ñK3Êý¾Ý] = 0
@ -259,6 +260,7 @@ WHERE B.
UPDATE YingShouZhanKuanMX_GZTH UPDATE YingShouZhanKuanMX_GZTH
SET OrderAmount=0,PaymentAmount=0,ShippedDebt=0,InvoicedDebt=0,IsEnded = NULL ,OwedTickets= 0,BillingAmount=0,PPBillingAmount=0,ZPBillingAmount=0,ZPBillingDate='',PPBillingDate='',PaymentDate = '',ShipmentsDate = '' SET OrderAmount=0,PaymentAmount=0,ShippedDebt=0,InvoicedDebt=0,IsEnded = NULL ,OwedTickets= 0,BillingAmount=0,PPBillingAmount=0,ZPBillingAmount=0,ZPBillingDate='',PPBillingDate='',PaymentDate = '',ShipmentsDate = ''
,ShipmentsAmount = 0,ReturnAmount = 0
from ( from (
SELECT CASE WHEN ROW_NUMBER() OVER(PARTITION BY FBILLNO ORDER BY fid) = 1 THEN FBILLNO SELECT CASE WHEN ROW_NUMBER() OVER(PARTITION BY FBILLNO ORDER BY fid) = 1 THEN FBILLNO
END AS µ¥ºÅ,* FROM YingShouZhanKuanMX_GZTH END AS µ¥ºÅ,* FROM YingShouZhanKuanMX_GZTH
@ -269,7 +271,7 @@ WHERE B.
UPDATE A UPDATE A
SET OwedTickets = B.QP SET OwedTickets = B.QP
FROM YingShouZhanKuanMX_GZTH A FROM YingShouZhanKuanMX_GZTH A
JOIN (SELECT FID,SUM(ShipmentsAmount) - SUM(BillingAmount) AS 'QP'--SUM(OrderAmount) - SUM(BillingAmount) AS 'QP' JOIN (SELECT FID,SUM(ShipmentsAmount) -SUM(ReturnNum)- SUM(BillingAmount) AS 'QP' --SUM(ShipmentsAmount)- SUM(BillingAmount) AS 'QP'
FROM YingShouZhanKuanMX_GZTH GROUP BY FID) B ON A.FID = B.FID FROM YingShouZhanKuanMX_GZTH GROUP BY FID) B ON A.FID = B.FID
WHERE A.[ÊÇ·ñK3Êý¾Ý] = 0 AND A.row_num = 1 WHERE A.[ÊÇ·ñK3Êý¾Ý] = 0 AND A.row_num = 1

View File

@ -353,4 +353,16 @@ AND B.
AND B.ShouKuanFDate < @EndDate AND B.ShouKuanFDate < @EndDate
--SELECT OrderAmount,PaymentAmount,ShippedDebt,InvoicedDebt,IsEnded ,OwedTickets,BillingAmount, CASE WHEN ROW_NUMBER() OVER(PARTITION BY FBILLNO ORDER BY fid) = 1 THEN FBILLNO --SELECT OrderAmount,PaymentAmount,ShippedDebt,InvoicedDebt,IsEnded ,OwedTickets,BillingAmount, CASE WHEN ROW_NUMBER() OVER(PARTITION BY FBILLNO ORDER BY fid) = 1 THEN FBILLNO
--END AS µ¥ºÅ,* FROM YingShouZhanKuanMX_GZTH --END AS µ¥ºÅ,* FROM YingShouZhanKuanMX_GZTH
--退退
SELECT A.FID,SUM(A.ShipmentsAmount) AS '发货金额', SUM(A.ReturnAmount) AS '退货金额',
STUFF((SELECT DISTINCT ','+ReturnDate FROM YingShouZhanKuanMX_GZTH WHERE FID = a.FID FOR XML PATH('')),1,1,'') AS '退货日期'
INTO #TEMP4
FROM YingShouZhanKuanMX_GZTH A
GROUP BY A.FID
UPDATE A
SET A.ShipmentsAmount = ISNULL(B.,0),A.ReturnAmount = ISNULL(B.退,0),A.ReturnDate = ISNULL(B.退,'')
FROM YingShouZhanKuanMX_GZTH A
INNER JOIN #TEMP4 B ON A.FID = B.FID
END END

View File

@ -51,6 +51,17 @@ INNER JOIN #CFTEMP1 B On A.FID = B.FID
DELETE FROM YingShouZhanKuanJY_GZTH DELETE FROM YingShouZhanKuanJY_GZTH
WHERE row_num <> 1; WHERE row_num <> 1;
UPDATE A
SET A.Number = B.row_num1
FROM YingShouZhanKuanJY_GZTH A
INNER JOIN (
SELECT
FID,
ROW_NUMBER() OVER (ORDER BY FID) as row_num1
FROM YingShouZhanKuanJY_GZTH
) B On A.FID = B.FID
-- --
UPDATE A UPDATE A
SET A.PPBillingDate = B.PPBillingDate,A.ZPBillingDate = B.ZPBillingDate SET A.PPBillingDate = B.PPBillingDate,A.ZPBillingDate = B.ZPBillingDate