示例#1
0
        private void DataGrid_凭证明细_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            Model_凭证明细 SelectedRow = this.DataGrid_凭证明细.SelectedCells[0].Item as Model_凭证明细;
            string     newValue    = (e.EditingElement as TextBox).Text.Trim();
            string     Header      = e.Column.Header.ToString();
            decimal    result      = 0m;

            if (Header == "借方金额")
            {
                if (!decimal.TryParse(newValue, out result))
                {
                    MessageBoxCommon.Show("请输入数字。");
                }
                VoucherDetailsNow[SelectedRow.序号].借方 = result;
                VoucherDetailsNow[SelectedRow.序号].贷方 = 0m;
                Count合计();
            }
            else if (Header == "贷方金额")
            {
                if (!decimal.TryParse(newValue, out result))
                {
                    MessageBoxCommon.Show("请输入数字。");
                }
                VoucherDetailsNow[SelectedRow.序号].贷方 = result;
                VoucherDetailsNow[SelectedRow.序号].借方 = 0m;
                Count合计();
            }
        }
示例#2
0
        private void DataGrid_凭证明细_Cell_MouseDoubleClick(object sender, RoutedEventArgs e)
        {
            if (Voucher.审核标志 == 1)
            {
                return;
            }
            Model_凭证明细       SelectedRow     = this.DataGrid_凭证明细.SelectedCells[0].Item as Model_凭证明细;
            DataGridCellInfo DoubleClickCell = this.DataGrid_凭证明细.CurrentCell;

            CellId = SelectedRow.序号;
            if (DoubleClickCell.Column.Header.ToString() == "科目" || DoubleClickCell.Column.Header.ToString() == "子细目")
            {
                PA.View.Pages.Pop.凭证录入.Page_凭证录入_子细目 page;
                page                       = new PA.View.Pages.Pop.凭证录入.Page_凭证录入_子细目();
                page.FillDate             += new Pages.Pop.凭证录入.Page_凭证录入_子细目_FillDateEventHandle(DoFillData);
                this.Frame_科目子细目.Content   = page;
                this.Popup_科目子细目.IsOpen    = true;
                this.Window_记账凭证.IsEnabled = false;
            }
            else if (DoubleClickCell.Column.Header.ToString() == "记账")
            {
                if (VoucherDetails[CellId].记账 == 0)
                {
                    VoucherDetails[CellId].记账 = 1;
                }
                else
                {
                    VoucherDetails[CellId].记账 = 0;
                }
            }
        }
示例#3
0
 /// <summary>
 /// 初始化数据(空)
 /// </summary>
 private void InitData(bool isFirstInit)
 {
     VoucherDetailsNow = new List <Model_凭证明细>();
     for (int i = 0; i < 6; i++)
     {
         Model_凭证明细 a = new Model_凭证明细();
         a.序号 = i;
         VoucherDetailsNow.Add(a);
     }
     if (isFirstInit)
     {
         ViewModel.ViewModel_用户 vu = new ViewModel.ViewModel_用户();
         this.DatePicker_Date.SelectedDate = DateTime.Now;
         this.Label_制单人.Content            = vu.GetUserName((int)ENUM.EM_AUTHORIY.记账员);
         this.Label_会计主管.Content           = vu.GetUserName((int)ENUM.EM_AUTHORIY.会计主管);
     }
     this.DataGrid_凭证明细.ItemsSource = VoucherDetailsNow;
     VoucherDetails.Clear();
     for (int i = 0; i < 6; i++)
     {
         VoucherDetails.Add(VoucherDetailsNow[i]);
     }
     Count合计();
     this.TextBox_号.Text = "";
 }
示例#4
0
 /// <summary>
 /// 填充数据(查看修改)
 /// </summary>
 private void FillData(Guid guid)
 {
     Voucher        = new PA.ViewModel.ViewModel_凭证管理().GetVoucher(guid);
     VoucherDetails = new PA.ViewModel.ViewModel_凭证管理().GetVoucherDetails(guid);
     this.DatePicker_Date.SelectedDate = Voucher.制表时间;
     this.TextBox_附属单证.Text            = Voucher.附属单证数.ToString();
     this.Label_借方合计.Content           = Voucher.合计借方金额.ToString().Contains(".") ? Voucher.合计借方金额.ToString("f2") : Voucher.合计借方金额.ToString();
     this.Label_贷方合计.Content           = Voucher.合计贷方金额.ToString().Contains(".") ? Voucher.合计贷方金额.ToString("f2") : Voucher.合计贷方金额.ToString();
     for (int i = 0; i < 6; i++)
     {
         Model_凭证明细 a = new Model_凭证明细();
         a.序号 = i;
         VoucherDetailsNow.Add(a);
     }
     for (int i = 0; i < VoucherDetails.Count; i++)
     {
         if (i < 6)
         {
             VoucherDetailsNow[i] = VoucherDetails[i];
         }
     }
     this.TextBox_号.Text            = VoucherDetailsNow[0].凭证号;
     this.DataGrid_凭证明细.ItemsSource = VoucherDetailsNow;
     PageAll = new PA.ViewModel.ViewModel_凭证管理().GetPageNum(guid);
     this.TextBlock_PageNum.Text = "1/" + PageAll;
     if (Voucher.审核标志 == 1)
     {
         this.Label_审核状态.Content    = "已审核";
         this.Label_审核状态.Foreground = Brushes.Green;
     }
     else
     {
         this.Label_审核状态.Content    = "未审核";
         this.Label_审核状态.Foreground = Brushes.Red;
     }
     //已审核,不能编辑修改
     if (Voucher.审核标志 == 1)
     {
         this.Button_保存.Visibility          = System.Windows.Visibility.Collapsed;
         this.Button_NewDataGrid.Visibility = System.Windows.Visibility.Collapsed;
         this.TextBox_号.IsReadOnly          = true;
         this.TextBox_附属单证.IsReadOnly       = true;
         this.DataGrid_凭证明细.IsReadOnly      = true;
         this.DatePicker_Date.IsEnabled     = false;
     }
     this.Label_会计主管.Content = Voucher.会计主管;
     this.Label_制单人.Content  = Voucher.制单人;
     this.Label_复核.Content   = Voucher.核;
 }
示例#5
0
 private void Button_NewDataGrid_Click(object sender, RoutedEventArgs e)
 {
     SaveVoucherDetails();
     VoucherDetailsNow = new List <Model_凭证明细>();
     for (int i = 0; i < 6; i++)
     {
         Model_凭证明细 a = new Model_凭证明细();
         a.序号 = i;
         VoucherDetailsNow.Add(a);
     }
     for (int i = 0; i < 6; i++)
     {
         VoucherDetails.Add(VoucherDetailsNow[i]);
     }
     this.DataGrid_凭证明细.ItemsSource = VoucherDetailsNow;
     PageAll++;
     PageNow = PageAll;
     this.TextBlock_PageNum.Text = PageNow + "/" + PageAll;
 }
示例#6
0
 private void MenuItem_Click(object sender, RoutedEventArgs e)
 {
     #region  除方法
     if (DataGrid_凭证明细.SelectedCells.Count != 0)
     {
         Model_凭证明细 m = DataGrid_凭证明细.SelectedCells[0].Item as Model_凭证明细;
         if (m.ID != 0)
         {
             bool flag = vmp.DeleteDetail(m.ID);
             if (!flag)
             {
                 MessageBoxCommon.Show("删除不成功!未找到对应数据!");
             }
         }
         m.摘要   = "";
         m.主科目名 = "";
         m.子细目  = "";
         m.借方   = 0;
         m.贷方   = 0;
         Count合计();
     }
     #endregion
 }
        internal List <Model_凭证明细> GetVoucherDetails(Guid guid)
        {
            string            LastVoucherNum = "";
            int               CountNum       = 0;
            bool              isFirstLine    = true;
            List <Model_凭证明细> VoucherDetails = new List <Model_凭证明细>();
            Model_凭证明细        detail;
            string            sql = "select detail.*, subjectA.subject_name as MainSubjectName, subjectB.subject_name as TimesSubjectName"
                                    + " from "
                                    + DBTablesName.T_VOUCHER_DETAIL + " detail"
                                    + " LEFT JOIN " + DBTablesName.T_SUBJECT + " subjectA ON detail.subject_id=subjectA.subject_id"
                                    + " LEFT JOIN " + DBTablesName.T_SUBJECT + " subjectB ON detail.detail=subjectB.subject_id"
                                    + " where PARENTID='" + guid + "'";
            DataSet ds = new PA.Helper.DataBase.DataBase().Query(sql);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (LastVoucherNum == dr[4].ToString() || isFirstLine)
                {
                    detail       = new Model_凭证明细();
                    detail.ID    = int.Parse(dr[0].ToString());
                    detail.序号    = int.Parse(dr[1].ToString());
                    detail.父节点ID = dr[2].ToString();
                    detail.凭证字   = dr[3].ToString();
                    detail.凭证号   = dr[4].ToString();
                    detail.摘要    = dr[5].ToString();
                    detail.科目编号  = dr[6].ToString();
                    detail.子细目ID = dr[7].ToString();
                    detail.记账    = int.Parse(dr[8].ToString());
                    detail.借方    = decimal.Parse(dr[9].ToString());
                    detail.贷方    = decimal.Parse(dr[10].ToString());
                    detail.主科目名  = dr[6].ToString() + " " + dr["MainSubjectName"].ToString();
                    detail.子细目   = dr[7].ToString() + " " + dr["TimesSubjectName"].ToString();
                    VoucherDetails.Add(detail);
                    LastVoucherNum = dr[4].ToString();
                    CountNum++;
                    isFirstLine = false;
                }
                else
                {
                    //补全上一页剩余空白行
                    for (int i = CountNum; i < 6; i++)
                    {
                        detail    = new Model_凭证明细();
                        detail.序号 = i;
                        VoucherDetails.Add(detail);
                    }
                    CountNum     = 0;
                    detail       = new Model_凭证明细();
                    detail.ID    = int.Parse(dr[0].ToString());
                    detail.序号    = int.Parse(dr[1].ToString());
                    detail.父节点ID = dr[2].ToString();
                    detail.凭证字   = dr[3].ToString();
                    detail.凭证号   = dr[4].ToString();
                    detail.摘要    = dr[5].ToString();
                    detail.科目编号  = dr[6].ToString();
                    detail.子细目ID = dr[7].ToString();
                    detail.记账    = int.Parse(dr[8].ToString());
                    detail.借方    = decimal.Parse(dr[9].ToString());
                    detail.贷方    = decimal.Parse(dr[10].ToString());
                    detail.主科目名  = dr[6].ToString() + " " + dr["MainSubjectName"].ToString();
                    detail.子细目   = dr[7].ToString() + " " + dr["TimesSubjectName"].ToString();
                    VoucherDetails.Add(detail);
                    LastVoucherNum = dr[4].ToString();
                    CountNum++;
                }
            }
            //补全最后的空白行
            for (int i = CountNum; i < 6; i++)
            {
                detail    = new Model_凭证明细();
                detail.序号 = i;
                VoucherDetails.Add(detail);
            }
            return(VoucherDetails);
        }