Example #1
0
        protected void Save(object sender, EventArgs e)
        {
            string tt = Request.Form["data"].Trim().ToString().Replace("\"", "'");

            tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent;
            switch (op)
            {
            case "head": tempinfo.head = tt;; break;

            case "top": tempinfo.top = tt;; break;

            case "foot": tempinfo.foot = tt;; break;
            }
            Session["tempinfo"] = tempinfo;
            Session["cancel"]   = 1;
            Response.Redirect("InvoiceTempEdit.aspx?id=" + id + "&op=edit");
        }
Example #2
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();
     }
 }
Example #3
0
        protected void Save(object sender, EventArgs e)
        {
            string tt = Request.Form["data"].Trim().ToString().Replace("\"", "'");

            tempinfo        = Session["tempinfo"] as InvioceTempDto.TempContent;
            tempinfo.bottom = tt;
            string t = Convert.ToString(Request.Form["bottom"].ToString()).Replace(" ", "");;

            t = t.Replace("[,", "[").Replace(",]", "]");
            if (tempinfo.Invoice_text != null)
            {
                bottomttt = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext>(tempinfo.Invoice_text);
            }
            var kk = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext2>(t).item;

            bottomttt.Bottom_Item = kk;
            tempinfo.Invoice_text = new EMT.Tools.Serialize().SerializeJson(bottomttt);
            if (this.tax_sup.Checked)
            {
                tempinfo.tax_sup = 1;
            }
            else
            {
                tempinfo.tax_sup = 0;
            }
            if (this.tax_cate.Checked)
            {
                tempinfo.tax_cat = 1;
            }
            else
            {
                tempinfo.tax_cat = 0;
            }
            if (this.tax_group.Checked)
            {
                tempinfo.tax_group = 1;
            }
            else
            {
                tempinfo.tax_group = 0;
            }
            Session["tempinfo"] = tempinfo;
            Session["cancel"]   = 1;
            Response.Redirect("InvoiceTempEdit.aspx?id=" + id + "&op=edit");
        }
Example #4
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");
            }
        }
Example #5
0
        protected void Save_Click(object sender, EventArgs e)
        {
            string t = Convert.ToString(Request.Form["data"].Trim().ToString());

            t = t.Replace("[,", "[").Replace(",]", "]").Replace("\n", "");
            string tt = Convert.ToString(Request.Form["typetype"].Trim().ToString());

            tt = tt.Replace("[,", "[").Replace(",]", "]").Replace("\n", "");
            string ttt = Convert.ToString(Request.Form["typett"].Trim().ToString());

            ttt      = ttt.Replace("[,", "[").Replace(",]", "]").Replace("\n", "");
            tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent;
            if (tempinfo != null && tempinfo.id == id)
            {
                tempinfo.body_group_by   = Convert.ToInt32(this.GroupBy.SelectedValue);
                tempinfo.body_order_by   = Convert.ToInt32(this.SortBy.SelectedValue);
                tempinfo.body_itemize_id = Convert.ToInt32(this.Itemize.SelectedValue);
                if (this.ShowLabelsWhenGrouped.Checked)
                {
                    tempinfo.show_labels_when_grouped = 1;
                }
                else
                {
                    tempinfo.show_labels_when_grouped = 0;
                }
                tempinfo.body = t.Replace("\"", "'");
                if (tempinfo.Invoice_text != null && !string.IsNullOrEmpty(tempinfo.Invoice_text))
                {
                    addset = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext>(tempinfo.Invoice_text);
                }
                addset.Labour_Item         = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext2>(tt).item;
                addset.Service_Bundle_Item = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext2>(ttt).item;
                tempinfo.Invoice_text      = new EMT.Tools.Serialize().SerializeJson(addset);
                Session["tempinfo"]        = tempinfo;
            }
            Session["cancel"] = 1;
            Response.Redirect("InvoiceTempEdit.aspx?id=" + id + "&op=edit");
        }
Example #6
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("\"", "'");
             }
         }
     }
 }
Example #7
0
 protected InvioceTempDto.Invoice_ext addset   = new InvioceTempDto.Invoice_ext();//扩展字段类型
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request.QueryString["id"]);
     if (!IsPostBack)
     {
         Bind();
         tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent;
         if (tempinfo != null && tempinfo.id == id)
         {
             this.GroupBy.SelectedValue = tempinfo.body_group_by.ToString();
             this.SortBy.SelectedValue  = tempinfo.body_order_by.ToString();
             this.Itemize.SelectedValue = tempinfo.body_itemize_id.ToString();
             if (tempinfo.show_labels_when_grouped == 1)
             {
                 this.ShowLabelsWhenGrouped.Checked = true;
             }
             if (!string.IsNullOrEmpty(tempinfo.Invoice_text))
             {
                 addset = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext>(tempinfo.Invoice_text);
             }
             if (!string.IsNullOrEmpty(tempinfo.body))
             {
                 tempinfo.body = HttpUtility.HtmlDecode(tempinfo.body);
                 var invoice_body = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_Body>(tempinfo.body.Replace("'", "\""));
                 if (invoice_body != null)
                 {
                     StringBuilder html = new StringBuilder();
                     int           i    = 0;
                     html.Append(" <script>");
                     html.Append(" $(document).ready(function () { ");
                     foreach (var column in invoice_body.GRID_COLUMN)
                     {
                         html.Append("$(\".Order\").eq(" + i + ").text(\"" + column.Order + "\");");
                         html.Append("$(\".Column_Content\").eq(" + i + ").html(\"" + column.Column_Content + "\");");
                         html.Append("$(\".Column_label\").eq(" + i + ").html(\"" + column.Column_label + "\");");
                         if (column.Display == "yes")
                         {
                             html.Append("$(\".Display\").eq(" + i + ").addClass(\"CM\");");
                         }
                         i++;
                     }
                     foreach (var OPTIONS in invoice_body.GRID_OPTIONS)
                     {
                         if (OPTIONS.Show_grid_header != "yes")
                         {
                             html.Append("$(\"#ShowGridHeader\").removeAttr(\"checked\");");
                         }
                         if (OPTIONS.Show_vertical_lines == "yes")
                         {
                             html.Append("$(\"#ShowVerticalGridlines\").attr(\"checked\",'true');");
                         }
                     }
                     i = 0;
                     foreach (var ITEM_COLUMN in invoice_body.ADD_THE_ITEM_COLUMN)
                     {
                         html.Append("$(\".add_invoice_type_id\").eq(" + i + ").value=\"" + ITEM_COLUMN.Type_of_Invoice_Item_ID + "\";");
                         html.Append("$(\".add_Order\").eq(" + i + ").text(\"" + ITEM_COLUMN.Order + "\");");
                         html.Append("$(\".add_invoice_type_name\").eq(" + i + ").html(\"" + ITEM_COLUMN.Type_of_Invoice_Item + "\");");
                         html.Append("$(\".add_Display_Format\").eq(" + i + ").html(\"" + ITEM_COLUMN.Display_Format + "\");");
                         if (ITEM_COLUMN.Checked != "yes")
                         {
                             html.Append("$(\".add_Display\").eq(" + i + ").removeClass(\"checked\");");
                         }
                         else
                         {
                             html.Append("$(\".add_Display\").eq(" + i + ").addClass(\"CM\");");
                         }
                         i++;
                     }
                     i = 0;
                     foreach (var ITEM_COLUMN in invoice_body.CUSTOMIZE_THE_ITEM_COLUMN)
                     {
                         html.Append("$(\".invoice_type_id\").eq(" + i + ").val(" + ITEM_COLUMN.Type_of_Invoice_Item_ID + ");");
                         html.Append("$(\".SortOrder\").eq(" + i + ").text(\"" + ITEM_COLUMN.Order + "\");");
                         html.Append("$(\".invoice_type_name\").eq(" + i + ").html(\"" + ITEM_COLUMN.Type_of_Invoice_Item + "\");");
                         html.Append("$(\".Display_Format\").eq(" + i + ").html(\"" + ITEM_COLUMN.Display_Format + "\");");
                         html.Append("$(\".Add_Display_Format\").eq(" + i + ").html(\"" + ITEM_COLUMN.Add_Display_Format + "\");");
                         i++;
                     }
                     html.Append("});</script>");
                     this.datalist.Text = html.ToString();
                     //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", html.ToString(), true);
                     html.Clear();
                 }
             }
             else
             {
                 this.datalist.Text = "<script> $(document).ready(function () {$(\".Display\").children().addClass(\"CM\");});</script>";
             }
         }
         else
         {
             //string myScript = @"$('.Display').children().addClass('CM')";
             //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
             this.datalist.Text = "<script> $(document).ready(function () {$(\".Display\").children().addClass(\"CM\");});</script>";
         }
     }
 }
Example #8
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();
            }
        }