2025-03-14 10:00:24 +08:00
using Kingdee.BOS.App.Data ;
using Kingdee.BOS.Core.CommonFilter ;
using Kingdee.BOS.Core.DynamicForm ;
using Kingdee.BOS.Core.DynamicForm.PlugIn ;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args ;
using Kingdee.BOS.Orm.DataEntity ;
using Kingdee.BOS.Util ;
2025-03-17 09:39:43 +08:00
using Kingdee.K3.FIN.Core ;
using Pilot.Report.Exploitation.Common ;
2025-03-14 10:00:24 +08:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Linq ;
namespace Pilot.Report.Exploitation.Receivables
{
/// <summary>
/// 【动态表单】应收款明细报表
/// </summary>
[Description("【动态表单】应收款明细报表"), HotUpdate]
public class ReceivablesDetails : AbstractDynamicFormPlugIn
{
public override void OnLoad ( EventArgs e )
{
base . OnLoad ( e ) ;
var showParameter = new DynamicFormShowParameter ( ) ;
2025-03-16 16:56:15 +08:00
showParameter . FormId = "VRYF_YSKMXBGL" ;
2025-03-14 10:00:24 +08:00
showParameter . ParentPageId = this . View . PageId ;
showParameter . PageId = this . View . PageId + "_Filter" ;
showParameter . OpenStyle . CacheId = this . View . PageId ;
this . View . ShowForm ( showParameter , action = > FilterCallBack ( action ) ) ;
}
public override void BarItemClick ( BarItemClickEventArgs e )
{
base . BarItemClick ( e ) ;
//点击过滤按钮,弹出过滤窗体
if ( e . BarItemKey . Equals ( "MBBA_tbButton_GL" , StringComparison . OrdinalIgnoreCase ) )
{
var showParameter = new DynamicFormShowParameter ( ) ;
2025-03-16 16:56:15 +08:00
showParameter . FormId = "VRYF_YSKMXBGL" ;
2025-03-14 10:00:24 +08:00
showParameter . ParentPageId = this . View . PageId ;
showParameter . PageId = this . View . PageId + "_Filter" ;
showParameter . OpenStyle . CacheId = this . View . PageId ;
this . View . ShowForm ( showParameter , action = > FilterCallBack ( action ) ) ;
}
2025-03-17 09:39:43 +08:00
//点击刷新数据按钮
if ( e . BarItemKey = = "MBBA_tbButton" )
{
var sql_1 = string . Format ( @"/*dialect*/exec PR_YingShouMingXi_yuyubo " ) ;
DBUtils . ExecuteDynamicObject ( Context , sql_1 ) ;
}
2025-03-14 10:00:24 +08:00
//点击保存按钮
if ( e . BarItemKey = = "MBBA_tbButton_2" )
{
var sql_1 = string . Format ( @"/*dialect*/Select top 1 FId From ReceivablesDetailsTable" ) ;
var sql_List1 = DBUtils . ExecuteDynamicObject ( Context , sql_1 ) ;
//判断是否存在表
if ( sql_List1 . Count ( ) > 0 )
{
2025-03-17 09:39:43 +08:00
/ *
*
*
* // 1. 确认分录字段的Key( 如 "FEntity")
string entryKey = "FEntity" ;
// 2. 安全获取DynamicObjectCollection
if ( this . View . Model . DataObject ! = null & &
this . View . Model . DataObject . ContainsKey ( entryKey ) )
{
DynamicObjectCollection entries = this . View . Model . DataObject [ entryKey ] as DynamicObjectCollection ;
if ( entries ! = null )
{
// 遍历分录行
foreach ( DynamicObject entryRow in entries )
{
// 获取字段值( 例如物料ID)
object materialId = entryRow [ "FMaterialId" ] ;
// 其他字段处理...
}
}
else
{
this . View . ShowMessage ( "分录数据格式错误!" ) ;
}
}
else
{
this . View . ShowMessage ( "未找到分录字段或DataObject为空! " ) ;
}
*
* /
DynamicObjectCollection entries = this . View . Model . DataObject [ "MBBA_K99bd8a69" ] as DynamicObjectCollection ;
var list = entries . Where ( g = > g . GetValue < string > ( "F_666" ) = = "True" ) . ToList ( ) ;
2025-03-14 10:00:24 +08:00
List < int > strings = new List < int > ( ) ;
2025-03-17 09:39:43 +08:00
string upsql = "" ;
int i = 0 ;
foreach ( var item in list )
2025-03-14 10:00:24 +08:00
{
2025-03-17 09:39:43 +08:00
if ( item [ "F_FID" ] . ToString ( ) ! = "0" & & item [ "F_FID" ] ! = null )
2025-03-14 10:00:24 +08:00
{
2025-03-17 09:39:43 +08:00
upsql + = $@"update ReceivablesDetailsTable set F_061='{item[" F_061 "]}', F_054='{item[" F_054 "]}' ,F_055='{item[" F_055 "]}',F_056='{item[" F_056 "]}'
, F_060 = ' { item [ "F_060" ] } ' , F_057 = ' { item [ "F_057" ] } ' , F_058 = ' { item [ "F_058" ] } ' , [ EditTime ] = ' { DateTime . Now } ' , [ IfManualEdit ] = 1 where FID = { item [ "F_FID" ] } ; ";
}
i + + ;
if ( i > = 100 )
{
Loghelp . Log ( "MBBA_tbButton_2" + upsql ) ;
DBUtils . ExecuteDynamicObject ( Context , upsql ) ;
upsql = "" ;
i = 0 ;
2025-03-14 10:00:24 +08:00
}
}
2025-03-17 09:39:43 +08:00
if ( upsql ! = "" )
2025-03-14 10:00:24 +08:00
{
2025-03-17 09:39:43 +08:00
Loghelp . Log ( "MBBA_tbButton_2" + upsql ) ;
DBUtils . ExecuteDynamicObject ( Context , upsql ) ;
}
#region
//for (int i = 0; i < entries.Count; i++)
//{
// var f = this.View.Model.GetValue("F_000", i)?.ToString();
// if (f != "0" && entries[i]["F_666"]?.ToString() == "True")
// {
// #region 隐藏单据体赋值
2025-03-14 10:00:24 +08:00
2025-03-17 09:39:43 +08:00
// var f0 = this.View.Model.GetValue("F_000", i);
// var f1 = this.View.Model.GetValue("F_001", i);
// var f2 = this.View.Model.GetValue("F_002", i);
// var f3 = this.View.Model.GetValue("F_003", i);
// var f4 = this.View.Model.GetValue("F_004", i);
// var f5 = this.View.Model.GetValue("F_005", i);
// var f6 = this.View.Model.GetValue("F_006", i);
// var f7 = this.View.Model.GetValue("F_007", i);
// var f8 = this.View.Model.GetValue("F_008", i);
// var f9 = this.View.Model.GetValue("F_009", i);
// var f10 = this.View.Model.GetValue("F_010", i);
// var f11 = this.View.Model.GetValue("F_011", i);
// var f12 = this.View.Model.GetValue("F_012", i);
// var f13 = this.View.Model.GetValue("F_013", i);
// var f14 = this.View.Model.GetValue("F_014", i);
// var f15 = this.View.Model.GetValue("F_015", i);
// var f16 = this.View.Model.GetValue("F_016", i);
// var f17 = this.View.Model.GetValue("F_017", i);
// var f18 = this.View.Model.GetValue("F_018", i);
// var f19 = this.View.Model.GetValue("F_019", i);
// var f20 = this.View.Model.GetValue("F_020", i);
// var f21 = this.View.Model.GetValue("F_021", i);
// var f22 = this.View.Model.GetValue("F_022", i);
// var f23 = this.View.Model.GetValue("F_023", i);
// var f24 = this.View.Model.GetValue("F_024", i);
// var f25 = this.View.Model.GetValue("F_025", i);
// var f26 = this.View.Model.GetValue("F_026", i);
// var f27 = this.View.Model.GetValue("F_027", i);
// var f28 = this.View.Model.GetValue("F_028", i);
// var f29 = this.View.Model.GetValue("F_029", i);
// var f30 = this.View.Model.GetValue("F_030", i);
// var f31 = this.View.Model.GetValue("F_031", i);
// var f32 = this.View.Model.GetValue("F_032", i);
// var f33 = this.View.Model.GetValue("F_033", i);
// var f34 = this.View.Model.GetValue("F_034", i);
// var f35 = this.View.Model.GetValue("F_035", i);
// var f36 = this.View.Model.GetValue("F_036", i);
// var f37 = this.View.Model.GetValue("F_037", i);
// var f38 = this.View.Model.GetValue("F_038", i);
// var f39 = this.View.Model.GetValue("F_039", i);
// var f40 = this.View.Model.GetValue("F_040", i);
// var f41 = this.View.Model.GetValue("F_041", i);
// var f42 = this.View.Model.GetValue("F_042", i);
// var f43 = this.View.Model.GetValue("F_043", i);
// var f44 = this.View.Model.GetValue("F_044", i);
// var f45 = this.View.Model.GetValue("F_045", i);
// var f46 = this.View.Model.GetValue("F_046", i);
// var f47 = this.View.Model.GetValue("F_047", i);
// var f48 = this.View.Model.GetValue("F_048", i);
// var f49 = this.View.Model.GetValue("F_049", i);
// var f50 = this.View.Model.GetValue("F_050", i);
// var f51 = this.View.Model.GetValue("F_051", i);
// var f52 = this.View.Model.GetValue("F_052", i);
// var f53 = this.View.Model.GetValue("F_053", i);
// var f54 = this.View.Model.GetValue("F_054", i);
// var f55 = this.View.Model.GetValue("F_055", i);
// var f56 = this.View.Model.GetValue("F_056", i);
// var f57 = this.View.Model.GetValue("F_057", i);
// var f58 = this.View.Model.GetValue("F_058", i);
// var f59 = this.View.Model.GetValue("F_059", i);
// var f60 = this.View.Model.GetValue("F_060", i);
// var f61 = this.View.Model.GetValue("F_061", i);
// var f62 = this.View.Model.GetValue("F_062", i);
// var f63 = this.View.Model.GetValue("F_063", i);
2025-03-14 10:00:24 +08:00
2025-03-17 09:39:43 +08:00
// #endregion
2025-03-14 10:00:24 +08:00
2025-03-17 09:39:43 +08:00
// DBUtils.ExecuteDynamicObject(Context, sql_3);
// }
//}
#endregion
2025-03-14 10:00:24 +08:00
}
}
if ( e . BarItemKey = = "MBBA_tbButton_3" )
{
2025-03-17 19:04:06 +08:00
//string sql = string.Format("Delete From ReceivablesDetailsTable");
//DBUtils.ExecuteDynamicObject(Context, sql);
//this.View.Model.SetValue("F_ISSX", "需要刷新");
2025-03-14 10:00:24 +08:00
}
}
public override void DataChanged ( DataChangedEventArgs e )
{
base . DataChanged ( e ) ;
if ( e . Field . Key . Equals ( "F_ISSX" ) )
{
//文本字段触发值更新时,模拟用户点击菜单,此处模拟点击“选项”菜单:
( ( IDynamicFormViewService ) this . View ) . MainBarItemClick ( "MBBA_tbButton" ) ;
}
if ( e . Field . Key . Equals ( "F_061" ) | | e . Field . Key . Equals ( "F_054" ) | | e . Field . Key . Equals ( "F_055" ) | | e . Field . Key . Equals ( "F_056" )
| | e . Field . Key . Equals ( "F_060" ) | | e . Field . Key . Equals ( "F_057" ) | | e . Field . Key . Equals ( "F_058" ) )
{
this . Model . SetValue ( "F_666" , "True" , e . Row ) ;
}
}
/// <summary>
/// 过滤框回调方法
/// </summary>
/// <param name="action"></param>
public void FilterCallBack ( FormResult action )
{
2025-03-20 09:41:04 +08:00
Dictionary < string , decimal > dicList = new Dictionary < string , decimal > ( ) ;
2025-03-14 10:00:24 +08:00
if ( action . ReturnData ! = null )
{
2025-03-20 09:41:04 +08:00
2025-03-16 16:41:25 +08:00
string wheresql = " 1=1 " ;
2025-03-14 10:00:24 +08:00
FilterParameter returnData = action . ReturnData as FilterParameter ; //过滤框返回的数据
DynamicObject dyObj = returnData . CustomFilter as DynamicObject ;
//获取组织FID
DynamicObject FSaleOrg = dyObj [ "F_YKQC_OrgId_83g" ] as DynamicObject ;
string FSaleOrgId = "" ;
if ( FSaleOrg ! = null )
{
FSaleOrgId = Convert . ToString ( FSaleOrg [ "ID" ] ) ;
2025-03-16 16:41:25 +08:00
wheresql + = $@" and [F_000]={FSaleOrgId}" ;
2025-03-14 10:00:24 +08:00
}
//获取开发日期
var FSDate = Convert . ToString ( dyObj [ "F_YKQC_Date_re5" ] ) ;
2025-03-16 16:41:25 +08:00
if ( ! string . IsNullOrWhiteSpace ( FSDate ) )
{
2025-03-17 09:39:43 +08:00
wheresql + = $@" and [F_012]>='{FSDate}'" ;
2025-03-16 16:41:25 +08:00
}
2025-03-14 10:00:24 +08:00
//获取结束日期
var FEDate = Convert . ToString ( dyObj [ "F_YKQC_Date_apv" ] ) ;
2025-03-16 16:41:25 +08:00
if ( ! string . IsNullOrWhiteSpace ( FEDate ) )
{
2025-03-17 09:39:43 +08:00
wheresql + = $@" and [F_012] <= '{FEDate}'" ;
2025-03-16 16:41:25 +08:00
}
2025-03-14 10:00:24 +08:00
//获取合同类型
DynamicObject HTLX = dyObj [ "F_YKQC_Assistant_dvn" ] as DynamicObject ;
string HTLXFid = "" ;
if ( HTLX ! = null )
{
2025-03-17 09:39:43 +08:00
HTLXFid = Convert . ToString ( HTLX [ "ID" ] ) ;
wheresql + = $@" and [F_059] = '{HTLXFid}'" ;
2025-03-14 10:00:24 +08:00
}
//获取购货单位
DynamicObject CUST = dyObj [ "F_YKQC_Base_qtr" ] as DynamicObject ;
string CustFid = "" ;
if ( CUST ! = null )
{
2025-03-16 16:41:25 +08:00
CustFid = Convert . ToString ( CUST [ "name" ] ) ;
wheresql + = $@" and [F_005] = '{CustFid}'" ;
2025-03-14 10:00:24 +08:00
}
//获取销售员
DynamicObject XSY = dyObj [ "F_YKQC_Base_tzk" ] as DynamicObject ;
string XSYFid = "" ;
if ( XSY ! = null )
{
XSYFid = Convert . ToString ( XSY [ "ID" ] ) ;
2025-03-17 09:39:43 +08:00
wheresql + = $@" and [销售员ID] = '{XSYFid}'" ;
2025-03-14 10:00:24 +08:00
}
//获取项目名称
DynamicObject GCXM = dyObj [ "F_YKQC_Base_uky" ] as DynamicObject ;
string GCXMFid = "" ;
if ( GCXM ! = null )
{
GCXMFid = Convert . ToString ( GCXM [ "NAME" ] ) ;
2025-03-17 09:39:43 +08:00
wheresql + = $@" and [F_009] = '{GCXMFid}'" ;
2025-03-14 10:00:24 +08:00
}
this . View . Model . DeleteEntryData ( "F_MBBA_Entity_qtr" ) ;
2025-03-16 15:07:32 +08:00
//获取表1
2025-03-16 16:41:25 +08:00
var sql_1 = "" ;
2025-03-14 10:00:24 +08:00
2025-06-09 09:36:26 +08:00
sql_1 + = string . Format ( $ @ "/*dialect*/Select * From (Select [FId],[F_001],[F_002],[F_003],[F_004],[F_005],[F_006],[F_007],[F_008],[F_009],[F_010],[F_011],[F_012],[F_013],[F_014],[F_015],[F_016],[F_017],[F_018],[F_019],[F_020],[F_021],[F_022],[F_023],[F_024],[F_025],[F_026],[F_027],[F_028],[F_029],[F_030],[F_031],[F_032],[F_033],[F_034],[F_035],[F_036],[F_037],[F_038],[F_039],[F_040],[F_041],[F_042],[F_043],[F_044],[F_045],[F_046],[F_047],[F_048],[F_049],[F_050],[F_051],[F_052],[F_053],[F_054],[F_055],[F_056],[F_057],[F_058],[F_059],[F_000],[F_060],[F_061],[F_062],[F_063],[销售单主键ID],[销售员ID],[收款条件主键ID],[EditTime],[IfManualEdit],[F_064],[F_065],[F_066],[F_067],[F_068],[BiBie],[HuiLv],[DingDanZongE_YuanBi],[ZeRenRen],[XinYongEDu],[客户编码],[DaoKuanJinE_YuanBi],[YingShouHeJi_YuanBi],[YunZaFei],[LeiJiTuiHuoJinE_YuanBi]
2025-06-11 14:51:56 +08:00
, [ F_025 ] * [ HuiLv ] as F_SJYCHYSKHJ_BWB , [ F_024 ] * [ HuiLv ] as F_WDQJE_BWB , [ F_027 ] * [ HuiLv ] F_DQJE_BWB From [ ReceivablesDetailsTable ] where { wheresql }
2025-03-14 10:00:24 +08:00
Union ALL
( Select
2025-03-16 16:56:15 +08:00
null , null , ' 合 计 : ' , null , null , null , null , null , null , null , SUM ( F_010 ) ,
2025-03-20 09:41:04 +08:00
null , null , null , null , null , null , SUM ( F_017 ) , SUM ( F_018 ) , SUM ( F_019 ) , SUM ( F_020 ) , SUM ( F_021 ) , SUM ( F_022 ) , null
, F_024 = ( SELECT SUM ( F_024 ) FROM [ ReceivablesDetailsTable ] hh where { wheresql } )
, SUM ( F_025 ) ,
null
, F_027 = ( SELECT SUM ( F_027 ) FROM [ ReceivablesDetailsTable ] hh where { wheresql } )
2025-03-20 15:17:43 +08:00
, null , null , null , null , null , null , null , null
, F_036 = (
SELECT SUM ( F_036 )
FROM ( SELECT DISTINCT [ 销 售 单 主 键 ID ] , hh . 收 款 条 件 主 键 ID , F_036
FROM [ ReceivablesDetailsTable ] hh where { wheresql } ) a )
, null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , 0 , 0 , 0 , null , 0
2025-06-05 19:33:30 +08:00
, null , null , null , null , null , ' ' , 1 [ HuiLv ] , SUM ( [ DingDanZongE_YuanBi ] ) , ' ' [ ZeRenRen ] , 0 [ XinYongEDu ] , ' ' [ 客 户 编 码 ] , SUM ( [ DaoKuanJinE_YuanBi ] ) , SUM ( [ YingShouHeJi_YuanBi ] ) , SUM ( [ YunZaFei ] ) , SUM ( [ LeiJiTuiHuoJinE_YuanBi ] )
2025-06-11 14:51:56 +08:00
, SUM ( [ F_SJYCHYSKHJ_BWB ] ) , null , null
2025-03-16 16:41:25 +08:00
From
2025-03-20 09:41:04 +08:00
( select distinct [ 销 售 单 主 键 ID ] , [ 销 售 员 ID ] , [ F_010 ] , F_017 , F_018 , F_019 , F_020 , F_021 , F_022 , 0 as F_024 , F_025 ,
2025-06-11 14:51:56 +08:00
0 as F_027 , 0 F_036 , [ BiBie ] , [ DingDanZongE_YuanBi ] , [ DaoKuanJinE_YuanBi ] , [ YingShouHeJi_YuanBi ] , [ YunZaFei ] , [ LeiJiTuiHuoJinE_YuanBi ]
, [ F_025 ] * [ HuiLv ] as F_SJYCHYSKHJ_BWB , 0 as F_WDQJE_BWB , 0 F_DQJE_BWB from
2025-03-20 09:41:04 +08:00
[ReceivablesDetailsTable]
2025-03-16 16:41:25 +08:00
where { wheresql }
) a ) ) W Order by W . F_001 ");
2025-03-14 10:00:24 +08:00
2025-03-16 16:41:25 +08:00
var sql_2 = "" ;
2025-03-14 10:00:24 +08:00
sql_2 + = string . Format ( @"/*dialect*/Select top 1 * From ReceivablesDetailsTable" ) ;
2025-03-20 09:41:04 +08:00
2025-03-14 10:00:24 +08:00
var sql_List2 = DBUtils . ExecuteDynamicObject ( Context , sql_2 ) ;
2025-03-16 16:56:15 +08:00
2025-03-14 10:00:24 +08:00
//判断是否存在表
if ( sql_List2 . Count ( ) < = 0 )
2025-03-16 16:56:15 +08:00
{
/ * this . View . ShowMessage ( "FSaleOrgId :" + FSaleOrgId + "," + "FSDate:" + FSDate + ","
+ "FEDate :" + FEDate + "," + "HTLXFid:" + HTLXFid + "," + "CustFid:" + CustFid + ","
+ "XSYFid:" + XSYFid + "," + "GCXMFid:" + GCXMFid ) ; * /
2025-03-17 09:39:43 +08:00
string sql = string . Format ( @"/*dialect*/EXEC [PR_YingShouMingXi_yuyubo]" ) ;
2025-03-14 10:00:24 +08:00
var sqlList = DBUtils . ExecuteDynamicObject ( Context , sql ) ;
2025-03-16 16:56:15 +08:00
if ( sqlList . Count ( ) > 0 )
{
string sql_3 = "" ;
const int batchSize = 1000 ; // 每批处理 1000 条数据
2025-03-17 09:39:43 +08:00
#region
// for (int i = 0; i < sqlList.Count(); i++)
// {
// #region 隐藏单据体赋值
2025-03-16 16:56:15 +08:00
2025-03-17 09:39:43 +08:00
// var f1 = sqlList[i]["F_001"];
// var f2 = sqlList[i]["销售员"];
// var f3 = sqlList[i]["SBU"];
// var f4 = sqlList[i]["明细区域"];
// var f5 = sqlList[i]["购货单位"];
// var f6 = sqlList[i]["公司性质"];
// var f7 = sqlList[i]["客户信用"];
// var f8 = sqlList[i]["合同编号"];
// var f9 = sqlList[i]["项目名称"];
// decimal f10 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["订单总额"]?.ToString()))
// {
// f10 = Convert.ToDecimal(sqlList[i]["订单总额"]);
// }
// var f11 = sqlList[i]["签订年份"];
// var f12 = sqlList[i]["订单日期"];
// var f13 = sqlList[i]["收款条件"];
// var f14 = sqlList[i]["发货日期"];
// decimal f15 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["应收比例"]?.ToString()))
// {
// f15 = Convert.ToDecimal(sqlList[i]["应收比例"]);
// }
// var f16 = sqlList[i]["开票日期"];
// decimal f17 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["累计发货金额"]?.ToString()))
// {
// f17 = Convert.ToDecimal(sqlList[i]["累计发货金额"]);
// }
// decimal f18 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["累计退货金额"]?.ToString()))
// {
// f18 = Convert.ToDecimal(sqlList[i]["累计退货金额"]);
// }
// decimal f19 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["累计开票金额"]?.ToString()))
// {
// f19 = Convert.ToDecimal(sqlList[i]["累计开票金额"]);
// }
// decimal f20 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["累计到款金额"]?.ToString()))
// {
// f20 = Convert.ToDecimal(sqlList[i]["累计到款金额"]);
// }
// decimal f21 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["应收款合计"]?.ToString()))
// {
// f21 = Convert.ToDecimal(sqlList[i]["应收款合计"]);
// }
// decimal f22 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["未出货总额"]?.ToString()))
// {
// f22 = Convert.ToDecimal(sqlList[i]["未出货总额"]);
// }
// var f23 = "";
// if (!string.IsNullOrWhiteSpace(sqlList[i]["预计到期时间"]?.ToString()))
// {
// f23 = sqlList[i]["预计到期时间"]?.ToString();
// }
// var f24 = Convert.ToDecimal(sqlList[i]["未到期金额"]);
// decimal f25 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["实际已出货应收款合计"]?.ToString()))
// {
// f25 = Convert.ToDecimal(sqlList[i]["实际已出货应收款合计"]);
// }
// var f26 = "";
// if (!string.IsNullOrWhiteSpace(sqlList[i]["到期时间"]?.ToString()))
// {
// f26 = sqlList[i]["到期时间"]?.ToString();
// }
// var f27 = Convert.ToDecimal(sqlList[i]["到期金额"]);
// var f28 = sqlList[i]["收款人"];
// var f29 = sqlList[i]["项目阶段"];
// var f30 = sqlList[i]["项目进度"];
// var f31 = sqlList[i]["项目调试时间"];
// var f32 = sqlList[i]["项目验收时间"];
// decimal f33 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["质保金天数"]?.ToString()))
// {
// f33 = Convert.ToDecimal(sqlList[i]["质保金天数"]);
// }
// var f34 = sqlList[i]["质保金到期时间"];
// var f35 = sqlList[i]["提前验收"];
// decimal f36 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["账龄月"]?.ToString()))
// {
// f36 = Convert.ToDecimal(sqlList[i]["账龄月"]);
// }
// var f37 = sqlList[i]["账龄阶段"];
// var f38 = sqlList[i]["一到六个月"];
// var f39 = sqlList[i]["七到十二个月"];
// var f40 = sqlList[i]["十三到十八个月"];
// var f41 = sqlList[i]["十九个月以上"];
// var f42 = sqlList[i]["一年以上"]; ;
// var f43 = sqlList[i]["风险评估级别"];
// var f44 = sqlList[i]["结算类别"];
// var f45 = sqlList[i]["结算类型"];
// var f46 = sqlList[i]["转专责小组时间"];
// var f47 = sqlList[i]["是否超账龄转出"];
// var f48 = sqlList[i]["超账龄是否申请归还大区"];
// var f49 = sqlList[i]["反馈表商务人员引用"];
// var f50 = sqlList[i]["反馈表引用分组"];
// var f51 = sqlList[i]["取值销售"];
// var f52 = sqlList[i]["是否坏账"];
// var f53 = sqlList[i]["是否预发货"];
// var f54 = sqlList[i]["预计回款时间"];
// decimal f55 = 0;
// if (!string.IsNullOrWhiteSpace(sqlList[i]["预计回款金额"]?.ToString()))
// {
// f55 = Convert.ToDecimal(sqlList[i]["预计回款金额"]);
// }
// var f56 = sqlList[i]["情况分类"];
// var f57 = sqlList[i]["销售反馈情况"];
// var f58 = sqlList[i]["商务运营专责协助收款反馈情况"];
// var f59 = sqlList[i]["合同类型"];
// var f0 = sqlList[i]["组织"];
// var f60 = sqlList[i]["实际跟进人"];
// var f61 = sqlList[i]["销售收款分类"];
// var f62 = sqlList[i]["是否集采项目"];
// var f63 = sqlList[i]["天数"];
// #endregion
2025-03-16 16:56:15 +08:00
2025-03-17 09:39:43 +08:00
// sql_3 += string.Format(@"Insert Into ReceivablesDetailsTable Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}',
//'{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}',
//'{30}','{31}','{32}','{33}','{34}','{35}','{36}','{37}','{38}','{39}','{40}','{41}','{42}','{43}','{44}','{45}','{46}','{47}','{48}','{49}',
//'{50}','{51}','{52}','{53}','{54}','{55}','{56}','{57}','{58}','{59}','{60}','{61}','{62}','{63}'
//)", f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26,
// f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47,
// f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f0, f60, f61, f62, f63);
2025-03-16 16:56:15 +08:00
2025-03-17 09:39:43 +08:00
// if ((i + 1) % batchSize == 0 || i == sqlList.Count() - 1)
// {
// DBUtils.ExecuteDynamicObject(Context, sql_3);
// sql_3 = "";
// }
// }
#endregion
2025-03-16 16:56:15 +08:00
}
2025-03-14 10:00:24 +08:00
}
2025-03-21 09:53:55 +08:00
//Loghelp.Log("合计");
//Loghelp.Log(sql_1);
2025-03-14 10:00:24 +08:00
var sql_List1 = DBUtils . ExecuteDynamicObject ( Context , sql_1 ) ;
int indexi = 0 ;
foreach ( var item in sql_List1 )
{
#region 隐 藏 单 据 体 赋 值
int rowindex = this . View . Model . GetEntryRowCount ( "F_MBBA_Entity_qtr" ) ;
this . View . Model . CreateNewEntryRow ( "F_MBBA_Entity_qtr" ) ;
//1
this . View . Model . SetValue ( "F_001" , item [ "F_001" ] , indexi ) ;
//2
this . View . Model . SetValue ( "F_002" , item [ "F_002" ] , indexi ) ;
//3
this . View . Model . SetValue ( "F_003" , item [ "F_003" ] , indexi ) ;
//4
this . View . Model . SetValue ( "F_004" , item [ "F_004" ] , indexi ) ;
//5
this . View . Model . SetValue ( "F_005" , item [ "F_005" ] , indexi ) ;
//6
this . View . Model . SetValue ( "F_006" , item [ "F_006" ] , indexi ) ;
//7
this . View . Model . SetValue ( "F_007" , item [ "F_007" ] , indexi ) ;
//8 indexi
this . View . Model . SetValue ( "F_008" , item [ "F_008" ] , indexi ) ;
//9 indexi
this . View . Model . SetValue ( "F_009" , item [ "F_009" ] , indexi ) ;
//10 indexi
this . View . Model . SetValue ( "F_010" , item [ "F_010" ] , indexi ) ;
//11 indexi
this . View . Model . SetValue ( "F_011" , item [ "F_011" ] , indexi ) ;
//12 indexi
this . View . Model . SetValue ( "F_012" , item [ "F_012" ] , indexi ) ;
//13 indexi
this . View . Model . SetValue ( "F_013" , item [ "F_013" ] , indexi ) ;
//14 indexi
2025-04-16 10:40:39 +08:00
this . View . Model . SetValue ( "F_FaHuoRiQi" , item [ "F_014" ] , indexi ) ;
2025-03-14 10:00:24 +08:00
//15 indexi
this . View . Model . SetValue ( "F_015" , item [ "F_015" ] , indexi ) ;
//16 indexi
2025-04-16 10:40:39 +08:00
this . View . Model . SetValue ( "F_FaPiaoRiQi" , item [ "F_016" ] , indexi ) ;
2025-03-14 10:00:24 +08:00
//17 indexi
this . View . Model . SetValue ( "F_017" , item [ "F_017" ] , indexi ) ;
//18 indexi
this . View . Model . SetValue ( "F_018" , item [ "F_018" ] , indexi ) ;
//19 indexi
this . View . Model . SetValue ( "F_019" , item [ "F_019" ] , indexi ) ;
//20 indexi
this . View . Model . SetValue ( "F_020" , item [ "F_020" ] , indexi ) ;
//21 indexi
this . View . Model . SetValue ( "F_021" , item [ "F_021" ] , indexi ) ;
//22 indexi
this . View . Model . SetValue ( "F_022" , item [ "F_022" ] , indexi ) ;
//23 indexi
this . View . Model . SetValue ( "F_023" , item [ "F_023" ] , indexi ) ;
//24 indexi
this . View . Model . SetValue ( "F_024" , item [ "F_024" ] , indexi ) ;
//25 indexi
this . View . Model . SetValue ( "F_025" , item [ "F_025" ] , indexi ) ;
//26 indexi
this . View . Model . SetValue ( "F_026" , item [ "F_026" ] , indexi ) ;
//27 indexi
this . View . Model . SetValue ( "F_027" , item [ "F_027" ] , indexi ) ;
//28 indexi
this . View . Model . SetValue ( "F_028" , item [ "F_028" ] , indexi ) ;
//29 indexi
this . View . Model . SetValue ( "F_029" , item [ "F_029" ] , indexi ) ;
//30 indexi
this . View . Model . SetValue ( "F_030" , item [ "F_030" ] , indexi ) ;
//31 indexi
this . View . Model . SetValue ( "F_031" , item [ "F_031" ] , indexi ) ;
//32 indexi
this . View . Model . SetValue ( "F_032" , item [ "F_032" ] , indexi ) ;
//33 indexi
this . View . Model . SetValue ( "F_033" , item [ "F_033" ] , indexi ) ;
//34 indexi
this . View . Model . SetValue ( "F_034" , item [ "F_034" ] , indexi ) ;
//35 indexi
this . View . Model . SetValue ( "F_035" , item [ "F_035" ] , indexi ) ;
//36 indexi
this . View . Model . SetValue ( "F_036" , item [ "F_036" ] , indexi ) ;
//37 indexi
this . View . Model . SetValue ( "F_037" , item [ "F_037" ] , indexi ) ;
//38 indexi
this . View . Model . SetValue ( "F_038" , item [ "F_038" ] , indexi ) ;
//39 indexi
this . View . Model . SetValue ( "F_039" , item [ "F_039" ] , indexi ) ;
//40 indexi
this . View . Model . SetValue ( "F_040" , item [ "F_040" ] , indexi ) ;
//41 indexi
this . View . Model . SetValue ( "F_041" , item [ "F_041" ] , indexi ) ;
//42 indexi
this . View . Model . SetValue ( "F_042" , item [ "F_042" ] , indexi ) ;
//43 indexi
this . View . Model . SetValue ( "F_043" , item [ "F_043" ] , indexi ) ;
//44 indexi
this . View . Model . SetValue ( "F_044" , item [ "F_044" ] , indexi ) ;
//45 indexi
this . View . Model . SetValue ( "F_045" , item [ "F_045" ] , indexi ) ;
//46 indexi
this . View . Model . SetValue ( "F_046" , item [ "F_046" ] , indexi ) ;
//47 indexi
this . View . Model . SetValue ( "F_047" , item [ "F_047" ] , indexi ) ;
//48 indexi
this . View . Model . SetValue ( "F_048" , item [ "F_048" ] , indexi ) ;
//49 indexi
this . View . Model . SetValue ( "F_049" , item [ "F_049" ] , indexi ) ;
//50 indexi
this . View . Model . SetValue ( "F_050" , item [ "F_050" ] , indexi ) ;
//51 indexi
this . View . Model . SetValue ( "F_051" , item [ "F_051" ] , indexi ) ;
//52 indexi
this . View . Model . SetValue ( "F_052" , item [ "F_052" ] , indexi ) ;
//53 indexi
this . View . Model . SetValue ( "F_053" , item [ "F_053" ] , indexi ) ;
//54 indexi
this . View . Model . SetValue ( "F_054" , item [ "F_054" ] , indexi ) ;
//55 indexi
this . View . Model . SetValue ( "F_055" , item [ "F_055" ] , indexi ) ;
//56 indexi
this . View . Model . SetValue ( "F_056" , item [ "F_056" ] , indexi ) ;
//57 indexi
this . View . Model . SetValue ( "F_057" , item [ "F_057" ] , indexi ) ;
//58 indexi
this . View . Model . SetValue ( "F_058" , item [ "F_058" ] , indexi ) ;
//59 indexi
this . View . Model . SetValue ( "F_059" , item [ "F_059" ] , indexi ) ;
//00 indexi
this . View . Model . SetValue ( "F_000" , item [ "F_000" ] , indexi ) ;
//F_FID
this . View . Model . SetValue ( "F_FID" , item [ "FID" ] , indexi ) ;
//60
this . View . Model . SetValue ( "F_060" , item [ "F_060" ] , indexi ) ;
//61
this . View . Model . SetValue ( "F_061" , item [ "F_061" ] , indexi ) ;
//62
this . View . Model . SetValue ( "F_062" , item [ "F_062" ] , indexi ) ;
//63
this . View . Model . SetValue ( "F_063" , item [ "F_063" ] , indexi ) ;
2025-03-21 09:53:55 +08:00
//64
this . View . Model . SetValue ( "F_064" , item [ "F_064" ] , indexi ) ;
//65
this . View . Model . SetValue ( "F_065" , item [ "F_065" ] , indexi ) ;
//66
this . View . Model . SetValue ( "F_066" , item [ "F_066" ] , indexi ) ;
//67
this . View . Model . SetValue ( "F_067" , item [ "F_067" ] , indexi ) ;
//68
this . View . Model . SetValue ( "F_068" , item [ "F_068" ] , indexi ) ;
2025-06-05 19:33:30 +08:00
//结算币别
this . View . Model . SetValue ( "FBiBie" , item [ "BiBie" ] , indexi ) ;
//汇率
this . View . Model . SetValue ( "FHuiLv" , item [ "HuiLv" ] , indexi ) ;
//订单总额(原币)
this . View . Model . SetValue ( "FDingDanZongE_YuanBi" , item [ "DingDanZongE_YuanBi" ] , indexi ) ;
//责任人
this . View . Model . SetValue ( "FZeRenRen" , item [ "ZeRenRen" ] , indexi ) ;
//客户信用额度
this . View . Model . SetValue ( "FXinYongEDu" , item [ "XinYongEDu" ] , indexi ) ;
//累计到款金额(原币)
this . View . Model . SetValue ( "FDaoKuanJinE_YuanBi" , item [ "DaoKuanJinE_YuanBi" ] , indexi ) ;
//应收款合计(原币)
this . View . Model . SetValue ( "FYingShouHeJi_YuanBi" , item [ "YingShouHeJi_YuanBi" ] , indexi ) ;
//运杂费
this . View . Model . SetValue ( "FYunZaFei" , item [ "YunZaFei" ] , indexi ) ;
//累计退货金额(原币)
this . View . Model . SetValue ( "FLeiJiTuiHuoJinE_YuanBi" , item [ "LeiJiTuiHuoJinE_YuanBi" ] , indexi ) ;
2025-03-20 09:41:04 +08:00
2025-06-11 14:51:56 +08:00
//实际已出货应收款合计(本位币)
this . View . Model . SetValue ( "F_SJYCHYSKHJ_BWB" , item [ "F_SJYCHYSKHJ_BWB" ] , indexi ) ;
//未到期金额(本位币)
this . View . Model . SetValue ( "F_WDQJE_BWB" , item [ "F_WDQJE_BWB" ] , indexi ) ;
//到期金额(本位币)
this . View . Model . SetValue ( "F_DQJE_BWB" , item [ "F_DQJE_BWB" ] , indexi ) ;
2025-03-20 09:41:04 +08:00
//【订单总额、累计发货金额、累计退货金额、累计开票金额、累计到款金额、应收款合计、未出货总额、实际已出货应收款合计、】的明细需要去重
if ( dicList . ContainsKey ( item [ "销售单主键ID" ] . ToString ( ) + "-" + item [ "销售员ID" ] . ToString ( ) ) )
{
this . View . Model . SetValue ( "F_010" , null , indexi ) ;
this . View . Model . SetValue ( "F_017" , null , indexi ) ;
this . View . Model . SetValue ( "F_018" , null , indexi ) ;
this . View . Model . SetValue ( "F_019" , null , indexi ) ;
this . View . Model . SetValue ( "F_020" , null , indexi ) ;
this . View . Model . SetValue ( "F_021" , null , indexi ) ;
this . View . Model . SetValue ( "F_022" , null , indexi ) ;
this . View . Model . SetValue ( "F_025" , null , indexi ) ;
2025-06-05 19:33:30 +08:00
this . View . Model . SetValue ( "FLeiJiTuiHuoJinE_YuanBi" , null , indexi ) ;
this . View . Model . SetValue ( "FDaoKuanJinE_YuanBi" , null , indexi ) ;
this . View . Model . SetValue ( "FYingShouHeJi_YuanBi" , null , indexi ) ;
this . View . Model . SetValue ( "FXinYongEDu" , null , indexi ) ;
this . View . Model . SetValue ( "FDingDanZongE_YuanBi" , null , indexi ) ;
2025-06-11 14:51:56 +08:00
this . View . Model . SetValue ( "F_SJYCHYSKHJ_BWB" , null , indexi ) ;
2025-03-20 09:41:04 +08:00
}
else
dicList . Add ( item [ "销售单主键ID" ] . ToString ( ) + "-" + item [ "销售员ID" ] . ToString ( ) , 0 ) ;
2025-03-14 10:00:24 +08:00
indexi + + ;
#endregion
}
this . View . UpdateView ( "F_MBBA_Entity_qtr" ) ;
}
}
2025-03-17 19:04:06 +08:00
2025-03-14 10:00:24 +08:00
}
}