Exemple #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();
                    }
                }
            }
        }
Exemple #2
0
        public static void 自动生成全部费用(ArchiveOperationForm masterForm)
        {
            if (!ServiceProvider.GetService <IMessageBox>().ShowYesNo("是否要自动全部生成费用?", "确认"))
            {
                return;
            }
            ProgressForm progressForm = new ProgressForm();

            progressForm.Start(masterForm, "生成");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
            {
                费用实体 entity = masterForm.DisplayManager.CurrentItem as 费用实体;
                if (entity == null)
                {
                    throw new ArgumentException("请选择要生成费用的产值!");
                }
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆产值>())
                {
                    车辆产值 piao = rep.Get <车辆产值>(entity.ID);
                    rep.Initialize(piao.任务, piao);
                    process_fy_yw.批量生成费用(rep, piao, piao.任务, null, null);
                }

                return(null);
            }),
                new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
            {
                masterForm.ControlManager.OnCurrentItemChanged();
                progressForm.Stop();
            }));
        }
 private void btn删除_Click(object sender, EventArgs e)
 {
     if (m_cm.DisplayManager.CurrentItem != null)
     {
         ArchiveOperationForm.DoDeleteS(m_cm, m_gridName);
     }
 }
Exemple #4
0
        public static void 提交(ArchiveOperationForm masterForm)
        {
            调节款 tjk = masterForm.ControlManager.DisplayManager.CurrentItem as 调节款;

            if (tjk == null)
            {
                return;
            }

            using (IRepository rep = RepositoryFactory.GenerateRepository <调节款>())
            {
                try
                {
                    rep.BeginTransaction();
                    tjk.Submitted = true;
                    rep.Update(tjk);

                    rep.Initialize(tjk, tjk.调节款明细);
                    foreach (调节款明细 i in tjk.调节款明细)
                    {
                        应收应付款 j = i.Clone() as 应收应付款;
                        j.应收应付源 = tjk;
                        rep.Save(j);
                    }

                    rep.CommitTransaction();
                }
                catch (Exception)
                {
                    rep.RollbackTransaction();
                }
            }
        }
Exemple #5
0
        public static void 撤销提交(ArchiveOperationForm masterForm)
        {
            调节款 tjk = masterForm.ControlManager.DisplayManager.CurrentItem as 调节款;

            if (tjk == null)
            {
                return;
            }

            using (IRepository rep = RepositoryFactory.GenerateRepository <调节款>())
            {
                try
                {
                    rep.BeginTransaction();
                    tjk.Submitted = false;
                    rep.Update(tjk);

                    IList <应收应付款> list = rep.Session.CreateCriteria <应收应付款>()
                                         .Add(NHibernate.Criterion.Expression.Eq("应收应付源", tjk))
                                         .List <应收应付款>();
                    foreach (应收应付款 i in list)
                    {
                        rep.Delete(i);
                    }
                    rep.CommitTransaction();
                }
                catch (Exception)
                {
                    rep.RollbackTransaction();
                }
            }
        }
Exemple #6
0
        public static void 贴现(ArchiveOperationForm masterForm)
        {
            承兑汇票 entity = masterForm.DisplayManager.CurrentItem as 承兑汇票;

            if (entity == null)
            {
                return;
            }
            if (entity.Submitted)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票已操作完全!");
                return;
            }
            if (entity.托收贴现.HasValue)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票已" + entity.托收贴现.Value + "!");
                return;
            }

            masterForm.DoEdit();

            entity.托收贴现 = 托收贴现.贴现;

            masterForm.ControlManager.OnCurrentItemChanged();
        }
Exemple #7
0
        public static void 现金返回(ArchiveOperationForm masterForm)
        {
            承兑汇票 entity = masterForm.DisplayManager.CurrentItem as 承兑汇票;

            if (entity == null)
            {
                return;
            }
            if (entity.Submitted)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票已操作完全!");
                return;
            }
            if (!entity.托收贴现.HasValue)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票还未托收或贴现");
                return;
            }
            if (entity.返回方式.HasValue)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票已" + entity.返回方式.Value + "返回!");
                return;
            }

            masterForm.DoEdit();

            entity.返回方式 = 承兑汇票返回方式.现金;
            if (entity.托收贴现 == 托收贴现.托收)
            {
                entity.返回金额 = entity.金额;
            }
            entity.Submitted = true;

            masterForm.ControlManager.OnCurrentItemChanged();
        }
Exemple #8
0
        public static void 生成凭证(ArchiveOperationForm masterForm)
        {
            IList <费用> list = GetSelectedFee4Pz(masterForm);

            if (list.Count == 0)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("请选择未出对帐单和凭证的费用!");
                return;
            }

            if (!MessageForm.ShowYesNo("是否要生成选中项相应的凭证?", "确认"))
            {
                return;
            }

            ArchiveOperationForm masterFormKj = ServiceProvider.GetService <IApplication>().ExecuteAction("资金票据_凭证") as ArchiveOperationForm;

            if (masterFormKj != null)
            {
                if (masterFormKj.DoAdd())
                {
                    ArchiveDetailForm detailFormKj = masterFormKj.ArchiveDetailForm as ArchiveDetailForm;

                    IControlManager <凭证费用明细> detailCmKj = (((IArchiveDetailFormWithDetailGrids)detailFormKj).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>;
                    IRelationalDao           masterDao  = masterFormKj.ControlManager.Dao as IRelationalDao;
                    MemoryDao <凭证费用明细>       memoryBll  = (masterDao.GetRelationalDao(0) as IMemoriedRelationalDao).DetailMemoryDao as MemoryDao <凭证费用明细>;
                    //MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMemoriedMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>;

                    (masterFormKj.DisplayManager.CurrentItem as 凭证).凭证类别 = 凭证类别.付款凭证;
                    detailFormKj.UpdateContent();

                    process_pz.AddFees(masterFormKj.DisplayManager.CurrentItem as 凭证, list, detailCmKj);
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// 与“自动生成全部费用”功能一样
        /// 当2个不同window,用DetailWindow配置时,用这个函数
        /// </summary>
        /// <param name="masterForm"></param>
        public static void 自动生成全部费用DetailWindow(ArchiveOperationForm masterForm)
        {
            if (!MessageForm.ShowYesNo("是否要自动生成全部费用?", "确认"))
            {
                return;
            }
            ProgressForm progressForm = new ProgressForm();

            progressForm.Start(masterForm, "生成");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
            {
                费用实体 entity = (masterForm.ParentForm as ArchiveOperationForm).DisplayManager.CurrentItem as 费用实体;
                if (entity == null)
                {
                    throw new ArgumentException("请选择要生成费用的票!");
                }

                生成票费用(entity);
                return(null);
            }),
                new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
            {
                Feng.Grid.BoundGridExtention.ReloadData((masterForm.ParentForm as ArchiveOperationForm).MasterGrid as IBoundGrid);
                progressForm.Stop();
            }));
        }
Exemple #10
0
        public static void 自动生成全部票费用(ArchiveOperationForm masterForm)
        {
            if (!MessageForm.ShowYesNo("是否要自动生成全部票费用?", "确认"))
            {
                return;
            }

            ProgressForm progressForm = new ProgressForm();

            progressForm.Start(masterForm, "生成");

            Feng.Async.AsyncHelper asyncHelper = new Feng.Async.AsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
            {
                foreach (object obj in masterForm.DisplayManager.Items)
                {
                    费用实体 entity = obj as 费用实体;
                    if (entity == null)
                    {
                        throw new ArgumentException("费用实体 is null!");
                    }

                    生成票费用(entity);
                }
                return(null);
            }),
                new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
            {
                Feng.Grid.BoundGridExtention.ReloadData(masterForm.MasterGrid as IBoundGrid);
                progressForm.Stop();
            }));
        }
Exemple #11
0
        //public static void 读取报关单网页快照(string 报关单号)
        //{
        //    foreach (KeyValuePair<string, string> id in Get_nbediRead_ID())
        //    {
        //        m_nbediRead = new nbediRead();
        //        m_nbediRead.SetLoginInfo(id.Key, id.Value);
        //        报关单数据 bgdsj = m_nbediRead.查询报关单数据(报关单号);
        //        if (bgdsj == null)
        //        {
        //            continue;
        //        }
        //        保存报关单快照(bgdsj.报关单长号, bgdsj.网页快照);
        //    }
        //}

        /// <summary>
        /// 生成并预览报关单
        /// 在Html文件夹下,生成以报关单号为文件名的Html文件
        /// </summary>
        /// <param name="masterForm"></param>
        public static void 预览报关单快照(ArchiveOperationForm masterForm)
        {
            if (!System.IO.Directory.Exists("Html"))
            {
                System.IO.Directory.CreateDirectory("Html");
            }

            bool   isNull       = false;
            string warnMessages = "没有以下报关单的预览代码,请重新网上读取:";

            foreach (Xceed.Grid.DataRow row in masterForm.MasterGrid.GridControl.SelectedRows)
            {
                if (row.Cells["报关单号"].Value == null)
                {
                    continue;
                }

                object wykz = Feng.Data.DbHelper.Instance.ExecuteScalar("select 网页快照 from Temp_报关单网页快照 where 报关单号 = '" + row.Cells["报关单号"].Value + "'");
                if (wykz == null || string.IsNullOrEmpty(wykz.ToString()))
                {
                    warnMessages += Environment.NewLine + row.Cells["报关单号"].Value;
                    isNull        = true;
                    continue;
                }

                System.IO.File.WriteAllText("Html\\" + row.Cells["报关单号"].Value + ".htm", wykz.ToString(), Encoding.UTF8);

                System.Diagnostics.Process.Start("Html\\" + row.Cells["报关单号"].Value + ".htm");
            }

            if (isNull)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning(warnMessages);
            }
        }
Exemple #12
0
        public static void 作废支票(ArchiveOperationForm masterForm)
        {
            支票 entity = masterForm.DisplayManager.CurrentItem as 支票;

            if (entity == null)
            {
                return;
            }
            if (entity.Submitted)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此支票不能作废!");
                return;
            }
            if (entity.是否作废)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此支票已作废!");
                return;
            }

            masterForm.DoEdit();

            entity.是否作废 = true;

            masterForm.ControlManager.OnCurrentItemChanged();
        }
Exemple #13
0
        public static void 自动填备注(ArchiveOperationForm masterForm)
        {
            int successCount = 0, skipCount = 0;

            ProgressAsyncHelper asyncHelper = new ProgressAsyncHelper(
                new Feng.Async.AsyncHelper.DoWork(delegate()
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>())
                {
                    rep.BeginTransaction();
                    foreach (Xceed.Grid.DataRow row in masterForm.MasterGrid.GridControl.SelectedRows)
                    {
                        if (!row.Cells["状态"].Value.ToString().Contains("64"))         // 只有“未对账”的费用才会自动填备注
                        {
                            if (MessageForm.ShowYesNo("第 " + row.Cells["Id"].Value.ToString() + " 条不是未对账费用!" + Environment.NewLine
                                                      + "提单号:" + row.Cells["提单号"].Value.ToString()
                                                      + " 箱号:" + row.Cells["箱号"].Value.ToString()
                                                      + " 费用项:" + row.Cells["费用项"].Value.ToString()
                                                      + Environment.NewLine + "“是”跳过继续,“否”取消所有操作?", "提示"))
                            {
                                skipCount++;
                                continue;
                            }
                            else
                            {
                                successCount = skipCount = 0;
                                rep.RollbackTransaction();
                                return(null);
                            }
                        }

                        IList <业务费用> ywfy = (rep as Feng.NH.INHibernateRepository).List <业务费用>(NHibernate.Criterion.DetachedCriteria.For <业务费用>()
                                                                                               .Add(NHibernate.Criterion.Expression.Eq("费用实体.ID", new Guid(row.Cells["费用实体"].Value.ToString())))
                                                                                               .Add(NHibernate.Criterion.Expression.Eq("箱Id", new Guid(row.Cells["箱"].Value.ToString())))
                                                                                               .Add(NHibernate.Criterion.Expression.Eq("费用项编号", row.Cells["费用项"].Value.ToString()))
                                                                                               .Add(NHibernate.Criterion.Expression.Eq("相关人编号", row.Cells["相关人"].Value.ToString()))
                                                                                               .Add(NHibernate.Criterion.Expression.Eq("金额", (decimal)row.Cells["金额"].Value)));

                        if (ywfy.Count > 1)
                        {
                            rep.RollbackTransaction();
                            throw new NullReferenceException("第 " + row.Cells["Id"].Value.ToString() + " 条对应了" + ywfy.Count + "条财务费用"
                                                             + Environment.NewLine + "可能由于重复登记,请先查看删除多余记录");
                        }

                        ywfy[0].备注 += row.Cells["备注"].Value.ToString();
                        new 业务费用Dao().Update(rep, ywfy[0]);
                        successCount++;
                    }

                    rep.CommitTransaction();
                }
                return(null);
            }),
                new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
            {
                MessageForm.ShowInfo("成功" + successCount + "条, 跳过" + skipCount + "条");
            }), masterForm, "执行");
        }
Exemple #14
0
        public static void 生成相同费用(ArchiveOperationForm masterForm)
        {
            if (masterForm.MasterGrid.GridControl.SelectedRows.Count == 0)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("请选择费用!");
                return;
            }
            if (!MessageForm.ShowYesNo("是否要生成选中项相同的费用?", "确认"))
            {
                return;
            }

            int cnt = 0;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <非业务费用>())
            {
                foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
                {
                    Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                    if (dataRow == null)
                    {
                        continue;
                    }

                    非业务费用 entity = dataRow.Tag as 非业务费用;

                    if (entity.非业务费用实体.费用实体类型编号 != 37 /*费用实体类型.其他非业务*/)
                    {
                        continue;
                    }

                    rep.Initialize(entity.费用实体, entity);

                    非业务费用 item = new 非业务费用();
                    item.收付标志   = entity.收付标志;
                    item.费用实体   = entity.费用实体;
                    item.费用项编号  = entity.费用项编号;
                    item.费用类别编号 = entity.费用类别编号;
                    item.金额     = entity.金额;
                    item.相关人编号  = entity.相关人编号;

                    object newEntity = masterForm.ControlManager.AddNew();
                    if (newEntity != null)
                    {
                        masterForm.ControlManager.DisplayManager.Items[masterForm.ControlManager.DisplayManager.Position] = item;
                        masterForm.ControlManager.EndEdit();
                        (masterForm.MasterGrid.CurrentRow as Xceed.Grid.DataRow).Cells["费用项编号"].CellEditorManager = dataRow.Cells["费用项编号"].CellEditorManager;
                        cnt++;
                    }
                    else
                    {
                        masterForm.ControlManager.CancelEdit();
                        break;
                    }
                }
            }

            MessageForm.ShowInfo("已生成" + cnt + "条费用!");
        }
Exemple #15
0
 public static void 撤销专家任务(ArchiveOperationForm masterForm)
 {
     if (masterForm.DisplayManager.CurrentItem != null)
     {
         撤销任务的专家任务(masterForm.DisplayManager.CurrentItem as 任务);
         ResetRowData(masterForm);
     }
 }
Exemple #16
0
 public static void 撤销车辆作业(ArchiveOperationForm masterForm)
 {
     if (masterForm.DisplayManager.CurrentItem != null)
     {
         撤销专家任务的车辆作业(masterForm.DisplayManager.CurrentItem as 专家任务);
         任务管理.ResetRowData(masterForm);
     }
 }
Exemple #17
0
        public static void ReadCk(ArchiveOperationForm masterForm)
        {
            IControlManager masterCm = masterForm.ControlManager;

            if (masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue == null)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("请输入提单号!");
                return;
            }

            string tdh = masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue.ToString().Trim();

            m_nbeportGrab.SetLoginInfo(SystemProfileFile.DefaultUserProfile.GetValue("Hd.Options", "NetReadUserName", ""),
                                       SystemProfileFile.DefaultUserProfile.GetValue("Hd.Options", "NetReadPassword", ""));
            IList <集装箱数据> boxList = m_nbeportGrab.查询集装箱数据(ImportExportType.出口集装箱, tdh);

            if (boxList.Count <= 0)
            {
                return;
            }

            AskToReplace(masterCm, "船名航次", boxList[0].船舶英文名称 + "/" + boxList[0].航次);
            AskToReplace(masterCm, "进港地编号", NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", boxList[0].堆场区));
            AskToReplace(masterCm, "离港时间", boxList[0].进场时间);
            AskToReplace(masterCm, "提单号", boxList[0].提单号);
            AskToReplace(masterCm, "箱量", boxList.Count);

            IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager;

            foreach (集装箱数据 data in boxList)
            {
                bool have = false;
                foreach (Xceed.Grid.DataRow row in ((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0].DataRows)
                {
                    if (row.Cells["箱号"].Value != null && row.Cells["箱号"].Value.ToString().Trim() == data.集装箱号.Trim())
                    {
                        have = true;
                        break;
                    }
                }
                if (!have)
                {
                    出口箱 newItem = new 出口箱
                    {
                        箱号    = data.集装箱号,
                        箱型    = Feng.Utils.ConvertHelper.ChangeType(data.箱型, typeof(箱型)) as 箱型,
                        装货地编号 = (string)NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", data.堆场区),
                        进港时间  = data.Real进场时间,
                        提箱时间  = data.Real提箱时间
                    };

                    detailCm.AddNew();
                    detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = newItem;
                    detailCm.EndEdit();
                }
            }
        }
        public static void 内贸出港票提交(ArchiveOperationForm masterForm)
        {
            内贸出港票 ticket = masterForm.ControlManager.DisplayManager.CurrentItem as 内贸出港票;

            if (ticket == null)
            {
                return;
            }
        }
Exemple #19
0
        public static void 生成油费对外费用(ArchiveOperationForm masterForm)
        {
            if (MessageForm.ShowYesNo("是否自动生成油费对外费用?", "提示"))
            {
                int count = 0;
                try
                {
                    if (masterForm.DisplayManager.Items != null && masterForm.DisplayManager.Items.Count > 0)
                    {
                        foreach (Xceed.Grid.Row row in masterForm.MasterGrid.GridControl.SelectedRows)
                        {
                            Xceed.Grid.DataRow dataRow = row as Xceed.Grid.DataRow;
                            if (dataRow == null)
                            {
                                continue;
                            }

                            业务费用 fy = dataRow.Tag as 业务费用;

                            // 把 费用归属=驾驶员 费用项=204 的记录 逐条生成  费用归属=对外的
                            // 收付标志 反一下   相关人=null
                            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>())
                            {
                                rep.Initialize(fy.车辆产值, fy);
                            }

                            if (fy.费用归属 == 费用归属.驾驶员 && fy.费用项编号 == "204")
                            {
                                业务费用 kps = masterForm.ControlManager.AddNew() as 业务费用;

                                kps.费用归属  = 费用归属.对外;
                                kps.收付标志  = fy.收付标志 == 收付标志.收 ? 收付标志.付 : 收付标志.收;
                                kps.数量    = fy.数量;
                                kps.费用项编号 = fy.费用项编号;
                                kps.金额    = fy.金额;
                                kps.费用实体  = fy.费用实体;
                                kps.车辆产值  = fy.车辆产值;
                                kps.车辆编号  = fy.车辆编号;
                                kps.任务    = fy.任务;

                                masterForm.DisplayManager.DisplayCurrent();
                                masterForm.ControlManager.EndEdit(true);
                                count++;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new InvalidUserOperationException(ex.Message);
                }
                finally
                {
                    MessageForm.ShowInfo("已生成 " + count + " 条对外费用!");
                }
            }
        }
Exemple #20
0
        public static void 批量添加发票(ArchiveOperationForm masterForm)
        {
            frm_cw_kj_fp_addall form = new frm_cw_kj_fp_addall(true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                masterForm.ControlManager.DisplayManager.SearchManager.LoadData(null, null);
            }
        }
Exemple #21
0
        public static void ResetRowData(ArchiveOperationForm masterForm)
        {
            DataUnboundGrid m_grid = masterForm.MasterGrid as DataUnboundGrid;

            if (m_grid != null)
            {
                m_grid.ResetRowData(m_grid.CurrentDataRow);
            }
        }
        private void btn修改_Click(object sender, EventArgs e)
        {
            if (m_cm.DisplayManager.CurrentItem != null)
            {
                ArchiveOperationForm.DoEditS(m_cm, m_gridName);
                UpdateContent(m_cm, m_gridName);

                m_cm.DisplayManager.OnSelectedDataValueChanged(new SelectedDataValueChangedEventArgs("任务性质", m_cm.DisplayManager.DataControls["任务性质"]));
            }
        }
Exemple #23
0
        public static void 撤销返回(ArchiveOperationForm masterForm)
        {
            承兑汇票 entity = masterForm.DisplayManager.CurrentItem as 承兑汇票;

            if (entity == null)
            {
                return;
            }
            if (!entity.Submitted)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票未进行返回操作!");
                return;
            }

            if (entity.Submitted && !entity.托收贴现.HasValue)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票已支付!");
                return;
            }
            if (!MessageForm.ShowYesNo("是否确认撤销?", "确认"))
            {
                return;
            }

            //Dictionary<string, object> saved = new Dictionary<string, object>();
            //saved["返回方式"] = entity.返回方式;
            //saved["返回时间"] = entity.返回时间;
            //saved["返回经手人编号"] = entity.返回经手人编号;
            //saved["入款账户编号"] = entity.入款账户编号;
            //saved["返回金额"] = entity.返回金额;


            //entity.Submitted = false;
            //entity.返回方式 = null;
            //entity.返回时间 = null;
            //entity.返回经手人编号 = null;
            //entity.入款账户编号 = null;
            //entity.返回金额 = null;

            //// 不加DisplayCurrent,会导致数据控件中的值未改变,再次保存进entity中
            //masterForm.ControlManager.DisplayManager.DisplayCurrent();
            //masterForm.ControlManager.EditCurrent();
            //masterForm.ControlManager.EndEdit();

            // 直接保存。如果通过界面操作,会和界面的Validator搞混,导致不能保存,出现数据错误
            entity.Submitted = false;
            entity.返回方式      = null;
            entity.返回时间      = null;
            entity.返回经手人编号   = null;
            entity.入款账户编号    = null;
            entity.返回金额      = null;
            (new 承兑汇票Bll()).Update(entity);
            masterForm.ControlManager.OnCurrentItemChanged();
        }
Exemple #24
0
        //public static void 审核(ArchiveOperationForm masterForm)
        //{
        //    if (MessageForm.ShowYesNo("是否确认审核?", "确认") == System.Windows.Forms.DialogResult.No)
        //        return;

        //    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<凭证>())
        //    {
        //        (new 凭证Dao()).Audit(rep, masterForm.DisplayManager.CurrentItem as 凭证);
        //    }
        //    masterForm.ControlManager.RaiseEntityChangedEvent(true);
        //}

        //public static void 撤销审核(ArchiveOperationForm masterForm)
        //{
        //    if (MessageForm.ShowYesNo("是否确认撤销审核?", "确认") == System.Windows.Forms.DialogResult.No)
        //        return;
        //    using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<凭证>())
        //    {
        //        (new 凭证Dao()).Unaudit(rep, masterForm.DisplayManager.CurrentItem as 凭证);
        //    }
        //    masterForm.ControlManager.RaiseEntityChangedEvent(true);
        //}

        #region "凭证费用明细审核"
        //public static void 审核费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.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<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }

        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000")
        //    {
        //        审核不核销费用(masterForm, detailForm, windowMenuInfo);
        //    }
        //    else
        //    {
        //        RepositoryHelper.Initialize(detailCm.DisplayManagerT.CurrentEntity.费用项, detailCm.DisplayManagerT.CurrentEntity);

        //        detailCm.DisplayManagerT.CurrentEntity.费用项 = EntityBufferCollection.Instance["费用项"].Get(detailCm.DisplayManagerT.CurrentEntity.费用项编号) as 费用项;

        //        凭证费用明细 entity = detailCm.DisplayManagerT.CurrentEntity;
        //        int? 费用类别编号 = entity.收付标志 == 收付标志.收 ? entity.费用项.收入类别 : entity.费用项.支出类别;

        //        if (费用类别编号.HasValue)
        //        {
        //            费用类别 费用类别 = EntityBufferCollection.Instance["费用类别"].Get(费用类别编号.Value) as 费用类别;
        //            if (费用类别.大类 == "业务常规" || 费用类别.大类 == "业务额外")
        //            {
        //                审核业务核销费用(masterForm, detailForm, windowMenuInfo);
        //            }
        //            else
        //            {
        //                审核非业务核销费用(masterForm, detailForm, windowMenuInfo);
        //            }
        //        }
        //        else
        //        {
        //            throw new ArgumentException("无有效费用类别!");
        //        }
        //    }
        //}


        //public static void 审核不核销费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.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<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }
        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 != "000")
        //    {
        //        MessageForm.ShowError("此项目不为应收应付款,不能核销!");
        //        return;
        //    }
        //    detailCm.DisplayManagerT.CurrentEntity.审核状态 = true;
        //    detailCm.RaiseEntityChangedEvent(true);

        //    memoryBll.Update(detailCm.DisplayManagerT.CurrentEntity);
        //}

        //public static void 审核业务核销费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.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<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }
        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000")
        //    {
        //        MessageForm.ShowError("此项目为应收应付款,不能核销!");
        //        return;
        //    }

        //    ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(108)) as ArchiveCheckForm;
        //    ISearchControl fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["相关人编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.相关人编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["费用项编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.费用项编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["收付标志"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.收付标志 };
        //    fc.ReadOnly = true;

        //    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, memoryBll, memoryBll2, false);
        //    }
        //}


        //public static void 审核非业务核销费用(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.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<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }
        //    if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000")
        //    {
        //        MessageForm.ShowError("此项目为应收应付款,不能核销!");
        //        return;
        //    }

        //    ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(109)) as ArchiveCheckForm;
        //    ISearchControl fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["相关人编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.相关人编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["费用项编号"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.费用项编号 };
        //    fc.ReadOnly = true;

        //    fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["收付标志"];
        //    fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.收付标志 };
        //    fc.ReadOnly = true;

        //    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, memoryBll, memoryBll2, false);
        //    }
        //}

        //public static void 清空审核数据(ArchiveOperationForm masterForm)
        //{
        //    IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>;
        //    IBaseDao masterDao = ((IArchiveGrid)masterForm.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<费用>;

        //    if (detailCm.DisplayManager.Position == -1)
        //    {
        //        MessageForm.ShowError("请选择要核销的费用项目!");
        //        return;
        //    }

        //    if (MessageForm.ShowYesNo("是否要清空审核数据?", "确认") == DialogResult.No)
        //    {
        //        return;
        //    }

        //    RepositoryHelper.Initialize(detailCm.DisplayManagerT.CurrentEntity.费用, detailCm.DisplayManagerT.CurrentEntity);
        //    foreach (费用 i in detailCm.DisplayManagerT.CurrentEntity.费用)
        //    {
        //        i.凭证费用明细 = null;
        //        memoryBll2.Delete(i);
        //    }
        //    detailCm.DisplayManagerT.CurrentEntity.费用.Clear();

        //    detailCm.DisplayManagerT.CurrentEntity.审核状态 = false;
        //    detailCm.RaiseEntityChangedEvent(true);

        //    memoryBll.Update(detailCm.DisplayManagerT.CurrentEntity);
        //}
        #endregion

        public static void 新增成本发票(ArchiveOperationForm masterForm)
        {
            ArchiveDetailForm form = Feng.Windows.Utils.ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("非业务财务_成本发票"), null);

            form.ControlManager.AddNew();
            form.UpdateContent();
            form.ControlManager.DisplayManager.DataControls["金额"].SelectedDataValue  = masterForm.ControlManager.DisplayManager.DataControls["金额.数额"].SelectedDataValue;
            form.ControlManager.DisplayManager.DataControls["凭证号"].SelectedDataValue = masterForm.ControlManager.DisplayManager.DataControls["凭证号"].SelectedDataValue;

            DialogResult ret = form.ShowDialog();
        }
Exemple #25
0
 public static void 新增收款凭证(ArchiveOperationForm masterForm)
 {
     if (masterForm.DoAdd())
     {
         凭证 pz = masterForm.DisplayManager.CurrentItem as 凭证;
         pz.凭证类别   = 凭证类别.收款凭证;
         pz.自动手工标志 = 自动手工标志.手工;
         //pz.操作人 = "会计";
         //pz.日期 = System.DateTime.Today;
         (masterForm.ArchiveDetailForm as ArchiveDetailForm).UpdateContent();
     }
 }
Exemple #26
0
        public static void 打印对账单(ArchiveOperationForm masterForm)
        {
            对账单 entity = masterForm.DisplayManager.CurrentItem as 对账单;

            if (entity == null)
            {
                MessageForm.ShowError("请选择要打印的对账单!");
                return;
            }

            ReflectionHelper.RunStaticMethod("Hd.Report", "Hd.Report.ReportPrint", "打印对账单", new object[] { entity.编号 });
        }
Exemple #27
0
        public static void 凭证修改(ArchiveOperationForm masterForm)
        {
            凭证 pz = masterForm.DisplayManager.CurrentItem as 凭证;

            if (pz == null)
            {
                MessageForm.ShowError("请选择要修改的凭证!");
                return;
            }
            //pz.操作人 = "出纳";

            masterForm.DoEdit();
        }
Exemple #28
0
        public static void 自动生成费用(ArchiveOperationForm masterForm)
        {
            Dictionary <string, object> setData = masterForm.Tag as Dictionary <string, object>;
            费用实体 entity;

            using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <业务费用>())
            {
                rep.BeginTransaction();
                entity = rep.Get <费用实体>(setData["费用实体"]);
                rep.CommitTransaction();
            }

            if (entity.费用实体类型编号 == 11 /*费用实体类型.进口*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <进口票>())
                {
                    进口票 piao = rep.Get <进口票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }
            else if (entity.费用实体类型编号 == 15 /*费用实体类型.内贸出港*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <内贸出港票>())
                {
                    内贸出港票 piao = rep.Get <内贸出港票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }
            else if (entity.费用实体类型编号 == 45 /*费用实体类型.进口其他业务*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <进口其他业务票>())
                {
                    进口其他业务票 piao = rep.Get <进口其他业务票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }
            else if (entity.费用实体类型编号 == 13 /*费用实体类型.出口*/)
            {
                using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <出口票>())
                {
                    出口票 piao = rep.Get <出口票>(setData["费用实体"]);
                    rep.Initialize(piao.箱, piao);
                    process_fy_yw.批量生成费用(rep, entity.费用实体类型编号, piao, piao.箱, (string)setData["费用项"], !setData.ContainsKey("收付标志") ? null : (收付标志?)setData["收付标志"]);
                }
            }

            (masterForm.MasterGrid as IBoundGrid).ReloadData();
        }
Exemple #29
0
        public static void 撤销托收贴现(ArchiveOperationForm masterForm)
        {
            承兑汇票 entity = masterForm.DisplayManager.CurrentItem as 承兑汇票;

            if (entity == null)
            {
                return;
            }
            if (entity.Submitted)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票已操作完全!");
                return;
            }

            if (!entity.托收贴现.HasValue)
            {
                ServiceProvider.GetService <IMessageBox>().ShowWarning("此承兑汇票未进行托收贴现操作!");
                return;
            }

            if (!MessageForm.ShowYesNo("是否确认撤销?", "确认"))
            {
                return;
            }


            //Dictionary<string, object> saved = new Dictionary<string, object>();
            //saved["托收贴现"] = entity.托收贴现;
            //saved["出去时间"] = entity.出去时间;
            //saved["出去经手人编号"] = entity.出去经手人编号;
            //saved["经办人编号"] = entity.经办人编号;


            //entity.Submitted = false;
            //entity.托收贴现 = null;
            //entity.出去时间 = null;
            //entity.出去经手人编号 = null;
            //entity.经办人编号 = null;

            //masterForm.ControlManager.DisplayManager.DisplayCurrent();
            //masterForm.ControlManager.EditCurrent();
            //masterForm.ControlManager.EndEdit();

            entity.Submitted = false;
            entity.托收贴现      = null;
            entity.出去时间      = null;
            entity.出去经手人编号   = null;
            entity.经办人编号     = null;
            (new 承兑汇票Bll()).Update(entity);
            masterForm.ControlManager.OnCurrentItemChanged();
        }
Exemple #30
0
        private void btn修改_Click(object sender, EventArgs e)
        {
            if (m_cm.DisplayManager.CurrentItem != null)
            {
                进口票 entity = m_cm.DisplayManagerT.CurrentEntity;
                if (!Check票(entity))
                {
                    return;
                }

                ArchiveOperationForm.DoEditS(m_cm, m_gridName);
                UpdateContent(m_cm, m_gridName);
            }
        }