protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        string companyCD            = UserInfo.CompanyCD;
        PurchaseContractModel model = new PurchaseContractModel();
        string RejectNo             = this.txtArriveNo.Text;
        string Title  = this.txtTitle.Text;
        string TypeID = this.drpTypeID.Value;

        if (TypeID == "0")
        {
            TypeID = "";
        }
        string Purchaser = this.HidPurchaser.Value;
        string FromType  = this.ddlFromType.Value;

        if (FromType == "-1")
        {
            FromType = "";
        }
        string ProviderID = this.txtHidProviderID.Value;
        string BillStatus = this.ddlBillStatus.Value;

        if (BillStatus == "0")
        {
            BillStatus = "";
        }
        string UsedStatus = this.ddlUsedStatus.Value;

        if (UsedStatus == "0")
        {
            UsedStatus = "";
        }
        string DeptID = this.HidDeptID.Value;

        model.CompanyCD = companyCD;
        int TotalCount = 0;

        string EFIndex = GetBillExAttrControl1.GetExtIndexValue;
        string EFDesc  = GetBillExAttrControl1.GetExtTxtValue;

        DataTable dt = PurchaseRejectBus.SelectPurchaseReject(1, 1000000, "ID", ref TotalCount, RejectNo, Title, TypeID, Purchaser, FromType, ProviderID, BillStatus, UsedStatus, DeptID, this.hidProjectID.Value, EFIndex, EFDesc);



        //导出标题
        string headerTitle = "单据编号|单据主题|采购分类|采购员|供应商|源单类型|应退货款合计|单据状态|审批状态";

        string[] header = headerTitle.Split('|');

        //导出标题所对应的列字段名称
        string columnFiled = "RejectNo|Title|TypeName|PurchaserName|ProviderName|FromTypeName|TotalYthkhj|BillStatusName|UsedStatus";

        string[] field = columnFiled.Split('|');

        XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "采购退货单列表");
    }
Пример #2
0
 public static bool CancelClosePurchaseContract(PurchaseContractModel Model)
 {
     return(PurchaseContractDBHelper.CancelClosePurchaseContract(Model));
 }
Пример #3
0
 public static bool CancelConfirmPurchaseContract(PurchaseContractModel Model, string DetailProductCount, string DetailFromBillNo, string DetailFromLineNo, string length, out string strMsg)
 {
     return(PurchaseContractDBHelper.CancelConfirmPurchaseContract(Model, DetailProductCount, DetailFromBillNo, DetailFromLineNo, length, out strMsg));
 }
Пример #4
0
        /// <summary>
        /// 新增合同
        /// </summary>
        /// <param name="CompanyCD"></param>
        /// <param name="CompanyNo"></param>
        /// <returns></returns>
        public static bool InsertPurchaseContract(PurchaseContractModel model, string DetailProductID, string DetailProductNo, string DetailProductName, string DetailUnitID, string DetailProductCount, string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount, string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee, string DetailTotalTax, string DetailRequireDate, string DetailApplyReason, string DetailRemark, string DetailFromBillID, string DetailFromLineNo, string DetailUsedUnitID, string DetailUsedUnitCount, string DetailUsedPrice, string DetailExRate, string length, out string ID, Hashtable ht)
        {
            try
            {
                ////获取登陆用户ID
                //string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID;
                //return PurchaseContractDBHelper.InsertPurchaseContract(model, DetailProductID, DetailProductNo, DetailProductName, DetailUnitID, DetailProductCount, DetailUnitPrice, DetailTaxPrice, DetailDiscount, DetailTaxRate, DetailTotalPrice, DetailTotalFee, DetailTotalTax, DetailRequireDate, DetailApplyReason, DetailRemark, DetailFromBillID, DetailFromLineNo, length, out ID);

                bool         succ     = false;
                LogInfoModel logModel = InitLogInfo(model.ContractNo);
                logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
                //设置模块ID 模块ID请在ConstUtil中定义,以便维护
                logModel.ModuleID = ConstUtil.MODULE_ID_PurchaseContract_Add;
                succ = PurchaseContractDBHelper.InsertPurchaseContract(model, DetailProductID, DetailProductNo, DetailProductName, DetailUnitID, DetailProductCount, DetailUnitPrice, DetailTaxPrice, DetailDiscount, DetailTaxRate, DetailTotalPrice, DetailTotalFee, DetailTotalTax, DetailRequireDate, DetailApplyReason, DetailRemark, DetailFromBillID, DetailFromLineNo, DetailUsedUnitID, DetailUsedUnitCount, DetailUsedPrice, DetailExRate, length, out ID, ht);
                if (!succ)
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                else
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                LogDBHelper.InsertLog(logModel);
                return(succ);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            #region
            //string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            ////model.CompanyCD = CompanyCD;
            ////string CompanyCD = "AAAAAA";
            //try
            //{
            //    ////int length = 3 + str.Length + str2.Length;//SQL语句长度
            //    ////string[] sql = new string[length];
            //    //return PurchaseContractDBHelper.InsertPurchaseContract(model);

            //    ////for (int i = 0; i < str.Length; ++i)
            //    ////{
            //    ////    PurchaseContractDBHelper.InsertDtlS(model,DetailID, DetailProductNo, DetailProductName, DetailProductCount, DetailUnitID, DetailRequireDate, DetailUnitPrice, DetailTotalPrice, DetailApplyReason, DetailRemark, DetailFromBillID, DetailFromLineNo, length);
            //    ////}
            //    ////SqlHelper.ExecuteTransForListWithSQL(sql);
            //    ////return SqlHelper.Result.OprateCount > 0 ? true : false;
            //    int Creator = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID;
            //    bool result = false;



            //    #region 合同添加SQL语句
            //    //SQL拼写
            //    StringBuilder sqlc = new StringBuilder();
            //    SqlDateTime signdate = model.SignDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.SignDate.ToString());
            //    SqlDateTime confirmdate = model.ConfirmDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.ConfirmDate.ToString());
            //    SqlDateTime closedate = model.CloseDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.CloseDate.ToString());
            //    SqlDateTime createdate = model.CreateDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.CreateDate.ToString());
            //    sqlc.AppendLine("Insert into officedba.PurchaseContract");
            //    sqlc.AppendLine("(CompanyCD,ContractNo,Title,ProviderID,FromType,FromBillID,");
            //    sqlc.AppendLine("TotalPrice,CurrencyType,Rate,PayType,SignDate,");
            //    sqlc.AppendLine("Seller,TheyDelegate,OurDelegate,Status,Note,");
            //    sqlc.AppendLine("TakeType,CarryType,Attachment,remark,BillStatus,Creator,");
            //    sqlc.AppendLine("CreateDate,ModifiedDate,ModifiedUserID,Confirmor,ConfirmDate,Closer,CloseDate,");
            //    sqlc.AppendLine("DeptID,TotalTax,TotalFee,Discount,DiscountTotal,RealTotal,isAddTax,CountTotal,TypeID,SignAddr,MoneyType)");
            //    sqlc.AppendLine("values('" + model.CompanyCD + "','" + model.ContractNo + "','" + model.Title + "'," + model.ProviderID + ",'" + model.FromType + "'");
            //    sqlc.AppendLine("," + model.FromBillID + "," + model.TotalPrice + "," + model.CurrencyType + "," + model.Rate + "," + model.PayType + "");
            //    if (signdate.IsNull)
            //    {
            //        sqlc.AppendLine("," + signdate + "");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine(",'"+signdate+"'");
            //    }
            //    sqlc.AppendLine("," + model.Seller + ",'" + model.TheyDelegate + "'," + model.OurDelegate + ",'" + model.Status + "'");
            //    sqlc.AppendLine(",'" + model.Note + "'," + model.TakeType + "," + model.CarryType + ",'" + model.Attachment + "','" + model.remark + "'");
            //    sqlc.AppendLine(", '" + model.BillStatus + "'," + Creator+ "");
            //    if (createdate.IsNull)
            //    {
            //        sqlc.AppendLine(","+createdate+"");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine(",'" + createdate + "'");
            //    }
            //    sqlc.AppendLine(",getdate(),'" + model.ModifiedUserID + "'," + model.Confirmor + "");
            //    if (confirmdate.IsNull)
            //    {
            //        sqlc.AppendLine("," + confirmdate + "");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine(",'"+confirmdate+"'");
            //    }
            //    sqlc.AppendLine("," + model.Closer + "");
            //    if (closedate.IsNull)
            //    {
            //        sqlc.AppendLine(","+closedate+"");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine(",'"+closedate+"'");
            //    }
            //    sqlc.AppendLine("," + model.DeptID + "," + model.TotalTax + "," + model.TotalFee + "," + model.Discount + "," + model.DiscountTotal + "," + model.RealTotal + ",'" + model.isAddTax + "'," + model.CountTotal + "," + model.TypeID + ",'" + model.SignAddr + "','" + model.MoneyType + "')");

            //   // sqlc.AppendLine(",'" + model.BillStatus + "'," + model.Creator + ", '"+createdate+"',getdate(),'" + model.ModifiedUserID + "'");
            //   // sqlc.AppendLine("," + model.Confirmor + "," +confirmdate+ "," + model.Closer + ","+closedate+" )");
            //    #endregion
            //    string[] sql = null;
            //    int lengs = Convert.ToInt32(length);
            //    if (lengs > 0)
            //    {
            //        sql = new string[lengs+1];
            //        sql[0] = sqlc.ToString();
            //        string[] ProductID = DetailProductID.Split(',');
            //        string[] ProductNo = DetailProductNo.Split(',');
            //        string[] ProductName = DetailProductName.Split(',');
            //        string[] Standard = DetailStandard.Split(',');//规格
            //        string[] UnitID = DetailUnitID.Split(',');
            //        string[] ProductCount = DetailProductCount.Split(',');
            //        string[] UnitPrice = DetailUnitPrice.Split(',');//单价
            //        string[] TaxPrice = DetailTaxPrice.Split(',');//含税价
            //        string[] Discount = DetailDiscount.Split(',');//折扣
            //        string[] TaxRate = DetailTaxRate.Split(',');//税率
            //        string[] TotalPrice = DetailTotalPrice.Split(',');//金额
            //        string[] TotalFee = DetailTotalFee.Split(',');//含税金额
            //        string[] TotalTax = DetailTotalTax.Split(',');//税额
            //        string[] RequireDate = DetailRequireDate.Split(',');
            //        string[] ApplyReason = DetailApplyReason.Split(',');
            //        string[] Remark = DetailRemark.Split(',');
            //        string[] FromBillID = DetailFromBillID.Split(',');
            //        string[] FromLineNo = DetailFromLineNo.Split(',');
            //        for (int i = 1; i <=lengs; i++)
            //        {
            //            SqlDateTime mRequireDate;
            //            decimal mTotalPrice, mUnitID;
            //            decimal mUnitPrice, mProductCount, mTaxPrice, mDiscount, mTaxRate, mTotalFee, mTotalTax;
            //            //if (RequireDate[i-1].ToString() == "")
            //            //{
            //            //    mRequireDate = SqlDateTime.Null;
            //            //}
            //            //else
            //            //{
            //            //    mRequireDate = SqlDateTime.Parse(RequireDate[i-1].ToString());
            //            //}
            //            if (UnitPrice[i - 1].ToString() == "")
            //            {
            //                mUnitPrice = 0;
            //            }
            //            else
            //            {
            //                mUnitPrice = Convert.ToDecimal(UnitPrice[i - 1].ToString());
            //            }
            //            if (ProductCount[i - 1].ToString() == "")
            //            {
            //                mProductCount = 0;
            //            }
            //            else
            //            {
            //                mProductCount = Convert.ToDecimal(ProductCount[i - 1].ToString());
            //            }
            //            if (TotalPrice[i - 1].ToString() == "")
            //            {
            //                mTotalPrice = 0;
            //            }
            //            else
            //            {
            //                mTotalPrice = Convert.ToDecimal(TotalPrice[i - 1].ToString());
            //            }
            //            if (TaxPrice[i - 1].ToString() == "")
            //            {
            //                mTaxPrice = 0;
            //            }
            //            else
            //            {
            //                mTaxPrice = Convert.ToDecimal(TaxPrice[i - 1].ToString());
            //            }
            //            if (Discount[i - 1].ToString() == "")
            //            {
            //                mDiscount = 0;
            //            }
            //            else
            //            {
            //                mDiscount = Convert.ToDecimal(Discount[i - 1].ToString());
            //            }
            //            if (TaxRate[i - 1].ToString() == "")
            //            {
            //                mTaxRate = 0;
            //            }
            //            else
            //            {
            //                mTaxRate = Convert.ToDecimal(TaxRate[i - 1].ToString());
            //            }
            //            if (TotalFee[i - 1].ToString() == "")
            //            {
            //                mTotalFee = 0;
            //            }
            //            else
            //            {
            //                mTotalFee = Convert.ToDecimal(TotalFee[i - 1].ToString());
            //            }
            //            if (TotalTax[i - 1].ToString() == "")
            //            {
            //                mTotalTax = 0;
            //            }
            //            else
            //            {
            //                mTotalTax = Convert.ToDecimal(TotalTax[i - 1].ToString());
            //            }
            //            if (UnitID[i - 1].ToString() == "")
            //            {
            //                mUnitID = 0;
            //            }
            //            else
            //            {
            //                mUnitID = Convert.ToDecimal(UnitID[i - 1].ToString());
            //            }
            //            System.Text.StringBuilder cmdsql = new System.Text.StringBuilder();
            //            cmdsql.AppendLine(" Insert into  officedba.PurchaseContractDetail(CompanyCD,ContractNo,ProductID,ProductNo,ProductName,standard,UnitID,ProductCount,");
            //            cmdsql.AppendLine("UnitPrice,TaxPrice,Discount,TaxRate,TotalPrice,TotalFee,TotalTax,RequireDate,ApplyReason,Remark,FromBillID,FromLineNo)");
            //            cmdsql.AppendLine(" Values('" + model.CompanyCD + "','" + model.ContractNo + "','" + ProductID[i - 1].ToString() + "','" + ProductNo[i - 1].ToString() + "','" + ProductName[i - 1].ToString() + "','" + Standard[i - 1].ToString() + "'");
            //            cmdsql.AppendLine(",'" + mUnitID + "','" + mProductCount + "','" + mUnitPrice + "','" + mTaxPrice + "','" + mDiscount + "','" + mTaxRate + "','" + mTotalPrice + "','" + mTotalFee + "','" + mTotalTax + "'");
            //            if (RequireDate[i - 1].ToString() == "")
            //            {
            //                mRequireDate = SqlDateTime.Null;
            //                cmdsql.AppendLine(","+mRequireDate+"");
            //            }
            //            else
            //            {
            //                mRequireDate = SqlDateTime.Parse(RequireDate[i - 1].ToString());
            //                cmdsql.AppendLine(",'"+mRequireDate+"'");
            //            }
            //            cmdsql.AppendLine(",'" + ApplyReason[i - 1].ToString() + "','" + Remark[i - 1].ToString() + "','" + FromBillID[i - 1].ToString() + "','" + FromLineNo[i - 1].ToString() + "')");
            //            sql[i] = cmdsql.ToString();

            //        }
            //        if (PurchaseContractDBHelper.InsertPurchaseContract(sql))
            //            {
            //                //model.ID = IDIdentityUtil.GetIDIdentity("officedba.PurchaseContract");
            //                result = true;
            //            }
            //    }
            //    else
            //    {
            //        sql = new string[1];
            //        sql[0] = sqlc.ToString();
            //        if (PurchaseContractDBHelper.InsertPurchaseContract(sql))
            //        {
            //            model.ID = IDIdentityUtil.GetIDIdentity("officedba.PurchaseContract");
            //            result = true;
            //        }
            //    }
            //    return result;
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
            #endregion
        }
Пример #5
0
        /// <summary>
        /// 修改合同记录
        /// </summary>
        /// <param name="CompanyCD"></param>
        /// <param name="CompanyNo"></param>
        /// <returns></returns>
        public static bool UpdatePurchaseContract(PurchaseContractModel model, string DetailProductID, string DetailProductNo, string DetailProductName, string DetailUnitID, string DetailProductCount, string DetailUnitPrice, string DetailTaxPrice, string DetailDiscount, string DetailTaxRate, string DetailTotalPrice, string DetailTotalFee, string DetailTotalTax, string DetailRequireDate, string DetailApplyReason, string DetailRemark, string DetailFromBillID, string DetailFromBillNo, string DetailFromLineNo, string DetailUsedUnitID, string DetailUsedUnitCount, string DetailUsedPrice, string DetailExRate, string length, string fflag2, string no, Hashtable ht)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            if (model.ID <= 0)
            {
                return(false);
            }
            try
            {
                bool         succ     = false;
                LogInfoModel logModel = InitLogInfo(no);
                logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
                //设置模块ID 模块ID请在ConstUtil中定义,以便维护
                logModel.ModuleID = ConstUtil.MODULE_ID_PurchaseContract_Add;
                succ = PurchaseContractDBHelper.UpdatePurchaseContract(model, DetailProductID, DetailProductNo, DetailProductName, DetailUnitID, DetailProductCount, DetailUnitPrice, DetailTaxPrice, DetailDiscount, DetailTaxRate, DetailTotalPrice, DetailTotalFee, DetailTotalTax, DetailRequireDate, DetailApplyReason, DetailRemark, DetailFromBillID, DetailFromBillNo, DetailFromLineNo, DetailUsedUnitID, DetailUsedUnitCount, DetailUsedPrice, DetailExRate, length, fflag2, no, ht);
                if (!succ)
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                else
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                LogDBHelper.InsertLog(logModel);
                return(succ);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            #region
            //if (model.CompanyCD == null) model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            ////string CompanyCD = "AAAAAA";
            ////try
            ////{
            ////    return PurchaseContractDBHelper.UpdatePurchaseContract(sql);
            ////}
            ////catch (Exception ex)
            ////{
            ////    throw ex;
            ////}

            //try
            //{
            //    SqlDateTime signdate = model.SignDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.SignDate.ToString());
            //    SqlDateTime confirmdate = model.ConfirmDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.ConfirmDate.ToString());
            //    SqlDateTime closedate = model.CloseDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.CloseDate.ToString());
            //    SqlDateTime createdate = model.CreateDate == null ? SqlDateTime.Null : SqlDateTime.Parse(model.CreateDate.ToString());
            //    int Creator = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID;
            //    #region 采购合同更新SQL语句
            //    StringBuilder sqlc = new StringBuilder();
            //    sqlc.AppendLine(" UPDATE officedba.PurchaseContract SET ");
            //    sqlc.AppendLine(" CompanyCD          ='" + model.CompanyCD + "',");
            //    sqlc.AppendLine(" ContractNo         ='" + no + "',");
            //    sqlc.AppendLine(" Title              ='" + model.Title + "',");
            //    sqlc.AppendLine(" ProviderID         =" + model.ProviderID + ",");
            //    sqlc.AppendLine(" FromType           ='" + model.FromType + "',");
            //    sqlc.AppendLine(" FromBillID         =" + model.FromBillID + ",");
            //    sqlc.AppendLine(" TotalPrice         =" + model.TotalPrice + ",");
            //    sqlc.AppendLine(" CurrencyType       =" + model.CurrencyType + ",");
            //    sqlc.AppendLine(" Rate               =" + model.Rate + ",");
            //    sqlc.AppendLine(" PayType            =" + model.PayType + ",");
            //    if (signdate.IsNull)
            //    {
            //        sqlc.AppendLine("SignDate        = " + signdate + ",");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine("SignDate       = '" + signdate + "',");
            //    }
            //    sqlc.AppendLine(" Seller            =" + model.Seller + ",");
            //    sqlc.AppendLine(" TheyDelegate   ='" + model.TheyDelegate + "',");
            //    sqlc.AppendLine(" OurDelegate         =" + model.OurDelegate + ",");
            //    sqlc.AppendLine(" Status            ='" + model.Status + "',");
            //    sqlc.AppendLine(" Note              ='" + model.Note + "',");
            //    sqlc.AppendLine(" TakeType          =" + model.TakeType + ",");
            //    sqlc.AppendLine(" CarryType         =" + model.CarryType + ",");
            //    sqlc.AppendLine(" Attachment        ='" + model.Attachment + "',");
            //    sqlc.AppendLine(" remark            ='" + model.remark + "',");
            //    sqlc.AppendLine(" BillStatus        ='" + model.BillStatus + "',");
            //    sqlc.AppendLine(" Creator           =" + model.Creator + ",");
            //    if (createdate.IsNull)
            //    {
            //        sqlc.AppendLine("CreateDate     = " + createdate + ",");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine("CreateDate     = '" + createdate + "',");
            //    }
            //    sqlc.AppendLine(" ModifiedDate      =getdate(),");
            //    sqlc.AppendLine(" ModifiedUserID    ='" + model.ModifiedUserID + "',");
            //    sqlc.AppendLine(" Confirmor         =" + model.Confirmor + ",");
            //    if (confirmdate.IsNull)
            //    {
            //        sqlc.AppendLine("Confirmdate     = " + confirmdate + ",");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine("Confirmdate     = '" + confirmdate + "',");
            //    }
            //    sqlc.AppendLine(" Closer            =" + Creator + ",");
            //    if (closedate.IsNull)
            //    {
            //        sqlc.AppendLine("CloseDate      =" + closedate + ",");
            //    }
            //    else
            //    {
            //        sqlc.AppendLine("CloseDate      ='" + closedate + "',");
            //    }
            //    sqlc.AppendLine("DeptID             =" + model.DeptID + ",");
            //    sqlc.AppendLine("TotalTax             =" + model.TotalTax + ",");
            //    sqlc.AppendLine("TotalFee             =" + model.TotalFee + ",");
            //    sqlc.AppendLine("Discount             =" + model.Discount + ",");
            //    sqlc.AppendLine("DiscountTotal             =" + model.DiscountTotal + ",");
            //    sqlc.AppendLine("RealTotal             =" + model.RealTotal + ",");
            //    sqlc.AppendLine("isAddTax             ='" + model.isAddTax + "',");
            //    sqlc.AppendLine("CountTotal             =" + model.CountTotal + ",");
            //    sqlc.AppendLine("TypeID             =" + model.TypeID + ",");
            //    sqlc.AppendLine("SignAddr             ='" + model.SignAddr + "',");
            //    sqlc.AppendLine("MoneyType             =" + model.MoneyType + "");
            //    sqlc.AppendLine(" Where  CompanyCD='" + model.CompanyCD + "' and ContractNo='" + no+"' ");

            //    #endregion

            //    //如果未别引用,明细操作
            //    string[] sql = null;
            //    int lengs = Convert.ToInt32(length);
            //    if (lengs > 0)
            //    {
            //        sql = new string[lengs + 2];
            //        sql[0] = sqlc.ToString();
            //        sql[1] = "delete from officedba.PurchaseContractDetail where CompanyCD='" + model.CompanyCD + "' and ContractNo='" + no + "' ";
            //        string[] ProductID = DetailProductID.Split(',');
            //        string[] ProductNo = DetailProductNo.Split(',');
            //        string[] ProductName = DetailProductName.Split(',');
            //        string[] Standard = DetailStandard.Split(',');//规格
            //        string[] UnitID = DetailUnitID.Split(',');
            //        string[] ProductCount = DetailProductCount.Split(',');
            //        string[] UnitPrice = DetailUnitPrice.Split(',');//单价
            //        string[] TaxPrice = DetailTaxPrice.Split(',');//含税价
            //        string[] Discount = DetailDiscount.Split(',');//折扣
            //        string[] TaxRate = DetailTaxRate.Split(',');//税率
            //        string[] TotalPrice = DetailTotalPrice.Split(',');//金额
            //        string[] TotalFee = DetailTotalFee.Split(',');//含税金额
            //        string[] TotalTax = DetailTotalTax.Split(',');//税额
            //        string[] RequireDate = DetailRequireDate.Split(',');
            //        string[] ApplyReason = DetailApplyReason.Split(',');
            //        string[] Remark = DetailRemark.Split(',');
            //        string[] FromBillID = DetailFromBillID.Split(',');
            //        string[] FromLineNo = DetailFromLineNo.Split(',');
            //        for (int i = 2; i <= lengs + 1; i++)
            //        {
            //            SqlDateTime mRequireDate;
            //            decimal mTotalPrice, mUnitID;
            //            decimal mUnitPrice, mProductCount, mTaxPrice, mDiscount, mTaxRate, mTotalFee, mTotalTax;
            //            if (UnitPrice[i - 2].ToString() == "")
            //            {
            //                mUnitPrice = 0;
            //            }
            //            else
            //            {
            //                mUnitPrice = Convert.ToDecimal(UnitPrice[i - 2].ToString());
            //            }
            //            if (ProductCount[i - 2].ToString() == "")
            //            {
            //                mProductCount = 0;
            //            }
            //            else
            //            {
            //                mProductCount = Convert.ToDecimal(ProductCount[i - 2].ToString());
            //            }
            //            if (TotalPrice[i - 2].ToString() == "")
            //            {
            //                mTotalPrice = 0;
            //            }
            //            else
            //            {
            //                mTotalPrice = Convert.ToDecimal(TotalPrice[i - 2].ToString());
            //            }
            //            if (TaxPrice[i - 2].ToString() == "")
            //            {
            //                mTaxPrice = 0;
            //            }
            //            else
            //            {
            //                mTaxPrice = Convert.ToDecimal(TaxPrice[i - 2].ToString());
            //            }
            //            if (Discount[i - 2].ToString() == "")
            //            {
            //                mDiscount = 0;
            //            }
            //            else
            //            {
            //                mDiscount = Convert.ToDecimal(Discount[i - 2].ToString());
            //            }
            //            if (TaxRate[i - 2].ToString() == "")
            //            {
            //                mTaxRate = 0;
            //            }
            //            else
            //            {
            //                mTaxRate = Convert.ToDecimal(TaxRate[i - 2].ToString());
            //            }
            //            if (TotalFee[i - 2].ToString() == "")
            //            {
            //                mTotalFee = 0;
            //            }
            //            else
            //            {
            //                mTotalFee = Convert.ToDecimal(TotalFee[i - 2].ToString());
            //            }
            //            if (TotalTax[i - 2].ToString() == "")
            //            {
            //                mTotalTax = 0;
            //            }
            //            else
            //            {
            //                mTotalTax = Convert.ToDecimal(TotalTax[i - 2].ToString());
            //            }
            //            if (UnitID[i - 2].ToString() == "")
            //            {
            //                mUnitID = 0;
            //            }
            //            else
            //            {
            //                mUnitID = Convert.ToDecimal(UnitID[i - 2].ToString());
            //            }
            //            System.Text.StringBuilder cmdsql = new System.Text.StringBuilder();
            //            //cmdsql.AppendLine(" Insert into  officedba.PurchaseContractDetail(CompanyCD,ContractNo,ProductID,ProductNo,ProductName,ProductCount,");
            //            //cmdsql.AppendLine("UnitID,RequireDate,UnitPrice,TotalPrice,ApplyReason,Remark,FromBillID,FromLineNo)");
            //            cmdsql.AppendLine(" Insert into  officedba.PurchaseContractDetail(CompanyCD,ContractNo,ProductID,ProductNo,ProductName,standard,UnitID,ProductCount,");
            //            cmdsql.AppendLine("UnitPrice,TaxPrice,Discount,TaxRate,TotalPrice,TotalFee,TotalTax,RequireDate,ApplyReason,Remark,FromBillID,FromLineNo)");
            //            cmdsql.AppendLine(" Values('" + model.CompanyCD + "','" + no + "','" + ProductID[i - 2].ToString() + "','" + ProductNo[i - 2].ToString() + "','" + ProductName[i - 2].ToString() + "','" + Standard[i - 2].ToString() + "','" + mUnitID + "','" + mProductCount + "'");
            //            cmdsql.AppendLine(",'" + mUnitPrice + "','" + mTaxPrice + "','" + mDiscount + "','" + mTaxRate + "','" + mTotalPrice + "','" + mTotalFee + "','" + mTotalTax + "'");
            //            if (RequireDate[i - 2].ToString() == "")
            //            {
            //                mRequireDate = SqlDateTime.Null;
            //                cmdsql.AppendLine("," + mRequireDate + "");
            //            }
            //            else
            //            {
            //                mRequireDate = SqlDateTime.Parse(RequireDate[i - 2].ToString());
            //                cmdsql.AppendLine(",'" + mRequireDate + "'");
            //            }
            //            cmdsql.AppendLine(",'" + ApplyReason[i - 2].ToString() + "','" + Remark[i - 2].ToString() + "','" + FromBillID[i - 2].ToString() + "','" + FromLineNo[i - 2].ToString() + "')");
            //            sql[i] = cmdsql.ToString();
            //        }
            //        return PurchaseContractDBHelper.UpdatePurchaseContract(sql);
            //    }
            //    else
            //    {
            //        sql = new string[2];
            //        sql[0] = sqlc.ToString();
            //        sql[1] = "delete from officedba.PurchaseContractDetail where CompanyCD='" + model.CompanyCD + "' and ContractNo='" + no + "' ";
            //        return PurchaseContractDBHelper.UpdatePurchaseContract(sql);
            //    }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
            #endregion
        }
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        string companyCD            = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
        PurchaseContractModel model = new PurchaseContractModel();
        string ContractNo           = this.txtContractNo.Text;
        string Title  = this.txtTitle.Text;
        string TypeID = this.DrpTypeID.Value;

        if (TypeID == "0")
        {
            TypeID = "";
        }
        string DeptID = this.txtHidOurDept.Value;
        string Seller = this.HidSeller.Value;
        //if (Seller == undefined)
        //{
        //    Seller = "";
        //}
        string FromType = this.ddlFromType.Value;

        if (FromType == "-1")
        {
            FromType = "";
        }
        string ProviderID = this.txtHidProviderID.Value;
        string BillStatus = this.ddlBillStatus.Value;

        if (BillStatus == "0")
        {
            BillStatus = "";
        }
        string UsedStatus = this.ddlUsedStatus.Value;

        if (UsedStatus == "0")
        {
            UsedStatus = "";
        }

        string tIndex  = GetBillExAttrControl1.GetExtIndexValue;
        string xtValue = GetBillExAttrControl1.GetExtTxtValue;

        model.CompanyCD = companyCD;
        int       TotalCount = 0;
        DataTable dt         = PurchaseContractBus.SelectPurchaseContract(1, 1000000, "ID", ref TotalCount, ContractNo, Title, TypeID, DeptID, Seller, FromType, ProviderID, BillStatus, UsedStatus, tIndex, xtValue);



        //DataTable dt = WorkCenterBus.GetWorkCenterListBycondition(model, 1, 1000000, "ID desc", ref totalCount);

        //导出标题
        string headerTitle = "合同编号|合同主题|采购分类|采购员|供应商|金额合计|税额合计|含税金额合计|单据状态|审批状态";

        string[] header = headerTitle.Split('|');

        //导出标题所对应的列字段名称
        string columnFiled = "ContractNo|Title|TypeName|EmployeeName|CustName|TotalPrice|TotalTax|TotalFee|BillStatusName|UsedStatus";

        string[] field = columnFiled.Split('|');

        XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "采购合同列表");
    }