Пример #1
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();
                }
            }
        }
Пример #2
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 + ");");
                }
            }
        }