コード例 #1
0
ファイル: ACC_CREDENCE_LIST.cs プロジェクト: 100009/hberp
 private void toolEdit_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (DBGrid.CurrentRow == null)
         {
             return;
         }
         modAccCredenceList  mod = (modAccCredenceList)DBGrid.CurrentRow.DataBoundItem;
         EditAccCredenceList frm = new EditAccCredenceList();
         frm.EditItem(mod.AccName, mod.AccSeq);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             LoadData();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
コード例 #2
0
ファイル: ACC_CREDENCE_LIST.cs プロジェクト: 100009/hberp
        private void DBGrid_SelectionChanged(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }
            modAccCredenceList mod = (modAccCredenceList)DBGrid.CurrentRow.DataBoundItem;

            if (mod.Status == 0)
            {
                toolDel.Enabled   = true;
                toolAudit.Enabled = true;
                toolReset.Enabled = false;
            }
            else
            {
                toolDel.Enabled   = false;
                toolAudit.Enabled = false;
                toolReset.Enabled = true;
            }
        }
コード例 #3
0
ファイル: ACC_CREDENCE_LIST.cs プロジェクト: 100009/hberp
        private void toolExport_Click(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }
            IList <modExcelRangeData> list = new List <modExcelRangeData>();
            modAccCredenceList        mod  = (modAccCredenceList)DBGrid.CurrentRow.DataBoundItem;

            list.Add(new modExcelRangeData("单据共 " + mod.AttachCount.ToString() + " 张", "A3", "A3"));
            list.Add(new modExcelRangeData(mod.CredenceDate.ToString("yyyy年MM月dd日"), "B3", "C3"));
            list.Add(new modExcelRangeData("总 字第 " + mod.AccSeq.ToString().Trim() + " 号", "E3", "E3"));
            decimal borrowsum = 0;
            decimal lendsum   = 0;
            BindingCollection <modAccCredenceDetail> listdetail = _dal.GetCredenceDetail(mod.AccName, mod.AccSeq, Util.IsTrialBalance, out Util.emsg);

            for (int i = 0; i < listdetail.Count; i++)
            {
                modAccCredenceDetail modd = listdetail[i];
                string col = (6 + i).ToString().Trim();
                list.Add(new modExcelRangeData(modd.Digest, "A" + col, "A" + col));
                list.Add(new modExcelRangeData(modd.SubjectName, "B" + col, "B" + col));
                list.Add(new modExcelRangeData(modd.DetailId, "C" + col, "C" + col));
                if (modd.BorrowMoney != 0)
                {
                    list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.BorrowMoney), "D" + col, "D" + col));
                    borrowsum += modd.BorrowMoney;
                }
                if (modd.LendMoney != 0)
                {
                    list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.LendMoney), "E" + col, "E" + col));
                    lendsum += modd.LendMoney;
                }
            }
            list.Add(new modExcelRangeData(string.Format("{0:C2}", borrowsum), "D14", "D14"));
            list.Add(new modExcelRangeData(string.Format("{0:C2}", lendsum), "E14", "E14"));
            list.Add(new modExcelRangeData(mod.UpdateUser, "D16", "D16"));
            clsExport.ExportByTemplate(list, "记帐凭证", 1, 16, 6, 1);
        }
コード例 #4
0
ファイル: ACC_CREDENCE_LIST.cs プロジェクト: 100009/hberp
 private void toolDel_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (DBGrid.CurrentRow == null)
         {
             return;
         }
         if (MessageBox.Show(clsTranslate.TranslateString("Do you really want to delete it?"), clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             return;
         }
         modAccCredenceList mod = _dal.GetItem(DBGrid.CurrentRow.Cells[0].Value.ToString(), Convert.ToInt32(DBGrid.CurrentRow.Cells[1].Value), false, out Util.emsg);
         if (mod.Status == 1)
         {
             MessageBox.Show("该凭证已审核,您不能删除!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         bool ret = _dal.Save("DEL", mod, null, string.Empty, null, out Util.emsg);
         if (ret)
         {
             LoadData();
         }
         else
         {
             MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
コード例 #5
0
ファイル: ACC_CREDENCE_LIST.cs プロジェクト: 100009/hberp
        private void toolReset_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (DBGrid.RowCount == 0)
                {
                    return;
                }
                if (DBGrid.SelectedRows.Count == 0 && DBGrid.CurrentRow == null)
                {
                    return;
                }
                if (MessageBox.Show(clsTranslate.TranslateString("Do you really want to reset it?"), clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                if (DBGrid.SelectedRows.Count == 0)
                {
                    modAccCredenceList mod = _dal.GetItem(DBGrid.CurrentRow.Cells[0].Value.ToString(), Convert.ToInt32(DBGrid.CurrentRow.Cells[1].Value), false, out Util.emsg);
                    if (mod.Status == 1 && _dal.Reset(mod.AccName, mod.AccSeq, Util.UserId, out Util.emsg))
                    {
                        MessageBox.Show(clsTranslate.TranslateString("Reset Success!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DBGrid.CurrentRow.Cells["status"].Value      = 0;
                        DBGrid.CurrentRow.DefaultCellStyle.ForeColor = Color.Black;
                        DBGrid.CurrentRow.Selected = false;
                    }
                    else
                    {
                        MessageBox.Show(clsTranslate.TranslateString(Util.emsg), mod.AccSeq.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }
                else
                {
                    for (int i = DBGrid.SelectedRows.Count - 1; i >= 0; i--)
                    {
                        modAccCredenceList mod = _dal.GetItem(DBGrid.SelectedRows[i].Cells[0].Value.ToString(), Convert.ToInt32(DBGrid.SelectedRows[i].Cells[1].Value), false, out Util.emsg);
                        if (mod.Status == 1 && _dal.Reset(mod.AccName, mod.AccSeq, Util.UserId, out Util.emsg))
                        {
                            DBGrid.SelectedRows[i].Cells["status"].Value      = 0;
                            DBGrid.SelectedRows[i].DefaultCellStyle.ForeColor = Color.Black;
                            DBGrid.SelectedRows[i].Selected = false;
                        }
                        else
                        {
                            MessageBox.Show(clsTranslate.TranslateString(Util.emsg), mod.AccSeq.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                    }
                }
                toolDel.Enabled   = true;
                toolAudit.Enabled = true;
                toolReset.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }