private void tableView1_CellValueChanged(object sender, DevExpress.Xpf.Grid.CellValueChangedEventArgs e)
 {
     if (e.Column.FieldName == "AccID")
     {
         VoucherTplEntry entry = e.Row as VoucherTplEntry;
         entry.itemClassLst = itemClsDao.getCollectionByAccount(entry.AccID);
     }
 }
예제 #2
0
        public VoucherTpl getDetailByInterID(int InterID)
        {
            String  sql = "select * from fsICVoucherTpl t1 where t1.FInterID=" + InterID + "";
            DataSet ds  = DbHelper.getInstance().Query(sql);

            if (!DbHelper.getInstance().IsEmpty(ds))
            {
                VoucherTpl tpl = new VoucherTpl();
                //取表头
                tpl.InterID        = Convert.ToInt32(ds.Tables[0].Rows[0]["FInterID"]);
                tpl.Name           = Convert.ToString(ds.Tables[0].Rows[0]["FName"]);
                tpl.GroupID        = Convert.ToInt32(ds.Tables[0].Rows[0]["FGroupID"]);
                tpl.BillerID       = Convert.ToInt32(ds.Tables[0].Rows[0]["FBillerID"]);
                tpl.BillNo         = Convert.ToString(ds.Tables[0].Rows[0]["FBillNo"]);
                tpl.LastUpdateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["FDate"]);
                tpl.TransType      = Convert.ToInt32(ds.Tables[0].Rows[0]["FTplType"]);
                tpl.IsDefault      = Convert.ToInt32(ds.Tables[0].Rows[0]["FIsDefault"]);
                //取表体

                sql = "select * from fsICVoucherTplEntry where FInterID=" + tpl.InterID;
                DataSet ds2 = DbHelper.getInstance().Query(sql);
                ObservableCollection <VoucherTplEntry> entryList = new ObservableCollection <VoucherTplEntry>();
                foreach (DataRow row in ds2.Tables[0].Rows)
                {
                    VoucherTplEntry entry = new VoucherTplEntry();

                    entry.InterID    = tpl.InterID;
                    entry.AccID      = Convert.ToInt32(row["FAccID"]);
                    entry.AmountFrom = Convert.ToInt32(row["FAmountFrom"]);
                    entry.EntryID    = Convert.ToInt32(row["FEntryID"]);
                    entry.Note       = Convert.ToString(row["FNote"]);
                    entry.Direction  = Convert.ToInt32(row["FAccDC"]);
                    //取核算项目
                    sql = "select * from fsICVoucherTAudit where FInterID=" + tpl.InterID + " and FEntryID=" + entry.EntryID;
                    DataSet ds3 = db.Query(sql);
                    ObservableCollection <ItemClass> itemLst = new ObservableCollection <ItemClass>();

                    foreach (DataRow itemRow in ds3.Tables[0].Rows)
                    {
                        ItemClass item = new ItemClass();
                        item.Field       = Convert.ToString(itemRow["FFieldName"]);
                        item.IsEntry     = Convert.ToInt32(itemRow["FIsEntry"]);
                        item.ItemClassID = Convert.ToInt32(itemRow["FItemClassID"]);
                        item.Name        = Convert.ToString(itemRow["FName"]);
                        item.Number      = Convert.ToString(itemRow["FNumber"]);
                        itemLst.Add(item);
                    }
                    entry.itemClassLst = itemLst;


                    entryList.Add(entry);
                }
                tpl.EntryList = entryList;
                return(tpl);
            }
            return(null);
        }
        public void ShowSetItemsWindow()
        {
            SetItemsWindow wind = new SetItemsWindow();

            wind.TransType = (int)cboTransType.EditValue;
            VoucherTplEntry entry = (VoucherTplEntry)gridControl1.GetFocusedRow();

            if (entry == null)
            {
                return;
            }
            wind.Data = entry.itemClassLst;
            wind.InitView();
            wind.ShowDialog();
        }