Пример #1
0
        private void btnBrand_Click(object sender, EventArgs e)
        {
            frmSingleSelect frm = new frmSingleSelect();
            ArrayList       arr = _dal.GetBrandList(out Util.emsg);

            frm.InitData("请选择品牌:", arr, ComboBoxStyle.DropDown);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                txtBrand.Text = Util.retValue1;
            }
        }
Пример #2
0
        private void toolImport_Click(object sender, EventArgs e)
        {
            try
            {
                frmSelectGrid   frmsel = new frmSelectGrid();
                frmSingleSelect frms   = new frmSingleSelect();
                frms.InitData("请选择导入方式:", "客户订单,采购单", "客户订单", ComboBoxStyle.DropDownList);
                if (frms.ShowDialog() == DialogResult.OK)
                {
                    switch (Util.retValue1)
                    {
                    case "客户订单":
                        dalCustomerOrderList dalorder = new dalCustomerOrderList();
                        BindingCollection <modCustomerOrderList> listorder = dalorder.GetIList(false, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (listorder != null)
                        {
                            frmsel.InitViewList("请选择要导入的客户订单号:", listorder);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                EditSalesShipment frm = new EditSalesShipment();
                                frm.ImportItem(Util.retValue1, frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;

                    case "采购单":
                        dalPurchaseList dal = new dalPurchaseList();
                        BindingCollection <modPurchaseList> list = dal.GetIList(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (list != null)
                        {
                            frmsel.InitViewList("请选择要导入的采购单号:", list);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                EditSalesShipment frm = new EditSalesShipment();
                                frm.ImportItem(Util.retValue1, frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #3
0
        private void mnuNewVendorOrderList_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (DBGrid.CurrentRow == null)
                {
                    return;
                }

                string selectionlist = string.Empty;

                dalVendorList dalvendor = new dalVendorList();
                BindingCollection <modVendorList> listvendor = dalvendor.GetIList("1", string.Empty, out Util.emsg);
                if (listvendor != null)
                {
                    frmSingleSelect frm = new frmSingleSelect();
                    frm.InitViewList("请选择供应商", listvendor, "VendorName", "VendorName", ComboBoxStyle.DropDown);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        modVendorList modvendor = dalvendor.GetItem(Util.retValue1, out Util.emsg);
                        BindingCollection <modVendorOrderList> list = new BindingCollection <modVendorOrderList>();
                        if (DBGrid.SelectedRows.Count == 0)
                        {
                            modCustomerOrderList modco = (modCustomerOrderList)DBGrid.CurrentRow.DataBoundItem;
                            modVendorOrderList   mod   = new modVendorOrderList();
                            mod.Id          = 0;
                            mod.FormDate    = DateTime.Today;
                            mod.RequireDate = DateTime.Today;
                            //mod.VendorOrderNo = modco.CustOrderNo;
                            mod.Remark      = modco.CustName + ": " + modco.CustOrderNo;
                            mod.VendorName  = Util.retValue1;
                            mod.PayMethod   = string.Empty;
                            mod.PurchaseMan = Util.UserId;
                            mod.ProductId   = modco.ProductId;
                            mod.ProductName = modco.ProductName;
                            if (clsLxms.GetProductSizeFlag(mod.ProductId) == 0)
                            {
                                mod.Size = 1;
                            }
                            else
                            {
                                mod.Size = modco.Size;
                            }
                            mod.Currency   = modvendor.Currency;
                            mod.UnitNo     = modco.UnitNo;
                            mod.Qty        = modco.Qty;
                            mod.Price      = 0;
                            mod.UpdateUser = Util.UserId;
                            list.Add(mod);
                        }
                        else
                        {
                            for (int i = 0; i < DBGrid.SelectedRows.Count; i++)
                            {
                                if (DBGrid.SelectedRows[i].Visible)
                                {
                                    modCustomerOrderList modco = (modCustomerOrderList)DBGrid.SelectedRows[i].DataBoundItem;
                                    modVendorOrderList   mod   = new modVendorOrderList();
                                    mod.Id          = 0;
                                    mod.FormDate    = DateTime.Today;
                                    mod.RequireDate = DateTime.Today;
                                    //mod.VendorOrderNo = modco.CustOrderNo;
                                    mod.Remark      = modco.CustName + ": " + modco.CustOrderNo;
                                    mod.VendorName  = Util.retValue1;
                                    mod.PayMethod   = string.Empty;
                                    mod.PurchaseMan = Util.UserId;
                                    mod.ProductId   = modco.ProductId;
                                    mod.ProductName = modco.ProductName;
                                    if (clsLxms.GetProductSizeFlag(mod.ProductId) == 0)
                                    {
                                        mod.Size = 1;
                                    }
                                    else
                                    {
                                        mod.Size = modco.Size;
                                    }
                                    mod.Currency   = modvendor.Currency;
                                    mod.UnitNo     = modco.UnitNo;
                                    mod.Qty        = modco.Qty;
                                    mod.Price      = 0;
                                    mod.UpdateUser = Util.UserId;
                                    list.Add(mod);
                                }
                            }
                        }
                        VendorOrderImport frmImport = new VendorOrderImport();
                        frmImport.InitViewList(list);
                        frmImport.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #4
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;
            }
        }
Пример #5
0
        private void toolImport_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                frmSelectGrid   frmsel = new frmSelectGrid();
                frmSingleSelect frms   = new frmSingleSelect();
                frms.InitData("请选择导入方式:", "采购订单,客户订单,EXCEL", "采购订单", ComboBoxStyle.DropDownList);
                if (frms.ShowDialog() == DialogResult.OK)
                {
                    switch (Util.retValue1)
                    {
                    case "客户订单":
                        dalPurchaseList dalorder = new dalPurchaseList();
                        BindingCollection <modCustomerOrderList> listorder = dalorder.GetImportOrderData(DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (listorder != null)
                        {
                            frmsel.InitViewList("请选择要导入的客户订单号:", listorder);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                EditPurchaseList frm = new EditPurchaseList();
                                frm.ImportOrder(frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;

                    case "采购订单":
                        dalVendorOrderList dalpo = new dalVendorOrderList();
                        BindingCollection <modVendorOrderList> listpo = dalpo.GetIList(false, string.Empty, string.Empty, string.Empty, DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (listpo != null)
                        {
                            frmsel.InitViewList("请选择要导入的采购订单号:", listpo);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                EditPurchaseList frm = new EditPurchaseList();
                                frm.ImportPO(frmSelectGrid.selectionlist);
                                if (frm.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                        break;

                    case "EXCEL":
                        OpenFileDialog ofd       = new OpenFileDialog();
                        string         inifolder = clsLxms.GetParameterValue("PURCHASE_IMPORT_PATH");
                        if (Directory.Exists(inifolder))
                        {
                            ofd.InitialDirectory = clsLxms.GetParameterValue("PURCHASE_IMPORT_PATH");
                        }
                        else
                        {
                            ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        }
                        ofd.Multiselect      = true;      //允许同时选择多个文件
                        ofd.Filter           = "Excel文件|*.xls;*.xlsx";
                        ofd.RestoreDirectory = true;
                        ofd.FilterIndex      = 1;
                        if (ofd.ShowDialog() == DialogResult.OK)
                        {
                            string[]         files = ofd.FileNames;
                            EditPurchaseList frm   = new EditPurchaseList();
                            frm.Import(files);
                            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;
            }
        }
Пример #6
0
        private void toolExport_Click(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }

            frmSingleSelect frm = new frmSingleSelect();

            frm.InitData("请选择导出单据类别:", "购销合同,采购订单", "购销合同", ComboBoxStyle.DropDownList);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                IList <modExcelRangeData>             list       = new List <modExcelRangeData>();
                modPurchaseList                       mod        = (modPurchaseList)DBGrid.CurrentRow.DataBoundItem;
                BindingCollection <modPurchaseDetail> listdetail = _dal.GetDetail(mod.PurchaseId, out Util.emsg);

                switch (Util.retValue1)
                {
                case "采购订单":
                    dalVendorList dalv = new dalVendorList();
                    modVendorList modv = dalv.GetItem(mod.VendorName, out Util.emsg);
                    list.Add(new modExcelRangeData(clsLxms.GetParameterValue("COMPANY_NAME"), "A1", "I1"));
                    list.Add(new modExcelRangeData("电话:" + clsLxms.GetParameterValue("COMPANY_TEL") + "      传真:" + clsLxms.GetParameterValue("COMPANY_FAX"), "A2", "I2"));
                    list.Add(new modExcelRangeData(clsLxms.GetParameterValue("COMPANY_ADDR"), "A3", "I3"));
                    list.Add(new modExcelRangeData(modv.VendorName, "C6", "E6"));
                    list.Add(new modExcelRangeData(modv.Tel, "C7", "E7"));
                    list.Add(new modExcelRangeData(modv.Fax, "C8", "E8"));
                    list.Add(new modExcelRangeData(modv.Linkman, "C9", "E9"));
                    list.Add(new modExcelRangeData(modv.Addr, "C10", "E10"));

                    list.Add(new modExcelRangeData(mod.PurchaseNo, "G6", "I6"));
                    list.Add(new modExcelRangeData(mod.PurchaseDate.ToString("yyyy年MM月dd日"), "G7", "I7"));
                    list.Add(new modExcelRangeData(mod.UpdateUser, "G8", "I8"));
                    list.Add(new modExcelRangeData(mod.txtPayMethod, "G9", "I9"));
                    list.Add(new modExcelRangeData(mod.UpdateUser, "F38", "F38"));
                    for (int i = 0; i < listdetail.Count; i++)
                    {
                        modPurchaseDetail modd = listdetail[i];
                        string            col  = (13 + i).ToString().Trim();
                        list.Add(new modExcelRangeData((i + 1).ToString(), "A" + col, "A" + col));
                        list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "C" + col));
                        list.Add(new modExcelRangeData(modd.Brand, "D" + col, "D" + col));
                        list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                        list.Add(new modExcelRangeData(modd.Qty.ToString(), "F" + col, "F" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "G" + col, "G" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "H" + col, "H" + col));
                        list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));
                    }
                    clsExport.ExportByTemplate(list, "采购单", 1, 38, 9, 1);
                    break;

                case "购销合同":
                    list.Add(new modExcelRangeData(mod.VendorName, "B6", "E6"));
                    list.Add(new modExcelRangeData(mod.PurchaseNo, "I6", "I6"));
                    list.Add(new modExcelRangeData(mod.PurchaseDate.ToString("yyyy年MM月dd日"), "I7", "I7"));
                    list.Add(new modExcelRangeData("金额大写:" + clsMoney.ConvertToMoney(Convert.ToDouble(mod.DetailSum + mod.OtherMny - mod.KillMny)), "A23", "I23"));
                    list.Add(new modExcelRangeData(string.Format("{0:C2}", mod.DetailSum + mod.OtherMny - mod.KillMny), "H22", "H22"));

                    for (int i = 0; i < listdetail.Count; i++)
                    {
                        modPurchaseDetail modd = listdetail[i];
                        string            col  = (10 + i).ToString().Trim();
                        //list.Add(new modExcelRangeData((i+1).ToString(), "A" + col, "A" + col));
                        list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "B" + col));
                        list.Add(new modExcelRangeData(modd.Brand, "C" + col, "C" + col));
                        list.Add(new modExcelRangeData(modd.Qty.ToString(), "D" + col, "D" + col));
                        list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "G" + col, "G" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "H" + col, "H" + col));
                        list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));
                    }
                    clsExport.ExportByTemplate(list, "购销合同", 1, 41, 9, 1);
                    break;
                }
            }
        }
Пример #7
0
        private void toolImport_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                frmSingleSelect frm       = new frmSingleSelect();
                dalVendorList   dalvendor = new dalVendorList();
                BindingCollection <modVendorList> listvendor = dalvendor.GetIList("1", string.Empty, out Util.emsg);
                if (listvendor != null)
                {
                    frm.InitViewList("请选择供应商", listvendor, "VendorName", "VendorName", ComboBoxStyle.DropDown);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        modVendorList modvendor = dalvendor.GetItem(Util.retValue1, out Util.emsg);
                        frmSelectGrid frmsel    = new frmSelectGrid();

                        dalPurchaseList dalorder = new dalPurchaseList();
                        BindingCollection <modCustomerOrderList> listorder = dalorder.GetImportOrderData(DateTime.Today.AddDays(-30).ToString("MM-dd-yyyy"), string.Empty, out Util.emsg);
                        if (listorder != null)
                        {
                            frmsel.InitViewList("请选择要导入的客户订单号:", listorder);
                            if (frmsel.ShowDialog() == DialogResult.OK)
                            {
                                BindingCollection <modVendorOrderList> list = new BindingCollection <modVendorOrderList>();
                                dalCustomerOrderList dalco = new dalCustomerOrderList();
                                BindingCollection <modCustomerOrderList> listco = dalco.GetIList(frmSelectGrid.selectionlist, out Util.emsg);
                                foreach (modCustomerOrderList modco in listco)
                                {
                                    modVendorOrderList mod = new modVendorOrderList();
                                    mod.Id          = 0;
                                    mod.FormDate    = DateTime.Today;
                                    mod.RequireDate = DateTime.Today;
                                    //mod.VendorOrderNo = modco.CustOrderNo;
                                    mod.Remark      = modco.CustName + ": " + modco.CustOrderNo;
                                    mod.VendorName  = Util.retValue1;
                                    mod.PayMethod   = string.Empty;
                                    mod.PurchaseMan = Util.UserId;
                                    mod.ProductId   = modco.ProductId;
                                    mod.ProductName = modco.ProductName;
                                    if (clsLxms.GetProductSizeFlag(mod.ProductId) == 0)
                                    {
                                        mod.Size = 1;
                                    }
                                    else
                                    {
                                        mod.Size = modco.Size;
                                    }
                                    mod.Currency   = modvendor.Currency;
                                    mod.UnitNo     = modco.UnitNo;
                                    mod.Qty        = modco.Qty;
                                    mod.Price      = 0;
                                    mod.UpdateUser = Util.UserId;
                                    list.Add(mod);
                                }
                                VendorOrderImport frmImport = new VendorOrderImport();
                                frmImport.InitViewList(list);
                                if (frmImport.ShowDialog() == DialogResult.OK)
                                {
                                    LoadData();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #8
0
        private void toolExport_Click(object sender, EventArgs e)
        {
            if (DBGrid.CurrentRow == null)
            {
                return;
            }
            frmSingleSelect frm = new frmSingleSelect();

            frm.InitData("请选择导出单据类别:", "送货单,购销合同", "送货单", ComboBoxStyle.DropDownList);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                IList <modExcelRangeData> list = new List <modExcelRangeData>();
                modSalesShipment          mod  = (modSalesShipment)DBGrid.CurrentRow.DataBoundItem;
                BindingCollection <modSalesShipmentDetail> listdetail = _dal.GetDetail(mod.ShipId, out Util.emsg);
                dalCustomerList dalcust = new dalCustomerList();
                modCustomerList modcust = dalcust.GetItem(mod.CustId, out Util.emsg);
                switch (Util.retValue1)
                {
                case "送货单":
                case "收营单":
                    string company = clsLxms.GetParameterValue("COMPANY_NAME");
                    switch (company)
                    {
                    case "深圳市蓝图净化用品有限公司":
                        list.Add(new modExcelRangeData("№ " + mod.ShipNo, "H6", "I6"));
                        list.Add(new modExcelRangeData(modcust.FullName, "C7", "E7"));
                        list.Add(new modExcelRangeData(modcust.Tel, "G7", "I7"));
                        list.Add(new modExcelRangeData(modcust.Linkman, "C8", "E8"));
                        list.Add(new modExcelRangeData(modcust.Fax, "G8", "I8"));
                        list.Add(new modExcelRangeData(mod.ShipAddr, "C9", "I9"));

                        list.Add(new modExcelRangeData(mod.CustOrderNo, "A13", "C13"));
                        list.Add(new modExcelRangeData(modcust.PayMethod, "D13", "E13"));
                        dalAdminEmployeeList dalemp = new dalAdminEmployeeList();
                        modAdminEmployeeList modemp = dalemp.GetItem(mod.SalesMan, out Util.emsg);
                        if (modemp != null)
                        {
                            list.Add(new modExcelRangeData(modemp.EmployeeName, "F13", "F13"));
                        }
                        else
                        {
                            list.Add(new modExcelRangeData(mod.SalesMan, "F13", "F13"));
                        }
                        list.Add(new modExcelRangeData(mod.ShipDate.ToString("yyyy年MM月dd日"), "G13", "G13"));

                        for (int i = 0; i < listdetail.Count; i++)
                        {
                            modSalesShipmentDetail modd = listdetail[i];
                            string col = (17 + i).ToString().Trim();
                            list.Add(new modExcelRangeData((i + 1).ToString(), "A" + col, "A" + col));
                            list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "C" + col));
                            list.Add(new modExcelRangeData(modd.Specify, "D" + col, "D" + col));
                            list.Add(new modExcelRangeData(modd.Qty.ToString(), "E" + col, "E" + col));
                            list.Add(new modExcelRangeData(modd.UnitNo, "F" + col, "F" + col));
                            list.Add(new modExcelRangeData(modd.Price.ToString("#,##0.00"), "G" + col, "G" + col));
                            list.Add(new modExcelRangeData((modd.Qty * modd.Price).ToString("#,##0.00"), "H" + col, "H" + col));
                            list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));
                        }
                        clsExport.ExportByTemplate(list, "蓝图送货单", 1, 24, 10, 1);
                        break;

                    default:
                        list.Add(new modExcelRangeData(clsLxms.GetParameterValue("COMPANY_NAME"), "A1", "L1"));
                        list.Add(new modExcelRangeData("TEL:" + clsLxms.GetParameterValue("COMPANY_TEL") + "  Fax:" + clsLxms.GetParameterValue("COMPANY_FAX"), "A2", "L2"));
                        list.Add(new modExcelRangeData("公司地址:" + clsLxms.GetParameterValue("COMPANY_ADDR"), "A3", "L3"));
                        if (mod.InvoiceStatus >= 1)
                        {
                            list.Add(new modExcelRangeData("S", "L4", "L4"));
                        }
                        list.Add(new modExcelRangeData(mod.ShipType, "E4", "I5"));
                        list.Add(new modExcelRangeData(mod.CustOrderNo, "C4", "D4"));
                        list.Add(new modExcelRangeData(modcust.FullName, "C5", "D5"));
                        list.Add(new modExcelRangeData(mod.ShipAddr, "C6", "D6"));
                        list.Add(new modExcelRangeData(modcust.Linkman + " " + modcust.Tel, "K4", "K4"));
                        list.Add(new modExcelRangeData(mod.ShipNo, "K5", "K5"));
                        list.Add(new modExcelRangeData(mod.ShipDate.ToString("yyyy年MM月dd日"), "K6", "K6"));
                        list.Add(new modExcelRangeData("合计金额:" + clsMoney.ConvertToMoney(Convert.ToDouble(mod.DetailSum + mod.OtherMny - mod.KillMny)), "A16", "I17"));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", mod.DetailSum + mod.OtherMny - mod.KillMny), "J16", "K16"));
                        list.Add(new modExcelRangeData("付款方式:" + mod.PayMethod, "J17", "K17"));
                        list.Add(new modExcelRangeData(Util.UserName, "K20", "K20"));

                        for (int i = 0; i < listdetail.Count; i++)
                        {
                            modSalesShipmentDetail modd = listdetail[i];
                            string col = (8 + i).ToString().Trim();
                            list.Add(new modExcelRangeData((i + 1).ToString(), "A" + col, "A" + col));
                            list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "D" + col));
                            list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                            list.Add(new modExcelRangeData(modd.Qty.ToString(), "F" + col, "G" + col));
                            list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "H" + col, "I" + col));
                            list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "J" + col, "J" + col));
                            list.Add(new modExcelRangeData(modd.Remark, "K" + col, "K" + col));
                        }
                        clsExport.ExportByTemplate(list, "送货单", 1, 20, 11, 1);
                        break;
                    }
                    break;

                case "购销合同":
                    list.Add(new modExcelRangeData(modcust.FullName, "B6", "E6"));
                    list.Add(new modExcelRangeData(mod.ShipNo, "I6", "I6"));
                    list.Add(new modExcelRangeData(mod.ShipDate.ToString("yyyy年MM月dd日"), "I7", "I7"));
                    list.Add(new modExcelRangeData("金额大写:" + clsMoney.ConvertToMoney(Convert.ToDouble(mod.DetailSum + mod.OtherMny - mod.KillMny)), "A23", "I23"));
                    list.Add(new modExcelRangeData(string.Format("{0:C2}", mod.DetailSum + mod.OtherMny - mod.KillMny), "H22", "H22"));

                    dalProductList dalpdt = new dalProductList();
                    for (int i = 0; i < listdetail.Count; i++)
                    {
                        modSalesShipmentDetail modd = listdetail[i];
                        string col = (10 + i).ToString().Trim();
                        //list.Add(new modExcelRangeData((i+1).ToString(), "A" + col, "A" + col));
                        list.Add(new modExcelRangeData(modd.ProductName, "B" + col, "B" + col));
                        modProductList modpdt = dalpdt.GetItem(modd.ProductId, out Util.emsg);
                        if (modpdt != null)
                        {
                            list.Add(new modExcelRangeData(modpdt.Brand, "C" + col, "C" + col));
                        }
                        list.Add(new modExcelRangeData(modd.Qty.ToString(), "D" + col, "D" + col));
                        list.Add(new modExcelRangeData(modd.UnitNo, "E" + col, "E" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Price), "G" + col, "G" + col));
                        list.Add(new modExcelRangeData(string.Format("{0:C2}", modd.Qty * modd.Price), "H" + col, "H" + col));
                        list.Add(new modExcelRangeData(modd.Remark, "I" + col, "I" + col));
                    }
                    clsExport.ExportByTemplate(list, "购销合同", 1, 38, 9, 1);
                    break;
                }
            }
        }