예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MessageID = Request["MessageID"] + "";
            //MessageID = "d0235c96-6473-4ed0-a34d-c156fba9b115";
            SystemCode = Request["SystemCode"] + "";
            //SystemCode = "OA";
            PERSONALRECORDID = Request["PERSONALRECORDID"] + "";

            string xml = Get_Record_DetailByForm(SystemCode + "_" + MessageID);
            //string xml = MobileService.Get_Record_DetailByForm(PERSONALRECORDID);

            ObjBill  bill     = null;
            BillView billView = new BillView();

            if (null != xml && xml.Length > 0)
            {
                try
                {
                    bill = billView.CreateView(this.pnl1, xml, IsApproval, ref error);
                    if (bill != null)
                    {
                        billText = bill.Text;
                    }
                }
                catch
                {
                    Response.Write(error);
                }
            }
            else
            {
                Response.Write("对不起,当前数据版本不对,请在电脑上查看");
            }
        }
예제 #2
0
        public void PrintBill(ObjBill objBill, List <ObjBillDetail> objBillDetail)
        {
            Bill_vi report = new Bill_vi();

            foreach (DevExpress.XtraReports.Parameters.Parameter p in report.Parameters)
            {
                p.Visible = false;
            }
            report.InitData(objBill.SOHD, objBill.NGHD, objBill.TenKH, objBill.DchiKH, objBill.MANV, objBill.TenNV, objBill.TRIGIA, objBillDetail);
            documentViewer1.DocumentSource = report;
            report.CreateDocument();
        }
예제 #3
0
파일: GetForm.cs 프로젝트: jjg0519/OA
        public void GetForm(string MessageID, ref Panel panel, bool IsApproval, ref string error)
        {
            string        xml           = T_Bill_GetDetailByForm(MessageID);
            StringBuilder stringBuilder = new StringBuilder();
            BillView      billView      = new BillView();
            ObjBill       bill          = null;

            if (null != xml && xml.Length > 0)
            {
                bill = billView.CreateView(panel, xml, IsApproval, ref error);
            }
        }
예제 #4
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string Query = "SELECT HD.SOHD,NV.HOTEN,NV.MANV,KH.HOTEN,KH.DCHI,HD.NGHD,CT.SL,CT.MASP,SP.GIA,SP.TENSP " +
                           "FROM HOADON AS HD " +
                           "JOIN CTHD AS CT " +
                           "ON HD.SOHD = CT.SOHD " +
                           "JOIN NHANVIEN AS NV " +
                           "ON HD.MANV = NV.MANV " +
                           "JOIN KHACHHANG AS KH " +
                           "ON KH.MAKH = HD.MAKH " +
                           "JOIN SANPHAM AS SP " +
                           "ON SP.MASP = CT.MASP " +
                           "WHERE HD.SOHD = '" + tbSoHD.Text + "' ";
            DataTable data    = DataProvider.Instance.ExecuteQuery(Query);
            DataRow   dataRow = data.Rows[0];
            ObjBill   objBill = new ObjBill();

            objBill.SOHD   = dataRow.ItemArray[0].ToString();
            objBill.TenNV  = dataRow.ItemArray[1].ToString();
            objBill.MANV   = dataRow.ItemArray[2].ToString();
            objBill.TenKH  = dataRow.ItemArray[3].ToString();
            objBill.DchiKH = dataRow.ItemArray[4].ToString();
            DateTime date = Convert.ToDateTime(dataRow.ItemArray[5].ToString());

            objBill.NGHD = date;
            int    len                = data.Rows.Count;
            double trigia             = 0;
            List <ObjBillDetail> list = new List <ObjBillDetail>();

            for (int i = 0; i < len; i++)
            {
                DataRow       dr  = data.Rows[i];
                ObjBillDetail obj = new ObjBillDetail();
                obj.SL    = dr.ItemArray[6].ToString();
                obj.MaSP  = dr.ItemArray[7].ToString();
                obj.GIA   = dr.ItemArray[8].ToString();
                obj.TenSP = dr.ItemArray[9].ToString();
                obj.Tong  = (Convert.ToDouble(obj.SL) * Convert.ToDouble(obj.GIA)).ToString();
                trigia   += Convert.ToDouble(obj.Tong);

                list.Add(obj);
            }
            objBill.TRIGIA = trigia.ToString();
            Print frm = new Print();

            frm.PrintBill(objBill, list);
            frm.Show();
        }
예제 #5
0
파일: BillData.cs 프로젝트: jjg0519/OA
        public static ObjSubList[] CreateSubList(XmlNode nodeObject, string listName, ObjBill schemaBill, bool isSub)
        {
            //选取ObjectList节点
            XmlNodeList listList = nodeObject.SelectNodes("ObjectList");

            //根据节点数建立实体集
            ObjSubList[] sublists = new ObjSubList[listList.Count];
            //遍历结点
            for (int j = 0; j < listList.Count; j++)
            {
                //从该结点获取一个ObjectList的Name
                string subListName = ((XmlElement)listList[j]).GetAttribute("Name");
                string subListText = ((XmlElement)listList[j]).GetAttribute("Text");
                //建立Sublist对象
                ObjSubList objSubList = new ObjSubList();
                objSubList.Name = subListName;
                objSubList.Text = subListText;
                var temp = schemaBill.GetSubListsDict()[subListName];
                if (temp != null)
                {
                    objSubList.Align         = temp.Align;
                    objSubList.HideWhenEmpty = temp.HideWhenEmpty;
                }

                //把billschema的columnList的信息赋给bill

                //从该结点中获取Object节点集,对应Sublist的行数据
                XmlNodeList objlist = listList[j].SelectNodes("Object");
                //根据xml数据中的object节点数建立sublist对象的rowlist数组
                objSubList.RowList = new ObjRow[objlist.Count];
                //遍历 object节点集,以构建数据
                for (int i = 0; i < objlist.Count; i++)
                {
                    //得到object的name
                    string rowName = ((XmlElement)objlist[i]).GetAttribute("Name");
                    string rowID   = ((XmlElement)objlist[i]).GetAttribute("id");
                    if (string.IsNullOrEmpty(rowID))
                    {
                        //  continue;
                    }
                    //从object结点中得到所有的attribute,即该行的所有字段
                    XmlNodeList list = objlist[i].SelectNodes("Attribute");
                    //建立对应的objrow对象以容纳字段数据
                    ObjRow row = new ObjRow();
                    row.Name = rowName;
                    row.Id   = rowID;
                    //根据attribut的数量建立fieldlist数组
                    row.ObjFieldList = new ObjField[list.Count];
                    //遍历attribute结点
                    for (int m = 0; m < list.Count; m++)
                    {
                        //从attribute节点中得到数据信息
                        XmlElement node      = list[m] as XmlElement;
                        string     Name      = ((XmlElement)node).GetAttribute("Name");
                        string     Text      = ((XmlElement)node).GetAttribute("Text");
                        string     DataType  = ((XmlElement)node).GetAttribute("DataType");
                        string     DataValue = ((XmlElement)node).GetAttribute("DataValue");

                        //建立对应的objfield对象
                        ObjField dataField = new ObjField();
                        dataField.Name = Name;
                        //dataField.Text = Text;
                        dataField.DataType  = DataType;
                        dataField.DataValue = DataValue;
                        string fgColor = string.Empty;
                        string Tooltip = string.Empty;
                        if (node.HasAttribute("Color"))
                        {
                            fgColor = node.GetAttribute("Color");
                        }
                        if (node.HasAttribute("Tooltip"))
                        {
                            Tooltip = node.GetAttribute("Tooltip");
                        }
                        dataField.Color   = fgColor;
                        dataField.Tooltip = Tooltip;


                        //如果能够在配置文件中找到对应的定义项,则把该定义项的相关信息赋值到该对象。
                        //通过Name作为key进行过索引
                        if (schemaBill.GetSubListsDict()[subListName] != null && schemaBill.GetSubListsDict()[subListName].GetRowDict()[rowID] != null && schemaBill.GetSubListsDict()[subListName].GetRowDict()[rowID].GetObjFieldDict()[Name] != null)
                        {
                            ObjField schemaField = schemaBill.GetSubListsDict()[subListName].GetRowDict()[rowID].GetObjFieldDict()[Name];
                            dataField.Colspan     = schemaField.Colspan;
                            dataField.IsVisible   = schemaField.IsVisible;
                            dataField.CssName     = schemaField.CssName;
                            dataField.ColumnOrder = schemaField.ColumnOrder;
                        }
                        //把建立的field对象赋给对应索引的fieldlist数组。
                        row.ObjFieldList[m] = dataField;
                    }
                    //把建立的row对象赋给对应索引的 rowlist数组
                    objSubList.RowList[i] = row;
                    row.SubSubList        = CreateSubList(objlist[i], objSubList.Name, schemaBill, true);
                }
                //把建立的sublist对象赋给对应索引的sublist数组
                if (schemaBill.GetSubListsDict()[objSubList.Name] != null && isSub == false)
                {
                    objSubList.ColumnList = schemaBill.GetSubListsDict()[objSubList.Name].ColumnList;
                }
                //把建立的sublist对象赋给对应索引的sublist数组
                if (schemaBill.GetSubListsDict()[listName] != null && isSub == true)
                {
                    objSubList.ColumnList = schemaBill.GetSubListsDict()[listName].SubColumnList;
                }
                sublists[j] = objSubList;
            }
            return(sublists);
        }
예제 #6
0
파일: BillData.cs 프로젝트: jjg0519/OA
        public static ObjBill CreateBill(string xml, ref string error)
        {
            ObjBill bill = new ObjBill();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);

            //读取Form中的数据
            XmlNode nodeResult = doc.SelectSingleNode("//Result");

            if (nodeResult != null)
            {
                if (((XmlElement)nodeResult).GetAttribute("Code") != "0")
                {
                    error = ((XmlElement)nodeResult).InnerText.ToString();
                    throw new SmtException(((XmlElement)nodeResult).InnerText);
                }
                else
                {
                    XmlNode nodeForm = doc.SelectSingleNode("//Form");
                    bill.ModelCode     = ((XmlElement)nodeForm).GetAttribute("ModelCode");
                    bill.OrderType     = ((XmlElement)nodeForm).GetAttribute("OrderType");
                    bill.Text          = ((XmlElement)nodeForm).GetAttribute("Text");
                    bill.FormID        = ((XmlElement)nodeForm).GetAttribute("FormID");
                    bill.MessageStatus = ((XmlElement)nodeForm).GetAttribute("MESSAGESTATUS");
                    ObjBill schemaBill = DataManager <ObjBill> .Get(HttpContext.Current.Server.MapPath("BillSchema/" + bill.ModelCode + ".xml"));

                    XmlNode nodeObject = doc.SelectSingleNode("//Object");

                    { //读取主表数据
                        XmlNodeList   list       = nodeObject.SelectNodes("Attribute");
                        ObjDetailList detailList = new ObjDetailList();
                        detailList.ObjFieldList = new ObjField[list.Count];
                        foreach (var item in schemaBill.DetailLists)
                        {
                            item.Load();
                        }
                        for (int i = 0; i < list.Count; i++)
                        {
                            XmlElement node      = list[i] as XmlElement;
                            string     Name      = ((XmlElement)node).GetAttribute("Name");
                            string     Text      = ((XmlElement)node).GetAttribute("Text");
                            string     DataType  = ((XmlElement)node).GetAttribute("DataType");
                            string     DataValue = ((XmlElement)node).GetAttribute("DataValue");
                            string     fgColor   = string.Empty;
                            string     Tooltip   = string.Empty;
                            if (node.HasAttribute("Color"))
                            {
                                fgColor = node.GetAttribute("Color");
                            }
                            if (node.HasAttribute("Tooltip"))
                            {
                                Tooltip = node.GetAttribute("Tooltip");
                            }

                            ObjField dataField = new ObjField();
                            dataField.Name      = Name;
                            dataField.Text      = Text;
                            dataField.DataType  = DataType;
                            dataField.DataValue = DataValue.Replace("\n", "<br />");
                            dataField.Color     = fgColor;
                            dataField.Tooltip   = Tooltip;

                            //将数据样式应用于字段
                            if (schemaBill.DetailLists.Length > 0 &&
                                schemaBill.DetailLists[0].ObjFieldList.Length > 0 && schemaBill.DetailLists[0].GetObjFieldDict()[Name] != null)
                            {
                                ObjField schemaField = schemaBill.DetailLists[0].GetObjFieldDict()[Name];
                                dataField.Colspan       = schemaField.Colspan;
                                dataField.IsVisible     = schemaField.IsVisible;
                                dataField.CssName       = schemaField.CssName;
                                dataField.Orderno       = schemaField.Orderno;
                                dataField.ColumnOrder   = schemaField.ColumnOrder;
                                dataField.Text          = schemaField.Text;
                                dataField.IsShowCaption = schemaField.IsShowCaption;
                                dataField.IsLink        = schemaField.IsLink;
                                if (dataField.DataType.ToLower() == "rtf")
                                {
                                    bill.RtfData = dataField.DataValue;
                                }
                                //因业务编号的问题,需要重新获取编号(目前出差报销)
                                if (dataField.DataValue == "")
                                {
                                    //TODO:需要重新获取编号
                                    //UNDONE:需要重新获取编号
                                }
                            }
                            else //在配置文件中没找到的字段,都不显示
                            {
                                dataField.IsVisible = false;
                            }
                            detailList.ObjFieldList[i]  = dataField;
                            detailList.PadRepeatCount   = schemaBill.DetailLists[0].PadRepeatCount;
                            detailList.PhoneRepeatCount = schemaBill.DetailLists[0].PhoneRepeatCount;
                        }
                        bill.DetailLists = new ObjDetailList[] { detailList };
                    }


                    bill.SubLists = CreateSubList(nodeObject, "", schemaBill, false);

                    XmlNode ConsultationList = doc.SelectSingleNode("//ConsultationList");
                    if (ConsultationList != null)
                    {
                        bill.ConsultationLists = CreateConsultationList(ConsultationList);
                    }
                    XmlNode nodeApproval = doc.SelectSingleNode("//ApprovalList");

                    if (nodeApproval != null)
                    {//读取审核列表数据
                        XmlNodeList     list         = nodeApproval.SelectNodes("Atrribute");
                        ObjApprovalList approvalList = new ObjApprovalList();
                        approvalList.Text         = "审核信息";
                        approvalList.ApprovalList = new ObjApproval[list.Count];
                        for (int i = 0; i < list.Count; i++)
                        {
                            XmlNode     node           = list[i];
                            string      Approver       = ((XmlElement)node).GetAttribute("Approver");
                            string      ApprovalTime   = ((XmlElement)node).GetAttribute("ApprovalTime");
                            string      ApprovalState  = ((XmlElement)node).GetAttribute("ApprovalState");
                            string      ApprovalRemark = ((XmlElement)node).GetAttribute("ApprovalRemark");
                            string      FlowType       = ((XmlElement)node).GetAttribute("FlowType");
                            string      Flag           = ((XmlElement)node).GetAttribute("Flag");
                            ObjApproval dataField      = new ObjApproval();
                            dataField.Approver       = Approver;
                            dataField.ApprovalTime   = Convert.ToDateTime(ApprovalTime);
                            dataField.ApprovalState  = ApprovalState;
                            dataField.ApprovalRemark = ApprovalRemark;
                            dataField.Flag           = Flag;
                            dataField.FlowType       = FlowType;

                            //应用样式于字段
                            if (null != schemaBill.ApprovalLists && schemaBill.ApprovalLists.Length > 0 && null != schemaBill.ApprovalLists[0].ApprovalList &&
                                schemaBill.ApprovalLists[0].ApprovalList.Length > 0 && schemaBill.ApprovalLists[0].GetApprovalDict()[Approver] != null)
                            {
                                ObjApproval schemaField = schemaBill.ApprovalLists[0].GetApprovalDict()[Approver];

                                //dataField.Colspan = schemaField.Colspan;
                            }
                            approvalList.ApprovalList[i] = dataField;
                        }
                        bill.ApprovalLists = new ObjApprovalList[] { approvalList };
                    }


                    XmlNode nodeAttach = doc.SelectSingleNode("//AttachList");
                    if (nodeAttach != null)
                    {//读取附件列表数据
                        XmlNodeList   list         = nodeAttach.SelectNodes("Atrribute");
                        ObjAttachList approvalList = new ObjAttachList();
                        approvalList.AttachList = new ObjAttach[list.Count];
                        for (int i = 0; i < list.Count; i++)
                        {
                            XmlNode node = list[i];
                            string  Name = ((XmlElement)node).GetAttribute("Name");
                            string  Url  = ((XmlElement)node).GetAttribute("Url");

                            ObjAttach dataField = new ObjAttach();
                            dataField.Name = Name;
                            dataField.Url  = Url;

                            //将样式应用于字段
                            if (null != schemaBill && null != schemaBill.AttachLists && schemaBill.AttachLists.Length > 0 &&
                                schemaBill.AttachLists[0].AttachList != null &&
                                schemaBill.AttachLists[0].AttachList.Length > 0 && schemaBill.AttachLists[0].GetAttachDict()[Name] != null)
                            {
                                ObjAttach schemaField = schemaBill.AttachLists[0].GetAttachDict()[Name];
                                //dataField.Colspan = schemaField.Colspan;
                            }
                            approvalList.AttachList[i] = dataField;
                        }
                        bill.AttachLists = new ObjAttachList[] { approvalList };
                    }
                }
            }

            return(bill);
        }