Ejemplo n.º 1
0
        /// <summary>
        /// AddQuestCtrl
        /// </summary>
        void AddQuestCtrl(EntityQnRecord qnRecord)
        {
            try
            {
                if (qnRecord != null)
                {
                    if (!string.IsNullOrEmpty(qnRecord.xmlData))
                    {
                        XmlDocument document = new XmlDocument();
                        document.LoadXml(qnRecord.xmlData);
                        XmlNodeList list = document["FormData"].ChildNodes;
                        xmlData = list[9].OuterXml;
                        dicData = Function.ReadXML(xmlData);
                    }
                }
                using (ProxyHms proxy = new ProxyHms())
                {
                    lstCtrlLocation = proxy.Service.GetQnCtrlLocation(lstQuest[8], qnRecord.qnId);
                    lstTopic        = new List <EntityDicQnSetting>();
                    lstItems        = new List <EntityDicQnSetting>();
                    proxy.Service.GetQnCustom(1, out lstTopic, out lstItems);
                }

                int locationX = 0;
                int locationY = 0;

                if (lstCtrlLocation != null && lstCtrlLocation.Count > 0)
                {
                    foreach (var clVo in lstCtrlLocation)
                    {
                        if (clVo.name.Contains("FM"))
                        {
                            DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel();
                            lblTopic.Name = clVo.name;
                            lblTopic.Text = clVo.text;
                            if (clVo.name == "FM0902" || clVo.name == "FM0903")
                            {
                                lblTopic.Font      = new System.Drawing.Font("宋体", 9.5F);
                                lblTopic.ForeColor = System.Drawing.Color.Red;
                                lblTopic.WidthF    = clVo.width + 10;
                            }
                            else
                            {
                                lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold);
                            }
                            locationX         = clVo.locationX;
                            locationY         = clVo.locationY;
                            lblTopic.WidthF   = clVo.width;
                            lblTopic.Location = new System.Drawing.Point(locationX, locationY);
                            this.Detail.Controls.Add(lblTopic);
                        }
                    }
                }

                List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>();
                if (lstTopic != null && lstTopic.Count > 0)
                {
                    for (int i = 0; i < lstTopic.Count; i++)
                    {
                        EntityDicQnSetting item = lstTopic[i];
                        if (item.questName == lstQuest[8])
                        {
                            if (string.IsNullOrEmpty(item.parentFieldId))
                            {
                                DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel();
                                lblTopic.Name = item.fieldId;
                                lblTopic.Text = item.fieldName;
                                lblTopic.Font = new System.Drawing.Font("宋体", 9.5F);
                                EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == item.fieldId);
                                locationX       = ctrLocat.locationX;
                                locationY       = ctrLocat.locationY;
                                lblTopic.WidthF = ctrLocat.width;
                                //lblTopic.HeightF = ctrLocat.height;
                                lblTopic.Location = new System.Drawing.Point(locationX, locationY);
                                this.Detail.Controls.Add(lblTopic);

                                lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == item.fieldId);
                                if (lstChildSettings.Count > 0)
                                {
                                    foreach (var childVo in lstChildSettings)
                                    {
                                        if (childVo.typeId != "3")
                                        {
                                            DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox();
                                            string strEndWith = childVo.fieldId.Substring(4, 2);
                                            chkAns.Text = childVo.fieldName;
                                            chkAns.Font = new System.Drawing.Font("宋体", 9.5F);
                                            chkAns.Name = childVo.fieldId;
                                            EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId);
                                            locationX    = ctrLocatChild.locationX;
                                            locationY    = ctrLocatChild.locationY;
                                            chkAns.Width = ctrLocatChild.width;
                                            //chkAns.Height = ctrLocatChild.height;
                                            chkAns.Location = new System.Drawing.Point(locationX, locationY);
                                            if (dicData.ContainsKey(childVo.fieldId))
                                            {
                                                string value = dicData[childVo.fieldId];
                                                chkAns.Checked = value == "0" ? false : true;
                                            }
                                            this.Detail.Controls.Add(chkAns);
                                        }
                                        else
                                        {
                                            DevExpress.XtraReports.UI.XRLabel txtAns = new DevExpress.XtraReports.UI.XRLabel();
                                            string strEndWith = childVo.fieldId.Substring(4, 2);
                                            txtAns.Text = childVo.fieldName;
                                            txtAns.Font = new System.Drawing.Font("宋体", 9.5F);
                                            txtAns.Name = childVo.fieldId;
                                            EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId);
                                            locationX    = ctrLocatChild.locationX;
                                            locationY    = ctrLocatChild.locationY;
                                            txtAns.Width = ctrLocatChild.width;
                                            //txtAns.Height = ctrLocatChild.height;
                                            txtAns.Location = new System.Drawing.Point(locationX, locationY);
                                            if (dicData.ContainsKey(childVo.fieldId))
                                            {
                                                string value = dicData[childVo.fieldId];
                                                txtAns.Text = value;
                                            }
                                            this.Detail.Controls.Add(txtAns);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(ex);
            }
            finally
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// AddQuestCtrl
        /// </summary>
        void AddQuestCtrl(EntityQnRecord qnRecord)
        {
            try
            {
                if (qnRecord != null)
                {
                    if (!string.IsNullOrEmpty(qnRecord.xmlData))
                    {
                        XmlDocument document = new XmlDocument();
                        document.LoadXml(qnRecord.xmlData);
                        XmlNodeList list = document["FormData"].ChildNodes;
                        xmlData = list[1].OuterXml;
                        dicData = Function.ReadXML(xmlData);
                    }
                }
                using (Biz202 biz = new Biz202())
                {
                    lstCtrlLocation = biz.GetQnCtrlLocation(lstQuest[1]);
                }

                using (Biz209 biz = new Biz209())
                {
                    lstTopic = new List <EntityDicQnSetting>();
                    lstItems = new List <EntityDicQnSetting>();
                    biz.GetQnCustom(1, out lstTopic, out lstItems);
                }
                int locationX = 0;
                int locationY = 0;

                int F35Count = 0;
                int F35Row   = (lstTopic.FindAll(r => r.fieldId.Contains("F035")).Count) / 6;
                int F35Y     = 0;
                List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>();
                if (lstTopic != null && lstTopic.Count > 0)
                {
                    for (int i = 0; i < lstTopic.Count; i++)
                    {
                        EntityDicQnSetting item = lstTopic[i];
                        if (item.questName == lstQuest[1])
                        {
                            if (item.fieldId.Contains("F035"))
                            {
                                DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox();
                                chkAns.Text = item.fieldName;
                                chkAns.Font = new System.Drawing.Font("宋体", 9.5F);
                                chkAns.Name = item.fieldId;
                                EntityCtrlLocation ctrLocat = lstCtrlLocation.FindAll(r => r.name.Contains("F035"))[F35Count];
                                locationX       = ctrLocat.locationX;
                                locationY       = ctrLocat.locationY;
                                F35Y           += locationY;
                                chkAns.Width    = ctrLocat.width;
                                chkAns.Height   = ctrLocat.height;
                                chkAns.Location = new System.Drawing.Point(locationX, locationY);
                                if (dicData.ContainsKey(item.fieldId))
                                {
                                    string value = dicData[item.fieldId];
                                    chkAns.Checked = value == "0" ? false : true;
                                }
                                this.Detail.Controls.Add(chkAns);
                                F35Count++;
                            }
                        }
                    }
                    F35Y -= 80;
                    for (int i2 = 0; i2 < lstTopic.Count; i2++)
                    {
                        EntityDicQnSetting itemVo = lstTopic[i2];
                        if (itemVo.questName == lstQuest[1])
                        {
                            if (string.IsNullOrEmpty(itemVo.parentFieldId) && !itemVo.fieldId.Contains("F035"))
                            {
                                DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel();
                                lblTopic.Name = itemVo.fieldId;
                                lblTopic.Text = itemVo.fieldName;
                                lblTopic.Font = new System.Drawing.Font("宋体", 9.5F);
                                EntityCtrlLocation ctrLocat = lstCtrlLocation.Find(r => r.name == itemVo.fieldId);
                                locationX         = ctrLocat.locationX;
                                locationY         = ctrLocat.locationY - F35Y;
                                lblTopic.Location = new System.Drawing.Point(locationX, locationY);
                                this.Detail.Controls.Add(lblTopic);

                                lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == itemVo.fieldId);
                                if (lstChildSettings.Count > 0)
                                {
                                    foreach (var childVo in lstChildSettings)
                                    {
                                        DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox();
                                        string strEndWith = childVo.fieldId.Substring(4, 2);
                                        chkAns.Text = childVo.fieldName;
                                        chkAns.Font = new System.Drawing.Font("宋体", 9.5F);
                                        chkAns.Name = childVo.fieldId;
                                        EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name == childVo.fieldId);
                                        locationX       = ctrLocatChild.locationX;
                                        locationY       = ctrLocatChild.locationY - F35Y;
                                        chkAns.Width    = ctrLocatChild.width;
                                        chkAns.Height   = ctrLocatChild.height;
                                        chkAns.Location = new System.Drawing.Point(locationX, locationY);
                                        if (dicData.ContainsKey(childVo.fieldId))
                                        {
                                            string value = dicData[childVo.fieldId];
                                            chkAns.Checked = value == "0" ? false : true;
                                        }
                                        this.Detail.Controls.Add(chkAns);
                                    }
                                }
                            }
                        }
                    }
                }

                if (lstCtrlLocation != null && lstCtrlLocation.Count > 0)
                {
                    foreach (var clVo in lstCtrlLocation)
                    {
                        DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel();
                        lblTopic.Name = clVo.name;
                        lblTopic.Text = clVo.text;
                        lblTopic.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold);
                        locationX     = clVo.locationX;
                        if (clVo.name == "FM0201")
                        {
                            locationY = clVo.locationY;
                        }
                        else if (clVo.name.Contains("FM"))
                        {
                            locationY = clVo.locationY - F35Y;
                        }
                        else
                        {
                            continue;
                        }

                        lblTopic.Location = new System.Drawing.Point(locationX, locationY);
                        this.Detail.Controls.Add(lblTopic);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(ex);
            }
            finally
            {
            }
        }
Ejemplo n.º 3
0
    private MemoryStream PrintJobSheet(string orderNo, string jobType, string tripId)
    {
        XtraReport rpt = new XtraReport();

        string path1    = string.Format("~/files/photos/");
        string path2    = path1.Replace(' ', '_').Replace('\'', '_');
        string pathx    = path2.Substring(1);
        string path3    = MapPath(path2);
        string filename = string.Format(@"{0}.jpg", orderNo);

        if (!Directory.Exists(path3))
        {
            Directory.CreateDirectory(path3);
        }
        string p = string.Format(@"~\files\photos\{0}", filename);

        string     e_file      = HttpContext.Current.Server.MapPath(p);
        DateTime   now         = DateTime.Now;
        string     file        = string.Format(@"~\html\{0}", jobType.ToUpper());
        string     htmlName    = string.Format(@"{0}.html", orderNo);
        string     httpPath    = HttpContext.Current.Request.Url.Host.ToString() + "/html/" + jobType.ToUpper() + "/" + htmlName;
        XtraReport rpt_barcode = new XtraReport();

        rpt_barcode.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\DeliveryOrder_CRA.repx"));
        rpt_barcode.DataSource = DocPrint.PrintJobSheet(orderNo, jobType, tripId);
        set_signed_barcode(rpt_barcode, orderNo, httpPath, filename);
        rpt_barcode.CreateDocument();
        rpt_barcode.ExportToImage(e_file);

        Dictionary <string, string> d = new Dictionary <string, string>();
        string http_Photo_Path        = "http://" + HttpContext.Current.Request.Url.Host.ToString() + "/files/photos/" + filename;
        string value = string.Format(@"<img src='{0}' alt=''/>", http_Photo_Path);

        d.Add("title", orderNo);
        d.Add("content", value);

        string temp = string.Format(@"~\html\template.html");


        html.CreateHtml(temp, file, htmlName, d, "");
        rpt.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\DeliveryOrder_CRA.repx"));
        string sql      = string.Format(@"select epodHardCopy from ctm_jobdet2 where Id={0}", tripId);
        string hardCopy = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql));

        if (hardCopy == "HardCopy")
        {
            rpt.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\DO_HardCopy.repx"));
        }

        set_signed_barcode_byid(rpt, orderNo, tripId, httpPath, filename);

        DataSet   set  = DocPrint.PrintJobSheet(orderNo, jobType, tripId);
        DataTable Mast = set.Tables[0].Copy();

        Mast.TableName = "Mast";
        if (Mast.Rows.Count > 0)
        {
            string epodCB1 = SafeValue.SafeString(Mast.Rows[0]["EpodCB1"]);
            string epodCB2 = SafeValue.SafeString(Mast.Rows[0]["EpodCB2"]);
            string epodCB3 = SafeValue.SafeString(Mast.Rows[0]["EpodCB3"]);
            string epodCB4 = SafeValue.SafeString(Mast.Rows[0]["EpodCB4"]);
            string epodCB5 = SafeValue.SafeString(Mast.Rows[0]["EpodCB5"]);
            string epodCB6 = SafeValue.SafeString(Mast.Rows[0]["EpodCB6"]);
            DevExpress.XtraReports.UI.DetailBand details = rpt.Report.Bands["detailBand1"] as DevExpress.XtraReports.UI.DetailBand;
            if (details != null)
            {
                DevExpress.XtraReports.UI.XRCheckBox ckb1 = details.FindControl("ckb1", false) as DevExpress.XtraReports.UI.XRCheckBox;
                if (epodCB1 == "Yes")
                {
                    ckb1.Checked = true;
                }
                DevExpress.XtraReports.UI.XRCheckBox ckb2 = details.FindControl("ckb2", false) as DevExpress.XtraReports.UI.XRCheckBox;
                if (epodCB2 == "Yes")
                {
                    ckb2.Checked = true;
                }
                DevExpress.XtraReports.UI.XRCheckBox ckb3 = details.FindControl("ckb3", false) as DevExpress.XtraReports.UI.XRCheckBox;
                if (epodCB3 == "Yes")
                {
                    ckb3.Checked = true;
                }
                DevExpress.XtraReports.UI.XRCheckBox ckb4 = details.FindControl("ckb4", false) as DevExpress.XtraReports.UI.XRCheckBox;
                if (epodCB4 == "Yes")
                {
                    ckb4.Checked = true;
                }
                DevExpress.XtraReports.UI.XRCheckBox ckb5 = details.FindControl("ckb5", false) as DevExpress.XtraReports.UI.XRCheckBox;
                if (epodCB5 == "Yes")
                {
                    ckb5.Checked = true;
                }
                DevExpress.XtraReports.UI.XRCheckBox ckb6 = details.FindControl("ckb6", false) as DevExpress.XtraReports.UI.XRCheckBox;
                if (epodCB6 == "Yes")
                {
                    ckb6.Checked = true;
                }
            }
        }
        rpt.DataSource = set;

        System.IO.MemoryStream str = new MemoryStream();
        rpt.CreateDocument();
        rpt.ExportToPdf(str);


        return(str);
    }
Ejemplo n.º 4
0
        /// <summary>
        /// AddQuestCtrl
        /// </summary>
        void AddQuestCtrl(EntityQnRecord qnRecord)
        {
            try
            {
                if (qnRecord != null)
                {
                    if (!string.IsNullOrEmpty(qnRecord.xmlData))
                    {
                        XmlDocument document = new XmlDocument();
                        document.LoadXml(qnRecord.xmlData);
                        XmlNodeList list = document["FormData"].ChildNodes;
                        xmlData = list[1].OuterXml;
                        dicData = Function.ReadXML(xmlData);
                    }
                }
                using (ProxyHms proxy = new ProxyHms())
                {
                    lstCtrlLocation = proxy.Service.GetQnCtrlLocation(lstQuest[0], qnRecord.qnId);
                }

                using (ProxyHms proxy = new ProxyHms())
                {
                    lstTopic = new List <EntityDicQnSetting>();
                    lstItems = new List <EntityDicQnSetting>();
                    proxy.Service.GetQnCustom(1, out lstTopic, out lstItems);
                }
                int locationX = 0;
                int locationY = 0;

                if (lstCtrlLocation != null && lstCtrlLocation.Count > 0)
                {
                    foreach (var clVo in lstCtrlLocation)
                    {
                        if (clVo.name.Contains("FT"))
                        {
                            DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel();
                            lblTopic.Name          = clVo.name;
                            lblTopic.Text          = clVo.text;
                            lblTopic.Font          = new System.Drawing.Font("宋体", 9.5F);
                            locationX              = clVo.locationX;
                            locationY              = clVo.locationY;
                            lblTopic.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY);
                            this.Detail.Controls.Add(lblTopic);
                        }
                        if (clVo.name.Contains("FM"))
                        {
                            DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel();
                            lblTopic.Name          = clVo.name;
                            lblTopic.Text          = clVo.text;
                            lblTopic.Font          = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold);
                            locationX              = clVo.locationX;
                            locationY              = clVo.locationY;
                            lblTopic.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY);
                            this.Detail.Controls.Add(lblTopic);
                        }
                    }
                }
                int parentCount = 0;
                List <EntityDicQnSetting> lstChildSettings = new List <EntityDicQnSetting>();
                if (lstTopic != null && lstTopic.Count > 0)
                {
                    for (int i = 0; i < lstTopic.Count; i++)
                    {
                        EntityDicQnSetting item = lstTopic[i];
                        if (item.questName == lstQuest[0])
                        {
                            if (string.IsNullOrEmpty(item.parentFieldId))
                            {
                                DevExpress.XtraReports.UI.XRLabel lblTopic = new DevExpress.XtraReports.UI.XRLabel();
                                lblTopic.Name = item.fieldId;
                                lblTopic.Text = lstTopic.Find(r => r.fieldId == item.fieldId).fieldName;
                                lblTopic.Font = new System.Drawing.Font("宋体", 9.5F);
                                EntityCtrlLocation ctrLocat = lstCtrlLocation.FindAll(r => r.type == 1)[parentCount];
                                locationX = ctrLocat.locationX;
                                locationY = ctrLocat.locationY;
                                lblTopic.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY);
                                this.Detail.Controls.Add(lblTopic);
                                lstChildSettings = lstTopic.FindAll(r => r.parentFieldId == item.fieldId);
                                if (lstChildSettings.Count > 0)
                                {
                                    foreach (var childVo in lstChildSettings)
                                    {
                                        DevExpress.XtraReports.UI.XRCheckBox chkAns = new DevExpress.XtraReports.UI.XRCheckBox();
                                        string strEndWith = childVo.fieldId.Substring(4, 2);
                                        chkAns.Text = "";
                                        chkAns.Font = new System.Drawing.Font("宋体", 9.5F);
                                        chkAns.Name = childVo.fieldId;
                                        EntityCtrlLocation ctrLocatChild = lstCtrlLocation.Find(r => r.name.Contains(ctrLocat.name) && r.type == 2 && r.name.EndsWith(strEndWith));
                                        locationX            = ctrLocatChild.locationX;
                                        locationY            = ctrLocatChild.locationY;
                                        chkAns.Dpi           = 100F;
                                        chkAns.LocationFloat = new DevExpress.Utils.PointFloat(locationX, locationY);
                                        chkAns.SizeF         = new System.Drawing.SizeF(15.625F, 23F);
                                        if (dicData.ContainsKey(childVo.fieldId))
                                        {
                                            string value = dicData[childVo.fieldId];
                                            chkAns.Checked = value == "0" ? false : true;
                                        }

                                        this.Detail.Controls.Add(chkAns);
                                    }
                                }
                                parentCount++;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(ex);
            }
            finally
            {
            }
        }