// 删除
        protected void GridGoodsSeries_OnDeleteCommand(object sender, GridCommandEventArgs e)
        {
            var editedItem = (GridEditableItem)e.Item;
            var id         = (Guid)editedItem.GetDataKeyValue("SeriesID");

            try
            {
                string errorMessage;
                var    result = _goodsCenterSao.DeleteSeries(id, out errorMessage);//删除分类
                if (result)
                {
                    //记录工作日志
                    var personnelInfo = CurrentSession.Personnel.Get();
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, id, "",
                                               OperationPoint.GoodsSeriesManager.Delete.GetBusinessInfo(), string.Empty);
                }
                else
                {
                    RAM.Alert("操作无效!" + errorMessage);
                }
            }
            catch
            {
                RAM.Alert("删除失败!");
            }
        }
        // 修改
        protected void GridGoodsSeries_OnUpdateCommand(object sender, GridCommandEventArgs e)
        {
            var    editedItem  = (GridEditableItem)e.Item;
            var    id          = (Guid)editedItem.GetDataKeyValue("SeriesID");
            string seriesName  = ((TextBox)editedItem.FindControl("TB_SeriesName")).Text;
            var    goodsSeries = new GoodsSeriesInfo();

            goodsSeries.SeriesID   = id;
            goodsSeries.SeriesName = seriesName;

            string errorMessage;
            var    result = _goodsCenterSao.UpdateSeries(goodsSeries, out errorMessage);//更新系列

            if (result)
            {
                //记录工作日志
                var personnelInfo = CurrentSession.Personnel.Get();
                WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, id, "",
                                           OperationPoint.GoodsSeriesManager.Edit.GetBusinessInfo(), string.Empty);
            }
            else
            {
                RAM.Alert("操作无效!" + errorMessage);
            }
        }
示例#3
0
        /// <summary>新建
        /// </summary>
        protected void RadGrid_InvoiceRollList_InsertCommand(object sender, GridCommandEventArgs e)
        {
            if (!SubmitController.Enabled)
            {
                return;
            }
            var editedItem = e.Item as GridEditableItem;
            var newId      = Guid.NewGuid();

            if (editedItem != null)
            {
                var textBoxReceiptor        = editedItem.FindControl("TextBox_Receiptor") as TextBox;
                var textBoxInvoiceCode      = editedItem.FindControl("TextBox_InvoiceCode") as TextBox;
                var textBoxInvoiceStartNo   = editedItem.FindControl("TextBox_InvoiceStartNo") as TextBox;
                var textBoxInvoiceEndNo     = editedItem.FindControl("TextBox_InvoiceEndNo") as TextBox;
                var textBoxInvoiceRollCount = editedItem.FindControl("TextBox_InvoiceRollCount") as TextBox;
                var radDatePickerTime       = editedItem.FindControl("RadDatePicker_Time") as RadDatePicker;
                var radComboBoxFiliale      = editedItem.FindControl("RCB_Filiale") as RadComboBox;
                var invoiceRollInfo         = new Keede.Ecsoft.Model.InvoiceRoll
                {
                    Id               = newId,
                    Receiptor        = textBoxReceiptor != null?textBoxReceiptor.Text:string.Empty,
                    InvoiceCode      = textBoxInvoiceCode != null?textBoxInvoiceCode.Text:string.Empty,
                    InvoiceStartNo   = textBoxInvoiceStartNo == null?0:int.Parse(string.IsNullOrEmpty(textBoxInvoiceStartNo.Text.Trim()) ? "0" : textBoxInvoiceStartNo.Text.Trim()),
                    InvoiceEndNo     = textBoxInvoiceEndNo == null?0:int.Parse(string.IsNullOrEmpty(textBoxInvoiceEndNo.Text.Trim()) ? "0" : textBoxInvoiceEndNo.Text.Trim()),
                    InvoiceRollCount = textBoxInvoiceRollCount == null?0:int.Parse(string.IsNullOrEmpty(textBoxInvoiceRollCount.Text.Trim()) ? "0" : textBoxInvoiceRollCount.Text.Trim()),
                    CreateTime       = radDatePickerTime != null?radDatePickerTime.SelectedDate ?? DateTime.Now:DateTime.Now,
                    FilialeId        = radComboBoxFiliale != null?new Guid(radComboBoxFiliale.SelectedValue):Guid.Empty
                };
                invoiceRollInfo.InvoiceCount = invoiceRollInfo.InvoiceEndNo - invoiceRollInfo.InvoiceStartNo + 1;
                if (invoiceRollInfo.InvoiceCount < 1)
                {
                    RAM.Alert("发票份数是:" + invoiceRollInfo.InvoiceCount + "份,填写发票号码错误");
                    return;
                }
                var success = Invoice.WriteInstance.AddInvoiceRoll(invoiceRollInfo);
                if (success)
                {
                    var personnelInfo = CurrentSession.Personnel.Get();
                    //发票库管理发票入库操作记录添加
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceRollInfo.Id, invoiceRollInfo.InvoiceCode,
                                               OperationPoint.InvoiceStorageManage.InvoiceIntoLibrary.GetBusinessInfo(), string.Empty);
                    SubmitController.Submit();
                    RAM.ResponseScripts.Add("location.href=location.href;");
                }
                else
                {
                    RAM.Alert("购买发票添加失败");
                }
            }
        }
示例#4
0
        /// <summary>编辑
        /// </summary>
        protected void RadGrid_InvoiceRollList_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            var editedItem = e.Item as GridEditableItem;

            if (editedItem != null)
            {
                var textBoxReceiptor        = editedItem.FindControl("TextBox_Receiptor") as TextBox;
                var textBoxInvoiceCode      = editedItem.FindControl("TextBox_InvoiceCode") as TextBox;
                var textBoxInvoiceStartNo   = editedItem.FindControl("TextBox_InvoiceStartNo") as TextBox;
                var textBoxInvoiceEndNo     = editedItem.FindControl("TextBox_InvoiceEndNo") as TextBox;
                var textBoxInvoiceRollCount = editedItem.FindControl("TextBox_InvoiceRollCount") as TextBox;
                var radDatePickerTime       = editedItem.FindControl("RadDatePicker_Time") as RadDatePicker;
                var radComboBoxFiliale      = editedItem.FindControl("RCB_Filiale") as RadComboBox;
                var invoiceRollInfo         = new Keede.Ecsoft.Model.InvoiceRoll
                {
                    Id               = new Guid(editedItem.GetDataKeyValue("Id").ToString()),
                    Receiptor        = textBoxReceiptor != null ? textBoxReceiptor.Text : string.Empty,
                    InvoiceCode      = textBoxInvoiceCode != null ? textBoxInvoiceCode.Text : string.Empty,
                    InvoiceStartNo   = textBoxInvoiceStartNo == null ? 0 : int.Parse(string.IsNullOrEmpty(textBoxInvoiceStartNo.Text.Trim()) ? "0" : textBoxInvoiceStartNo.Text.Trim()),
                    InvoiceEndNo     = textBoxInvoiceEndNo == null ? 0 : int.Parse(string.IsNullOrEmpty(textBoxInvoiceEndNo.Text.Trim()) ? "0" : textBoxInvoiceEndNo.Text.Trim()),
                    InvoiceRollCount = textBoxInvoiceRollCount == null ? 0 : int.Parse(string.IsNullOrEmpty(textBoxInvoiceRollCount.Text.Trim()) ? "0" : textBoxInvoiceRollCount.Text.Trim()),
                    CreateTime       = radDatePickerTime != null ? radDatePickerTime.SelectedDate ?? DateTime.Now : DateTime.Now,
                    FilialeId        = radComboBoxFiliale != null ? new Guid(radComboBoxFiliale.SelectedValue) : Guid.Empty
                };
                invoiceRollInfo.InvoiceCount = invoiceRollInfo.InvoiceEndNo - invoiceRollInfo.InvoiceStartNo + 1;
                if (invoiceRollInfo.InvoiceCount < 1)
                {
                    RAM.Alert("发票份数是:" + invoiceRollInfo.InvoiceCount + "份,填写发票号码错误");
                    return;
                }
                var success = Invoice.WriteInstance.UpdateInvoiceRoll(invoiceRollInfo);
                if (success)
                {
                    var personnelInfo = CurrentSession.Personnel.Get();
                    //发票库管理编辑操作记录添加
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceRollInfo.Id, invoiceRollInfo.InvoiceCode, OperationPoint.InvoiceStorageManage.Edit.GetBusinessInfo(), string.Empty);
                    ReadInvoiceRollList();
                }
                else
                {
                    RAM.Alert("编辑发票失败,其中的发票卷可能分发在打印了");
                }
            }
        }
示例#5
0
        //添加商品分类
        protected void Add_Click(object sender, EventArgs e)
        {
            try
            {
                GoodsClassInfo goodsClassInfo = NonceGoodsClassInfo;
                goodsClassInfo.GoodsClassFieldList = GoodsClassFieldIdList;
                string errorMessage;
                var    result = _goodsCenterSao.AddClass(goodsClassInfo, out errorMessage);
                if (result)
                {
                    //商品分类添加操作记录添加
                    var personnelInfo = CurrentSession.Personnel.Get();
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, goodsClassInfo.ClassId, "",
                                               OperationPoint.GoodsClassManager.Add.GetBusinessInfo(), "");

                    if (TVGoodsClass.SelectedNode == null)
                    {
                        RadTreeNode addNode = CreateNode(goodsClassInfo.ClassName, false, goodsClassInfo.ClassId.ToString());
                        TVGoodsClass.Nodes.Add(addNode);
                    }
                    else
                    {
                        RadTreeNode currentNode = TVGoodsClass.FindNodeByValue(goodsClassInfo.ParentClassId.ToString());
                        RadTreeNode addNode     = CreateNode(goodsClassInfo.ClassName, false, goodsClassInfo.ClassId.ToString());
                        currentNode.Nodes.Add(addNode);
                        OpenTree(currentNode);
                        BindParentClass();
                    }
                    InsterItem(sender, e);
                }
                else
                {
                    RAM.Alert("商品分类添加失败!操作异常!" + errorMessage);
                }
            }
            catch
            {
                RAM.Alert("产品分类添加失败!");
            }
        }
示例#6
0
        //删除属性
        protected void FieldGrid_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            var editedItem = (GridDataItem)e.Item;
            var fieldId    = new Guid(editedItem.GetDataKeyValue("FieldId").ToString());

            if (fieldId == Guid.Empty)
            {
                RAM.Alert(string.Format("操作无效!{0}", "FieldId不能空"));
                return;
            }
            try
            {
                string errorMessage;
                var    result = _goodsFieldSao.DeleteField(fieldId, out errorMessage);
                if (result)
                {
                    //商品属性更改操作记录添加
                    var personnelInfo = CurrentSession.Personnel.Get();
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, fieldId, "",
                                               OperationPoint.GoodsAttributeManager.Edit.GetBusinessInfo(), string.Empty);
                    if (editedItem.OwnerTableView.DataMember == "TopField")
                    {
                        FieldGrid.Rebind();
                    }
                    else
                    {
                        editedItem.OwnerTableView.Rebind();
                    }
                }
                else
                {
                    RAM.Alert("操作无效!" + errorMessage);
                }
            }
            catch
            {
                RAM.Alert("商品属性信息删除失败!");
            }
        }
        // 增加
        protected void GridGoodsSeries_OnInsertCommand(object sender, GridCommandEventArgs e)
        {
            var    editedItem = (GridEditableItem)e.Item;
            string seriesName = ((TextBox)editedItem.FindControl("TB_SeriesName")).Text;
            var    info       = new GoodsSeriesInfo();

            info.SeriesID   = Guid.NewGuid();
            info.SeriesName = seriesName;

            string errorMessage;
            var    result = _goodsCenterSao.AddSeries(info, out errorMessage);//插入系列

            if (result)
            {
                //记录工作日志
                var personnelInfo = CurrentSession.Personnel.Get();
                WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, info.SeriesID, "",
                                           OperationPoint.GoodsSeriesManager.Add.GetBusinessInfo(), string.Empty);
            }
            else
            {
                RAM.Alert("操作无效!" + errorMessage);
            }
        }
示例#8
0
        protected void RGInvoice_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var dataItem         = e.Item as GridDataItem;
                var invoiceId        = new Guid(dataItem.GetDataKeyValue("InvoiceId").ToString());
                var enumInvoiceState = (InvoiceState)int.Parse(dataItem.GetDataKeyValue("InvoiceState").ToString());
                //var invoice = new Invoice();
                if (e.CommandName == "Approved")
                {
                    try
                    {
                        if (enumInvoiceState == InvoiceState.Request)
                        {
                            //invoice.SetInvoiceState(invoiceId, InvoiceState.Success, WebControl.RetrunUserAndTime("受理发票"), CurrentSession.Personnel.Get().RealName);
                            Invoice.WriteInstance.SetInvoiceState(invoiceId, InvoiceState.Success, CurrentSession.Personnel.Get().RealName);
                            IList <GoodsOrderInfo> goodOrderInfoList = invoiceId != Guid.Empty?_goodsOrder.GetInvoiceGoodsOrderList(invoiceId):new List <GoodsOrderInfo>();
                            foreach (GoodsOrderInfo goodsOrderInfo in goodOrderInfoList)
                            {
                                sync.SyncSetInvoiceState(goodsOrderInfo.SaleFilialeId, invoiceId, InvoiceState.Success, true, WebControl.RetrunUserAndTime("受理发票"));
                                break;
                            }
                            //发票管理受理操作记录添加
                            var invoiceInfo   = Invoice.ReadInstance.GetInvoice(invoiceId);
                            var personnelInfo = CurrentSession.Personnel.Get();
                            WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceId, invoiceInfo == null ? "" : invoiceInfo.InvoiceNo.ToMendString(8),
                                                       OperationPoint.InvoiceManage.Approved.GetBusinessInfo(), string.Empty);
                        }
                        RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                    }
                    catch
                    {
                        RAM.Alert("更改发票状态失败!");
                    }
                }
                else if (e.CommandName == "Cancel")
                {
                    try
                    {
                        //invoice.SetInvoiceState(invoiceId, InvoiceState.Cancel, WebControl.RetrunUserAndTime("取消发票"), CurrentSession.Personnel.Get().RealName);
                        Invoice.WriteInstance.SetInvoiceState(invoiceId, InvoiceState.Cancel, CurrentSession.Personnel.Get().RealName);
                        IList <GoodsOrderInfo> goodOrderInfoList = invoiceId != Guid.Empty ? _goodsOrder.GetInvoiceGoodsOrderList(invoiceId) : new List <GoodsOrderInfo>();
                        foreach (GoodsOrderInfo goodsOrderInfo in goodOrderInfoList)
                        {
                            sync.SyncSetInvoiceState(goodsOrderInfo.SaleFilialeId, invoiceId, InvoiceState.Cancel, true, WebControl.RetrunUserAndTime("取消发票"));
                            break;
                        }

                        //发票管理取消操作记录添加
                        var invoiceInfo   = Invoice.ReadInstance.GetInvoice(invoiceId);
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceId, invoiceInfo == null ? "" : invoiceInfo.InvoiceNo.ToMendString(8),
                                                   OperationPoint.InvoiceManage.Cancel.GetBusinessInfo(), string.Empty);
                        RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                    }
                    catch
                    {
                        RAM.Alert("更改发票状态失败!");
                    }
                }
                else if ("waste" == e.CommandName)
                {
                    //var success = invoice.SetInvoiceState(invoiceId, InvoiceState.Waste, "该发票财务确认作废.[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    var success = Invoice.WriteInstance.SetInvoiceState(invoiceId, InvoiceState.Waste, CurrentSession.Personnel.Get().RealName);
                    if (success)
                    {
                        IList <GoodsOrderInfo> goodOrderInfoList = invoiceId != Guid.Empty ? _goodsOrder.GetInvoiceGoodsOrderList(invoiceId) : new List <GoodsOrderInfo>();
                        foreach (GoodsOrderInfo goodsOrderInfo in goodOrderInfoList)
                        {
                            sync.SyncSetInvoiceState(goodsOrderInfo.SaleFilialeId, invoiceId, InvoiceState.Waste, true, "该发票财务确认作废.[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]");
                            break;
                        }

                        RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                    }
                    else
                    {
                        RAM.Alert("发票拒绝作废,有可能发票已经报送税务!");
                    }
                }
                else if ("return" == e.CommandName)
                {
                    //invoice.SetInvoiceState(invoiceId, InvoiceState.Success, "该发票财务拒绝作废.状态返回已开[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    Invoice.WriteInstance.SetInvoiceState(invoiceId, InvoiceState.Success, CurrentSession.Personnel.Get().RealName);
                    RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
            }
        }
示例#9
0
        protected void Delete_Click(object sender, EventArgs e)
        {
            if (TVGoodsClass.SelectedNode == null)
            {
                return;
            }
            var currentNode       = TVGoodsClass.SelectedNode;
            var panterCurrentNode = currentNode.ParentNode;
            var classId           = new Guid(currentNode.Value);

            if (classId != Guid.Empty)
            {
                try
                {
                    GoodsClassInfo goodsClassInfo = _goodsCenterSao.GetClassDetail(classId);
                    string         errorMessage;
                    var            result = _goodsCenterSao.DeleteClass(classId, out errorMessage);
                    if (result)
                    {
                        UnselectAllNodes(TVGoodsClass);

                        //商品分类添加操作记录添加
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, goodsClassInfo.ClassId, "",
                                                   OperationPoint.GoodsClassManager.Delete.GetBusinessInfo(), "");

                        if (currentNode.Parent != null)
                        {
                            panterCurrentNode.Selected = true;
                            panterCurrentNode.Nodes.Remove(currentNode);
                            var            nodeId          = new Guid(panterCurrentNode.Value);
                            GoodsClassInfo goodsClassInfo2 = nodeId == Guid.Empty ? null : _goodsCenterSao.GetClassDetail(nodeId);
                            NonceGoodsClassInfo = goodsClassInfo2;
                        }
                        else
                        {
                            if (currentNode.Index > 0)
                            {
                                currentNode.TreeView.Nodes[currentNode.Index - 1].Selected = true;
                                var            id = new Guid(currentNode.TreeView.Nodes[currentNode.Index - 1].Value);
                                GoodsClassInfo goodsClassInfo2 = id == Guid.Empty ? null : _goodsCenterSao.GetClassDetail(id);
                                NonceGoodsClassInfo = goodsClassInfo2;
                            }
                            TVGoodsClass.Nodes.Remove(currentNode);
                        }
                        DDL_ParentClass.SelectedValue = panterCurrentNode.Value;

                        if (panterCurrentNode.Value != Guid.Empty.ToString())
                        {
                            BindParentClass();
                        }
                    }
                    else
                    {
                        RAM.Alert("商品分类删除失败!" + errorMessage);
                    }
                }
                catch (Exception exp)
                {
                    RAM.Alert("商品分类信息删除失败!\n\n错误提示:" + exp.Message);
                }
            }
            else
            {
                RAM.Alert("根节点不允许删除!");
            }
        }
示例#10
0
        protected void Update_Click(object sender, EventArgs e)
        {
            GoodsClassInfo goodsClassInfo = NonceGoodsClassInfo;

            if (goodsClassInfo.ClassId != Guid.Empty)
            {
                try
                {
                    if (TVGoodsClass.SelectedNode != null)
                    {
                        goodsClassInfo.GoodsClassFieldList = GoodsClassFieldIdList;
                        var goodsInfoList = _goodsCenterSao.GetGoodsInfoListSimpleByClassId(goodsClassInfo.ClassId, string.Empty);
                        var fieldList     = _goodsCenterSao.GetFieldListByGoodsClassId(goodsClassInfo.ClassId).ToList();
                        if (goodsInfoList.Count > 0)
                        {
                            if (GoodsClassFieldIdList.Count != fieldList.Count)
                            {
                                RAM.Alert("该分类下有商品,不能更改商品分类的属性");
                                return;
                            }
                        }

                        string errorMessage;
                        var    result = _goodsCenterSao.UpdateClass(goodsClassInfo, out errorMessage);
                        if (result)
                        {
                            // 操作记录添加
                            var personnelInfo = CurrentSession.Personnel.Get();
                            WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, goodsClassInfo.ClassId, "",
                                                       OperationPoint.GoodsClassManager.Edit.GetBusinessInfo(), "");

                            RadTreeNode currentNode = TVGoodsClass.SelectedNode;
                            RadTreeNode aimNode     = TVGoodsClass.FindNodeByValue(goodsClassInfo.ParentClassId.ToString());
                            currentNode.Text     = goodsClassInfo.ClassName;
                            currentNode.ToolTip  = goodsClassInfo.ClassName;
                            currentNode.CssClass = "TreeNode";
                            if (currentNode.Parent != null)
                            {
                                if (goodsClassInfo.ParentClassId != new Guid(currentNode.ParentNode.Value))
                                {
                                    currentNode.ParentNode.Nodes.Remove(currentNode);
                                    aimNode.Nodes.Add(currentNode);
                                    OpenTree(aimNode);
                                }
                            }
                        }
                        else
                        {
                            RAM.Alert("商品分类更改失败!" + errorMessage);
                        }
                    }
                }
                catch
                {
                    RAM.Alert("产品分类更改失败!");
                }
            }
            else
            {
                RAM.Alert("根节点不允许更改!");
            }
        }
        /// <summary>Grid操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SemiStockGrid_OnItemCommand(object sender, GridCommandEventArgs e)
        {
            var item = e.Item as GridDataItem;

            if (item != null)
            {
                var dataItem    = item;
                var stockId     = new Guid(dataItem.GetDataKeyValue("StockId").ToString());
                var storageInfo = _storageRecordDao.GetStorageRecord(stockId);

                //作废
                if (e.CommandName == "Cancellation")
                {
                    #region --> Cancellation
                    var personnelInfo = CurrentSession.Personnel.Get();

                    if (storageInfo.StockType == (int)StorageRecordType.BorrowIn)
                    {
                        string description = "[借入单作废] " + personnelInfo.RealName + "[" +
                                             DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]";

                        var borrowLendInfo = _borrowLendDao.GetBorrowLendInfo(stockId);
                        if (borrowLendInfo != null)
                        {
                            var outStorageInfo = _storageRecordDao.GetStorageRecord(borrowLendInfo.BorrowLendId);
                            if (outStorageInfo != null)
                            {
                                //作废借入返回单
                                _storageManager.NewSetStateStorageRecord(outStorageInfo.StockId, StorageRecordState.Canceled,
                                                                         description);
                            }
                        }
                        //作废借入单
                        _storageManager.NewSetStateStorageRecord(stockId, StorageRecordState.Canceled, description);

                        //入库单作废操作记录添加
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, stockId,
                                                   storageInfo.TradeCode,
                                                   OperationPoint.StorageInManager.Cancel.GetBusinessInfo(), string.Empty);
                    }
                    else
                    {
                        Guid purid = _storageRecordDao.GetStorageRecord(stockId).LinkTradeID;

                        IList <PurchasingDetailInfo> dlist = _purchasingDetail.Select(purid);
                        var purchasingManager = new PurchasingManager(_purchasing, null, null, null, null);
                        using (var ts = new TransactionScope(TransactionScopeOption.Required))
                        {
                            if (dlist.Count > 0)
                            {
                                bool flag = true;
                                if (dlist.Any(dInfo => dInfo.RealityQuantity >= 1))
                                {
                                    purchasingManager.PurchasingUpdate(purid, PurchasingState.PartComplete);
                                    flag = false;
                                }
                                if (flag)
                                {
                                    purchasingManager.PurchasingUpdate(purid, PurchasingState.Purchasing);
                                }
                            }
                            string description = "[入库作废] " + CurrentSession.Personnel.Get().RealName + "[" +
                                                 DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]";
                            _storageManager.NewSetStateStorageRecord(stockId, StorageRecordState.Canceled, description);
                            //入库单作废操作记录添加
                            WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, stockId,
                                                       storageInfo.TradeCode,
                                                       OperationPoint.StorageInManager.Cancel.GetBusinessInfo(), string.Empty);
                            ts.Complete();
                        }
                    }

                    #endregion
                }

                RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
        }
        /// <summary>Grid操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SemiStockGrid_OnItemCommand(object sender, GridCommandEventArgs e)
        {
            var item = e.Item as GridDataItem;

            if (item != null)
            {
                var dataItem    = item;
                var stockId     = new Guid(dataItem.GetDataKeyValue("StockId").ToString());
                var storageInfo = _storageRecordDao.GetStorageRecord(stockId);

                //作废
                if (e.CommandName == "Cancellation")
                {
                    #region --> Cancellation
                    var personnelInfo = CurrentSession.Personnel.Get();

                    if (storageInfo.StockType == (int)StorageRecordType.LendOut)
                    {
                        string description = "[借出单作废] " + personnelInfo.RealName + "[" +
                                             DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]";

                        var borrowLendInfo = _borrowLendDao.GetBorrowLendInfo(stockId);
                        if (borrowLendInfo != null)
                        {
                            var outStorageInfo = _storageRecordDao.GetStorageRecord(borrowLendInfo.BorrowLendId);
                            if (outStorageInfo != null)
                            {
                                //作废借出返回单
                                _storageManager.NewSetStateStorageRecord(outStorageInfo.StockId,
                                                                         StorageRecordState.Canceled,
                                                                         description);
                            }
                        }
                        //作废借出单
                        _storageManager.NewSetStateStorageRecord(stockId, StorageRecordState.Canceled, description);

                        //入库单作废操作记录添加
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, stockId,
                                                   storageInfo.TradeCode,
                                                   OperationPoint.StorageInManager.Cancel.GetBusinessInfo(), string.Empty);
                    }
                    else
                    {
                        string description = "[出库作废] " + CurrentSession.Personnel.Get().RealName + "[" +
                                             DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]";
                        _storageManager.NewSetStateStorageRecord(stockId, StorageRecordState.Canceled, description);
                        //入库单作废操作记录添加
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, stockId,
                                                   storageInfo.TradeCode,
                                                   OperationPoint.StorageInManager.Cancel.GetBusinessInfo(), string.Empty);
                    }

                    #endregion
                }
                else if (e.CommandName == "Validation")
                {
                    //售后确认
                    #region  -->Validation

                    StorageRecordInfo storageRecordInfo = _storageRecordDao.GetStorageRecord(stockId);
                    var  stockValidation     = (CheckBox)dataItem.FindControl("CB_StockValidation");
                    bool stockValidationType = stockValidation.Checked;
                    _storageRecordDao.UpdateStorageRecordDetailByStockId(stockId, stockValidationType);

                    var personnelInfo = CurrentSession.Personnel.Get();
                    //出库确认添加操作记录添加
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, stockId, storageRecordInfo.TradeCode, OperationPoint.StorageOutManager.Confirm.GetBusinessInfo(), string.Empty);

                    #endregion
                }

                RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
        }
        protected void Rad_invoce_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var                    dataItem  = e.Item as GridDataItem;
                var                    invoiceid = new Guid(dataItem.GetDataKeyValue("InvoiceId").ToString());
                IGoodsOrder            order     = new GoodsOrder(GlobalConfig.DB.FromType.Read);
                IList <GoodsOrderInfo> infos     = order.GetInvoiceGoodsOrderList(invoiceid);
                if (infos == null || infos.Count == 0)
                {
                    throw new NotImplementedException("invoiceid" + invoiceid + "--方法GetInvoiceGoodsOrderList(invoiceid)为空");
                }
                if ("delete" == e.CommandName)
                {
                    //ibll.SetInvoiceState(invoiceid, InvoiceState.Cancel, "该发票存在重复,因此取消该发票![" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    Invoice.WriteInstance.SetInvoiceState(invoiceid, InvoiceState.Cancel, CurrentSession.Personnel.Get().RealName);
                    sync.SyncSetInvoiceState(infos[0].SaleFilialeId, invoiceid, InvoiceState.Cancel, true, "该发票存在重复,因此取消该发票![" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]");
                }
                else if ("waste" == e.CommandName)
                {
                    //var success = ibll.SetInvoiceState(invoiceid, InvoiceState.Waste, "该发票财务确认作废.[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    var success = Invoice.WriteInstance.SetInvoiceState(invoiceid, InvoiceState.Waste, CurrentSession.Personnel.Get().RealName);
                    if (success)
                    {
                        var personnelInfo = CurrentSession.Personnel.Get();
                        //发票汇总允许作废操作记录添加
                        var invoiceInfo = Invoice.WriteInstance.GetInvoice(invoiceid);
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceid, invoiceInfo == null ? "" : invoiceInfo.InvoiceNo.ToMendString(8),
                                                   OperationPoint.InvoiceStatistics.AllowScrap.GetBusinessInfo(), string.Empty);

                        sync.SyncSetInvoiceState(infos[0].SaleFilialeId, invoiceid, InvoiceState.Waste, true,
                                                 "该发票财务确认作废.[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]");
                    }
                    else
                    {
                        RAM.Alert("发票拒绝作废,有可能发票已经报送税务!");
                    }
                }
                else if ("return" == e.CommandName)
                {
                    //ibll.SetInvoiceState(invoiceid, InvoiceState.Success, "该发票财务拒绝作废.状态返回已开[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "]", CurrentSession.Personnel.Get().RealName);
                    Invoice.WriteInstance.UpdateSetInvoiceState(invoiceid, InvoiceState.Success, CurrentSession.Personnel.Get().RealName);

                    var invoiceInfo   = Invoice.WriteInstance.GetInvoice(invoiceid);
                    var personnelInfo = CurrentSession.Personnel.Get();
                    //发票汇总财务拒绝作废操作记录添加
                    WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, invoiceid, invoiceInfo == null ? "" : invoiceInfo.InvoiceNo.ToMendString(8),
                                               OperationPoint.InvoiceStatistics.RefuseScrap.GetBusinessInfo(), string.Empty);
                }
                rad_invoce.Rebind();
            }
            if (e.CommandName == "Search")
            {
                if (RcbKindType.SelectedValue == string.Format("{0}", (Byte)InvoiceKindType.Electron))
                {
                    RAM.Alert("此功能只适用于纸质发票!");
                }
                else
                {
                    AnomalyInvoce();
                    rad_invoce.Rebind();
                }
            }
        }
示例#14
0
        //添加属性
        protected void FieldGrid_InsertCommand(object sender, GridCommandEventArgs e)
        {
            var       editedItem = (GridEditableItem)e.Item;
            var       fieldId    = Guid.NewGuid();
            Guid      parentfieldId;
            string    fieldName;
            string    fieldValue;
            FieldInfo fieldInfo;

            switch (editedItem.OwnerTableView.DataMember)
            {
            case "TopField":
            {
                parentfieldId = Guid.Empty;
                fieldName     = ((TextBox)editedItem.FindControl("TB_FieldName")).Text;
                fieldValue    = ((TextBox)editedItem.FindControl("TB_FieldValue")).Text;

                try
                {
                    fieldInfo = new FieldInfo
                    {
                        FieldId       = fieldId,
                        ParentFieldId = parentfieldId,
                        FieldName     = fieldName,
                        FieldValue    = fieldValue
                    };

                    string errorMessage;
                    var    result = _goodsFieldSao.AddField(fieldInfo, out errorMessage);
                    if (result)
                    {
                        //商品属性添加操作记录添加
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, fieldId, "",
                                                   OperationPoint.GoodsAttributeManager.Add.GetBusinessInfo(), string.Empty);
                        //WebControl.AddCommodityAttributeOperation(HRS.Enum.OperationTypePoint.OperationLogTypeEnum.CommodityAttribute, CurrentSession.Personnel.Get().PersonnelId, fieldId, fieldName + fieldValue, HRS.Enum.OperationTypePoint.CommodityAttributeState.AddAttribute, string.Empty);
                        FieldGrid.Rebind();
                    }
                    else
                    {
                        RAM.Alert("操作无效!" + errorMessage);
                    }
                }
                catch
                {
                    RAM.Alert("商品属性信息添加失败!");
                }
            }
            break;

            case "CombField":
            {
                GridDataItem parentItem = editedItem.OwnerTableView.ParentItem;
                parentfieldId = new Guid(parentItem.GetDataKeyValue("FieldId").ToString());
                fieldName     = ((Label)parentItem.FindControl("LB_FieldName")).Text;
                fieldValue    = ((TextBox)editedItem.FindControl("TB_FieldValue")).Text;
                try
                {
                    fieldInfo = new FieldInfo
                    {
                        FieldId       = fieldId,
                        ParentFieldId = parentfieldId,
                        FieldName     = fieldName,
                        FieldValue    = fieldValue
                    };

                    string errorMessage;
                    var    result = _goodsFieldSao.AddField(fieldInfo, out errorMessage);
                    if (result)
                    {
                        //商品属性添加操作记录添加
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, fieldId, "",
                                                   OperationPoint.GoodsAttributeManager.Add.GetBusinessInfo(), string.Empty);
                        //WebControl.AddCommodityAttributeOperation(HRS.Enum.OperationTypePoint.OperationLogTypeEnum.CommodityAttribute, CurrentSession.Personnel.Get().PersonnelId, fieldId, fieldName + fieldValue, HRS.Enum.OperationTypePoint.CommodityAttributeState.AddAttribute, string.Empty);
                        editedItem.OwnerTableView.Rebind();
                    }
                    else
                    {
                        RAM.Alert("操作无效!" + errorMessage);
                    }
                }
                catch
                {
                    RAM.Alert("商品属性信息添加失败!");
                }
            }
            break;
            }
        }
        // 采购中
        protected void IbnPurchasing_Click(object sender, EventArgs eventArgs)
        {
            bool isHave      = false;
            var  codeManager = new CodeManager();

            foreach (GridDataItem dataItem in RG_DebitNote.Items)
            {
                var purchasingId      = new Guid(dataItem.GetDataKeyValue("PurchasingId").ToString());
                var personResponsible = new Guid(dataItem.GetDataKeyValue("PersonResponsible").ToString());
                var cbCheck           = (CheckBox)dataItem.FindControl("CB_Check");
                if (cbCheck.Checked)
                {
                    using (var ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        isHave = true;
                        _debitNoteDao.UpdateDebitNoteStateByPurchasingId(purchasingId, (int)DebitNoteState.Purchasing);
                        //生成采购单
                        DebitNoteInfo debitNoteInfo = _debitNoteDao.GetDebitNoteInfo(purchasingId) ?? new DebitNoteInfo();
                        IList <DebitNoteDetailInfo> debitNoteDetailList = _debitNoteDao.GetDebitNoteDetailList(purchasingId);
                        CompanyCussentInfo          companyCussentInfo  = CompanyCussentList.FirstOrDefault(w => w.CompanyId == debitNoteInfo.CompanyId);
                        //var warehouseInfo = WarehouseManager.Get(debitNoteInfo.WarehouseId);
                        PersonnelInfo  personnelInfo     = PersonnelList.FirstOrDefault(w => w.PersonnelId == debitNoteInfo.PersonResponsible) ?? new PersonnelInfo(null);
                        PurchasingInfo oldPurchasingInfo = _purchasing.GetPurchasingById(purchasingId);
                        var            realName          = CurrentSession.Personnel.Get().RealName;
                        var            filialeId         = string.IsNullOrWhiteSpace(debitNoteInfo.PurchasingNo) || debitNoteInfo.PurchasingNo == "-"?FilialeManager.GetHeadList().First(ent => ent.Name.Contains("可得")).ID
                            : _purchasing.GetPurchasingList(debitNoteInfo.PurchasingNo).FilialeID;
                        var pInfo = new PurchasingInfo
                        {
                            PurchasingID    = Guid.NewGuid(),
                            PurchasingNo    = codeManager.GetCode(CodeType.PH),
                            CompanyID       = debitNoteInfo.CompanyId,
                            CompanyName     = companyCussentInfo == null ? "" : companyCussentInfo.CompanyName,
                            FilialeID       = filialeId,
                            WarehouseID     = debitNoteInfo.WarehouseId,
                            PurchasingState = (int)PurchasingState.Purchasing,
                            PurchasingType  = (int)PurchasingType.Custom,
                            StartTime       = DateTime.Now,
                            EndTime         = DateTime.MaxValue,
                            //Description = "[采购类别:{0}赠品借记单][对应采购单号" + debitNoteInfo.PurchasingNo + "]" + CurrentSession.Personnel.Get().RealName,
                            Description         = string.Format("[采购类别:{0},赠品借记单对应采购单号{1};采购人:{2}]", EnumAttribute.GetKeyName(PurchasingType.Custom), debitNoteInfo.PurchasingNo, realName),
                            PmId                = personnelInfo.PersonnelId,
                            PmName              = personnelInfo.RealName,
                            ArrivalTime         = oldPurchasingInfo.ArrivalTime,
                            PersonResponsible   = personResponsible,
                            PurchasingFilialeId = filialeId
                        };
                        IList <PurchasingDetailInfo> purchasingDetailList = new List <PurchasingDetailInfo>();
                        if (debitNoteDetailList.Count > 0)
                        {
                            List <Guid> goodsIdOrRealGoodsIdList  = debitNoteDetailList.Select(w => w.GoodsId).Distinct().ToList();
                            Dictionary <Guid, GoodsInfo> dicGoods = _goodsCenterSao.GetGoodsBaseListByGoodsIdOrRealGoodsIdList(goodsIdOrRealGoodsIdList);
                            if (dicGoods != null && dicGoods.Count > 0)
                            {
                                foreach (var debitNoteDetailInfo in debitNoteDetailList)
                                {
                                    bool hasKey = dicGoods.ContainsKey(debitNoteDetailInfo.GoodsId);
                                    if (hasKey)
                                    {
                                        GoodsInfo goodsBaseInfo = dicGoods.FirstOrDefault(w => w.Key == debitNoteDetailInfo.GoodsId).Value;
                                        // 获取商品的60、30、11天销量
                                        var purchasingDetailInfo = _purchasingDetail.GetChildGoodsSale(debitNoteDetailInfo.GoodsId, debitNoteInfo.WarehouseId, DateTime.Now, pInfo.PurchasingFilialeId) ?? new PurchasingDetailInfo();
                                        var durchasingDetailInfo = new PurchasingDetailInfo
                                        {
                                            PurchasingID        = pInfo.PurchasingID,
                                            PurchasingGoodsID   = Guid.NewGuid(),
                                            GoodsID             = debitNoteDetailInfo.GoodsId,
                                            GoodsName           = debitNoteDetailInfo.GoodsName,
                                            GoodsCode           = goodsBaseInfo.GoodsCode,
                                            Specification       = debitNoteDetailInfo.Specification,
                                            CompanyID           = pInfo.CompanyID,
                                            Price               = debitNoteDetailInfo.Price,
                                            PlanQuantity        = debitNoteDetailInfo.GivingCount,
                                            RealityQuantity     = 0,
                                            State               = 0,
                                            Description         = "",
                                            Units               = goodsBaseInfo.Units,
                                            PurchasingGoodsType = (int)PurchasingGoodsType.Gift,
                                            SixtyDaySales       = purchasingDetailInfo.SixtyDaySales,
                                            ThirtyDaySales      = purchasingDetailInfo.ThirtyDaySales,
                                            ElevenDaySales      = purchasingDetailInfo.ElevenDaySales == 0 ? 0 : purchasingDetailInfo.ElevenDaySales, // 11 //日均销量(11天)
                                            CPrice              = debitNoteDetailInfo.Price
                                        };
                                        purchasingDetailList.Add(durchasingDetailInfo);
                                    }
                                }
                            }
                        }
                        if (purchasingDetailList.Count > 0)
                        {
                            _debitNoteDao.UpdateDebitNoteNewPurchasingIdByPurchasingId(purchasingId, pInfo.PurchasingID);
                            _purchasing.PurchasingInsert(pInfo);
                            _purchasing.PurchasingUpdateIsOut(pInfo.PurchasingID);
                            //报备管理生成采购单操作记录添加
                            WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, pInfo.PurchasingID, pInfo.PurchasingNo,
                                                       OperationPoint.ReportManage.DebitToAddPurchasingList.GetBusinessInfo(), string.Empty);
                            var purchasingDetailManager = new PurchasingDetailManager(_purchasingDetail, _purchasing);
                            purchasingDetailManager.Save(purchasingDetailList);
                        }
                        ts.Complete();
                    }
                }
            }
            if (isHave == false)
            {
                RAM.Alert("未勾选借记单!");
            }
            else
            {
                RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
        }
示例#16
0
        protected void RgCheckInfoItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Search")
            {
                var ddlStatus     = e.Item.FindControl("DDL_CheckState") as DropDownList;
                var rdpstart      = e.Item.FindControl("RDP_StartTime") as RadDatePicker;
                var rdpend        = e.Item.FindControl("RDP_EndTime") as RadDatePicker;
                var tboxNo        = e.Item.FindControl("TB_CompanyFundReciptNO") as TextBox;
                var saleFilialeId = e.Item.FindControl("DdlSaleFiliale") as DropDownList;
                var bankAccountId = e.Item.FindControl("DdlBankAccount") as DropDownList;
                if (saleFilialeId != null)
                {
                    SelectSaleFilialeId = saleFilialeId.SelectedValue;
                }
                if (bankAccountId != null)
                {
                    SelectBankAccountId = bankAccountId.SelectedValue;
                }
                if (rdpstart != null)
                {
                    if (rdpstart.SelectedDate != null)
                    {
                        StartTime = rdpstart.SelectedDate.Value;
                    }
                }
                if (rdpend != null)
                {
                    if (rdpend.SelectedDate != null)
                    {
                        EndTime = Convert.ToDateTime(rdpend.SelectedDate.Value);
                    }
                }
                if (ddlStatus != null)
                {
                    Status = (CompanyFundReceiptState)int.Parse(ddlStatus.SelectedValue);
                }
                if (tboxNo != null)
                {
                    ReceiptNo = tboxNo.Text;
                }
                RG_CheckInfo.CurrentPageIndex = 0;
                RG_CheckInfo.Rebind();
            }
            var item = e.Item as GridDataItem;

            if (item != null)
            {
                var companyFUndReceiptBll = new BLL.Implement.Inventory.CompanyFundReceipt(_companyFundReceipt);
                if (e.CommandName == "DemandReceipt")
                {
                    if (isdo.Value == "false")
                    {
                        return;
                    }
                    var dataItem = item;
                    try
                    {
                        var    receiptId = new Guid(dataItem.GetDataKeyValue("ReceiptID").ToString());
                        var    receiptNo = dataItem.GetDataKeyValue("ReceiptNo").ToString();
                        string remark    = WebControl.RetrunUserAndTime("索取发票,待认证");
                        companyFUndReceiptBll.UpdateFundReceiptState(receiptId, CompanyFundReceiptState.WaitAttestation, remark, CurrentSession.Personnel.Get().PersonnelId);
                        ////往来收付款确定已收增加操作记录添加
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, receiptId, receiptNo,
                                                   OperationPoint.CurrentReceivedPayment.InvoiceReceived.GetBusinessInfo(), string.Empty);
                    }
                    catch (Exception ex)
                    {
                        RAM.Alert("索取发票失败" + ex.Message);
                        return;
                    }
                    RG_CheckInfo.Rebind();
                }
                if (e.CommandName == "OperateAttestation")
                {
                    if (isdo.Value == "false")
                    {
                        return;
                    }
                    var dataItem = item;
                    try
                    {
                        var    receiptId = new Guid(dataItem.GetDataKeyValue("ReceiptID").ToString());
                        string remark    = WebControl.RetrunUserAndTime("发票已认证");
                        var    personnel = CurrentSession.Personnel.Get();
                        var    result    = companyFUndReceiptBll.UpdateFundReceiptState(receiptId, CompanyFundReceiptState.FinishAttestation, remark, personnel.PersonnelId);
                        if (result > 0)
                        {
                            RAM.Alert("系统提示:发票认证成功!");
                        }
                    }
                    catch (Exception ex)
                    {
                        RAM.Alert("系统提示:发票认证操作异常,详细异常信息:" + ex.Message);
                        return;
                    }
                    RG_CheckInfo.Rebind();
                }
            }
        }
示例#17
0
        protected void RG_CheckInfo_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Search")
            {
                var ddlStatus = e.Item.FindControl("DDL_CheckState") as DropDownList;
                var rdpstart  = e.Item.FindControl("RDP_StartTime") as RadDatePicker;
                var rdpend    = e.Item.FindControl("RDP_EndTime") as RadDatePicker;
                var tboxNo    = e.Item.FindControl("TB_CompanyFundReciptNO") as TextBox;
                if (rdpstart != null)
                {
                    if (rdpstart.SelectedDate != null)
                    {
                        StartTime = rdpstart.SelectedDate.Value;
                    }
                }
                if (rdpend != null)
                {
                    if (rdpend.SelectedDate != null)
                    {
                        EndTime = Convert.ToDateTime(rdpend.SelectedDate.Value.AddDays(1).ToString("yyyy-MM-dd 00:00:00"));
                    }
                }
                if (ddlStatus != null)
                {
                    Status = int.Parse(ddlStatus.SelectedValue);
                }
                if (tboxNo != null)
                {
                    ReceiptNo = tboxNo.Text;
                }
                RG_CheckInfo.CurrentPageIndex = 0;
                RG_CheckInfo.Rebind();
            }
            var item = e.Item as GridDataItem;

            if (item != null)
            {
                if (e.CommandName == "DoFoundReceipt")
                {
                    if (isdo.Value == "false")
                    {
                        return;
                    }
                    var dataItem = item;
                    try
                    {
                        var    receiptId = new Guid(dataItem.GetDataKeyValue("ReceiptID").ToString());
                        var    receiptNo = dataItem.GetDataKeyValue("ReceiptNo").ToString();
                        string remark    = WebControl.RetrunUserAndTime("开具发票,审核");
                        BLL.Implement.Inventory.CompanyFundReceipt.WriteInstance.UpdateFundReceiptState(receiptId, CompanyFundReceiptState.Audited, remark, CurrentSession.Personnel.Get().PersonnelId);
                        //往来收付款开具发票增加操作记录添加
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, receiptId, receiptNo,
                                                   OperationPoint.CurrentReceivedPayment.MakeInvoice.GetBusinessInfo(), string.Empty);
                    }
                    catch (Exception ex)
                    {
                        RAM.Alert("开具发票失败" + ex.Message);
                        return;
                    }
                    RG_CheckInfo.Rebind();
                }
            }
        }
示例#18
0
        // ReSharper disable once FunctionComplexityOverflow
        protected void RG_CheckInfo_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Verification")
            {
                if (RG_CheckInfo.SelectedItems.Count == 0)
                {
                    RAM.Alert("请选择核销数据!");
                    return;
                }
                if (verification.Value == "false")
                {
                    return;
                }
                var builder = new StringBuilder("");
                var companyFundReceiptBll = new BLL.Implement.Inventory.CompanyFundReceipt(_companyFundReceipt);
                foreach (GridDataItem item in RG_CheckInfo.SelectedItems)
                {
                    var receiptId = new Guid(item.GetDataKeyValue("ReceiptID").ToString());
                    var receiptNo = item.GetDataKeyValue("ReceiptNo").ToString();
                    try
                    {
                        string remark = WebControl.RetrunUserAndTime("核销发票转入完成状态");
                        companyFundReceiptBll.UpdateFundReceiptState(receiptId, CompanyFundReceiptState.Finish, remark);
                        //往来收付款核销发票增加操作记录添加
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, receiptId, receiptNo,
                                                   OperationPoint.CurrentReceivedPayment.InvoiceVerification.GetBusinessInfo(), string.Empty);
                    }
                    catch (Exception)
                    {
                        builder.AppendLine(receiptNo);
                    }
                }
                if (builder.Length > 0)
                {
                    RAM.Alert(builder + "核销失败!");
                }
                RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
            if (e.CommandName == "Search")
            {
                var txtManager    = (RadTextBox)e.Item.FindControl("RTB_InvioceManager");
                var rdpstart      = (RadDatePicker)e.Item.FindControl("RDP_StartTime");
                var rdpend        = (RadDatePicker)e.Item.FindControl("RDP_EndTime");
                var tboxNo        = (TextBox)e.Item.FindControl("TB_CompanyFundReciptNO");
                var rcbState      = e.Item.FindControl("DDL_CheckState") as DropDownList;
                var saleFilialeId = e.Item.FindControl("DdlSaleFiliale") as DropDownList;
                var bankAccountId = e.Item.FindControl("DdlBankAccount") as DropDownList;
                if (saleFilialeId != null)
                {
                    SelectSaleFilialeId = saleFilialeId.SelectedValue;
                }
                if (bankAccountId != null)
                {
                    SelectBankAccountId = bankAccountId.SelectedValue;
                }
                if (rcbState != null)
                {
                    State = (CompanyFundReceiptState)Convert.ToInt32(rcbState.SelectedValue);
                }
                if (txtManager.Text != "")
                {
                    List <PersonnelInfo> infoList = _personnelManager.GetList().Where(o => o.RealName.Contains(txtManager.Text)).ToList();
                    if (infoList.Count == 0)
                    {
                        RAM.Alert("该人不存在");
                        return;
                    }
                    InvoicesDemander = infoList[0].PersonnelId;
                }
                else
                {
                    InvoicesDemander = Guid.Empty;
                }
                if (rdpstart != null)
                {
                    if (rdpstart.SelectedDate != null)
                    {
                        StartTime = rdpstart.SelectedDate.Value;
                    }
                }
                if (rdpend != null)
                {
                    if (rdpend.SelectedDate != null)
                    {
                        EndTime = Convert.ToDateTime(rdpend.SelectedDate.Value.AddDays(1).ToString("yyyy-MM-dd 00:00:00"));
                    }
                }
                ReceiptNo = tboxNo.Text;
                RG_CheckInfo.CurrentPageIndex = 0;
                RG_CheckInfo.Rebind();
            }
            var gridDataItem = e.Item as GridDataItem;

            if (gridDataItem != null)
            {
                if (e.CommandName == "DemandReceipt")
                {
                    if (isdo.Value == "false")
                    {
                        return;
                    }
                    var dataItem = gridDataItem;
                    try
                    {
                        var    companyFundReceiptBll = new BLL.Implement.Inventory.CompanyFundReceipt(_companyFundReceipt);
                        var    receiptId             = new Guid(dataItem.GetDataKeyValue("ReceiptID").ToString());
                        var    receiptNo             = dataItem.GetDataKeyValue("ReceiptNo").ToString();
                        string remark = WebControl.RetrunUserAndTime("核销发票转入完成状态");
                        companyFundReceiptBll.UpdateFundReceiptState(receiptId, CompanyFundReceiptState.Finish, remark);
                        //往来收付款核销发票增加操作记录添加
                        var personnelInfo = CurrentSession.Personnel.Get();
                        WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, receiptId, receiptNo,
                                                   OperationPoint.CurrentReceivedPayment.InvoiceVerification.GetBusinessInfo(), string.Empty);
                    }
                    catch (Exception ex)
                    {
                        RAM.Alert("索取发票失败" + ex.Message);
                        return;
                    }
                    RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
            }
        }