Esempio n. 1
0
        public void Bind()
        {
            #region  拉框赋值

            var dic = new QuoteTemplateBLL().GetField();

            // 日期格式
            this.DateFormat.DataTextField  = "show";
            this.DateFormat.DataValueField = "val";
            this.DateFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "DateFormat").Value;
            this.DateFormat.DataBind();
            this.DateFormat.SelectedIndex = 0;
            //数字格式
            this.NumberFormat.DataTextField  = "show";
            this.NumberFormat.DataValueField = "val";
            this.NumberFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "NumberFormat").Value;
            this.NumberFormat.DataBind();
            //货币格式(正数)
            this.CurrencyPositivePattern.DataTextField  = "show";
            this.CurrencyPositivePattern.DataValueField = "val";
            this.CurrencyPositivePattern.DataSource     = dic.FirstOrDefault(_ => _.Key == "CurrencyPositivePattern").Value;
            this.CurrencyPositivePattern.DataBind();
            //货币格式(负数)
            this.CurrencyNegativePattern.DataTextField  = "show";
            this.CurrencyNegativePattern.DataValueField = "val";
            this.CurrencyNegativePattern.DataSource     = dic.FirstOrDefault(_ => _.Key == "CurrencyNegativePattern").Value;
            this.CurrencyNegativePattern.DataBind();
            #endregion
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["item"] != null && !string.IsNullOrEmpty(Request.QueryString["item"].ToString()))
         {
             body_item = Request.QueryString["item"].ToString();
         }
         else
         {
             body_item = "";
         }
         this.AlertVariableFilter.DataTextField  = "show";
         this.AlertVariableFilter.DataValueField = "val";
         this.AlertVariableFilter.DataSource     = new QuoteTemplateBLL().GetBodyVariableField();
         this.AlertVariableFilter.DataBind();
         this.AlertVariableFilter.Items.Insert(0, new ListItem()
         {
             Value = "0", Text = "显示全部变量", Selected = true
         });
         var           list = new QuoteTemplateBLL().GetBodyAllVariable();
         StringBuilder sb   = new StringBuilder();
         foreach (string va in list)
         {
             sb.Append("<option class='val' ondblclick='dbclick(this);'>" + va.Replace("'", "") + "</option>");
         }
         this.VariableList.Text = sb.ToString();
     }
 }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request.QueryString["id"]);
            if (!IsPostBack)
            {
                if (Session["quote_head"] != null && !string.IsNullOrEmpty(Session["quote_head"].ToString()))
                {
                    quote_head = HttpUtility.HtmlDecode(Session["quote_head"].ToString()).Replace("\"", "'");
                }
                this.AlertVariableFilter.DataTextField  = "show";
                this.AlertVariableFilter.DataValueField = "val";
                this.AlertVariableFilter.DataSource     = new QuoteTemplateBLL().GetVariableField();
                this.AlertVariableFilter.DataBind();
                this.AlertVariableFilter.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "显示全部变量", Selected = true
                });
                //
                var           list = new QuoteTemplateBLL().GetAllVariable();
                StringBuilder sb   = new StringBuilder();
                foreach (string va in list)
                {
                    sb.Append("<option class='val' ondblclick='dbclick(this);'>" + va.Replace("'", "") + "</option>");
                }
                this.VariableList.Text = sb.ToString();
            }

            //quote_head = HttpUtility.HtmlDecode(data.quote_header_html).Replace("\"", "'");
        }
Esempio n. 4
0
        protected void AlertVariableFilter_SelectedIndexChanged(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            if (this.AlertVariableFilter.SelectedValue == "0")
            {
                sb.Clear();
                var list = new QuoteTemplateBLL().GetAllVariable();
                foreach (string va in list)
                {
                    sb.Append("<option class='val' ondblclick='dbclick(this);'>" + va.Replace("'", "") + "</option>");
                }
                this.VariableList.Text = sb.ToString();
            }
            else
            {
                int id = Convert.ToInt32(this.AlertVariableFilter.SelectedValue.ToString());
                sb.Clear();
                var list = new QuoteTemplateBLL().GetVariable(id);
                foreach (string va in list)
                {
                    sb.Append("<option class='val' ondblclick='dbclick(this);' >" + va.Replace("'", "") + "</option>");
                }
                this.VariableList.Text = sb.ToString();
            }
        }
Esempio n. 5
0
        public void Bind()
        {
            var dic = new QuoteTemplateBLL().GetField();

            //分组
            this.GroupBy.DataTextField  = "show";
            this.GroupBy.DataValueField = "val";
            this.GroupBy.DataSource     = dic.FirstOrDefault(_ => _.Key == "GroupBy").Value;
            this.GroupBy.DataBind();
            this.GroupBy.SelectedIndex = 0;
            //显示
            this.Itemize.DataTextField  = "show";
            this.Itemize.DataValueField = "val";
            this.Itemize.DataSource     = dic.FirstOrDefault(_ => _.Key == "Itemize").Value;
            this.Itemize.DataBind();
            //排序字段
            this.SortBy.DataTextField  = "show";
            this.SortBy.DataValueField = "val";
            this.SortBy.DataSource     = dic.FirstOrDefault(_ => _.Key == "SortBy").Value;
            this.SortBy.DataBind();
            //可选变量
            this.Variable.DataTextField  = "show";
            this.Variable.DataValueField = "val";
            this.Variable.DataSource     = new QuoteTemplateBLL().GetInvoiceBodyVariableField();
            this.Variable.DataBind();
            this.Variable.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "显示全部变量", Selected = true
            });
            var           list = new QuoteTemplateBLL().GetBodyAllInvoiceVariable();
            StringBuilder sb   = new StringBuilder();

            foreach (string va in list)
            {
                sb.Append("<option class='val' ondblclick='dbclick(this);'>" + va.Replace("'", "") + "</option>");
            }
            this.VariableList.Text       = sb.ToString();
            this.GetVaild.DataTextField  = "show";
            this.GetVaild.DataValueField = "val";
            this.GetVaild.DataSource     = new QuoteTemplateBLL().GetInvoiceBodyVariableField();
            this.GetVaild.DataBind();
            this.GetVaild.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "显示全部变量", Selected = true
            });
            this.GetVaildlist.Text = sb.ToString();
        }
Esempio n. 6
0
        /// <summary>
        /// 设置发票模板为默认
        /// </summary>
        /// <param name="context"></param>
        /// <param name="invoiceTmplId"></param>
        public void DefaultInvoiceTemplate(HttpContext context, long invoiceTmplId)
        {
            var result = new QuoteTemplateBLL().default_quote_template(LoginUserId, invoiceTmplId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("设为默认发票模板成功!");
            }
            else if (result == DTO.ERROR_CODE.DEFAULT)
            {
                context.Response.Write("已经是默认状态,无需再操作!");
            }
            else
            {
                context.Response.Write("设为默认发票模板失败!");
            }
        }
Esempio n. 7
0
        //转PDF,还没有完成9-26
        protected void ToPdf_Click(object sender, EventArgs e)
        {
            var    data     = new QuoteTemplateBLL().GetQuoteTemplate(id);
            string savepath = string.Format("C:\\DoneNowNET" + "\\" + data.name + ".pdf");//最终保存
            string url      = Request.Url.ToString();

            try
            {
                if (!string.IsNullOrEmpty(url) || !string.IsNullOrEmpty(savepath))
                {
                    Process p      = new Process();
                    string  dllstr = string.Format("C:\\Program Files (x86)\\wkhtmltopdf\\bin\\wkhtmltopdf.exe");
                    if (File.Exists(dllstr))
                    {
                        p.StartInfo.FileName               = dllstr;
                        p.StartInfo.Arguments              = " \"" + url + "\"  \"" + savepath + "\"";
                        p.StartInfo.UseShellExecute        = false;
                        p.StartInfo.RedirectStandardInput  = true;
                        p.StartInfo.RedirectStandardOutput = true;
                        p.StartInfo.RedirectStandardError  = true;
                        p.StartInfo.CreateNoWindow         = true;
                        p.Start();
                        p.WaitForExit();
                        try
                        {
                            FileStream fs   = new FileStream(savepath, FileMode.Open);
                            byte[]     file = new byte[fs.Length];
                            fs.Read(file, 0, file.Length);
                            fs.Close();
                            Response.Clear();
                            Response.AddHeader("content-disposition", "attachment; filename=" + data.name + ".pdf");//強制下載
                            Response.ContentType = "application/octet-stream";
                            Response.BinaryWrite(file);
                        }
                        catch (Exception ee)
                        {
                            throw new Exception(ee.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }
Esempio n. 8
0
        public void ActiveQuoteTemplate(HttpContext context, long QuoteTemp_id)
        {
            var result = new QuoteTemplateBLL().active_quote_template(LoginUserId, QuoteTemp_id);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("设为激活状态报价模板成功!");
            }
            else if (result == DTO.ERROR_CODE.ACTIVATION)
            {
                context.Response.Write("已经是激活状态,无需再操作!");
            }
            else
            {
                context.Response.Write("设为激活状态报价模板失败!");
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 停用发票模板
        /// </summary>
        /// <param name="context"></param>
        /// <param name="invoiceTmplId"></param>
        public void NoActiveInvoiceTemplate(HttpContext context, long invoiceTmplId)
        {
            var result = new QuoteTemplateBLL().no_active_quote_template(LoginUserId, invoiceTmplId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("设为停用状态发票模板成功!");
            }
            else if (result == DTO.ERROR_CODE.NO_ACTIVATION)
            {
                context.Response.Write("已经是停用状态,无需再操作!");
            }
            else
            {
                context.Response.Write("设为停用状态发票模板失败!");
            }
        }
Esempio n. 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request.QueryString["id"]);
     if (!IsPostBack)
     {
         tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent;
         if (tempinfo != null && tempinfo.id == id)
         {
             if (!string.IsNullOrEmpty(tempinfo.bottom))
             {
                 bottom = HttpUtility.HtmlDecode(tempinfo.bottom).Replace("\"", "'");
             }
             if (!string.IsNullOrEmpty(tempinfo.Invoice_text))
             {
                 bottomttt = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext>(tempinfo.Invoice_text);
                 if (tempinfo.tax_cat == 1)
                 {
                     this.tax_cate.Checked = true;
                 }
                 if (tempinfo.tax_group == 1)
                 {
                     this.tax_group.Checked = true;
                 }
                 if (tempinfo.tax_sup == 1)
                 {
                     this.tax_sup.Checked = true;
                 }
             }
         }
         this.AlertVariableFilter.DataTextField  = "show";
         this.AlertVariableFilter.DataValueField = "val";
         this.AlertVariableFilter.DataSource     = new QuoteTemplateBLL().GetInvoiceVariableField();
         this.AlertVariableFilter.DataBind();
         this.AlertVariableFilter.Items.Insert(0, new ListItem()
         {
             Value = "0", Text = "显示全部变量", Selected = true
         });
         var           list = new QuoteTemplateBLL().GetAllVariable();
         StringBuilder sb   = new StringBuilder();
         foreach (string va in list)
         {
             sb.Append("<option class='val' ondblclick='dbclick(this);'>" + va.Replace("'", "") + "</option>");
         }
         this.VariableList.Text = sb.ToString();
     }
 }
Esempio n. 11
0
        private void save()
        {
            QuoteTemplateBLL qtbll = new QuoteTemplateBLL();
            var sqt = qtbll.GetQuoteTemplate(id);

            if (sqt == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('获取数据错误!');history.go(-1);</script>");
            }
            tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent;
            if (tempinfo != null && tempinfo.id == id)
            {
                sqt.page_header_html  = tempinfo.head;   //页眉
                sqt.quote_header_html = tempinfo.top;    //头部
                sqt.body_html         = tempinfo.body;   //主体
                sqt.quote_footer_html = tempinfo.bottom; //底部
                sqt.page_footer_html  = tempinfo.foot;   //页脚
                //bottom税相关
                sqt.show_tax_cate = (SByte)tempinfo.tax_cat;
                sqt.show_each_tax_in_tax_group = (SByte)tempinfo.tax_group;
                sqt.show_tax_cate_superscript  = (SByte)tempinfo.tax_sup;
                //body分组
                sqt.body_group_by_id         = tempinfo.body_group_by;
                sqt.body_itemize_id          = tempinfo.body_itemize_id;
                sqt.body_order_by_id         = tempinfo.body_order_by;
                sqt.show_labels_when_grouped = (SByte)tempinfo.show_labels_when_grouped;
                //bottom 合计
                sqt.tax_total_disp = tempinfo.Invoice_text;
                //底部备注
                sqt.quote_footer_notes = tempinfo.foot_note;
            }
            //更新保存
            var result = qtbll.update(sqt, GetLoginUserId());

            if (result == ERROR_CODE.SUCCESS)                           // 更新用户成功,刷新前一个页面
            {
                Response.Write("<script>alert('发票模板修改成功!');</script>"); //关闭添加页面的同时,刷新父页面
            }
            else if (result == ERROR_CODE.USER_NOT_FIND)                // 用户丢失
            {
                Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                Response.Redirect("Login.aspx");
            }
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                // quote_group_by

                groupBy.DataTextField  = "show";
                groupBy.DataValueField = "val";
                groupBy.DataSource     = dic.FirstOrDefault(_ => _.Key == "quote_group_by").Value;
                groupBy.DataBind();


                isShow      = Request.QueryString["isShow"];
                IssaleOrder = !string.IsNullOrEmpty(Request.QueryString["isSaleOrder"]);
                var sid = Request.QueryString["sale_order_id"];
                if (!string.IsNullOrEmpty(sid))
                {
                    sale_order_id = long.Parse(sid);
                }


                var quote_id = Request.QueryString["quote_id"];
                if (!string.IsNullOrEmpty(quote_id))
                {
                    quote = new QuoteBLL().GetQuote(Convert.ToInt64(quote_id));

                    if (quote.quote_tmpl_id != null)
                    {
                        var sys_quote_temp = new QuoteTemplateBLL().GetQuoteTemplate((long)quote.quote_tmpl_id);
                        if (sys_quote_temp != null)
                        {
                            // 获取到该报价的报价模板用于设置税的显示方式和汇总名称
                            show_each_tax_in_tax_group.Value  = sys_quote_temp.show_each_tax_in_tax_group.ToString();
                            show_each_tax_in_tax_period.Value = sys_quote_temp.show_each_tax_in_tax_period.ToString(); // 选中第一个:按照周期分组时起作用,每个周期后显示税 最后的汇总也有税)
                                                                                                                       // var a3 =sys_quote_temp.show_labels_when_grouped;  // 预留字段
                            show_tax_cate.Value             = sys_quote_temp.show_tax_cate.ToString();
                            show_tax_cate_superscript.Value = sys_quote_temp.show_tax_cate_superscript.ToString();
                        }
                    }
                }
                var opportunity_id = Request.QueryString["opportunity_id"];  // 这里是通过商机查看报价项的情况
                if (!string.IsNullOrEmpty(opportunity_id))
                {
                    var oppoQuoteList = new crm_quote_dal().GetQuoteByWhere($" and opportunity_id = {opportunity_id} ");

                    if (oppoQuoteList != null && oppoQuoteList.Count > 0)
                    {
                        quote = oppoQuoteList.FirstOrDefault(_ => _.is_primary_quote == 1);  // 如果该商机下有报价则一定会有主报价
                    }
                }

                if (quote != null)
                {
                    quoteItemList = new crm_quote_item_dal().GetQuoteItems($" and quote_id={quote.id} ");
                    // quoteItemList.Sort(SortCycle);  // 自定义排序测试
                    quoteItemList = quoteItemList.OrderBy(_ => SortQuoteItem(_.period_type_id)).ToList();
                    quoteList     = new crm_quote_dal().GetQuoteByWhere($" and opportunity_id = {quote.opportunity_id} ");
                    var primaryQuote = quoteList.FirstOrDefault(_ => _.is_primary_quote == 1);
                    if (primaryQuote != null)
                    {
                        var thisQuoteItemList = new crm_quote_item_dal().GetQuoteItems($" and quote_id={primaryQuote.id} ");


                        var thisDiscountQIList   = thisQuoteItemList.Where(_ => _.type_id == (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT && _.optional == 0).ToList();
                        var thisOneTimeQTList    = thisQuoteItemList.Where(_ => _.period_type_id == (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME && _.optional == 0).ToList();
                        var thisOptionalItemList = thisQuoteItemList.Where(_ => _.optional == 1).ToList();

                        var totalPrice = ((decimal)((thisQuoteItemList.Sum(_ => (_.unit_discount != null && _.unit_price != null && _.quantity != null) ? (_.unit_price - _.unit_discount) * _.quantity : 0) - thisDiscountQIList.Where(_ => _.discount_percent != null).ToList().Sum(_ => (_.unit_discount != null && _.quantity != null) ? _.unit_discount * _.quantity : 0) - (thisOneTimeQTList != null && thisOneTimeQTList.Count > 0 ? thisDiscountQIList.Where(_ => _.discount_percent != null).ToList().Sum(_ => thisOneTimeQTList.Sum(one => (one.unit_discount != null && one.unit_price != null && one.quantity != null) ? (one.unit_price - one.unit_discount) * one.quantity : 0) * _.discount_percent) : 0)))).ToString("#0.00");
                        quoteList.Remove(primaryQuote);
                        primaryQuote.name = "PRIMARY:" + primaryQuote.name + "(" + totalPrice + ")";
                        quoteList.Add(primaryQuote);
                    }


                    #region // 为报价下拉框赋值
                    quoteDropList.DataValueField = "id";
                    quoteDropList.DataTextField  = "name";
                    quoteDropList.DataSource     = quoteList;
                    quoteDropList.DataBind();
                    quoteDropList.SelectedValue = quote.id.ToString();
                    #endregion
                    if (quoteItemList != null && quoteItemList.Count > 0)
                    {
                        // 用户需要添加折扣类型的报价项,然后可以针对付费周期类型为一次性的报价项进行折扣
                        // 折扣只针对一次性周期的报价项折扣
                        oneTimeList = quoteItemList.Where(_ => _.period_type_id == (int)DTO.DicEnum.QUOTE_ITEM_PERIOD_TYPE.ONE_TIME && _.optional == 0 && _.type_id != (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT && _.type_id != (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES).ToList();

                        discountQIList = quoteItemList.Where(_ => _.type_id == (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT && _.optional == 0).ToList();

                        //  获取到可选的报价项,
                        optionalItemList = quoteItemList.Where(_ => _.optional == 1).ToList();   // 获取到可选的报价项
                        // optionalItemList.Sort();

                        // &&optionalItemList.Any(op=>op.id!=_.id)&&oneTimeList.Any(one=>one.id!=_.id)  满足多个报价项过滤条件的,选择其中的一个
                        distributionList = quoteItemList.Where(_ => _.type_id == (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES && _.optional == 0).ToList();   // 配送类型的报价项

                        // 配送,一次性,可选的配置项独立显示,所以在这里分离出来,传到前台后单独处理

                        //  获取到筛选后报价项列表方便分组管理  筛选后的列表不包括可选,一次性的折扣和配送
                        var screenList = quoteItemList.Where(_ => _.type_id != (int)EMT.DoneNOW.DTO.DicEnum.QUOTE_ITEM_TYPE.DISTRIBUTION_EXPENSES && _.optional != 1 && _.type_id != (int)DTO.DicEnum.QUOTE_ITEM_TYPE.DISCOUNT).ToList();

                        if (!string.IsNullOrEmpty(Request.QueryString["group_by"]))
                        {
                            groupByType = Request.QueryString["group_by"];
                        }
                        else
                        {
                            if (quote.group_by_id != null)
                            {
                                groupByType = ((long)quote.group_by_id).ToString();
                            }
                        }
                        //  groupByType = ?((long)quote.group_by_id).ToString():Request.QueryString["group_by"];
                        if (groupByType == ((int)EMT.DoneNOW.DTO.DicEnum.QUOTE_GROUP_BY.CYCLE).ToString())                                                                      // 按周期分组
                        {
                            groupList = screenList.GroupBy(_ => _.period_type_id == null ? "" : _.period_type_id.ToString()).ToDictionary(_ => (object)_.Key, _ => _.ToList()); // as Dictionary<long?,
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.CYCLE, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.CYCLE).ToString();
                        }
                        else if (groupByType == ((int)QUOTE_GROUP_BY.PRODUCT).ToString())  // 按产品分组
                        {
                            groupList = screenList.GroupBy(_ => _.object_id == null ? "" : ReturnProductID((long)_.object_id)).ToDictionary(_ => (object)_.Key, _ => _.ToList());
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.PRODUCT, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.PRODUCT).ToString();
                        }
                        else if (groupByType == ((int)QUOTE_GROUP_BY.CYCLE_PRODUCT).ToString())   // 按周期产品分组
                        {
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.CYCLE_PRODUCT, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.CYCLE_PRODUCT).ToString();
                            doubleGroupList       = screenList.GroupBy(d => d.period_type_id == null ? "" : d.period_type_id.ToString()).ToDictionary(_ => (object)_.Key, _ => _.ToList().GroupBy(d => d.object_id == null ? "" : ReturnProductID((long)d.object_id)).ToDictionary(d => (object)d.Key, d => d.ToList()));
                        }
                        else if (groupByType == ((int)QUOTE_GROUP_BY.PRODUCT_CYCLE).ToString()) // 按产品周期分组
                        {
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.PRODUCT_CYCLE, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.PRODUCT_CYCLE).ToString();
                            doubleGroupList       = screenList.GroupBy(_ => _.object_id == null ? "" : ReturnProductID((long)_.object_id)).ToDictionary(_ => (object)_.Key, _ => _.ToList().GroupBy(d => d.period_type_id == null ? "" : d.period_type_id.ToString()).ToDictionary(d => (object)d.Key, d => d.ToList()));
                        }
                        else // 不分组
                        {
                            new QuoteBLL().UpdateGroup(quote.id, (int)QUOTE_GROUP_BY.NO, GetLoginUserId());
                            groupBy.SelectedValue = ((int)QUOTE_GROUP_BY.NO).ToString();
                        }
                        //switch (groupByType)
                        //{
                        //    case "cycle":
                        //        // 按照周期分组
                        //        break;
                        //    case "product":
                        //        break;
                        //    default:
                        //        groupByType = "no";
                        //        break;
                        //}
                        // ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script> $(\"#groupBy\").val('"+groupBy+"')</script>");
                        if (discountQIList != null && discountQIList.Count > 0)
                        {
                            discountQIList.ForEach(_ => { if (_.discount_percent != null)
                                                          {
                                                              _.discount_percent = _.discount_percent / 100;
                                                          }
                                                   });
                        }
                    }
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void Bind()
        {
            #region  拉框赋值

            var dic = new QuoteTemplateBLL().GetField();

            // 日期格式
            this.DateFormat.DataTextField  = "show";
            this.DateFormat.DataValueField = "val";
            this.DateFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "DateFormat").Value;
            this.DateFormat.SelectedValue  = data.date_display_format_id.ToString();
            this.DateFormat.DataBind();
            //数字格式
            this.NumberFormat.DataTextField  = "show";
            this.NumberFormat.DataValueField = "val";
            this.NumberFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "NumberFormat").Value;
            this.NumberFormat.SelectedValue  = data.number_display_format_id.ToString();
            this.NumberFormat.DataBind();
            //货币格式(正数)
            this.CurrencyPositivePattern.DataTextField  = "show";
            this.CurrencyPositivePattern.DataValueField = "val";
            this.CurrencyPositivePattern.DataSource     = dic.FirstOrDefault(_ => _.Key == "CurrencyPositivePattern").Value;
            this.CurrencyPositivePattern.SelectedValue  = data.currency_positive_format_id.ToString();
            this.CurrencyPositivePattern.DataBind();
            //货币格式(负数)
            this.CurrencyNegativePattern.DataTextField  = "show";
            this.CurrencyNegativePattern.DataValueField = "val";
            this.CurrencyNegativePattern.DataSource     = dic.FirstOrDefault(_ => _.Key == "CurrencyNegativePattern").Value;
            this.CurrencyNegativePattern.SelectedValue  = data.currency_negative_format_id.ToString();
            this.CurrencyNegativePattern.DataBind();


            this.Name.Text        = data.name;
            this.Description.Text = data.description;
            if (data.is_active != 1)
            {
                this.Active.Checked = false;
            }
            if (data.show_each_tax_in_tax_group == 1)
            {
                this.show_each_tax_in_tax_group.Checked = true;
            }
            if (data.show_each_tax_in_tax_period == 1)
            {
                this.show_each_tax_in_tax_period.Checked = true;
                k = 1;
            }
            if (data.show_tax_cate == 1)
            {
                this.show_tax_cate.Checked = true;
            }
            if (data.show_tax_cate_superscript == 1)
            {
                this.show_tax_cate_superscript.Checked = true;
            }


            var data_tax = new EMT.Tools.Serialize().DeserializeJson <QuoteTemplateAddDto.Tax_Total_Disp>(data.tax_total_disp);
            this.SemiAnnualTotal.Text             = data_tax.Semi_Annual_Total;
            this.IncludingOptionalQuoteItems.Text = data_tax.Including_Optional_Quote_Items;
            this.ItemTotal.Text               = data_tax.Item_Total;
            this.Subtotal.Text                = data_tax.Subtotal;
            this.Total.Text                   = data_tax.Total;
            this.TotalTaxes.Text              = data_tax.Total_Taxes;
            this.YearlySubtotal.Text          = data_tax.Yearly_Subtotal;
            this.YearlyTotal.Text             = data_tax.Yearly_Total;
            this.ShippingTotal.Text           = data_tax.Shipping_Total;
            this.ShippingSubtotal.Text        = data_tax.Shipping_Subtotal;
            this.SemiAnnualSubtotal.Text      = data_tax.Semi_Annual_Subtotal;
            this.QuarterlySubtotal.Text       = data_tax.Quarterly_Subtotal;
            this.QuarterlyTotal.Text          = data_tax.Quarterly_Total;
            this.MonthlySubtotal.Text         = data_tax.Monthly_Subtotal;
            this.OptionalSubtotal.Text        = data_tax.Optional_Subtotal;
            this.OptionalTotal.Text           = data_tax.Optional_Total;
            this.MonthlyTotal.Text            = data_tax.Monthly_Total;
            this.OneTimeDiscountSubtotal.Text = data_tax.One_Time_Discount_Subtotal;
            this.OneTimeDiscountTotal.Text    = data_tax.One_Time_Discount_Total;
            this.OneTimeSubtotal.Text         = data_tax.One_Time_Subtotal;
            this.OneTimeTotal.Text            = data_tax.One_Time_Total;

            switch (data.page_number_location_id)
            {
            case (int)PAGE_NUMBER_LOCATION.NO: this.showNO.Checked = true; break;

            case (int)PAGE_NUMBER_LOCATION.BOTTOMLEFT: this.showLeft.Checked = true; break;

            case (int)PAGE_NUMBER_LOCATION.BOTTOMCENTER: this.showCenter.Checked = true; break;

            case (int)PAGE_NUMBER_LOCATION.BOTTOMRIGHT: this.showRight.Checked = true; break;
            }

            switch (data.paper_size_id)
            {
            case (int)PAGE_SIZE.LETTER: this.Letter.Checked = true; break;

            case (int)PAGE_SIZE.A4: this.A4.Checked = true; break;
            }

            #endregion
        }
Esempio n. 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            id           = Convert.ToInt64(Request.QueryString["id"]);
            if (!IsPostBack)
            {
                Bind();
                if (id > 0)  //修改
                {
                    var data = new QuoteTemplateBLL().GetQuoteTemplate(id);
                    if (data == null)
                    {
                        Response.Write("<script>alert('获取相关数据失败,返回上一个页面');window.close();self.opener.location.reload();</script>");
                    }
                    else
                    {
                        this.Name.Text        = data.name;
                        this.Description.Text = data.description;
                        if (data.is_active == 1)
                        {
                            this.Active.Checked = true;
                        }
                        if (data.show_each_tax_in_tax_group == 1)
                        {
                            this.show_each_tax_in_tax_group.Checked = true;
                        }
                        if (data.show_each_tax_in_tax_period == 1)
                        {
                            this.show_each_tax_in_tax_period.Checked = true;
                        }
                        if (data.show_tax_cate == 1)
                        {
                            this.show_tax_cate.Checked = true;
                        }
                        if (data.show_tax_cate_superscript == 1)
                        {
                            this.show_tax_cate_superscript.Checked = true;
                        }

                        var data_tax = new EMT.Tools.Serialize().DeserializeJson <QuoteTemplateAddDto.Tax_Total_Disp>(data.tax_total_disp);
                        this.SemiAnnualTotal.Text             = data_tax.Semi_Annual_Total;
                        this.IncludingOptionalQuoteItems.Text = data_tax.Including_Optional_Quote_Items;
                        this.ItemTotal.Text               = data_tax.Item_Total;
                        this.Subtotal.Text                = data_tax.Subtotal;
                        this.Total.Text                   = data_tax.Total;
                        this.TotalTaxes.Text              = data_tax.Total_Taxes;
                        this.YearlySubtotal.Text          = data_tax.Yearly_Subtotal;
                        this.YearlyTotal.Text             = data_tax.Yearly_Total;
                        this.ShippingTotal.Text           = data_tax.Shipping_Total;
                        this.ShippingSubtotal.Text        = data_tax.Shipping_Subtotal;
                        this.SemiAnnualSubtotal.Text      = data_tax.Semi_Annual_Subtotal;
                        this.QuarterlySubtotal.Text       = data_tax.Quarterly_Subtotal;
                        this.QuarterlyTotal.Text          = data_tax.Quarterly_Total;
                        this.MonthlySubtotal.Text         = data_tax.Monthly_Subtotal;
                        this.OptionalSubtotal.Text        = data_tax.Optional_Subtotal;
                        this.OptionalTotal.Text           = data_tax.Optional_Total;
                        this.MonthlyTotal.Text            = data_tax.Monthly_Total;
                        this.OneTimeDiscountSubtotal.Text = data_tax.One_Time_Discount_Subtotal;
                        this.OneTimeDiscountTotal.Text    = data_tax.One_Time_Discount_Total;
                        this.OneTimeSubtotal.Text         = data_tax.One_Time_Subtotal;
                        this.OneTimeTotal.Text            = data_tax.One_Time_Total;

                        switch (data.page_number_location_id)
                        {
                        case (int)PAGE_NUMBER_LOCATION.NO: this.showNO.Checked = true; break;

                        case (int)PAGE_NUMBER_LOCATION.BOTTOMLEFT: this.showLeft.Checked = true; break;

                        case (int)PAGE_NUMBER_LOCATION.BOTTOMCENTER: this.showCenter.Checked = true; break;

                        case (int)PAGE_NUMBER_LOCATION.BOTTOMRIGHT: this.showRight.Checked = true; break;
                        }

                        switch (data.paper_size_id)
                        {
                        case (int)PAGE_SIZE.LETTER: this.Letter.Checked = true; break;

                        case (int)PAGE_SIZE.A4: this.A4.Checked = true; break;
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        protected void AddQuoteTemplate(object sender, EventArgs e)
        {
            //this.DateFormat.
            sys_quote_tmpl sqt = new sys_quote_tmpl();

            sqt.name = this.Name.Text.Trim().ToString();
            if (this.Active.Checked)
            {
                sqt.is_active = 1;
            }
            else
            {
                sqt.is_active = 0;
            }
            sqt.description                 = this.Description.Text.Trim().ToString();
            sqt.paper_size_id               = paper_size_id();
            sqt.page_number_location_id     = page_number_location_id();
            sqt.create_user_id              = LoginUserId;
            sqt.currency_negative_format_id = Convert.ToInt32(this.CurrencyNegativePattern.SelectedValue.Trim().ToString());
            sqt.currency_positive_format_id = Convert.ToInt32(this.CurrencyPositivePattern.SelectedValue.Trim().ToString());
            sqt.number_display_format_id    = Convert.ToInt32(this.NumberFormat.SelectedValue.Trim().ToString());
            sqt.date_display_format_id      = Convert.ToInt32(this.DateFormat.SelectedValue.Trim().ToString());
            sqt.cate_id = 1;
            if (this.show_each_tax_in_tax_group.Checked)
            {
                sqt.show_each_tax_in_tax_group = 1;
            }
            else
            {
                sqt.show_each_tax_in_tax_group = 0;
            }
            if (this.show_each_tax_in_tax_period.Checked)
            {
                sqt.show_each_tax_in_tax_period = 1;
            }
            else
            {
                sqt.show_each_tax_in_tax_period = 0;
            }
            if (this.show_tax_cate.Checked)
            {
                sqt.show_tax_cate = 1;
            }
            else
            {
                sqt.show_tax_cate = 0;
            }
            if (this.show_tax_cate_superscript.Checked)
            {
                sqt.show_tax_cate_superscript = 1;
            }
            else
            {
                sqt.show_tax_cate_superscript = 0;
            }

            sqt.tax_total_disp = tax_total_disp();
            // sqt.create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);

            QuoteTemplateBLL qtbll = new QuoteTemplateBLL();

            if (string.IsNullOrEmpty(sqt.name))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('模板名称未填写!');</script>");
            }
            if (id > 0)
            {
                var result = qtbll.update(sqt, GetLoginUserId());
                if (result == ERROR_CODE.SUCCESS)
                {
                    Response.Write("<script>alert('报价模板属性修改成功');window.close();self.opener.location.reload();</script>");
                }
                else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
                {
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    Response.Write("<script>alert('报价模板属性修改成功');</script>");
                }
            }
            else
            {
                int id1;
                var result = qtbll.Add(sqt, GetLoginUserId(), out id1);
                if (result == ERROR_CODE.SUCCESS)                                                                        // 插入用户成功,刷新前一个页面
                {
                    Response.Write("<script>alert('报价模板添加成功!');window.close();self.opener.location.reload();</script>"); //  关闭添加页面的同时,刷新父页面
                }
                else if (result == ERROR_CODE.USER_NOT_FIND)                                                             // 用户丢失
                {
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("Login.aspx");
                }
            }
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request.QueryString["id"]);
            if (!IsPostBack)
            {
                if (Session["cancel"] != null && (int)Session["cancel"] != 1)
                {
                    Cancel1();
                }
                Session["cancel"] = 0;
                QuoteTemplateBLL qtb = new QuoteTemplateBLL();
                if (Request.QueryString["op"] == null || string.IsNullOrEmpty(Request.QueryString["op"].ToString()))
                {
                    if (qtb.is_quote(id) == DTO.ERROR_CODE.ERROR)//判断报价模板是否被引用
                    {
                        Response.Write("<script>if(confirm('模板被报价引用,如果修改会影响到这些报价。你如果你不想影响这些报价,可以复制一个新的模板,然后对新模板进行修改。是否继续?')==true){}else{window.close();}</script>");
                    }
                }
                //填充数据
                var data = qtb.GetQuoteTemplate(id);
                if (data == null)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('获取数据错误!');history.go(-1);</script>");
                }
                else
                {
                    tempname = data.name;
                    //页眉
                    if (Session["page_head"] != null && !string.IsNullOrEmpty(Session["page_head"].ToString()))
                    {
                        this.head.Text = HttpUtility.HtmlDecode(Session["page_head"].ToString()).Replace("\"", "'");
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(data.page_header_html))
                        {
                            Session["page_head"] = this.head.Text = " ";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
                            {
                            }
                            else
                            {
                                Session["page_head"] = this.head.Text = HttpUtility.HtmlDecode(data.page_header_html).Replace("\"", "'");
                            }
                        }
                    }
                    //头部
                    if (Session["quote_head"] != null)
                    {
                        this.top.Text = HttpUtility.HtmlDecode(Session["quote_head"].ToString()).Replace("\"", "'");
                    }

                    else
                    {
                        if (string.IsNullOrEmpty(data.quote_header_html))
                        {
                            Session["quote_head"] = this.top.Text = " ";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
                            {
                            }
                            else
                            {
                                Session["quote_head"] = this.top.Text = HttpUtility.HtmlDecode(data.quote_header_html).Replace("\"", "'");
                            }
                        }
                    }
                    //正文body

                    //正在进行中
                    string body_json = string.Empty;
                    if (Session["quote_body"] == null || string.IsNullOrEmpty(Session["quote_body"].ToString()))
                    {
                        if (string.IsNullOrEmpty(data.body_html))
                        {
                            //Session["quote_body"] = ";
                            //填充默认
                            StringBuilder sb = new StringBuilder();
                            sb.Append("<table class='ReadOnlyGrid_Table'>");
                            sb.Append("<tr>");
                            sb.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left;' width='40px;'>序列号</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>数量</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Left;'>报价项名称</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>单价</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>单元折扣t</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>折后价</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>总价</td>");
                            sb.Append("</tr>");
                            for (int i = 0; i < 8; i++)
                            {
                                sb.Append("<tr><td style='text - align: Left; '>[Quote Item:Number]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Quantity]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Name]<br/>[Quote Item:Item Description]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Unit Price]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Unit Discount]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Adjusted Unit Price]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Extended Price]</td></tr>");
                            }
                            sb.Append("</table>");
                            this.body.Text = sb.ToString();
                            sb.Clear();
                        }
                        else
                        {
                            Session["quote_body"] = HttpUtility.HtmlDecode(data.body_html).Replace("\"", "'");
                            body_json             = Session["quote_body"].ToString();
                        }
                    }
                    else
                    {
                        body_json = Session["quote_body"].ToString();
                    }

                    if (!string.IsNullOrEmpty(body_json))
                    {
                        var           quote_body = new EMT.Tools.Serialize().DeserializeJson <QuoteTemplateAddDto.BODY>(body_json.Replace("'", "\"")); //正文主体
                        int           i          = 0;                                                                                                  //统计显示的列数
                        StringBuilder table      = new StringBuilder();
                        table.Append("<table class='ReadOnlyGrid_Table'>");
                        table.Append("<tr>");
                        foreach (var coulmn in quote_body.GRID_COLUMN)//获取需要显示的列名
                        {
                            if (coulmn.Display == "yes")
                            {
                                table.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left; '>" + coulmn.Column_label + "</td>");
                                i++;
                            }
                        }
                        table.Append("</tr>");
                        for (int j = 0; j < 8; j++)
                        {
                            table.Append("<tr>");
                            foreach (var coulmn in quote_body.GRID_COLUMN)//获取需要显示的列名
                            {
                                if (coulmn.Display == "yes" && coulmn.Column_Content != "报价项名称")
                                {
                                    table.Append("<td style='text-align: Left;' class='bord'>" + coulmn.Column_Content + "</td>");
                                }
                                if (coulmn.Display == "yes" && coulmn.Column_Content == "报价项名称")
                                {
                                    table.Append("<td style='text-align: Left;'class='bord'>" + quote_body.CUSTOMIZE_THE_ITEM_COLUMN[j].Display_Format + "</td>");
                                }
                                if (quote_body.GRID_OPTIONS[0].Show_vertical_lines == "yes")
                                {
                                    Response.Write("<style>.bord{border-left: 1px solid  #eaeaea;border-right: 1px solid #eaeaea;}</style>");
                                }
                            }
                            table.Append("</tr>");
                        }
                        table.Append("</table>");
                        this.body.Text = table.ToString();
                        table.Clear();
                    }
                    //底部
                    if (Session["quote_foot"] != null)
                    {
                        this.bottom.Text = HttpUtility.HtmlDecode(Session["quote_foot"].ToString()).Replace("\"", "'");
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(data.quote_footer_html))
                        {
                            Session["quote_foot"] = this.bottom.Text = " ";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
                            {
                            }
                            else
                            {
                                Session["quote_foot"] = this.bottom.Text = HttpUtility.HtmlDecode(data.quote_footer_html).Replace("\"", "'");
                            }
                        }
                    }
                    //页脚
                    if (Session["page_foot"] != null)
                    {
                        this.foot.Text = HttpUtility.HtmlDecode(Session["page_foot"].ToString()).Replace("\"", "'");
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(data.page_footer_html))
                        {
                            Session["page_foot"] = this.foot.Text = " ";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
                            {
                            }
                            else
                            {
                                Session["page_foot"] = this.foot.Text = HttpUtility.HtmlDecode(data.page_footer_html).Replace("\"", "'");
                            }
                        }
                    }


                    if (Session["page_appendix"] == null || string.IsNullOrEmpty(Session["page_appendix"].ToString()))
                    {
                        if (string.IsNullOrEmpty(data.quote_footer_notes))
                        {
                            Session["page_appendix"] = " ";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
                            {
                            }
                            else
                            {
                                Session["page_appendix"] = HttpUtility.HtmlDecode(data.quote_footer_notes).Replace("\"", "'");
                            }
                        }
                    }
                }
            }
        }
Esempio n. 17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request.QueryString["id"]);
     // id = 1475;
     if (!IsPostBack)
     {
         if (Session["cancel"] != null && (int)Session["cancel"] != 1)
         {
             Session.Remove("tempinfo");
         }
         Session["cancel"] = 0;
         QuoteTemplateBLL qtb = new QuoteTemplateBLL();
         if (Request.QueryString["op"] == null || string.IsNullOrEmpty(Request.QueryString["op"].ToString()))
         {
             if (qtb.invoice_used(id) == DTO.ERROR_CODE.ERROR)//判断报价模板是否被引用
             {
                 Response.Write("<script>if(confirm('模板被发票引用,如果修改会影响到这些发票。你如果你不想影响这些发票,可以复制一个新的模板,然后对新模板进行修改。是否继续?')==true){}else{window.close();}</script>");
             }
         }
         //填充数据
         var data = qtb.GetQuoteTemplate(id);
         if (data == null)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('获取数据错误!');history.go(-1);</script>");
         }
         else
         {
             var tempppp = Session["tempinfo"] as InvioceTempDto.TempContent;
             if (tempppp == null || tempppp.id != id)
             {
                 tempinfo.id   = data.id;
                 tempinfo.name = data.name;
                 //五大部分
                 tempinfo.head   = data.page_header_html;  //页眉
                 tempinfo.top    = data.quote_header_html; //头部
                 tempinfo.body   = data.body_html;         //主体
                 tempinfo.bottom = data.quote_footer_html; //底部
                 tempinfo.foot   = data.page_footer_html;  //页脚
                 //bottom税相关
                 tempinfo.tax_cat   = data.show_tax_cate;
                 tempinfo.tax_group = data.show_each_tax_in_tax_group;
                 tempinfo.tax_sup   = data.show_tax_cate_superscript;
                 //body分组
                 tempinfo.body_group_by            = data.body_group_by_id == null ? 0 : (int)data.body_group_by_id;
                 tempinfo.body_itemize_id          = data.body_itemize_id == null ? 0 : (int)data.body_itemize_id;
                 tempinfo.body_order_by            = data.body_order_by_id == null ? 0 : (int)data.body_order_by_id;
                 tempinfo.show_labels_when_grouped = data.show_labels_when_grouped == null ? 0 : (int)data.show_labels_when_grouped;
                 //bottom 合计
                 if (data.tax_total_disp != null || !string.IsNullOrEmpty(data.tax_total_disp))
                 {
                     tempinfo.Invoice_text = data.tax_total_disp.Replace("'", "\"");//正文主体
                 }
                 //底部备注
                 tempinfo.foot_note  = data.quote_footer_notes;
                 Session["tempinfo"] = tempinfo;
             }
             else
             {
                 tempinfo = tempppp;
             }
             //页眉
             if (!string.IsNullOrEmpty(tempinfo.head))
             {
                 this.head.Text = HttpUtility.HtmlDecode(tempinfo.head).Replace("\"", "'");
             }
             //头部
             if (!string.IsNullOrEmpty(tempinfo.top))
             {
                 this.top.Text = HttpUtility.HtmlDecode(tempinfo.top).Replace("\"", "'");
             }
             //正文body
             if (string.IsNullOrEmpty(tempinfo.body))
             {
                 //填充默认
                 StringBuilder sb = new StringBuilder();
                 sb.Append("<table class='ReadOnlyGrid_Table'>");
                 sb.Append("<tr>");
                 sb.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left;' width='40px;'>序列号</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>条目创建日期</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Left;'>类型</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>员工姓名</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>计费时间</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>数量</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>费率/成本</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>税率</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>税</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>计费总额</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>小时费率</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>角色</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>工作类型</td>");
                 sb.Append("</tr>");
                 for (int i = 0; i < 8; i++)
                 {
                     sb.Append("<tr><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td></tr>");
                 }
                 sb.Append("</table>");
                 this.body.Text = sb.ToString();
                 sb.Clear();
             }
             else
             {
                 var           Invoice_Body = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_Body>(tempinfo.body.Replace("'", "\"")); //正文主体
                 int           i            = 0;                                                                                                         //统计显示的列数
                 StringBuilder table        = new StringBuilder();
                 table.Append("<table class='ReadOnlyGrid_Table'>");
                 table.Append("<tr>");
                 foreach (var coulmn in Invoice_Body.GRID_COLUMN)//获取需要显示的列名
                 {
                     if (coulmn.Display == "yes")
                     {
                         table.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left; '>" + coulmn.Column_label + "</td>");
                         i++;
                     }
                 }
                 table.Append("</tr>");
                 for (int j = 0; j < 8; j++)
                 {
                     table.Append("<tr>");
                     foreach (var coulmn in Invoice_Body.GRID_COLUMN)//获取需要显示的列名
                     {
                         if (coulmn.Display == "yes" && coulmn.Column_Content != "条目描述")
                         {
                             table.Append("<td style='text-align: Left;' class='bord'>" + coulmn.Column_Content + "</td>");
                         }
                         if (coulmn.Display == "yes" && coulmn.Column_Content == "条目描述")
                         {
                             table.Append("<td style='text-align: Left;'class='bord'>" + Invoice_Body.CUSTOMIZE_THE_ITEM_COLUMN[j].Display_Format + "</td>");
                         }
                         if (Invoice_Body.GRID_OPTIONS[0].Show_vertical_lines == "yes")
                         {
                             Response.Write("<style>.bord{border-left: 1px solid  #eaeaea;border-right: 1px solid #eaeaea;}</style>");
                         }
                     }
                     table.Append("</tr>");
                 }
                 table.Append("</table>");
                 this.body.Text = table.ToString();
                 table.Clear();
             }
             //底部
             if (!string.IsNullOrEmpty(tempinfo.bottom))
             {
                 this.bottom.Text = HttpUtility.HtmlDecode(tempinfo.bottom.ToString()).Replace("\"", "'");
             }
             //页脚
             if (!string.IsNullOrEmpty(tempinfo.foot))
             {
                 this.foot.Text = HttpUtility.HtmlDecode(tempinfo.foot.ToString()).Replace("\"", "'");
             }
         }
     }
 }
Esempio n. 18
0
        private void save()
        {
            QuoteTemplateBLL qtbll = new QuoteTemplateBLL();
            var sqt = qtbll.GetQuoteTemplate(id);

            if (sqt == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('获取数据错误!');history.go(-1);</script>");
            }
            //sys_quote_tmpl sqt = new sys_quote_tmpl();
            if (Session["page_head"] != null)
            {
                sqt.page_header_html = Session["page_head"].ToString();
            }
            if (Session["quote_head"] != null)
            {
                sqt.quote_header_html = Session["quote_head"].ToString();
            }
            if (Session["quote_body"] != null)
            {
                sqt.body_html = Session["quote_body"].ToString();
            }
            if (Session["quote_foot"] != null)
            {
                sqt.quote_footer_html = Session["quote_foot"].ToString();
            }
            if (Session["page_foot"] != null)
            {
                sqt.page_footer_html = Session["page_foot"].ToString();
            }
            if (Session["page_appendix"] != null)
            {
                sqt.quote_footer_notes = Session["page_appendix"].ToString();
            }

            //if (Session["copy"] != null)
            //{
            //    string name = Session["copy"].ToString();
            //    Session.Remove("copy");
            //    //保存副本
            //    //sqt.id = (int)(_dal.GetNextIdCom());
            //    sqt.is_system = 0;
            //    sqt.is_default = 0;
            //    sqt.name = name+sqt.name+Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            //    var result = qtbll.Add(sqt, GetLoginUserId(), out id);
            //    if (result == ERROR_CODE.SUCCESS)                    //
            //    {
            //        //id  获取副本插入时的id
            //        Response.Write("<script>alert('报价模板副本成功添加成功!');</script>");  //  刷新页面
            //    }
            //    else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
            //    {
            //        Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
            //        Response.Redirect("Login.aspx");
            //    }
            //}
            //else
            //{
            //更新保存
            var result = qtbll.update(sqt, GetLoginUserId());

            if (result == ERROR_CODE.SUCCESS)                           // 更新用户成功,刷新前一个页面
            {
                Response.Write("<script>alert('报价模板修改成功!');</script>"); //  关闭添加页面的同时,刷新父页面
            }
            else if (result == ERROR_CODE.USER_NOT_FIND)                // 用户丢失
            {
                Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                Response.Redirect("Login.aspx");
            }
            //}
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request.QueryString["id"]);
            op = Request.QueryString["op"];
            switch (op)
            {
            case "head": opop = "页眉"; break;

            case "top": opop = "头部"; break;

            case "foot": opop = "页脚"; break;

            case "appendix": opop = "附录"; break;
            }
            if (!IsPostBack)
            {
                tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent;
                if (tempinfo != null && tempinfo.id == id)
                {
                    switch (op)
                    {
                    case "head":
                        if (!string.IsNullOrEmpty(tempinfo.head))
                        {
                            head = HttpUtility.HtmlDecode(tempinfo.head).Replace("\"", "'");
                        }
                        ; break;

                    case "top": if (!string.IsNullOrEmpty(tempinfo.top))
                        {
                            head = HttpUtility.HtmlDecode(tempinfo.top).Replace("\"", "'");
                        }
                        ; break;

                    case "foot":
                        if (!string.IsNullOrEmpty(tempinfo.foot))
                        {
                            head = HttpUtility.HtmlDecode(tempinfo.foot).Replace("\"", "'");
                        }
                        ; break;

                    case "appendix":
                        if (!string.IsNullOrEmpty(tempinfo.foot_note))
                        {
                            head = HttpUtility.HtmlDecode(tempinfo.foot).Replace("\"", "'");
                        }
                        ; break;
                    }
                }
                this.AlertVariableFilter.DataTextField  = "show";
                this.AlertVariableFilter.DataValueField = "val";
                this.AlertVariableFilter.DataSource     = new QuoteTemplateBLL().GetInvoiceVariableField();
                this.AlertVariableFilter.DataBind();
                this.AlertVariableFilter.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "显示全部变量", Selected = true
                });
                var           list = new QuoteTemplateBLL().GetAllInvoiceVariable();
                StringBuilder sb   = new StringBuilder();
                foreach (string va in list)
                {
                    sb.Append("<option class='val' ondblclick='dbclick(this);'>" + va.Replace("'", "") + "</option>");
                }
                this.VariableList.Text = sb.ToString();
            }
        }