private void subjectToKis() { if (this.client == null) { MessageBox.Show("请选择客户信息!"); return; } if (this.kisDbFileParams == null || this.kisDbFileParams.DbFilePath == null) { MessageBox.Show("请选择数据库文件!"); return; } if (this.clientSubjects == null || this.clientSubjects.Count <= 0) { MessageBox.Show("没有需要导入KIS的新科目"); return; } KisDbFileFactory kisDbFileFactory = new KisDbFileFactory(this.kisDbFileParams); KisDbPref kisDbPref = kisDbFileFactory.getGLPref(); try { //检查当前客户与账套信息是否一致 if (kisDbPref.Fcompany != this.client.Fullname && kisDbPref.Fcompany != this.client.Name) { DialogResult dr = MessageBox.Show("选择的客户与账套名称不一致,是否继续导入?", "系统提示", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK) { return; } } kisDbFileFactory.exportSubject2Kis(this.clientSubjects); //引用工厂里导入新科目的方法 ClientSubjectFactory csf = new ClientSubjectFactory(); csf.updateIsNew(this.clientSubjects, 0); //引用新科目导入数据库后更新sinew和audit的状态 this.queryClientNewSubject(this.client.Id); //显示当前客户新会计科目的方法 MessageBox.Show("导入新科目到KIS成功,请打开财务系统查看!"); } catch (Exception e1) { MessageBox.Show("导入新科目到KIS错误!" + e1.Message); } }
private void testConnectButton_Click(object sender, EventArgs e) { if (this.kisDbFileParams == null || this.kisDbFileParams.DbFilePath == null || this.kisDbFileParams.DbFilePath == "") { MessageBox.Show("请选择数据库文件!"); return; } KisDbFileFactory kisDbFileFactory = new KisDbFileFactory(this.kisDbFileParams); try { kisDbFileFactory.testConnect(); MessageBox.Show("连接数据库成功!"); } catch (Exception e1) { MessageBox.Show("连接数据库错误!" + e1.Message); } }
private void initSubject() { if (this.client == null) { MessageBox.Show("请先选择客户信息!"); return; } if (this.kisDbFileParams == null) { MessageBox.Show("请先选择数据库文件!"); return; } KisDbFileFactory kisDbFileFactory = new KisDbFileFactory(this.kisDbFileParams); KisDbPref kisDbPref = kisDbFileFactory.getGLPref(); try { if (kisDbPref.Fcompany != this.client.Fullname && kisDbPref.Fcompany != this.client.Name) { DialogResult dr = MessageBox.Show("选择的客户与账套名称不一致,是否继续初始化?", "系统提示", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK) { return; } } this.InformationTextBox.Visible = true; //打开提示框 this.InformationTextBox.Text = "正在初始化会计科目!请稍等……"; //提示文本 this.InformationTextBox.Font = new Font("宋体", 12); //提示字体 kisDbFileFactory.initSubject(this.client, this.user); //引用工厂里初始化科目的方法 this.InformationTextBox.Visible = false; //关闭提示框 MessageBox.Show("初始化科目完成,请登录小微服查看!"); } catch (Exception e1) { this.InformationTextBox.Visible = false;//关闭提示框 MessageBox.Show("初始化科目失败" + e1.Message); } }
private void exports(string categoryname) { if (this.inst == null || this.inst.Id == null) { MessageBox.Show("无法获取当前机构信息!"); return; } if (this.user == null || this.user.Id == null) { MessageBox.Show("无法获取当前用户信息!"); } if (this.client == null || this.client.Id == null) { MessageBox.Show("请先选择客户信息!"); return; } if (this.accountcycle == null || this.accountcycle.Id == null) { MessageBox.Show("请先选择月份!"); return; } if (this.kisDbFileParams == null || this.kisDbFileParams.DbFilePath == null) { MessageBox.Show("请先选择KIS账套文件!"); return; } try { KisDbFileFactory kisDbFileFactory = new KisDbFileFactory(this.kisDbFileParams); KisDbPref kisDbPref = kisDbFileFactory.getGLPref(); //检查当前客户与账套信息是否一致 if (kisDbPref.Fcompany != this.client.Fullname && kisDbPref.Fcompany != this.client.Name) { DialogResult dr = MessageBox.Show("选择的客户与账套名称不一致,是否继续导入?", "系统提示", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK) { return; } } //执行导出凭证到KIS this.InformationTextBox.Visible = true; //打开提示框 this.InformationTextBox.Text = "正在导出凭证!请稍等……"; //提示文本 this.InformationTextBox.Font = new Font("宋体", 12); //提示字体 //按钮状态变成不能点击 this.exportIncomeButton.Enabled = false; this.exportOutputButton.Enabled = false; this.bankbillExportbutton.Enabled = false; this.exportpayrollbutton.Enabled = false; this.localreporttaxbutton.Enabled = false; this.paytaxreportbutton.Enabled = false; if (this.InformationTextBox.Text != null || this.InformationTextBox.Text != "") { kisDbFileFactory.exportVoucher(vouchernumber, voucherword, vouchersummary, this.inst, this.client, this.accountcycle, this.user, categoryname); } this.InformationTextBox.Visible = false;//关闭提示框 //恢复按钮点击状态 this.exportIncomeButton.Enabled = true; this.exportOutputButton.Enabled = true; this.bankbillExportbutton.Enabled = true; this.exportpayrollbutton.Enabled = true; this.localreporttaxbutton.Enabled = true; this.paytaxreportbutton.Enabled = true; MessageBox.Show("导出凭证成功!请登录财务系统查看结果"); } catch (Exception e) { Console.WriteLine(e.StackTrace); this.InformationTextBox.Visible = false;//关闭提示框 MessageBox.Show(e.Message); //恢复按钮点击状态 this.exportIncomeButton.Enabled = true; this.exportOutputButton.Enabled = true; this.bankbillExportbutton.Enabled = true; this.exportpayrollbutton.Enabled = true; this.localreporttaxbutton.Enabled = true; this.paytaxreportbutton.Enabled = true; } }