/// <summary>
        /// 获取文件路径
        /// </summary>
        public string FileFullPath(string fileName, BillTemplate bt)
        {
            string fileType = "";

            if (bt.HisBillFileType == BillFileType.RuiLang)
            {
                fileType = ".grf";
            }
            else
            {
                fileType = ".rtf";
            }

            string filePath = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\" + bt.No + fileType;

            BP.WF.Node curNode = new BP.WF.Node(this.NodeID);
            //表单树时对存放路径进行修改
            if (curNode.FormType == NodeFormType.SheetTree)
            {
                bt.Url   = "FlowFrm\\" + this.FK_Flow + "\\" + this.NodeID + "\\" + fileName.Replace(fileType, "");
                filePath = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\FlowFrm\\" + this.FK_Flow + "\\" + this.NodeID;
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                filePath = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\FlowFrm\\" + this.FK_Flow + "\\" + this.NodeID + "\\" + fileName;
            }
            return(filePath);
        }
Exemplo n.º 2
0
        public void PrintBill(BillTemplate billTemplate)
        {
            billTemplate.Height = billTemplate.Height + 2000;
            PrintDialog printDialog = new PrintDialog();

            if (printDialog.ShowDialog() == true)
            {
                printDialog.PrintVisual(billTemplate.All, "dsada");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 打印历史结账单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Print_Click(object sender, RoutedEventArgs e)
        {
            if (grid_h.SelectedIndex < 0 || grid_h.SelectedIndex >= HList.Count)
            {
                return;
            }
            string s = BillTemplate.GenerateHisorderBill(HList[grid_h.SelectedIndex], HDList);

            BillTemplate.PrintBill(s);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 瑞郎
        /// </summary>
        /// <param name="func"></param>
        public void PrintDocV4(BillTemplate func)
        {
            IsRuiLang = true;

            Button button = new Button();

            button.OnClientClick = "return btnPreview_onclick('" + func.Url + "')";

            button.Text = "预览 '" + func.Name + "'";

            this.Pub1.Add(button);
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BillTemplates templetes = new BillTemplates();

            templetes.Retrieve(BillTemplateAttr.NodeID, this.FK_Node);
            if (templetes.Count == 0)
            {
                this.WinCloseWithMsg("当前节点上没有绑定单据模板。");
                return;
            }

            if (templetes.Count == 1)
            {
                PrintDocV3(templetes[0] as BillTemplate);
                return;
            }

            this.Pub1.AddTable();
            this.Pub1.AddCaptionLeft("请选择要打印的单据");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("单据编号");
            this.Pub1.AddTDTitle("单据名称");
            this.Pub1.AddTDTitle("打印");
            this.Pub1.AddTREnd();

            foreach (BillTemplate en in templetes)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTD(en.No);
                this.Pub1.AddTD(en.Name);
                this.Pub1.AddTD("<a href='PrintDoc.aspx?WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&FK_Bill=" + en.No + "&FK_Flow=" + this.FK_Flow + "' >打印</a>");
                this.Pub1.AddTREnd();
            }
            this.Pub1.AddTableEnd();

            if (this.FK_Bill != null)
            {
                BillTemplate templete = new BillTemplate(this.FK_Bill);

                if (templete.HisBillFileType == BillFileType.RuiLang)
                {
                    this.PrintDocV4(templete);
                }
                else
                {
                    this.PrintDocV2(templete);
                }
            }
        }
Exemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (Global.Time.Day != DateTime.Now.Day || Global.Time.Month != DateTime.Now.Month || Global.Time.Year != DateTime.Now.Year)
            {
                //MessageBox.Show("Hoba");
                Global.BillNo = 1;
            }
            else
            {
                Global.BillNo++;
            }


            Global.Time = DateTime.Now;
            BillTemplate BillTemplate = new BillTemplate();

            BillTemplate.Session         = new Dictionary <string, object>();
            BillTemplate.Session["Bill"] = new BillModel();

            BillTemplate.Initialize();

            webBrowser1.DocumentText = BillTemplate.TransformText();


            businesslayer bl = new businesslayer();


            foreach (DataGridViewRow row in CartTable.Rows)
            {
                if (!row.IsNewRow)
                {
                    bl.Buy(Global.Time, row.Cells["CustomerSSN"].Value.ToString(), row.Cells["MobileSerial"].Value.ToString(), row.Cells["ModName"].Value.ToString(), row.Cells["ModSellPrice"].Value.ToString());
                }
            }

            bl.insertBill();
            MySqlDataReader dr    = bl.Select("all", "cart", "", "");
            DataTable       table = new DataTable();

            if (dr != null)
            {
                table.Load(dr);
                if (table != null)
                {
                    CartTable.DataSource = table;
                }
            }
        }
 public void PrintBill(BillTemplate parameter)
 {
     try
     {
         PrintDialog printDialog = new PrintDialog();
         if (printDialog.ShowDialog() == true)
         {
             parameter.btnPrint.Visibility = Visibility.Hidden;
             printDialog.PrintVisual(parameter.grdPrint, "Bill");
         }
     }
     finally
     {
         parameter.btnPrint.Visibility = Visibility.Visible;
     }
 }
Exemplo n.º 8
0
        public void PrintDocV3(BillTemplate funcs)
        {
            switch (funcs.HisBillFileType)
            {
            case BillFileType.Word:
            case BillFileType.Excel:
                PrintDocV2(funcs);
                break;

            case BillFileType.RuiLang:
                PrintDocV4(funcs);
                break;

            default:
                break;
            }
        }
        void btn_Del_Click(object sender, EventArgs e)
        {
            BillTemplate t = new BillTemplate();

            t.No = this.RefNo;
            t.Delete();

            #region 更新节点信息。
            BP.WF.Node    nd      = new BP.WF.Node(this.NodeID);
            string        Billids = "";
            BillTemplates tmps    = new BillTemplates(nd);
            foreach (BillTemplate tmp in tmps)
            {
                Billids += "@" + tmp.No;
            }
            nd.HisBillIDs = Billids;
            nd.Update();
            #endregion 更新节点信息。
            this.Response.Redirect("Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID, true);
        }
Exemplo n.º 10
0
        void btn_Click(object sender, EventArgs e)
        {
            HtmlInputFile file = this.Ucsys1.FindControl("f") as HtmlInputFile;
            BillTemplate  bt   = new BillTemplate();

            bt.NodeID = this.NodeID;
            BP.WF.Node nd = new BP.WF.Node(this.NodeID);
            if (this.RefNo != null)
            {
                bt.No = this.RefNo;
                bt.Retrieve();
                bt             = this.Ucsys1.Copy(bt) as BillTemplate;
                bt.NodeID      = this.NodeID;
                bt.FK_BillType = this.Ucsys1.GetDDLByID("DDL_BillType").SelectedItemStringVal;
                if (file.Value == null || file.Value.Trim() == "")
                {
                    bt.Update();
                    this.Alert("保存成功");
                    return;
                }

                if (bt.HisBillFileType == BillFileType.RuiLang)
                {
                    if (file.Value.ToLower().Contains(".grf") == false)
                    {
                        this.Alert("@错误,非法的 grf 格式文件。");
                        return;
                    }
                }
                else
                {
                    if (file.Value.ToLower().Contains(".rtf") == false)
                    {
                        this.Alert("@错误,非法的 rtf 格式文件。");
                        return;
                    }
                }
                string temp     = "";
                string tempName = "";
                if (bt.HisBillFileType == BillFileType.RuiLang)
                {
                    tempName = "Temp.grf";
                    temp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.grf";
                    file.PostedFile.SaveAs(temp);
                }
                else
                {
                    tempName = "Temp.rtf";
                    temp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.rtf";
                    file.PostedFile.SaveAs(temp);
                }



                //检查文件是否正确。
                try
                {
                    string[] paras = BP.DA.Cash.GetBillParas_Gener(tempName, nd.HisFlow.HisGERpt.EnMap.Attrs);
                }
                catch (Exception ex)
                {
                    this.Ucsys2.AddMsgOfWarning("错误信息", ex.Message);
                    return;
                }
                string fullFile = FileFullPath(file.PostedFile.FileName, bt);//BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\" + bt.No + ".rtf";
                System.IO.File.Copy(temp, fullFile, true);
                bt.Update();
                return;
            }
            bt = this.Ucsys1.Copy(bt) as BillTemplate;

            if (file.Value != null)
            {
                if (bt.HisBillFileType == BillFileType.RuiLang)
                {
                    if (file.Value.ToLower().Contains(".grf") == false)
                    {
                        this.Alert("@错误,非法的 grf 格式文件。");
                        // this.Alert("@错误,非法的 rtf 格式文件。");
                        return;
                    }
                }
                else
                {
                    if (file.Value.ToLower().Contains(".rtf") == false)
                    {
                        this.Alert("@错误,非法的 rtf 格式文件。");
                        // this.Alert("@错误,非法的 rtf 格式文件。");
                        return;
                    }
                }
            }
            else
            {
                this.Alert("请上传文件。");
                // this.Alert("@错误,非法的 rtf 格式文件。");
                return;
            }

            /* 如果包含这二个字段。*/
            string fileName = file.PostedFile.FileName;

            fileName = fileName.Substring(fileName.LastIndexOf("\\") + 1);
            if (bt.Name == "")
            {
                bt.Name = fileName.Replace(".rtf", "");
                bt.Name = fileName.Replace(".grf", "");
            }

            try
            {
                bt.No = BP.Tools.chs2py.convert(bt.Name);
                if (bt.IsExits)
                {
                    bt.No = bt.No + "." + BP.DA.DBAccess.GenerOID().ToString();
                }
            }
            catch
            {
                bt.No = BP.DA.DBAccess.GenerOID().ToString();
            }
            string tmp     = "";
            string tmpName = "";

            if (bt.HisBillFileType == BillFileType.RuiLang)
            {
                tmpName = "Temp.grf";
                tmp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.grf";
                file.PostedFile.SaveAs(tmp);
            }
            else
            {
                tmpName = "Temp.rtf";
                tmp     = BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\Temp.rtf";
                file.PostedFile.SaveAs(tmp);
            }


            //检查文件是否正确。
            try
            {
                string[] paras1 = BP.DA.Cash.GetBillParas_Gener(tmpName, nd.HisFlow.HisGERpt.EnMap.Attrs);
            }
            catch (Exception ex)
            {
                this.Ucsys2.AddMsgOfWarning("Error:", ex.Message);
                return;
            }

            string fullFile1 = FileFullPath(fileName, bt);//BP.Sys.SystemConfig.PathOfCyclostyleFile + "\\" + bt.No + ".rtf";

            System.IO.File.Copy(tmp, fullFile1, true);
            // file.PostedFile.SaveAs(fullFile1);
            bt.FK_BillType = this.Ucsys1.GetDDLByID("DDL_BillType").SelectedItemStringVal;
            bt.Insert();

            #region 更新节点信息。
            string        Billids = "";
            BillTemplates tmps    = new BillTemplates(nd);
            foreach (BillTemplate Btmp in tmps)
            {
                Billids += "@" + Btmp.No;
            }
            nd.HisBillIDs = Billids;
            nd.Update();
            #endregion 更新节点信息。

            this.Response.Redirect("Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID, true);
        }
Exemplo n.º 11
0
        public void PrintDoc(BillTemplate en)
        {
            Node nd = new Node(this.FK_Node);
            Work wk = nd.HisWork;

            wk.OID = this.WorkID;
            wk.Retrieve();
            string msg  = "";
            string file = DataType.CurrentYear + "_" + WebUser.FK_Dept + "_" + en.No + "_" + this.WorkID + ".doc";

            BP.Pub.RTFEngine rtf = new BP.Pub.RTFEngine();
            //        Works works;
            string[] paths;
            string   path;

            try
            {
                #region 生成单据
                rtf.HisEns.Clear();
                rtf.EnsDataDtls.Clear();
                rtf.AddEn(wk);
                rtf.ensStrs += ".ND" + wk.NodeID;
                ArrayList al = wk.GetDtlsDatasOfArrayList();
                foreach (Entities ens in al)
                {
                    rtf.AddDtlEns(ens);
                }

                BP.Sys.GEEntity ge = new BP.Sys.GEEntity("ND" + int.Parse(nd.FK_Flow) + "Rpt");
                ge.Copy(wk);
                rtf.HisGEEntity = ge;

                paths = file.Split('_');
                path  = paths[0] + "/" + paths[1] + "/" + paths[2] + "/";

                path = BP.WF.Glo.FlowFileBill + DataType.CurrentYear + "\\" + WebUser.FK_Dept + "\\" + en.No + "\\";
                if (System.IO.Directory.Exists(path) == false)
                {
                    System.IO.Directory.CreateDirectory(path);
                }
                // rtf.ensStrs = ".ND";
                rtf.MakeDoc(en.Url + ".rtf",
                            path, file, en.ReplaceVal, false);
                #endregion

                #region 转化成pdf.
                if (en.HisBillFileType == BillFileType.PDF)
                {
                    string rtfPath = path + file;
                    string pdfPath = rtfPath.Replace(".doc", ".pdf");
                    try
                    {
                        BP.WF.Glo.Rtf2PDF(rtfPath, pdfPath);

                        file = file.Replace(".doc", ".pdf");
                        System.IO.File.Delete(rtfPath);

                        file = file.Replace(".doc", ".pdf");
                        //System.IO.File.Delete(rtfPath);
                    }
                    catch (Exception ex)
                    {
                        msg += ex.Message;
                    }
                }
                #endregion

                string url = BP.WF.Glo.CCFlowAppPath + "DataUser/Bill/" + DataType.CurrentYear + "/" + WebUser.FK_Dept + "/" + en.No + "/" + file;
                this.Response.Redirect(url, false);
                //         BP.Sys.PubClass.OpenWordDocV2( path+file, en.Name);
            }
            catch (Exception ex)
            {
                BP.WF.DTS.InitBillDir dir = new BP.WF.DTS.InitBillDir();
                dir.Do();
                path = BP.WF.Glo.FlowFileBill + DataType.CurrentYear + "\\" + WebUser.FK_Dept + "\\" + en.No + "\\";
                string msgErr = "@生成单据失败,请让管理员检查目录设置 [" + BP.WF.Glo.FlowFileBill + "]。@Err:" + ex.Message + " @File=" + file + " @Path:" + path;
                throw new Exception(msgErr + "@其它信息:" + ex.Message);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 结账按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            int PayChannel = 0;

            switch (PayTypeString)
            {
            case PayType.微信:
                PayCodeString = tbxWx.Text.Trim();
                PayChannel    = 1;
                break;

            case PayType.支付宝:
                PayCodeString = tbxZfb.Text.Trim();
                PayChannel    = 2;
                break;

            case PayType.积分:
                PayCodeString = tbxJf.Text.Trim();
                PayChannel    = 3;
                break;

            default:
                PayCodeString = string.Empty;
                PayChannel    = 0;
                break;
            }

            if (PayChannel == 0 && tbxMoney.Text.Length > 8)
            {
                MessageBox.Show("输入有误,请重新输入!");
                tbxMoney.Text = string.Empty;
                return;
            }

            if (PayChannel > 0 && string.IsNullOrEmpty(PayCodeString))
            {
                MessageBox.Show(string.Format("请输入{0}付款码!", PayTypeString));
                return;
            }

            MsgArgs arg = new MsgArgs();

            arg.Extra.Add("PayCode", PayCodeString);
            arg.Extra.Add("PayType", PayTypeString);
            arg.Extra.Add("PayChannel", PayChannel);

            //支付中...
            grid_doing.Visibility = Visibility.Visible;
            Task <MsgArgs> task = Task.Factory.StartNew(() =>
            {
                MsgArgs msg = OK(arg) as MsgArgs;
                return(msg);
            });
            Task t = task.ContinueWith((a) =>
            {
                MsgArgs message = a.Result;
                if (message.Code != MsgCode.Succ)
                {//支付失败...
                    grid_doing.Visibility = Visibility.Collapsed;
                    MessageBox.Show(message.ErrMessage);
                    if (PayChannel == 0)
                    {
                        tbxMoney.Focus();
                    }
                    else if (PayChannel == 1)
                    {
                        tbxWx.Text = string.Empty;
                        tbxWx.Focus();
                    }
                    else if (PayChannel == 2)
                    {
                        tbxZfb.Text = string.Empty;
                        tbxZfb.Focus();
                    }
                    else if (PayChannel == 3)
                    {
                        tbxJf.Text = string.Empty;
                        tbxJf.Focus();
                    }
                    return;
                }
                //支付成功...
                grid_doing.Visibility = Visibility.Collapsed;
                grid_succ.Visibility  = Visibility.Visible;
                BillTemplate.PrintBill(message.Content);
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "节点单据设计";   //"节点单据设计";
            switch (this.DoType)
            {
            case "Edit":
                BillTemplate bk1 = new BillTemplate(this.RefNo);
                bk1.NodeID = this.NodeID;
                this.DoNew(bk1);
                return;

            case "New":
                BillTemplate bk = new BillTemplate();
                bk.NodeID = this.RefOID;
                this.DoNew(bk);
                return;

            case "EditType":
                EditTypes();
                return;

            default:
                break;
            }

            BillTemplates Bills = new BillTemplates(this.NodeID);

            if (Bills.Count == 0)
            {
                this.Response.Redirect("Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=New", true);
                return;
            }

            BP.WF.Node nd = new BP.WF.Node(this.NodeID);
            this.Title = nd.Name + " - " + "单据管理";  //单据管理
            this.Ucsys1.AddTable();
            if (this.RefNo == null)
            {
                this.Ucsys1.AddCaptionLeft("<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=New'><img src='/WF/Img/Btn/New.gif' border=0/>新建</a> -<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=EditType'><img src='/WF/Img/Btn/Edit.gif' border=0/>类别维护</a>");
            }
            this.Ucsys1.AddTR();
            this.Ucsys1.AddTDTitle("IDX");
            this.Ucsys1.AddTDTitle("编号");
            this.Ucsys1.AddTDTitle("名称");
            this.Ucsys1.AddTDTitle("操作");
            this.Ucsys1.AddTREnd();
            int i = 0;

            foreach (BillTemplate Bill in Bills)
            {
                i++;
                this.Ucsys1.AddTR();
                this.Ucsys1.AddTDIdx(i);

                this.Ucsys1.AddTD(Bill.No);
                this.Ucsys1.AddTD("<img src='/WF/Img/Btn/Word.gif' >" + Bill.Name);
                this.Ucsys1.AddTD("<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=Edit&RefNo=" + Bill.No + "'><img src='/WF/Img/Btn/Edit.gif' border=0/编辑/a>|<a href='../../DataUser/CyclostyleFile/" + Bill.No + ".rtf'><img src='/WF/Img/Btn/save.gif' border=0/> 模板下载</a>");
                this.Ucsys1.AddTREnd();
            }
            this.Ucsys1.AddTableEnd();
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "节点单据设计"; //"节点单据设计";
            switch (this.DoType)
            {
            case "Edit":
                BillTemplate bk1 = new BillTemplate(this.RefNo);
                bk1.NodeID = this.NodeID;
                this.DoNew(bk1);
                return;

            case "New":
                BillTemplate bk = new BillTemplate();
                bk.NodeID = this.RefOID;
                this.DoNew(bk);
                return;

            case "EditType":
                EditTypes();
                return;

            default:
                break;
            }

            BillTemplates Bills = new BillTemplates(this.NodeID);

            if (Bills.Count == 0)
            {
                this.Response.Redirect("Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=New", true);
                return;
            }

            BP.WF.Node nd = new BP.WF.Node(this.NodeID);
            this.Title = nd.Name + " - " + "单据管理";  //单据管理
            this.Ucsys1.AddTable();
            if (this.RefNo == null)
            {
                this.Ucsys1.AddCaptionLeft("<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=New'><img src='../Img/Btn/New.gif' border=0/>新建</a> -<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=EditType'><img src='../Img/Btn/Edit.gif' border=0/>类别维护</a>");
            }
            this.Ucsys1.AddTR();
            this.Ucsys1.AddTDTitle("IDX");
            this.Ucsys1.AddTDTitle("编号");
            this.Ucsys1.AddTDTitle("名称");
            this.Ucsys1.AddTDTitle("操作");
            this.Ucsys1.AddTREnd();
            int i = 0;

            foreach (BillTemplate Bill in Bills)
            {
                i++;
                this.Ucsys1.AddTR();
                this.Ucsys1.AddTDIdx(i);

                this.Ucsys1.AddTD(Bill.No);
                string fileUrl = "";
                //../WorkOpt/GridEdit.aspx?grf=" +Bill.Url + ".grf&t="+DateTime.Now.ToString("yyMMddhh:mm:ss")+" target='_blank'
                if (Bill.HisBillFileType == BillFileType.RuiLang)
                {
                    string name = Bill.Url;

                    name = name.Replace('\\', '-');

                    //if (name.Split('\\').Count() > 2)
                    //{
                    //    string tempName = "";
                    //    foreach (string single in name.Split('\\'))
                    //    {
                    //        tempName += single + "-";
                    //    }
                    //    name = tempName.Substring(0, tempName.Length - 1);
                    //}
                    fileUrl = "<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID +
                              "&DoType=Edit&RefNo=" + Bill.No +
                              "'><img src='../Img/Btn/Edit.gif' border=0/编辑/a>|<a href='../../../DataUser/CyclostyleFile/" +
                              Bill.Url + ".grf'><img src='../Img/Btn/Save.gif' border=0/> 模板下载</a>|<a href='javascript:openEidt(\"" + name + "\")'  ><img src='../Img/Btn/Edit.gif' />编辑模版</a>";
                }
                else
                {
                    fileUrl = "<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID +
                              "&DoType=Edit&RefNo=" + Bill.No +
                              "'><img src='../Img/Btn/Edit.gif' border=0/编辑/a>|<a href='../../DataUser/CyclostyleFile/" +
                              Bill.Url + ".rtf'><img src='../Img/Btn/save.gif' border=0/> 模板下载</a>";
                }
                this.Ucsys1.AddTD("<img src='../Img/Btn/Word.gif' >" + Bill.Name);
                this.Ucsys1.AddTD(fileUrl);
                this.Ucsys1.AddTREnd();
            }
            this.Ucsys1.AddTableEnd();
        }
Exemplo n.º 15
0
        /// <summary>
        /// 打印单据
        /// </summary>
        /// <param name="func"></param>
        public void PrintDocV2(BillTemplate func)
        {
            string billInfo = "";
            Node   nd       = new Node(this.FK_Node);
            Work   wk       = nd.HisWork;

            wk.OID = this.WorkID;
            wk.Retrieve();
            wk.ResetDefaultVal();

            string file = DateTime.Now.Year + "_" + WebUser.FK_Dept + "_" + func.No + "_" + WorkID + ".doc";

            BP.Pub.RTFEngine rtf = new BP.Pub.RTFEngine();

            string[] paths;
            string   path;

            try
            {
                #region 生成单据
                rtf.HisEns.Clear();
                rtf.EnsDataDtls.Clear();
                if (func.NodeID == 0)
                {
                }
                else
                {
                    //WorkNodes wns = new WorkNodes();
                    //if (nd.HisRunModel == RunModel.FL
                    //    || nd.HisRunModel == RunModel.FHL
                    //    || nd.HisRunModel == RunModel.HL)
                    //    wns.GenerByFID(nd.HisFlow, this.WorkID);
                    //else
                    //    wns.GenerByWorkID(nd.HisFlow, this.WorkID);

                    //把流程主表数据放入里面去.
                    GEEntity ndxxRpt = new GEEntity("ND" + int.Parse(nd.FK_Flow) + "Rpt");
                    ndxxRpt.PKVal = this.WorkID;
                    ndxxRpt.Retrieve();
                    ndxxRpt.Copy(wk);

                    //把数据赋值给wk.
                    wk.Row          = ndxxRpt.Row;
                    rtf.HisGEEntity = wk;

                    //加入他的明细表.
                    List <Entities> al = wk.GetDtlsDatasOfList();
                    foreach (Entities ens in al)
                    {
                        rtf.AddDtlEns(ens);
                    }

                    //rtf.AddEn(wk);
                    ////if (wns.Count == 0)
                    ////    works = nd.HisWorks;
                    ////else
                    ////    works = wns.GetWorks;
                    //foreach (Work mywk in works)
                    //{
                    //    if (mywk.OID == 0)
                    //        continue;
                    //    rtf.AddEn(mywk);
                    //    rtf.ensStrs += ".ND" + mywk.NodeID;
                    //}
                }

                paths = file.Split('_');
                path  = paths[0] + "/" + paths[1] + "/" + paths[2] + "/";

                string billUrl = BP.WF.Glo.CCFlowAppPath + "DataUser/Bill/" + path + file;

                if (func.HisBillFileType == BillFileType.PDF)
                {
                    billUrl   = billUrl.Replace(".doc", ".pdf");
                    billInfo += "<img src='/WF/Img/FileType/PDF.gif' /><a href='" + billUrl + "' target=_blank >" + func.Name + "</a>";
                }
                else
                {
                    billInfo += "<img src='/WF/Img/FileType/doc.gif' /><a href='" + billUrl + "' target=_blank >" + func.Name + "</a>";
                }

                path = BP.WF.Glo.FlowFileBill + DateTime.Now.Year + "\\" + WebUser.FK_Dept + "\\" + func.No + "\\";
                //  path = Server.MapPath(path);
                if (System.IO.Directory.Exists(path) == false)
                {
                    System.IO.Directory.CreateDirectory(path);
                }

                rtf.MakeDoc(func.Url + ".rtf",
                            path, file, func.ReplaceVal, false);
                #endregion

                #region 转化成pdf.
                if (func.HisBillFileType == BillFileType.PDF)
                {
                    string rtfPath = path + file;
                    string pdfPath = rtfPath.Replace(".doc", ".pdf");
                    try
                    {
                        BP.WF.Glo.Rtf2PDF(rtfPath, pdfPath);
                    }
                    catch (Exception ex)
                    {
                        billInfo = ex.Message;
                        //this.addMsg("RptError", "产生报表数据错误:" + ex.Message);
                    }
                }
                #endregion

                #region 保存单据
                Bill bill = new Bill();
                bill.MyPK        = wk.FID + "_" + wk.OID + "_" + nd.NodeID + "_" + func.No;
                bill.FID         = wk.FID;
                bill.WorkID      = wk.OID;
                bill.FK_Node     = wk.NodeID;
                bill.FK_Dept     = WebUser.FK_Dept;
                bill.FK_Emp      = WebUser.No;
                bill.Url         = billUrl;
                bill.RDT         = DataType.CurrentDataTime;
                bill.FullPath    = path + file;
                bill.FK_NY       = DataType.CurrentYearMonth;
                bill.FK_Flow     = nd.FK_Flow;
                bill.FK_BillType = func.FK_BillType;
                bill.Emps        = rtf.HisGEEntity.GetValStrByKey("Emps");
                bill.FK_Starter  = rtf.HisGEEntity.GetValStrByKey("Rec");
                bill.StartDT     = rtf.HisGEEntity.GetValStrByKey("RDT");
                bill.Title       = rtf.HisGEEntity.GetValStrByKey("Title");
                bill.FK_Dept     = rtf.HisGEEntity.GetValStrByKey("FK_Dept");
                try
                {
                    bill.Save();
                }
                catch
                {
                    bill.Update();
                }
                #endregion
            }
            catch (Exception ex)
            {
                BP.WF.DTS.InitBillDir dir = new BP.WF.DTS.InitBillDir();
                dir.Do();
                path = BP.WF.Glo.FlowFileBill + DateTime.Now.Year + "\\" + WebUser.FK_Dept + "\\" + func.No + "\\";
                string msgErr = "@" + string.Format("生成单据失败,请让管理员检查目录设置") + "[" + BP.WF.Glo.FlowFileBill + "]。@Err:" + ex.Message + " @File=" + file + " @Path:" + path;
                billInfo += "@<font color=red>" + msgErr + "</font>";
                throw new Exception(msgErr + "@其它信息:" + ex.Message);
            }

            this.Pub1.AddFieldSet("打印单据");
            this.Pub1.AddUL();
            this.Pub1.AddLi(billInfo);
            this.Pub1.AddULEnd();
            this.Pub1.AddFieldSetEnd();
            return;
        }
Exemplo n.º 16
0
        public void DoNew(BillTemplate bill)
        {
            this.Ucsys1.Clear();
            BP.WF.Node nd = new BP.WF.Node(this.NodeID);
            this.Ucsys1.AddTable();
            this.Ucsys1.AddCaptionLeft("<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "' >" + "返回" + "</a> - <a href=Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=New ><img  border=0 src='../Img/Btn/New.gif' />新建</a>");
            this.Ucsys1.AddTR();
            this.Ucsys1.AddTDTitle("项目");
            this.Ucsys1.AddTDTitle("输入");
            this.Ucsys1.AddTDTitle("备注");
            this.Ucsys1.AddTREnd();

            this.Ucsys1.AddTR();
            this.Ucsys1.AddTD("单据类型"); // 单据/单据名称
            DDL ddl = new DDL();

            ddl.ID = "DDL_BillType";

            BP.WF.Data.BillTypes ens = new BillTypes();
            ens.RetrieveAllFromDBSource();

            if (ens.Count == 0)
            {
                BP.WF.Data.BillType enB = new BillType();
                enB.Name    = "新建类型" + "1";
                enB.FK_Flow = this.FK_Flow;
                enB.No      = "01";
                enB.Insert();
                ens.AddEntity(enB);
            }

            ddl.BindEntities(ens);
            ddl.SetSelectItem(bill.FK_BillType);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "&DoType=EditType'><img src='../Img/Btn/Edit.gif' border=0/>类别维护</a>");
            this.Ucsys1.AddTREnd();

            this.Ucsys1.AddTR();
            this.Ucsys1.AddTD("编号");
            TB tb = new TB();

            tb.ID      = "TB_No";
            tb.Text    = bill.No;
            tb.Enabled = false;
            if (tb.Text == "")
            {
                tb.Text = "系统自动生成";
            }

            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTD("");
            this.Ucsys1.AddTREnd();

            this.Ucsys1.AddTR();
            this.Ucsys1.AddTD("名称"); // 单据/单据名称
            tb         = new TB();
            tb.ID      = "TB_Name";
            tb.Text    = bill.Name;
            tb.Columns = 40;
            this.Ucsys1.AddTD("colspan=2", tb);
            this.Ucsys1.AddTREnd();

            this.Ucsys1.AddTR();
            this.Ucsys1.AddTD("生成的文件类型"); // 单据/单据名称
            ddl    = new DDL();
            ddl.ID = "DDL_BillFileType";
            ddl.BindSysEnum("BillFileType");
            ddl.SetSelectItem((int)bill.HisBillFileType);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("目前不支持excel,html格式.");
            this.Ucsys1.AddTREnd();

            this.Ucsys1.AddTR();
            this.Ucsys1.AddTD("单据模板");
            HtmlInputFile file = new HtmlInputFile();

            file.ID = "f";
            file.Attributes["width"] = "100%";
            this.Ucsys1.AddTD("colspan=2", file);
            this.Ucsys1.AddTREnd();

            this.Ucsys1.AddTRSum();
            this.Ucsys1.Add("<TD class=TD colspan=3 align=center>");
            Button btn = new Button();

            btn.CssClass = "Btn";
            btn.ID       = "Btn_Save";
            btn.Text     = "保存";
            this.Ucsys1.Add(btn);
            btn.Click += new EventHandler(btn_Click);
            this.Ucsys1.Add(btn);
            if (bill.No.Length > 1)
            {
                btn          = new Button();
                btn.ID       = "Btn_Del";
                btn.CssClass = "Btn";
                btn.Text     = "删除"; // "删除单据";
                this.Ucsys1.Add(btn);
                btn.Attributes["onclick"] += " return confirm('您确认吗?');";
                btn.Click += new EventHandler(btn_Del_Click);
            }
            string url      = "";
            string fileType = "";

            if (bill.HisBillFileType == BillFileType.RuiLang)
            {
                fileType = "grf";
            }
            else
            {
                fileType = "rtf";
            }

            if (this.RefNo != null)
            {
                url = "<a href='../../DataUser/CyclostyleFile/" + bill.Url + "." + fileType + "'><img src='../Img/Btn/save.gif' border=0/> 模板下载</a>";
            }

            this.Ucsys1.Add(url + "</TD>");
            this.Ucsys1.AddTREnd();

            this.Ucsys1.AddTable();
        }
Exemplo n.º 17
0
        /// <summary>
        /// 结账按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OK_Click(object sender, RoutedEventArgs e)
        {
            int PayChannel = 0;

            switch (PayTypeString)
            {
            case PayType.微信:
                PayCodeString = tbxWx.Text.Trim();
                PayChannel    = 1;
                break;

            case PayType.支付宝:
                PayCodeString = tbxZfb.Text.Trim();
                PayChannel    = 2;
                break;

            case PayType.积分:
                PayCodeString = tbxJf.Text.Trim();
                PayChannel    = 3;
                break;

            default:
                PayCodeString = string.Empty;
                PayChannel    = 0;
                break;
            }

            if (PayChannel == 0 && tbxMoney.Text.Length > 8)
            {
                MessageBox.Show("输入有误,请重新输入!");
                tbxMoney.Text = string.Empty;
                return;
            }

            if (PayChannel > 0 && string.IsNullOrEmpty(PayCodeString))
            {
                MessageBox.Show(string.Format("请输入{0}付款码!", PayTypeString));
                return;
            }

            MsgArgs arg = new MsgArgs();

            arg.Extra.Add("PayCode", PayCodeString);
            arg.Extra.Add("PayType", PayTypeString);
            arg.Extra.Add("PayChannel", PayChannel);

            //支付中...
            grid_doing.Visibility = Visibility.Visible;

            //用线程处理
            MsgArgs message = await Task.Run(() =>
            {
                MsgArgs msg = OK(arg) as MsgArgs;
                return(msg);
            });

            if (message.Code != MsgCode.Succ)
            {//支付失败...
                grid_doing.Visibility = Visibility.Collapsed;
                MessageBox.Show(message.ErrMessage);
                if (PayChannel == 0)
                {
                    tbxMoney.Focus();
                }
                else if (PayChannel == 1)
                {
                    tbxWx.Text = string.Empty;
                    tbxWx.Focus();
                }
                else if (PayChannel == 2)
                {
                    tbxZfb.Text = string.Empty;
                    tbxZfb.Focus();
                }
                else if (PayChannel == 3)
                {
                    tbxJf.Text = string.Empty;
                    tbxJf.Focus();
                }
                return;
            }
            //支付成功...
            BillTemplate.PrintBill(message.Content);
            grid_doing.Visibility = Visibility.Collapsed;
            grid_succ.Visibility  = Visibility.Visible;
        }