private void Button_查询_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBox_一级科目.Text)) { MessageBoxCommon.Show("请选择一级科目"); TextBox_一级科目.Focus(); return; } else if (string.IsNullOrEmpty(TextBox_二级科目.Text)) { MessageBoxCommon.Show("请选择二级科目"); TextBox_二级科目.Focus(); return; } else { string a = TextBox_一级科目.Text.ToString(); string b = TextBox_二级科目.Text.ToString(); List <Model_科目明细账> lm = vmk.GetSubjectDetail(a, b); if (lm.Count > 0) { this.Label_年.Content = lm[0].年 + "年"; } else { Model_科目明细账 m = new Model_科目明细账(); m.摘要 = "查询不到数据!"; lm.Add(m); } this.DataGrid_科目明细.ItemsSource = lm; } }
private void Button_反审核_Click(object sender, RoutedEventArgs e) { if (this.DataGrid_本期凭证.SelectedCells.Count != 0) { this.StackPanel_MoreButton.Visibility = System.Windows.Visibility.Collapsed; if (vsy.ValidateRuning() == false) { MessageBoxCommon.Show("试用期已过,不能使用此功能!"); return; } if (CommonInfo.权限值 >= 2) { bool?result = MessageBoxDel.Show("注意", "确认反审核凭证?"); if (result == false) { return; } Model_凭证管理 asd = this.DataGrid_本期凭证.SelectedCells[0].Item as Model_凭证管理; new PA.ViewModel.ViewModel_凭证管理().UnReview(asd.ID); ReflashData(); } else { MessageBoxCommon.Show("您的权限不够,不能进行审核!"); } } else { MessageBoxCommon.Show("请先选择数据"); } }
/// <summary> /// 备份功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_备份_Click(object sender, RoutedEventArgs e) { try { string folderpath = this.backup_filePath.Text; string newfilepath = folderpath + "\\PyramidAccounting" + DateTime.Now.ToString("yyyyMMdd") + ".bak"; if (!System.IO.Directory.Exists(folderpath)) { System.IO.Directory.CreateDirectory(folderpath); } System.IO.File.Copy(dbfilepath, newfilepath, true); //做数据库文件复制 vmm.UpdateAutoBackTag(TextBox_备份天数.Text); if (!backgroundBackupTag) { MessageBoxCommon.Show("数据备份操作成功!"); } mrc.日志 = "进行备份操作,备份路径为:" + newfilepath; vmr.Insert(mrc); } catch (Exception ee) { Log.Write(ee.Message); } }
private void Button_Recover_Click(object sender, RoutedEventArgs e) { string recover_path = Recover_filepath.Text.ToString(); if (!System.IO.File.Exists(recover_path)) { MessageBoxCommon.Show("当前路径找不到数据文件,请检查路径!", "不好意思"); } else if (!string.IsNullOrEmpty(recover_path)) { string lastname = recover_path.Substring(recover_path.LastIndexOf(".") + 1, (recover_path.Length - recover_path.LastIndexOf(".") - 1)); if (lastname.Equals("db") || lastname.Equals("bak")) { string newDBname = System.IO.Path.GetFileNameWithoutExtension(recover_path) + ".db"; string newpath = "Data\\" + newDBname; System.IO.File.Copy(recover_path, newpath, true); //复制回原来的目录 xw.WriteXML("数据库", newDBname); MessageBoxCommon.Show("成功", "恢复数据成功,重启软件生效哦!"); mrc.日志 = "进行了恢复数据"; vmr.Insert(mrc); } else { MessageBoxCommon.Show("选择的数据库文件格式不正确!"); } } }
private void Button_停用_Click(object sender, RoutedEventArgs e) { if (DataGrid_权限设置.SelectedItem != null) { Model_用户 m = DataGrid_权限设置.SelectedItem as Model_用户; if (m.是否使用.Equals("停用")) { MessageBoxCommon.Show("当前用户已经停用,请勿重复操作!"); return; } string messageBoxText = "用户停用后,将不能登录!"; string caption = "注意"; bool? result = false; result = MessageBoxDel.Show(caption, messageBoxText); if (result == false) { return; } bool flag = vm.StopUse(m.ID); if (flag) { mrc.日志 = "进行停用了用户名:" + m.用户名; vmr.Insert(mrc); FreshData(); } else { MessageBoxCommon.Show("操作失败!请联系管理员"); } } else { MessageBoxCommon.Show("请选择需要停用的用户"); } }
private void Button_科目保存_Click(object sender, RoutedEventArgs e) { if (CommonInfo.权限值 < 2) { MessageBoxCommon.Show("需要会计主管确认后再进行保存!"); return; } string messageBoxText = "您现在正在进行保存年初金额操作,请谨慎操作?"; string caption = "注意"; bool? result = MessageBoxDel.Show(caption, messageBoxText); if (result == false) { return; } bool flag = new ViewModel_年初金额().Update(); if (flag) { mrc.日志 = "保存了年初金额初始化!"; vmr.Insert(mrc); MessageBoxCommon.Show("保存成功!"); } //刷新操作 Button btn = sender as Button; //btn.Visibility = Visibility.Hidden; CommonInfo.是否初始化年初数 = true; }
private void Button_总账查询_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBox_科目及单位名称.Text)) { MessageBoxCommon.Show("请选择科目"); TextBox_科目及单位名称.Focus(); return; } else { string a = TextBox_科目及单位名称.Text.ToString(); List <Model_总账> lm; if (a.Substring(0, 1) == "4" || a.Substring(0, 1) == "5") { lm = vmk.GetTotalFee(a, true); } else { lm = vmk.GetTotalFee(a); } this.DataGrid_总账.ItemsSource = lm; if (lm.Count > 1) { this.Label_总账年.Content = lm[1].年 + "年"; } else { Model_总账 m = new Model_总账(); m.摘要 = "查询不到数据!"; lm.Add(m); } this.DataGrid_总账.ItemsSource = lm; } }
private void Button_经费支出明细Print_Click(object sender, RoutedEventArgs e) { string _subjectid = string.Empty; string _detailid = string.Empty; if (string.IsNullOrEmpty(TextBox_多栏明细账_一.Text)) { MessageBoxCommon.Show("请选择一级科目!"); this.TextBox_多栏明细账_一.Focus(); return; } if (string.IsNullOrEmpty(TextBox_多栏明细账_二.Text)) { _detailid = TextBox_多栏明细账_一.Text.Split('\t')[0]; } else { if (string.IsNullOrEmpty(TextBox_多栏明细账_三.Text)) { _detailid = TextBox_多栏明细账_二.Text.Split('\t')[0]; } else { _detailid = TextBox_多栏明细账_三.Text.Split('\t')[0]; } } _subjectid = TextBox_多栏明细账_一.Text; if (new PA.Helper.ExcelHelper.ExcelWriter().ExportExpenditureDetails(_subjectid, _detailid) != "") { MessageBoxCommon.Show("打印失败,请检查数据。"); } }
private bool Validate() { string username = TextBox_用户名.Text.Trim(); if (ComboBox_用户权限.SelectedIndex == 0) { MessageBoxCommon.Show("请选择用户权限"); return(false); } if (string.IsNullOrEmpty(username)) { MessageBoxCommon.Show("请填写用户名"); return(false); } else { if (vm.ValidateUserName(username)) { MessageBoxCommon.Show("当前用户名已存在,请勿重复添加!"); return(false); } if (ComboBox_用户权限.SelectedIndex == 3 && (vm.ValidateAccountOfficer((int)ENUM.EM_AUTHORIY.会计主管))) { MessageBoxCommon.Show("当前已存在会计主管,请勿重复添加!"); return(false); } } if (TextBox_用户密码.SecurePassword.Length == 0) { MessageBoxCommon.Show("请设置初始密码!"); return(false); } return(true); }
private void Button_注册_Click(object sender, RoutedEventArgs e) { string registerCode = TextBox_注册.Text.Trim().ToUpper(); UsbController usb = new Helper.Tools.UsbController(); string date = DateTime.Now.ToString("yyyyMMdd"); string orginCode = "StoneAnt.PA" + date + usb.getSerialNumberFromDriveLetter(); string validateCode = Secure.GetMD5_32(orginCode).ToUpper(); if (registerCode.Equals(validateCode)) { rg.UpdateSoftwareVersionStatus((int)ENUM.EM_SOFTWARESTATE.已注册); rg.UpdateSoftwareRegisterCode(registerCode); //注册后加密数据库 DBInitialize.ChangeDBPassword(); xw.WriteXML("注册", "true"); MessageBoxCommon.Show("注册成功!"); this.LoadPage(); Grid_Register.Visibility = Visibility.Collapsed; } else { MessageBoxCommon.Show("注册码不准确,请联系开发商!"); } }
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合计(); } }
private void Button_AdministrativeExpensesSchedulePrint_Click(object sender, RoutedEventArgs e) { string result = new PA.Helper.ExcelHelper.InstitutionsExcelWriter().ExportAdministrativeExpensesSchedule(ComboBox_Date2.SelectedIndex + 1); if (result != "") { MessageBoxCommon.Show(result); } }
private void Button_IncomeAndExpenditurePrint_Click(object sender, RoutedEventArgs e) { string result = new PA.Helper.ExcelHelper.InstitutionsExcelWriter().ExportIncomeAndExpenditure(ComboBox_Date1.SelectedIndex + 1); if (result != "") { MessageBoxCommon.Show(result); } }
private void Button_BalanceSheetPrint_Click(object sender, RoutedEventArgs e) { string result = new PA.Helper.ExcelHelper.InstitutionsExcelWriter().ExportBalanceSheet(ComboBox_Date.SelectedIndex + 1, CommonInfo.真实姓名); if (result != "") { MessageBoxCommon.Show(result); } }
private void Button_解密_Click(object sender, RoutedEventArgs e) { DBInitialize.ClearPassword(); File.Copy(DBInitialize.dataSource, "Data\\DataWithoutPassword.db", true); new XMLWriter().WriteXML("注册", "false"); DBInitialize.ChangeDBPassword(); new XMLWriter().WriteXML("注册", "true"); Log.Write("成功拷贝机密文件"); MessageBoxCommon.Show("拷贝成功!"); }
private void Button_多栏明细_Click(object sender, RoutedEventArgs e) { string _subjectid = string.Empty; string _detailid = string.Empty; List <Model_费用明细> lm = new List <Model_费用明细>(); if (string.IsNullOrEmpty(TextBox_多栏明细账_一.Text)) { MessageBoxCommon.Show("请选择一级科目!"); this.TextBox_多栏明细账_一.Focus(); return; } if (string.IsNullOrEmpty(TextBox_多栏明细账_二.Text)) { _detailid = TextBox_多栏明细账_一.Text.Split('\t')[0]; } else { if (string.IsNullOrEmpty(TextBox_多栏明细账_三.Text)) { _detailid = TextBox_多栏明细账_二.Text.Split('\t')[0]; } else { _detailid = TextBox_多栏明细账_三.Text.Split('\t')[0]; } } _subjectid = TextBox_多栏明细账_一.Text.Split('\t')[0]; lm = vmk.GetFeeDetail(_subjectid, _detailid); if (lm.Count > 0) { this.Label_费用明细年.Content = lm[0].年 + "年"; int count = 1; if (lm[0].列名.Count > 18) { MessageBoxCommon.Show("该版本软件不支持查询该科目!"); return; } foreach (string s in lm[0].列名) { Label lb = new Label(); lb = FindName("Label_" + count) as Label; lb.Content = s.Split('\t')[1]; count++; } } else { Model_费用明细 m = new Model_费用明细(); m.摘要 = "查询不到数据!"; lm.Add(m); } this.DataGrid_费用明细账.ItemsSource = lm; }
private void Button_创建_Click(object sender, RoutedEventArgs e) { if (!Validate()) //校验不成功 { return; } List <Model.DataGrid.Model_账套> lm = new List <Model.DataGrid.Model_账套>(); Model.DataGrid.Model_账套 m = new Model.DataGrid.Model_账套(); m.ID = DateTime.Now.ToString("yyyyMMddHHmmss"); CommonInfo.账薄号 = m.ID; CommonInfo.当前期 = Convert.ToInt32(TextBox_期.Text.Trim()); m.账套名称 = TextBox_账套名称.Text.Trim(); m.单位名称 = TextBox_公司.Text.Trim(); m.启用期间 = TextBox_year.Text + "年" + TextBox_期.Text + "期"; m.创建时间 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); m.会计制度 = ComboBox_制度.Text.Trim(); m.制度索引 = ComboBox_制度.SelectedIndex; m.当前期 = Convert.ToInt32(TextBox_期.Text.Trim()); CommonInfo.年 = TextBox_year.Text; CommonInfo.制度索引 = m.制度索引.ToString(); CommonInfo.制表单位 = m.单位名称; lm.Add(m); //修改下次启动时帐套的显示 xw.WriteXML("账套信息", m.账套名称); xw.WriteXML("单位", TextBox_公司.Text.Trim()); //数据创建步骤 //1.创建账套 bool flag1 = new ViewModel_Books().Insert(lm); if (!flag1) { MessageBoxCommon.Show("创建帐套时候发生异常,请联系开发商解决问题!"); return; } //2.为账套新建初始年初数 new ViewModel_年初金额().Insert(m.ID); Model_操作日志 mr = new Model_操作日志(); ViewModel_操作日志 vmr = new ViewModel_操作日志(); mr = vmr.GetOperateLog(); mr.日志 = "创建了账套:" + m.账套名称; vmr.Insert(mr); //调整至主页面 CommonInfo.账套信息 = m.账套名称; MainWindow mw = new MainWindow(); mw.Show(); this.Close(); }
private void TextBox_二级科目_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (string.IsNullOrEmpty(TextBox_一级科目.Text.Trim())) { MessageBoxCommon.Show("请选择一级科目后再操作!"); return; } PA.View.Pages.Pop.凭证录入.Page_凭证录入_子细目 page = new PA.View.Pages.Pop.凭证录入.Page_凭证录入_子细目(TextBox_一级科目.Text.ToString().Split('\t')[0], false); page.FillDate += new Pages.Pop.凭证录入.Page_凭证录入_子细目_FillDateEventHandle(DoFillData); this.Frame_科目子细目.Content = page; this.Popup_科目子细目.IsOpen = true; }
/// <summary> /// Lugia /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_New_Add子细目_Click(object sender, RoutedEventArgs e) { string Number = this.TextBox_New_子细目编号.Text; string Name = this.TextBox_New_子细目名称.Text; string Money = this.TextBox_New_年初数.Text; if (string.IsNullOrEmpty(Number) || string.IsNullOrEmpty(Name)) { MessageBoxCommon.Show("数据不能为空"); return; } if (string.IsNullOrEmpty(Money)) { Money = "0"; } string ParentsID = this.ComboBox_New_父ID.Text; List <Model_科目管理> details = new List <Model_科目管理>(); Model_科目管理 detail = new Model_科目管理(); detail.科目编号 = Number; detail.科目名称 = Name; detail.年初金额 = Money; if (this.ComboBox_New_父ID.Text.Length <= 3) { detail.类别 = "100"; } else if (this.ComboBox_New_父ID.Text.Length <= 5) { detail.类别 = "1000"; } else { detail.类别 = "10000"; } detail.父ID = ParentsID; detail.借贷标记 = BorrowMark; details.Add(detail); bool flag = vm.Insert(details); if (flag) { this.TextBox_New_子细目名称.Text = ""; this.TextBox_New_年初数.Text = ""; check(); } else { MessageBoxCommon.Show("添加不成功,请检查编号是否唯一!"); } }
private void Button_操作记录查询_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(DatePicker_操作记录.Text) || string.IsNullOrEmpty(DatePicker_操作记录End.Text)) { MessageBoxCommon.Show("请选择查询时间的范围!"); return; } string dateStart = Convert.ToDateTime(DatePicker_操作记录.Text).ToString("yyyy-MM-dd HH:mm:ss"); string dateEnd = Convert.ToDateTime(DatePicker_操作记录End.Text).AddDays(1).ToString("yyyy-MM-dd HH:mm:ss"); ViewModel_操作日志 v = new ViewModel_操作日志(); this.DataGrid_操作记录.ItemsSource = v.GetData(dateStart, dateEnd); }
private void Button_修改_Click(object sender, RoutedEventArgs e) { if (DataGrid_权限设置.SelectedItem != null) { Model_用户 m = DataGrid_权限设置.SelectedItem as Model_用户; Pop.系统管理.Page_修改用户 p = new Pop.系统管理.Page_修改用户(m.ID); this.Grid_Pop弹出.Visibility = Visibility; this.Frame_系统管理_Pop.Content = p; p.CloseEvent += new Pop.系统管理.Page_系统管理_CloseEventHandle(CloseGrid); } else { MessageBoxCommon.Show("请选择需要修改的用户"); } }
private void TextBox_多栏明细账_三_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (TextBox_多栏明细账_二.Text == null || TextBox_多栏明细账_二.Text.Equals("")) { MessageBoxCommon.Show("请选择二级科目编号及名称!"); TextBox_多栏明细账_二.Focus(); return; } string subject_id = TextBox_多栏明细账_二.Text.Split('\t')[0]; PA.View.Pages.Pop.凭证录入.Page_凭证录入_子细目 page = new PA.View.Pages.Pop.凭证录入.Page_凭证录入_子细目(subject_id, true); page.FillDate += new Pages.Pop.凭证录入.Page_凭证录入_子细目_FillDateEventHandle(FillData多栏明细账_三); this.Frame_科目子细目.Content = page; this.Popup_科目子细目.IsOpen = true; }
private void Button_总账Print_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBox_科目及单位名称.Text)) { MessageBoxCommon.Show("请选择科目"); TextBox_科目及单位名称.Focus(); return; } string Parm = TextBox_科目及单位名称.Text.ToString(); string result = new PA.Helper.ExcelHelper.ExcelWriter().ExportLedger(Parm); if (result != "") { MessageBoxCommon.Show(result); } }
private void Button_凭证输入_Click(object sender, RoutedEventArgs e) { if (vsy.ValidateRuning() == false) { MessageBoxCommon.Show("试用期已过,不能使用此功能!"); return; } if (CommonInfo.是否初始化年初数) { new PA.View.Windows.Win_记账凭证().ShowDialog(); //OnTabChange(1, 0); } else { MessageBoxCommon.Show("当前未初始化年初金额,请先初始化年初数!"); } }
private void Button_save_Click(object sender, RoutedEventArgs e) { try { xw.WriteXML("自动备份标志", is_auto_backup.IsChecked.ToString()); xw.WriteXML("备份时间", TextBox_备份天数.Text); xw.WriteXML("备份路径", backup_filePath.Text); xw.WriteXML("还原路径", Recover_filepath.Text); mrc.日志 = "保存当前配置信息!"; vmr.Insert(mrc); } catch (Exception ex) { Log.Write(ex.Message); } MessageBoxCommon.Show("设置成功!"); }
private void Button_保存并新增_Click(object sender, RoutedEventArgs e) { GetData(); if (!CheckData()) { return; } if (new PA.ViewModel.ViewModel_凭证管理().InsertData(Voucher, VoucherDetails)) { OnSubmit(); InitData(false); } else { MessageBoxCommon.Show("数据有误"); } }
private bool Validate() { string 编号 = TextBox_编号.Text.Trim(); if (string.IsNullOrEmpty(编号)) { MessageBoxCommon.Show("请填写编号"); return(false); } else if (vm.ValidateIndex(TextBox_编号.Text.Trim())) { MessageBoxCommon.Show("编号已存在"); return(false); } return(true); }
private void Button_Add_Click(object sender, RoutedEventArgs e) { if (vsy.ValidateRuning() == false) { MessageBoxCommon.Show("试用期已过,不能使用此功能!"); return; } if (CommonInfo.是否初始化年初数) { PA.View.Windows.Win_记账凭证 win = new PA.View.Windows.Win_记账凭证(); win.ShowDialog(); } else { MessageBoxCommon.Show("当前未初始化科目年初数,请设置!"); } }
private bool CheckData() { if (this.Label_借方合计.Content.ToString() != this.Label_贷方合计.Content.ToString()) { MessageBoxCommon.Show("借贷不平衡"); return(false); } List <string> VoucherNum = new List <string>(); for (int i = 0; i < PageAll; i++) { if (VoucherDetails[i * 6].凭证号 == "") { MessageBoxCommon.Show("凭证号不能为空"); return(false); } else { if (!VoucherNum.Contains(VoucherDetails[i * 6].凭证号)) { VoucherNum.Add(VoucherDetails[i * 6].凭证号); } else { MessageBoxCommon.Show("凭证号不能相同"); return(false); } if (!vmp.IsVOUCHER_NOExist(VoucherDetails[i * 6].凭证号) && isNew) { MessageBoxCommon.Show("凭证号已存在,请勿重复添加!"); return(false); } } } int temp; if (!int.TryParse(this.TextBox_附属单证.Text.Trim(), out temp)) { MessageBoxCommon.Show("附属单证必须为数字"); return(false); } return(true); }
private void Button_科目明细Print_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBox_一级科目.Text)) { MessageBoxCommon.Show("请选择一级科目"); TextBox_一级科目.Focus(); return; } else if (string.IsNullOrEmpty(TextBox_二级科目.Text)) { MessageBoxCommon.Show("请选择二级科目"); TextBox_二级科目.Focus(); return; } if (new PA.Helper.ExcelHelper.ExcelWriter().ExportSubjectDetails(TextBox_一级科目.Text, TextBox_二级科目.Text) != "") { MessageBoxCommon.Show("打印失败,请检查数据。"); } }