@ -1,4 +1,7 @@
using DevExpress.XtraGrid.Views.Grid.ViewInfo ;
using DevExpress.Utils ;
using DevExpress.XtraGrid.Columns ;
using DevExpress.XtraGrid.Views.Grid ;
using DevExpress.XtraGrid.Views.Grid.ViewInfo ;
using DevExpress.XtraPrinting.Native ;
using PEIS.Base ;
using PEIS.Entity ;
@ -8,6 +11,7 @@ using PEIS.Utils;
using PEIS.View.Base ;
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Drawing ;
using System.Globalization ;
using System.Linq ;
@ -153,6 +157,7 @@ namespace PEIS.View.Enrollment
FeeItemSearch2 . TextChanged + = FeeItemSearch2_TextChanged ;
FastGroupMove . Click + = FastGroupMove_Click ;
FastExport . Click + = FastExport_Click ;
FastExportTime . Click + = FastExportTime_Click ;
FastDelete . Click + = FastDelete_Click ;
FastGroup . Click + = FastGroup_Click ;
FastCancelGroup . Click + = FastCancelGroup_Click ;
@ -847,7 +852,7 @@ namespace PEIS.View.Enrollment
}
}
private void FastExport_Click ( object sender , EventArgs e ) // 导出团体成员
private void FastExport_Click ( object sender , EventArgs e ) // 导出所有 团体成员
{
if ( _l stEnrollmentPatient . Count ! = 0 )
{
@ -863,12 +868,112 @@ namespace PEIS.View.Enrollment
options . TextExportMode = DevExpress . XtraPrinting . TextExportMode . Value ;
options . ExportType = DevExpress . Export . ExportType . WYSIWYG ;
// 首先,创建一个新的列对象
GridColumn newColumn = new GridColumn ( ) ;
// 设置列的标题,例如"序号"
newColumn . Caption = "序号" ;
// 设置列的字段名称,这将用于数据绑定
newColumn . FieldName = "RowNumber" ;
newColumn . VisibleIndex = 0 ;
newColumn . AppearanceCell . Font = new Font ( "微软雅黑" , 1 2 ) ;
DgcEnrollment . ExportToXls ( saveFileDialog . FileName , options ) ;
// 将列添加到GridView的Columns集合中
DgvEnrollment . Columns . Add ( newColumn ) ;
for ( int i = 0 ; i < _l stEnrollmentPatient . Count ( ) ; i + + )
{
// 使用GetRowCellValue方法获取当前行的序号列的值
int rowNumber = DgvEnrollment . GetRowHandle ( i ) ; // 行句柄
DgvEnrollment . SetRowCellValue ( rowNumber , "RowNumber" , i + 1 ) ; // 设置序号列的值
}
DgcEnrollment . ExportToXls ( saveFileDialog . FileName , options ) ;
DgvEnrollment . Columns . Remove ( newColumn ) ;
}
}
}
private void FastExportTime_Click ( object sender , EventArgs e ) // 导出指定时间范围成员
{
DateTime currentDate = DateTime . Now ;
Form dateForm = new Form ( ) ;
dateForm . Font = new Font ( "微软雅黑" , 1 2 ) ;
dateForm . Text = "时间选择器" ;
dateForm . StartPosition = FormStartPosition . CenterScreen ;
dateForm . Size = new Size ( 3 3 0 , 2 2 6 ) ;
Label begLabel = new Label ( ) ;
begLabel . Location = new Point ( 1 0 , 2 0 ) ;
begLabel . Text = "开始时间:" ;
DateTimePicker begTime = new DateTimePicker ( ) ;
begTime . Location = new Point ( 1 1 0 , 2 0 ) ;
begTime . Value = currentDate . AddDays ( - 6 ) ;
Label endLabel = new Label ( ) ;
endLabel . Location = new Point ( 1 0 , 7 0 ) ;
endLabel . Text = "结束时间:" ;
DateTimePicker endTime = new DateTimePicker ( ) ;
endTime . Location = new Point ( 1 1 0 , 7 0 ) ;
endTime . Value = currentDate ;
Button confirmBtn = new Button ( ) ;
confirmBtn . Text = "确认选择" ;
confirmBtn . Location = new Point ( 1 1 0 , 1 2 0 ) ;
confirmBtn . AutoSize = true ;
confirmBtn . Click + = delegate ( object a , EventArgs b )
{
if ( _l stEnrollmentPatient . Count ! = 0 )
{
SaveFileDialog saveFileDialog = new SaveFileDialog ( ) ;
saveFileDialog . Title = "导出Excel" ;
saveFileDialog . FileName = "团体名单" ;
saveFileDialog . Filter = "Excel文件(*.xls)|*.xls" ;
DialogResult dialogResult = saveFileDialog . ShowDialog ( this ) ;
if ( dialogResult = = DialogResult . OK )
{
DevExpress . XtraPrinting . XlsExportOptionsEx options = new DevExpress . XtraPrinting . XlsExportOptionsEx ( ) ;
options . ShowGridLines = true ;
options . TextExportMode = DevExpress . XtraPrinting . TextExportMode . Value ;
options . ExportType = DevExpress . Export . ExportType . WYSIWYG ;
// 首先,创建一个新的列对象
GridColumn newColumn = new GridColumn ( ) ;
// 设置列的标题,例如"序号"
newColumn . Caption = "序号" ;
// 设置列的字段名称,这将用于数据绑定
newColumn . FieldName = "RowNumber" ;
newColumn . VisibleIndex = 0 ;
newColumn . AppearanceCell . Font = new Font ( "微软雅黑" , 1 2 ) ;
// 将列添加到GridView的Columns集合中
DgvEnrollment . Columns . Add ( newColumn ) ;
DgcEnrollment . DataSource = _l stEnrollmentPatient . Where ( w = > w . SignTime > begTime . Value . Date & & w . SignTime < endTime . Value . AddDays ( 1 ) . Date ) ;
for ( int i = 0 ; i < _l stEnrollmentPatient . Where ( w = > w . SignTime > begTime . Value . Date & & w . SignTime < endTime . Value . AddDays ( 1 ) . Date ) . Count ( ) ; i + + )
{
// 使用GetRowCellValue方法获取当前行的序号列的值
int rowNumber = DgvEnrollment . GetRowHandle ( i ) ; // 行句柄
DgvEnrollment . SetRowCellValue ( rowNumber , "RowNumber" , i + 1 ) ; // 设置序号列的值
}
DgcEnrollment . ExportToXls ( saveFileDialog . FileName , options ) ;
DgvEnrollment . Columns . Remove ( newColumn ) ;
}
}
ShowEnrollmentPatient ( _l stEnrollmentPatient ) ;
dateForm . Close ( ) ;
} ;
dateForm . Controls . Add ( begLabel ) ;
dateForm . Controls . Add ( begTime ) ;
dateForm . Controls . Add ( endLabel ) ;
dateForm . Controls . Add ( endTime ) ;
dateForm . Controls . Add ( confirmBtn ) ;
dateForm . ShowDialog ( ) ;
}
private void FastDelete_Click ( object sender , EventArgs e ) // 删除未签到成员
@ -878,7 +983,7 @@ namespace PEIS.View.Enrollment
OnCancelRegInfo ( item . ID ) ;
}
private void DgvEnrollment_RowCellClick ( object sender , DevExpress . XtraGrid . Views . Grid . RowCellClickEventArgs e )
private void DgvEnrollment_RowCellClick ( object sender , RowCellClickEventArgs e )
{
if ( e . Column . AbsoluteIndex = = 0 )
{
@ -1056,6 +1161,12 @@ namespace PEIS.View.Enrollment
return ;
}
if ( item ? . CancelTime ! = null )
{
Global . Msg ( "info" , "该订单为退费订单留存记录,不能删除!" ) ;
return ;
}
if ( item = = null ) return ;
OnDeleteOrder ( item . ID ) ;
OnGetCheckCost ( Convert . ToInt64 ( DgvOrg . GetRowCellValue ( DgvOrg . GetSelectedRows ( ) [ 0 ] , "ID" ) . ToString ( ) ) , _ chooseRegItem . ID ) ;
@ -1168,6 +1279,12 @@ namespace PEIS.View.Enrollment
return ;
}
if ( item ? . CancelTime ! = null )
{
Global . Msg ( "info" , "该订单为退费订单留存记录,不能删除!" ) ;
return ;
}
if ( item = = null ) return ;
OnDeleteOrder ( item . ID ) ;
OnGetCheckCost ( Convert . ToInt64 ( DgvOrg . GetRowCellValue ( DgvOrg . GetSelectedRows ( ) [ 0 ] , "ID" ) . ToString ( ) ) , _ chooseRegItem . ID ) ;
@ -1216,7 +1333,7 @@ namespace PEIS.View.Enrollment
#endregion 交互事件
private void DgvCheckCost_RowStyle ( object sender , DevExpress . XtraGrid . Views . Grid . RowStyleEventArgs e )
private void DgvCheckCost_RowStyle ( object sender , RowStyleEventArgs e )
{
if ( DgvCheckCost . RowCount = = 0 ) return ;
if ( DgvCheckCost . GetRowCellValue ( e . RowHandle , "SendTime" ) ! = null )
@ -1235,7 +1352,7 @@ namespace PEIS.View.Enrollment
e . Appearance . ForeColor = Color . Black ;
}
private void DgvCheckCost2_RowStyle ( object sender , DevExpress . XtraGrid . Views . Grid . RowStyleEventArgs e )
private void DgvCheckCost2_RowStyle ( object sender , RowStyleEventArgs e )
{
if ( DgvCheckCost2 . RowCount = = 0 ) return ;
if ( DgvCheckCost2 . GetRowCellValue ( e . RowHandle , "SendTime" ) ! = null )
@ -1261,7 +1378,7 @@ namespace PEIS.View.Enrollment
grid . GroupText = Convert . ToBoolean ( DgvCheckCost . GetRowCellValue ( index , "GroupTag" ) ) ? "分组缴费订单" : "未分组缴费订单" ;
}
private void DgvEnrollmentFeeItem_RowStyle ( object sender , DevExpress . XtraGrid . Views . Grid . RowStyleEventArgs e )
private void DgvEnrollmentFeeItem_RowStyle ( object sender , RowStyleEventArgs e )
{
if ( DgvEnrollmentFeeItem . RowCount = = 0 ) return ;
e . Appearance . ForeColor = DgvEnrollmentFeeItem . GetRowCellValue ( e . RowHandle , "OrderNo" ) = = null ? Color . Black : Color . DodgerBlue ;
@ -1335,7 +1452,7 @@ namespace PEIS.View.Enrollment
splitter7 . Visible = PnlFeeItem . Visible ;
}
private void DgvOrg_CustomDrawRowIndicator ( object sender , DevExpress . XtraGrid . Views . Grid . RowIndicatorCustomDrawEventArgs e )
private void DgvOrg_CustomDrawRowIndicator ( object sender , RowIndicatorCustomDrawEventArgs e )
{
if ( e . RowHandle > = 0 )
e . Info . DisplayText = ( e . RowHandle + 1 ) . ToString ( ) ;
@ -1403,13 +1520,13 @@ namespace PEIS.View.Enrollment
}
}
private void DgvGroupPatient_CustomDrawRowIndicator ( object sender , DevExpress . XtraGrid . Views . Grid . RowIndicatorCustomDrawEventArgs e )
private void DgvGroupPatient_CustomDrawRowIndicator ( object sender , RowIndicatorCustomDrawEventArgs e )
{
if ( e . RowHandle > = 0 )
e . Info . DisplayText = ( e . RowHandle + 1 ) . ToString ( ) ;
}
private void DgvPatient_CustomDrawRowIndicator ( object sender , DevExpress . XtraGrid . Views . Grid . RowIndicatorCustomDrawEventArgs e )
private void DgvPatient_CustomDrawRowIndicator ( object sender , RowIndicatorCustomDrawEventArgs e )
{
if ( e . RowHandle > = 0 )
e . Info . DisplayText = ( e . RowHandle + 1 ) . ToString ( ) ;