示例#1
0
        //发票接收
        protected void imgbtn_Receive_Click(object sender, EventArgs e)
        {
            var    invoice     = ((ImageButton)sender).CommandArgument;
            var    invoiceInfo = invoice.Split(',');
            string invoiceId   = invoiceInfo[0];
            string invoiceType = invoiceInfo[1];
            CompanyFundReceiptInvoiceInfo model =
                _companyFundReceiptInvoice.Getlmshop_CompanyFundReceiptInvoiceByInvoiceId(new Guid(invoiceId));

            if (model.InvoiceState.Equals((int)CompanyFundReceiptInvoiceState.Submit))
            {
                string remark = WebControl.RetrunUserAndTime("【接收发票】");
                if (invoiceType.Equals("1"))
                {
                    _companyFundReceiptInvoice.Updatelmshop_CompanyFundReceiptInvoiceByInvoiceId(remark, new Guid(invoiceId),
                                                                                                 (int)CompanyFundReceiptInvoiceState.Verification);
                }
                else
                {
                    _companyFundReceiptInvoice.Updatelmshop_CompanyFundReceiptInvoiceByInvoiceId(remark, new Guid(invoiceId),
                                                                                                 (int)CompanyFundReceiptInvoiceState.Receive);
                }
                MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
            else
            {
                MessageBox.Show(this, "状态已更新,不允许此操作!");
            }
        }
        //作废
        protected void btn_Del_Click(object sender, EventArgs e)
        {
            var reportId       = ((Button)sender).CommandArgument;
            var costReportInfo = _costReport.GetReportByReportId(new Guid(reportId));

            if (!(costReportInfo.State.Equals((int)CostReportState.Auditing) || costReportInfo.State.Equals((int)CostReportState.AuditingNoPass) || (costReportInfo.ReportKind.Equals((int)CostReportKind.Later) && costReportInfo.State.Equals((int)CostReportState.InvoiceNoPass))))
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    var memo = WebControl.RetrunUserAndTime("[【作废申报】:申报作废;]");
                    _costReport.UpdateReport(new Guid(reportId), (int)CostReportState.Cancel, string.Empty, memo, Guid.Empty);

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, new Guid(reportId), costReportInfo.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    RG_Report.Rebind();
                    ts.Complete();
                }
                catch
                {
                    MessageBox.AppendScript(this, "作废申报失败!");
                }
            }
        }
示例#3
0
 protected void BeforeLoan(CostReportInfo model)
 {
     if (model.IsSystem)
     {
         model.State = (int)CostReportState.AlreadyAuditing;//状态:待付款
     }
     else
     {
         //查询没有付款的票据
         var isPayList = CostReportBillInfoList.Where(p => !p.IsPay);
         if (isPayList.Any())                               //有没有付款的票据
         {
             model.State = (int)CostReportState.NoAuditing; //状态:票据待受理
         }
         else
         {
             if (model.IsLastTime)
             {
                 if (CostReportTravelInfoList.Any() || CostReportTerminiInfoList.Any() || !string.IsNullOrEmpty(model.GoodsCode) || !model.InvoiceId.Equals(Guid.Empty))
                 {
                     model.State = (int)CostReportState.NoAuditing;//状态:票据待受理
                 }
                 else
                 {
                     model.State = (int)CostReportState.AlreadyAuditing;//状态:待付款
                 }
             }
             else
             {
                 model.State = (int)CostReportState.AlreadyAuditing;//状态:待付款
             }
         }
     }
     model.Memo = WebControl.RetrunUserAndTime("[【审核】:审核通过;审核说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]");
 }
示例#4
0
        //费用申报(lmshop_CostReport)
        protected void EditCostReportModel(CostReportInfo model, PersonnelInfo personnelInfo)
        {
            model.ReportNo       = new CodeManager().GetCode(CodeType.RE);
            model.ReportKind     = (int)CostReportKind.FeeIncome;
            model.AssumeBranchId = string.IsNullOrEmpty(ddl_AssumeBranch.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeBranch.SelectedValue);
            model.AssumeGroupId  = string.IsNullOrEmpty(ddl_AssumeGroup.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeGroup.SelectedValue);
            model.AssumeShopId   = string.IsNullOrEmpty(ddl_AssumeShop.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeShop.SelectedValue);
            model.CostsVarieties = string.IsNullOrEmpty(Hid_CostsClass.Value) ? -1 : int.Parse(Hid_CostsClass.Value);
            model.GoodsCode      = string.Empty;
            model.CompanyClassId = string.IsNullOrEmpty(ddl_CompanyClass.SelectedValue) ? Guid.Empty : new Guid(ddl_CompanyClass.SelectedValue);
            model.CompanyId      = string.IsNullOrEmpty(ddl_FeeType.SelectedValue) ? Guid.Empty : new Guid(ddl_FeeType.SelectedValue);
            model.UrgentOrDefer  = int.Parse(rbl_UrgentOrDefer.SelectedValue);
            model.UrgentReason   = model.UrgentOrDefer.Equals(1) ? txt_UrgentReason.Text : string.Empty;
            model.ReportName     = txt_ReportName.Text;
            model.StartTime      = DateTime.Parse(txt_StartTime.Text);
            model.EndTime        = DateTime.Parse(txt_EndTime.Text);
            model.PayCompany     = txt_PayCompany.Text;
            model.ReportCost     = Math.Abs(Decimal.Parse(txt_ReportCost.Text));
            model.RealityCost    = model.ReportCost;
            model.ApplyForCost   = model.ReportCost;
            model.ActualAmount   = model.ReportCost;
            model.CostType       = int.Parse(rbl_CostType.SelectedValue);
            model.Deposit        = 2;
            if (model.CostType.Equals(2))
            {
                model.BankAccountName = txt_BankName.Text.Trim() + "," + txt_SubBankName.Text.Trim();
            }
            model.InvoiceType      = (int)CostReportInvoiceType.WaitCheck;
            model.PayBankAccountId = string.IsNullOrEmpty(rcb_PayBankAccount.SelectedValue) ? Guid.Empty : new Guid(rcb_PayBankAccount.SelectedValue); //结算账号
            model.AssumeFilialeId  = string.IsNullOrEmpty(Hid_AssumeFiliale.Value) ? Guid.Empty : new Guid(Hid_AssumeFiliale.Value);                   //结算公司
            model.ReportMemo       = txt_ReportMemo.Text;

            model.ReportFilialeId   = personnelInfo.FilialeId;
            model.ReportBranchId    = personnelInfo.BranchId;
            model.ReportPersonnelId = personnelInfo.PersonnelId;
            model.State             = (int)CostReportState.Auditing;
            if (string.IsNullOrEmpty(Request.QueryString["ReportId"]))
            {
                model.ReportDate = DateTime.Now;
            }
            model.Memo        = WebControl.RetrunUserAndTime("[【费用收入】:" + txt_ReportMemo.Text + ";]");
            model.IsLastTime  = true;
            model.IsSystem    = false;
            model.ApplyNumber = 1;
            model.IsEnd       = false;

            if (!string.IsNullOrEmpty(rcb_PayBankAccount.SelectedValue))
            {
                var bankAccountInfo = _bankAccounts.GetBankAccounts(new Guid(rcb_PayBankAccount.SelectedValue));
                if (bankAccountInfo != null && bankAccountInfo.IsMain)
                {
                    model.IsOut = true;
                }
                else
                {
                    model.IsOut = false;
                }
            }
        }
示例#5
0
        protected void PayVerification(CostReportInfo model)
        {
            model.State = (int)CostReportState.NoAuditing;//状态:票据待受理

            #region 结算账号
            IBankAccounts bankAccounts    = new BankAccounts(GlobalConfig.DB.FromType.Read);
            var           bankAccountInfo = bankAccounts.GetBankAccounts(model.PayBankAccountId);
            string        payBankAccount  = bankAccountInfo == null ? "暂无结算" : (bankAccountInfo.BankName + "【" + bankAccountInfo.AccountsName + "】");
            #endregion

            model.Memo = WebControl.RetrunUserAndTime("[【审核】:审核通过;审核说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]") + WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");
        }
 protected void VoucherPay(CostReportInfo model, bool need, string payBankAccount)
 {
     if (need)
     {
         model.State      = (int)CostReportState.Complete;
         model.FinishDate = DateTime.Now;
         model.Memo       = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");
     }
     else
     {
         model.State = (int)CostReportState.Pay;
         model.Memo  = WebControl.RetrunUserAndTime("[【待付款】:待支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;]");
     }
 }
示例#7
0
        //审核不通过
        protected void btn_NoPass_Click(object sender, EventArgs e)
        {
            #region 验证数据
            var errorMsg = CheckData();
            if (string.IsNullOrEmpty(txt_AuditingMemo.Text))
            {
                errorMsg += "请填写“审核说明”!";
            }
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, errorMsg);
                return;
            }
            #endregion

            CostReportInfo model = _costReport.GetReportByReportId(new Guid(Request.QueryString["ReportId"]));
            if (model.State != (int)CostReportState.Auditing)
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            var state = (int)CostReportState.AuditingNoPass;
            var memo  = WebControl.RetrunUserAndTime("[【审核】:审核不通过;审核说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]");

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReportBill.Updatelmshop_CostReportBillForPassByReportId(model.ReportId, false);
                    _costReport.UpdateReport(model.ReportId, state, txt_AuditingMemo.Text, memo, Personnel.PersonnelId);
                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "setTimeout(function(){ CloseAndRebind(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
            }
            #endregion
        }
示例#8
0
        //发票认证完成
        protected void imgbtn_Verification_Click(object sender, EventArgs e)
        {
            var invoiceId = ((ImageButton)sender).CommandArgument;
            CompanyFundReceiptInvoiceInfo model =
                _companyFundReceiptInvoice.Getlmshop_CompanyFundReceiptInvoiceByInvoiceId(new Guid(invoiceId));

            if (model.InvoiceState.Equals((int)CompanyFundReceiptInvoiceState.Authenticate))
            {
                string remark = WebControl.RetrunUserAndTime("【发票认证完成】");
                _companyFundReceiptInvoice.Updatelmshop_CompanyFundReceiptInvoiceByInvoiceId(remark, new Guid(invoiceId),
                                                                                             (int)CompanyFundReceiptInvoiceState.Verification);
                MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
            else
            {
                MessageBox.Show(this, "状态已更新,不允许此操作!");
            }
        }
示例#9
0
 //发票批量认证完成
 protected void btn_BatchVerification_Click(object sender, EventArgs e)
 {
     if (Request["ckId"] != null)
     {
         var errorMsg   = new StringBuilder();
         var invoiceIds = Request["ckId"].Split(',');
         foreach (var item in invoiceIds)
         {
             CompanyFundReceiptInvoiceInfo model =
                 _companyFundReceiptInvoice.Getlmshop_CompanyFundReceiptInvoiceByInvoiceId(new Guid(item));
             if (model.InvoiceState != (int)CompanyFundReceiptInvoiceState.Authenticate)
             {
                 errorMsg.Append("发票号码“").Append(model.InvoiceNo).Append("”状态已更新,不允许此操作!").Append("\\n");
                 continue;
             }
             try
             {
                 string remark = WebControl.RetrunUserAndTime("【发票认证完成】");
                 _companyFundReceiptInvoice.Updatelmshop_CompanyFundReceiptInvoiceByInvoiceId(remark,
                                                                                              new Guid(item), (int)CompanyFundReceiptInvoiceState.Verification);
             }
             catch
             {
                 errorMsg.Append("发票号码“").Append(model.InvoiceNo).Append("”保存失败!").Append("\\n");
             }
         }
         if (!string.IsNullOrEmpty(errorMsg.ToString()))
         {
             MessageBox.Show(this, errorMsg.ToString());
         }
         MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
     }
     else
     {
         MessageBox.Show(this, "请选择相关数据!");
     }
 }
示例#10
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 + ");");
            }
        }
示例#11
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();
                }
            }
        }
 protected void FeeIncome(CostReportInfo model, string payBankAccount)
 {
     model.State      = (int)CostReportState.Complete;
     model.FinishDate = DateTime.Now;
     model.Memo       = WebControl.RetrunUserAndTime("[【已收款】:已收入" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");
 }
        protected void BeforeLoan(CostReportInfo model, bool need, string payBankAccount, out bool execute)
        {
            execute = false;
            if (need || (model.IsSystem && model.RealityCost < 0))
            {
                if (model.Deposit.Equals(1))
                {
                    model.State      = (int)CostReportState.Complete;
                    model.FinishDate = DateTime.Now;
                    model.DepositNo  = new CodeManager().GetCode(CodeType.RE);
                    model.Memo       = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");
                }
                else
                {
                    if (model.IsSystem)
                    {
                        if (model.RealityCost > 0)
                        {
                            model.Memo = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");
                        }
                        else if (model.RealityCost < 0)
                        {
                            execute    = true;
                            model.Memo = WebControl.RetrunUserAndTime("[【已收款】:已收入" + WebControl.RemoveDecimalEndZero(Math.Abs(model.RealityCost)) + "元;结算账号:" + payBankAccount + ";]");
                        }
                        model.State      = (int)CostReportState.Complete;
                        model.FinishDate = DateTime.Now;
                    }
                    else if (model.IsLastTime)
                    {
                        model.Memo = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");

                        //预借款时,可能出现(“票据金额”=“申请金额”,“票据金额”>“申请金额”,“票据金额”<“申请金额”)三种情况
                        var difference = model.ApplyForCost - model.ActualAmount;//“票据金额”和“申请金额”的差额
                        if (difference == 0 || difference > 0)
                        {
                            model.RealityCost = difference;
                            model.State       = (int)CostReportState.Complete;
                            model.FinishDate  = DateTime.Now;
                        }
                        else if (difference < 0)
                        {
                            model.RealityCost = difference;
                            model.ReportMemo  = "打款金额多了" + ERP.UI.Web.Common.WebControl.RemoveDecimalEndZero(Math.Abs(difference)) + "元";
                            model.State       = (int)CostReportState.WaitVerify;

                            #region 插入系统生成的金额
                            CostReportAmountInfoList = _costReportAmount.GetmShop_CostReportAmountByReportId(model.ReportId).Where(p => !p.IsSystem).ToList();
                            var maxNum = CostReportAmountInfoList.Any() ? CostReportAmountInfoList.Select(p => p.Num).Max() : 0;
                            CostReportAmountInfoList.Add(new CostReportAmountInfo
                            {
                                AmountId = Guid.NewGuid(),
                                ReportId = Guid.Empty,
                                Num      = maxNum + 1,
                                Amount   = difference,
                                IsPay    = true,
                                IsSystem = true
                            });
                            model.IsSystem = true;
                            #endregion
                        }
                    }
                    else
                    {
                        model.ApplyNumber = ++model.ApplyNumber;
                        model.State       = (int)CostReportState.CompletedMayApply;
                        model.Memo        = WebControl.RetrunUserAndTime("[【已付款】:已支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";]");
                    }
                }
            }
            else
            {
                model.State = (int)CostReportState.Pay;
                model.Memo  = WebControl.RetrunUserAndTime("[【待付款】:待支付" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;]");
            }
        }
示例#14
0
 protected void FeeIncome(CostReportInfo model)
 {
     model.State = (int)CostReportState.WaitVerify;
     model.Memo  = WebControl.RetrunUserAndTime("[【审核】:审核通过;审核说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]");
 }
示例#15
0
 protected void VoucherPay(CostReportInfo model)
 {
     model.State = (int)CostReportState.NoAuditing;//状态:票据待受理
     model.Memo  = WebControl.RetrunUserAndTime("[【审核】:审核通过;审核说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]");
 }
示例#16
0
        //保存数据
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            #region 验证数据
            var errorMsg = CheckData();
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, errorMsg);
                return;
            }
            #endregion

            //CostReportState.WaitVerify 此状态对于“个人”是【待付款确认】,对于“公司”是【待收款确认】
            CostReportInfo model = _costReport.GetReportByReportId(new Guid(Request.QueryString["ReportId"]));
            if (model.State != (int)CostReportState.WaitVerify)
            {
                MessageBox.Show(this, "该单据状态已更新,不允许此操作!");
                return;
            }

            #region 额外可修改的项
            UpdateItem(model);
            #endregion

            model.AssumeBranchId   = string.IsNullOrEmpty(ddl_AssumeBranch.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeBranch.SelectedValue);
            model.AssumeGroupId    = string.IsNullOrEmpty(ddl_AssumeGroup.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeGroup.SelectedValue);
            model.AssumeShopId     = string.IsNullOrEmpty(ddl_AssumeShop.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeShop.SelectedValue);
            model.PayBankAccountId = string.IsNullOrEmpty(rcb_PayBankAccount.SelectedValue) ? Guid.Empty : new Guid(rcb_PayBankAccount.SelectedValue);
            model.AssumeFilialeId  = string.IsNullOrEmpty(ddl_AssumeFiliale.SelectedValue) ? Guid.Empty : new Guid(ddl_AssumeFiliale.SelectedValue);
            model.Poundage         = string.IsNullOrEmpty(txt_Poundage.Text) ? 0 : decimal.Parse(txt_Poundage.Text);
            model.TradeNo          = txt_TradeNo.Text;
            model.AuditingMemo     = txt_AuditingMemo.Text;
            model.Memo             = WebControl.RetrunUserAndTime("[【保存数据】:已保存;收款说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]");
            var bankAccountInfo = _bankAccounts.GetBankAccounts(new Guid(rcb_PayBankAccount.SelectedValue));
            if (bankAccountInfo != null && bankAccountInfo.IsMain)
            {
                model.IsOut = true;
            }
            else
            {
                model.IsOut = false;
            }

            #region 保存数据
            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    _costReport.UpdateReport(model);

                    //添加操作日志
                    _operationLogManager.Add(Personnel.PersonnelId, Personnel.RealName, model.ReportId, model.ReportNo, OperationPoint.CostDeclare.AuditDeclare.GetBusinessInfo(), 1, "");

                    ts.Complete();
                    MessageBox.AppendScript(this, "parent.SetFlag();CloseAndRebind();");
                }
                catch
                {
                    MessageBox.Show(this, "保存失败!");
                }
                finally
                {
                    ts.Dispose();
                }
            }
            #endregion
        }
示例#17
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 + ");");
                }
            }
        }
示例#18
0
 protected void FeeIncome(CostReportInfo model, string payBankAccount)
 {
     model.State      = (int)CostReportState.Complete;
     model.FinishDate = DateTime.Now;
     model.Memo       = WebControl.RetrunUserAndTime("[【已收款】:已收入" + WebControl.RemoveDecimalEndZero(model.RealityCost) + "元;结算账号:" + payBankAccount + ";收款说明:" + (string.IsNullOrEmpty(txt_AuditingMemo.Text) ? "暂无说明" : txt_AuditingMemo.Text) + ";]");
 }
示例#19
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();
                }
            }
        }
示例#20
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 + ");");
                }
            }
        }