Example #1
0
        private void toolNew_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                frmSingleSelect frmsingle = new frmSingleSelect();
                frmsingle.InitData("请选择记帐凭证类别", "一般凭证,销售凭证,设计加工凭证,采购凭证,仓库进出,费用登记,收款凭证,付款凭证,其它应收凭证,其它应付凭证,生产凭证,支票承兑,固定资产增加,固定资产处理,固定资产评估,资产折旧,零库清理,价格调整,利润分配", ComboBoxStyle.DropDownList);
                if (frmsingle.ShowDialog() == DialogResult.OK)
                {
                    frmSelectGrid       frmsel = new frmSelectGrid();
                    EditAccCredenceList frm    = new EditAccCredenceList();
                    switch (Util.retValue1)
                    {
                    case "销售凭证":
                        dalSalesShipment dalss = new dalSalesShipment();
                        BindingCollection <modSalesShipment> listss = dalss.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listss != null && listss.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listss);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "设计加工凭证":
                        dalSalesDesignForm dalsd = new dalSalesDesignForm();
                        BindingCollection <modSalesDesignForm> listsd = dalsd.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listsd != null && listsd.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listsd);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "采购凭证":
                        dalPurchaseList dalpc = new dalPurchaseList();
                        BindingCollection <modPurchaseList> listpc = dalpc.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listpc != null && listpc.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listpc);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "费用登记":
                        dalAccExpenseForm dalexp = new dalAccExpenseForm();
                        BindingCollection <modAccExpenseForm> listexp = dalexp.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listexp != null && listexp.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listexp);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "收款凭证":
                        dalAccReceivableForm dalrec = new dalAccReceivableForm();
                        BindingCollection <modAccReceivableForm> listrec = dalrec.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listrec != null && listrec.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listrec);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "付款凭证":
                        dalAccPayableForm dalpay = new dalAccPayableForm();
                        BindingCollection <modAccPayableForm> listpay = dalpay.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listpay != null && listpay.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listpay);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "其它应收凭证":
                        dalAccOtherReceivableForm dalorec = new dalAccOtherReceivableForm();
                        BindingCollection <modAccOtherReceivableForm> listorec = dalorec.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listorec != null && listorec.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listorec);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "其它应付凭证":
                        dalAccOtherPayableForm dalopay = new dalAccOtherPayableForm();
                        BindingCollection <modAccOtherPayableForm> listopay = dalopay.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listopay != null && listopay.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listopay);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "仓库进出":
                        dalWarehouseInoutForm dalio = new dalWarehouseInoutForm();
                        BindingCollection <modWarehouseInoutForm> listio = dalio.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listio != null && listio.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listio);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "生产凭证":
                        dalProductionForm dalpdt = new dalProductionForm();
                        BindingCollection <modProductionForm> listpdt = dalpdt.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listpdt != null && listpdt.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listpdt);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "支票承兑":
                        dalAccCheckForm dalcheck = new dalAccCheckForm();
                        BindingCollection <modAccCheckForm> listcheck = dalcheck.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listcheck != null && listcheck.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listcheck);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "固定资产增加":
                        dalAssetAdd dalassetadd = new dalAssetAdd();
                        BindingCollection <modAssetAdd> listassetadd = dalassetadd.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listassetadd != null && listassetadd.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listassetadd);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "固定资产处理":
                        dalAssetSale dalassetsale = new dalAssetSale();
                        BindingCollection <modAssetSale> listassetsale = dalassetsale.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listassetsale != null && listassetsale.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listassetsale);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "固定资产评估":
                        dalAssetEvaluate dalassetevaluate = new dalAssetEvaluate();
                        BindingCollection <modAssetEvaluate> listassetevaluate = dalassetevaluate.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listassetevaluate != null && listassetevaluate.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listassetevaluate);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "价格调整":
                        dalPriceAdjustForm dalpaf = new dalPriceAdjustForm();
                        BindingCollection <modPriceAdjustForm> listpaf = dalpaf.GetWaitCredenceList(Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg);
                        if (listpaf != null && listpaf.Count > 0)
                        {
                            frmsel.InitViewList(Util.retValue1, listpaf);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                if (frm.AddItem(Util.retValue1, frmSelectGrid.selectionlist))
                                {
                                    if (frm.ShowDialog() == DialogResult.OK)
                                    {
                                        LoadData();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Util.emsg))
                            {
                                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("没有找到相应的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        break;

                    case "零库清理":
                        if (frm.AddItem(Util.retValue1, string.Empty))
                        {
                            if (frm.ShowDialog() == DialogResult.OK)
                            {
                                LoadData();
                            }
                        }
                        break;

                    case "利润分配":
                        frm.AddItem(Util.retValue1, string.Empty);
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            LoadData();
                        }
                        break;

                    default:
                        frm.AddItem(Util.retValue1, string.Empty);
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            LoadData();
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }