Beispiel #1
0
 protected void RtCompanyClassNodeClick(object sender, RadTreeNodeEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Node.Value))
     {
         RG_CheckInfo.Rebind();
     }
 }
Beispiel #2
0
 //查询
 protected void btn_Search_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(DdlSaleFiliale.SelectedValue))
     {
         SelectSaleFilialeId = DdlSaleFiliale.SelectedValue;
     }
     Status    = (CompanyFundReceiptState)int.Parse(DDL_CheckState.SelectedValue);
     ReceiptNo = TB_CompanyFundReciptNO.Text;
     PayType   = int.Parse(DDL_PayType.SelectedValue);
     GridDataBind();
     RG_CheckInfo.CurrentPageIndex = 0;
     RG_CheckInfo.DataBind();
 }
Beispiel #3
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();
                }
            }
        }
Beispiel #4
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 ddlType         = e.Item.FindControl("DDL_ReceivePayType") as DropDownList;
                var ddlBank         = e.Item.FindControl("DDL_Bank") as DropDownList;
                var rdpSExecuteTime = e.Item.FindControl("RDP_SExecuteTime") as RadDatePicker;
                var rdpEExecuteTime = e.Item.FindControl("RDP_EExecuteTime") as RadDatePicker;
                var filialeId       = e.Item.FindControl("DdlSaleFiliale") as DropDownList;
                if (filialeId != null && !string.IsNullOrEmpty(filialeId.SelectedValue))
                {
                    SelectSaleFilialeId = filialeId.SelectedValue;
                }

                #region [申请时间段]
                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"));
                    }
                }
                #endregion

                #region [打款时间段]
                if (rdpSExecuteTime != null)
                {
                    if (rdpSExecuteTime.SelectedDate != null)
                    {
                        SExecuteTime = rdpSExecuteTime.SelectedDate.Value;
                    }
                }
                if (rdpEExecuteTime != null)
                {
                    if (rdpEExecuteTime.SelectedDate != null)
                    {
                        EExecuteTime = Convert.ToDateTime(rdpEExecuteTime.SelectedDate.Value.AddDays(1).ToString("yyyy-MM-dd 00:00:00"));
                    }
                }
                #endregion
                if (ddlType != null)
                {
                    Type = (CompanyFundReceiptType)int.Parse(ddlType.SelectedValue);
                }
                if (ddlStatus != null)
                {
                    Status = (CompanyFundReceiptState)int.Parse(ddlStatus.SelectedValue);
                }
                if (tboxNo != null)
                {
                    ReceiptNo = tboxNo.Text;
                }
                if (ddlBank != null)
                {
                    BankId = new Guid(ddlBank.SelectedValue);
                }
                RG_CheckInfo.CurrentPageIndex = 0;
                RG_CheckInfo.Rebind();
            }
            else if (e.CommandName == "AllDo")
            {
                int num = 0;
                foreach (GridDataItem dataItem in RG_CheckInfo.Items)
                {
                    var cbCheck = (CheckBox)dataItem.FindControl("CB_Check");
                    if (!cbCheck.Checked)
                    {
                        continue;
                    }
                    var    receiptId   = new Guid(dataItem.GetDataKeyValue("ReceiptID").ToString());
                    string remark      = WebControl.RetrunUserAndTime("执行");
                    var    receiptInfo = _companyFundReceipt.GetCompanyFundReceiptInfo(receiptId);
                    if (receiptInfo == null || receiptInfo.ReceiptStatus >= (int)CompanyFundReceiptState.Executed ||
                        string.IsNullOrEmpty(receiptInfo.DealFlowNo) || receiptInfo.PayBankAccountsId == Guid.Empty)
                    {
                        continue;
                    }
                    using (var ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        //付款
                        if (receiptInfo.ReceiptType == (int)CompanyFundReceiptType.Payment)
                        {
                            var accountCount = BankAccountManager.ReadInstance.GetBankAccountsNonce(receiptInfo.PayBankAccountsId);
                            if (accountCount <= 0)
                            {
                                RAM.Alert("帐户余额为0,无法付款!");
                                return;
                            }
                            if (Convert.ToDecimal(accountCount) < receiptInfo.RealityBalance + receiptInfo.Poundage)
                            {
                                RAM.Alert("帐户余额为不足,无法付款!");
                                return;
                            }
                            _companyFundReceipt.UpdateFundReceiptRemark(receiptId, remark);
                            _companyFundReceipt.UpdateFundReceiptState(receiptId, CompanyFundReceiptState.Executed);
                            _companyFundReceipt.SetDateTime(receiptId, 2);
                            if (receiptInfo.Poundage != 0)
                            {
                                _companyFundReceipt.UpdatePoundage(receiptId, receiptInfo.Poundage);
                            }
                        }
                        //收款
                        if (receiptInfo.ReceiptType == (int)CompanyFundReceiptType.Receive)
                        {
                            _companyFundReceipt.UpdateFundReceiptRemark(receiptId, remark);
                            _companyFundReceipt.UpdateFundReceiptState(receiptId, CompanyFundReceiptState.Executed);
                            _companyFundReceipt.SetDateTime(receiptId, 2);
                            if (receiptInfo.Poundage != 0)
                            {
                                _companyFundReceipt.UpdatePoundage(receiptId, receiptInfo.Poundage);
                            }
                        }
                        ts.Complete();
                    }
                    num++;
                }
                if (num == 0)
                {
                    RAM.Alert("请选择");
                }
                RAM.ResponseScripts.Add("setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
        }
        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();
                }
            }
        }
        // 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 + ");");
                }
            }
        }