Example #1
0
        /// <summary>
        /// 修改时更新业务单表状态信息
        /// </summary>
        /// <param name="lstCommand"></param>
        /// <param name="BillingID"></param>
        /// <param name="DiffAmount"></param>
        public static void updateUpBillingStatus(ArrayList lstCommand, string BillingID, decimal DiffAmount)
        {
            decimal NAccount = BillingDBHelper.GetBillingNAccounts(BillingID);

            StringBuilder sql = new StringBuilder();

            sql.AppendLine("Update  officedba.Billing set YAccounts=isnull(YAccounts,0)+(@DiffAmount),NAccounts=isnull(NAccounts,0)-(@DiffAmount)  ");
            sql.AppendLine(" where ID=@ID");

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = sql.ToString();
            //定义参数
            cmd.Parameters.AddWithValue("@DiffAmount", SqlDbType.Decimal).Value = DiffAmount;
            cmd.Parameters.AddWithValue("@ID", SqlDbType.Int).Value             = BillingID;
            lstCommand.Add(cmd);


            decimal    StatusAmount    = NAccount - (DiffAmount);
            string     updateStautsSQL = "Update  officedba.Billing set AccountsStatus=@AccountsStatus where ID=@ID1";
            SqlCommand comdd           = new SqlCommand();

            comdd.CommandText = updateStautsSQL;
            if (StatusAmount > 0)
            {
                comdd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Decimal).Value = ConstUtil.ACCOUNTS_STATUS_YJSZ;
                comdd.Parameters.AddWithValue("@ID1", SqlDbType.Int).Value = BillingID;
            }
            else
            {
                comdd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Decimal).Value = ConstUtil.ACCOUNTS_STATUS_YJS;
                comdd.Parameters.AddWithValue("@ID1", SqlDbType.Int).Value = BillingID;
            }
            lstCommand.Add(comdd);
        }
Example #2
0
        /// <summary>
        /// 修改开票信息
        /// </summary>
        /// <param name="model">开票实体</param>
        /// <returns>true 成功,false失败</returns>
        public static bool UpdateBillingInfo(BillingModel model)
        {
            if (model == null)
            {
                return(false);
            }

            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            try
            {
                bool   succ        = false;
                string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID;

                LogInfoModel logModel = InitLogInfo(model.BillingNum, 0);
                logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;

                succ = BillingDBHelper.UpdateBillingInfo(model);
                if (!succ)
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                else
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                LogDBHelper.InsertLog(logModel);
                return(succ);
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, 0, ex);
                return(false);
            }
        }
Example #3
0
        /// <summary>
        /// 更新业务单关联的金额
        /// </summary>
        /// <param name="lstCommand">数组</param>
        /// <param name="ID">主键</param>
        private static void UpdateInsertBillingPrice(ArrayList lstCommand, int ID, decimal Price)
        {
            decimal NAccount = BillingDBHelper.GetBillingNAccounts(ID.ToString());

            StringBuilder sql = new StringBuilder();

            sql.AppendLine("Update  officedba.Billing set YAccounts=isnull(YAccounts,0)+@YAccounts,NAccounts=isnull(NAccounts,0)-@YAccounts  ");
            sql.AppendLine(" where ID=@ID");

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = sql.ToString();
            //定义参数
            cmd.Parameters.AddWithValue("@YAccounts", SqlDbType.Decimal).Value = Price;
            cmd.Parameters.AddWithValue("@ID", SqlDbType.Int).Value            = ID;
            lstCommand.Add(cmd);


            decimal    StatusAmount    = NAccount - Price;
            string     updateStautsSQL = "Update  officedba.Billing set AccountsStatus=@AccountsStatus where ID=@ID1";
            SqlCommand comdd           = new SqlCommand();

            comdd.CommandText = updateStautsSQL;
            if (StatusAmount > 0)
            {
                comdd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Decimal).Value = ConstUtil.ACCOUNTS_STATUS_YJSZ;
                comdd.Parameters.AddWithValue("@ID1", SqlDbType.Int).Value = ID;
            }
            else
            {
                comdd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Decimal).Value = ConstUtil.ACCOUNTS_STATUS_YJS;
                comdd.Parameters.AddWithValue("@ID1", SqlDbType.Int).Value = ID;
            }
            lstCommand.Add(comdd);
        }
Example #4
0
        /// <summary>
        /// 删除付款单信息级联更新对应的业务单的已付金额和未付金额
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public static bool DeletePayBill(string ids)
        {
            SqlConnection conn = new SqlConnection(SqlHelper._connectionStringStr);

            conn.Open();
            SqlTransaction mytran = conn.BeginTransaction();

            try
            {
                string[] Str = ids.Split(',');
                for (int i = 0; i < Str.Length; i++)
                {
                    string    deletePayBillingSQL    = "delete from officedba.PayBill where ID=@IDStr" + i + " ";//删除付款单sql
                    string    updateBillingAmountSQL = "Update  officedba.Billing set YAccounts=isnull(YAccounts,0)-(@PayAmount" + i + "),NAccounts=isnull(NAccounts,0)+(@PayAmount" + i + ") where ID=@ID" + i + "";
                    DataTable dt           = GetBillingInfo(int.Parse(Str[i].ToString()));
                    string    billingID    = dt.Rows[0]["BillingID"].ToString();
                    decimal   PayAmount    = Convert.ToDecimal(dt.Rows[0]["PayAmount"].ToString());
                    decimal   YAccount     = BillingDBHelper.GetBillingYAccounts(billingID);//获取业务单已付金额
                    decimal   diffYAccount = YAccount - PayAmount;

                    SqlParameter[] parms = new SqlParameter[2];
                    parms[0] = SqlHelper.GetParameter("@PayAmount" + i + "", PayAmount);
                    parms[1] = SqlHelper.GetParameter("@ID" + i + "", billingID);

                    SqlHelper.ExecuteNonQuery(mytran, CommandType.Text, updateBillingAmountSQL, parms);
                    string         updateStautsSQL = "Update  officedba.Billing set AccountsStatus=@AccountsStatus" + i + " where ID=@IDS" + i + "";
                    SqlParameter[] parmss          = new SqlParameter[2];
                    if (diffYAccount > 0)//结算中
                    {
                        parmss[0] = SqlHelper.GetParameter("@AccountsStatus" + i + "", ConstUtil.ACCOUNTS_STATUS_YJSZ);
                        parmss[1] = SqlHelper.GetParameter("@IDS" + i + "", billingID);
                    }
                    else//未结算
                    {
                        parmss[0] = SqlHelper.GetParameter("@AccountsStatus" + i + "", ConstUtil.ACCOUNTS_STATUS_WJS);
                        parmss[1] = SqlHelper.GetParameter("@IDS" + i + "", billingID);
                    }
                    SqlHelper.ExecuteNonQuery(mytran, CommandType.Text, updateStautsSQL, parmss);

                    SqlParameter[] parmsss = new SqlParameter[1];
                    parmsss[0] = SqlHelper.GetParameter("@IDStr" + i + "", Str[i].ToString());
                    SqlHelper.ExecuteNonQuery(mytran, CommandType.Text, deletePayBillingSQL, parmsss);
                }
                mytran.Commit();
                return(true);
            }
            catch
            {
                mytran.Rollback();
                return(false);
            }
            finally
            {
                conn.Close();
            }
        }
Example #5
0
 /// <summary>
 /// 根据主键获取业务单信息
 /// </summary>
 /// <param name="ID">主键ID</param>
 /// <returns>DataTable</returns>
 public static DataTable GetBillingInfoByIDPrint(string ID)
 {
     try
     {
         return(BillingDBHelper.GetBillingInfoByIDPrint(ID));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
 public static bool UpdatePurchaseRejectIsOpen(string ID)
 {
     try
     {
         return(BillingDBHelper.UpdatePurchaseRejectIsOpen(ID));
     }
     catch
     {
         return(false);
     }
 }
Example #7
0
 public static bool UpdateSellChannelSttlIsOpen(string ID)
 {
     try
     {
         return(BillingDBHelper.UpdateSellChannelSttlIsOpen(ID));
     }
     catch
     {
         return(false);
     }
 }
Example #8
0
 /// <summary>
 /// 更新是否登记凭证状态
 /// </summary>
 /// <param name="ID">主键</param>
 /// <returns>true 成功,false失败</returns>
 public static bool UpdateVoucherStatus(string ID)
 {
     try
     {
         return(BillingDBHelper.UpdateVoucherStatus(ID));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #9
0
 /// <summary>
 /// 根据主键获取业务单未付金额
 /// </summary>
 /// <param name="ID">主键ID</param>
 /// <returns>decimal</returns>
 public static decimal GetBillingNAccounts(string ID)
 {
     try
     {
         return(BillingDBHelper.GetBillingNAccounts(ID));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #10
0
 public static string CheckChooseSellInfo(string SourceID, string BillCD)
 {
     try
     {
         return(BillingDBHelper.CheckChooseSellInfo(SourceID, BillCD));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #11
0
 public static DataTable GetPurchaseRejectInfo(string ids)
 {
     try
     {
         string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
         return(BillingDBHelper.GetPurchaseRejectInfo(ids, CompanyCD));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #12
0
 public static DataTable GetSellSendInfo(string CodeNo, string Title,
                                         string CustName, string StartDate, string EndDate, int pageIndex, int pageSize, string OrderBy, ref int totalCount)
 {
     try
     {
         string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
         return(BillingDBHelper.GetSellSendInfo(CompanyCD, CodeNo, Title, CustName, StartDate, EndDate, pageIndex, pageSize, OrderBy, ref totalCount));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #13
0
        public static string CheckChooseSellSendInfo(string SourceID, string BillCD)
        {
            string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

            try
            {
                return(BillingDBHelper.CheckChooseSellSendInfo(SourceID, BillCD, CompanyCD));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #14
0
 public static DataTable GetPurchaseRejectInfo(string RejectNo, string Title,
                                               string CustName, string StartDate, string EndDate)
 {
     try
     {
         string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
         return(BillingDBHelper.GetPurchaseRejectInfo(CompanyCD, RejectNo, Title, CustName, StartDate, EndDate));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #15
0
        public static bool BillingNumIsexist(string BillingNum)
        {
            try
            {
                string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

                return(BillingDBHelper.BillingNumIsexist(CompanyCD, BillingNum));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #16
0
        /// <summary>
        /// 根据公司编码获取开票信息
        /// </summary>
        /// <returns>DataTable</returns>
        public static DataTable GetBillingInfoByCompanyCD()
        {
            string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

            try
            {
                return(BillingDBHelper.GetBillingInfoByCompanyCD(CompanyCD));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #17
0
        /// <summary>
        /// 审核开票信息
        /// </summary>
        /// <param name="ID">主键</param>
        /// <param name="Auditor">审核人</param>
        /// <param name="AuditDate">审核时间</param>
        /// <returns>true审核成功,false审核失败</returns>
        public static bool AuditBilling(string ID)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            string   Auditor   = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID.ToString();
            DateTime AuditDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));

            bool isSucc = false;

            try
            {
                isSucc = BillingDBHelper.AuditBilling(ID, Auditor, AuditDate);
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                string[] noList = ID.Split(',');
                for (int i = 0; i < noList.Length; i++)
                {
                    //获取编号
                    string no = noList[i];
                    //替换两边的 '
                    no = no.Replace("'", string.Empty);
                    //操作日志
                    LogInfoModel logModel = InitLogInfo(no, 1);
                    //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                    logModel.Element = ConstUtil.LOG_PROCESS_CONFIRM;
                    //设置操作成功标识
                    logModel.Remark = remark;
                    //登陆日志
                    LogDBHelper.InsertLog(logModel);
                }
                return(isSucc);
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, 1, ex);
                return(false);
            }
        }
Example #18
0
        /// <summary>
        /// 根据检索条件检索出满足条件的信息
        /// </summary>
        /// <param name="CompanyCD">公司编码</param>
        /// <param name="OrderCD">订单编码</param>
        /// <param name="BillingNum">订单号</param>
        /// <param name="BillingType">开票类型</param>
        /// <param name="AccountsStatus">结算状态</param>
        /// <param name="StartDate">开始日期</param>
        /// <param name="EndDate">结束日期</param>
        /// <returns>DataTable</returns>
        public static DataTable SearchBillingInfo(string OrderCD, string BillingNum, string BillingType,
                                                  string AccountsStatus, string StartDate, string EndDate, string AuditStatus, string IsVoucher, string ContactUnits,
                                                  int pageIndex, int pageSize, string OrderBy, ref int totalCount)
        {
            string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

            try
            {
                return(BillingDBHelper.SearchBillingInfo(CompanyCD, OrderCD, BillingNum, BillingType, AccountsStatus, StartDate, EndDate,
                                                         AuditStatus, IsVoucher, ContactUnits, pageIndex, pageSize, OrderBy, ref totalCount));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #19
0
        /// <summary>
        /// 删除发票信息
        /// </summary>
        /// <param name="ID">主键</param>
        /// <returns>true成功,false</returns>
        public static bool DeleteBilling(string ID)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            bool isSucc = false;

            try
            {
                isSucc = BillingDBHelper.DeleteBilling(ID);
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                string[] noList = ID.Split(',');
                for (int i = 0; i < noList.Length; i++)
                {
                    //获取编号
                    string no = noList[i];
                    //替换两边的 '
                    no = no.Replace("'", string.Empty);
                    //操作日志
                    LogInfoModel logModel = InitLogInfo(no, 1);
                    //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                    logModel.Element = ConstUtil.LOG_PROCESS_DELETE;
                    //设置操作成功标识
                    logModel.Remark = remark;
                    //登陆日志
                    LogDBHelper.InsertLog(logModel);
                }
                return(isSucc);
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, 1, ex);
                return(false);
            }
        }
Example #20
0
        /// <summary>
        /// 更新业务单关联的金额
        /// </summary>
        /// <param name="lstCommand">数组</param>
        /// <param name="ID">主键</param>
        private static void UpdateBillingPriceInfo(ArrayList lstCommand, int ID, decimal Price, decimal OldPrice)
        {
            decimal NAccounts = 0;

            decimal result = BillingDBHelper.GetBillingNAccounts(ID.ToString());

            if (result > 0)
            {
                //获取业务单未付金额
                NAccounts = result;
            }

            decimal       diffAccounts = Price - OldPrice;//update by moshenlin 2009-08-05
            StringBuilder sql          = new StringBuilder();

            sql.AppendLine("Update  officedba.Billing set YAccounts=isnull(YAccounts,0)+@YAccounts,");
            sql.AppendLine("NAccounts=isnull(NAccounts,0)-@NAccounts,AccountsStatus=@AccountsStatus ");
            sql.AppendLine(" where ID=@ID");

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = sql.ToString();
            //定义参数
            //cmd.Parameters.AddWithValue("@YAccounts", SqlDbType.Decimal).Value = OldPrice;
            cmd.Parameters.AddWithValue("@YAccounts", SqlDbType.Decimal).Value = diffAccounts;//update by moshenlin 2009-08-05
            cmd.Parameters.AddWithValue("@ID", SqlDbType.Int).Value            = ID;
            //cmd.Parameters.AddWithValue("@NAccounts", SqlDbType.Decimal).Value = OldPrice;
            cmd.Parameters.AddWithValue("@NAccounts", SqlDbType.Decimal).Value = diffAccounts;//update by moshenlin 2009-08-05

            if (NAccounts - diffAccounts == 0)
            {
                cmd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Char).Value = ConstUtil.ACCOUNTS_STATUS_YJS;
            }
            else
            {
                cmd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Char).Value = ConstUtil.ACCOUNTS_STATUS_YJSZ;
            }

            lstCommand.Add(cmd);
        }
Example #21
0
        /// <summary>
        /// 更新业务单关联的金额
        /// </summary>
        /// <param name="lstCommand">数组</param>
        /// <param name="ID">主键</param>
        private static void UpdateBillingPrice(ArrayList lstCommand, int ID, decimal Price)
        {
            decimal NAccounts = 0;
            decimal result    = BillingDBHelper.GetBillingNAccounts(ID.ToString());

            if (result > 0)
            {
                //获取业务单未付金额
                NAccounts = result;
            }
            StringBuilder sql = new StringBuilder();

            sql.AppendLine("Update  officedba.Billing set YAccounts=isnull(YAccounts,0)+@YAccounts,");
            sql.AppendLine("NAccounts=@NAccounts,AccountsStatus=@AccountsStatus ");
            sql.AppendLine(" where ID=@ID");

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = sql.ToString();

            //定义参数
            cmd.Parameters.AddWithValue("@YAccounts", SqlDbType.Decimal).Value = Price;
            cmd.Parameters.AddWithValue("@ID", SqlDbType.Int).Value            = ID;
            //未结金额
            decimal ProcPrice = NAccounts - Price;

            if (ProcPrice == 0)
            {
                cmd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Char).Value = ConstUtil.ACCOUNTS_STATUS_YJS;
            }
            else
            {
                cmd.Parameters.AddWithValue("@AccountsStatus", SqlDbType.Char).Value = ConstUtil.ACCOUNTS_STATUS_YJSZ;
            }

            cmd.Parameters.AddWithValue("@NAccounts", SqlDbType.Decimal).Value = ProcPrice;
            lstCommand.Add(cmd);
        }
Example #22
0
        /// <summary>
        /// 删除收款单
        /// </summary>
        /// <returns>true 成功,false失败</returns>
        public static bool DeleteIncomeBill(string ID, string BillingID, string Price)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            bool   isSucc       = false;
            string SetBillingID = string.Empty;

            try
            {
                isSucc = IncomeBillDBHelper.DeleteIncomeBill(ID, BillingID, Price);
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                string[] noList = ID.Split(',');
                for (int i = 0; i < noList.Length; i++)
                {
                    //获取编号
                    string no = noList[i];
                    //替换两边的 '
                    no = no.Replace("'", string.Empty);
                    //操作日志
                    LogInfoModel logModel = InitLogInfo(no, 1);
                    //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                    logModel.Element = ConstUtil.LOG_PROCESS_DELETE;
                    //设置操作成功标识
                    logModel.Remark = remark;
                    //登陆日志
                    LogDBHelper.InsertLog(logModel);
                }

                if (isSucc)
                {
                    DataTable dt = BillingDBHelper.GetBillingYAccountsDT(BillingID);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow rows in dt.Rows)
                        {
                            if (Convert.ToDecimal(rows["YAccounts"]) == 0)
                            {
                                SetBillingID += rows["ID"].ToString() + ",";
                            }
                        }
                    }
                    //如果存在已付金额为0则更新结算状态
                    if (SetBillingID.Length > 0)
                    {
                        SetBillingID = SetBillingID.TrimEnd(new char[] { ',' });
                        isSucc       = BillingDBHelper.UpdateAccountStatusByID(SetBillingID, "0");
                    }
                }
                return(isSucc);
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, 1, ex);
                return(false);
            }
        }
        /// <summary>
        /// 获取业务单对应的源单的详细信息
        /// </summary>
        /// <param name="BillingID">业务单主键ID</param>
        /// <returns></returns>
        public DataTable GetSourceDt(int BillingID, string CompanyCD, string PayOrIncomeType)
        {
            try
            {
                DataTable returnDT = new DataTable();

                if (IsExist(BillingID, CompanyCD, PayOrIncomeType))
                {
                    returnDT = GetBlendingSourse(CompanyCD, BillingID.ToString(), PayOrIncomeType);
                }
                else
                {
                    string         sql   = @"select a.SourceID,a.SourceDt,a.BillingType,a.InvoiceType,isnull(a.CurrencyType,0) as CurrencyType,isnull(a.CurrencyRate,1) as Rate ,isnull(b.CurrencyName,'') as CurrencyName from officedba.Billing a left outer join officedba.CurrencyTypeSetting b on a.CurrencyType=b.ID where a.ID=@ID and b.CompanyCD=@CompanyCD and a.CompanyCD=@CompanyCDD ";
                    SqlParameter[] parms =
                    {
                        new SqlParameter("@ID",         BillingID),
                        new SqlParameter("@CompanyCD",  CompanyCD),
                        new SqlParameter("@CompanyCDD", CompanyCD)
                    };
                    DataTable dt    = SqlHelper.ExecuteSql(sql, parms);
                    DataTable RevDt = new DataTable();

                    string ids          = string.Empty;
                    string Fromtable    = string.Empty;
                    string BillingType  = string.Empty;
                    string InvoiceType  = string.Empty;
                    string CurrencyName = string.Empty;
                    string Rate         = string.Empty;
                    string CurrencyType = string.Empty;
                    returnDT.Columns.Add("SourceDt");     //源单表
                    returnDT.Columns.Add("SourceID");     //源单ID
                    returnDT.Columns.Add("BillCD");       //源单编码
                    returnDT.Columns.Add("BillingType");  //源单类别
                    returnDT.Columns.Add("InvoiceType");  //发票类别
                    returnDT.Columns.Add("TotalPrice");   //源单总金额
                    returnDT.Columns.Add("ContactUnits"); //往来客户
                    returnDT.Columns.Add("CurrencyType");
                    returnDT.Columns.Add("Rate");
                    returnDT.Columns.Add("CurrencyName");

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        ids          = dt.Rows[0]["SourceID"].ToString();
                        Fromtable    = dt.Rows[0]["SourceDt"].ToString().Trim();
                        BillingType  = dt.Rows[0]["BillingType"].ToString();
                        InvoiceType  = dt.Rows[0]["InvoiceType"].ToString();
                        CurrencyName = dt.Rows[0]["CurrencyName"].ToString();
                        Rate         = dt.Rows[0]["Rate"].ToString();
                        CurrencyType = dt.Rows[0]["CurrencyType"].ToString();

                        switch (Fromtable)
                        {
                        case "officedba.SellOrder":
                            RevDt = SellOrderDBHelper.SearchOrderByCondition(ids, CompanyCD);
                            for (int i = 0; i < RevDt.Rows.Count; i++)
                            {
                                DataRow row = returnDT.NewRow();
                                row["SourceDt"]     = Fromtable;
                                row["SourceID"]     = RevDt.Rows[i]["ID"].ToString();
                                row["BillCD"]       = RevDt.Rows[i]["OrderNo"].ToString();
                                row["BillingType"]  = BillingType;
                                row["InvoiceType"]  = InvoiceType;
                                row["TotalPrice"]   = RevDt.Rows[i]["RealTotal"].ToString();
                                row["ContactUnits"] = RevDt.Rows[i]["CustName"].ToString();
                                row["CurrencyName"] = CurrencyName;
                                row["CurrencyType"] = CurrencyType;
                                row["Rate"]         = Rate;
                                returnDT.Rows.Add(row);
                            }
                            break;

                        case "officedba.PurchaseOrder":
                            RevDt = PurchaseOrderDBHelper.SearchOrderByCondition(ids, CompanyCD);
                            for (int i = 0; i < RevDt.Rows.Count; i++)
                            {
                                DataRow row = returnDT.NewRow();
                                row["SourceDt"]     = Fromtable;
                                row["SourceID"]     = RevDt.Rows[i]["ID"].ToString();
                                row["BillCD"]       = RevDt.Rows[i]["OrderNo"].ToString();
                                row["BillingType"]  = BillingType;
                                row["InvoiceType"]  = InvoiceType;
                                row["TotalPrice"]   = RevDt.Rows[i]["RealTotal"].ToString();
                                row["ContactUnits"] = RevDt.Rows[i]["CustName"].ToString();
                                row["CurrencyName"] = CurrencyName;
                                row["CurrencyType"] = CurrencyType;
                                row["Rate"]         = Rate;
                                returnDT.Rows.Add(row);
                            }
                            break;

                        case "officedba.SellBack":
                            RevDt = BillingDBHelper.SellBackInfo(ids, CompanyCD);
                            for (int i = 0; i < RevDt.Rows.Count; i++)
                            {
                                DataRow row = returnDT.NewRow();
                                row["SourceDt"]     = Fromtable;
                                row["SourceID"]     = RevDt.Rows[i]["ID"].ToString();
                                row["BillCD"]       = RevDt.Rows[i]["BackNo"].ToString();
                                row["BillingType"]  = BillingType;
                                row["InvoiceType"]  = InvoiceType;
                                row["TotalPrice"]   = RevDt.Rows[i]["RealTotal"].ToString();
                                row["ContactUnits"] = RevDt.Rows[i]["CustName"].ToString();
                                row["CurrencyName"] = CurrencyName;
                                row["CurrencyType"] = CurrencyType;
                                row["Rate"]         = Rate;
                                returnDT.Rows.Add(row);
                            }
                            break;

                        case "officedba.SellChannelSttl":
                            RevDt = BillingDBHelper.GetSellChannelSttlInfo(ids, CompanyCD);
                            for (int i = 0; i < RevDt.Rows.Count; i++)
                            {
                                DataRow row = returnDT.NewRow();
                                row["SourceDt"]     = Fromtable;
                                row["SourceID"]     = RevDt.Rows[i]["ID"].ToString();
                                row["BillCD"]       = RevDt.Rows[i]["SttlNo"].ToString();
                                row["BillingType"]  = BillingType;
                                row["InvoiceType"]  = InvoiceType;
                                row["TotalPrice"]   = RevDt.Rows[i]["SttlTotal"].ToString();
                                row["ContactUnits"] = RevDt.Rows[i]["CustName"].ToString();
                                row["CurrencyName"] = CurrencyName;
                                row["CurrencyType"] = CurrencyType;
                                row["Rate"]         = Rate;
                                returnDT.Rows.Add(row);
                            }
                            break;

                        case "officedba.PurchaseReject":
                            RevDt = BillingDBHelper.GetPurchaseRejectInfo(ids, CompanyCD);
                            for (int i = 0; i < RevDt.Rows.Count; i++)
                            {
                                DataRow row = returnDT.NewRow();
                                row["SourceDt"]     = Fromtable;
                                row["SourceID"]     = RevDt.Rows[i]["ID"].ToString();
                                row["BillCD"]       = RevDt.Rows[i]["OrderNO"].ToString();
                                row["BillingType"]  = BillingType;
                                row["InvoiceType"]  = InvoiceType;
                                row["TotalPrice"]   = RevDt.Rows[i]["RealTotal"].ToString();
                                row["ContactUnits"] = RevDt.Rows[i]["CustName"].ToString();
                                row["CurrencyName"] = CurrencyName;
                                row["CurrencyType"] = CurrencyType;
                                row["Rate"]         = Rate;
                                returnDT.Rows.Add(row);
                            }
                            break;

                        case "officedba.PurchaseArrive":
                            RevDt = BillingDBHelper.GetPurchaseIncomeInfo(ids, CompanyCD);
                            for (int i = 0; i < RevDt.Rows.Count; i++)
                            {
                                DataRow row = returnDT.NewRow();
                                row["SourceDt"]     = Fromtable;
                                row["SourceID"]     = RevDt.Rows[i]["ID"].ToString();
                                row["BillCD"]       = RevDt.Rows[i]["OrderNO"].ToString();
                                row["BillingType"]  = BillingType;
                                row["InvoiceType"]  = InvoiceType;
                                row["TotalPrice"]   = RevDt.Rows[i]["RealTotal"].ToString();
                                row["ContactUnits"] = RevDt.Rows[i]["CustName"].ToString();
                                row["CurrencyName"] = CurrencyName;
                                row["CurrencyType"] = CurrencyType;
                                row["Rate"]         = Rate;
                                returnDT.Rows.Add(row);
                            }
                            break;

                        case "officedba.SellSend":
                            RevDt = BillingDBHelper.GetSellSendInfo(ids, CompanyCD);
                            for (int i = 0; i < RevDt.Rows.Count; i++)
                            {
                                DataRow row = returnDT.NewRow();
                                row["SourceDt"]     = Fromtable;
                                row["SourceID"]     = RevDt.Rows[i]["ID"].ToString();
                                row["BillCD"]       = RevDt.Rows[i]["OrderNO"].ToString();
                                row["BillingType"]  = BillingType;
                                row["InvoiceType"]  = InvoiceType;
                                row["TotalPrice"]   = RevDt.Rows[i]["RealTotal"].ToString();
                                row["ContactUnits"] = RevDt.Rows[i]["CustName"].ToString();
                                row["CurrencyName"] = CurrencyName;
                                row["CurrencyType"] = CurrencyType;
                                row["Rate"]         = Rate;
                                returnDT.Rows.Add(row);
                            }
                            break;

                        default:
                            break;
                        }
                    }
                }
                return(returnDT);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #24
0
 /// <summary>
 /// 根据主键获取业务单已付金额
 /// </summary>
 /// <param name="ID">主键ID</param>
 /// <returns>decimal</returns>
 public static decimal GetBillingYAccounts(string ID)
 {
     return(BillingDBHelper.GetBillingYAccounts(ID));
 }