Ejemplo n.º 1
0
        //初始化页面数据
        protected void LoadBillData(string billId)
        {
            CostReportBillInfo model = CostReportBillInfo = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(billId));

            txt_BillUnit.Text    = model.BillUnit;
            txt_BillDate.Text    = DateTime.Parse(model.BillDate.ToString()).ToString("yyyy-MM-dd");
            txt_NoTaxAmount.Text = model.NoTaxAmount.ToString(CultureInfo.InvariantCulture);
            txt_Tax.Text         = model.Tax.ToString(CultureInfo.InvariantCulture);
            txt_BillNo.Text      = model.BillNo;
            txt_TaxAmount.Text   = model.TaxAmount.ToString(CultureInfo.InvariantCulture);
            txt_BillCode.Text    = model.BillCode;
            txt_BillState.Text   = EnumAttribute.GetKeyName((CostReportBillState)model.BillState);
            txt_Memo.Text        = model.Memo;

            var invoiceType = Request.QueryString["InvoiceType"];

            if (int.Parse(invoiceType).Equals((int)CostReportInvoiceType.VatInvoice))
            {
                VatInvoice.Visible = true;
            }
            else if (int.Parse(invoiceType).Equals((int)CostReportInvoiceType.Voucher))
            {
                lit_BillNo.Text       = "收据";
                lit_TaxAmount.Visible = BillCode.Visible = txtBillCode.Visible = false;
            }
        }
Ejemplo n.º 2
0
 private void BindValue(InvoiceApplyInfo applyInfo)
 {
     TbAddress.Text           = applyInfo.Address;
     TbTelephone.Text         = applyInfo.Telephone;
     TbReceiver.Text          = applyInfo.Receiver;
     TbApplyRemark.Text       = applyInfo.ApplyRemark;
     TbRetreat.Text           = applyInfo.RetreatRemark;
     TbTitleType.Text         = EnumAttribute.GetKeyName((ApplyInvoiceTitleType)applyInfo.InvoiceTitleType);
     TbTitle.Text             = applyInfo.Title;
     TbAmount.Text            = applyInfo.Amount.ToString("#0.00");
     TbPerAmount.Text         = applyInfo.Amount.ToString("#0.00");
     TbOrderNo.Text           = applyInfo.TradeCode;
     TbThirdPartyOrderNo.Text = applyInfo.ThirdPartyCode;
     BtSave.Text = IsAudit ? "核准" : "开票";
     BtBack.Text = IsAudit ? "核退" : "退回";
     IsSpecial   = applyInfo.ApplyType == (int)ApplyInvoiceType.Special;
     if (applyInfo.InvoiceTitleType == (int)ApplyInvoiceTitleType.Company)
     {
         TbContactAddress.Text = applyInfo.ContactAddress;
         TbContactPhone.Text   = applyInfo.ContactTelephone;
         TbTaxNumber.Text      = applyInfo.TaxpayerNumber;
         TbBankName.Text       = applyInfo.BankName;
         TbBankAccountNo.Text  = applyInfo.BankAccountNo;
         IsCompany             = true;
     }
     else
     {
         IsCompany = false;
     }
     RAM.ResponseScripts.Add(string.Format("load({0},{1});", !IsCompany?1:0, IsAudit ? 0 : 1));
 }
Ejemplo n.º 3
0
 protected string GetPaymentTypeName(object paymentType)
 {
     if (Convert.ToInt32(paymentType) > Convert.ToInt32(PaymentType.SwipeCard))
     {
         return("待设置");
     }
     return(EnumAttribute.GetKeyName((PaymentType)paymentType));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 得到采购类型
 /// </summary>
 /// <param name="purchaseType"></param>
 /// <returns></returns>
 protected string GetPurchaseTypeName(object purchaseType)
 {
     if (purchaseType == null || purchaseType.ToString() == "0" || string.IsNullOrEmpty(purchaseType.ToString()))
     {
         return("-");
     }
     return(EnumAttribute.GetKeyName((PurchaseType)purchaseType));
 }
 protected string GetState(object state)
 {
     try
     {
         return(EnumAttribute.GetKeyName((MemberBalanceChangeStateEnum)state));
     }
     catch (Exception)
     {
         return("未知状态");
     }
 }
Ejemplo n.º 6
0
        ///<summary>
        /// 审核状态绑定
        ///</summary>
        public void BindAuditType()
        {
            var saleStockTypes = (Dictionary <int, string>)EnumAttribute.GetDict <PurchaseSetLogStatue>();

            foreach (KeyValuePair <int, string> kvp in saleStockTypes)
            {
                var item = new RadComboBoxItem(EnumAttribute.GetKeyName((PurchaseSetLogStatue)kvp.Key), string.Format("{0}", kvp.Key));
                RCB_AuditStatue.Items.Add(item);
            }
            RCB_AuditStatue.Items.Insert(0, new RadComboBoxItem("全部", "-1"));
        }
Ejemplo n.º 7
0
 protected string GetOrderState(Object orderState)
 {
     try
     {
         return(EnumAttribute.GetKeyName((OrderState)orderState));
     }
     catch (Exception)
     {
         return("未知状态");
     }
 }
        /// <summary>
        /// 单据类型
        /// </summary>
        private void BindStorageType()
        {
            var dicStorageType = new Dictionary <int, string>();

            dicStorageType.Add((int)StorageRecordType.BorrowIn, EnumAttribute.GetKeyName((StorageRecordType.BorrowIn)));
            dicStorageType.Add((int)StorageRecordType.SellReturnIn, EnumAttribute.GetKeyName((StorageRecordType.SellReturnIn)));
            dicStorageType.Add((int)StorageRecordType.BuyStockIn, EnumAttribute.GetKeyName((StorageRecordType.BuyStockIn)));
            dicStorageType.Add((int)StorageRecordType.LendIn, EnumAttribute.GetKeyName((StorageRecordType.LendIn)));
            DDL_StorageType.DataSource     = dicStorageType;
            DDL_StorageType.DataTextField  = "Value";
            DDL_StorageType.DataValueField = "Key";
            DDL_StorageType.DataBind();
            DDL_StorageType.Items.Insert(0, new ListItem("", ""));
        }
Ejemplo n.º 9
0
        ///<summary>
        /// 获取银行账户列表
        ///</summary>
        ///<returns></returns>
        public IList <BankAccountInfo> GetBankAccountsList()
        {
            var selectSalePlatformInfo = CacheCollection.SalePlatform.Get(TargetId);

            if (selectSalePlatformInfo != null)
            {
                var bankAccountList = _bankAccountDaoWrite.GetListByTargetId(selectSalePlatformInfo.FilialeId);
                #region [已注释] 允许多绑
                //foreach (var bankAccountsInfo in bankAccountList)
                //{
                //    var iteminfo = new BankAccountsInfo
                //                    {
                //                        BankAccountsId = bankAccountsInfo.BankAccountsId,
                //                        Accounts =bankAccountsInfo.Accounts + " => " + bankAccountsInfo.BankName + " 【" +ERP.Enum.Attribute.EnumAttribute.GetKeyName((PaymentType) bankAccountsInfo.PaymentType) +"】"
                //                    };
                //    needBankAccountList.Add(iteminfo);
                //}
                #endregion

                #region  每个账号只对应一个公司
                var salePlatformList         = CacheCollection.SalePlatform.GetListByFilialeId(selectSalePlatformInfo.FilialeId);
                var bindingedBankAccountList = new List <BankAccountInfo>();
                foreach (var salePlatformInfo in salePlatformList)
                {
                    bindingedBankAccountList.AddRange(BankAccountManager.ReadInstance.GetListByTargetId(salePlatformInfo.ID));
                }

                #endregion
                return((from info in bankAccountList
                        where bindingedBankAccountList.All(ent => ent.BankAccountsId != info.BankAccountsId)
                        select new BankAccountInfo
                {
                    BankAccountsId = info.BankAccountsId,
                    Accounts = info.Accounts + " => " + info.BankName + "【" + EnumAttribute.GetKeyName((PaymentType)info.PaymentType) + "】"
                }).ToList());
            }
            var filiale = CacheCollection.Filiale.Get(TargetId);
            IList <BankAccountInfo> oldlist = filiale != null && filiale.FilialeTypes.Contains((int)MIS.Enum.FilialeType.SaleCompany) ?
                                              _bankAccountsWrite.GetBankAccountsNoBindingList().Where(b => b.IsUse).ToList():_bankAccountsWrite.GetBankAccountsList(new[] { PaymentType.Tradition, PaymentType.Tradition }).Where(b => b.IsUse).ToList();
            return(oldlist.Select(binfo => new BankAccountInfo
            {
                BankAccountsId = binfo.BankAccountsId,
                Accounts = binfo.Accounts + " => " + binfo.BankName + " 【" + EnumAttribute.GetKeyName((PaymentType)binfo.PaymentType) + "】"
            }).ToList());
        }
        /// <summary>
        /// 单据类型
        /// </summary>
        private void BindStorageType()
        {
            var dicStorageType = new Dictionary <int, string>
            {
                { (int)StorageRecordType.LendOut, EnumAttribute.GetKeyName((StorageRecordType.LendOut)) },
                { (int)StorageRecordType.AfterSaleOut, EnumAttribute.GetKeyName((StorageRecordType.AfterSaleOut)) },
                { (int)StorageRecordType.BuyStockOut, EnumAttribute.GetKeyName((StorageRecordType.BuyStockOut)) },
                { (int)StorageRecordType.SellStockOut, EnumAttribute.GetKeyName((StorageRecordType.SellStockOut)) },
                { (int)StorageRecordType.BorrowOut, EnumAttribute.GetKeyName((StorageRecordType.BorrowOut)) },
                { (int)StorageRecordType.InnerPurchase, EnumAttribute.GetKeyName((StorageRecordType.InnerPurchase)) }
            };

            DDL_StorageType.DataSource     = dicStorageType;
            DDL_StorageType.DataTextField  = "Value";
            DDL_StorageType.DataValueField = "Key";
            DDL_StorageType.DataBind();
            DDL_StorageType.Items.Insert(0, new ListItem("", ""));
        }
        /// <summary>
        /// 获取处理状态
        /// </summary>
        /// <param name="reportState">状态</param>
        /// <param name="realityCost">申报金额</param>
        /// <returns></returns>
        protected string GetReportState(string reportState, int realityCost)
        {
            if (string.IsNullOrEmpty(reportState))
            {
                return("-");
            }

            var state = int.Parse(reportState);

            if (((int)CostReportState.AlreadyAuditing).Equals(state) && realityCost < 0)
            {
                return("待收款");
            }
            if (((int)CostReportState.AlreadyAuditing).Equals(state) && realityCost > 0)
            {
                return("待付款");
            }
            return(EnumAttribute.GetKeyName((CostReportState)state));
        }
Ejemplo n.º 12
0
        protected string GetReceiptStatus(object receiptStatus, object invoiceState)
        {
            var status   = Convert.ToInt32(receiptStatus);
            var state    = Convert.ToInt32(invoiceState);
            var stateDic = (Dictionary <int, string>)EnumAttribute.GetDict <CompanyFundReceiptState>();

            if (status == (int)CompanyFundReceiptState.WaitInvoice)
            {
                if (state > 0)
                {
                    return(EnumAttribute.GetKeyName((ApplyInvoiceState)invoiceState));
                }
                return(stateDic[status]);
            }
            if (status == (int)CompanyFundReceiptState.Audited && state > 0)
            {
                return("已开");
            }
            return(stateDic.ContainsKey(status)? stateDic[status]:"未知状态");
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 单据类型
        /// </summary>
        private void BindStorageType()
        {
            var dicStorageType = new Dictionary <int, string>();

            dicStorageType.Add((int)StorageRecordType.BuyStockIn, EnumAttribute.GetKeyName((StorageRecordType.BuyStockIn)));
            dicStorageType.Add((int)StorageRecordType.SellStockOut, EnumAttribute.GetKeyName((StorageRecordType.SellStockOut)));
            dicStorageType.Add((int)StorageRecordType.BuyStockOut, EnumAttribute.GetKeyName((StorageRecordType.BuyStockOut)));
            dicStorageType.Add((int)StorageRecordType.SellReturnIn, EnumAttribute.GetKeyName((StorageRecordType.SellReturnIn)));
            dicStorageType.Add((int)StorageRecordType.BorrowIn, EnumAttribute.GetKeyName((StorageRecordType.BorrowIn)));
            dicStorageType.Add((int)StorageRecordType.BorrowOut, EnumAttribute.GetKeyName((StorageRecordType.BorrowOut)));
            dicStorageType.Add((int)StorageRecordType.LendOut, EnumAttribute.GetKeyName((StorageRecordType.LendOut)));
            dicStorageType.Add((int)StorageRecordType.LendIn, EnumAttribute.GetKeyName((StorageRecordType.LendIn)));
            dicStorageType.Add((int)StorageRecordType.AfterSaleOut, EnumAttribute.GetKeyName((StorageRecordType.AfterSaleOut)));
            dicStorageType.Add((int)StorageRecordType.InnerPurchase, EnumAttribute.GetKeyName((StorageRecordType.InnerPurchase)));
            RCB_SalesType.DataSource     = dicStorageType;
            RCB_SalesType.DataTextField  = "Value";
            RCB_SalesType.DataValueField = "Key";
            RCB_SalesType.DataBind();
            RCB_SalesType.Items.Insert(0, new RadComboBoxItem("全部", "0"));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取处理状态
        /// </summary>
        /// <param name="reportState">状态</param>
        /// <param name="reportCost">申报金额</param>
        /// <returns></returns>
        protected string GetReportState(string reportState, int reportCost)
        {
            if (string.IsNullOrEmpty(reportState))
            {
                return("-");
            }

            //true:表示是财务部(即代表公司);false:表示是个人
            bool flag  = _reportPersonnelId.Equals(Guid.Empty);
            var  state = int.Parse(reportState);

            if (((int)CostReportState.AlreadyAuditing).Equals(state) && reportCost < 0)
            {
                return(flag ? "待收款" : "待付款");
            }
            if (((int)CostReportState.AlreadyAuditing).Equals(state) && reportCost > 0)
            {
                return(flag ? "待付款" : "待收款");
            }
            return(EnumAttribute.GetKeyName((CostReportState)state));
        }
Ejemplo n.º 15
0
 private void BindValue(InvoiceApplyInfo applyInfo)
 {
     TbAddress.Text     = applyInfo.Address;
     TbTelephone.Text   = applyInfo.Telephone;
     TbReceiver.Text    = applyInfo.Receiver;
     TbApplyRemark.Text = applyInfo.ApplyRemark;
     TbRetreat.Text     = applyInfo.RetreatRemark;
     TbLeagueName.Text  = FilialeManager.GetName(applyInfo.TargetId);
     TbInvoiceType.Text = EnumAttribute.GetKeyName((ApplyInvoiceType)applyInfo.ApplyType);
     TbTitleType.Text   = EnumAttribute.GetKeyName((ApplyInvoiceTitleType)applyInfo.InvoiceTitleType);
     TbTitle.Text       = applyInfo.Title;
     TbPerTitle.Text    = applyInfo.Title;
     BtSave.Text        = IsAudit ? "核准" : "开票";
     BtBack.Text        = IsAudit ? "核退" : "退回";
     if (applyInfo.InvoiceTitleType == (int)ApplyInvoiceTitleType.Company)
     {
         TbContactAddress.Text = applyInfo.ContactAddress;
         TbContactPhone.Text   = applyInfo.ContactTelephone;
         TbTaxNumber.Text      = applyInfo.TaxpayerNumber;
         TbBankName.Text       = applyInfo.BankName;
         TbBankAccountNo.Text  = applyInfo.BankAccountNo;
     }
 }
Ejemplo n.º 16
0
        /// <summary>导出Excel
        /// </summary>
        /// <param name="slist"></param>
        public void OutPutExcel(IList <DebitNoteInfo> slist)
        {
            var workbook = new HSSFWorkbook();
            var ms       = new MemoryStream();
            var sheet    = new HSSFSheet[1];// 增加sheet。

            #region Excel样式
            //标题样式styletitle
            HSSFFont fonttitle = workbook.CreateFont();
            fonttitle.FontHeightInPoints = 12;
            fonttitle.Color      = HSSFColor.RED.index;
            fonttitle.Boldweight = 1;
            HSSFCellStyle styletitle = workbook.CreateCellStyle();
            styletitle.BorderBottom = HSSFCellStyle.BORDER_THIN;
            styletitle.BorderLeft   = HSSFCellStyle.BORDER_THIN;
            styletitle.BorderRight  = HSSFCellStyle.BORDER_THIN;
            styletitle.BorderTop    = HSSFCellStyle.BORDER_THIN;
            styletitle.SetFont(fonttitle);
            //内容字体styleContent
            HSSFFont fontcontent = workbook.CreateFont();
            fontcontent.FontHeightInPoints = 9;
            fontcontent.Color = HSSFColor.BLACK.index;
            HSSFCellStyle styleContent = workbook.CreateCellStyle();
            styleContent.BorderBottom = HSSFCellStyle.BORDER_THIN;
            styleContent.BorderLeft   = HSSFCellStyle.BORDER_THIN;
            styleContent.BorderRight  = HSSFCellStyle.BORDER_THIN;
            styleContent.BorderTop    = HSSFCellStyle.BORDER_THIN;
            styleContent.SetFont(fontcontent);
            //总计 styletotal
            HSSFFont fonttotal = workbook.CreateFont();
            fonttotal.FontHeightInPoints = 12;
            fonttotal.Color      = HSSFColor.BLACK.index;
            fonttotal.Boldweight = 2;
            HSSFCellStyle styletotal = workbook.CreateCellStyle();
            styletotal.SetFont(fonttotal);
            #endregion

            #region 将值插入sheet

            sheet[0] = workbook.CreateSheet("赠品借记单列表");//添加sheet名
            sheet[0].DefaultColumnWidth = 50;
            sheet[0].DefaultRowHeight   = 20;

            HSSFRow      rowtitle    = sheet[0].CreateRow(0);
            HSSFCell     celltitie   = rowtitle.CreateCell(0);
            const string SHEET_TITLE = "赠品借记单列表";
            celltitie.SetCellValue(SHEET_TITLE);
            HSSFCellStyle style = workbook.CreateCellStyle();
            style.Alignment = HSSFCellStyle.ALIGN_CENTER;
            HSSFFont font = workbook.CreateFont();
            font.FontHeightInPoints = 20;
            font.Color      = HSSFColor.BLACK.index;
            font.Boldweight = 2;
            style.SetFont(font);
            celltitie.CellStyle = style;
            sheet[0].AddMergedRegion(new Region(0, 0, 0, 2));

            #region //列名
            HSSFRow  rowTitle = sheet[0].CreateRow(3);
            HSSFCell cell1    = rowTitle.CreateCell(0);
            HSSFCell cell2    = rowTitle.CreateCell(1);
            HSSFCell cell3    = rowTitle.CreateCell(2);
            HSSFCell cell4    = rowTitle.CreateCell(3);
            HSSFCell cell5    = rowTitle.CreateCell(4);
            HSSFCell cell6    = rowTitle.CreateCell(5);
            HSSFCell cell7    = rowTitle.CreateCell(6);
            HSSFCell cell8    = rowTitle.CreateCell(7);
            HSSFCell cell9    = rowTitle.CreateCell(8);
            cell1.SetCellValue("对应采购单号");
            cell2.SetCellValue("供应商");
            cell3.SetCellValue("赠品总价");
            cell4.SetCellValue("活动开始");
            cell5.SetCellValue("活动结束");
            cell6.SetCellValue("借记单状态");
            cell7.SetCellValue("仓库");
            cell8.SetCellValue("责任人");
            cell1.CellStyle = styletitle;
            cell2.CellStyle = styletitle;
            cell3.CellStyle = styletitle;
            cell4.CellStyle = styletitle;
            cell5.CellStyle = styletitle;
            cell6.CellStyle = styletitle;
            cell7.CellStyle = styletitle;
            cell8.CellStyle = styletitle;
            cell9.CellStyle = styletitle;
            #endregion

            #region //内容
            int row = 4;

            if (slist.Count > 0)
            {
                foreach (DebitNoteInfo debitNoteInfo in slist)
                {
                    HSSFRow  rowt = sheet[0].CreateRow(row);
                    HSSFCell c1   = rowt.CreateCell(0);
                    HSSFCell c2   = rowt.CreateCell(1);
                    HSSFCell c3   = rowt.CreateCell(2);
                    HSSFCell c4   = rowt.CreateCell(3);
                    HSSFCell c5   = rowt.CreateCell(4);
                    HSSFCell c6   = rowt.CreateCell(5);
                    HSSFCell c7   = rowt.CreateCell(6);
                    HSSFCell c8   = rowt.CreateCell(7);
                    HSSFCell c9   = rowt.CreateCell(8);
                    c1.SetCellValue(debitNoteInfo.PurchasingNo);                                         //对应采购单号
                    c2.SetCellValue(GetCompanyName(debitNoteInfo.CompanyId));                            //供应商
                    c3.SetCellValue(debitNoteInfo.PresentAmount.ToString(CultureInfo.InvariantCulture)); //赠品总价
                    c4.SetCellValue(debitNoteInfo.ActivityTimeStart.ToString());                         //活动开始
                    c5.SetCellValue(debitNoteInfo.ActivityTimeEnd.ToString());                           //活动结束
                    c6.SetCellValue(EnumAttribute.GetKeyName((DebitNoteState)debitNoteInfo.State));      //借记单状态
                    c7.SetCellValue(GetWarehouseName(debitNoteInfo.WarehouseId));                        //仓库
                    c8.SetCellValue(GetPersonName(debitNoteInfo.PersonResponsible));                     //责任人
                    c1.CellStyle           = styleContent;
                    c2.CellStyle           = styleContent;
                    c3.CellStyle           = styleContent;
                    c4.CellStyle           = styleContent;
                    c5.CellStyle           = styleContent;
                    c6.CellStyle           = styleContent;
                    c7.CellStyle           = styleContent;
                    c8.CellStyle           = styleContent;
                    c9.CellStyle           = styleContent;
                    c1.CellStyle.Alignment = HSSFCellStyle.ALIGN_LEFT;
                    row++;
                }
            }
            else
            {
                HSSFRow  rtotal = sheet[0].CreateRow(row);
                HSSFCell t0     = rtotal.CreateCell(0);
                t0.SetCellValue("无数据显示");
                t0.CellStyle = styletotal;
            }
            sheet[0].DisplayGridlines = false;
            #endregion

            #region 输出
            workbook.Write(ms);
            Response.ContentEncoding = Encoding.GetEncoding("utf-8");
            Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("赠品借记单列表" + DateTime.Now.ToString("yyyyMMdd") + ".xls", Encoding.UTF8));
            Response.BinaryWrite(ms.ToArray());

            ms.Close();
            ms.Dispose();
            GC.Collect();
            #endregion

            #endregion
        }
Ejemplo n.º 17
0
        // 采购中
        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 + ");");
            }
        }
Ejemplo n.º 18
0
        //批量审核
        protected void btn_Audit_Click(object sender, EventArgs e)
        {
            string selectedGoodsAuditState = rcb_GoodsAuditState.SelectedValue;

            if (string.IsNullOrEmpty(selectedGoodsAuditState))
            {
                MessageBox.Show(this, "请选择审核状态!");
                return;
            }

            if (Request["ckId"] == null)
            {
                MessageBox.Show(this, "请选择相关数据!");
                return;
            }

            if (!(int.Parse(selectedGoodsAuditState).Equals((int)GoodsAuditState.PurchasingWaitAudit) && GetPowerOperationPoint("PurchasingWaitAudit")) && !(int.Parse(selectedGoodsAuditState).Equals((int)GoodsAuditState.QualityWaitAudit) && GetPowerOperationPoint("QualityWaitAudit")) && !(int.Parse(selectedGoodsAuditState).Equals((int)GoodsAuditState.CaptainWaitAudit) && GetPowerOperationPoint("CaptainWaitAudit")))
            {
                MessageBox.Show(this, "您不具有“" + EnumAttribute.GetKeyName((GoodsAuditState)int.Parse(selectedGoodsAuditState)) + "”的审核权限!");
                return;
            }

            var errorMsg   = string.Empty;
            var goodIdList = new List <Guid>();
            var goodsIdsAndGoodsNamesAndGoodsAuditState = Request["ckId"].Split(',');

            foreach (var item in goodsIdsAndGoodsNamesAndGoodsAuditState)
            {
                var    goodsId         = new Guid(item.Split('&')[0]);
                string goodsAuditState = item.Split('&')[2];
                string goodsCode       = item.Split('&')[3];
                if (goodsAuditState != selectedGoodsAuditState)
                {
                    errorMsg += goodsCode + ",";
                }
                else
                {
                    goodIdList.Add(goodsId);
                }
            }
            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show(this, "商品编号:" + errorMsg.Substring(0, errorMsg.Length - 1) + " 审核状态与已选择审核状态不一致!");
                return;
            }

            #region 批量核准
            if (goodIdList.Any())
            {
                int    auditState     = int.Parse(selectedGoodsAuditState);
                string auditStateMemo = string.Empty;
                switch ((GoodsAuditState)int.Parse(selectedGoodsAuditState))
                {
                case GoodsAuditState.PurchasingWaitAudit:
                    auditState     = (int)GoodsAuditState.QualityWaitAudit;
                    auditStateMemo = "【采购经理审核】:审核通过;";
                    break;

                case GoodsAuditState.QualityWaitAudit:
                    auditState     = (int)GoodsAuditState.CaptainWaitAudit;
                    auditStateMemo = "【质管部审核】:审核通过;";
                    break;

                case GoodsAuditState.CaptainWaitAudit:
                    auditState     = (int)GoodsAuditState.Pass;
                    auditStateMemo = "【负责人终审】:审核通过;";
                    break;
                }
                auditStateMemo = WebControl.RetrunUserAndTime("[" + auditStateMemo + "]");
                string failMessage;
                bool   result = _goodManager.PlUpdateGoodsAuditStateAndAuditStateMemo(goodIdList, auditState, auditStateMemo, out failMessage);
                if (result)
                {
                    MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                    MessageBox.Show(this, "保存成功!");
                }
                else
                {
                    MessageBox.Show(this, "保存失败!" + failMessage);
                }
            }
            #endregion
        }
Ejemplo n.º 19
0
 private string GetPayMode(int payMode)
 {
     return(EnumAttribute.GetKeyName((PayMode)payMode));
 }
Ejemplo n.º 20
0
 private string GetRefundmentMode(int refundmentMode)
 {
     return(EnumAttribute.GetKeyName((RefundmentMode)refundmentMode));
 }
Ejemplo n.º 21
0
 protected string GetMatchType(object matchType)
 {
     return(EnumAttribute.GetKeyName((MatchType)matchType));
 }
 /// <summary>
 /// 获取检查状态
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 protected object GetCheckState(object state)
 {
     return(EnumAttribute.GetKeyName((CheckState)state));
 }
Ejemplo n.º 23
0
 protected string GetStockType(int stockType)
 {
     return(EnumAttribute.GetKeyName((StorageRecordType)stockType));
 }
Ejemplo n.º 24
0
        public string GetEnumIntro(object enumIndex)
        {
            var enumKey = (CompanyFundReceiptInvoiceType)int.Parse(enumIndex.ToString());

            return(EnumAttribute.GetKeyName(enumKey));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 获取单据类型,区别是付款单还是收款单
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        protected string GetReceiptType(string type)
        {
            var rtype = (CompanyFundReceiptType)Convert.ToInt32(type);

            return(EnumAttribute.GetKeyName(rtype));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 获取单据状态
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        protected string GetReceiptStatus(string status)
        {
            var rstatus = (CompanyFundReceiptState)Convert.ToInt32(status);

            return(EnumAttribute.GetKeyName(rstatus));
        }
Ejemplo n.º 27
0
        public static void RunTask()
        {
            var now  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            int week = GetWeek(now);

            if (week == 1 || week == 3)
            {
                #region --> 今天周一或周三
                var pg                      = DataAccessor.GetPurchasingGoodsList(TaskType.All);
                var goodsIdList             = pg.Select(w => w.GoodsId).Distinct().ToList();
                IList <GoodsInfo> goodsList = _goodsCenterSao.GetGoodsListByGoodsIds(goodsIdList).ToList();
                if (goodsList.Count == 0)
                {
                    return;
                }

                var dictPurchase   = new Dictionary <PurchasingInfo, List <PurchasingDetailInfo> >();
                var purchasingSets = new List <PurchasingGoods>();
                pg = pg.Where(w => w.StockUpDay == week && w.HostingFilialeId != Guid.Empty).ToList();
                var goodsDics     = goodsList.ToDictionary(k => k.GoodsId, v => v);
                var realGoodsDics = new Dictionary <Guid, GoodsInfo>();

                Dictionary <Guid, List <Guid> > goodsWithRealGoods = new Dictionary <Guid, List <Guid> >();
                foreach (var warehouseIdGroup in pg.GroupBy(act => new { act.WarehouseId, act.HostingFilialeId }))
                {
                    var warehouseId          = warehouseIdGroup.Key.WarehouseId;
                    var hostingFilialeId     = warehouseIdGroup.Key.HostingFilialeId;
                    var stockStatistics      = WMSSao.GetStockStatisticsDtosForAuto(warehouseId, hostingFilialeId);
                    var planPurchasingGoods1 = DataAccessor.GetAllSumPurchasingQuantity(warehouseId, hostingFilialeId).ToDictionary(k => k.GoodsID, v => v.PurchasingQuantity);
                    foreach (var companyIdGroup in warehouseIdGroup.GroupBy(act => act.CompanyId))
                    {
                        var purchaseGroupIds = companyIdGroup.Select(w => w.PurchaseGroupId).Distinct().ToList();
                        foreach (var purchaseGroupId in purchaseGroupIds)
                        {
                            //采购分组
                            var pgList             = companyIdGroup.Where(w => w.PurchaseGroupId == purchaseGroupId).ToList();
                            var personResponsibles = pgList.Select(w => w.PersonResponsible).Distinct().ToList();
                            foreach (var personResponsible in personResponsibles)
                            {
                                var prList = pgList.Where(w => w.PersonResponsible == personResponsible).ToList();
                                if (prList.Count > 0)
                                {
                                    foreach (var prInfo in prList.Where(ent => goodsDics.ContainsKey(ent.GoodsId)))
                                    {
                                        GoodsInfo goodsInfo = goodsDics[prInfo.GoodsId];
                                        if (goodsInfo == null)
                                        {
                                            continue;
                                        }
                                        prInfo.GoodsName = goodsInfo.GoodsName;
                                        prInfo.GoodsCode = goodsInfo.GoodsCode;
                                        prInfo.Units     = goodsInfo.Units;
                                        if (goodsInfo.ExpandInfo != null)
                                        {
                                            prInfo.PackQuantity = goodsInfo.ExpandInfo.PackCount;
                                        }
                                        List <Guid> realGoodsIdList;
                                        if (goodsWithRealGoods.ContainsKey(prInfo.GoodsId))
                                        {
                                            realGoodsIdList = goodsWithRealGoods[prInfo.GoodsId];
                                        }
                                        else
                                        {
                                            realGoodsIdList = _goodsCenterSao.GetRealGoodsIdsByGoodsId(prInfo.GoodsId).ToList();
                                            if (realGoodsIdList.Count == 0)
                                            {
                                                realGoodsIdList.Add(prInfo.GoodsId);
                                            }
                                            goodsWithRealGoods.Add(prInfo.GoodsId, realGoodsIdList);
                                        }

                                        int stockUpDays = prInfo.FilingForm == 1 ? GetStockUpDays(prInfo) : prInfo.FilingTrigger;
                                        if (stockUpDays == 0)
                                        {
                                            continue;
                                        }
                                        var childGoodsSaleAll = GetChildGoodsSaleTotalByDays(realGoodsIdList, new List <Guid> {
                                            prInfo.WarehouseId
                                        }, stockUpDays, now);

                                        if (childGoodsSaleAll.Count > 0)
                                        {
                                            foreach (var sale in childGoodsSaleAll)
                                            {
                                                sale.PlanPurchasingquantity = sale.WeightedAverageSaleQuantity * stockUpDays;
                                                if (sale.PlanPurchasingquantity > 0)
                                                {
                                                    //个位数0<x<=5向上取为5,个位数为6<x<=9向上取整为10
                                                    char[] temp       = sale.PlanPurchasingquantity.ToString(CultureInfo.InvariantCulture).ToArray();
                                                    int    unitsDigit = Convert.ToInt32(temp[temp.Length - 1]);
                                                    if (unitsDigit > 0 && unitsDigit < 5)
                                                    {
                                                        sale.PlanPurchasingquantity += 5 - unitsDigit;
                                                    }
                                                    else if (unitsDigit > 5)
                                                    {
                                                        sale.PlanPurchasingquantity += 10 - unitsDigit;
                                                    }
                                                }

                                                //计算当前的采购商品数量,包含扣除的已经采购完成和部分采购完成和赠品类型
                                                sale.SubtractPurchasingQuantity = planPurchasingGoods1.ContainsKey(sale.GoodsId)? planPurchasingGoods1[sale.GoodsId] : 0;

                                                //计算当前仓库存货数量
                                                sale.NonceWarehouseStockQuantity = stockStatistics.Where(ent => ent.RealGoodsId == sale.GoodsId).Sum(info => info.CurrentStock + info.UppingQuantity - info.RequireQuantity - info.SubtotalQuantity);
                                                if (prInfo.FilingForm == 2)
                                                {
                                                    //2触发报备
                                                    //计算是否满足不足数量
                                                    double planQuantity    = sale.WeightedAverageSaleQuantity * prInfo.Insufficient;
                                                    double realityQuantity = Math.Ceiling(planQuantity - sale.SubtractPurchasingQuantity - sale.NonceWarehouseStockQuantity);
                                                    if (realityQuantity <= 0)
                                                    {
                                                        //无需报备
                                                        continue;
                                                    }
                                                }
                                                if (sale.RealityNeedPurchasingQuantity > 0)
                                                {
                                                    var            salesinfo = DataAccessor.GetChildGoodsSale(sale.GoodsId, warehouseId, sale.HostingFilialeId, DateTime.Now);
                                                    PurchasingInfo existingPurchasingInfo = null;
                                                    bool           isExist = false;
                                                    if (dictPurchase.Keys.Count > 0)
                                                    {
                                                        existingPurchasingInfo = dictPurchase.Keys.FirstOrDefault(act => act.PersonResponsible == personResponsible && act.PurchasingFilialeId == hostingFilialeId && act.WarehouseID == warehouseId && companyIdGroup.Key == act.CompanyID);
                                                    }
                                                    var detailList = new List <PurchasingDetailInfo>();
                                                    if (existingPurchasingInfo == null)
                                                    {
                                                        existingPurchasingInfo = new PurchasingInfo
                                                        {
                                                            PurchasingID        = Guid.NewGuid(),
                                                            CompanyID           = companyIdGroup.Key,
                                                            CompanyName         = prList[0].CompanyName,
                                                            WarehouseID         = warehouseId,
                                                            PurchasingState     = (int)PurchasingState.NoSubmit,
                                                            PurchasingType      = (int)PurchasingType.AutoStock,
                                                            PersonResponsible   = personResponsible,
                                                            PurchaseGroupId     = purchaseGroupId,
                                                            StartTime           = DateTime.Now,
                                                            EndTime             = DateTime.MaxValue,
                                                            Description         = string.Format("[采购类别:{0};系统自动报备]", EnumAttribute.GetKeyName(PurchasingType.Custom)),
                                                            FilialeID           = hostingFilialeId,
                                                            PurchasingFilialeId = hostingFilialeId
                                                        };
                                                    }
                                                    else
                                                    {
                                                        isExist    = true;
                                                        detailList = dictPurchase[existingPurchasingInfo];
                                                    }
                                                    var purchasingDetailInfo = new PurchasingDetailInfo
                                                    {
                                                        PurchasingID      = existingPurchasingInfo.PurchasingID,
                                                        GoodsID           = sale.GoodsId,
                                                        GoodsName         = prInfo.GoodsName,
                                                        GoodsCode         = prInfo.GoodsCode,
                                                        Specification     = sale.Specification,
                                                        CompanyID         = companyIdGroup.Key,
                                                        Price             = prInfo.Price,
                                                        PlanQuantity      = sale.RealityNeedPurchasingQuantity,
                                                        RealityQuantity   = 0,
                                                        State             = 0,
                                                        Units             = prInfo.Units,
                                                        PurchasingGoodsID = Guid.NewGuid(),
                                                        SixtyDaySales     = salesinfo.SixtyDaySales,
                                                        ThirtyDaySales    = salesinfo.ThirtyDaySales,
                                                        ElevenDaySales    = salesinfo.ElevenDaySales,
                                                        CPrice            = prInfo.Price
                                                    };
                                                    detailList.Add(purchasingDetailInfo);

                                                    if (!realGoodsDics.ContainsKey(sale.GoodsId))
                                                    {
                                                        realGoodsDics.Add(sale.GoodsId, goodsInfo);
                                                    }
                                                    if (detailList.Count > 0 && !isExist)
                                                    {
                                                        dictPurchase.Add(existingPurchasingInfo, detailList);
                                                    }
                                                }
                                            }
                                            if (!purchasingSets.Any(act => act.WarehouseId == warehouseId && act.HostingFilialeId == hostingFilialeId && act.GoodsId == prInfo.GoodsId))
                                            {
                                                purchasingSets.Add(prInfo);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                PurchasingPromotion(dictPurchase, realGoodsDics, purchasingSets);
                #endregion
            }
        }
 /// <summary>
 /// 获取状态
 /// </summary>
 /// <param name="state">状态</param>
 /// <returns></returns>
 protected string GetState(object state)
 {
     return(EnumAttribute.GetKeyName((MemberMentionState)state));
 }
Ejemplo n.º 29
0
 public string GetEnumName(object goodsType)
 {
     return(EnumAttribute.GetKeyName((GoodsKindType)goodsType));
 }
        //增票待认证(无需认证)
        protected void btn_NoAuthenticate_Click(object sender, EventArgs e)
        {
            var errorMsg = new StringBuilder();

            if (!string.IsNullOrEmpty(Hid_BillId.Value))
            {
                var billIds = Hid_BillId.Value.Split(',');
                foreach (var item in billIds)
                {
                    CostReportBillInfo model = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(item));
                    if (!model.BillState.Equals((int)CostReportBillState.Receive))
                    {
                        errorMsg.Append("“票据号码:").Append(model.BillNo).Append("”不符合“" + EnumAttribute.GetKeyName(CostReportBillState.Receive) + "”状态!").Append("\\n");
                        continue;
                    }
                    try
                    {
                        string remark = ERP.UI.Web.Common.WebControl.RetrunUserAndTime("【票据认证完成】");
                        _costReportBill.Updatelmshop_CostReportBillByBillId(remark, new Guid(item), (int)CostReportBillState.Verification);
                    }
                    catch
                    {
                        errorMsg.Append("“票据号码:").Append(model.BillNo).Append("”保存失败!").Append("\\n");
                    }
                }
                MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
            else
            {
                errorMsg.Append("请选择相关数据!");
            }
            if (!string.IsNullOrEmpty(errorMsg.ToString()))
            {
                MessageBox.Show(this, errorMsg.ToString());
            }
        }