// //选择月份end // //选择账套start // private void selectAccessButton_Click(object sender, EventArgs e) { if (this.dbIpTextBox.Text == "" || this.dbIpTextBox.Text == null) { MessageBox.Show("请输入账套服务器地址!"); } if (this.dbUserTextBox.Text == "" || this.dbUserTextBox.Text == null) { MessageBox.Show("请输入账套数据库用户名!"); } if (this.dbPasswordTextBox.Text == null) { this.dbPasswordTextBox.Text = ""; } YYT3Factory yYT3Factory = new YYT3Factory(); try { //引用工厂里连接数据库查找总账套的方法 List <YYT3accset> accsetList = yYT3Factory.queryAccset(this.dbUserTextBox.Text, this.dbPasswordTextBox.Text, this.dbIpTextBox.Text, "UFDATA_"); this.accset = CommonManager.selectAccset(accsetList);//弹出选择账套窗口 if (this.accset != null) { this.accsetNameTextBox.Text = this.accset.CAcc_Name + "[" + this.accset.DbName + "]";//账套显示栏赋值 } } catch (Exception e1) { Console.WriteLine(e1.StackTrace); MessageBox.Show(e1.Message); } }
private void exports(string categoryname) { ExportBean exportBean = new ExportBean(); if (this.inst == null || this.inst.Id == null) { MessageBox.Show("无法获取当前机构信息"); } if (this.client == null || this.client.Id == null) { MessageBox.Show("无法获取当前客户信息"); } if (this.accountcycle == null || this.accountcycle.Id == null) { MessageBox.Show("无法获取当前月份信息"); } if (this.user == null || this.user.Id == null) { MessageBox.Show("无法获取当前用户信息"); } if (this.accset == null) { MessageBox.Show("请选择账套信息"); } if (accset.CAcc_Name != client.Name && accset.CAcc_Name != client.Fullname) { DialogResult dr = MessageBox.Show("选择的客户与账套名称不一致,是否继续导入?", "系统提示", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK) { return; } } exportBean.Instid = this.inst.Id; exportBean.Clientid = this.client.Id; exportBean.Categoryname = categoryname; exportBean.Createby = this.user.Id; exportBean.Accountcyclesn = this.accountcycle.Sn; try { this.InformationTextBox.Text = "正在导出凭证,请稍等……"; this.InformationTextBox.Visible = true; this.InformationTextBox.Font = new Font("宋体", 12); if (this.InformationTextBox.Visible == true) { YYT3Factory yYT3Factory = new YYT3Factory(); yYT3Factory.exports(exportBean, this.accset, this.inst, this.client, this.user, this.accountcycle, categoryname); } this.InformationTextBox.Visible = false; MessageBox.Show("凭证导出成功!请登录财务系统查看结果!"); } catch (Exception e) { this.InformationTextBox.Visible = false; Console.WriteLine(e.StackTrace); MessageBox.Show(e.Message); } }
//创建连接测试 private void connectText() { if (this.accset == null) { MessageBox.Show("请先选择账套!"); } try { YYT3Factory yYT3Factory = new YYT3Factory(); yYT3Factory.connectTest(this.accset);//引用Factory工厂里测试连接的方法 MessageBox.Show("连接成功"); } catch (Exception e) { MessageBox.Show(e.Message); } }
// //凭证导出end // //客户初始化start // private void initSubjectToolStripMenuItem_Click(object sender, EventArgs e) { if (this.accset == null) { MessageBox.Show("请先选择账套!"); return; } if (this.client == null) { MessageBox.Show("请先选择客户!"); return; } if (accset.CAcc_Name != client.Name && accset.CAcc_Name != client.Fullname) { DialogResult dr = MessageBox.Show("选择的客户与账套名称不一致,是否继续初始化?", "系统提示", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK) { return; } } try { this.InformationTextBox.Visible = true; //打开提示框 this.InformationTextBox.Text = "正在初始化会计科目!请稍等……"; //提示文本 this.InformationTextBox.Font = new Font("宋体", 12); //提示字体 YYT3Factory yYT3Factory = new YYT3Factory(); yYT3Factory.initSubjectByYYT3(this.accset, this.client, Session.GetInstance().User); this.InformationTextBox.Visible = false;//关闭提示框 MessageBox.Show("初始化成功,请打开小微服查看!"); } catch (Exception e1) { Console.WriteLine(e1.StackTrace); this.InformationTextBox.Visible = false;//关闭提示框 MessageBox.Show(e1.Message); } }
private void exportSubject() { ExportBean exporBean = new ExportBean(); if (this.inst == null || this.inst.Id == null) { MessageBox.Show("无法获取当前机构信息!"); return; } if (this.user == null || this.user.Id == null) { MessageBox.Show("无法获取当前用户信息!"); return; } if (this.client == null || this.client.Id == null) { MessageBox.Show("请选择客户信息!"); return; } if (this.accountcycle == null || this.accountcycle.Sn == null) { MessageBox.Show("请选择月份!"); return; } if (this.accset == null) { MessageBox.Show("请选择账套!"); return; } if (this.clientSubjects == null || this.clientSubjects.Count <= 0) { MessageBox.Show("没有需要导入用友T3的新科目"); return; } if (this.accset.CAcc_Name != this.client.Fullname && this.accset.CAcc_Name != this.client.Name) { DialogResult dr = MessageBox.Show("选择的客户与账套名称不一致,是否继续导入?", "系统提示", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK) { return; } } exporBean.Instid = this.inst.Id; exporBean.Clientid = this.client.Id; exporBean.Accountcyclesn = this.accountcycle.Sn; exporBean.Createby = this.user.Id; try { YYT3Factory yYT3Factory = new YYT3Factory(); yYT3Factory.exportSubject(exporBean, this.accset); ClientSubjectFactory csf = new ClientSubjectFactory(); csf.updateIsNew(this.clientSubjects, 0); this.queryClientNewSubject(this.client.Id); MessageBox.Show("新科目导出成功!请登录财务系统查看结果!"); } catch (Exception e) { MessageBox.Show(e.Message); } }