@ -25,6 +25,7 @@ using BWP.B3Frameworks;
using System.Web.UI ;
using TSingSoft.WebPluginFramework.Controls ;
using TSingSoft.WebPluginFramework.Exports ;
using BWP.B3QingDaoWanFu.BO ;
namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
{
@ -62,7 +63,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
var 皮 肉 重 量 = ( Money < 金 额 > ? ) ( objToDecimal ( 肉 重 量 ) + objToDecimal ( 皮 重 ) ) ;
row [ "皮肉重量" ] = 皮 肉 重 量 ;
sum皮肉重量 + = ( 皮 肉 重 量 ? ? 0 ) ;
var 到 厂 毛 重 = objToDecimal ( row [ "到厂毛重" ] ) ;
row [ "皮肉比" ] = Math . Round ( ( double ) ( 皮 肉 重 量 / 到 厂 毛 重 * 1 0 0 ) , 2 ) ;
}
@ -78,7 +79,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
SetCommonDivSumTable ( table , "实付单价" , "实付金额" , "到厂毛重" ) ;
SetCommonDivSumTable ( table , "单头盈亏" , "盈亏" , "收购头数" ) ;
SetCommonDivSumTable ( table , "均重" , "到厂毛重" , "收购头数" ) ;
SetCommonDivSumTable ( table , "损耗比" , "损耗" , "原发毛重" , true ) ;
SetCommonDivSumTable ( table , "损耗比" , "损耗" , "原发毛重" , true ) ;
SetCommonDivSumTable ( table , "皮肉比" , "皮肉重量" , "到厂毛重" , true ) ;
Set占比 ( table ) ;
@ -93,7 +94,27 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
table . SumRow [ "死亡头数" ] = n ;
}
// Set占比(table,);
if ( _checkbox . Items . FindByText ( "经纪费" ) . Selected )
{
Money < 金 额 > n = 0 m ;
foreach ( DFDataRow row in table . Rows )
{
n + = Convert . ToDecimal ( row [ "经纪费" ] ? ? 0 ) ;
}
table . SumRow [ "经纪费" ] = n ;
}
if ( _checkbox . Items . FindByText ( "运费" ) . Selected )
{
Money < 金 额 > n = 0 ;
foreach ( DFDataRow row in table . Rows )
{
n + = Convert . ToInt32 ( row [ "运费" ] ? ? 0 ) ;
}
table . SumRow [ "运费" ] = n ;
}
// Set占比(table,);
}
private void Set占比 ( DFDataTable table )
@ -115,21 +136,21 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
var 烫 褪 总 重 量 = 烫 褪 一 级 重 量 + 烫 褪 二 级 重 量 + 烫 褪 三 级 重 量 + 烫 褪 四 级 重 量 + 烫 褪 五 级 重 量 ;
table . SumRow [ "剥皮|一级|占比" ] = Math . Round ( 剥 皮 一 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|二级|占比" ] = Math . Round ( 剥 皮 二 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|三级|占比" ] = Math . Round ( 剥 皮 三 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|四级|占比" ] = Math . Round ( 剥 皮 四 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|五级|占比" ] = Math . Round ( 剥 皮 五 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|一级|占比" ] = Math . Round ( 剥 皮 一 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|二级|占比" ] = Math . Round ( 剥 皮 二 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|三级|占比" ] = Math . Round ( 剥 皮 三 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|四级|占比" ] = Math . Round ( 剥 皮 四 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "剥皮|五级|占比" ] = Math . Round ( 剥 皮 五 级 重 量 / 剥 皮 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|一级|占比" ] = Math . Round ( 烫 褪 一 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|二级|占比" ] = Math . Round ( 烫 褪 二 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|三级|占比" ] = Math . Round ( 烫 褪 三 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|四级|占比" ] = Math . Round ( 烫 褪 四 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|五级|占比" ] = Math . Round ( 烫 褪 五 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|一级|占比" ] = Math . Round ( 烫 褪 一 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|二级|占比" ] = Math . Round ( 烫 褪 二 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|三级|占比" ] = Math . Round ( 烫 褪 三 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|四级|占比" ] = Math . Round ( 烫 褪 四 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "烫褪|五级|占比" ] = Math . Round ( 烫 褪 五 级 重 量 / 烫 褪 总 重 量 * 1 0 0 , 2 ) ;
var 一 二 级 重 量 = 剥 皮 一 级 重 量 + 剥 皮 二 级 重 量 + 烫 褪 一 级 重 量 + 烫 褪 二 级 重 量 ;
var 总 重 量 = 剥 皮 总 重 量 + 烫 褪 总 重 量 ;
table . SumRow [ "一二级比" ] = Math . Round ( 一 二 级 重 量 / 总 重 量 * 1 0 0 , 2 ) ;
table . SumRow [ "一二级比" ] = Math . Round ( 一 二 级 重 量 / 总 重 量 * 1 0 0 , 2 ) ;
}
@ -211,7 +232,8 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
_checkbox . Items . Add ( new ListItem ( "过磅单号" , "Weigh_ID" ) ) ;
_checkbox . Items . Add ( new ListItem ( "结算单号" , "ID" ) ) ;
_checkbox . Items . Add ( new ListItem ( "业务员" , "Employee_Name" ) ) ;
_checkbox . Items . Add ( new ListItem ( "经纪费" , "JingJiFee" ) ) ;
_checkbox . Items . Add ( new ListItem ( "运费" , "TransferFee" ) ) ;
_checkbox . Items . Add ( new ListItem ( "收购头数" , "RealNumber" ) ) ;
_checkbox . Items . Add ( new ListItem ( "死亡头数" , "DeathNumber" ) ) ;
@ -280,8 +302,8 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
{
return new QuerySettings ( SelectRange . All , mDFGrid . SortField , mDFGrid . SortDirection ) ;
} ;
queryPanel . ButtonsPanel . EAdd ( new TSButton ( "导出到Excel" , ( sender , args ) = > exporter . Export ( excelExporter ) ) ) ;
queryPanel . ButtonsPanel . EAdd ( new TSButton ( "导出到Excel" , ( sender , args ) = > exporter . Export ( excelExporter ) ) ) ;
queryPanel . ButtonsPanel . EAdd ( exporter ) ;
}
@ -323,6 +345,10 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
tempUnionDom . Register ( query ) ;
var unionAlias = new JoinAlias ( "tempUnionDom" , typeof ( tempUnionDom ) ) ;
query . From . AddJoin ( JoinType . Left , new DQDmoSource ( unionAlias ) , DQCondition . EQ ( bill , "ID" , unionAlias , "StatPay_ID" ) ) ;
var costRecord = new JoinAlias ( typeof ( CostRecordTemp ) ) ;
CostRecordTemp . Register ( query ) ;
query . From . AddJoin ( JoinType . Left , new DQDmoSource ( costRecord ) , DQCondition . EQ ( bill , "Weigh_ID" , costRecord , "WeightBill_ID" ) ) ;
query . GroupBy . Expressions . Add ( DQExpression . Field ( bill , "Date" ) ) ;
@ -359,7 +385,12 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
query . Columns . Add ( DQSelectColumn . Create ( DQExpression . Field ( field . Value ) , field . Text ) ) ;
query . GroupBy . Expressions . Add ( DQExpression . Field ( field . Value ) ) ;
break ;
case "经纪费" :
case "运费" :
query . Columns . Add ( DQSelectColumn . Create ( DQExpression . Field ( costRecord , field . Value ) , field . Text ) ) ;
query . GroupBy . Expressions . Add ( DQExpression . Field ( weight , "ID" ) ) ;
query . GroupBy . Expressions . Add ( DQExpression . Field ( costRecord , field . Value ) ) ;
break ;
case "均重" :
query . Columns . Add ( DQSelectColumn . Create ( DQExpression . Sum ( DQExpression . LogicCase ( DQCondition . EQ ( unionAlias , "UnionType" , 1 ) , DQExpression . Field ( unionAlias , "RealWeight" ) ) ) . ESafeDivide ( DQExpression . Sum ( DQExpression . LogicCase ( DQCondition . EQ ( unionAlias , "UnionType" , 1 ) , DQExpression . Field ( unionAlias , "RealNumber" ) ) ) ) . ECastType < Money < 金 额 > > ( ) , "均重" ) ) ;
break ;
@ -992,9 +1023,33 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports
query . Columns . Add ( DQSelectColumn . Field ( "Weigh_ID" ) ) ;
query . Columns . Add ( DQSelectColumn . Sum ( "Num" ) ) ;
query . GroupBy . Expressions . Add ( DQExpression . Field ( "Weigh_ID" ) ) ;
query . Where . Conditions . Add ( DQCondition . EQ ( setting , "AbnormalItem_Name" , "死亡" ) ) ;
query . Where . Conditions . Add ( DQCondition . EQ ( setting , "AbnormalItem_Name" , "死亡" ) ) ;
return query ;
}
}
class CostRecordTemp
{
public long WeightBill_ID { get ; set ; }
public Money < 金 额 > ? JingJiFee { get ; set ; }
public Money < 金 额 > ? TransferFee { get ; set ; }
public static void Register ( DQueryDom root )
{
var main = new JoinAlias ( typeof ( CostRecord ) ) ;
var detail = new JoinAlias ( typeof ( CostRecord_Detail ) ) ;
var query = new DQueryDom ( main ) ;
query . From . AddJoin ( JoinType . Inner , new DQDmoSource ( detail ) , DQCondition . EQ ( main , "ID" , detail , "CostRecord_ID" ) ) ;
query . Columns . Add ( DQSelectColumn . Field ( "WeightBill_ID" , detail ) ) ;
query . Columns . Add ( DQSelectColumn . Sum ( detail , "JingJiFee" ) ) ;
query . Columns . Add ( DQSelectColumn . Sum ( detail , "TransferFee" ) ) ;
query . GroupBy . Expressions . Add ( DQExpression . Field ( detail , "WeightBill_ID" ) ) ;
query . Where . Conditions . Add ( DQCondition . And ( DQCondition . EQ ( "BillState" , 单 据 状 态 . 已 审 核 ) , DQCondition . EQ ( "Domain_ID" , DomainContext . Current . ID ) ) ) ;
root . RegisterQueryTable ( typeof ( CostRecordTemp ) , new string [ ] { "WeightBill_ID" , "JingJiFee" , "TransferFee" } , query ) ;
}
}
}
}