private void FrmDeptRpt_Load(object sender, EventArgs e) { this.cB_style.SelectedIndex = 0; this.cB_type.SelectedIndex = 0; this.cbPerson.SelectedIndex = type; //this.BindData(); DataSet_Rpt dsr = new DataSet_Rpt(); HIS.ZY_BLL.CostItemStyle cis = this.cB_style.SelectedIndex == 0 ? HIS.ZY_BLL.CostItemStyle.记账日期 : HIS.ZY_BLL.CostItemStyle.结帐日期; HIS.ZY_BLL.CostItemType cit = this.cB_type.SelectedIndex == 0 ? HIS.ZY_BLL.CostItemType.发票项目 : HIS.ZY_BLL.CostItemType.核算项目; dsr.DeptCostTotal_Rpt_AddCol(cit); //dsr.BindDeptItemData(this.dtp_Bdate.Value, this.dtp_Edate.Value, cis, cit); Dept_dt = (DataTable)dsr.DeptCostTotal_Rpt; this.dgv_Fee.DataSource = Dept_dt; this.dgv_Fee.Columns[0].Frozen = true; this.dgv_Fee.Columns[1].Frozen = true; this.dgv_Fee.Columns[2].Frozen = true; for (int i = 2; i < dgv_Fee.Columns.Count; i++) { dgv_Fee.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } if (type == 2) { this.dgv_Fee.Columns[0].Visible = false; } }
private void BindData() { DataSet_Rpt dsr = new DataSet_Rpt(); HIS.ZY_BLL.CostItemStyle cis = this.cB_style.SelectedIndex == 0 ? HIS.ZY_BLL.CostItemStyle.记账日期 : HIS.ZY_BLL.CostItemStyle.结帐日期; HIS.ZY_BLL.CostItemType cit = HIS.ZY_BLL.CostItemType.发票项目; if (this.cB_type.SelectedIndex == 0) { cit = HIS.ZY_BLL.CostItemType.发票项目; } else if (this.cB_type.SelectedIndex == 1) { cit = HIS.ZY_BLL.CostItemType.核算项目; } else if (this.cB_type.SelectedIndex == 2) { cit = HIS.ZY_BLL.CostItemType.会计项目; } //if(cit) dsr.DeptCostTotal_Rpt_AddCol(cit); dsr.BindDeptItemData(type, this.dtp_Bdate.Value, this.dtp_Edate.Value, cis, cit); Dept_dt = (DataTable)dsr.DeptCostTotal_Rpt; this.dgv_Fee.DataSource = Dept_dt; this.dgv_Fee.Columns[0].Frozen = true; this.dgv_Fee.Columns[1].Frozen = true; this.dgv_Fee.Columns[2].Frozen = true; for (int i = 2; i < dgv_Fee.Columns.Count; i++) { dgv_Fee.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } if (type == 2) { this.dgv_Fee.Columns[0].Visible = false; } }