Esempio n. 1
0
        protected override PayItemInfo PreCheckForCancelPay(PayItemInfo entity, out PayableInfo payableInfo)
        {
            var payItemInfo = base.PreCheckForCancelPay(entity, out payableInfo);

            var poInfo = ExternalDomainBroker.GetPurchaseOrderInfo(payableInfo.OrderSysNo.Value, 0);

            if (poInfo == null)
            {
                ThrowBizException("PayItem_OrderNotExisitsFormat", payItemInfo.OrderSysNo);
            }
            if (poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.WaitingInStock)
            {
                if (payItemInfo.PayStyle != PayItemStyle.Advanced)
                {
                    ThrowBizException("PayItem_CancelPay_OnlyCanAdvancePay");
                }
            }
            else if (poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.InStocked ||
                     poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.PartlyInStocked ||
                     poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.ManualClosed ||
                     poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.SystemClosed ||
                     poInfo.PurchaseOrderBasicInfo.PurchaseOrderStatus == PurchaseOrderStatus.VendorClosed)
            {
                if (payItemInfo.PayStyle != PayItemStyle.Normal)
                {
                    ThrowBizException("PayItem_CancelPay_OnlyCanNormalPay");
                }
            }
            else
            {
                ThrowBizException("PayItem_CancelPay_POStatusInvalid");
            }
            return(payItemInfo);
        }
Esempio n. 2
0
        public void Test_Invoice_CreatePayable()
        {
            PayableInfo entity = new PayableInfo();

            entity.AlreadyPayAmt      = 0;
            entity.AuditDatetime      = DateTime.Now;
            entity.AuditUserSysNo     = -1;
            entity.BatchNumber        = 0;
            entity.CompanyCode        = "8601";
            entity.CurrencySysNo      = 0;
            entity.EIMSAmt            = 0;
            entity.EIMSNo             = 0;
            entity.EstimatedTimeOfPay = DateTime.Now;
            entity.InStockAmt         = 0;
            entity.InvoiceFactStatus  = PayableInvoiceFactStatus.Corrent;
            entity.InvoiceStatus      = PayableInvoiceStatus.Absent;
            entity.InvoiceUpdateTime  = DateTime.Now;
            entity.Note        = "Just for NUnit Test";
            entity.OrderAmt    = 0;
            entity.OrderStatus = 0;
            //entity.OrderType = PayableOrderType.FinanceSettleOrder;
            entity.OrderSysNo             = 11;
            entity.PayItemList            = null;
            entity.PayStatus              = PayableStatus.UnPay;
            entity.AuditStatus            = PayableAuditStatus.NotAudit;
            entity.PMSysNo                = 0;
            entity.RawOrderAmt            = 0;
            entity.UpdateInvoiceUserSysNo = 0;

            ObjectFactory <PayableProcessor> .Instance.Create(entity);
        }
Esempio n. 3
0
        /// <summary>
        /// 添加备注
        /// </summary>
        /// <param name="payableInfo"></param>
        public virtual PayableInfo AddMemo(PayableInfo info)
        {
            if (string.IsNullOrEmpty(info.NewMemo))
            {
                //throw new BizException("新建备注不能为空!");
                ThrowBizException("Finance_MemoNotNull");
            }

            PayableInfo oldInfo     = null;
            var         oldInfoList = m_FinanceDA.PayableQuery(new PayableCriteriaInfo()
            {
                SysNo = info.SysNo
            });

            if (null == oldInfoList || oldInfoList.Count == 0)
            {
                //throw new BizException("未找到此单据!");
                ThrowBizException("Finance_NotFoundBill");
            }
            else
            {
                oldInfo = oldInfoList[0];
            }

            string newMemo = string.Format("\r\n{0},[{1},({2})];", info.NewMemo, info.OperationUserFullName, DateTime.Now.ToString("yy-MM-dd,HH:mm"));

            if (newMemo.Length + ((string.IsNullOrEmpty(oldInfo.Memo)) ? 0 : oldInfo.Memo.Length) <= 500)
            {
                info.Memo += newMemo;
                m_FinanceDA.AddMemo(info.SysNo.Value, info.Memo, info.CompanyCode);
            }

            return(info);
        }
Esempio n. 4
0
        protected virtual PayItemInfo PreCheckForCancelLock(PayItemInfo entity, out PayableInfo payableInfo)
        {
            var payItemInfo = PayItemBizProcessor.LoadBySysNo(entity.SysNo.Value);

            //付款状态是否为已锁定
            if (payItemInfo.Status != PayItemStatus.Locked)
            {
                ThrowBizException("PayItem_UnLock_StatusNotMatchLocked");
            }

            //校验应付款的供应商是否已锁定
            if (PayItemBizProcessor.IsHoldByVendor(payItemInfo))
            {
                ThrowBizException("PayItem_UnLock_CannotUnLockByVendor");
            }

            if (PayItemBizProcessor.IsHoldByVendorPM(payItemInfo))
            {
                ThrowBizException("PayItem_UnLock_CannotUnLockByPM");
            }

            payableInfo = PayableBizProcessor.LoadBySysNo(payItemInfo.PaySysNo.Value);
            //应付款是否为已作废或者已支付
            if (payableInfo.PayStatus == PayableStatus.Abandon)
            {
                ThrowBizException("PayItem_UnLock_AbandonStatusCannotUnLock");
            }
            else if (payableInfo.PayStatus == PayableStatus.FullPay)
            {
                ThrowBizException("PayItem_UnLock_FullPayStatusCannotUnLock");
            }
            return(payItemInfo);
        }
Esempio n. 5
0
        /// <summary>
        /// 自动支付付款单
        /// </summary>
        /// <param name="entity"></param>
        public virtual void AutoPay(PayItemInfo entity)
        {
            if (!entity.SysNo.HasValue || entity.SysNo == 0)
            {
                throw new ArgumentNullException("entity.SysNo");
            }

            if (!entity.PaySysNo.HasValue || entity.PaySysNo == 0)
            {
                throw new ArgumentNullException("entity.PaySysNo");
            }

            //获取系统用户编号
            int sysUserSysNo = GetSystemUserSysNo();

            //更新应付款的状态为“财务已审核”
            PayableInfo payableInfo = new PayableInfo();

            payableInfo.SysNo          = entity.PaySysNo;
            payableInfo.AuditUserSysNo = sysUserSysNo;
            payableInfo.AuditStatus    = PayableAuditStatus.Audited;
            ObjectFactory <PayableProcessor> .Instance.UpdateAuditInfo(payableInfo);

            //TODO:自动支付不是强制支付(待确认)
            entity.PayUserSysNo = sysUserSysNo;
            Pay(entity, false);
        }
Esempio n. 6
0
        public virtual PayItemInfo CancelAbandon(PayItemInfo entity)
        {
            PayableInfo payableInfo = null;
            var         payItemInfo = PreCheckForCancelAbandon(entity, out payableInfo);

            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                payItemInfo.Status = PayItemStatus.Origin;
                payItemInfo        = PayItemBizProcessor.UpdateStatus(payItemInfo);
                if (payableInfo.PayStatus == PayableStatus.Abandon)
                {
                    payableInfo.PayStatus     = PayableStatus.UnPay;
                    payableInfo.AlreadyPayAmt = 0;
                    PayableBizProcessor.UpdateStatus(payableInfo);
                }
                scope.Complete();
            }

            AfterProcessForCancelAbandon(payItemInfo);

            return(payItemInfo);
        }
Esempio n. 7
0
        protected virtual PayItemInfo PreCheckForPay(PayItemInfo entity, out PayableInfo payableInfo)
        {
            var payItemInfo = PayItemBizProcessor.LoadBySysNo(entity.SysNo.Value);

            if (payItemInfo.Status != PayItemStatus.Origin)
            {
                ThrowBizException("PayItem_Pay_OnlyOriginCanPay");
            }

            payableInfo = PayableBizProcessor.LoadBySysNo(payItemInfo.PaySysNo.Value);
            //ECC移除应付款汇总表,没有相应的财务审核功能,移除此逻辑 by freegod 20130531
            //if (payableInfo.AuditStatus != PayableAuditStatus.Audited)
            //{
            //    ThrowBizException("PayItem_Pay_PayableAuditStatusNotMatchAudited");
            //}

            if (payableInfo.PayStatus == PayableStatus.FullPay)
            {
                ThrowBizException("PayItem_Pay_CannotPayForFullPay");
            }
            if (payableInfo.PayStatus == PayableStatus.Abandon)
            {
                ThrowBizException("PayItem_Pay_CannotPayForAbandon");
            }
            payItemInfo.OrderSysNo  = payableInfo.OrderSysNo;
            payItemInfo.BatchNumber = payableInfo.BatchNumber;

            return(payItemInfo);
        }
Esempio n. 8
0
        protected virtual void CreatePOAdjustByVendor(PayableInfo entity)
        {
            var result = ObjectFactory <PayItemProcessor> .Instance.GetListByCriteria(new PayItemInfo
            {
                OrderSysNo = entity.OrderSysNo,
                OrderType  = PayableOrderType.PO,
                PayStyle   = PayItemStyle.Advanced,
                Status     = PayItemStatus.Paid
            });

            if (result.Count <= 0)
            {
                return;
            }
            var item = result[0];

            if (item.PayAmt <= 0 || item.AvailableAmt.Value <= 0)
            {
                return;
            }
            if (entity.OrderStatus != 6)
            {
                ThrowBizException("Payable_CreatePOAdjustByVendor_StatusInValid", entity.OrderStatus);
            }
            if (entity.InStockAmt != item.AvailableAmt)
            {
                ThrowBizException("Payable_CreatePOAdjustByVendor_InStockAmtNotEqualAvailableAmt", (entity.InStockAmt.HasValue ? entity.InStockAmt.Value.ToString("#.00") : "0.00"), (item.AvailableAmt.HasValue ? item.AvailableAmt.Value.ToString("#.00") : "0:00"));
            }
            TransactionOptions option = new TransactionOptions();

            //option.IsolationLevel = IsolationLevel.ReadUncommitted;
            option.Timeout = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
            {
                PayItemInfo payitem = new PayItemInfo();
                payitem.OrderType          = PayableOrderType.POAdjust;
                payitem.OrderSysNo         = entity.OrderSysNo;
                payitem.PayStyle           = PayItemStyle.Normal;
                payitem.PayAmt             = -item.AvailableAmt.Value;
                payitem.Note               = "auto create Before Close PO";
                payitem.Status             = PayItemStatus.Origin;
                payitem.OrderStatus        = entity.OrderStatus;
                payitem.EstimatedTimeOfPay = entity.EstimatedTimeOfPay;
                payitem.RawOrderAmt        = -item.AvailableAmt.Value;
                payitem.EIMSAmt            = 0;

                ObjectFactory <PayItemProcessor> .Instance.Create(payitem);

                ObjectFactory <PayItemProcessor> .Instance.UpdateAvailableAmt(item.OrderType.Value, item.OrderSysNo.Value, 0);

                scope.Complete();
            }
            //记录操作日志
            ObjectFactory <ICommonBizInteract> .Instance.CreateOperationLog(
                GetMessageString("Payable_Log_CreatePOAdjustByVendor", ServiceContext.Current.UserSysNo, item.SysNo)
                , BizLogType.Finance_Pay_Item_Add
                , item.SysNo.Value
                , item.CompanyCode);
        }
Esempio n. 9
0
 /// <summary>
 /// 按应付款主记录进行支付操作
 /// </summary>
 /// <param name="payableInfo"></param>
 /// <param name="payUserSysNo"></param>
 /// <returns></returns>
 public PayableInfo PayByPayableSysNo(PayableInfo payableInfo, int payUserSysNo)
 {
     try
     {
         PayableInfo oldPayable     = null;
         var         oldPayableList = m_FinaceDA.PayableQuery(new PayableCriteriaInfo()
         {
             SysNo = payableInfo.SysNo
         });
         if (oldPayableList == null || oldPayableList.Count == 0)
         {
             //throw new BizException("未找到此单据!");
             ThrowBizException("Payable_BillNotFount");
         }
         else
         {
             oldPayable              = oldPayableList[0];
             payableInfo.OrderType   = oldPayable.OrderType;
             payableInfo.BatchNumber = oldPayable.BatchNumber;
         }
         if (!string.Equals(oldPayable.AuditStatus.ToString(), PayableAuditStatus.Audited.ToString(), StringComparison.OrdinalIgnoreCase))
         {
             //throw new BizException("支付操作要求单据的审核状态为[财务审核通过]!");
             ThrowBizException("Payable_PayJustSupportAuditPassStatus");
         }
         if (oldPayable.PayStatus != PayableStatus.UnPay)
         {
             //throw new BizException("支付操作要求单据的支付状态为[未支付]!");
             ThrowBizException("Payable_PayJustSupportPayTypeIsNotPay");
         }
         var pItems = m_FinaceDA.QueryPayItems(new PayableItemCriteriaInfo()
         {
             PaySysNo = payableInfo.SysNo, Status = PayItemStatus.Origin
         });
         if (pItems == null || pItems.Count == 0)
         {
             //throw new BizException(string.Format("未找到此应付记录[{0}]的未付款信息!", payableInfo.SysNo));
             ThrowBizException("Payable_NotFoundUnPayInfo", payableInfo.SysNo);
         }
         TransactionOptions option = new TransactionOptions();
         option.IsolationLevel = IsolationLevel.ReadUncommitted;
         option.Timeout        = TransactionManager.DefaultTimeout;
         using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
         {
             foreach (var x in pItems)
             {
                 x.PayUserSysNo = payUserSysNo;
                 this.PayPayItem(x);
             }
             scope.Complete();
         }
     }
     catch (BizException bex)
     {
         // throw new BizException(string.Format("单据【{0}】类型【{1}】支付失败:{2}", (payableInfo.OrderType != PayableOrderType.PO) ? payableInfo.OrderSysNo.ToString() : string.Format("{0}-{1}", payableInfo.OrderSysNo, payableInfo.BatchNumber.Value.ToString().PadLeft(2, '0')), EnumHelper.GetDescription(payableInfo.OrderType), bex.Message));
         ThrowBizException("Payable_BillTypePayError", (payableInfo.OrderType != PayableOrderType.PO) ? payableInfo.OrderSysNo.ToString() : string.Format("{0}-{1}", payableInfo.OrderSysNo, payableInfo.BatchNumber.Value.ToString().PadLeft(2, '0')), EnumHelper.GetDescription(payableInfo.OrderType), bex.Message);
     }
     return(payableInfo);
 }
Esempio n. 10
0
 /// <summary>
 /// 拒绝审核应付款信息
 /// </summary>
 /// <param name="entity">待拒绝审核的应付款信息</param>
 public virtual void RefuseAudit(PayableInfo entity)
 {
     if (!entity.SysNo.HasValue)
     {
         throw new ArgumentException("entity.SysNo");
     }
     ObjectFactory <PayableProcessor> .Instance.RefuseAudit(entity.SysNo.Value, 255);
 }
Esempio n. 11
0
        protected virtual void ProcessUnpaidPrepay(PayableInfo entity, PayItemInfo payItem)
        {
            //作废付款单
            ObjectFactory <PayItemProcessor> .Instance.Abandon(payItem);

            //新建应付款
            POInStock(entity);
        }
Esempio n. 12
0
 /// <summary>
 /// 拒绝审核应付款预先检查
 /// </summary>
 /// <param name="payableInfo"></param>
 protected void PreCheckForRefuseAudit(PayableInfo payableInfo)
 {
     //拒绝审核时的检测:应付记录尚未支付,并且处于待财务审状态
     if (payableInfo.PayStatus != PayableStatus.UnPay || payableInfo.AuditStatus != PayableAuditStatus.WaitFNAudit)
     {
         ThrowBizException("Payable_RefuseAudit_StatusOrAuditNotMatch");
     }
 }
Esempio n. 13
0
        /// <summary>
        /// 更新应付款状态和单据金额
        /// </summary>
        /// <param name="entity"></param>
        public void UpdateStatusAndOrderAmt(PayableInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdatePayableStatusAndOrderAmt");

            command.SetParameterValue(entity);

            command.ExecuteNonQuery();
        }
Esempio n. 14
0
 /// <summary>
 /// 更新应付款信息
 /// </summary>
 /// <param name="entity">待更新的应付款信息</param>
 public virtual void UpdateInvoice(PayableInfo entity)
 {
     if (!entity.SysNo.HasValue)
     {
         throw new ArgumentException("entity.SysNO");
     }
     ObjectFactory <PayableProcessor> .Instance.UpdateInvoice(entity);
 }
Esempio n. 15
0
        public PayableInfo Create(PayableInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("InsertPayable");

            command.SetParameterValue(entity);

            entity.SysNo = Convert.ToInt32(command.ExecuteScalar());
            return(entity);
        }
Esempio n. 16
0
        /// <summary>
        /// 更新应付款状态
        /// </summary>
        /// <param name="entity"></param>
        public void UpdateStatus(PayableInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdatePayableStatus");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@PayStatus", entity.PayStatus);

            command.ExecuteNonQuery();
        }
Esempio n. 17
0
        protected override PayItemInfo PreCheckForCancelLock(PayItemInfo entity, out PayableInfo payableInfo)
        {
            if (entity.OrderType == PayableOrderType.POAdjust)
            {
                throw new ECCentral.BizEntity.BizException(ResouceManager.GetMessageString(InvoiceConst.ResourceTitle.PayItem, "PayItem_UnLock_InvalidOrderType"));
            }

            return(base.PreCheckForCancelLock(entity, out payableInfo));
        }
Esempio n. 18
0
        /// <summary>
        /// 更新预计付款时间
        /// </summary>
        /// <param name="payableInfo"></param>
        public void UpdateETP(PayableInfo payableInfo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdatePayableETP");

            command.SetParameterValue("@SysNo", payableInfo.SysNo);
            command.SetParameterValue("@ETP", payableInfo.EstimatedTimeOfPay);

            command.ExecuteNonQuery();
        }
Esempio n. 19
0
        protected override void ProcessReferencePayableInfoForCreate(PayItemInfo entity)
        {
            //如果该付款单对应的应付款已经Abandon,那么此时需要重新激活该应付款并将其更新
            if (ReferencePayableInfo != null)
            {
                if (ReferencePayableInfo.PayStatus == PayableStatus.Abandon)
                {
                    ReferencePayableInfo.OrderAmt = entity.PayAmt;
                    ReferencePayableInfo.PayStatus = PayableStatus.UnPay;

                    if (entity.OrderType == PayableOrderType.VendorSettleOrder)
                    {
                        ReferencePayableInfo.EIMSNo = ExternalDomainBroker.GetConsignSettlementReturnPointSysNo(entity.OrderSysNo.Value);
                    }
                    else
                    {
                        ReferencePayableInfo.EIMSNo = null;
                    }
                    PayableBizProcessor.UpdateStatusAndOrderAmt(ReferencePayableInfo);

                    entity.PaySysNo = ReferencePayableInfo.SysNo.Value;
                    entity.CurrencySysNo = 1;
                    entity.OrderType = ReferencePayableInfo.OrderType;
                    entity.OrderSysNo = ReferencePayableInfo.OrderSysNo;
                }

                if (ReferencePayableInfo.PayStatus == PayableStatus.UnPay)
                {
                    entity.PaySysNo = ReferencePayableInfo.SysNo.Value;
                    entity.CurrencySysNo = 1;
                    entity.OrderType = ReferencePayableInfo.OrderType;
                    entity.OrderSysNo = ReferencePayableInfo.OrderSysNo;
                }
            }
            else
            {
                ReferencePayableInfo = new PayableInfo();
                ReferencePayableInfo.OrderSysNo = entity.OrderSysNo.Value;
                ReferencePayableInfo.OrderType = entity.OrderType.Value;
                ReferencePayableInfo.AlreadyPayAmt = 0;
                ReferencePayableInfo.OrderAmt = entity.PayAmt;
                ReferencePayableInfo.CurrencySysNo = 1;
                ReferencePayableInfo.PayStatus = PayableStatus.UnPay;
                ReferencePayableInfo.InvoiceStatus = PayableInvoiceStatus.Absent;
                ReferencePayableInfo.AuditStatus = PayableAuditStatus.NotAudit;
                ReferencePayableInfo.InvoiceFactStatus = PayableInvoiceFactStatus.Corrent;
                ReferencePayableInfo.Note = "Auto created by system!";
                ReferencePayableInfo.CompanyCode = entity.CompanyCode;

                ReferencePayableInfo = PayableBizProcessor.Create(ReferencePayableInfo);

                entity.PaySysNo = ReferencePayableInfo.SysNo.Value;
                entity.CurrencySysNo = 1;
                entity.OrderType = ReferencePayableInfo.OrderType;
                entity.OrderSysNo = ReferencePayableInfo.OrderSysNo;
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 审核应付款
        /// </summary>
        /// <param name="sysNo">应付款系统编号</param>
        /// <param name="objectAuditStatus">审核的目标状态,分待财务审核或已审核</param>
        public virtual void Audit(int sysNo, PayableAuditStatus objectAuditStatus)
        {
            PayableInfo entity = LoadBySysNo(sysNo);

            PreCheckForAudit(entity, objectAuditStatus);

            entity.AuditStatus = objectAuditStatus;
            m_PayableDA.UpdateAuditInfo(entity);
        }
Esempio n. 21
0
        protected override void ProcessReferencePayableInfoForCreate(PayItemInfo entity)
        {
            var now = DateTime.Now;

            //如果该付款单对应的应付款已经Abandon,那么此时需要重新激活该应付款并将其更新
            if (ReferencePayableInfo != null)
            {
                if (ReferencePayableInfo.PayStatus == PayableStatus.Abandon)
                {
                    ReferencePayableInfo.OrderAmt  = entity.PayAmt;
                    ReferencePayableInfo.PayStatus = PayableStatus.UnPay;

                    ReferencePayableInfo.InStockAmt  = entity.InStockAmt;
                    ReferencePayableInfo.EIMSAmt     = entity.EIMSAmt;
                    ReferencePayableInfo.RawOrderAmt = entity.RawOrderAmt;

                    CaclETP(entity, now);

                    PayableBizProcessor.UpdateStatusAndOrderAmt(ReferencePayableInfo);
                }
                entity.PaySysNo      = ReferencePayableInfo.SysNo.Value;
                entity.CurrencySysNo = m_POInfo.PurchaseOrderBasicInfo.CurrencyCode;
                entity.OrderType     = ReferencePayableInfo.OrderType;
                entity.OrderSysNo    = ReferencePayableInfo.OrderSysNo;
            }
            else
            {
                ReferencePayableInfo                    = new PayableInfo();
                ReferencePayableInfo.OrderSysNo         = entity.OrderSysNo.Value;
                ReferencePayableInfo.OrderType          = entity.OrderType.Value;
                ReferencePayableInfo.CurrencySysNo      = m_POInfo.PurchaseOrderBasicInfo.CurrencyCode;
                ReferencePayableInfo.OrderAmt           = entity.PayAmt;
                ReferencePayableInfo.AlreadyPayAmt      = 0;
                ReferencePayableInfo.PayStatus          = PayableStatus.UnPay;
                ReferencePayableInfo.InvoiceStatus      = PayableInvoiceStatus.Absent;
                ReferencePayableInfo.AuditStatus        = PayableAuditStatus.NotAudit;
                ReferencePayableInfo.InvoiceFactStatus  = PayableInvoiceFactStatus.Corrent;
                ReferencePayableInfo.Note               = "Auto created by system!";
                ReferencePayableInfo.BatchNumber        = entity.BatchNumber.HasValue ? entity.BatchNumber : 1;
                ReferencePayableInfo.EIMSAmt            = entity.EIMSAmt;
                ReferencePayableInfo.InStockAmt         = entity.InStockAmt;
                ReferencePayableInfo.RawOrderAmt        = entity.RawOrderAmt;
                ReferencePayableInfo.OrderStatus        = entity.OrderStatus;
                ReferencePayableInfo.EstimatedTimeOfPay = entity.EstimatedTimeOfPay;
                ReferencePayableInfo.CompanyCode        = entity.CompanyCode;

                CaclETP(entity, now);

                ReferencePayableInfo = PayableBizProcessor.Create(ReferencePayableInfo);

                entity.PaySysNo      = ReferencePayableInfo.SysNo.Value;
                entity.CurrencySysNo = m_POInfo.PurchaseOrderBasicInfo.CurrencyCode;
                entity.OrderType     = ReferencePayableInfo.OrderType;
                entity.OrderSysNo    = ReferencePayableInfo.OrderSysNo;
            }
        }
Esempio n. 22
0
 public PayableViewModel()
 {
     Pager              = new PaginationInfo();
     FriendlyMessage    = new List <FriendlyMessage>();
     PayableInfo        = new PayableInfo();
     PayableList        = new List <PayableInfo>();
     PayableHistoryInfo = new PayableHistoryInfo();
     PayableHistoryList = new List <PayableHistoryInfo>();
     TransactionInfo    = new TransactionInfo();
 }
Esempio n. 23
0
 /// <summary>
 /// 更新应付款发票状态和ETP
 /// </summary>
 /// <param name="payable"></param>
 public virtual void UpdatePayableInvoiceStatusWithEtp(PayableInfo payable)
 {
     m_PayableDA.UpdatePayableInvoiceStatusWithEtp(payable);
     //记录操作日志
     ObjectFactory <ICommonBizInteract> .Instance.CreateOperationLog(
         GetMessageString("Payable_Log_Update", ServiceContext.Current.UserSysNo, payable.SysNo)
         , BizLogType.Finance_Pay_Item_Add
         , payable.SysNo.Value
         , payable.CompanyCode);
 }
Esempio n. 24
0
        public List <SqlParameter> SetValuesInPayable(PayableInfo PayableInfo)
        {
            List <SqlParameter> sqlParam = new List <SqlParameter>();

            if (PayableInfo.PayableId != 0)
            {
                sqlParam.Add(new SqlParameter("@PayableId", PayableInfo.PayableId));
            }
            else
            {
                sqlParam.Add(new SqlParameter("@CreatedDate", PayableInfo.CreatedDate));

                sqlParam.Add(new SqlParameter("@CreatedBy", PayableInfo.CreatedBy));
            }

            sqlParam.Add(new SqlParameter("@BookingId", PayableInfo.BookingId));

            Logger.Debug("Payable Controller BookingId:" + PayableInfo.BookingId);

            sqlParam.Add(new SqlParameter("@ProductId", PayableInfo.ProductId));

            Logger.Debug("Payable Controller ProductId:" + PayableInfo.ProductId);

            sqlParam.Add(new SqlParameter("@VendorId", PayableInfo.VendorId));

            Logger.Debug("Payable Controller VendorId:" + PayableInfo.VendorId);

            sqlParam.Add(new SqlParameter("@TotalAmount", PayableInfo.TotalAmount));

            Logger.Debug("Payable Controller TotalAmount:" + PayableInfo.TotalAmount);

            sqlParam.Add(new SqlParameter("@BalanceAmount", PayableInfo.BalanceAmount));

            Logger.Debug("Payable Controller BalanceAmount:" + PayableInfo.BalanceAmount);


            if (PayableInfo.TotalAmount == PayableInfo.BalanceAmount || PayableInfo.BalanceAmount == 0)
            {
                sqlParam.Add(new SqlParameter("@PaymentStatus", "Fully Paid"));

                Logger.Debug("Payable Controller PaymentStatus:" + PayableInfo.PaymentStatus);
            }
            else if (PayableInfo.TotalAmount > PayableInfo.BalanceAmount)
            {
                sqlParam.Add(new SqlParameter("@PaymentStatus", "Partially Paid"));

                Logger.Debug("Payable Controller PaymentStatus:" + PayableInfo.PaymentStatus);
            }
            sqlParam.Add(new SqlParameter("@UpdatedDate", PayableInfo.UpdatedDate));

            sqlParam.Add(new SqlParameter("@UpdatedBy", PayableInfo.UpdatedBy));

            return(sqlParam);
        }
Esempio n. 25
0
        /// <summary>
        /// 更新付款单发票信息
        /// </summary>
        /// <param name="entity"></param>
        public void UpdateInvoiceInfo(PayableInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdatePayableInvoive");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@InvoiceStatus", entity.InvoiceStatus);
            command.SetParameterValue("@InvoiceFactStatus", entity.InvoiceFactStatus);
            command.SetParameterValue("@Note", entity.Note);
            command.SetParameterValueAsCurrentUserSysNo("@UpdateInvoiceUserSysNo");
            command.ExecuteNonQuery();
        }
Esempio n. 26
0
        public void UpdatePayableEGPAndETP(PayableInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdatePayableEGPAndETP");

            command.SetParameterValue("@SysNo", entity.SysNo);
            //command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            command.SetParameterValue("@EGP", entity.EGP);
            command.SetParameterValue("@ETP", entity.ETP);
            command.ExecuteNonQuery();

            //return entity;
        }
Esempio n. 27
0
        public void CreatePayByVendor(int poSysNo, int batchNo, int orderStatus, PayableOrderType orderType, decimal?inStockAmt, string companyCode)
        {
            PayableInfo entity = new PayableInfo();

            entity.OrderSysNo  = poSysNo;
            entity.BatchNumber = batchNo;
            entity.OrderStatus = orderStatus;
            entity.OrderType   = orderType;
            entity.InStockAmt  = inStockAmt;
            entity.CompanyCode = companyCode;

            ObjectFactory <PayableProcessor> .Instance.CreateByVendor(entity);
        }
Esempio n. 28
0
        /// <summary>
        /// 拒绝审核应付款
        /// </summary>
        /// <param name="entity"></param>
        public virtual void RefuseAudit(int sysNo, int pmSysNo)
        {
            PayableInfo payableInfo = LoadBySysNo(sysNo);

            PreCheckForRefuseAudit(payableInfo);

            payableInfo.AuditStatus = PayableAuditStatus.NotAudit;
            payableInfo.Memo        = GetMessageString("Payable_RefuseAudit_Success", payableInfo.OrderSysNo);
            m_PayableDA.UpdateAuditInfo(payableInfo);

            //发送邮件通知
            SendMailAfterRefuseAuditFinancePay(pmSysNo, payableInfo);
        }
Esempio n. 29
0
        public void UpdateFirstPay(PayableInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdateFirstPay");

            command.SetParameterValue("@SysNo", entity.SysNo);
            command.SetParameterValue("@PayStatus", entity.PayStatus);
            command.SetParameterValue("@OrderAmt", entity.OrderAmt);
            command.SetParameterValue("@OrderStatus", entity.OrderStatus);
            command.SetParameterValue("@InStockAmt", entity.InStockAmt);
            command.SetParameterValue("@EIMSAmt", entity.EIMSAmt);
            command.SetParameterValue("@RawOrderAmt", entity.RawOrderAmt);
            command.ExecuteNonQuery();
        }
Esempio n. 30
0
        protected override void ProcessReferencePayableInfoForCreate(PayItemInfo entity)
        {
            var now = System.DateTime.Now;
            List <PayableInfo> payList = PayableBizProcessor.GetListByCriteria(new PayableInfo
            {
                OrderSysNo = entity.OrderSysNo,
                OrderType  = entity.OrderType
            });

            if (payList != null && payList.Count > 0)
            {
                ReferencePayableInfo = payList[0];
                if (ReferencePayableInfo.PayStatus == PayableStatus.Abandon)
                {
                    ReferencePayableInfo.OrderAmt           = entity.PayAmt;
                    ReferencePayableInfo.PayStatus          = PayableStatus.UnPay;
                    ReferencePayableInfo.EIMSNo             = null;
                    ReferencePayableInfo.EstimatedTimeOfPay = now;
                    PayableBizProcessor.UpdateStatusAndOrderAmt(ReferencePayableInfo);
                }
                entity.CurrencySysNo = 1;
                entity.PaySysNo      = ReferencePayableInfo.SysNo.Value;
                entity.OrderType     = ReferencePayableInfo.OrderType;
                entity.OrderSysNo    = ReferencePayableInfo.OrderSysNo;
            }
            else
            {
                ReferencePayableInfo                    = new PayableInfo();
                ReferencePayableInfo.OrderSysNo         = entity.OrderSysNo.Value;
                ReferencePayableInfo.OrderType          = entity.OrderType.Value;
                ReferencePayableInfo.AlreadyPayAmt      = 0;
                ReferencePayableInfo.OrderAmt           = entity.PayAmt;
                ReferencePayableInfo.CurrencySysNo      = 1;// 人民币类型
                ReferencePayableInfo.PayStatus          = PayableStatus.UnPay;
                ReferencePayableInfo.InvoiceStatus      = PayableInvoiceStatus.Absent;
                ReferencePayableInfo.AuditStatus        = PayableAuditStatus.NotAudit;
                ReferencePayableInfo.InvoiceFactStatus  = PayableInvoiceFactStatus.Corrent;
                ReferencePayableInfo.Note               = "Auto created by system!";
                ReferencePayableInfo.EIMSNo             = null;
                ReferencePayableInfo.EstimatedTimeOfPay = now;
                ReferencePayableInfo.CompanyCode        = entity.CompanyCode;
                ReferencePayableInfo                    = PayableBizProcessor.Create(ReferencePayableInfo);

                entity.PaySysNo      = ReferencePayableInfo.SysNo.Value;
                entity.CurrencySysNo = 1;
                entity.OrderType     = ReferencePayableInfo.OrderType;
                entity.OrderSysNo    = ReferencePayableInfo.OrderSysNo;
            }
        }