예제 #1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            EditAccPeriodList frm = new EditAccPeriodList();

            frm.AddItem(txtUserId.Text.Trim());
            if (frm.ShowDialog() == DialogResult.OK)
            {
                FillControl.FillPeriodList(cboPeriodList);
            }
        }
예제 #2
0
        private void toolNew_Click(object sender, EventArgs e)
        {
            EditAccPeriodList frm = new EditAccPeriodList();

            frm.AddItem(Util.UserId);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                LoadData();
            }
        }
예제 #3
0
        private void toolEdit_Click(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }
            EditAccPeriodList frm = new EditAccPeriodList();

            frm.EditItem((modAccPeriodList)DBGrid.CurrentRow.DataBoundItem);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                LoadData();
            }
        }
예제 #4
0
파일: SYS_INIT.cs 프로젝트: 100009/hberp
        private void btnPost_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (MessageBox.Show("初始化前,您是否已备份好您的数据?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
                if (MessageBox.Show("初始化会清除系统中所有的单据及报表数据,您确定要继续数据吗?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }

                string sql = string.Empty;
                sql = "truncate table acc_credence_detail";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_credence_list";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_product_inout";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_check_form_detail";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_check_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "delete acc_check_list";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_other_payable";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_other_payable_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_other_receivable";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_other_receivable_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_payable_list";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_payable_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_receivable_list";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_receivable_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table acc_expense_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table warehouse_product_inout";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table production_form_material";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table production_form_ware";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table production_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table purchase_detail";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table purchase_list";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table sales_shipment_detail";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table sales_shipment";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table quotation_detail";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table quotation_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table warehouse_inout_form";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table asset_depre_list";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table asset_work_qty";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table asset_sale";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table asset_evaluate";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "delete asset_list";
                SqlHelper.ExecuteNonQuery(sql);
                sql = "truncate table asset_add";
                SqlHelper.ExecuteNonQuery(sql);

                if (rbClearCustomerList.Checked)
                {
                    sql = "delete customer_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearCustomerType.Checked)
                {
                    sql = "delete customer_type";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearVendorList.Checked)
                {
                    sql = "delete vendor_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearVendorType.Checked)
                {
                    sql = "delete vendor_type";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearProductList.Checked)
                {
                    sql = "delete product_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearProductType.Checked)
                {
                    sql = "delete product_type_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearUserList.Checked)
                {
                    sql = "delete sys_user_privilege where user_id!='SYSADMIN'";
                    SqlHelper.ExecuteNonQuery(sql);
                    sql = "delete sys_task_grant where role_id not in ('R001','SYSADMIN')";
                    SqlHelper.ExecuteNonQuery(sql);
                    sql = "delete sys_user_list where user_id!='SYSADMIN'";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearRoleList.Checked)
                {
                    sql = "delete sys_role_list where role_id!='R001'";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearEmployeeList.Checked)
                {
                    sql = "delete admin_employee_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearDeptList.Checked)
                {
                    sql = "delete admin_dept_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearDegreeList.Checked)
                {
                    sql = "delete admin_degree_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearDutyList.Checked)
                {
                    sql = "delete admin_duty_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }

                if (rbClearUnitList.Checked)
                {
                    sql = "delete unit_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearWarehouseList.Checked)
                {
                    sql = "delete warehouse_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearBankList.Checked)
                {
                    sql = "delete acc_bank_list";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearCurrencyList.Checked)
                {
                    sql = "delete acc_currency_list where owner_flag!=1";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearBankAccount.Checked)
                {
                    sql = "delete acc_bank_account where account_no!='现金'";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearCredenceWord.Checked)
                {
                    sql = "delete acc_credence_word";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearBalanceStyle.Checked)
                {
                    sql = "delete acc_balance_style";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearCheckType.Checked)
                {
                    sql = "delete acc_check_type";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearCommonDigest.Checked)
                {
                    sql = "delete acc_common_digest";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearDigestType.Checked)
                {
                    sql = "delete acc_common_digest_type";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearOtherReceivableObject.Checked)
                {
                    sql = "delete other_receivable_object";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                if (rbClearOtherPayableObject.Checked)
                {
                    sql = "delete other_payable_object";
                    SqlHelper.ExecuteNonQuery(sql);
                }
                sql = "delete acc_period_list";
                SqlHelper.ExecuteNonQuery(sql);
                MessageBox.Show("系统初始化完成,请您建一个新的财务区间,然后重启程序!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                EditAccPeriodList frm = new EditAccPeriodList();
                frm.AddItem(Util.UserId);
                frm.ShowDialog();
                frmLogin frmlogin = new frmLogin();
                frmlogin.ShowDialog();
                this.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
예제 #5
0
        private void toolBalance_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                Util.emsg   = string.Empty;
                dalAccReport dal = new dalAccReport();
                BindingCollection <modWaitingAuditList> list = dal.GetWaitingAuditList(Util.modperiod.AccName, Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                if (list != null && list.Count > 0)
                {
                    MessageBox.Show("您本月还有未完成单据,不能结算!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    frmViewList frmvl = new frmViewList();
                    frmvl.InitViewList(clsTranslate.TranslateString("Waiting Audit List"), list);
                    frmvl.ShowDialog();
                    return;
                }
                BindingCollection <modAccountBalance> list2 = dal.GetAccountBalance(Util.modperiod.AccName, Util.IsTrialBalance, out Util.emsg);
                if (list2 != null && list2.Count > 0)
                {
                    foreach (modAccountBalance mod in list2)
                    {
                        if (Math.Abs(mod.Differ) >= Convert.ToDecimal("0.5"))
                        {
                            MessageBox.Show("财务数据不平衡,请先联系程序员检查原因并修正错误!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            frmViewList frmvl = new frmViewList();
                            frmvl.InitViewList(clsTranslate.TranslateString("Account Balance"), list2);
                            frmvl.ShowDialog();
                            return;
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(Util.emsg))
                {
                    MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                EditAccCredenceList frm = new EditAccCredenceList();
                frm.AddItem("月末结算", string.Empty);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Util.IsTrialBalance = false;
                    LoadData();
                    EditAccPeriodList frmapl = new EditAccPeriodList();
                    frmapl.InitForm(Util.modperiod.EndDate.AddDays(1));
                    frmapl.AddItem(Util.UserId);
                    if (frmapl.ShowDialog() == DialogResult.OK)
                    {
                        Util.modperiod.LockFlag = 1;
                        dalAccAnalyzeProfit dalprofit = new dalAccAnalyzeProfit();
                        dalprofit.Generate(Util.modperiod.AccName, Util.IsTrialBalance, out Util.emsg);

                        dalAccAnalyzeSales dalsales = new dalAccAnalyzeSales();
                        dalsales.Generate(Util.modperiod.AccName, out Util.emsg);

                        dalAccAnalyzePurchase dalpur = new dalAccAnalyzePurchase();
                        dalpur.Generate(Util.modperiod.AccName, out Util.emsg);

                        dalAccAnalyzeWaste dalwaste = new dalAccAnalyzeWaste();
                        dalwaste.Generate(Util.modperiod.AccName, out Util.emsg);

                        dalAccAnalyzeProduct dalpdt = new dalAccAnalyzeProduct();
                        dalpdt.Generate(Util.modperiod.AccName, out Util.emsg);
                        Application.Exit();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }