Beispiel #1
0
 private bool Check()
 {
     if (CommHelp.VerifesToNum(txtZhangQi.Text) == false || Convert.ToDecimal(txtZhangQi.Text) < 0)
     {
         base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目财务成本账期 格式有问题!');</script>");
         return(false);
     }
     if (CommHelp.VerifesToNum(txtCeSuanDian.Text) == false || Convert.ToDecimal(txtCeSuanDian.Text) < 0 || Convert.ToDecimal(txtCeSuanDian.Text) > 1)
     {
         base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('财务成本测算点 格式有问题!');</script>");
         return(false);
     }
     if (CommHelp.VerifesToNum(txtMonthLiLv.Text) == false || Convert.ToDecimal(txtMonthLiLv.Text) < 0 || Convert.ToDecimal(txtMonthLiLv.Text) > 1)
     {
         base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('财务成本月利率 格式有问题!');</script>");
         return(false);
     }
     if (txtFrom.Text == "")
     {
         base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('考核前期日期 不能为空!');</script>");
         return(false);
     }
     if (txtFrom.Text != "")
     {
         if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('考核前期日期 格式错误!');</script>");
             return(false);
         }
     }
     return(true);
 }
Beispiel #2
0
        protected void btnIsSelected_Click(object sender, EventArgs e)
        {
            if (btnEdit.Text == "取消编辑")
            {
                StringBuilder where = new StringBuilder();
                for (int i = 0; i < this.gvList.Rows.Count; i++)
                {
                    Label   lblIds        = (gvList.Rows[i].FindControl("Id")) as Label;
                    TextBox EditGuestName = (gvList.Rows[i].FindControl("EditGuestName")) as TextBox;
                    TextBox EditReceived  = (gvList.Rows[i].FindControl("EditReceived")) as TextBox;
                    if (CommHelp.VerifesToNum(EditReceived.Text) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('到款金额格式错误!');</script>");
                        return;
                    }
                    //where.AppendFormat("update KIS.[KingdeeInvoice].[dbo].[Invoice] set GuestName='{1}',Received={2} where Id={0};", lblIds.Text, EditGuestName.Text, EditReceived.Text);
                    where.AppendFormat("update [KingdeeInvoice].[dbo].[Invoice] set GuestName='{1}',Received={2} where Id={0};", lblIds.Text, EditGuestName.Text, EditReceived.Text);
                }
                if (where.ToString() != "")
                {
                    DBHelp.ExeCommand(where.ToString());
                }
            }
            if (ViewState["cbIsIsorder"] == null)
            {
                string where = " Id  in (";
                string expWhere = " Id  in (";
                for (int i = 0; i < this.gvList.Rows.Count; i++)
                {
                    CheckBox cb = (gvList.Rows[i].FindControl("cbIsIsorder")) as CheckBox;
                    if (cb.Checked)
                    {
                        Label lblIds = (gvList.Rows[i].FindControl("Id")) as Label;
                        where += "'" + lblIds.Text + "',";
                    }
                    else
                    {
                        Label lblIds = (gvList.Rows[i].FindControl("Id")) as Label;
                        expWhere += "'" + lblIds.Text + "',";
                    }
                }

                if (where != " Id  in (")
                {
                    where = where.Substring(0, where.Length - 1) + ")";
                    //var sql = "update KIS.[KingdeeInvoice].[dbo].[Invoice] set Isorder=1 where " + where;
                    var sql = "update [KingdeeInvoice].[dbo].[Invoice] set Isorder=1 where " + where;
                    DBHelp.ExeCommand(sql);
                }

                if (expWhere != " Id  in (")
                {
                    expWhere = expWhere.Substring(0, expWhere.Length - 1) + ")";
                    //var sql = "update KIS.[KingdeeInvoice].[dbo].[Invoice] set Isorder=null where " + expWhere;
                    var sql = "update [KingdeeInvoice].[dbo].[Invoice] set Isorder=null where " + expWhere;
                    DBHelp.ExeCommand(sql);
                }
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('保存成功!');</script>");
            }
        }
Beispiel #3
0
        public bool FormCheck()
        {
            if (this.ddlCarNo.Text.Trim() == "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择车牌号!');</script>");
                this.ddlCarNo.Focus();
                return(false);
            }

            if (this.txtMaintenanceTime.Text.Trim() == "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写保养/加油时间!');</script>");
                this.txtMaintenanceTime.Focus();
                return(false);
            }
            if (txtMaintenanceTime.Text != "")
            {
                try
                {
                    Convert.ToDateTime(txtMaintenanceTime.Text);
                }
                catch (Exception)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的日期格式有误!');</script>");
                    txtMaintenanceTime.Focus();
                    return(false);
                }
            }


            if (this.txtDistance.Text.Trim() == "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写公里数!');</script>");
                this.txtDistance.Focus();
                return(false);
            }
            if (CommHelp.VerifesToNum(txtDistance.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('公里数 格式错误!');</script>");
                this.txtDistance.Focus();
                return(false);
            }

            if (txtTotal.Text != "")
            {
                try
                {
                    Convert.ToDecimal(txtTotal.Text);
                }
                catch (Exception)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('金额格式有误!');</script>");
                    this.txtTotal.Focus();
                    return(false);
                }
            }


            return(true);
        }
Beispiel #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var propertyList = this.FIN_PropertyService.GetListArray(" MyProperty='个性'");
            List <FIN_SpecCost> commCostList = new List <FIN_SpecCost>();

            foreach (var m in propertyList)
            {
                if (!string.IsNullOrEmpty(Request["pro_" + m.Id]))
                {
                    var newM = new FIN_SpecCost();
                    newM.CaiYear    = ddlYear.Text + ddlMonth.Text;
                    newM.CompId     = Convert.ToInt32(ddlCompany.Text);
                    newM.CostTypeId = m.Id;

                    if (CommHelp.VerifesToNum(Request["pro_" + m.Id].ToString()) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('数值 格式错误!');</script>");
                        return;
                    }

                    newM.Total  = Convert.ToDecimal(Request["pro_" + m.Id]);
                    newM.UserID = Convert.ToInt32(ddlUser.Text);
                    commCostList.Add(newM);
                }
            }
            FIN_SpecCostService commSer = new FIN_SpecCostService();

            commSer.AddList(commCostList);

            base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('保存成功!');</script>");
        }
Beispiel #5
0
        private bool Check()
        {
            if (string.IsNullOrEmpty(txtSupplierName.Text))
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('供应商名称不能为空!');</script>"));
                return false;
            }
            if (string.IsNullOrEmpty(txtTotal.Text))
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('金额不能为空!');</script>"));
                return false;
            }
            if (CommHelp.VerifesToNum(txtTotal.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('金额格式错误!');</script>"));
                return false;
            }

            if (string.IsNullOrEmpty(dllUse.Text))
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('请选择用途!');</script>"));
                return false;
            }
            return true;
        }
Beispiel #6
0
        public bool FormCheck()
        {
            string strErr = "";

            if (this.txtBasePoType.Text.Trim().Length == 0)
            {
                strErr += "名称不能为空!\\n";
            }

            if (CommHelp.VerifesToNum(txtReward.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('系数 格式错误!');</script>");
                return(false);
            }
            try
            {
                Convert.ToDecimal(txtReward.Text);
            }
            catch (Exception)
            {
                strErr += "系数格式错误!\\n";
            }



            if (strErr != "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }

            return(true);
        }
Beispiel #7
0
 public bool FormCheck()
 {
     if (this.txtPAItemName.Text.Trim() == "")
     {
         base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写绩效考核项名称!');</script>");
         this.txtPAItemName.Focus();
         return(false);
     }
     if (!string.IsNullOrEmpty(txtPAItemScore.Text))
     {
         if (CommHelp.VerifesToNum(txtPAItemScore.Text.Trim()) == false)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('分值 格式错误!');</script>");
             return(false);
         }
     }
     if (!string.IsNullOrEmpty(txtPAItemAmount.Text))
     {
         if (CommHelp.VerifesToNum(txtPAItemAmount.Text.Trim()) == false)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('奖罚金额 格式错误!');</script>");
             return(false);
         }
     }
     if (base.Request["PAItemId"] != null)
     {
         if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from A_PAItem where A_PAItemName='{0}' and A_PAItemId<>{1}", this.txtPAItemName.Text.Trim(), base.Request["PAItemId"]))) > 0)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('绩效考核项名称已经存在,请重新填写!');</script>");
             this.txtPAItemName.Focus();
             return(false);
         }
     }
     else
     {
         if (Convert.ToInt32(DBHelp.ExeScalar(string.Format("select count(*) from A_PAItem where A_PAItemName='{0}'", this.txtPAItemName.Text.Trim()))) > 0)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('绩效考核项名称已经存在,请重新填写!');</script>");
             this.txtPAItemName.Focus();
             return(false);
         }
     }
     return(true);
 }
Beispiel #8
0
        public bool FormCheck()
        {
            string strErr = "";

            if (this.txtTeamLever.Text.Trim().Length == 0)
            {
                strErr += "姓名不能为空!\\n";
            }
            //if (this.txtCardNo.Text.Trim().Length == 0)
            //{
            //    strErr += "身份证号不能为空!\\n";
            //}
            if (this.txtContractStartTime.Text.Trim().Length == 0)
            {
                strErr += "合作起始时间不能为空!\\n";
            }
            if (CommHelp.VerifesToDateTime(txtContractStartTime.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('合作起始时间 格式错误!');</script>");
                return(false);
            }
            if (this.txtTeamPersonCount.Text.Trim().Length == 0)
            {
                strErr += "人员规模不能为空!\\n";
            }
            if (CommHelp.VerifesToNum(txtTeamPersonCount.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('人员规模 格式错误!');</script>");
                return(false);
            }
            if (!string.IsNullOrEmpty(txtPhone.Text) && txtPhone.Text.Length != 11)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('手机号码 格式错误!');</script>");
                return(false);
            }
            if (strErr != "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }

            return(true);
        }
        public bool FormCheck()
        {
            string strErr = "";

            if (this.txtTypeValue.Text.Trim().Length == 0)
            {
                strErr = "信息不能为空!\\n";
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                this.txtTypeValue.Focus();
                return(false);
            }

            if (CommHelp.VerifesToNum(txtTypeValue.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('数字(天) 格式错误!');</script>");
                return(false);
            }
            return(true);
        }
        private void Show()
        {
            string sql = "";

            if (txtYear.Text != "")
            {
                if (CommHelp.VerifesToNum(txtYear.Text) == false)
                {
                }
                sql += string.Format(" Jyear= {0}", txtYear.Text);
            }
            List <Fin_JieDate> list = this.jieDateService.GetListArray(sql);

            AspNetPager1.RecordCount = list.Count;
            this.gvList.PageIndex    = AspNetPager1.CurrentPageIndex - 1;

            this.gvList.DataSource = list;
            this.gvList.DataBind();
        }
Beispiel #11
0
        public bool FormCheck()
        {
            if (CommHelp.VerifesToNum(txtZhangQi.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('成本账期 格式错误!');</script>");
                return(false);
            }

            if (CommHelp.VerifesToNum(txtCeSuanDian.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('成本测算 格式错误!');</script>");
                return(false);
            }

            if (CommHelp.VerifesToNum(txtMonthLiLv.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('成本月利率 格式错误!');</script>");
                return(false);
            }
            return(true);
        }
Beispiel #12
0
        public bool FormCheck()
        {
            string strErr = "";

            if (this.txtWarnDays.Text.Trim().Length == 0)
            {
                strErr += "警示天数不能为空!\\n";
            }
            else
            {
                if (CommHelp.VerifesToNum(txtWarnDays.Text) == false)
                {
                    strErr += "警示天数格式错误!\\n";
                }
            }
            if (strErr != "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }
            return(true);
        }
Beispiel #13
0
        public bool FormCheck()
        {
            string strErr = "";


            if (this.txtPromiseSellTotal.Text.Trim().Length == 0 || CommHelp.VerifesToNum(txtPromiseSellTotal.Text) == false)
            {
                strErr = "承诺销售额指标 格式错误!\\n";
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                this.txtPromiseSellTotal.Focus();
                return(false);
            }


            if (this.txtPromiseProfit.Text.Trim().Length == 0 || CommHelp.VerifesToNum(txtPromiseProfit.Text) == false)
            {
                strErr = "承诺利润 格式错误!\\n";
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                this.txtPromiseProfit.Focus();
                return(false);
            }
            if (this.txtAddGuetSellTotal.Text.Trim().Length == 0 || CommHelp.VerifesToNum(txtAddGuetSellTotal.Text) == false)
            {
                strErr = "新客户承诺销售额 格式错误!\\n";
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                this.txtAddGuetSellTotal.Focus();
                return(false);
            }
            if (this.txtAddGuestProfit.Text.Trim().Length == 0 || CommHelp.VerifesToNum(txtAddGuestProfit.Text) == false)
            {
                strErr = "新客户承诺利润 格式错误!\\n";
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                this.txtAddGuestProfit.Focus();
                return(false);
            }

            return(true);
        }
        private void Show()
        {
            if (!string.IsNullOrEmpty(txtGoodAvgPrice.Text))
            {
                if (CommHelp.VerifesToNum(txtGoodAvgPrice.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('商品均价 格式错误!');</script>");
                    return;
                }
            }

            List <TB_Good> gooQGooddList = this.goodSer.GetListArray_New(GetSql());

            lblHadInvoice.Text = string.Format("{0:n2}", gooQGooddList.Sum(t => t.HadInvoice));
            lblNoInvoice.Text  = string.Format("{0:n2}", gooQGooddList.Sum(t => t.NoInvoice));
            lblHouseTotal.Text = string.Format("{0:n2}", gooQGooddList.Sum(t => t.GoodTotal));

            AspNetPager1.RecordCount = gooQGooddList.Count;
            this.gvList.PageIndex    = AspNetPager1.CurrentPageIndex - 1;

            this.gvList.DataSource = gooQGooddList;
            this.gvList.DataBind();
        }
        public bool FormCheck()
        {
            string strErr = "";

            if (txtPayXiShu.Text == "")
            {
                strErr += "激励系数格式错误!\\n";
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }
            if (CommHelp.VerifesToNum(txtPayXiShu.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('激励系数 格式错误!');</script>");
                return(false);
            }
            try
            {
                Convert.ToDecimal(txtPayXiShu.Text);
            }
            catch (Exception)
            {
                strErr += "激励系数格式错误!\\n";
            }
            if (Convert.ToDecimal(txtPayXiShu.Text) > 1000 || Convert.ToDecimal(txtPayXiShu.Text) < 0)
            {
                strErr += "激励系数格式在数值0---1000之间!\\n";
            }

            if (strErr != "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }

            return(true);
        }
Beispiel #16
0
        public string GetWhereSql()
        {
            string sql = " 1=1 ";

            if (string.IsNullOrEmpty(txtFrom.Text) || string.IsNullOrEmpty(txtTo.Text))
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择盘点日期!');</script>");
                return("-1");
            }
            if (CommHelp.VerifesToDateTime(txtFrom.Text) == false || CommHelp.VerifesToDateTime(txtTo.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('盘点日期 格式错误!');</script>");
                return("-1");
            }
            if (txtGoodAvgPrice.Text != "")
            {
                try
                {
                    if (Convert.ToDecimal(txtGoodAvgPrice.Text) <= 0)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('商品均价必须大于0!');</script>");

                        return("");
                    }
                    sql += string.Format(" and GoodAvgPrice {0} {1}", ddlPrice.Text, txtGoodAvgPrice.Text);
                }
                catch (Exception)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('商品均价格式有误!');</script>");

                    return("-1");
                }
            }
            if (txtCaiKuNum.Text != "")
            {
                if (CommHelp.VerifesToNum(txtCaiKuNum.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('采购需出格式出错!');</script>");
                    return("-1");
                }
                sql += string.Format("and isnull(SumKuXuCai,0){0}{1}", ddlCaiKuNum.Text, txtCaiKuNum.Text);
            }

            if (txtZhiLiuNum.Text != "")
            {
                if (CommHelp.VerifesToNum(txtZhiLiuNum.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('滞留库存格式出错!');</script>");
                    return("-1");
                }
                sql += string.Format("and (isnull(GoodNum,0)-isnull(SumKuXuCai,0)){0}{1}", ddlZhiLiuNum.Text, txtZhiLiuNum.Text);
            }

            if (!string.IsNullOrEmpty(txtNum.Text))
            {
                if (CommHelp.VerifesToNum(txtNum.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('库存格式出错!');</script>");
                    return("-1");
                }
                sql += string.Format(" and isnull(GoodNum,0){0}{1}", ddlFuHao.SelectedItem.Text, txtNum.Text);
            }

            if (txtZhuJi.Text != "")
            {
                //string goodName = txtZhuJi.Text.Replace(@"\", ",");

                string[] allList = txtZhuJi.Text.Split('\\');
                if (allList.Length != 7)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('商品格式不正确!');</script>");
                    return("-1");
                }
                int goodId = goodsSer.GetGoodId(allList[1], allList[3], allList[4], allList[2], allList[5]);
                if (goodId == 0)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的商品不存在!');</script>");

                    return("-1");
                }

                sql += string.Format(" and TB_Good.GoodId={0}", goodId);
            }


            if (ddlGoodSmType.Text != "" && ddlGoodType.Text != "")
            {
                sql += string.Format(" and GoodTypeSmName ='{0}' ", ddlGoodSmType.SelectedItem.Value);
            }
            else
            {
                if (ddlGoodSmType.Text != "" && ddlGoodType.Text == "")
                {
                    sql += string.Format(" and GoodTypeSmName ='{0}' ", ddlGoodSmType.SelectedItem.Value);
                }
                if (ddlGoodSmType.Text == "" && ddlGoodType.Text != "")
                {
                    sql += string.Format(" and  GoodTypeName ='{0}'", ddlGoodType.SelectedItem.Value);
                }
            }

            if (ddlHouse.Text != "" && ddlHouse.Text != "0")
            {
                sql += string.Format(" and HouseId ={0}", ddlHouse.SelectedItem.Value);
            }


            if (txtGoodNo.Text != "")
            {
                sql += string.Format(" and TB_Good.GoodNo like '%{0}%'", txtGoodNo.Text);
            }
            if (txtNameOrTypeOrSpec.Text != "" && txtNameOrTypeOrSpecTwo.Text != "")
            {
                sql += string.Format(" and ((GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%') or (GoodTypeSmName like '%{1}%' or GoodName  like '%{1}%' or GoodSpec like '%{1}%'))",
                                     txtNameOrTypeOrSpec.Text, txtNameOrTypeOrSpecTwo.Text);
            }
            else if (txtNameOrTypeOrSpec.Text != "" || txtNameOrTypeOrSpecTwo.Text != "")
            {
                var NameOrTypeOrSpec = "";
                if (txtNameOrTypeOrSpec.Text != "")
                {
                    NameOrTypeOrSpec = txtNameOrTypeOrSpec.Text;
                }
                if (txtNameOrTypeOrSpecTwo.Text != "")
                {
                    NameOrTypeOrSpec = txtNameOrTypeOrSpecTwo.Text;
                }

                sql += string.Format(" and (GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%')",
                                     NameOrTypeOrSpec);
            }
            if (txtNameOrTypeOrSpec2.Text != "" || txtNameOrTypeOrSpecTwo2.Text != "")
            {
                if (txtNameOrTypeOrSpec2.Text != "" && txtNameOrTypeOrSpecTwo2.Text != "")
                {
                    sql += string.Format(" and ((GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%') and (GoodTypeSmName like '%{1}%' or GoodName  like '%{1}%' or GoodSpec like '%{1}%'))",
                                         txtNameOrTypeOrSpec2.Text, txtNameOrTypeOrSpecTwo2.Text);
                }
                else if (txtNameOrTypeOrSpec2.Text != "" || txtNameOrTypeOrSpecTwo2.Text != "")
                {
                    var NameOrTypeOrSpec = "";
                    if (txtNameOrTypeOrSpec2.Text != "")
                    {
                        NameOrTypeOrSpec = txtNameOrTypeOrSpec2.Text;
                    }
                    if (txtNameOrTypeOrSpecTwo2.Text != "")
                    {
                        NameOrTypeOrSpec = txtNameOrTypeOrSpecTwo2.Text;
                    }

                    sql += string.Format(" and (GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%')",
                                         NameOrTypeOrSpec);
                }
            }
            if (ddlArea.Text != "")
            {
                sql += string.Format(" and GoodArea='{0}'", ddlArea.Text);
            }
            if (ddlNumber.Text != "")
            {
                sql += string.Format(" and GoodNumber='{0}'", ddlNumber.Text);
            }
            if (ddlRow.Text != "")
            {
                sql += string.Format(" and GoodRow='{0}'", ddlRow.Text);
            }
            if (ddlCol.Text != "")
            {
                sql += string.Format(" and GoodCol='{0}'", ddlCol.Text);
            }

            return(sql);
        }
Beispiel #17
0
        private List <ElectronicInvoice> GetData()
        {
            billTypeList = new Invoice_BillTypeService().GetListArray(" IsStop=0");
            personList   = new Invoice_PersonService().GetListArray(" IsStop=0");
            var sql      = "";
            var sumWhere = "having 1=1";

            if (txtSmallTotal.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtSmallTotal.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('金额 格式错误!');</script>");
                    return(null);
                }
                sumWhere += string.Format(" and {1}{0}isnull(sum(ActPay),0) ", ddlLeftTotal.Text, txtSmallTotal.Text.Trim());
            }
            if (txtBigTotal.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtBigTotal.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('金额 格式错误!');</script>");
                    return(null);
                }
                sumWhere += string.Format(" and isnull(sum(ActPay),0){0} {1}", ddlTotal.Text, txtBigTotal.Text.Trim());
            }
            if (txtPFNo.Text.Trim() != "")
            {
                sql += string.Format(" and LastFPNo like '%{0}%'", txtPFNo.Text.Trim());
            }
            //if (txtNotPFNo.Text.Trim() != "")
            //{
            //    sql += string.Format(" and LastFPNo <>'{0}'", txtNotPFNo.Text.Trim());
            //}
            if (txtSupplierBrandName.Text.Trim() != "")
            {
                sql += string.Format(" and SupplierBrandName like '%{0}%'", txtSupplierBrandName.Text.Trim());
            }

            if (txtPONo.Text.Trim() != "")
            {
                if (CheckPoNO(txtPONo.Text) == false)
                {
                    return(null);
                }
                sql += string.Format(" and PONo like '%{0}%'", txtPONo.Text.Trim());
            }
            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目日期 格式错误!');</script>");
                    return(null);
                }
                sql += string.Format(" and PODate>='{0} 00:00:00'", txtFrom.Text);
            }

            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目日期 格式错误!');</script>");
                    return(null);
                }
                sql += string.Format(" and PODate<='{0} 23:59:59'", txtTo.Text);
            }

            if (txtProNo.Text.Trim() != "")
            {
                if (CheckProNo(txtProNo.Text) == false)
                {
                    return(null);
                }
                sql += string.Format(" and ProNo like '%{0}%'", txtProNo.Text.Trim());
            }

            if (ddlUser.Text != "-1")
            {
                sql += string.Format(" and AE='{0}'", ddlUser.SelectedItem.Text);
            }

            //if (ddlCompany.Text != "-1")
            //{
            //    sql += string.Format(" and AE='{0}'", ddlCompany.SelectedItem.Text);
            //}
            if (!string.IsNullOrEmpty(txtSupplierName.Text))
            {
                if (cbSupplierName.Checked == false)
                {
                    sql += string.Format(" and SupplierName like '%{0}%'", txtSupplierName.Text.Trim());
                }
                else
                {
                    sql += string.Format(" and SupplierName='{0}'", txtSupplierName.Text.Trim());
                }
            }
            if (!string.IsNullOrEmpty(txtSupplierSimpName.Text))
            {
                if (cbSupplierSimpName.Checked == false)
                {
                    sql += string.Format(" and SupplieSimpeName like '%{0}%'", txtSupplierSimpName.Text.Trim());
                }
                else
                {
                    sql += string.Format(" and SupplieSimpeName='{0}'", txtSupplierSimpName.Text.Trim());
                }
            }
            if (ddlPayType.Text != "-1")
            {
                sql += string.Format(" and busType='{0}'", ddlPayType.Text);
            }
            if (ddlModel.Text != "全部")
            {
                sql += string.Format(" and Model='{0}'", ddlModel.Text);
            }
            if (ddlPeculiarity.Text != "全部")
            {
                sql += string.Format(" and Peculiarity='{0}'", ddlPeculiarity.Text);
            }
            if (ddlProvince.Text != "")
            {
                sql += string.Format(" and Province='{0}'", ddlProvince.SelectedItem.Text);
            }
            if (ddlCity.Text != "")
            {
                sql += string.Format(" and City='{0}'", ddlCity.SelectedItem.Text);
            }
            var list = this.electronicInvoiceSer.GetReport(sql, sumWhere);

            var countList = list.GroupBy(t => t.busType + t.ProNo).Where(t => t.Count() > 1);


            foreach (var m in countList)
            {
                hb.Add(m.Key, null);
            }
            return(list);
        }
        public void Show()
        {
            txtGuestName.Text = txtGuestName.Text.Trim();
            txtInvoiceNo.Text = txtInvoiceNo.Text.Trim();
            txtPOName.Text    = txtPOName.Text.Trim();
            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票日期 格式错误!');</script>");
                    return;
                }
            }
            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票日期 格式错误!');</script>");
                    return;
                }
            }

            List <InvoiceReport> invoiceList = new List <InvoiceReport>();

            if (isSelect)
            {
                string sql = " where Sell_OrderFP.Status='通过'  and  Sell_OrderFP.FPNo<>'' ";

                string sql_1 = "where 1=1 ";

                if (txtGuestName.Text.Trim() != "")
                {
                    sql_1 += string.Format(" and Sell_OrderFP.GuestNAME like '%{0}%'", txtGuestName.Text.Trim());
                }
                if (txtInvoiceNo.Text.Trim() != "")
                {
                    sql_1 += string.Format(" and FPNo like '%{0}%'", txtInvoiceNo.Text.Trim());
                }
                if (cbZhengShu.Checked == false && txtInvoice.Text != "")
                {
                    if (CommHelp.VerifesToNum(txtInvoice.Text) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票金额 格式错误!');</script>");
                        return;
                    }
                    if (ddlInvTotal.Text == "=")
                    {
                        sql_1 += string.Format(" and Sell_OrderFP.Total in ({0},{1})", Convert.ToDecimal(txtInvoice.Text), -Convert.ToDecimal(txtInvoice.Text));
                    }
                    else
                    {
                        sql_1 += string.Format(" and Sell_OrderFP.Total {0} {1}", ddlInvTotal.Text, txtInvoice.Text);
                    }
                }
                if (cbZhengShu.Checked && txtInvoice.Text != "")
                {
                    if (CommHelp.VerifesToNum(txtInvoice.Text) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票金额 格式错误!');</script>");
                        return;
                    }
                    if (ddlInvTotal.Text == "=")
                    {
                        sql_1 += string.Format(" and Sell_OrderFP.Total ={0} ", txtInvoice.Text);
                    }
                    else
                    {
                        sql_1 += string.Format(" and Sell_OrderFP.Total {0} {1}", ddlInvTotal.Text, txtInvoice.Text);
                    }
                }
                string param = "CG_POOrder.Status='通过'";
                string temp  = "";
                if (ddlClose.Text != "-1" || ddlIsSelect.Text != "-1" || ddlHanShui.Text != "-1" || cbIsSpecial.Checked || cbJiaoFu.Checked || ddlUser.Text != "-1" ||
                    txtPOFrom.Text != "" || txtPOTo.Text != "" || txtPONo.Text != "" || ddlCompany.Text != "-1" || ddlModel.Text != "全部")
                {
                    if (ddlClose.Text != "-1")
                    {
                        param += string.Format(" and IsClose={0}", ddlClose.Text);
                    }
                    if (ddlIsSelect.Text != "-1")
                    {
                        param += string.Format(" and IsSelected={0}", ddlIsSelect.Text);
                    }
                    if (ddlHanShui.Text != "-1")
                    {
                        param += string.Format(" and IsPoFax={0}", ddlHanShui.Text);
                    }
                    if (ddlModel.Text != "全部")
                    {
                        param += string.Format(" and Model='{0}'", ddlModel.Text);
                    }
                    if (cbIsSpecial.Checked)
                    {
                        param += string.Format(" and IsSpecial=0 ");
                    }

                    if (cbJiaoFu.Checked)
                    {
                        param += string.Format(" and POStatue2='已交付' ");
                    }


                    if (txtPOFrom.Text != "")
                    {
                        if (CommHelp.VerifesToDateTime(txtPOFrom.Text) == false)
                        {
                            base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票日期 格式错误!');</script>");
                            return;
                        }
                        param += string.Format(" and PODate>='{0} 00:00:00'", txtPOFrom.Text);
                    }

                    if (txtPOTo.Text != "")
                    {
                        if (CommHelp.VerifesToDateTime(txtPOTo.Text) == false)
                        {
                            base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票日期 格式错误!');</script>");
                            return;
                        }
                        param += string.Format(" and PODate<='{0} 23:59:59'", txtPOTo.Text);
                    }
                    if (ddlUser.Text != "-1")
                    {
                        param += string.Format(" and AppName={0} ", ddlUser.Text);
                    }
                    if (ddlCompany.Text != "-1")
                    {
                        string where = string.Format(" CompanyCode='{0}'", ddlCompany.Text.Split(',')[2]);
                        param       += string.Format(" and AppName IN(select id from tb_User where {0}) ", where);
                    }
                    if (txtPONo.Text.Trim() != "")
                    {
                        if (CheckPoNO(txtPONo.Text) == false)
                        {
                            return;
                        }

                        param += string.Format(" and Sell_OrderFP.PONO like '%{0}%' ", txtPONo.Text.Trim());
                    }

                    if (!string.IsNullOrEmpty(txtPOName.Text))
                    {
                        param += string.Format(" and Sell_OrderFP.PONAME like '%{0}%'", txtPOName.Text);
                    }

                    sql += string.Format(" and exists(select id from CG_POOrder where {0} and  CG_POOrder.PONO=Sell_OrderFP.PONO  and ifzhui=0)", param);

                    temp = string.Format(" and exists(select id from CG_POOrder where {0} and  CG_POOrder.PONO=Sell_OrderFP.PONO  and ifzhui=0)", param);
                }

                if (ddlIsXiaozhang.Text != "-1")
                {
                }

                if (ddlCompare.Text == "2")
                {
                    invoiceList = this.invoiceSer.GetAllInvoiceReports(txtGuestName.Text, txtInvoiceNo.Text, txtInvoice.Text,
                                                                       ddlInvTotal.Text, txtFrom.Text, txtTo.Text, sql, "1", cbInvoTotalToge.Checked, ddlIsorder.Text, cbZhengShu.Checked, "", ddlIsXiaozhang.Text, param, temp);


                    invoiceList.AddRange(this.invoiceSer.GetAllInvoiceReports(txtGuestName.Text, txtInvoiceNo.Text, txtInvoice.Text,
                                                                              ddlInvTotal.Text, txtFrom.Text, txtTo.Text, sql, "0", cbInvoTotalToge.Checked, ddlIsorder.Text, cbZhengShu.Checked, "", ddlIsXiaozhang.Text, param, temp));
                }
                else
                {
                    if (Request["PONo"] != null)
                    {
                        invoiceList = this.invoiceSer.GetAllInvoiceReports(txtGuestName.Text, txtInvoiceNo.Text, txtInvoice.Text,
                                                                           ddlInvTotal.Text, txtFrom.Text, txtTo.Text, sql, ddlCompare.Text, cbInvoTotalToge.Checked, ddlIsorder.Text, cbZhengShu.Checked, txtPONo.Text, ddlIsXiaozhang.Text, param, temp);
                    }
                    else
                    {
                        invoiceList = this.invoiceSer.GetAllInvoiceReports(txtGuestName.Text, txtInvoiceNo.Text, txtInvoice.Text,
                                                                           ddlInvTotal.Text, txtFrom.Text, txtTo.Text, sql, ddlCompare.Text, cbInvoTotalToge.Checked, ddlIsorder.Text, cbZhengShu.Checked, "", ddlIsXiaozhang.Text, param, temp);
                    }
                }
                isSelect            = false;
                ViewState["myList"] = invoiceList;
            }
            else
            {
                invoiceList = ViewState["myList"] as List <InvoiceReport>;
            }
            AspNetPager1.RecordCount = invoiceList.Count;
            this.gvList.PageIndex    = AspNetPager1.CurrentPageIndex - 1;

            string allPONOs  = "";
            int    pageIndex = gvList.PageIndex;

            for (int i = (pageIndex * 10); i < ((pageIndex + 1) * 10); i++)
            {
                if (i >= invoiceList.Count)
                {
                    break;
                }
                if (!string.IsNullOrEmpty(invoiceList[i].OA_PONO))
                {
                    allPONOs += "'" + invoiceList[i].OA_PONO + "',";
                }
            }
            allPONOs = allPONOs.Trim(',');
            if (allPONOs != "")
            {
                string    ponos = string.Format(@"SELECT PONO,AE from CG_POOrder  where Status='通过' and  IFZhui=0 AND PONO IN ({0})", allPONOs);
                DataTable dt    = DBHelp.getDataTable(ponos);
                list = new List <BaseModel>();
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new BaseModel {
                        key = dr[0].ToString(), AE = dr[1].ToString()
                    });
                }
            }
            this.gvList.DataSource = invoiceList;
            this.gvList.DataBind();


            decimal OA_InvoiceTotal      = 0;
            decimal Kingdee_InvoiceTotal = 0;

            Hashtable hs  = new Hashtable();
            Hashtable hs1 = new Hashtable();

            foreach (var m in invoiceList)
            {
                if (!hs.ContainsKey(m.Kingdee_Id))
                {
                    Kingdee_InvoiceTotal += m.Kingdee_InvoiceTotal ?? 0;
                    hs.Add(m.Kingdee_Id, null);
                }

                if (!hs1.ContainsKey(m.OA_FPId))
                {
                    OA_InvoiceTotal += m.OA_InvoiceTotal ?? 0;
                    hs1.Add(m.OA_FPId, null);
                }
            }
            lblAllTotal.Text     = invoiceList.Sum(t => t.All_InvoiceTotal ?? 0).ToString();
            lblOATotal.Text      = OA_InvoiceTotal.ToString();
            lblKingdeeTotal.Text = Kingdee_InvoiceTotal.ToString();
        }
Beispiel #19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (txtNum.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtNum.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('数量 格式错误!');</script>");
                    return;
                }
            }
            if (txtCostPrice.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtCostPrice.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('单价 格式错误!');</script>");
                    return;
                }
            }
            //int goodId = goodsSer.GetGoodId(txtInvName.Text, lblSpec.Text, txtModel.Text,lblGoodSmTypeName.Text,txtUnit.Text);
            //if (goodId == 0)
            //{
            //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的商品不存在!');</script>");

            //    return;
            //}
            try
            {
                Convert.ToDecimal(txtCostPrice.Text);
            }
            catch (Exception)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的单价格式有误!');</script>");
                return;
            }
            //var good= goodsSer.GetModel(goodId);
            tb_QuotePrice_InvDetails s = new tb_QuotePrice_InvDetails();

            s.InvUnit        = txtUnit.Text;
            s.InvPrice       = Convert.ToDecimal(txtCostPrice.Text);
            s.InvGoodId      = 0;
            s.InvName        = txtInvName.Text;
            s.InvNum         = Convert.ToDecimal(txtNum.Text);
            s.InvModel       = lblSpec.Text;
            s.GoodBrand      = txtGoodBrand.Text;
            s.Total          = s.InvNum * s.InvPrice;
            s.Product        = txtProduct.Text;
            s.GoodNo         = txtGoodNo.Text;
            s.GoodTypeSmName = lblGoodSmTypeName.Text;
            s.InvRemark      = txtRemark.Text;
            //修改
            if (Request["index"] != null)
            {
                int index = Convert.ToInt32(Request["index"]);

                tb_QuotePrice_InvDetails model = ViewState["m"] as tb_QuotePrice_InvDetails;
                s.Id          = model.Id;
                s.IfUpdate    = true;
                s.UpdateIndex = Convert.ToInt32(Request["index"]);
                Session["m"]  = s;


                this.ClientScript.RegisterStartupScript(this.GetType(), null, "<script> window.close();</script>");
            }
            else
            {
                if (Session["InvDetails"] == null)
                {
                    List <tb_QuotePrice_InvDetails> invDetails = new List <tb_QuotePrice_InvDetails>();
                    invDetails.Insert(invDetails.Count, s);
                    Session["InvDetails"] = invDetails;
                }
                else
                {
                    List <tb_QuotePrice_InvDetails> invDetails = Session["InvDetails"] as List <tb_QuotePrice_InvDetails>;
                    invDetails.Insert(invDetails.Count, s);
                    Session["InvDetails"] = invDetails;
                }
                clear();
            }
            // this.ClientScript.RegisterStartupScript(this.GetType(), null, "<script> window.close();</script>");
        }
        private void Show()
        {
            if (ddlFKDF.Text != "-1" && !string.IsNullOrEmpty(txtFKDF.Text))
            {
                if (CommHelp.VerifesToNum(txtFKDF.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('反馈得分 格式错误!');</script>");
                    return;
                }
            }
            if (ddlAllScore.Text != "-1" && !string.IsNullOrEmpty(txtAllScore.Text))
            {
                if (CommHelp.VerifesToNum(txtAllScore.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('综合得分 格式错误!');</script>");
                    return;
                }
            }
            string sql = " ";

            if (ddlCompany.Text != "-1")
            {
                string where = string.Format(" CompanyCode='{0}'", ddlCompany.Text.Split(',')[2]);
                sql         += string.Format(" and exists (select id from tb_User where IFZhui=0 and {0} and CG_POOrder.appName=id)", where);
            }
            if (txtPONo.Text != "")
            {
                sql += string.Format(" and CG_POOrder.PONo like '%{0}%'", txtPONo.Text);
            }


            if (ttxPOName.Text != "")
            {
                sql += string.Format(" and CG_POOrder.POName like '%{0}%'", ttxPOName.Text);
            }

            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目时间 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and CG_POOrder.PODate>='{0} 00:00:00'", txtFrom.Text);
            }

            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目时间 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and CG_POOrder.PODate<='{0} 23:59:59'", txtTo.Text);
            }


            if (txtGuestName.Text != "")
            {
                sql += string.Format(" and CG_POOrder.GuestName  like '%{0}%'", txtGuestName.Text);
            }
            var isColse = "";

            if (ddlIsClose.Text != "-1")
            {
                isColse = " and IsClose=" + ddlIsClose.Text;
            }

            if (ddlIsSelect.Text != "-1")
            {
                isColse += " and IsSelected=" + ddlIsSelect.Text;
            }
            if (ddlPOTyle.Text != "-1")
            {
                isColse += " and CG_POOrder.POType=" + ddlPOTyle.Text;
            }
            if (ddlModel.Text != "全部")
            {
                sql += string.Format(" and Model='{0}'", ddlModel.Text);
            }
            if (ddlJieIsSelected.Text != "-1")
            {
                isColse += " and JieIsSelected=" + ddlJieIsSelected.Text;
            }
            //if (ViewState["showAll"] != null)
            //{
            //    sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName={0} AND PONO=JXC_REPORT.PONO )", Session["currentUserId"]);
            //}

            //if (ddlGuestTypeList.SelectedValue != "全部")
            //{
            //    sql += string.Format(" and EXISTS (select id from TB_GuestTrack where MyGuestType='{0}' and TB_GuestTrack.id=CG_POOrder.GuestId )",ddlGuestTypeList.SelectedValue);
            //}

            if (ddlGuestTypeList.SelectedValue != "全部")
            {
                sql += string.Format(" and GuestType='{0}'", ddlGuestTypeList.SelectedValue);
            }

            if (ddlGuestProList.SelectedValue != "-2")
            {
                sql += string.Format(" and GuestPro={0}", ddlGuestProList.SelectedValue);
            }



            if (ddlUser.Text == "-1")//显示所有用户
            {
                if (ddlIsSpecial.Text != "-1")
                {
                    sql += string.Format(" and IsSpecial={1} {0} ", isColse, ddlIsSpecial.Text);
                    //sql += string.Format(" and EXISTS (select ID from CG_POOrder where IsSpecial=0 AND PONO=JXC_REPORT.PONO {0})", isColse);
                }

                //else
                //{
                //    sql += string.Format(" and EXISTS (select ID from CG_POOrder where IsSpecial=1 AND PONO=JXC_REPORT.PONO {0})", isColse);
                //}
                //var model = Session["userInfo"] as User;
                //sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName in (select ID from tb_User where 1=1 and loginName<>'admin' and loginStatus<>'离职') AND PONO=JXC_REPORT.PONO )", Session["currentUserId"]);
            }
            else if (ddlUser.Text == "0")//显示部门信息
            {
                var model = Session["userInfo"] as User;
                //sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName in (select ID from tb_User where 1=1 and loginName<>'admin' and loginStatus<>'离职' and loginIPosition<>'' and loginIPosition='{0}') AND PONO=JXC_REPORT.PONO )", model.LoginIPosition);

                if (ddlIsSpecial.Text != "-1")
                {
                    sql += string.Format(" and CG_POOrder.AppName in (select ID from tb_User where 1=1 and loginName<>'admin' and loginStatus<>'离职' and loginIPosition<>'' and loginIPosition='{0}') and IsSpecial={2} {1}",
                                         model.LoginIPosition, isColse, ddlIsSpecial.Text);
                    // sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName in (select ID from tb_User where 1=1 and loginName<>'admin' and loginStatus<>'离职' and loginIPosition<>'' and loginIPosition='{0}') AND PONO=JXC_REPORT.PONO and IsSpecial=0 {1})", model.LoginIPosition, isColse);
                }
                else
                {
                    sql += string.Format(" and CG_POOrder.AppName in (select ID from tb_User where 1=1 and loginName<>'admin' and loginStatus<>'离职' and loginIPosition<>'' and loginIPosition='{0}')  {1}",
                                         model.LoginIPosition, isColse);
                    //sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName in (select ID from tb_User where 1=1 and loginName<>'admin' and loginStatus<>'离职' and loginIPosition<>'' and loginIPosition='{0}') AND PONO=JXC_REPORT.PONO and IsSpecial=1 {1})", model.LoginIPosition, isColse);
                }
            }
            else
            {
                if (ddlIsSpecial.Text != "-1")
                {
                    sql += string.Format(" and CG_POOrder.AppName={0} and IsSpecial={2} {1} ", ddlUser.Text, isColse, ddlIsSpecial.Text);
                    //sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName={0} AND PONO=JXC_REPORT.PONO  and IsSpecial=0 {1})", ddlUser.Text, isColse);
                }
                else
                {
                    sql += string.Format(" and CG_POOrder.AppName={0}  {1} ", ddlUser.Text, isColse);
                    //sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName={0} AND PONO=JXC_REPORT.PONO  and IsSpecial=1 {1})", ddlUser.Text, isColse);
                }
                //sql += string.Format(" and EXISTS (select ID from CG_POOrder where AppName={0} AND PONO=JXC_REPORT.PONO )", ddlUser.Text);
            }

            if (CheckBox1.Checked || CheckBox2.Checked || CheckBox3.Checked || CheckBox4.Checked)
            {
                sql += " and exists ( select ID from CG_POOrder where PONO=JXC_REPORT.PONO";
                if (CheckBox1.Checked)
                {
                    sql += string.Format(" and POStatue='{0}'", CheckBox1.Text);
                }
                if (CheckBox2.Checked)
                {
                    sql += string.Format(" and POStatue2='{0}'", CheckBox2.Text);
                }
                if (CheckBox3.Checked)
                {
                    sql += string.Format(" and POStatue3='{0}'", CheckBox3.Text);
                }
                if (CheckBox4.Checked)
                {
                    sql += string.Format(" and POStatue4='{0}'", CheckBox4.Text);
                }

                sql += ")";
            }


            string having = " having ";

            if (CheckBox5.Checked && CheckBox6.Checked)
            {
                having += string.Format("  (avg(SellFPTotal)<> sum(goodSellTotal) or  avg(SellFPTotal) is null)  and (avg(InvoTotal)<> sum(goodSellTotal) or sum(InvoTotal) is null)");
            }
            else if (CheckBox5.Checked || CheckBox6.Checked)
            {
                if (CheckBox5.Checked)
                {
                    having += string.Format("  avg(SellFPTotal)<> sum(goodSellTotal) or  avg(SellFPTotal) is null ");
                }
                if (CheckBox6.Checked)
                {
                    having += string.Format("  avg(InvoTotal)<> sum(goodSellTotal) or sum(InvoTotal) is null ");
                }
            }
            else
            {
                having = "";
            }


            string fuhao = " where 1=1 ";

            if (ddlFKDF.Text != "-1" && !string.IsNullOrEmpty(txtFKDF.Text))
            {
                fuhao += string.Format(" and MyValue{0}{1}", ddlFKDF.Text, txtFKDF.Text);
            }
            if (ddlFuHao.Text != "-1")
            {
                fuhao = string.Format(" where SumPOTotal {0} isnull(goodSellTotal,0)", ddlFuHao.Text);
            }
            if (ddlPOFaTotal.Text != "-1")
            {
                fuhao += string.Format(" and SumPOTotal {0} isnull(SellFPTotal,0)", ddlPOFaTotal.Text);
            }
            if (ddlShiJiDaoKuan.Text != "-1")
            {
                fuhao += string.Format(" and SumPOTotal {0} isnull(InvoTotal,0)", ddlShiJiDaoKuan.Text);
            }
            if (ddlEquPOTotal.Text != "-1")
            {
                if (CommHelp.VerifesToNum(txtEquTotal.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目金额 格式错误!');</script>");
                    return;
                }
                fuhao += string.Format(" and SumPOTotal{0}{1}", ddlEquPOTotal.Text, txtEquTotal.Text);
            }



            if (ddlJingLiTotal.Text != "-1")
            {
                fuhao += string.Format(" and maoliTotal {0} (isnull(InvoTotal,0)-isnull(goodTotal,0))", ddlJingLiTotal.Text);
            }

            if (!string.IsNullOrEmpty(txtProProfit.Text) && ddlProProfit.Text != "-1")
            {
                if (CommHelp.VerifesToNum(txtProProfit.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目净利 格式错误!');</script>");
                    return;
                }
                fuhao += string.Format(" and maoliTotal {0} {1}", ddlProProfit.Text, txtProProfit.Text);
            }

            if (!string.IsNullOrEmpty(txtProTureProfit.Text) && ddlProTureProfit.Text != "-1")
            {
                if (CommHelp.VerifesToNum(txtProTureProfit.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('实际净利 格式错误!');</script>");
                    return;
                }
                fuhao += string.Format(" and InvoTotal-goodTotal {0} {1}", ddlProTureProfit.Text, txtProTureProfit.Text);
            }

            if (ddlPaiGong.Text != "-1")
            {
                //fuhao += string.Format(" and OutDispater={0}", ddlPaiGong.Text);

                if (ddlPaiGong.Text != "-1000")
                {
                    fuhao += string.Format(" and OutDispater={0}", ddlPaiGong.Text);
                }
                else
                {
                    string userIds = "";
                    foreach (ListItem item in ddlPaiGong.Items)
                    {
                        if (item.Value != "-1" && item.Value != "-1000")
                        {
                            userIds += string.Format("{0},", item.Value);
                        }
                    }
                    fuhao += string.Format(" and OutDispater not in ({0})", userIds.Trim(','));
                }
            }

            if (txtPGFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtPGFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('派工时间 格式错误!');</script>");
                    return;
                }
                fuhao += string.Format(" and DisDate>='{0} 00:00:00'", txtPGFrom.Text);
            }

            if (txtPGTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtPGTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('派工时间 格式错误!');</script>");
                    return;
                }
                fuhao += string.Format(" and DisDate<='{0} 23:59:59'", txtPGTo.Text);
            }

            if (ddlJingLi.Text != "-1" && !string.IsNullOrEmpty(txtJingLi.Text))
            {
                if (CommHelp.VerifesToNum(txtJingLi.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('净利润率 格式错误!');</script>");
                    return;
                }
            }
            List <JXC_REPORTTotal> pOOrderList = this.POSer.GetSkill_Total(sql, having, fuhao);

            if (ddlTrueZhangQI.Text != "-1")
            {
                if (ddlTrueZhangQI.Text == "1")
                {
                    pOOrderList = pOOrderList.FindAll(T => T.trueZhangQi <= 30);
                }
                if (ddlTrueZhangQI.Text == "2")
                {
                    pOOrderList = pOOrderList.FindAll(T => T.trueZhangQi > 30 && T.trueZhangQi <= 60);
                }
                if (ddlTrueZhangQI.Text == "3")
                {
                    pOOrderList = pOOrderList.FindAll(T => T.trueZhangQi > 60 && T.trueZhangQi <= 90);
                }
                if (ddlTrueZhangQI.Text == "4")
                {
                    pOOrderList = pOOrderList.FindAll(T => T.trueZhangQi > 90 && T.trueZhangQi <= 120);
                }
                if (ddlTrueZhangQI.Text == "5")
                {
                    pOOrderList = pOOrderList.FindAll(T => T.trueZhangQi > 120);
                }
            }


            if (ddlJingLi.Text != "-1" && !string.IsNullOrEmpty(txtJingLi.Text))
            {
                decimal jingLi = Convert.ToDecimal(txtJingLi.Text);
                if (ddlJingLi.Text == ">")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.JingLi > jingLi);
                }
                if (ddlJingLi.Text == "<")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.JingLi < jingLi);
                }
                if (ddlJingLi.Text == ">=")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.JingLi >= jingLi);
                }
                if (ddlJingLi.Text == "<=")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.JingLi <= jingLi);
                }
                if (ddlJingLi.Text == "=")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.JingLi == jingLi);
                }
            }

            if (ddlAllScore.Text != "-1" && !string.IsNullOrEmpty(txtAllScore.Text))
            {
                if (CommHelp.VerifesToNum(txtAllScore.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('综合得分 格式错误!');</script>");
                    return;
                }
                fuhao = ddlAllScore.Text;
                decimal allScore = Convert.ToDecimal(txtAllScore.Text);
                if (fuhao == ">")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.allScore > allScore);
                }
                if (fuhao == "<")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.allScore < allScore);
                }
                if (fuhao == ">=")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.allScore >= allScore);
                }
                if (fuhao == "<=")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.allScore <= allScore);
                }
                if (fuhao == "=")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.allScore == allScore);
                }
                if (fuhao == "<>")
                {
                    pOOrderList = pOOrderList.FindAll(t => t.allScore == allScore);
                }
            }
            //var getAllPONos = pOOrderList.Aggregate("", (current, m) => current + ("'" + m.PONo + "',")).Trim(',');
            //lblVisAllPONO.Text = getAllPONos;

            Hashtable ht  = new Hashtable();
            decimal   jlr = 0;
            decimal   sumgoodSellTotal = 0;
            decimal   sumTrueLiRun     = 0;
            decimal   sumSellFPTotal   = 0;
            decimal   sumSumPOTotal    = 0;
            decimal   sumInvoiceTotal  = 0;

            foreach (var m in pOOrderList)
            {
                if (!ht.ContainsKey(m.PONo))
                {
                    jlr += m.maoliTotal;
                    sumgoodSellTotal += m.goodSellTotal;
                    sumTrueLiRun     += m.TrueLiRun;
                    sumSellFPTotal   += m.SellFPTotal;
                    sumSumPOTotal    += m.SumPOTotal;
                    sumInvoiceTotal  += m.InvoiceTotal;
                    ht.Add(m.PONo, null);
                }
            }

            lblJLR.Text = string.Format("{0:n6}", jlr);
            lblXSE.Text = string.Format("{0:n6}", sumgoodSellTotal);
            var trueLiRun = sumTrueLiRun;

            lblSJLR.Text = string.Format("{0:n6}", trueLiRun);

            lblFP.Text = string.Format("{0:n6}", sumSellFPTotal);
            // 项目总额:XXX
            decimal allPoTotal = sumSumPOTotal;

            lblAllPoTotal.Text = string.Format("{0:n6}", allPoTotal);
            //项目总利润率:YYY = 项目净利合计/XXX
            lblAllLRLv.Text = "0";
            if (allPoTotal > 0)
            {
                lblAllLRLv.Text = string.Format("{0:f2}", (jlr / allPoTotal * 100));
            }
            // 实际总利润率:ZZZ=  实际利润合计/XXX
            lblAllTrunLv.Text = "0";
            if (allPoTotal > 0)
            {
                lblAllTrunLv.Text = string.Format("{0:f2}", (trueLiRun / allPoTotal * 100));
            }
            //项目到款总额:TTT= 实到帐的合计
            var allDaoKuan = sumInvoiceTotal;

            lblAllDaoKuan.Text = string.Format("{0:n6}", allDaoKuan);
            //到款率: VVV=TTT/XXX
            lblAllDaoKuanLv.Text = "0";
            if (allPoTotal > 0)
            {
                lblAllDaoKuanLv.Text = string.Format("{0:f2}", (allDaoKuan / allPoTotal * 100));
            }

            //开票率:LLL= 发票总额合计 /XXX
            var faPiaoTotal = sumSellFPTotal;// pOOrderList.Sum(t => t.SellFPTotal);

            lblAllFaPiaoLv.Text = "0";
            if (allPoTotal > 0)
            {
                lblAllFaPiaoLv.Text = string.Format("{0:f2}", (faPiaoTotal / allPoTotal * 100));
            }
            var sumAllScore = pOOrderList.Sum(t => t.allScore);
            var sumMyValue  = pOOrderList.Sum(t => t.MyValue);
            var count       = pOOrderList.Count(t => t.DisDate != null);

            lblAllScore.Text    = string.Format("{0:f2}", sumAllScore);
            lblFanKuiScore.Text = string.Format("{0:f2}", sumMyValue);

            if (count == 0)
            {
                lblAvgScore.Text   = string.Format("{0:f2}", 0);
                lblAvgFKscore.Text = string.Format("{0:f2}", 0);
            }
            else
            {
                lblAvgScore.Text   = string.Format("{0:f2}", sumAllScore / count);
                lblAvgFKscore.Text = string.Format("{0:f2}", sumMyValue / count);
            }


            AspNetPager1.RecordCount = pOOrderList.Count;
            this.gvMain.PageIndex    = AspNetPager1.CurrentPageIndex - 1;

            this.gvMain.DataSource = pOOrderList;
            this.gvMain.DataBind();

            //pager.TotalCount = pOOrderList.Count;
            //PagerControl page= gvMain.BottomPagerRow.Cells[0].FindControl("myPage") as PagerControl;
            //page.TotalCount = pOOrderList.Count;
            //page.BindData();
            // AspNetPager1.CustomInfoHTML = "第<font color='red'><b>%currentPageIndex%</b></font>页,共%PageCount%页,每页显示%PageSize%条记录";
        }
Beispiel #21
0
        private void Show(bool isPrint = false)
        {
            string sql = " 1=1 ";

            if (txtBusFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtBusFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('公交费发票号码 格式错误!');</script>");
                return;
            }

            if (txtRepastFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtRepastFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('餐饮发票号码 格式错误!');</script>");
                return;
            }
            if (txtHotelFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtHotelFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('住宿发票号码 格式错误!');</script>");
                return;
            }
            if (txtOilFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtOilFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('汽油发票号码 格式错误!');</script>");
                return;
            }
            if (txtGuoBeginFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtGuoBeginFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('过路费发票号码 格式错误!');</script>");
                return;
            }
            if (txtPostFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtPostFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('邮寄发票号码 格式错误!');</script>");
                return;
            }
            if (txtOtherFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtOtherFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('其它费用发票号码 格式错误!');</script>");
                return;
            }
            if (txtCaiFPNO.Text.Trim() != "" && CommHelp.VerifesToNum_NoString(txtCaiFPNO.Text.Trim()) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('小额采购发票号码 格式错误!');</script>");
                return;
            }


            if (txtBusFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and BusFPNO like '%{0}%'", txtBusFPNO.Text.Trim());
            }

            if (txtRepastFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and RepastFPNO like '%{0}%'", txtRepastFPNO.Text.Trim());
            }
            if (txtHotelFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and HotelFPNO like '%{0}%'", txtHotelFPNO.Text.Trim());
            }
            if (txtOilFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and OilFPNO like '%{0}%'", txtOilFPNO.Text);
            }
            if (txtGuoBeginFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and GuoBeginFPNO like '%{0}%'", txtGuoBeginFPNO.Text.Trim());
            }
            if (txtPostFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and PostFPNO like '%{0}%'", txtPostFPNO.Text.Trim());
            }
            if (txtOtherFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and OtherFPNO like '%{0}%'", txtOtherFPNO.Text.Trim());
            }
            if (txtCaiFPNO.Text.Trim() != "")
            {
                sql += string.Format(" and CaiFPNO like '%{0}%'", txtCaiFPNO.Text.Trim());
            }


            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Tb_DispatchList.CreateTime>='{0} 00:00:00'", txtFrom.Text);
            }

            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Tb_DispatchList.CreateTime<='{0} 23:59:59'", txtTo.Text);
            }

            if (txtGuestName.Text.Trim() != "")
            {
                sql += string.Format(" and Tb_DispatchList.GuestName like '%{0}%'", txtGuestName.Text.Trim());
            }
            if (txtPOName.Text.Trim() != "")
            {
                sql += string.Format(" and Tb_DispatchList.POName like '%{0}%'", txtPOName.Text.Trim());
            }
            if (txtPONO.Text.Trim() != "")
            {
                if (CheckPoNO(txtPONO.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and Tb_DispatchList.PONo like '%{0}%'", txtPONO.Text.Trim());
            }
            if (ddlFuHao.Text != "-1" && !string.IsNullOrEmpty(txtTotal.Text))
            {
                if (CommHelp.VerifesToNum(txtTotal.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('报销金额 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and ISNULL(BusTotal,0)+ISNULL(RepastTotal,0)+ISNULL(HotelTotal,0)+ISNULL(OilTotal,0)+ISNULL(GuoTotal,0)+ISNULL(PostTotal,0)+ISNULL(Tb_DispatchList.PoTotal,0)+ISNULL(OtherTotal,0) {0}{1}", ddlFuHao.Text, txtTotal.Text);
            }
            if (txtProNo.Text.Trim() != "")
            {
                if (CheckProNo(txtProNo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and Tb_DispatchList.CardNo like '%{0}%'", txtProNo.Text.Trim());
            }
            if (ddlFundType.Text != "-1")
            {
                if (ddlFundType.Text == "0")//公交费
                {
                    sql += string.Format(" and BusTotal is not null and BusTotal>0", ddlFundType.Text);
                }
                else if (ddlFundType.Text == "1")//餐饮费
                {
                    sql += string.Format(" and RepastTotal is not null and RepastTotal>0", ddlFundType.Text);
                }
                else if (ddlFundType.Text == "2")//住宿费
                {
                    sql += string.Format(" and HotelTotal is not null and HotelTotal>0", ddlFundType.Text);
                }
                else if (ddlFundType.Text == "3")//汽油补贴
                {
                    sql += string.Format(" and OilTotal is not null and OilTotal>0", ddlFundType.Text);
                }
                else if (ddlFundType.Text == "4")//过路费
                {
                    sql += string.Format(" and GuoTotal is not null and GuoTotal>0", ddlFundType.Text);
                }
                else if (ddlFundType.Text == "5")//邮寄费
                {
                    sql += string.Format(" and PostTotal is not null and PostTotal>0", ddlFundType.Text);
                }
                else if (ddlFundType.Text == "6")//小额采购
                {
                    sql += string.Format(" and Tb_DispatchList.PoTotal is not null and Tb_DispatchList.PoTotal>0", ddlFundType.Text);
                }
                else if (ddlFundType.Text == "7")//其他费用
                {
                    sql += string.Format(" and OtherTotal is not null and OtherTotal>0", ddlFundType.Text);
                }
            }
            if (ddlCompany.Text != "-1")
            {
                sql += string.Format(" and TB_Company.ComCode='{0}'", ddlCompany.Text.Split(',')[2]);
            }

            if (ddlUser.Text != "-1")
            {
                sql += string.Format(" and AE='{0}'", ddlUser.SelectedItem.Text);
            }
            if (ddlState.Text != "全部")
            {
                sql += string.Format(" and Tb_DispatchList.state='{0}'", ddlState.Text);
            }
            if (!string.IsNullOrEmpty(txtKeyWords.Text))
            {
                sql += string.Format(@" and ([BusFromAddress] like '%{0}%'
or [BusFromAddress] like '%{0}%' or [BusToAddress] like '%{0}%' or  CONVERT(varchar(100), BusFromTime, 120) like '%{0}%' or CONVERT(varchar(100), BusToTime, 120) like '%{0}%'
or [RepastAddress] like '%{0}%' or [RepastTotal] like '%{0}%' or [RepastPerNum] like '%{0}%' or [RepastPers] like '%{0}%'
or [HotelAddress] like '%{0}%' or [HotelName] like '%{0}%' or [OilFromAddress] like '%{0}%' or [OilToAddress] like '%{0}%'
or [OilLiCheng] like '%{0}%' or [GuoBeginAddress] like '%{0}%' or [GuoToAddress] like '%{0}%' or [PostFromAddress] like '%{0}%'
or [PostToAddress] like '%{0}%' or [PoContext] like '%{0}%' or [OtherContext] like '%{0}%' or [BusRemark] like '%{0}%'
or [RepastRemark] like '%{0}%' or [HotelRemark] like '%{0}%' or [OilRemark] like '%{0}%' or [GuoRemark] like '%{0}%'
or [PostRemark] like '%{0}%' or Tb_DispatchList.[PoRemark] like '%{0}%' or [OtherRemark] like '%{0}%' or [PostNo] like '%{0}%'
or [PostCompany] like '%{0}%' or [PostContext] like '%{0}%' or [PostToPer] like '%{0}%' or [Post_No] like '%{0}%')", txtKeyWords.Text);
            }

            if (ddlModel.Text != "全部")
            {
                sql += string.Format(" and Model='{0}'", ddlModel.Text);
            }
            //增加查询条件
            if (ddlGuestTypeList.SelectedValue != "全部")
            {
                sql += string.Format(" and GuestType='{0}'", ddlGuestTypeList.SelectedValue);
            }

            if (ddlGuestProList.SelectedValue != "-2")
            {
                sql += string.Format(" and GuestPro={0}", ddlGuestProList.SelectedValue);
            }

            if (ddlClose.Text != "-1")
            {
                sql += string.Format(" and CG_POOrder.IsClose={0} ", ddlClose.Text);
            }
            if (ddlIsSelect.Text != "-1")
            {
                sql += string.Format(" and CG_POOrder.IsSelected={0} ", ddlIsSelect.Text);
            }
            if (ddlJieIsSelected.Text != "-1")
            {
                sql += string.Format(" and CG_POOrder.JieIsSelected={0} ", ddlJieIsSelected.Text);
            }
            if (ddlIsSpecial.Text != "-1")
            {
                sql += string.Format(" and CG_POOrder.IsSpecial={0} ", ddlIsSpecial.Text);
            }

            if (!string.IsNullOrEmpty(txtPOSTNO.Text.Trim()))
            {
                sql += string.Format(" and PostNo LIKE '%{0}%' ", txtPOSTNO.Text.Trim());
            }
            List <Tb_DispatchList> dispatchList = this.dispatchSer.GetListArrayReport(sql);

            if (isPrint)
            {
                Tb_DispatchList sumTotal = new Tb_DispatchList();
                sumTotal.Total = dispatchList.Sum(t => t.Total);
                dispatchList.Add(sumTotal);
            }
            lblTotal.Text = dispatchList.Sum(t => t.Total).ToString();

            AspNetPager1.RecordCount = dispatchList.Count;
            this.gvList.PageIndex    = AspNetPager1.CurrentPageIndex - 1;
            this.gvList.DataSource   = dispatchList;
            this.gvList.DataBind();
        }
Beispiel #22
0
        private void Show()
        {
            string sql = "1=1";

            if (!string.IsNullOrEmpty(txtContract_No.Text.Trim()))
            {
                sql += string.Format(" and Contract_No like '%{0}%'", txtContract_No.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtContract_Unit.Text.Trim()))
            {
                sql += string.Format(" and Contract_Unit like '%{0}%'", txtContract_Unit.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtContract_Name.Text.Trim()))
            {
                sql += string.Format(" and Contract_Name like '%{0}%'", txtContract_Name.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtContract_Summary.Text.Trim()))
            {
                sql += string.Format(" and Contract_Summary like '%{0}%'", txtContract_Summary.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtPONo.Text.Trim()))
            {
                if (CheckPoNO(txtPONo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and PONo like '%{0}%'", txtPONo.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtContract_ProNo.Text))
            {
                sql += string.Format(" and Contract_ProNo like '%{0}%'", txtContract_ProNo.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtContract_Remark.Text))
            {
                sql += string.Format(" and Contract_Remark like '%{0}%'", txtContract_Remark.Text.Trim());
            }
            if (ddlContract_Type.Text != "-1")
            {
                sql += string.Format(" and Contract_Type={0}", ddlContract_Type.Text);
            }
            if (ddlContract_Use.Text != "-1")
            {
                sql += string.Format(" and Contract_Use='{0}'", ddlContract_Use.Text);
            }
            if (!string.IsNullOrEmpty(txtContract_Total.Text))
            {
                if (CommHelp.VerifesToNum(txtContract_Total.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('总金额 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Contract_Total{0}{1}", ddlContract_Total.Text, txtContract_Total.Text);
            }
            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('签订时间 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Contract_Date>='{0} 00:00:00'", txtFrom.Text);
            }

            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('签订时间 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Contract_Date<='{0} 23:59:59'", txtTo.Text);
            }

            if (!string.IsNullOrEmpty(txtContract_PageCount.Text))
            {
                if (CommHelp.VerifesToNum(txtContract_PageCount.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('合同总页数 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Contract_PageCount{0}{1}", ddlContract_PageCount.Text, txtContract_PageCount.Text);
            }
            if (!string.IsNullOrEmpty(txtContract_AllCount.Text))
            {
                if (CommHelp.VerifesToNum(txtContract_AllCount.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('合同总份数 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Contract_AllCount{0}{1}", ddlContract_AllCount.Text, txtContract_AllCount.Text);
            }
            if (!string.IsNullOrEmpty(txtContract_BCount.Text))
            {
                if (CommHelp.VerifesToNum(txtContract_BCount.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('己方份数 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Contract_BCount{0}{1}", ddlContract_BCount.Text, txtContract_BCount.Text);
            }
            if (ddlAE.Text != "全部")
            {
                sql += string.Format(" and AE='{0}'", ddlAE.Text);
            }
            if (ddlContract_Brokerage.Text != "全部")
            {
                sql += string.Format(" and Contract_Brokerage='{0}'", ddlContract_Brokerage.Text);
            }
            if (ddlContract_IsSign.Text != "-1")
            {
                sql += string.Format(" and Contract_IsSign={0}", ddlContract_IsSign.Text);
            }
            if (ddlContract_Local.Text != "-1")
            {
                sql += string.Format(" and Contract_Local='{0}'", ddlContract_Local.Text);
            }
            if (ddlContract_Year.Text != "-1")
            {
                sql += string.Format(" and Contract_Year={0}", ddlContract_Year.Text);
            }
            if (ddlContract_Month.Text != "-1")
            {
                sql += string.Format(" and Contract_Month={0}", ddlContract_Month.Text);
            }
            if (ddlContract_IsRequire.Text != "-1")
            {
                sql += string.Format(" and Contract_IsRequire={0}", ddlContract_IsRequire.Text);
            }
            if (ddlModel.Text != "全部")
            {
                sql += string.Format(" and EXISTS (select ID from CG_POOrder where Model='{0}' AND PONO=Contract.PONO) ", ddlModel.Text);
            }

            List <Contract> caiList = this.contractSer.GetListArray(sql);

            lblTotal.Text            = caiList.Sum(t => t.Contract_Total).ToString();
            AspNetPager1.RecordCount = caiList.Count;
            this.gvList.PageIndex    = AspNetPager1.CurrentPageIndex - 1;
            this.gvList.DataSource   = caiList;
            this.gvList.DataBind();
        }
Beispiel #23
0
        public void Show()
        {
            string sql = " where Status='通过' ";

            string sql_1 = "where 1=1 ";

            txtGuestName.Text = txtGuestName.Text.Trim();
            txtInvoiceNo.Text = txtInvoiceNo.Text.Trim();
            if (txtGuestName.Text.Trim() != "")
            {
                sql_1 += string.Format(" and Sell_OrderFP.GuestNAME like '%{0}%'", txtGuestName.Text.Trim());
            }
            if (txtInvoiceNo.Text != "")
            {
                sql_1 += string.Format(" and FPNo like '%{0}%'", txtInvoiceNo.Text);
            }

            if (cbZhengShu.Checked == false && txtInvoice.Text != "")
            {
                if (CommHelp.VerifesToNum(txtInvoice.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票金额 格式错误!');</script>");
                    return;
                }
                if (ddlInvTotal.Text == "=")
                {
                    sql_1 += string.Format(" and Sell_OrderFP.Total in ({0},{1})", Convert.ToDecimal(txtInvoice.Text), -Convert.ToDecimal(txtInvoice.Text));
                }
                else
                {
                    sql_1 += string.Format(" and Sell_OrderFP.Total {0} {1}", ddlInvTotal.Text, txtInvoice.Text);
                }
            }
            if (cbZhengShu.Checked && txtInvoice.Text != "")
            {
                if (CommHelp.VerifesToNum(txtInvoice.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票金额 格式错误!');</script>");
                    return;
                }
                if (ddlInvTotal.Text == "=")
                {
                    sql_1 += string.Format(" and Sell_OrderFP.Total ={0} ", txtInvoice.Text);
                }
                else
                {
                    sql_1 += string.Format(" and Sell_OrderFP.Total {0} {1}", ddlInvTotal.Text, txtInvoice.Text);
                }
            }

            string param = "Status='通过'";

            if (ddlClose.Text != "-1" || ddlIsSelect.Text != "-1" || ddlHanShui.Text != "-1" || cbIsSpecial.Checked || cbJiaoFu.Checked || ddlUser.Text != "-1" ||
                txtPOFrom.Text != "" || txtPOTo.Text != "" || txtPONo.Text != "" || ddlCompany.Text != "-1" || ddlModel.Text != "全部")
            {
                if (ddlClose.Text != "-1")
                {
                    param += string.Format(" and IsClose={0}", ddlClose.Text);
                }
                if (ddlIsSelect.Text != "-1")
                {
                    param += string.Format(" and IsSelected={0}", ddlIsSelect.Text);
                }
                if (ddlHanShui.Text != "-1")
                {
                    param += string.Format(" and IsPoFax={0}", ddlHanShui.Text);
                }
                if (cbIsSpecial.Checked)
                {
                    param += string.Format(" and IsSpecial=0 ");
                }

                if (cbJiaoFu.Checked)
                {
                    param += string.Format(" and POStatue2='已交付' ");
                }
                if (ddlModel.Text != "全部")
                {
                    param += string.Format(" and Model='{0}'", ddlModel.Text);
                }

                if (txtPOFrom.Text != "")
                {
                    if (CommHelp.VerifesToDateTime(txtPOFrom.Text) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目日期 格式错误!');</script>");
                        return;
                    }
                    param += string.Format(" and PODate>='{0} 00:00:00'", txtPOFrom.Text);
                }

                if (txtPOTo.Text != "")
                {
                    if (CommHelp.VerifesToDateTime(txtPOTo.Text) == false)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目日期 格式错误!');</script>");
                        return;
                    }
                    param += string.Format(" and PODate<='{0} 23:59:59'", txtPOTo.Text);
                }
                if (ddlUser.Text != "-1")
                {
                    param += string.Format(" and AppName={0} ", ddlUser.Text);
                }
                if (ddlCompany.Text != "-1")
                {
                    string where = string.Format(" CompanyCode='{0}'", ddlCompany.Text.Split(',')[2]);
                    param       += string.Format(" and AppName IN(select id from tb_User where {0}) ", where);
                }
                if (txtPONo.Text.Trim() != "")
                {
                    if (CheckPoNO(txtPONo.Text) == false)
                    {
                        return;
                    }
                    param += string.Format(" and PONO like '%{0}%' ", txtPONo.Text.Trim());
                }
                sql += string.Format(" and exists(select id from CG_POOrder where {0} and  CG_POOrder.PONO=Sell_OrderFP.PONO  and ifzhui=0)", param);
            }
            string diffDate = "";

            if (ddlTime.Text == "0")
            {
                diffDate = " DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())<=30 ";
            }
            if (ddlTime.Text == "1")
            {
                diffDate = " DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())>30 and DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())<=60";
            }
            if (ddlTime.Text == "2")
            {
                diffDate = " DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())>60 and DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())<=90";
            }
            if (ddlTime.Text == "3")
            {
                diffDate = " DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())>90 and DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())<=120";
            }
            if (ddlTime.Text == "4")
            {
                diffDate = " DATEDIFF(DAY,MAX(MaxRuTime),GETDATE())>120";
            }
            if (string.IsNullOrEmpty(lblQuanXian.Text))
            {
                gvList.Columns[6].Visible = true;
            }
            else
            {
                gvList.Columns[6].Visible = false;
            }
            if (!string.IsNullOrEmpty(txtFrom.Text))
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票日期 格式错误!');</script>");
                    return;
                }
            }
            if (!string.IsNullOrEmpty(txtTo.Text))
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票日期 格式错误!');</script>");
                    return;
                }
            }

            List <AccountReport> invoiceList = new List <AccountReport>();

            if (ddlCompare.Text == "2")
            {
                invoiceList = this.invoiceSer.GetAllAccountReports(txtGuestName.Text, txtInvoiceNo.Text, txtInvoice.Text,
                                                                   ddlInvTotal.Text, txtFrom.Text, txtTo.Text, sql, "1", cbInvoTotalToge.Checked, ddlIsorder.Text, cbSameFP.Checked, diffDate, cbZhengShu.Checked);

                if (ddlCompareList.Text == "-1")
                {
                    invoiceList.AddRange(this.invoiceSer.GetAllAccountReports(txtGuestName.Text, txtInvoiceNo.Text, txtInvoice.Text,
                                                                              ddlInvTotal.Text, txtFrom.Text, txtTo.Text, sql, "0", cbInvoTotalToge.Checked, ddlIsorder.Text, cbSameFP.Checked, diffDate, cbZhengShu.Checked));
                }
            }
            else
            {
                invoiceList = this.invoiceSer.GetAllAccountReports(txtGuestName.Text, txtInvoiceNo.Text, txtInvoice.Text,
                                                                   ddlInvTotal.Text, txtFrom.Text, txtTo.Text, sql, ddlCompare.Text, cbInvoTotalToge.Checked, ddlIsorder.Text, cbSameFP.Checked, diffDate, cbZhengShu.Checked, ddlCompareList.Text);
            }

            //if (ddlCompare.Text == "1" || ddlCompare.Text == "2")
            //{

            //    if (ddlCompareList.Text == "0")
            //    {
            //        invoiceList = invoiceList.FindAll(accountReport => accountReport.All_InvoiceTotal != null);
            //        invoiceList = invoiceList.FindAll(accountReport => accountReport.All_OATotal == accountReport.All_InvoiceTotal
            //            && accountReport.All_AccountTotal < accountReport.All_InvoiceTotal);


            //        var invoiceList2=  invoiceList.FindAll(accountReport => accountReport.All_InvoiceTotal != null);

            //        invoiceList2 = invoiceList2.FindAll(accountReport => !(accountReport.All_OATotal < accountReport.All_InvoiceTotal
            //            && accountReport.All_AccountTotal == accountReport.All_InvoiceTotal));

            //        invoiceList2 = invoiceList2.FindAll(accountReport => !((accountReport.All_OATotal == accountReport.All_InvoiceTotal
            //           && accountReport.All_AccountTotal == accountReport.All_InvoiceTotal) || (accountReport.All_OATotal < accountReport.All_InvoiceTotal
            //               && accountReport.All_AccountTotal < accountReport.All_InvoiceTotal)));

            //        invoiceList2 = invoiceList2.FindAll(accountReport => !(accountReport.All_OATotal == accountReport.All_InvoiceTotal
            //           && accountReport.All_AccountTotal < accountReport.All_InvoiceTotal));

            //        invoiceList.AddRange(invoiceList2);
            //    }
            //}
            invoiceList = (from items in invoiceList orderby items.MaxDate descending select items).ToList();
            AspNetPager1.RecordCount = invoiceList.Count;
            this.gvList.PageIndex    = AspNetPager1.CurrentPageIndex - 1;

            int    pageIndex = gvList.PageIndex;
            string allFPNo   = "";
            string allPONOs  = "";

            for (int i = (pageIndex * 10); i < ((pageIndex + 1) * 10); i++)
            {
                if (i >= invoiceList.Count)
                {
                    break;
                }
                if (!string.IsNullOrEmpty(invoiceList[i].All_InvoiceNo))
                {
                    allFPNo  += "'" + invoiceList[i].All_InvoiceNo + "',";
                    allPONOs += "'" + invoiceList[i].All_PONO + "',";
                }
                if (!string.IsNullOrEmpty(invoiceList[i].OA_InvoiceNo) && string.IsNullOrEmpty(invoiceList[i].OA_GuestName))
                {
                    allFPNo += "'" + invoiceList[i].OA_InvoiceNo + "',";
                }
            }
            allFPNo = allFPNo.Trim(',');
            if (allFPNo != "")
            {
                string    ponos = string.Format("SELECT FPNO,PONO,GuestNAME from Sell_OrderFP where Status='通过'  and FPNO in ({0})GROUP BY FPNO,PONO,GuestNAME ", allFPNo);
                DataTable dt    = DBHelp.getDataTable(ponos);
                list = new List <BaseModel>();
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new BaseModel {
                        key = dr[0].ToString(), value = dr[1].ToString(), value1 = dr[2].ToString()
                    });
                }
            }
            lblSumTotal.Text = "";
            List <AccountReport> resultInvoiceList = new List <AccountReport>();

            resultInvoiceList = invoiceList.FindAll(t => t.All_WeiInvoiceTotal > 0);


            //int[] b = { 53, 575, 55, 78, 340, 9, 121, 338, 39, 15 };


            ViewState["result"] = resultInvoiceList;
            if (resultInvoiceList.Count <= 50)
            {
                Button1.Enabled = true;
            }
            else
            {
                Button1.Enabled = false;
            }
            lblSumTotal.Text       = "";
            this.gvList.DataSource = invoiceList;
            this.gvList.DataBind();


            decimal OA_InvoiceTotal      = 0;
            decimal Kingdee_InvoiceTotal = 0;

            Hashtable hs  = new Hashtable();
            Hashtable hs1 = new Hashtable();

            foreach (var m in invoiceList)
            {
                if (!hs.ContainsKey(m.Kingdee_Id))
                {
                    Kingdee_InvoiceTotal += m.Kingdee_InvoiceTotal ?? 0;
                    hs.Add(m.Kingdee_Id, null);
                }

                if (!hs1.ContainsKey(m.OA_FPId))
                {
                    OA_InvoiceTotal += m.OA_InvoiceTotal ?? 0;
                    hs1.Add(m.OA_FPId, null);
                }
            }
            lblAllTotal.Text = invoiceList.Sum(t => t.All_InvoiceTotal ?? 0).ToString();
            var All_OATotal = invoiceList.Sum(t => t.All_OATotal ?? 0);

            lblAllOATotal.Text = All_OATotal.ToString();
            var All_AccountTotal = invoiceList.Sum(t => t.All_AccountTotal ?? 0);

            lblAllKinDaoTotal.Text    = All_AccountTotal.ToString();
            lblAllFPTotal.Text        = invoiceList.Sum(t => t.All_InvoiceTotal ?? 0).ToString();
            lblALLDiffTotal.Text      = (All_OATotal - All_AccountTotal).ToString();
            lblWeiAllOATotal.Text     = invoiceList.Sum(t => t.All_WeiOATotal ?? 0).ToString();
            lblWeiAllKinDaoTotal.Text = invoiceList.Sum(t => t.All_WeiInvoiceTotal).ToString();

            lblOATotal.Text      = OA_InvoiceTotal.ToString();
            lblKingdeeTotal.Text = Kingdee_InvoiceTotal.ToString();
        }
Beispiel #24
0
        public bool FormCheck()
        {
            string strErr = "";

            if (this.txtProNo.Text.Trim().Length == 0)
            {
                strErr += "单据号不能为空!\\n";
            }
            if (this.txtOutTotal.Text.Trim().Length == 0)
            {
                strErr += "出账金额不能为空!\\n";
            }
            if (CommHelp.VerifesToNum(this.txtOutTotal.Text.Trim()) == false)
            {
                strErr += "出账金额格式错误!\\n";
            }
            if (strErr != "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }

            if (ddlOutType.Text == "支付单" || ddlOutType.Text == "预付款单" || ddlOutType.Text == "申请请款单" || ddlOutType.Text == "预期报销单")
            {
                if (string.IsNullOrEmpty(txtTotal.Text))
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", "请点击获取单据金额"));
                    return(false);
                }
                //当下拉框选择 预付款单和支付单 时,点击获取样金额 后,单据的抬头必须严格和收款人名称一(除了单据抬头是淘宝,本部门,本部门(含税),淘宝(含1.33税) ,
                //京东 ,京东商城 可以不一样) ,修改或添加 才能保存数据,否则提示预付款单和支付单 抬头必须一致
                if (ddlOutType.Text == "支付单" || ddlOutType.Text == "预付款单")
                {
                    //中文括号转为英文
                    string name = txtName.Text.Trim().Replace("(", "(").Replace(")", ")");
                    if (lblInPayeeName.Text.Replace("(", "(").Replace(")", ")") != name && (name != "淘宝" && name != "本部门" && name != "本部门(含税)" && name != "淘宝(含1.33税)" &&
                                                                                            name != "上海圆迈贸易有限公司"))
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", "预付款单和支付单 抬头必须一致"));
                        return(false);
                    }
                }
                decimal total = Convert.ToDecimal(txtTotal.Text);

                decimal outTotal = Convert.ToDecimal(txtOutTotal.Text);

                string sqlsumTotal = string.Format("select isnull(sum(OutTotal),0) from Out_BankFlow where ProNo='{0}' and  OutType='{1}'",
                                                   txtProNo.Text.Trim(), ddlOutType.Text);
                if (base.Request["Id"] != null)
                {
                    sqlsumTotal += " and id<>" + Request["Id"];
                }
                var sumTotal = Convert.ToDecimal(DBHelp.ExeScalar(sqlsumTotal));

                if (sumTotal + outTotal > total)
                {
                    strErr = "该单据号剩余金额" + (total - sumTotal) + " !\\n";
                }
                if (strErr != "")
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                    return(false);
                }
            }

            string sql = string.Format("select ISNULL(SUM(OutTotal),0) AS SUMOutTotal FROM Out_BankFlow  where ReferenceNumber='{0}'", lblReferenceNumber.Text);

            if (base.Request["Id"] != null)
            {
                sql += " and id<>" + Request["Id"];
            }
            string  mainSql   = string.Format("select TradeAmount from BankFlow where TransactionReferenceNumber='{0}'", lblReferenceNumber.Text);
            decimal lastTotal = System.Math.Abs(Convert.ToDecimal(DBHelp.ExeScalar(mainSql))) - Convert.ToDecimal(DBHelp.ExeScalar(sql));

            if (lastTotal < Convert.ToDecimal(txtOutTotal.Text))
            {
                strErr = string.Format("出账剩余总金额:{0},请重新填写", lastTotal);
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }
            if (txtProNo.Text != "")
            {
                txtProNo.Text = txtProNo.Text.Trim();
                if (CheckProNo(txtProNo.Text) == false)
                {
                    return(false);
                }
            }
            return(true);
        }
        private void Show()
        {
            if (ddlFPType.Items.Count >= 2)
            {
                ddlFPType.Items[ddlFPType.Items.Count - 2].Attributes.Add("style", "background-color: red");
            }
            string sql = " 1=1 ";

            if (txtPONo.Text.Trim() != "")
            {
                if (CheckPoNO(txtPONo.Text.Trim()) == false)
                {
                    return;
                }
                sql += string.Format(" and Sell_OrderFP.PONo like '%{0}%'", txtPONo.Text.Trim());
            }


            if (ttxPOName.Text.Trim() != "")
            {
                sql += string.Format(" and POName like '%{0}%'", ttxPOName.Text.Trim());
            }

            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and RuTime>='{0} 00:00:00'", txtFrom.Text);
            }

            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and RuTime<='{0} 23:59:59'", txtTo.Text);
            }


            if (ddlStatue.Text != "")
            {
                sql += string.Format(" and Status='{0}'", ddlStatue.Text);
            }
            else
            {
                sql += string.Format(" and Status<>'不通过'");
            }

            if (txtProNo.Text.Trim() != "")
            {
                if (CheckProNo(txtProNo.Text.Trim()) == false)
                {
                    return;
                }
                sql += string.Format(" and ProNo like '%{0}%'", txtProNo.Text.Trim());
            }

            if (txtGuestName.Text.Trim() != "")
            {
                sql += string.Format(" and GuestName  like '%{0}%'", txtGuestName.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtFPTotal.Text))
            {
                if (CommHelp.VerifesToNum(txtFPTotal.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票金额 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Total {0}{1}", ddlPOFaTotal.Text, txtFPTotal.Text);
            }
            if (!string.IsNullOrEmpty(txtOldFPTotal.Text))
            {
                if (CommHelp.VerifesToNum(txtOldFPTotal.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('原金额 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and TopTotal {0}{1}", ddlOldPOFaTotal.Text, txtOldFPTotal.Text);
            }
            if (txtOldFPNo.Text != "")
            {
                sql += string.Format(" and TopFPNo like '%{0}%'", txtOldFPNo.Text);
            }

            if (ddlIsSelect.Text != "-1" && ddlIsClose.Text != "-1" && ddlJieIsSelected.Text != "-1" && ddlIsSpecial.Text != "-1" && ddlModel.Text != "全部")
            {
                sql += string.Format(" and exists(select id from CG_POOrder where Status='通过' and IsClose={0} and IsSelected={1} and JieIsSelected={2} and IsSpecial={3} and model={4} and CG_POOrder.PONO=Sell_OrderFP.PONO ) ", ddlIsClose.Text, ddlIsSelect.Text, ddlJieIsSelected.Text,
                                     ddlIsSpecial.Text, ddlModel.Text);
            }
            else
            {
                if (ddlIsClose.Text != "-1")
                {
                    sql += string.Format(" and exists(select id from CG_POOrder where Status='通过' and IsClose={0} and CG_POOrder.PONO=Sell_OrderFP.PONO ) ", ddlIsClose.Text);
                }
                if (ddlIsSelect.Text != "-1")
                {
                    sql += string.Format("and exists(select id from CG_POOrder where Status='通过' and IsSelected={0} and CG_POOrder.PONO=Sell_OrderFP.PONO ) ", ddlIsSelect.Text);
                }
                if (ddlJieIsSelected.Text != "-1")
                {
                    sql += string.Format("and exists(select id from CG_POOrder where Status='通过' and JieIsSelected={0} and CG_POOrder.PONO=Sell_OrderFP.PONO ) ", ddlJieIsSelected.Text);
                }
                if (ddlIsSpecial.Text != "-1")
                {
                    sql += string.Format("and exists(select id from CG_POOrder where Status='通过' and IsSpecial={0} and CG_POOrder.PONO=Sell_OrderFP.PONO ) ", ddlIsSpecial.Text);
                }
                if (ddlModel.Text != "全部")
                {
                    sql += string.Format("and exists(select id from CG_POOrder where Status='通过' and model='{0}' and CG_POOrder.PONO=Sell_OrderFP.PONO ) ", ddlModel.Text);
                }
            }
            if (ddlUser.Text != "-1")
            {
                sql += string.Format(" and CreateUserId={0}", ddlUser.Text);
            }
            if (ddlCompany.Text != "-1")
            {
                string where = string.Format(" CompanyCode='{0}'", ddlCompany.Text.Split(',')[2]);
                sql         += string.Format(" and CreateUserId IN(select id from tb_User where {0})", where);
            }

            if (txtFPNo.Text.Trim() != "")
            {
                sql += string.Format(" and FPNo like '%{0}%'", txtFPNo.Text.Trim());
            }

            if (ddlType.Text == "0")
            {
                sql += string.Format(" and exists(select Sell_OrderFPBack.id from Sell_OrderFPBack where Status='通过' and FPNo=Sell_OrderFP.FPNo )");
            }
            if (ddlType.Text == "1")
            {
                sql += string.Format(" and not exists(select Sell_OrderFPBack.id from Sell_OrderFPBack where Status='通过' and FPNo=Sell_OrderFP.FPNo)");
            }

            if (ddlPOInvoiceState.Text == "1")//发票数<项目数
            {
                //sql += string.Format(" and exists(select PONO from POFP_View where PONO=Sell_OrderFP.PONO and SumPoTotal-TuiTotal>sumTotal )");
                sql += string.Format(" and  SumPoTotal-TuiTotal>sumTotal ");
            }
            else if (ddlPOInvoiceState.Text == "2")//发票数>项目数
            {
                //sql += string.Format(" and exists(select PONO from POFP_View where PONO=Sell_OrderFP.PONO and  SumPoTotal-TuiTotal<sumTotal )");
                sql += string.Format(" and SumPoTotal-TuiTotal<sumTotal ");
            }
            else if (ddlPOInvoiceState.Text == "3")//发票数=项目数
            {
                //sql += string.Format(" and exists(select PONO from POFP_View where PONO=Sell_OrderFP.PONO and  SumPoTotal-TuiTotal=sumTotal )");
                sql += string.Format(" and SumPoTotal-TuiTotal=sumTotal ");
            }

            if (ddlFPType.Text != "-1")
            {
                if (ddlFPType.SelectedItem.Text != "其他")
                {
                    sql += string.Format(" and FPNoStyle='{0}'", ddlFPType.SelectedItem.Text);
                }
                else
                {
                    sql += string.Format(" and FPNoStyle not in (select FpType from FpTypeBaseInfo) and FPNoStyle<>''");
                }
            }
            if (ddlGuestTypeList.SelectedValue != "全部" || ddlGuestProList.SelectedValue != "-2")
            {
                string where = "";
                if (ddlGuestTypeList.SelectedValue != "全部")
                {
                    where += string.Format(" and GuestType='{0}'", ddlGuestTypeList.SelectedValue);
                }
                if (ddlGuestProList.SelectedValue != "-2")
                {
                    where += string.Format(" and GuestPro={0}", ddlGuestProList.SelectedValue);
                }
                sql += string.Format("and exists(select id from CG_POOrder where Status='通过' {0} and CG_POOrder.PONO=Sell_OrderFP.PONO and IFZhui=0) ", where);
            }
            List <Sell_OrderFP> pOOrderList = this.POSer.GetListArray(sql);

            decimal allTotal   = 0;
            decimal allPoTotal = 0;

            System.Collections.Hashtable hs = new Hashtable();
            foreach (var m in pOOrderList)
            {
                allTotal += m.Total;

                if (!hs.Contains(m.PONo))
                {
                    allPoTotal += m.AllPoTotal;
                    hs.Add(m.PONo, null);
                }
            }
            lblAllTotal.Text         = allTotal.ToString();
            lblAllPoTotal.Text       = allPoTotal.ToString();
            AspNetPager1.RecordCount = pOOrderList.Count;
            this.gvMain.PageIndex    = AspNetPager1.CurrentPageIndex - 1;
            this.gvMain.DataSource   = pOOrderList;
            this.gvMain.DataBind();


            //if (pOOrderList.Count > 0)
            //{
            //    CG_POOrderService orderSer = new CG_POOrderService();
            //    var list = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", pOOrderList[0].PONo));
            //    if (list.Count > 0)
            //    {

            //        lblPOTotal.Text = "项目(" + pOOrderList[0].PONo+")---" + (list[0].POTotal - list[0].TuiTotal).ToString();
            //    }
            //    else
            //    {
            //        lblPOTotal.Text = "0";
            //    }


            //lblPOTotal.Text = "";
            //}
            //子单
            List <Sell_OrderFPs> orders = new List <Sell_OrderFPs>();

            gvList.DataSource = orders;
            gvList.DataBind();
        }
        private void AdvancePaymentShow()
        {
            string sql = "  CAI_POOrder.Status='通过' ";


            if (txtAdvancePaymentPoNo.Text.Trim() != "")
            {
                if (CheckPoNO(txtAdvancePaymentPoNo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and PONo like '%{0}%'", txtAdvancePaymentPoNo.Text.Trim());
            }

            if (txtAdvancePaymentPoName.Text.Trim() != "")
            {
                sql += string.Format(" and POName like '%{0}%'", txtAdvancePaymentPoName.Text.Trim());
            }
            if (txtAdvancePaymentProNo.Text.Trim() != "")
            {
                if (CheckProNo(txtAdvancePaymentProNo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and CAI_POOrder.ProNo like '%{0}%'", txtAdvancePaymentProNo.Text.Trim());
            }
            if (txtAdvancePaymentSupplierName.Text.Trim() != "")
            {
                if (cbAdvancePiPei.Checked == false)
                {
                    sql += string.Format(" and lastSupplier  like '%{0}%'", txtAdvancePaymentSupplierName.Text.Trim());
                }
                else
                {
                    sql += string.Format(" and lastSupplier ='{0}'", txtAdvancePaymentSupplierName.Text.Trim());
                }
            }

            if (cbNoKuCun.Checked)
            {
                sql += string.Format(" and lastSupplier<>'库存'");
            }
            if (txtAdvancePaymentGoodNo.Text != "")
            {
                sql += string.Format(" and GoodNo like '%{0}%'", txtAdvancePaymentGoodNo.Text);
            }
            if (txtNameOrTypeOrSpec1.Text != "" || txtNameOrTypeOrSpecTwo1.Text != "")
            {
                if (txtNameOrTypeOrSpec1.Text != "" && txtNameOrTypeOrSpecTwo1.Text != "")
                {
                    sql += string.Format(" and ((GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%') or (GoodTypeSmName like '%{1}%' or GoodName  like '%{1}%' or GoodSpec like '%{1}%'))",
                                         txtNameOrTypeOrSpec1.Text, txtNameOrTypeOrSpecTwo1.Text);
                }
                else if (txtNameOrTypeOrSpec1.Text != "" || txtNameOrTypeOrSpecTwo1.Text != "")
                {
                    var NameOrTypeOrSpec = "";
                    if (txtNameOrTypeOrSpec1.Text != "")
                    {
                        NameOrTypeOrSpec = txtNameOrTypeOrSpec1.Text;
                    }
                    if (txtNameOrTypeOrSpecTwo1.Text != "")
                    {
                        NameOrTypeOrSpec = txtNameOrTypeOrSpecTwo1.Text;
                    }

                    sql += string.Format(" and (GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%')",
                                         NameOrTypeOrSpec);
                }
            }
            if (txtCaiNum1.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtCaiNum1.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('采购数 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and Num{0} {1}", ddlCaiNum1.Text, txtCaiNum1.Text.Trim());
            }
            if (txtCaiPrice1.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtCaiPrice1.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('采购单价 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and lastPrice{0} {1}", ddlCaiPrice1.Text, txtCaiPrice1.Text.Trim());
            }
            if (ddlAdvanceTemp.Text != "-1")
            {
                sql += " and IsCAITemp=" + ddlAdvanceTemp.Text;
            }

            if (ddlAdvUserList.Text != "-1")
            {
                sql += string.Format(" and CAI_POOrder.AE='{0}'", ddlAdvUserList.SelectedItem.Text);
            }

            string poDateSql = "";

            if (txtYuPoDateFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtYuPoDateFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目时间 格式错误!');</script>");
                    return;
                }
                poDateSql += string.Format(" and PODate>='{0} 00:00:00'", txtYuPoDateFrom.Text);
            }

            if (txtYuPoDateTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtYuPoDateTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目时间 格式错误!');</script>");
                    return;
                }
                poDateSql += string.Format(" and PODate<='{0} 23:59:59'", txtYuPoDateTo.Text);
            }

            if (!string.IsNullOrEmpty(poDateSql))
            {
                sql += string.Format(@" and (EXISTS (select ID from CG_POOrder where CG_POOrder.PONO=CAI_POOrder.PONO and IFZhui=0 {0}) or (1=1 {0}))", poDateSql);
            }

            //去除不必要的
            //model.IfRuKu || (model.GoodNum * model.GoodPrice - model.SupplierInvoiceTotal) <= 0

            List <SupplierToInvoiceView> pOOrderList = supplierToInvoiceSer.GetSupplierAdvancePaymentList(sql);

            if (cbAdvanceGuolv.Checked)
            {
                pOOrderList = pOOrderList.FindAll(t => t.IsShow);
            }
            AspNetPager2.RecordCount         = pOOrderList.Count;
            this.gvAdvancePayment.PageIndex  = AspNetPager2.CurrentPageIndex - 1;
            this.gvAdvancePayment.DataSource = pOOrderList;
            this.gvAdvancePayment.DataBind();
            lblYuTotal.Text               = YuTotal.ToString();
            lblYu_ShengYuTotal.Text       = Yu_ResultTotal.ToString();
            lblYu_ShengyuzhijiaTotal.Text = Yu_ShengYuZhiJia.ToString();
        }
Beispiel #27
0
        public bool FormCheck()
        {
            string strErr = "";


            if (this.txtPONo.Text.Trim().Length == 0)
            {
                strErr += "项目编号不能为空!\\n";
            }
            //if (this.txtGuestName.Text.Trim().Length == 0)
            //{
            //    strErr += "客户名称不能为空!\\n";
            //}
            if (this.txtSalesUnit.Text.Trim().Length == 0)
            {
                strErr += "采购单位不能为空!\\n";
            }
            if (string.IsNullOrEmpty(txtName.Text))
            {
                strErr += "签呈单名称不能为空!\\n";
            }
            if (this.txtSummary.Text.Trim().Length == 0)
            {
                strErr += "签呈单摘要不能为空!\\n";
            }
            if (CommHelp.VerifesToNum(txtTotal.Text) == false)
            {
                strErr += "总金额格式错误!\\n";
            }
            if (CommHelp.VerifesToDateTime(txtSignDate.Text) == false)
            {
                strErr += "签订起始日期时间格式错误!\\n";
            }
            if (CommHelp.VerifesToNum(txtSumPages.Text) == false)
            {
                strErr += "签呈单总页数格式错误!\\n";
            }

            if (CommHelp.VerifesToNum(txtSumCount.Text) == false)
            {
                strErr += "签呈单总份数格式错误!\\n";
            }
            if (CommHelp.VerifesToNum(txtBCount.Text) == false)
            {
                strErr += "己方份数格式错误!\\n";
            }

            //if (cbIsRequire.Checked == false)
            //{
            //    if (this.txtPONo.Text.Trim().Length == 0)
            //    {
            //        strErr += "项目编号不能为空!\\n";
            //    }
            //    if (this.txtAE.Text.Trim().Length == 0)
            //    {
            //        strErr += "AE不能为空!\\n";
            //    }
            //}

            if (strErr != "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format("<script>alert('{0}');</script>", strErr));
                return(false);
            }

            return(true);
        }
        private void Show()
        {
            //if(txtSupplier.Text=="")
            //{
            //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择供应商');</script>");
            //    return ;
            //}
            string sql = " 1=1 ";

            if (txtPONo.Text.Trim() != "")
            {
                if (CheckPoNO(txtPONo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and PONo like '%{0}%'", txtPONo.Text.Trim());
            }


            if (ttxPOName.Text.Trim() != "")
            {
                sql += string.Format(" and POName like '%{0}%'", ttxPOName.Text.Trim());
            }

            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('入库时间 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and RuTime>='{0} 00:00:00'", txtFrom.Text);
            }

            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('入库时间 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and RuTime<='{0} 23:59:59'", txtTo.Text);
            }

            string poDateSql = "";

            if (txtPoDateFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtPoDateFrom.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目时间 格式错误!');</script>");
                    return;
                }
                poDateSql += string.Format(" and PODate>='{0} 00:00:00'", txtPoDateFrom.Text);
            }

            if (txtPoDateTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtPoDateTo.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目时间 格式错误!');</script>");
                    return;
                }
                poDateSql += string.Format(" and PODate<='{0} 23:59:59'", txtPoDateTo.Text);
            }

            if (!string.IsNullOrEmpty(poDateSql))
            {
                sql += string.Format(@" and (EXISTS (select ID from CG_POOrder where CG_POOrder.PONO=CAI_OrderInHouse.PONO and IFZhui=0 
{0}) or EXISTS (select ID from CAI_POOrder where CAI_POOrder.PONO = CAI_OrderInHouse.PONO and BusType = 1 {0}))", poDateSql);
            }

            if (ddlStatue.Text != "")
            {
                sql += string.Format(" and CAI_OrderInHouse.Status='{0}'", ddlStatue.Text);
            }
            else
            {
                sql += string.Format(" and CAI_OrderInHouse.Status<>'不通过'");
            }

            if (txtProNo.Text.Trim() != "")
            {
                if (CheckProNo(txtProNo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and CAI_OrderInHouse.ProNo like '%{0}%'", txtProNo.Text.Trim());
            }


            if (txtChcekProNo.Text.Trim() != "")
            {
                if (CheckProNo(txtChcekProNo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and ChcekProNo like '%{0}%'", txtChcekProNo.Text.Trim());
            }

            if (txtSupplier.Text.Trim() != "")
            {
                if (cbPiPei.Checked == false)
                {
                    sql += string.Format(" and Supplier  like '%{0}%'", txtSupplier.Text.Trim());
                }
                else
                {
                    sql += string.Format(" and Supplier ='{0}'", txtSupplier.Text.Trim());
                }
            }


            if (ddlHouse.Text != "0")
            {
                sql += string.Format(" and HouseID={0}", ddlHouse.Text);
            }

            if (txtGoodNo.Text != "")
            {
                sql += string.Format(" and GoodNo like '%{0}%'", txtGoodNo.Text);
            }
            if (txtNameOrTypeOrSpec.Text != "" || txtNameOrTypeOrSpecTwo.Text != "")
            {
                if (txtNameOrTypeOrSpec.Text != "" && txtNameOrTypeOrSpecTwo.Text != "")
                {
                    sql += string.Format(" and ((GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%') or (GoodTypeSmName like '%{1}%' or GoodName  like '%{1}%' or GoodSpec like '%{1}%'))",
                                         txtNameOrTypeOrSpec.Text, txtNameOrTypeOrSpecTwo.Text);
                }
                else if (txtNameOrTypeOrSpec.Text != "" || txtNameOrTypeOrSpecTwo.Text != "")
                {
                    var NameOrTypeOrSpec = "";
                    if (txtNameOrTypeOrSpec.Text != "")
                    {
                        NameOrTypeOrSpec = txtNameOrTypeOrSpec.Text;
                    }
                    if (txtNameOrTypeOrSpecTwo.Text != "")
                    {
                        NameOrTypeOrSpec = txtNameOrTypeOrSpecTwo.Text;
                    }

                    sql += string.Format(" and (GoodTypeSmName like '%{0}%' or GoodName  like '%{0}%' or GoodSpec like '%{0}%')",
                                         NameOrTypeOrSpec);
                }
            }
            if (txtCaiNum.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtCaiNum.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('入库数 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and GoodNum{0} {1}", ddlCaiNum.Text, txtCaiNum.Text.Trim());
            }
            if (txtCaiPrice.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtCaiPrice.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('采购单价 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and GoodPrice{0} {1}", ddlCaiPrice.Text, txtCaiPrice.Text.Trim());
            }
            if (ddlTemp.Text != "-1")
            {
                sql += " and IsTemp=" + ddlTemp.Text;
            }

            if (ddlUser.Text != "-1")
            {
                sql += string.Format(" and EXISTS (select ID from CG_POOrder where CG_POOrder.PONO=CAI_OrderInHouse.PONO and AE='{0}')", ddlUser.SelectedItem.Text);
            }


            List <SupplierToInvoiceView> pOOrderList = supplierToInvoiceSer.GetListArray_New(sql);

            //过滤库存,库存的信息不要显示出来
            pOOrderList = pOOrderList.FindAll(t => t.GuestName != "库存");

            if (cbGuolv.Checked)
            {
                pOOrderList = pOOrderList.FindAll(t => t.IsShow);

                //pOOrderList = pOOrderList.FindAll(t => t.LastTotal != t.ResultTotal);
            }
            AspNetPager1.RecordCount = pOOrderList.Count;

            var temp = pOOrderList.Sum(t => t.ResultTotal);

            this.gvMain.PageIndex  = AspNetPager1.CurrentPageIndex - 1;
            this.gvMain.DataSource = pOOrderList;
            this.gvMain.DataBind();

            lblTotalZhi.Text           = TotalZhi.ToString();
            lblShengYuTotal.Text       = ResultTotal.ToString();
            lblShengyuzhijiaTotal.Text = ShengYuZhiJia.ToString();
        }
Beispiel #29
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtNum.Text)&&CommHelp.VerifesToNum(txtNum.Text)==false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('数量 格式有误!');</script>");
                return;
            }
            if (!string.IsNullOrEmpty(txtOtherCost.Text) && CommHelp.VerifesToNum(txtOtherCost.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('管理费 格式有误!');</script>");
                return;
            }
            if (!string.IsNullOrEmpty(txtSellPrice.Text) && CommHelp.VerifesToNum(txtSellPrice.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('销售单价 格式有误!');</script>");
                return;
            }
            if (!string.IsNullOrEmpty(txtCostPrice.Text) && CommHelp.VerifesToNum(txtCostPrice.Text) == false)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('成本单价 格式有误!');</script>");
                return;
            }

            if (txtToTime.Text != "")
            {
                try
                {
                    Convert.ToDateTime(txtToTime.Text);
                }
                catch (Exception)
                {
                    
                      base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('到帐日期格式有误!');</script>");
                   return;
                }
            }
            if (CommHelp.GetByteLen(lblModel.Text) > 20 * 2)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('型号长度不能超过20个汉字符,请修正!');</script>");
                return;
            }
            if (CommHelp.GetByteLen(txtDetailRemark.Text) > 20 * 2)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('备注长度不能超过20个汉字符,请修正!');</script>");
                return;
            }

            int goodId = goodsSer.GetGoodId(txtInvName.Text, lblSpec.Text, lblModel.Text,lblGoodSmTypeName.Text,lblUnit.Text);
            if (goodId == 0)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的商品不存在!');</script>");
                 
                return;
            }

            try
            {
                Convert.ToDecimal(txtSellPrice.Text);
                Convert.ToDecimal(txtCostPrice.Text);
            }
            catch (Exception)
            {
                
                   base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的单价格式有误!');</script>");
                   return;
            } 
           // var goodModel = goodsSer.GetModel(goodId);
            CG_POOrders s = new CG_POOrders();
            s.GoodNo = txtGoodNo.Text;// goodModel.GoodNo;
            s.GoodId = goodId;
            s.GoodUnit =lblUnit.Text;
            s.GoodName = txtInvName.Text;
            s.GoodSpec = lblSpec.Text;
            s.Good_Model = lblModel.Text;
            s.GoodTypeSmName = lblGoodSmTypeName.Text;
           
            s.CostPrice = Convert.ToDecimal(txtCostPrice.Text);
            s.DetailRemark = txtDetailRemark.Text;
            s.InvName = txtInvName.Text;
            s.Num = Convert.ToDecimal(txtNum.Text);
            if (txtOtherCost.Text != "")
                s.OtherCost = Convert.ToDecimal(txtOtherCost.Text);
            if (txtProfit.Text != "")
                s.Profit = Convert.ToDecimal(txtProfit.Text);

            s.SellPrice = Convert.ToDecimal(txtSellPrice.Text);
          
           
            if (txtToTime.Text != "")
            {
                s.ToTime = Convert.ToDateTime(txtToTime.Text);
            }

            s.CostTotal = s.CostPrice * s.Num;
            s.SellTotal=s.SellPrice*s.Num;
            s.YiLiTotal = s.SellTotal - s.CostTotal - s.OtherCost;
            if (s.SellTotal != 0)
                s.Profit = s.YiLiTotal / s.SellTotal * 100;
            else if (s.YiLiTotal != 0)
            {
                s.Profit = -100;
            }
            else
            {
                s.Profit = 0;
            }
                //修改
            if (Request["index"] != null)
            {
                int index = Convert.ToInt32(Request["index"]);
               
                    //List<CG_POOrders> POOrders = Session["Orders"] as List<CG_POOrders>;

                CG_POOrders model = ViewState["m"] as CG_POOrders;                    
                    s.Ids = model.Ids;
                    s.IfUpdate = true;
                    s.UpdateIndex = Convert.ToInt32(Request["index"]);
                    Session["m"] = s;
                 
                this.ClientScript.RegisterStartupScript(this.GetType(), null, "<script> window.close();</script>");
            }
            else
            {

                if (ViewState["Orders"] == null)
                {
                    List<CG_POOrders> POOrders = new List<CG_POOrders>();
                    POOrders.Insert(POOrders.Count, s);
                    ViewState["Orders"] = POOrders;
                }
                else
                {
                    List<CG_POOrders> POOrders = ViewState["Orders"] as List<CG_POOrders>;
                    POOrders.Insert(POOrders.Count , s);
                    ViewState["Orders"] = POOrders;
                }
                clear();
            }
           // this.ClientScript.RegisterStartupScript(this.GetType(), null, "<script> window.close();</script>");

        }
Beispiel #30
0
        public bool FormCheck()
        {
            if (this.txtGuestName.Text.Trim() == "" || txtGuestName.Text == "0")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择客户名称!');</script>");
                this.txtGuestName.Focus();
                return(false);
            }

            if (this.txtRemark.Text.Trim() == "")
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写报价概要!');</script>");
                this.txtRemark.Focus();
                return(false);
            }


            List <tb_QuotePrice_InvDetails> invDetails = Session["DataInvDetails"] as List <tb_QuotePrice_InvDetails>;

            if (invDetails.Count <= 0)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请添加报价内容!');</script>");

                return(false);
            }
            if (cbYH.Checked && string.IsNullOrEmpty(txtResultYH.Text))
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请添填写最终优惠价!');</script>");

                return(false);
            }
            //最终优惠价:ZZ,ZZ是一个输入框内的值,缺省=报价单内的所有费用合计,
            //但可以修改,修改的值不能超过 缺省值,否则提交 提示“优惠价格必须小于合计价格”
            if (cbYH.Checked)
            {
                //计算总价
                //只要小于 计税设备材料人工基数+工程计税
                var sumTotal = Convert.ToDecimal(lblTotalDetailsXiao.Text) + Convert.ToDecimal(string.IsNullOrEmpty(txtLaborCost.Text) ? "0" : txtLaborCost.Text) +
                               Convert.ToDecimal(string.IsNullOrEmpty(txtEngineeringTax.Text) ? "0" : txtEngineeringTax.Text);
                if (Convert.ToDecimal(txtResultYH.Text) >= sumTotal)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('优惠价格必须小于合计价格!');</script>");
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(txtLaborCost.Text))
            {
                if (CommHelp.VerifesToNum(txtLaborCost.Text.Trim()) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('人工费用 格式错误!');</script>");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(txtXX.Text))
            {
                if (CommHelp.VerifesToNum(txtXX.Text.Trim()) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('工程计税 格式错误!');</script>");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(txtResultYH.Text))
            {
                if (CommHelp.VerifesToNum(txtResultYH.Text.Trim()) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('最终优惠价 格式错误!');</script>");
                    return(false);
                }
            }
            return(true);
        }