Пример #1
0
        //public static void 自动凭证应付对账单生成费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<业务费用> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager
        //        as IControlManager<业务费用>;

        //    IList<费用> list = new List<费用>();
        //    foreach (业务费用 item in detailCm.DisplayManagerT.Entities)
        //    {
        //        list.Add(item.Clone() as 业务费用);
        //    }

        //    ArchiveOperationForm masterFormKj = TabbedMdiForm.ShowMenuFormInMdi("凭证_会计付款") as ArchiveOperationForm;
        //    if (masterFormKj != null)
        //    {
        //        if (masterFormKj.DoAdd())
        //        {
        //            IControlManager<凭证费用明细> detailCmKj = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //            IBaseDao masterDao = ((IArchiveGrid)masterFormKj.ActiveGrid).Bll as IBaseDao;
        //            MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
        //            MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

        //            (masterFormKj.DisplayManager.CurrentItem as 凭证).自动手工标志 = 自动手工标志.对账单;

        //            process_pz.AddFees(masterFormKj.DisplayManager.CurrentItem as 凭证, list, detailCmKj, memoryBll, memoryBll2);
        //            //frm_cw_fkpz_kj_detail detailFormTo = form.ArchiveDetailForm as frm_cw_fkpz_kj_detail;

        //            detailCmKj.DisplayManager.DataControls["金额.数额"].SelectedDataValue = detailForm.ControlManager.DisplayManager.DataControls["凭证金额"].SelectedDataValue;
        //            detailCmKj.DisplayManager.DataControls["金额.币制编号"].SelectedDataValue = detailForm.ControlManager.DisplayManager.DataControls["凭证币制编号"].SelectedDataValue;
        //        }
        //    }
        //}

        public static void  择应付对账单费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue == null)
            {
                MessageForm.ShowError("请先填写相关人编号!");
                return;
            }
            masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].ReadOnly = true;
            EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "相关人编号", masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue);

            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict["相关人编号"] = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue;
            ArchiveCheckForm form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_应付对账单_费用", dict);

            if (form != null)
            {
                IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

                using (var rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>())
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        业务费用 item = i as 业务费用;
                        item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单;
                        detailCm.AddNew();
                        detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                        detailCm.EndEdit();
                    }
                }
            }
        }
Пример #2
0
        public static void  择出口应收对账单费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue == null)
            {
                MessageForm.ShowError("请先填写费用项编号!");
                return;
            }
            if (masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue == null)
            {
                MessageForm.ShowError("请先填写相关人编号!");
                return;
            }

            masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].ReadOnly = true;
            masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].ReadOnly = true;
            EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "费用项编号", masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue);
            EntityScript.SetPropertyValue(masterForm.DisplayManager.CurrentItem, "相关人编号", masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue);

            string           type = (string)masterForm.ControlManager.DisplayManager.DataControls["费用项编号"].SelectedDataValue;
            ArchiveCheckForm form = null;

            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict["相关人编号"] = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue;
            if (type == "000")  // 常规
            {
                form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_出口_应收对账单_常规费用", dict);
            }
            else if (type == "001") // 额外
            {
                form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_出口_应收对账单_额外费用", dict);
            }

            if (form != null)
            {
                IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

                foreach (object i in form.SelectedEntites)
                {
                    业务费用 item = i as 业务费用;
                    item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单;
                    detailCm.AddNew();
                    detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                    detailCm.EndEdit();
                }
            }
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dm"></param>
        /// <param name="checkForm"></param>
        /// <param name="presetValues"></param>
        /// <returns></returns>
        public static ArchiveCheckForm Execute(IDisplayManager dm, ArchiveCheckForm checkForm, Dictionary <string, object> presetValues)
        {
            if (presetValues != null)
            {
                foreach (KeyValuePair <string, object> kvp in presetValues)
                {
                    if (kvp.Value == null)
                    {
                        MessageForm.ShowError("请先填写" + kvp.Key + "!");
                        return(null);
                    }
                }

                ISearchManager smc = checkForm.DisplayManager.SearchManager;
                if (smc != null)
                {
                    foreach (KeyValuePair <string, object> kvp in presetValues)
                    {
                        smc.SearchControls[kvp.Key].SelectedDataValues = new System.Collections.ArrayList {
                            kvp.Value
                        };
                    }
                }
            }

            DialogResult ret = checkForm.ShowDialog();

            if (ret == DialogResult.OK)
            {
                if (presetValues != null)
                {
                    foreach (KeyValuePair <string, object> kvp in presetValues)
                    {
                        dm.DataControls[kvp.Key].ReadOnly = true;

                        // save controlValue to entity
                        EntityScript.SetPropertyValue(dm.CurrentItem, kvp.Key,
                                                      dm.DataControls[kvp.Key].SelectedDataValue);
                    }
                }

                //IControlManager detailCm = ((ArchiveDetailFormAutoWithDetailGrid)detailForm).DetailGrid.ControlManager;
                return(checkForm);
            }

            return(null);
        }
Пример #4
0
        public static void 添加现有车辆管理费用(ArchiveOperationForm masterForm)
        {
            IControlManager <凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>;

            ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_会计凭证_车辆管理费用")) as ArchiveCheckForm;

            if (form.ShowDialog() == DialogResult.OK)
            {
                IList <费用> list = new List <费用>();
                foreach (object i in form.SelectedEntites)
                {
                    list.Add(i as 费用);
                }

                Hd.Service.process_pz.AddFees(masterForm.DisplayManager.CurrentItem as 凭证, list, detailCm);
            }
        }
Пример #5
0
        public static void 批量添加进口箱费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口箱")) as ArchiveCheckForm;

            if (form != null && form.ShowDialog() == DialogResult.OK)
            {
                foreach (object i in form.SelectedEntites)
                {
                    业务费用 item = new 业务费用();
                    if (i is 普通箱)
                    {
                        普通箱 xiang = i as 普通箱;

                        // it must have piao
                        item.票 = xiang.GetType().InvokeMember("票",
                                                              BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, xiang, null) as 普通票;

                        item.箱    = (i == null ? null : xiang);
                        item.箱Id  = i == null ? null : (Guid?)xiang.ID;
                        item.费用实体 = new 普通票 {
                            ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号
                        };
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                    }

                    object entity = cm.AddNew();
                    if (entity != null)
                    {
                        cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                        cm.EndEdit();
                    }
                    else
                    {
                        // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }
        }
Пример #6
0
        public static void 添加现有非业务费用(ArchiveOperationForm masterForm)
        {
            IControlManager <凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>;
            //IDao masterDao = masterForm.ControlManager.Dao;
            //MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>;
            //MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

            ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_会计凭证_非业务费用")) as ArchiveCheckForm;

            if (form.ShowDialog() == DialogResult.OK)
            {
                IList <费用> list = new List <费用>();
                foreach (object i in form.SelectedEntites)
                {
                    list.Add(i as 费用);
                }

                AddFees(masterForm.DisplayManager.CurrentItem as 凭证, list, detailCm);
            }
        }
Пример #7
0
        public static void 批量添加进口费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口票")) as ArchiveCheckForm;

            if (form != null && form.ShowDialog() == DialogResult.OK)
            {
                foreach (object i in form.SelectedEntites)
                {
                    业务费用 item = new 业务费用();
                    if (i is 普通票)
                    {
                        item.票    = i as 普通票;
                        item.费用实体 = new 普通票 {
                            ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号
                        };
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                    }

                    object entity = cm.AddNew();
                    if (entity != null)
                    {
                        cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                        cm.EndEdit();
                    }
                    else
                    {
                        // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }
        }
Пример #8
0
        public static void 批量添加进口其他费用(ArchiveOperationForm masterForm)
        {
            int cnt = 0;
            ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口其他业务票")) as ArchiveCheckForm;

            if (form.ShowDialog() == DialogResult.OK)
            {
                foreach (object i in form.SelectedEntites)
                {
                    //普通票 entity = i as 普通票;
                    进口其他业务票 entity2 = i as 进口其他业务票;

                    using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <进口其他业务票>())
                    {
                        rep.Initialize(entity2.箱, entity2);

                        cnt += 批量生成费用(rep, 45, entity2, entity2.箱, null, null);
                    }
                }

                MessageForm.ShowInfo("已生成" + cnt + "条收款费用!");
            }
        }
Пример #9
0
        public static void 批量添加费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加非业务费用");

            if (selectForm.ShowDialog() == DialogResult.OK)
            {
                ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm;

                if (form != null && form.ShowDialog() == DialogResult.OK)
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        非业务费用 newItem = new 非业务费用();

                        if (i is 费用实体)
                        {
                            newItem.费用实体 = i as 费用实体;
                        }
                        else
                        {
                            System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                        }

                        cm.AddNew();
                        cm.DisplayManager.Items[cm.DisplayManager.Position] = newItem;
                        cm.EndEdit();


                        //string filter = "现有费用实体类型 LIKE '%" + (int)item.费用实体.费用实体类型 + ",%'";
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_非业务", filter);
                    }
                }
            }
        }
Пример #10
0
        public static void  择固定资产(ArchiveOperationForm masterForm)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();
            ArchiveCheckForm            form = ProcessSelect.Execute((masterForm.ArchiveDetailForm as IDisplayManagerContainer).DisplayManager, "选择_非业务财务_固定资产折旧", dict);

            if (form != null)
            {
                IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

                using (var rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <非业务费用>())
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        非业务费用 item = i as 非业务费用;
                        item.对账单 = masterForm.DisplayManager.CurrentItem as 对账单;
                        detailCm.AddNew();
                        detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                        detailCm.EndEdit();
                    }

                    //foreach (object i in form.SelectedEntites)
                    //{
                    //    非业务费用 item = new 非业务费用();
                    //    DataRowView row = i as DataRowView;
                    //    item.费用实体 = rep.Get<费用实体>((Guid)row["Id"]);
                    //    item.相关人编号 = masterForm.ControlManager.DisplayManager.DataControls["相关人编号"].SelectedDataValue.ToString();
                    //    item.费用项编号 = "387";        // 固定资产折旧
                    //    item.收付标志 = 收付标志.付;

                    //    detailCm.AddNew();
                    //    detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = item;
                    //    detailCm.EndEdit();
                    //}
                }
            }
        }
Пример #11
0
        public static void 批量添加费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加业务费用");

            if (selectForm.ShowDialog() == DialogResult.OK)
            {
                ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm;

                if (form != null && form.ShowDialog() == DialogResult.OK)
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        业务费用 item = new 业务费用();
                        if (i is 普通票)
                        {
                            item.票    = i as 普通票;
                            item.费用实体 = new 普通票 {
                                ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号
                            };
                        }
                        else if (i is 普通箱)
                        {
                            普通箱 xiang = i as 普通箱;

                            // it must have piao
                            item.票 = xiang.GetType().InvokeMember("票",
                                                                  BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, xiang, null) as 普通票;

                            item.箱    = (i == null ? null : xiang);
                            item.箱Id  = i == null ? null : (Guid?)xiang.ID;
                            item.费用实体 = new 普通票 {
                                ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号
                            };
                        }
                        else
                        {
                            System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                        }

                        object entity = cm.AddNew();
                        if (entity != null)
                        {
                            cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                            cm.EndEdit();
                        }
                        else
                        {
                            // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                            masterForm.ControlManager.CancelEdit();
                            break;
                        }

                        //bool isPiao = (i is 普通票);
                        //string filter = "现有费用实体类型 LIKE '%" + (int)item.票.费用实体类型;
                        //if (isPiao)
                        //{
                        //    filter += ",%' AND 票 = " + isPiao;
                        //}
                        //else
                        //{
                        //    filter += ",%' AND 箱 = " + !isPiao;
                        //}
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_业务", filter);
                    }
                }
            }
        }
Пример #12
0
        public static void 批量添加费用(ArchiveOperationForm masterForm)
        {
            IControlManager cm = masterForm.ControlManager;

            ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加业务费用");

            if (selectForm.ShowDialog() == DialogResult.OK)
            {
                ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm;

                if (form != null && form.ShowDialog() == DialogResult.OK)
                {
                    foreach (object i in form.SelectedEntites)
                    {
                        业务费用 item = new 业务费用();
                        if (i is 车辆产值)
                        {
                            车辆产值 tang = i as 车辆产值;
                            item.车辆   = (i == null ? null : tang.车辆);
                            item.车辆编号 = i == null ? null : (Guid?)tang.车辆编号;
                            item.费用实体 = tang;
                            item.车辆产值 = tang;
                        }
                        else if (i is 任务)
                        {
                            任务 xiang = i as 任务;

                            // it must have piao
                            //item.车辆产值 = xiang.车辆产值;
                            item.任务   = (i == null ? null : xiang);
                            item.车辆   = (i == null ? null : xiang.车辆产值.车辆);
                            item.车辆编号 = i == null ? null : (Guid?)xiang.车辆产值.车辆编号;
                            item.费用实体 = xiang.车辆产值;// new 车辆产值 { ID = item.车辆产值.ID, Version = item.车辆产值.Version };
                            item.车辆产值 = xiang.车辆产值;
                        }
                        else
                        {
                            System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString());
                        }

                        object entity = cm.AddNew();
                        if (entity != null)
                        {
                            cm.DisplayManager.Items[cm.DisplayManager.Position] = item;
                            cm.EndEdit();
                        }
                        else
                        {
                            // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续
                            masterForm.ControlManager.CancelEdit();
                            break;
                        }

                        //bool isPiao = (i is 普通票);
                        //string filter = "现有费用实体类型 LIKE '%" + (int)item.票.费用实体类型;
                        //if (isPiao)
                        //{
                        //    filter += ",%' AND 票 = " + isPiao;
                        //}
                        //else
                        //{
                        //    filter += ",%' AND 箱 = " + !isPiao;
                        //}
                        //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_业务", filter);
                    }
                }
            }
        }