Exemple #1
0
        /// <summary>
        /// 电子货币支付
        /// </summary>
        public void IsElecPay(SqlTransaction tran, MemberOrderModel memberOrderModel)
        {
            //支付期数
            memberOrderModel.PayExpect = CommonClass.CommonDataBLL.getMaxqishu();
            //生成汇款单号
            memberOrderModel.RemittancesId = Model.Other.MYDateTime.ToYYMMDDHHmmssString();
            //支付状态改为1
            memberOrderModel.DefrayState = 1;

            //电子货币支付时,记录已经支付的金额
            addOrderDataDAL.Upd_ECTPay(tran, memberOrderModel.ElectronicaccountId, Convert.ToDouble(memberOrderModel.TotalMoney));

            //电子货币支付,则在店汇款中插入记录,最后两个参数需要更改,
            addOrderDataDAL.AddDataTORemittances(tran, memberOrderModel);

            //更新店铺的汇款
            addOrderDataDAL.Add_Remittances(tran, Convert.ToDouble(memberOrderModel.TotalMoney), memberOrderModel.StoreId);
        }
Exemple #2
0
        /// <summary>
        /// 填写退货退款单 ——ds2012——tianfeng
        /// </summary>
        /// <param name="DocID">订单号</param>
        /// <param name="StoreID">店编号</param>
        /// <returns></returns>
        public static Boolean UPtInventoryDoc(string DocID, string StoreID, int flag, double money, string reason, Boolean bol, string opbh, string opip, int qishu)
        {
            SqlParameter[] parameter =
            {
                new SqlParameter("@DocID",   SqlDbType.VarChar,  20),
                new SqlParameter("@StoreID", SqlDbType.VarChar,  20),
                new SqlParameter("@Flag",    SqlDbType.Int),
                new SqlParameter("@Charged", SqlDbType.Money,    20),
                new SqlParameter("@Reason",  SqlDbType.VarChar, 250),
                new SqlParameter("@error",   SqlDbType.VarChar, 20)
            };
            parameter[0].Value     = DocID;
            parameter[1].Value     = StoreID;
            parameter[2].Value     = flag;
            parameter[3].Value     = money;
            parameter[4].Value     = reason;
            parameter[5].Direction = ParameterDirection.Output;

            double totalFmoney = GetInventoryTotalMoney(DocID);

            using (SqlConnection conn = new SqlConnection(DBHelper.connString))
            {
                conn.Open();
                using (SqlTransaction tran = conn.BeginTransaction())
                {
                    try
                    {
                        //修改
                        double Fmoney = GetInventoryMoney(tran, DocID);

                        string huidan = "HK" + Model.Other.MYDateTime.ToYYMMDDHHmmssString();
                        //判断汇单号是否存在:true存在,false不存在
                        bool isExist = RemittancesDAL.isMemberExistsHuiDan(huidan);
                        while (isExist)
                        {
                            huidan  = "HK" + Model.Other.MYDateTime.ToYYMMDDHHmmssString();
                            isExist = RemittancesDAL.isMemberExistsHuiDan(huidan);
                        }

                        if (bol)
                        {
                            AddOrderDataDAL.AddDataTORemittances(tran, huidan, StoreID, (Fmoney * (-1)), DocID, opip, opbh, qishu);
                            DBHelper.ExecuteNonQuery(tran, "update storeinfo set totalaccountmoney=totalaccountmoney - @money where storeid=@storeid", new SqlParameter[2] {
                                new SqlParameter("@money", Fmoney), new SqlParameter("@storeid", StoreID)
                            }, CommandType.Text);
                            D_AccountDAL.AddStoreAccount(StoreID, Fmoney, D_AccountSftype.StoreDingHuokuan, S_Sftype.dianhuo, D_AccountKmtype.ReturnCharge, DirectionEnum.AccountReduced, "返回上次店铺退货单款" + DocID, tran);

                            DBHelper.ExecuteNonQuery(tran, "UPtInventoryDoc", parameter, CommandType.StoredProcedure);

                            AddOrderDataDAL.AddDataTORemittances(tran, "", StoreID, totalFmoney, DocID, opip, opbh, qishu);
                            DBHelper.ExecuteNonQuery(tran, "update storeinfo set totalaccountmoney=totalaccountmoney + @money where storeid=@storeid", new SqlParameter[2] {
                                new SqlParameter("@money", totalFmoney), new SqlParameter("@storeid", StoreID)
                            }, CommandType.Text);
                            D_AccountDAL.AddStoreAccount(StoreID, totalFmoney, D_AccountSftype.StoreDingHuokuan, S_Sftype.dianhuo, D_AccountKmtype.ReturnRebate, DirectionEnum.AccountsIncreased, "店铺退货单退款" + DocID, tran);

                            AddOrderDataDAL.AddDataTORemittances(tran, huidan, StoreID, (money * (-1)), DocID, opip, opbh, qishu);
                            DBHelper.ExecuteNonQuery(tran, "update storeinfo set totalaccountmoney=totalaccountmoney - @money where storeid=@storeid", new SqlParameter[2] {
                                new SqlParameter("@money", money), new SqlParameter("@storeid", StoreID)
                            }, CommandType.Text);
                            D_AccountDAL.AddStoreAccount(StoreID, money, D_AccountSftype.StoreDingHuokuan, S_Sftype.dianhuo, D_AccountKmtype.ReturnCharge, DirectionEnum.AccountReduced, "店铺退货单扣款" + DocID, tran);
                        }
                        else
                        {
                            //添加
                            DBHelper.ExecuteNonQuery(tran, "UPtInventoryDoc", parameter, CommandType.StoredProcedure);

                            AddOrderDataDAL.AddDataTORemittances(tran, huidan, StoreID, totalFmoney, DocID, opip, opbh, qishu);
                            DBHelper.ExecuteNonQuery(tran, "update storeinfo set totalaccountmoney=totalaccountmoney + @money where storeid=@storeid", new SqlParameter[2] {
                                new SqlParameter("@money", totalFmoney), new SqlParameter("@storeid", StoreID)
                            }, CommandType.Text);
                            D_AccountDAL.AddStoreAccount(StoreID, totalFmoney, D_AccountSftype.StoreDingHuokuan, S_Sftype.dianhuo, D_AccountKmtype.ReturnRebate, DirectionEnum.AccountsIncreased, "店铺退货单退款" + DocID, tran);

                            AddOrderDataDAL.AddDataTORemittances(tran, huidan, StoreID, (money * (-1)), DocID, opip, opbh, qishu);
                            DBHelper.ExecuteNonQuery(tran, "update storeinfo set totalaccountmoney=totalaccountmoney - @money where storeid=@storeid", new SqlParameter[2] {
                                new SqlParameter("@money", money), new SqlParameter("@storeid", StoreID)
                            }, CommandType.Text);
                            D_AccountDAL.AddStoreAccount(StoreID, money, D_AccountSftype.StoreDingHuokuan, S_Sftype.dianhuo, D_AccountKmtype.ReturnRebate, DirectionEnum.AccountReduced, "店铺退货单扣款" + DocID, tran);
                        }

                        tran.Commit();
                    }
                    catch (Exception ex1)
                    {
                        tran.Rollback();
                        return(false);
                    }
                    finally
                    {
                        conn.Close();
                    }
                }
            }


            return(int.Parse(parameter[5].Value.ToString()) == 0 ? true : false);
        }