Пример #1
0
        /// <summary>
        /// 取消审核代销结算单
        /// </summary>
        /// <param name="consignInfo"></param>
        /// <param name="callback"></param>
        public void CancelAuditConsignSettlement(ConsignSettlementInfo consignInfo, EventHandler <RestClientEventArgs <object> > callback)
        {
            consignInfo.CompanyCode = CPApplication.Current.CompanyCode;
            string relativeUrl = "POService/ConsignSettlement/CancelAuditConsignSettlement";

            restClient.Update(relativeUrl, consignInfo, callback);
        }
Пример #2
0
        private void ProcessDeduct(ConsignSettlementInfo settle)
        {
            DateTime begin = DateTime.Today.AddMonths(-1);

            settle.ConsignRange = begin.ToString("yyyy-MM");
            VendorDeductEntity deduct = dal.GetVendorDeductInfo(settle.VendorInfo.SysNo.Value);

            if (deduct != null)
            {
                switch (deduct.CalcType)
                {
                case VendorCalcType.Fix:
                    settle.DeductAmt = deduct.FixAmt;
                    break;

                case VendorCalcType.Cost:
                    settle.DeductAmt = settle.ConsignSettlementItemInfoList.Sum(p => p.CreateCost.Value * p.Quantity.Value * deduct.DeductPercent);
                    break;

                case VendorCalcType.Sale:
                    settle.DeductAmt = settle.ConsignSettlementItemInfoList.Sum(p => p.RetailPrice * p.Quantity.Value * deduct.DeductPercent);;
                    break;

                default:
                    settle.DeductAmt = 0;
                    break;
                }
                if (deduct.MaxAmt > 0)
                {
                    settle.DeductAmt = settle.DeductAmt > deduct.MaxAmt ? deduct.MaxAmt : settle.DeductAmt;
                }
                settle.DeductAccountType = deduct.AccountType;
                settle.DeductMethod      = deduct.DeductMethod;
            }
        }
Пример #3
0
        /// <summary>
        /// 更新代销结算单信息
        /// </summary>
        /// <param name="consignInfo"></param>
        /// <param name="callback"></param>
        public void UpdateConsignSettlement(ConsignSettlementInfo consignInfo, EventHandler <RestClientEventArgs <object> > callback)
        {
            consignInfo.CompanyCode     = CPApplication.Current.CompanyCode;
            consignInfo.CreateUserSysNo = CPApplication.Current.LoginUser.UserSysNo;
            string relativeUrl = "POService/ConsignSettlement/UpdateConsignSettlement";

            restClient.Update(relativeUrl, consignInfo, callback);
        }
Пример #4
0
        public ConsignSettlementInfo UpdateSettleStatus(ConsignSettlementInfo settlementInfo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdateSettleStatus");

            command.SetParameterValue("@SettleTime", settlementInfo.SettleDate);
            command.SetParameterValue("@SettleUserSysNo", settlementInfo.SettleUser.UserID);
            command.SetParameterValue("@Memo", settlementInfo.Memo);
            command.SetParameterValue("@Note", settlementInfo.Note);
            command.SetParameterValue("@Status", (int)settlementInfo.Status);
            command.SetParameterValue("@SysNo", settlementInfo.SysNo);
            command.ExecuteNonQuery();

            return(settlementInfo);
        }
Пример #5
0
        public ConsignSettlementInfo CreateConsignSettlementInfo(ConsignSettlementInfo consignSettlementInfo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CreateVendorSettle");

            command.SetParameterValue("@SysNo", consignSettlementInfo.SysNo);
            command.SetParameterValue("@SettleID", consignSettlementInfo.ReferenceSysNo);
            command.SetParameterValue("@VendorSysNo", consignSettlementInfo.VendorInfo.SysNo);
            command.SetParameterValue("@StockSysNo", consignSettlementInfo.SourceStockInfo.SysNo);
            command.SetParameterValue("@TotalAmt", consignSettlementInfo.TotalAmt);
            command.SetParameterValue("@CurrencySysNo", consignSettlementInfo.CurrencyCode);
            command.SetParameterValue("@CreateTime", DateTime.Now);
            command.SetParameterValueAsCurrentUserSysNo("@CreateUserSysNo");
            command.SetParameterValue("@Memo", consignSettlementInfo.Memo);
            command.SetParameterValue("@Note", consignSettlementInfo.Note);
            command.SetParameterValue("@Status", (int)consignSettlementInfo.Status);
            command.SetParameterValue("@SettleBalanceSysNo", consignSettlementInfo.SettleBalanceSysNo);
            command.SetParameterValue("@TaxRate", ((decimal)consignSettlementInfo.TaxRateData) / 100m);
            //////////////////////////////CLR16063//////////////////////////////
            command.SetParameterValue("@UsingReturnPoint", (!consignSettlementInfo.EIMSInfo.UsingReturnPoint.HasValue || consignSettlementInfo.EIMSInfo.UsingReturnPoint == 0m) ? (decimal?)null : consignSettlementInfo.EIMSInfo.UsingReturnPoint.Value);
            command.SetParameterValue("@PM_ReturnPointSysNo", consignSettlementInfo.PM_ReturnPointSysNo);
            command.SetParameterValue("@PMSysno", consignSettlementInfo.PMInfo.SysNo);
            command.SetParameterValue("@ReturnPointC3SysNo", consignSettlementInfo.ReturnPointC3SysNo);
            ////////////////////////////////////////////////////////////////////
            command.SetParameterValue("@CompanyCode", consignSettlementInfo.CompanyCode);
            command.SetParameterValue("@ProductLineSysNo", consignSettlementInfo.ProductLineSysNo);
            command.SetParameterValue("@IsToLease", (int)consignSettlementInfo.LeaseType);
            command.SetParameterValue("@DeductAmt", consignSettlementInfo.DeductAmt);
            command.SetParameterValue("@DeductAccountType", consignSettlementInfo.DeductAccountType == null?-1: (int)consignSettlementInfo.DeductAccountType);
            command.SetParameterValue("@DeductMethod", consignSettlementInfo.DeductMethod == null?-1: (int)consignSettlementInfo.DeductMethod);
            command.SetParameterValue("@ConsignRange", consignSettlementInfo.ConsignRange);
            consignSettlementInfo.SysNo    = System.Convert.ToInt32(command.ExecuteScalar());
            consignSettlementInfo.SettleID = "V" + consignSettlementInfo.SysNo.ToString().PadLeft(9, '0');

            if (consignSettlementInfo.ConsignSettlementItemInfoList != null && consignSettlementInfo.ConsignSettlementItemInfoList.Count > 0)
            {
                foreach (ConsignSettlementItemInfo item in consignSettlementInfo.ConsignSettlementItemInfoList)
                {
                    item.SettleSysNo = consignSettlementInfo.SysNo.Value;
                    item.CompanyCode = consignSettlementInfo.CompanyCode;
                    CreateConsignSettlemtnItemInfo(item);
                }
            }

            return(consignSettlementInfo);
        }
Пример #6
0
        private void btnAudit_Click(object sender, RoutedEventArgs e)
        {
            if (this.QueryResultGrid.SelectedItem == null || this.QueryResultGrid.SelectedIndex < 0)
            {
                Window.Alert(ResConsignQuery.AlertMsg_Audit);
                return;
            }
            //审核代销结算单:
            Window.Confirm(ResConsignQuery.AlertMsg_Alert, ResConsignQuery.AlertMsg_Confirm, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    DynamicXml getObject = this.QueryResultGrid.SelectedItem as DynamicXml;
                    if (null != getObject)
                    {
                        int getSysNo = Convert.ToInt32(getObject["SysNo"].ToString());
                        ConsignSettlementInfo newAuditConsign = new ConsignSettlementInfo()
                        {
                            SysNo = getSysNo
                        };

                        /*
                         * serviceFacade.AuditConsignSettlement(newAuditConsign, (obj2, args2) =>
                         * {
                         *  if (args2.FaultsHandle())
                         *  {
                         *      return;
                         *  }
                         *  Window.Alert(ResConsignQuery.AlertMsg_Alert, ResConsignQuery.AlertMsg_Success, MessageType.Information, (obj3, args3) =>
                         *  {
                         *      if (args3.DialogResult == DialogResultType.Cancel)
                         *      {
                         *          this.QueryResultGrid.PageIndex = 0;
                         *          this.QueryResultGrid.SelectedIndex = -1;
                         *          this.QueryResultGrid.Bind();
                         *      }
                         *  });
                         * });
                         */
                    }
                }
            });
        }
Пример #7
0
        protected override void PreCheckForCreate(PayItemInfo entity)
        {
            base.PreCheckForCreate(entity);

            m_ConsignSettlement = ExternalDomainBroker.GetConsignSettlementInfo(entity.OrderSysNo.Value);

            if (m_ConsignSettlement == null)
            {
                ThrowBizException("PayItem_OrderNotExisitsFormat", entity.OrderSysNo);
            }
            //填写代销结算单上的CompanyCode为付款单CompanyCode
            entity.CompanyCode = m_ConsignSettlement.CompanyCode;
            entity.OrderStatus = (int?)m_ConsignSettlement.Status;

            if (m_ConsignSettlement.Status == SettleStatus.SettlePassed)
            {
                if (entity.PayStyle != PayItemStyle.Normal)
                {
                    ThrowBizException("PayItem_Create_OnlyCanAddNormalPayForVendorSettleOrder");
                }
            }
            else
            {
                ThrowBizException("PayItem_Create_CannotAddPayForUnSettled");
            }

            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.FullPay)
                {
                    ThrowBizException("PayItem_Create_FullPay");
                }
            }
        }
Пример #8
0
        public BizEntity.PO.ConsignSettlementInfo LoadConsignSettlementInfo(int consignSettlementSysNo)
        {
            ConsignSettlementInfo returnEntity = new ConsignSettlementInfo();
            CustomDataCommand     command      = DataCommandManager.CreateCustomDataCommandFromConfig("GetVendorSettleBySysNo");

            using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, null, "Settle.SysNo DESC"))
            {
                //TODO: PM权限处理:
                //HasPMRight(builder);

                builder.ConditionConstructor.AddCondition(
                    QueryConditionRelationType.AND,
                    "Settle.SysNo",
                    DbType.Int32,
                    "@SettleSysNo",
                    QueryConditionOperatorType.Equal,
                    consignSettlementSysNo);

                command.CommandText = builder.BuildQuerySql();
            }
            returnEntity = command.ExecuteEntity <ConsignSettlementInfo>();
            return(returnEntity);
        }
 public virtual ConsignSettlementInfo UpdateConsignSettlementInfo(ConsignSettlementInfo consignInfo)
 {
     return(ConsignSettlementProcessor.UpdateConsignSettlementInfo(consignInfo));
 }
Пример #10
0
 public virtual ConsignSettlementInfo SystemCreateConsignSettlementInfo(ConsignSettlementInfo info)
 {
     return(ConsignSettlementProcessor.CreateConsignSettlementInfo(info, true));
 }
Пример #11
0
 public virtual ConsignSettlementInfo CreateConsignSettlementInfo(ConsignSettlementInfo info)
 {
     return(ConsignSettlementProcessor.CreateConsignSettlementInfo(info, false));
 }
Пример #12
0
 public void CancelAbandonConsignSettlement(ConsignSettlementInfo consignInfo)
 {
     ObjectFactory <ConsignSettlementAppService> .Instance.CancelAbandonSettlementInfo(consignInfo);
 }
Пример #13
0
 public void UpdateConsignSettlementInfo(ConsignSettlementInfo consignInfo)
 {
     ObjectFactory <ConsignSettlementAppService> .Instance.UpdateConsignSettlementInfo(consignInfo);
 }
Пример #14
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            #region [验证]
            if (!ValidationManager.Validate(this))
            {
                return;
            }
            if (this.newVM.ConsignSettlementItemInfoList.Where(x => x.SettleSysNo != -1).Count() <= 0)
            {
                Window.Alert("请先选择结算商品!");
                return;
            }
            #endregion
            //保存操作:
            Window.Confirm(ResConsignNew.ConfirmMsg_Save, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    //去除已经删除的Item(SysNo=-1)
                    newVM.ConsignSettlementItemInfoList = (from tItem in newVM.ConsignSettlementItemInfoList
                                                           where tItem.SettleSysNo != -1
                                                           select tItem).ToList();

                    ConsignSettlementInfo info = EntityConverter <ConsignSettlementInfoVM, ConsignSettlementInfo> .Convert(newVM, (s, t) =>
                    {
                        decimal usingReturnPoint = 0m;
                        t.EIMSInfo = new ConsignSettlementEIMSInfo();
                        if (decimal.TryParse("", out usingReturnPoint))
                        {
                            t.EIMSInfo.UsingReturnPoint = usingReturnPoint;
                        }
                        else
                        {
                            t.EIMSInfo.UsingReturnPoint = null;
                        }
                        t.SourceStockInfo = new BizEntity.Inventory.StockInfo()
                        {
                            SysNo = s.StockSysNo,
                        };
                        t.PMInfo = new BizEntity.IM.ProductManagerInfo()
                        {
                            SysNo = Convert.ToInt32(s.PMSysNo),
                        };
                        t.SettleUser = new BizEntity.Common.UserInfo()
                        {
                            SysNo = s.SettleUserSysNo,
                        };
                    });

                    info.ConsignSettlementItemInfoList.ForEach(x =>
                    {
                        x.ConsignToAccLogInfo.Cost = !x.ConsignToAccLogInfo.Cost.HasValue ? 0m : x.ConsignToAccLogInfo.Cost;
                    });
                    //保存PM高级权限,用于业务端验证
                    info.IsManagerPM = AuthMgr.HasFunctionAbsolute(AuthKeyConst.PO_SeniorPM_Query);
                    //代销商品规则检测
                    info.ConsignSettlementItemInfoList.ForEach(item =>
                    {
                        if (item.SettleType == SettleType.O)
                        {
                            if (item.SettleRuleSysNo.HasValue && item.Cost != item.SettlePrice)
                            {
                                item.SettleRuleSysNo = null;
                                item.SettleRuleName  = null;
                            }
                        }
                    });
                    //转租赁
                    info.LeaseType = this.newVM.LeaseType;
                    serviceFacade.CreateConsignSettlement(info, (obj2, args2) =>
                    {
                        if (args2.FaultsHandle())
                        {
                            return;
                        }
                        Window.Alert(ResConsignNew.InfoMsg_Title, ResConsignNew.InfoMsg_CreateSuccess, MessageType.Information, (obj3, args3) =>
                        {
                            if (args3.DialogResult == DialogResultType.Cancel)
                            {
                                Window.Close();
                            }
                        });
                    });
                }
            });
        }
Пример #15
0
 public virtual ConsignSettlementInfo CancelAuditConsignSettlement(ConsignSettlementInfo consignInfo)
 {
     return(ConsignSettlementProcessor.CancalAuditConsignSettlement(consignInfo));
 }
Пример #16
0
 public void AuditConsignSettlement(ConsignSettlementInfo consignInfo)
 {
     ObjectFactory <ConsignSettlementAppService> .Instance.AuditConsignSettlement(consignInfo);
 }
Пример #17
0
        /// <summary>
        /// 根据AccLog构建代销结算单
        /// </summary>
        /// <param name="acclogList">AccLog</param>
        /// <returns>代销结算单列表</returns>
        private List <ConsignSettlementInfo> GetVendorSettleList(List <ConsginToAccLogEntity> acclogList)
        {
            var consignSettlementInfoList = new List <ConsignSettlementInfo>();

            //检查SettleType,去除非法数据
            var invalidDataQuery = from item in acclogList
                                   where (item.SettleType.ToUpper() != "O" && item.SettleType.ToUpper() != "P" ||
                                          item.SettleType.ToUpper() == "P" && !item.SettlePercentage.HasValue)
                                   select item;

            var invalidList = invalidDataQuery.ToList();

            //如果存在错误数据,则发邮件提醒
            SendMailForInvalidData(invalidList);

            //排除错误数据
            var validDataQuery = acclogList.Except(invalidDataQuery);
            //Ray  新增 通过 产品线分组
            var groups = from item in validDataQuery
                         group item by new { item.VendorSysNo, item.VendorName, item.StockSysNo, item.ProductLineSysNo, item.CurrencySysNo, item.TaxRate, item.PMUserSysNo, item.PayPeriodType, item.IsToLease }
            into team
            select team;

            foreach (var group in groups)
            {
                ConsignSettlementInfo settle = null;

                var i = 0;
                foreach (var item in group)
                {
                    //每个代销结算单最多只能有MaxItemCount个Item
                    if (i % GlobalSettings.MaxItemCount == 0)
                    {
                        settle = new ConsignSettlementInfo();

                        settle.CreateUserName  = GlobalSettings.UserName;
                        settle.CreateUserSysNo = GlobalSettings.UserSysNo;
                        settle.CreateDate      = DateTime.Now;
                        settle.CurrencyCode    = group.Key.CurrencySysNo;
                        //settle.PayPeriodType = group.Key.PayPeriodType;

                        //settle.PM_ReturnPointSysNo = group.Key.PMUserSysNo;
                        settle.Status = SettleStatus.WaitingAudit;
                        //settle.StockName = group.Key.TaxRate.ToString();
                        settle.SourceStockInfo = new ECCentral.BizEntity.Inventory.StockInfo
                        {
                            SysNo = group.Key.StockSysNo
                        };

                        //settle.TaxRateData = group.Key.TaxRate;
                        settle.TaxRateData = PurchaseOrderTaxRate.Percent017;
                        //settle.VendorName = group.Key.VendorName;
                        //settle.VendorSysNo = group.Key.VendorSysNo;
                        settle.VendorInfo = new VendorInfo
                        {
                            SysNo = group.Key.VendorSysNo
                        };
                        settle.Note = "System Create";
                        settle.ConsignSettlementItemInfoList = new List <ConsignSettlementItemInfo>();
                        settle.PMInfo = new ECCentral.BizEntity.IM.ProductManagerInfo {
                            SysNo = group.Key.PMUserSysNo
                        };
                        settle.EIMSInfo = new ConsignSettlementEIMSInfo {
                            ReturnPoint = 0
                        };
                        settle.CompanyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];
                        settle.LeaseType   = item.IsToLease == 0 ? VendorIsToLease.UnLease : VendorIsToLease.Lease;

                        //生成新单据
                        consignSettlementInfoList.Add(settle);
                    }

                    ConsignSettlementItemInfo settleItem = new ConsignSettlementItemInfo();

                    //为SettleItem的属性赋值
                    SetItemValue(item, settleItem);
                    settle.ConsignSettlementItemInfoList.Add(settleItem);
                    i++;
                }
                //扣款项逻辑
                ProcessDeduct(settle);
            }

            //计算TotalAmt
            consignSettlementInfoList.ForEach(x =>
                                              x.TotalAmt = x.ConsignSettlementItemInfoList.Sum(y => y.Cost * y.Quantity) - x.DeductAmt
                                              );

            return(consignSettlementInfoList);
        }
Пример #18
0
        private void InitData(int sysno, DataTable table)
        {
            //获取代销单i型纳西】
            ConsignSettlementInfo origin = ObjectFactory <ConsignSettlementProcessor> .Instance.LoadConsignSettlementInfo(sysno);

            //获取商家信息
            VendorInfo vendor = ObjectFactory <VendorProcessor> .Instance.LoadVendorInfo(origin.VendorInfo.SysNo.Value);

            DataRow row = null;

            row = table.NewRow();

            row["StatementSysNo"] = sysno;                            //结算单号
            row["ContractSysNo"]  = string.Empty;                     //合同号
            row["StatementDate"]  = DateTime.Now.ToString("yyyy/MM"); //结算年月
            row["PrintDate"]      = DateTime.Now.ToString();          //打印日期

            row["StatementDepartment"] = "商品部";                       //结算部门

            //本月销售
            decimal amount = 0;

            foreach (var sub in origin.ConsignSettlementItemInfoList)
            {
                amount += sub.ConsignToAccLogInfo.SalePrice.Value * sub.ConsignToAccLogInfo.ProductQuantity.Value;
            }
            row["CurrentMonthMarket"] = amount.ToString("f2");                                                                           //本月销售

            row["PayDate"] = string.Empty;                                                                                               //付款日

            row["CompanyName1"] = vendor.VendorBasicInfo.VendorNameLocal;                                                                //公司名称
            row["CheckType"]    = "租赁-001";                                                                                              //核算方式

            row["CompanyAddress"] = vendor.VendorBasicInfo.Address;                                                                      //公司地址
            row["TaxNo"]          = vendor.VendorFinanceInfo.TaxNumber;                                                                  //税号

            row["OpenedBank"]  = vendor.VendorFinanceInfo.BankName;                                                                      //开户行
            row["BankAccount"] = vendor.VendorFinanceInfo.AccountNumber;                                                                 //账号

            row["VendorCode"]  = vendor == null ? string.Empty : vendor.VendorBasicInfo.VendorID;                                        //供货商代码
            row["VendorSysno"] = vendor == null ? string.Empty : origin.VendorInfo.SysNo.Value.ToString();                               //供货商系统编号
            row["CreateDate"]  = DateTime.Now.ToString();                                                                                //制单日期

            row["CutPaymentName"]        = origin.DeductMethod.HasValue ? (origin.DeductMethod == DeductMethod.Cash ? "现金" : "货扣") : ""; //扣款名称
            row["CutPaymentAmount"]      = origin.DeductMethod.HasValue ? "¥" + origin.DeductAmt.ToString("f2") : "¥0.00";               //扣款金额
            row["TotalCutPaymentAmount"] = origin.DeductMethod.HasValue ? "¥" + origin.DeductAmt.ToString("f2") : "¥0.00";               //合计

            //类型
            var taxRateData = origin.TaxRateData;
            Func <PurchaseOrderTaxRate, decimal, decimal> Shuijin = (a, b) =>
            {
                return(((decimal)(((int)a) / 100.00)) * b / ((decimal)(((int)a) / 100.00) + 1));
            };
            Func <PurchaseOrderTaxRate, decimal, decimal> Jiakuan = (a, b) =>
            {
                return(b / ((decimal)(((int)a) / 100.00) + 1));
            };

            string DefaultMony = ((int)0).ToString("f2");

            row["Cost"]       = DefaultMony;      //价款
            row["RateAmount"] = DefaultMony;      //税金
            row["RateTotal"]  = DefaultMony;      //税金合计

            row["17RateCost"]   = DefaultMony;    //17%税率价款
            row["17RateAmount"] = DefaultMony;    //税金
            row["17RateTotal"]  = DefaultMony;    //税金合计

            row["13RateCost"]   = DefaultMony;    //13%税率价款
            row["13RateAmount"] = DefaultMony;    //税金
            row["13RateTotal"]  = DefaultMony;    //税金合计

            row["OtherRateCost"]   = DefaultMony; //其他税率价款
            row["OtherRateAmount"] = DefaultMony; //税金
            row["OtherRateTotal"]  = DefaultMony; //税金合计

            decimal jiakuan    = Jiakuan(taxRateData.Value, origin.TotalAmt.Value);
            string  jiakuanStr = jiakuan.ToString("f2");
            string  jieSuam    = Shuijin(taxRateData.Value, origin.TotalAmt.Value).ToString("f2");
            string  zongJine   = origin.TotalAmt.Value.ToString("f2");

            row["Cost"]       = jiakuanStr; //价款
            row["RateAmount"] = jieSuam;    //税金
            row["RateTotal"]  = zongJine;   //税金合计

            if (taxRateData == PurchaseOrderTaxRate.Percent017)
            {
                row["17RateCost"]   = jiakuanStr; //17%税率价款
                row["17RateAmount"] = jieSuam;    //税金
                row["17RateTotal"]  = zongJine;   //税金合计
            }
            else if (taxRateData == PurchaseOrderTaxRate.Percent013)
            {
                row["13RateCost"]   = jiakuanStr; //13%税率价款
                row["13RateAmount"] = jieSuam;    //税金
                row["13RateTotal"]  = zongJine;   //税金合计
            }
            else
            {
                row["OtherRateCost"]   = jiakuanStr; //其他税率价款
                row["OtherRateAmount"] = jieSuam;    //税金
                row["OtherRateTotal"]  = zongJine;   //税金合计
            }

            row["ActualPayAmount"] = origin.TotalAmt.HasValue ? origin.TotalAmt.Value.ToString("f2") : "0.00"; //实际付款金额

            row["CompanyName2"] = "网购中心";                                                                      //公司名称
            row["Producer"]     = string.Empty;                                                                //制作人

            row["BusinessCheck"]  = string.Empty;                                                              //业务审核
            row["FinanceRecheck"] = string.Empty;                                                              //财务复核

            row["DepartmentManager"] = string.Empty;                                                           //部门经理
            row["Manufacturer"]      = string.Empty;                                                           //厂商

            row["display"] = "";

            table.Rows.Add(row);
        }
Пример #19
0
        public ConsignSettlementInfo UpdateConsignSettlementInfo(ConsignSettlementInfo settlementInfo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdateVendorSettle");

            command.SetParameterValue("@SysNo", settlementInfo.SysNo);
            command.SetParameterValue("@SettleID", settlementInfo.ReferenceSysNo);
            command.SetParameterValue("@VendorSysNo", settlementInfo.VendorInfo.SysNo);
            command.SetParameterValue("@StockSysNo", settlementInfo.SourceStockInfo.SysNo);
            command.SetParameterValue("@TotalAmt", settlementInfo.TotalAmt);
            command.SetParameterValue("@CurrencySysNo", settlementInfo.CurrencyCode);
            command.SetParameterValue("@Memo", settlementInfo.Memo);
            command.SetParameterValue("@Note", settlementInfo.Note);
            command.SetParameterValue("@SettleBalanceSysNo", settlementInfo.SettleBalanceSysNo);
            command.SetParameterValue("@TaxRate", ((int)settlementInfo.TaxRateData.Value / 100.0));

            //////////////////////////////CLR16063//////////////////////////////
            command.SetParameterValue("@UsingReturnPoint", settlementInfo.EIMSInfo.UsingReturnPoint);
            command.SetParameterValue("@PM_ReturnPointSysNo", settlementInfo.PM_ReturnPointSysNo);
            command.SetParameterValue("@PMSysno", settlementInfo.PMInfo.SysNo);
            command.SetParameterValue("@ReturnPointC3SysNo", settlementInfo.ReturnPointC3SysNo);
            ////////////////////////////////////////////////////////////////////
            command.SetParameterValue("@ProductLineSysNo", settlementInfo.ProductLineSysNo);

            command.ExecuteNonQuery();

            if (settlementInfo.ConsignSettlementItemInfoList != null && settlementInfo.ConsignSettlementItemInfoList.Count > 0)
            {
                foreach (ConsignSettlementItemInfo item in settlementInfo.ConsignSettlementItemInfoList)
                {
                    //更新SettleItem:
                    if (item.ItemSysNo.HasValue && item.AcquireReturnPointType.HasValue && item.AcquireReturnPoint.HasValue)
                    {
                        command = DataCommandManager.GetDataCommand("UpdateVendorSettleItem");

                        command.SetParameterValue("@Cost", item.Cost);
                        command.SetParameterValue("@SysNo", item.ItemSysNo);
                        command.SetParameterValue("@CurrencySysNo", item.CurrenyCode);
                        command.SetParameterValue("@AcquireReturnPoint", item.AcquireReturnPoint.Value);
                        command.SetParameterValue("@AcquireReturnPointType", item.AcquireReturnPointType.Value);
                        command.SetParameterValue("@SettlePercentage", item.SettlePercentage);
                        command.SetParameterValue("@SettleType", item.SettleType.Value.ToString());
                        command.SetParameterValue("@SettleRuleSysNo", item.SettleRuleSysNo);
                        command.ExecuteNonQuery();
                    }
                    else if (item.ItemSysNo.HasValue)
                    {
                        command = DataCommandManager.GetDataCommand("UpdateVendorSettleItemNOAcquirePoint");

                        command.SetParameterValue("@Cost", item.Cost);
                        command.SetParameterValue("@SysNo", item.ItemSysNo);
                        command.SetParameterValue("@CurrencySysNo", item.CurrenyCode);
                        command.SetParameterValue("@SettlePercentage", item.SettlePercentage);
                        command.SetParameterValue("@SettleType", item.SettleType.Value.ToString());
                        command.SetParameterValue("@SettleRuleSysNo", item.SettleRuleSysNo);
                        command.ExecuteNonQuery();
                    }
                    else
                    {//新建SettleItem:
                        item.SettleSysNo = settlementInfo.SysNo;
                        CreateConsignSettlemtnItemInfo(item);
                    }
                }
            }

            return(settlementInfo);
        }
Пример #20
0
 public virtual ConsignSettlementInfo CancelAbandonSettlementInfo(ConsignSettlementInfo consignInfo)
 {
     return(ConsignSettlementProcessor.CancelAbandonConsignSettlement(consignInfo));
 }
Пример #21
0
 public ConsignSettlementInfo CreateConsignSettlementBySystem(ConsignSettlementInfo info)
 {
     return(ObjectFactory <ConsignSettlementAppService> .Instance.CreateConsignSettlementInfoBySystem(info));
 }
Пример #22
0
 public virtual ConsignSettlementInfo SettleConsignSettlementInfo(ConsignSettlementInfo consignInfo)
 {
     return(ConsignSettlementProcessor.SettleConsignSettlement(consignInfo));
 }
Пример #23
0
 public ConsignSettlementInfo SystemCreateConsignSettlement(ConsignSettlementInfo info)
 {
     return(ObjectFactory <ConsignSettlementAppService> .Instance.SystemCreateConsignSettlementInfo(info));
 }
Пример #24
0
 public virtual List <ConsignSettlementEIMSInfo> LoadConsignEIMSList(ConsignSettlementInfo info, int?pageIndex, int?pageSize, string sortBy, out int totalCount)
 {
     return(ObjectFactory <ConsignSettlementProcessor> .Instance.LoadConsignEIMSList(info, pageIndex, pageSize, sortBy, out totalCount));
 }
Пример #25
0
        public void BuildData(System.Collections.Specialized.NameValueCollection requestPostData, out KeyValueVariables variables, out KeyTableVariables tableVariables)
        {
            //throw new NotImplementedException();

            variables      = new KeyValueVariables();
            tableVariables = new KeyTableVariables();

            string settleSysNoStr = requestPostData["ConsignSysNo"];

            int settleSysNo = int.Parse(settleSysNoStr);

            //获取代销单i型纳西】
            ConsignSettlementInfo consignSettlementInfo = ObjectFactory <ConsignSettlementProcessor> .Instance.LoadConsignSettlementInfo(settleSysNo);

            //获取商家信息
            VendorInfo VendorInfo = ObjectFactory <VendorProcessor> .Instance.LoadVendorInfo(consignSettlementInfo.VendorInfo.SysNo.Value);

            //获取代销单商品信息


            //结算单号
            variables.Add("SettleSysNo", consignSettlementInfo.ReferenceSysNo);
            //合同号   :
            variables.Add("Agreement", "");//空
            //结算年月
            variables.Add("ConsignRange", consignSettlementInfo.ConsignRange);
            //打印日期
            variables.Add("PrintDate", DateTime.Now.Date.ToString("yyyy-MM-dd"));
            //收款单位——全称
            variables.Add("PayeeName", VendorInfo.VendorBasicInfo.VendorBriefName);
            //收款单位-供货商代码
            variables.Add("PayeeNo", VendorInfo.VendorBasicInfo.VendorID);
            //开户行
            variables.Add("PayeeBack", VendorInfo.VendorFinanceInfo.BankName);
            //账号
            variables.Add("PayeeBackCardNo", VendorInfo.VendorFinanceInfo.AccountNumber);

            //付款单位-全称
            variables.Add("PayerName", "泰隆优选");
            //开户行
            variables.Add("PayerBack", "");       //空
            //账号
            variables.Add("PayerBackCardNo", ""); //空
            //付款部门
            variables.Add("PayerDepartment", ""); //空


            string DefaultMony = ((int)0).ToString("C");

            //供应商提供税票
            //价款
            variables.Add("Cost", DefaultMony);
            //税金
            variables.Add("Tax", DefaultMony);
            //价款税金合计
            variables.Add("TaxAndCost", DefaultMony);

            //17
            //价款
            variables.Add("17Cost", DefaultMony);
            //税金
            variables.Add("17Tax", DefaultMony);
            //价款税金合计
            variables.Add("17TaxAndCost", DefaultMony);

            //13
            //价款
            variables.Add("13Cost", DefaultMony);
            //税金
            variables.Add("13Tax", DefaultMony);
            //价款税金合计
            variables.Add("13TaxAndCost", DefaultMony);

            //other
            //价款
            variables.Add("OtCost", DefaultMony);
            //税金
            variables.Add("OtTax", DefaultMony);
            //价款税金合计
            variables.Add("OtTaxAndCost", DefaultMony);

            //类型
            var taxRateData = consignSettlementInfo.TaxRateData;


            Func <PurchaseOrderTaxRate, decimal, decimal> Shuijin = (a, b) => {
                return(((decimal)(((int)a) / 100.00)) * b / ((decimal)(((int)a) / 100.00) + 1));
            };

            Func <PurchaseOrderTaxRate, decimal, decimal> Jiakuan = (a, b) =>
            {
                return(b / ((decimal)(((int)a) / 100.00) + 1));
            };

            decimal jiakuan    = Jiakuan(taxRateData.Value, consignSettlementInfo.TotalAmt.Value);
            string  jiakuanStr = jiakuan.ToString("C");
            string  jieSuam    = Shuijin(taxRateData.Value, consignSettlementInfo.TotalAmt.Value).ToString("C");
            string  zongJine   = consignSettlementInfo.TotalAmt.Value.ToString("C");

            variables["Cost"]       = jiakuanStr;
            variables["Tax"]        = jieSuam;
            variables["TaxAndCost"] = zongJine;

            if (taxRateData == PurchaseOrderTaxRate.Percent017)
            {
                variables["17Cost"]       = jiakuanStr;
                variables["17Tax"]        = jieSuam;
                variables["17TaxAndCost"] = zongJine;
            }
            else if (taxRateData == PurchaseOrderTaxRate.Percent013)
            {
                variables["13Cost"]       = jiakuanStr;
                variables["13Tax"]        = jieSuam;
                variables["13TaxAndCost"] = zongJine;
            }
            else
            {
                variables["OtCost"]       = jiakuanStr;
                variables["OtTax"]        = jieSuam;
                variables["OtTaxAndCost"] = zongJine;
            }

            var deduct = ObjectFactory <DeductProcessor> .Instance.GetSingleDeductBySysNo(VendorInfo.VendorDeductInfo.DeductSysNo.ToString());

            if (deduct == null)
            {
                deduct            = new BizEntity.PO.PurchaseOrder.Deduct();
                deduct.DeductType = DeductType.Temp;
            }
            string deductTypeStr = EnumHelper.GetDescription(deduct.DeductType, typeof(DeductType));

            //扣款项目
            variables.Add("DeducType", deductTypeStr); //****

            //扣款金额
            variables.Add("DeducMoney", consignSettlementInfo.DeductAmt.ToString("C"));
            //备注
            variables.Add("Memo", "");//空

            //扣款合计:
            variables.Add("DeducMoneySum", consignSettlementInfo.DeductAmt.ToString("C"));

            //本月销售
            decimal amount = 0;

            foreach (var sub in consignSettlementInfo.ConsignSettlementItemInfoList)
            {
                amount += sub.ConsignToAccLogInfo.SalePrice.Value * sub.ConsignToAccLogInfo.ProductQuantity.Value;
            }
            variables.Add("CurrentSale", amount.ToString("C"));
            //实际付款金额
            variables.Add("RealPayMent", consignSettlementInfo.TotalAmt.Value.ToString("C"));

            //业务复核
            variables.Add("BussinessRechecker", consignSettlementInfo.AuditUser.UserName);
        }