Example #1
0
		public IEnumerable<CTable> LoadTables()
		{
			var list = new List<CTable>();

			List<CColumn> columns = LoadCollumns().ToList();
			List<CValue> rows = LoadValues().ToList();

			var reader = CDatabase.Instance.Execute(modSQL.SelectTables());
			CTable item = null;
			try
			{
				while (reader.Read())
				{
					item = new CTable();
					item.Id = reader.GetClearStr(0);
					item.Name = reader.GetClearStr(1);
					item.Status = Status.Normal;

					FillBy(item, columns, rows);

					item.Data = CTable.ToDataTable(item);

					list.Add(item);
				}

				reader.Close();
			}
			catch(Exception ex)
			{
				if (reader != null)
					reader.Close();
			}

			return list;
		}
		public TableSettingViewModel(CTable table, Func<object, bool> checkIsRightCollumn)
		{
			mvSaveCommand = new RelayCommand(OnSaveSelected, CanSave);
			mvCloseCommand = new RelayCommand(OnClose);

			Tables = new ObservableCollection<TableSettingItemViewModel>();
			DataTypes = new List<Type>()
			{
				typeof(string),
				typeof(double),
				typeof(int),
				typeof(DateTime),
				typeof(bool)
			};

			this.modCheckIsRightCollumn = checkIsRightCollumn;
			this.modTable = table;

			foreach (DataColumn item in table.Data.Columns)
			{
				var tableSetting = new TableSettingItemViewModel()
				{
					Name = item.ColumnName,
					CurrentType = item.DataType
				};
				Tables.Add(tableSetting);
			}

			NumberDecimalSeparator = ".";
			//eventAggregator.GetEvent<StateChangedEvent>().Subscribe(OnDataChanged);
			//eventAggregator.GetEvent<ItemChangedEvent>().Subscribe(OnSelectedChanged, ThreadOption.PublisherThread, true, Filter);
		}
Example #3
0
		public static void ShowEditSelectedTable(CTable table)
		{
			var wind = new wndProducts();
			wind.Owner = App.Current.MainWindow;
			wind.Owner.Hide();
			wind.Closed += (e, a) =>
			{
				wind.Owner.Show();
				wind.Activate();
			};
			wind.DataContext = new ProductItemsViewModel(table)
			{
				Token = wind.Token,
			};

			wind.Show();
		}
Example #4
0
		public static void ShowEmployeWindow(CTable table, Func<object, bool> checkRightColl, Action onWindowClosed)
		{
			var wind = new wndSetTypes();
			//wind.Owner = App.Current.MainWindow;
			//wind.Owner.Hide();
			//wind.Closed += (e, a) =>
			//{
			//	wind.Owner.Show();
			//	wind.Activate();
			//};
			wind.DataContext = new Settings.ViewModel.TableSettingViewModel(table, checkRightColl) 
			{ 
				Token = wind.Token,
			};
			wind.Closed += (p, v) =>
				{
					if (onWindowClosed != null)
						onWindowClosed();
				};
			
			wind.Show();
		}
        private Boolean ValidateData()
        {
            Boolean result = false;

            result = CHelper.ValidateTextBox(lblDocumentNo, txtDocNo, true);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblDocumentStatus, txtStatus, false);
            if (!result)
            {
                return(result);
            }
            result = CHelper.ValidateLookup(lblCustomer, uCustomer, false);
            if (!result)
            {
                return(result);
            }
            result = CHelper.ValidateTextBox(lblDesc, txtDesc, true);
            if (!result)
            {
                return(result);
            }
            result = CHelper.ValidateComboBox(lblBranch, cboBranch, false);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblDebtAmount, txtDebtAmount, false, InputDataType.InputTypeZeroPossitiveDecimal);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblNet, txtNet, false, InputDataType.InputTypeZeroPossitiveDecimal);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblhwdvalue, txthwdvalue, false, InputDataType.InputTypeZeroPossitiveDecimal);
            if (!result)
            {
                return(result);
            }

            CTable      ug = new CTable("ACCOUNT_DOC");
            MAccountDoc uv = new MAccountDoc(ug);

            uv.DocumentNo = txtDocNo.Text;
            if (vw != null)
            {
                uv.AccountDocId = (vw as MAccountDoc).AccountDocId;
            }
            if (OnixWebServiceAPI.IsAccountDocExist(uv.GetDbObject()))
            {
                CHelper.ShowKeyExist(lblDocumentNo, txtDocNo);
                return(false);
            }

            return(result);
        }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            Response.End();
        }
        m_User = (CUser)Session["User"];

        string vid = Request["vid"];

        if (string.IsNullOrEmpty(vid))
        {
            Response.End();
        }
        m_View = (CView)Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.Find(new Guid(vid));
        if (m_View == null)
        {
            Response.End();
        }
        m_Table = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(m_View.FW_Table_id);

        //检查权限
        if (!CheckAccess())
        {
            Response.End();
        }

        string ParentId = Request["ParentId"];

        if (!string.IsNullOrEmpty(ParentId))
        {
            m_guidParentId = new Guid(ParentId);
        }

        if (Session["AddMasterDetailViewRecord"] == null)
        {
            CBaseObjectMgr BaseObjectMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(m_Table.Code, m_guidParentId);
            if (BaseObjectMgr == null)
            {
                BaseObjectMgr        = new CBaseObjectMgr();
                BaseObjectMgr.TbCode = m_Table.Code;
                BaseObjectMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
            }
            CBaseObject obj = BaseObjectMgr.CreateBaseObject();
            obj.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());
            obj.TbCode = m_Table.Code;
            CUser user = (CUser)Session["User"];
            obj.Creator = user.Id;
            Session["AddMasterDetailViewRecord"] = obj;
        }

        if (!IsPostBack)
        {
            recordCtrl.m_View  = m_View;
            recordCtrl.m_Table = m_Table;
            recordCtrl.m_sortRestrictColumnAccessType = m_sortRestrictColumnAccessType;
            if (!string.IsNullOrEmpty(Request["UIColCount"]))
            {
                recordCtrl.m_iUIColCount = Convert.ToInt32(Request["UIColCount"]);
            }
            //外面传递的默认值
            foreach (CColumn col in m_Table.ColumnMgr.GetList())
            {
                if (!string.IsNullOrEmpty(Request[col.Code]))
                {
                    recordCtrl.m_sortDefVal.Add(col.Code, Request[col.Code]);
                }
            }
            //隐藏字段
            string sHideCols = Request["HideCols"];
            if (!string.IsNullOrEmpty(sHideCols))
            {
                string[] arr = sHideCols.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                foreach (string code in arr)
                {
                    recordCtrl.m_sortHideColumn.Add(code, code);
                }
            }
        }
        if (Request.Params["Action"] == "Cancel")
        {
            Session["AddMasterDetailViewRecord"] = null;
            Response.End();
        }
        else if (Request.Params["Action"] == "GetDetail")
        {
            GetDetail();
            Response.End();
        }
        else if (Request.Params["Action"] == "PostData")
        {
            PostData();
            Response.End();
        }
    }
Example #7
0
        void LoopTreeNode(int iLevel, List <CBaseObject> lstTIWC, TreeNode pnode)
        {
            if (iLevel >= lstTIWC.Count)
            {
                return;
            }
            CTableInFormControl tiwc = (CTableInFormControl)lstTIWC[iLevel];
            CTable table             = (CTable)Program.Ctx.TableMgr.Find(tiwc.FW_Table_id);

            if (table == null)
            {
                return;
            }
            if (!tiwc.IsLoop)
            {
                CBaseObjectMgr BaseObjectMgr = new CBaseObjectMgr();
                BaseObjectMgr.Ctx    = Program.Ctx;
                BaseObjectMgr.TbCode = table.Code;
                List <CBaseObject> lstObj = BaseObjectMgr.GetList(tiwc.QueryFilter);
                foreach (CBaseObject obj in lstObj)
                {
                    string sText  = tiwc.Text.ToLower();
                    int    iStart = 0;
                    while (sText.IndexOf('[', iStart) > -1)
                    {
                        int idx1 = sText.IndexOf('[', iStart);
                        int idx2 = sText.IndexOf(']', idx1);
                        iStart = idx1 + 1;
                        if (idx2 > idx1)
                        {
                            string  sCodeN = sText.Substring(idx1, idx2 - idx1 + 1);
                            string  sCode  = sCodeN.Substring(1, sCodeN.Length - 2);
                            CColumn column = table.ColumnMgr.FindByCode(sCode);
                            if (column == null)
                            {
                                continue;
                            }
                            string sVal = obj.GetColValue(column).ToString();
                            sText = sText.Replace(sCodeN, sVal);
                        }
                    }

                    TreeNode node = new TreeNode();
                    node.Text = sText;
                    node.Tag  = obj;
                    if (pnode == null)
                    {
                        treeView.Nodes.Add(node);
                    }
                    else
                    {
                        pnode.Nodes.Add(node);
                    }

                    LoopTreeNode(iLevel + 1, lstTIWC, node);
                }
            }
            else
            {
                string sFilter = tiwc.QueryFilter;
                if (sFilter.Trim() != "")
                {
                    sFilter += " and ";
                }
                sFilter += tiwc.RootFilter;
                List <TreeNode> lstTreeNode = SelfLoop(tiwc, sFilter, pnode);
                foreach (TreeNode node in lstTreeNode)
                {
                    LoopTreeNode(iLevel + 1, lstTIWC, node);
                }
            }
        }
Example #8
0
 public MMenuItem(CTable obj) : base(obj)
 {
 }
Example #9
0
        private static void addReport(ReportGroupEnum grp, String key, String className, CTable dat)
        {
            String prefix = "Onix.ClientCenter.Reports.";
            String fqName = prefix + className;

            MMasterRef mr = new MMasterRef(new CTable(""));

            mr.Code           = key;
            mr.Description    = className;
            mr.DescriptionEng = fqName;
            mr.Optional       = CLanguage.getValue(key);

            ArrayList arr = null;

            if (!reports.ContainsKey(grp))
            {
                arr = new ArrayList();
                reports.Add(grp, arr);
            }
            else
            {
                arr = (ArrayList)reports[grp];
            }

            extends.Add(key, dat);
            arr.Add(mr);

            mr.MasterID = arr.Count.ToString();
        }
Example #10
0
		public static string UpdateTable(CTable table)
		{
			string query = @"UPDATE Conf_Dyn_Tables SET Name='{0}'" 
				+ " WHERE Id='{1}';";
			return string.Format(query, table.Name, table.Id);
		}
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            Response.Redirect("../Login.aspx");
            Response.End();
        }
        string id = Request["id"];

        if (!string.IsNullOrEmpty(id))
        {
            m_View = (CView)Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.Find(new Guid(id));
        }
        else
        {
            m_bIsNew = true;
            if (Session["NewMasterDetailView"] == null)
            {
                Response.Redirect("MasterDetailViewInfo1.aspx?id=" + Request["id"] + "&catalog_id=" + Request["catalog_id"]);
                return;
            }
            else
            {
                SortedList <Guid, CView> sortObj = (SortedList <Guid, CView>)Session["NewMasterDetailView"];
                m_View = sortObj.Values[0];
            }
        }
        m_MTable = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(m_View.FW_Table_id);
        CViewDetail ViewDetail = (CViewDetail)m_View.ViewDetailMgr.GetFirstObj();

        if (ViewDetail == null)
        {
            Response.Redirect("MasterDetailViewInfo1.aspx?id=" + Request["id"] + "&catalog_id=" + Request["catalog_id"]);
            return;
        }
        m_DTable = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(ViewDetail.FW_Table_id);

        string catalog_id = Request["catalog_id"];

        if (!string.IsNullOrEmpty(catalog_id))
        {
            m_Catalog_id = new Guid(catalog_id);
        }


        if (Request.Params["Action"] == "GetData")
        {
            GetData();
            Response.End();
        }
        else if (Request.Params["Action"] == "GetDetail")
        {
            GetDetail();
            Response.End();
        }
        else if (Request.Params["Action"] == "PostData")
        {
            PostData();
            Response.End();
        }
        else if (Request.Params["Action"] == "Cancel")
        {
            Cancel();
            Response.End();
        }
    }
Example #12
0
		private void FillBy(CTable table, List<CColumn> columns, List<CValue> rows)
		{
			if (table == null)
				return;

			table.Columns = columns.Where(p => p.TableId == table.Id).ToList();
			table.Rows = rows.Where(p => p.TableId == table.Id).ToList();

			foreach (var item in table.Rows)
			{
				item.Column = table.Columns.FirstOrDefault(p => p.Id == item.CollumnId);
				if (item.Column == null)
					continue;
				item.ValueType = item.Column.GetCollType();
			}
		}
Example #13
0
 public CTableRowCollection(CTable Table) : base(Table) { }
Example #14
0
		public TableViewModel(CTable table)
		{
			this.Current = table;
		}
Example #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            Response.End();
        }
        m_User = (CUser)Session["User"];

        string vid = Request["vid"];

        if (string.IsNullOrEmpty(vid))
        {
            Response.End();
        }
        string vdid = Request["vdid"];

        if (string.IsNullOrEmpty(vdid))
        {
            Response.End();
        }
        m_View = (CView)Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.Find(new Guid(vid));
        if (m_View == null)
        {
            Response.End();
        }
        m_ViewDetail = (CViewDetail)m_View.ViewDetailMgr.Find(new Guid(vdid));
        if (m_ViewDetail == null)
        {
            Response.End();
        }
        m_Table = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(m_ViewDetail.FW_Table_id);

        m_sortRestrictColumnAccessType = m_User.GetRestrictColumnAccessTypeList(m_Table);

        if (Session["AddMultMasterDetailViewRecord"] == null)
        {
            Response.End();
        }
        CBaseObject objP = (CBaseObject)Session["AddMultMasterDetailViewRecord"];

        m_BaseObjectMgr = objP.GetSubObjectMgr(m_Table.Code, typeof(CBaseObjectMgr));

        string id = Request["id"];

        if (string.IsNullOrEmpty(id))
        {
            Response.End();
        }

        m_BaseObject = m_BaseObjectMgr.Find(new Guid(id));
        if (m_BaseObject == null)
        {
            Response.Write("请选择记录!");
            Response.End();
        }

        if (!IsPostBack)
        {
            recordCtrl.m_ViewDetail = m_ViewDetail;
            recordCtrl.m_Table      = m_Table;
            recordCtrl.m_sortRestrictColumnAccessType = m_sortRestrictColumnAccessType;
            recordCtrl.m_BaseObject = m_BaseObject;
            if (!string.IsNullOrEmpty(Request["UIColCount"]))
            {
                recordCtrl.m_iUIColCount = Convert.ToInt32(Request["UIColCount"]);
            }
            //隐藏字段
            string sHideCols = Request["HideCols"];
            if (!string.IsNullOrEmpty(sHideCols))
            {
                string[] arr = sHideCols.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                foreach (string code in arr)
                {
                    recordCtrl.m_sortHideColumn.Add(code, code);
                }
            }
        }
        if (Request.Params["Action"] == "Cancel")
        {
            Response.End();
        }
        else if (Request.Params["Action"] == "PostData")
        {
            PostData();
            Response.End();
        }
    }
Example #16
0
        public CTable Convert(KView view)
        {
            var table = new CTable(DataStoreTypes.Unknown);

            table.Schema    = view.Schema;
            table.Column    = new List <CColumn>();
            table.TableName = view.ViewName;
            foreach (var col in view.Column)
            {
                var tableColumn = new CColumn(table)
                {
                    IsPrimaryKey    = col.IsPrimaryKey,
                    IsIdentity      = col.IsIdentity,
                    IsNullable      = col.IsNullable,
                    IsIndexed       = col.IsIndexed,
                    IsUnique        = col.IsUnique,
                    ColumnName      = col.ColumnName,
                    ColumnType      = col.ColumnType,
                    ColumnSqlDbType = col.ColumnSqlDbType,
                    ColumnTypeRaw   = col.ColumnTypeRaw,
                    ColumnLength    = col.ColumnLength
                };

                if (col.ForeignKeyColumn != null)
                {
                    foreach (var fk in col.ForeignKeyColumn)
                    {
                        tableColumn.ForeignKeyColumn.Add(
                            new CColumn(new CTable(DataStoreTypes.Unknown)
                        {
                            Schema = new CSchema {
                                SchemaName = fk.View.Schema.SchemaName
                            },
                            TableName = fk.View.ViewName
                        })
                        {
                            ColumnName      = fk.ColumnName,
                            ColumnType      = fk.ColumnType,
                            ColumnSqlDbType = fk.ColumnSqlDbType,
                            ColumnLength    = fk.ColumnLength,
                            ColumnTypeRaw   = fk.ColumnTypeRaw
                        }
                            );
                    }
                }
                table.Column.Add(tableColumn);
            }
            foreach (var row in view.Row)
            {
                var tableRow = new CTableRow();
                foreach (var rowData in row.RowData)
                {
                    var tableRowData = new CTableRowData
                    {
                        Column = table.Column.FirstOrDefault(c => c.ColumnName == rowData.Column.ColumnName),
                        Value  = rowData.Value
                    };
                    tableRow.RowData.Add(tableRowData);
                }
                table.Row.Add(tableRow);
            }
            return(table);
        }
Example #17
0
 public MCompanyImage(CTable obj) : base(obj)
 {
 }
        public string Convert(CTable table)
        {
            var converter   = new CTableToCreateTableStatementConverter();
            var createTable = converter.Convert(table);

            //generate DDL

            var codeWriter = new CodeWriter();

            codeWriter.WriteLine($@"CREATE TABLE IF NOT EXISTS {table.Schema.SchemaName.WrapReservedAndSnakeCase( DataStoreTypes.MySql, table.ConvertToSnakeCase)}.{table.TableName.WrapReservedAndSnakeCase(DataStoreTypes.MySql, table.ConvertToSnakeCase)} (");
            codeWriter.Indent();

            var first = true;

            foreach (var col in table.Column)
            {
                if (!first)
                {
                    codeWriter.WriteLine(",");
                }
                first = false;

                codeWriter.Write($"{col.ColumnName.WrapReservedAndSnakeCase( DataStoreTypes.MySql, table.ConvertToSnakeCase)}");
                codeWriter.Write("\t");



                codeWriter.Write($" {SqlMapper.MySqlDbTypeToMySql(SqlMapper.DbTypeToMySqlDbType(col.ColumnType))}");
                if (col.DoesNeedLength())
                {
                    codeWriter.Write($"({col.ColumnLength})");
                }
                codeWriter.Write("\t");

                if (col.IsIdentity)
                {
                    codeWriter.Write($" AUTO_INCREMENT");
                }

                if (col.IsPrimaryKey)
                {
                    codeWriter.Write($" PRIMARY KEY");
                }
            }

            codeWriter.Unindent();

            /*
             * foreach (var column in table.Column)
             *  if (!string.IsNullOrEmpty(column.ColumnDescription))
             *  {
             *      codeWriter.WriteLine();
             *      codeWriter.WriteLine("GO");
             *      codeWriter.WriteLine();
             *      codeWriter.WriteLine(GetExtendedPropertyScript(table.Schema.SchemaName, table.TableName,
             *          column.ColumnName, column.ColumnDescription));
             *  }*/
            codeWriter.WriteLine();
            codeWriter.WriteLine(")  ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;");
            return(codeWriter.ToString());

            ;
        }
Example #19
0
        void Run()
        {
            if (m_Report == null)
            {
                return;
            }
            dataGridView.Columns.Clear();
            List <CStatItem>   lstStatItem = new List <CStatItem>();
            List <CBaseObject> lstObj      = m_Report.StatItemMgr.GetList();

            foreach (CBaseObject obj in lstObj)
            {
                lstStatItem.Add((CStatItem)obj);
            }
            lstStatItem.Sort();//按索引idx排序

            foreach (CStatItem StatItem in lstStatItem)
            {
                dataGridView.Columns.Add(StatItem.Name, StatItem.Name);
            }

            List <string> lstTable = new List <string>();
            string        sFields  = "";
            string        sGroupBy = "";
            string        sOrderBy = "";

            foreach (CStatItem StatItem in lstStatItem)
            {
                string sOrderFiled = "";
                if (StatItem.ItemType == CStatItem.enumItemType.Field)
                {
                    CTable table = (CTable)Program.Ctx.TableMgr.Find(StatItem.FW_Table_id);
                    if (table == null)
                    {
                        continue;
                    }
                    CColumn column = (CColumn)table.ColumnMgr.Find(StatItem.FW_Column_id);
                    if (column == null)
                    {
                        continue;
                    }

                    if (!lstTable.Contains(table.Code))
                    {
                        lstTable.Add(table.Code);
                    }
                    if (StatItem.StatType == CStatItem.enumStatType.Val)
                    {
                        sFields    += string.Format("[{0}].[{1}],", table.Code, column.Code);
                        sGroupBy   += string.Format("[{0}].[{1}],", table.Code, column.Code);
                        sOrderFiled = string.Format("[{0}].[{1}]", table.Code, column.Code);
                    }
                    else
                    {
                        sFields += string.Format("{0}([{1}].[{2}]) as [{3}],",
                                                 StatItem.GetStatTypeFunc(), table.Code, column.Code, StatItem.Name);
                        sOrderFiled = StatItem.Name;
                    }
                }
                else
                {
                    sFields    += string.Format("({0}) as [{1}],", StatItem.Formula, StatItem.Name);
                    sOrderFiled = StatItem.Name;
                }

                if (StatItem.Order == CStatItem.enumOrder.Asc)
                {
                    sOrderBy += sOrderFiled + ",";
                }
                else if (StatItem.Order == CStatItem.enumOrder.Desc)
                {
                    sOrderBy += sOrderFiled + " desc,";
                }
            }
            sFields  = sFields.TrimEnd(",".ToCharArray());
            sGroupBy = sGroupBy.TrimEnd(",".ToCharArray());
            sOrderBy = sOrderBy.TrimEnd(",".ToCharArray());

            string sTable = "";

            foreach (string sTb in lstTable)
            {
                sTable += sTb + ",";
            }
            sTable = sTable.TrimEnd(",".ToCharArray());

            string sSql = string.Format("select {0} from {1} ", sFields, sTable);

            sSql += " where IsDeleted=0 ";
            if (m_Report.Filter.Trim() != "")
            {
                sSql += " and " + m_Report.Filter;
            }
            if (sGroupBy != "")
            {
                sSql += " group by " + sGroupBy;
            }
            if (sOrderBy != "")
            {
                sSql += " order by " + sOrderBy;
            }

            //因为采用构造sql语句的方法来运行报表,所以仅考虑单数据库的情况,
            //即取主数据库。如果考虑多数据库分布存储情况,则使用对象来计算报表。
            DataTable dt = Program.Ctx.MainDB.QueryT(sSql);

            if (dt == null)
            {
                MessageBox.Show("运行报表失败,请修改报表定义!");
                return;
            }

            foreach (DataRow r in dt.Rows)
            {
                dataGridView.Rows.Add(1);
                DataGridViewRow row = dataGridView.Rows[dataGridView.Rows.Count - 1];
                for (int col = 0; col < dataGridView.Columns.Count; col++)
                {
                    row.Cells[col].Value = r[col];
                }
            }
        }
Example #20
0
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            if (Parameter.GetFieldValue("COSTING_TYPE").Equals("IMPORT"))
            {
                Parameter.SetFieldValue("DOCUMENT_TYPE", "1");
            }
            else if (Parameter.GetFieldValue("COSTING_TYPE").Equals("EXPORT"))
            {
                Parameter.SetFieldValue("DOCUMENT_TYPE", "2");
            }
            else if (Parameter.GetFieldValue("COSTING_TYPE").Equals("ADJUST"))
            {
                Parameter.SetFieldValue("DOCUMENT_TYPE", "4");
            }

            ArrayList arr = OnixWebServiceAPI.GetInventoryTransactionList(Parameter);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            #region First Header Case : Row is 0
            if (arr.Count == 0)
            {
                arr.Add(Parameter); //add for show header and first row empty
            }
            #endregion
            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];
                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }

                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            Parameter.SetFieldValue("DOCUMENT_TYPE", ((int)CashDocumentType.CashDocExport).ToString());
            ArrayList arr = OnixWebServiceAPI.GetCashDocList(Parameter);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }

                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
Example #22
0
        public static void InitReports()
        {
            if (reports == null)
            {
                reports = new Hashtable();

                CTable o1 = new CTable("");
                o1.SetFieldValue("COSTING_TYPE", "AVG");

                CTable o2 = new CTable("");
                o2.SetFieldValue("COSTING_TYPE", "FIFO");

                CTable o3 = new CTable("");
                o3.SetFieldValue("COSTING_TYPE", "IMPORT");

                CTable o4 = new CTable("");
                o4.SetFieldValue("COSTING_TYPE", "EXPORT");

                CTable o5 = new CTable("");
                o5.SetFieldValue("COSTING_TYPE", "ADJUST");

                CTable o6 = new CTable("");
                o6.SetFieldValue("COSTING_TYPE", "MOVE");

                //Inventory Report
                addReport(ReportGroupEnum.ReportGroupInventory, "rpt_inv_item_list", "CReportInventory000_01_ItemList", null);
                addReport(ReportGroupEnum.ReportGroupInventory, "rpt_inv_balance_summary_avg", "CReportInventory001_01_ItemBalance", o1);
                addReport(ReportGroupEnum.ReportGroupInventory, "rpt_inv_movement_avg", "CReportInv002_01_InventoryMovementSum", o1);
                addReport(ReportGroupEnum.ReportGroupInventory, "rpt_inv_movement_summary_avg", "CReportInv003_01_InventoryMoveSumDay", o1);
                addReport(ReportGroupEnum.ReportGroupInventory, "rpt_inv_movement_summary_all", "CReportInventory003_03_MovementSummary", null);

                addReport(ReportGroupEnum.ReportGroupCash, "rpt_cash_movement", "CReportCash001_01_CashMovementByAccount", null);

                CTable cq1 = new CTable("");
                cq1.SetFieldValue("DIRECTION", "2");
                addReport(ReportGroupEnum.ReportGroupCash, "rpt_cheque_payable", "CReportCheque001_01_SalePurchase", cq1);

                CTable cq2 = new CTable("");
                cq2.SetFieldValue("DIRECTION", "1");
                addReport(ReportGroupEnum.ReportGroupCash, "rpt_cheque_receivable", "CReportCheque001_01_SalePurchase", cq2);


                //Sale Report
                CTable sl0 = new CTable("");
                sl0.SetFieldValue("CATEGORY", "1");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_ar_movement_debtor", "CReportArAp001_01_Movement", sl0);

                CTable sl1 = new CTable("");
                sl1.SetFieldValue("CATEGORY", "1");
                sl1.SetFieldValue("INTERNAL_DRCR_FLAG", "N"); //ทำเป็น flag ให้เลือกได้ใน gui จะเหมาะกว่า
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_ar_invoiceList002_01", "CReportInvoice001_03_SalePurchase", sl1);

                CTable st0 = new CTable("");
                st0.SetFieldValue("CATEGORY", "1");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_tax_by_document", "CReportPurchase001_01_SalePurchaseTax", st0);

                CTable st0_1 = new CTable("");
                st0_1.SetFieldValue("CATEGORY", "1");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_wh_tax", "CReportPurchase001_02_SalePurchaseWhTax", st0_1);

                CTable st1 = new CTable("");
                st1.SetFieldValue("CATEGORY", "1");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_daily_per_day", "CReportSale004_01_SalePurchaseDailyPerDay", st1);

                CTable s0 = new CTable("");
                s0.SetFieldValue("CATEGORY", "1");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_payment", "CReportPayment001_01_SalePurchase", s0);

                CTable s1 = new CTable("");
                s1.SetFieldValue("CATEGORY", "1");
                s1.SetFieldValue("REPORT_TYPE", "1");
                s1.SetFieldValue("INTERNAL_DRCR_FLAG", "N"); //ทำเป็น flag ให้เลือกได้ใน gui จะเหมาะกว่า
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_invoice_list", "CReportInvoice001_01_SalePurchase", s1);

                CTable s2 = new CTable("");
                s2.SetFieldValue("CATEGORY", "1");
                s2.SetFieldValue("REPORT_TYPE", "2");
                s2.SetFieldValue("INTERNAL_DRCR_FLAG", "N"); //ทำเป็น flag ให้เลือกได้ใน gui จะเหมาะกว่า
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_invoice_by_project", "CReportInvoice001_01_SalePurchase", s2);

                CTable s3 = new CTable("");
                s3.SetFieldValue("CATEGORY", "1");
                s3.SetFieldValue("REPORT_TYPE", "3");
                s3.SetFieldValue("INTERNAL_DRCR_FLAG", "N"); //ทำเป็น flag ให้เลือกได้ใน gui จะเหมาะกว่า
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_invoice_by_project_group", "CReportInvoice001_02_SalePurchase", s3);

                CTable p4 = new CTable("");
                p4.SetFieldValue("CATEGORY", "1");
                p4.SetFieldValue("REPORT_TYPE", "1");
                p4.SetFieldValue("INTERNAL_DRCR_FLAG", "N"); //ทำเป็น flag ให้เลือกได้ใน gui จะเหมาะกว่า
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_sale_invoice_detail_list", "CReportInvoice001_02_SalePurchase", p4);

                CTable prf1 = new CTable("");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_profit_summary_by_month", "CReportProfit001_01_ProfitByMonth", prf1);

                CTable prf2 = new CTable("");
                prf2.SetFieldValue("REPORT_TYPE", "1");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_profit_summary_by_project", "CReportProfit001_02_ProfitByProject", prf2);

                CTable prf3 = new CTable("");
                prf3.SetFieldValue("REPORT_TYPE", "2");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_profit_summary_by_project_group", "CReportProfit001_02_ProfitByProject", prf3);

                //ACD
                CTable prfA = new CTable("");
                prf3.SetFieldValue("REPORT_TYPE", "2");
                addReport(ReportGroupEnum.ReportGroupSale, "rpt_profit_summary_by_month_acd", "AcDesign.CReportProfitACD_01_ProfitByMonth", prfA);



                //Purchase Report
                CTable tx0 = new CTable("");
                tx0.SetFieldValue("CATEGORY", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_tax", "CReportPurchase001_01_SalePurchaseTax", tx0);

                CTable tx1 = new CTable("");
                tx1.SetFieldValue("CATEGORY", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_wh_tax", "CReportPurchase001_02_SalePurchaseWhTax", tx1);

                CTable p0 = new CTable("");
                p0.SetFieldValue("CATEGORY", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_payment", "CReportPayment001_01_SalePurchase", p0);

                CTable p1 = new CTable("");
                p1.SetFieldValue("CATEGORY", "2");
                p1.SetFieldValue("REPORT_TYPE", "1");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_invoice_list", "CReportInvoice001_01_SalePurchase", p1);

                CTable p2 = new CTable("");
                p2.SetFieldValue("CATEGORY", "2");
                p2.SetFieldValue("REPORT_TYPE", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_invoice_by_project", "CReportInvoice001_01_SalePurchase", p2);

                CTable p2_1 = new CTable("");
                p2_1.SetFieldValue("CATEGORY", "2");
                p2_1.SetFieldValue("REPORT_TYPE", "3");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_invoice_by_project_group", "CReportInvoice001_02_SalePurchase", p2_1);

                CTable p2_3 = new CTable("");
                p2_3.SetFieldValue("CATEGORY", "2");
                p2_3.SetFieldValue("REPORT_TYPE", "3");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_invoice_summ_by_project_group", "CReportInvoice001_04_SalePurchase", p2_3);


                CTable p2_2 = new CTable("");
                p2_2.SetFieldValue("CATEGORY", "2");
                p2_2.SetFieldValue("REPORT_TYPE", "4");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_invoice_by_project_code", "CReportInvoice001_02_SalePurchase", p2_2);

                CTable p3 = new CTable("");
                p3.SetFieldValue("CATEGORY", "2");
                p3.SetFieldValue("REPORT_TYPE", "1");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_purchase_invoice_detail_list", "CReportInvoice001_02_SalePurchase", p3);

                CTable p3_a = new CTable("");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_account_owner_payment", "CReportPayment001_02_OwnerAccountPurchase", p3_a);

                CTable p3_b = new CTable("");
                p3_b.SetFieldValue("CATEGORY", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_invoice_detail", "CReportInvoice004_01_InvoiceTransaction", p3_b);

                CTable p3_c = new CTable("");
                p3_c.SetFieldValue("CATEGORY", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_po_detail", "CReportInvoice005_PoTransaction", p3_c);

                CTable p3_0 = new CTable("");
                p3_0.SetFieldValue("CATEGORY", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_ap_movement", "CReportArAp001_01_Movement", p3_0);

                CTable p3_1 = new CTable("");
                p3_1.SetFieldValue("CATEGORY", "2");
                addReport(ReportGroupEnum.ReportGroupPurchase, "rpt_ap_invoiceList002_01", "CReportInvoice001_03_SalePurchase", p3_1);


                //General
                addReport(ReportGroupEnum.ReportGroupGeneral, "rpt_service_list", "CReportGeneral001_01_ServicesList", null);

                //Hr
                addReport(ReportGroupEnum.ReportGroupHr, "rpt_employee_payroll_list", "CReportPayroll001_01_EmployeeListPayroll", null);
                addReport(ReportGroupEnum.ReportGroupHr, "rpt_employee_payroll_by_date", "CReportPayroll001_02_EmployeeListPayroll", null);
                addReport(ReportGroupEnum.ReportGroupHr, "rpt_employee_leave", "CReportEmployee00_01_EmployeeLeave", null);
                addReport(ReportGroupEnum.ReportGroupHr, "rpt_employee_tax", "CReportEmployee00_02_EmployeeTax", null);
                addReport(ReportGroupEnum.ReportGroupHr, "rpt_employee_social_insurance", "CReportEmployee00_03_EmployeeSocialInsure", null);
                addReport(ReportGroupEnum.ReportGroupHr, "rpt_employee_revenue", "CReportEmployee00_04_EmployeeRevenue", null);
                addReport(ReportGroupEnum.ReportGroupHr, "rpt_employee_yearly_tax", "CReportEmployee00_05_EmployeeYearlyTax", null);
            }
        }
Example #23
0
 public MReceiptItem(CTable obj) : base(obj)
 {
 }
Example #24
0
        //生成自引用树节点
        List <TreeNode> SelfLoop(CTableInFormControl tiwc, string sFilter, TreeNode pnode)
        {
            List <TreeNode> lstTreeNode = new List <TreeNode>();

            CTable table = (CTable)Program.Ctx.TableMgr.Find(tiwc.FW_Table_id);

            if (table == null)
            {
                return(lstTreeNode);
            }
            CBaseObjectMgr BaseObjectMgr = new CBaseObjectMgr();

            BaseObjectMgr.Ctx    = Program.Ctx;
            BaseObjectMgr.TbCode = table.Code;
            List <CBaseObject> lstObj = BaseObjectMgr.GetList(sFilter);

            foreach (CBaseObject obj in lstObj)
            {
                string sText  = tiwc.Text.ToLower();
                int    iStart = 0;
                while (sText.IndexOf('[', iStart) > -1)
                {
                    int idx1 = sText.IndexOf('[', iStart);
                    int idx2 = sText.IndexOf(']', idx1);
                    iStart = idx1 + 1;
                    if (idx2 > idx1)
                    {
                        string  sCodeN = sText.Substring(idx1, idx2 - idx1 + 1);
                        string  sCode  = sCodeN.Substring(1, sCodeN.Length - 2);
                        CColumn column = table.ColumnMgr.FindByCode(sCode);
                        if (column == null)
                        {
                            continue;
                        }
                        string sVal = obj.GetColValue(column).ToString();
                        sText = sText.Replace(sCodeN, sVal);
                    }
                }

                TreeNode node = new TreeNode();
                node.Text = sText;
                node.Tag  = obj;
                if (pnode == null)
                {
                    treeView.Nodes.Add(node);
                }
                else
                {
                    pnode.Nodes.Add(node);
                }

                CColumn col   = (CColumn)table.ColumnMgr.Find(tiwc.NodeIDCol);
                CColumn pcol  = (CColumn)table.ColumnMgr.Find(tiwc.PNodeIDCol);
                string  sVal2 = obj.GetColValue(col).ToString();
                if (col.ColType == ColumnType.string_type ||
                    col.ColType == ColumnType.ref_type ||
                    col.ColType == ColumnType.guid_type ||
                    col.ColType == ColumnType.datetime_type ||
                    col.ColType == ColumnType.text_type)
                {
                    sVal2 = "'" + sVal2 + "'";
                }
                string sSubFilter2 = string.Format(" {0}={1}", pcol.Code, sVal2);

                string sFilter2 = tiwc.QueryFilter;
                if (sFilter2.Trim() != "")
                {
                    sFilter2 += " and ";
                }
                sFilter2 += sSubFilter2;
                SelfLoop(tiwc, sFilter2, node);

                lstTreeNode.Add(node);
            }

            return(lstTreeNode);
        }
Example #25
0
 public MVoucherTemplate(CTable obj) : base(obj)
 {
 }
Example #26
0
    void GetDetail()
    {
        CBaseObject objP  = (CBaseObject)Session["AddMasterDetailViewRecord"];
        CViewDetail vd    = (CViewDetail)m_View.ViewDetailMgr.GetFirstObj();
        CTable      table = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(vd.FW_Table_id);

        //判断表权限
        AccessType tableAccessType = m_User.GetTableAccess(table.Id);

        if (tableAccessType == AccessType.forbide)
        {
            Response.Write("没有表权限!");
            return;
        }
        else if (tableAccessType == AccessType.read)
        {
        }
        else
        {
        }
        m_sortDetailRestrictColumnAccessType = m_User.GetRestrictColumnAccessTypeList(table);
        //
        CBaseObjectMgr objMgr = objP.GetSubObjectMgr(table.Code, typeof(CBaseObjectMgr));

        string  sData = "";
        CColumn colF  = (CColumn)table.ColumnMgr.Find(vd.ForeignKey);

        if (colF == null)
        {
            return;
        }
        List <CBaseObject> lstObj = objMgr.GetList();

        foreach (CBaseObject obj in lstObj)
        {
            string sRow = "";
            foreach (CBaseObject objC in table.ColumnMgr.GetList())
            {
                CColumn col = (CColumn)objC;
                //判断禁止权限字段
                if (m_sortDetailRestrictColumnAccessType.ContainsKey(col.Id))
                {
                    AccessType accessType = m_sortDetailRestrictColumnAccessType[col.Id];
                    if (accessType == AccessType.forbide)
                    {
                        string sVal = "";
                        sRow += string.Format("\"{0}\":\"{1}\",", col.Code, sVal);
                        continue;
                    }
                }
                //

                if (col.ColType == ColumnType.object_type)
                {
                    string sVal = "";
                    if (obj.GetColValue(col) != null)
                    {
                        sVal = "long byte";
                    }
                    sRow += string.Format("\"{0}\":\"{1}\",", col.Code, sVal);
                }
                else if (col.ColType == ColumnType.ref_type)
                {
                    CTable RefTable = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(col.RefTable);
                    if (RefTable == null)
                    {
                        continue;
                    }
                    CBaseObjectMgr objRefMgr = new CBaseObjectMgr();
                    objRefMgr.TbCode = RefTable.Code;
                    objRefMgr.Ctx    = Global.GetCtx(Session["TopCompany"].ToString());

                    CColumn            RefCol     = (CColumn)RefTable.ColumnMgr.Find(col.RefCol);
                    CColumn            RefShowCol = (CColumn)RefTable.ColumnMgr.Find(col.RefShowCol);
                    string             sWhere     = string.Format(" {0}=?", RefCol.Code);
                    List <DbParameter> cmdParas   = new List <DbParameter>();
                    cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col)));
                    List <CBaseObject> lstObj2 = objRefMgr.GetList(sWhere, cmdParas);
                    string             sVal    = "";
                    if (lstObj2.Count > 0)
                    {
                        CBaseObject obj2   = lstObj2[0];
                        object      objVal = obj2.GetColValue(RefShowCol);
                        if (objVal != null)
                        {
                            sVal = objVal.ToString();
                        }
                    }
                    sRow += string.Format("\"{0}\":\"{1}\",", col.Code, sVal);
                }
                else
                {
                    string sVal   = "";
                    object objVal = obj.GetColValue(col);
                    if (objVal != null)
                    {
                        sVal = objVal.ToString();
                    }
                    Util.ConvertJsonSymbol(ref sVal);
                    sRow += string.Format("\"{0}\":\"{1}\",", col.Code, sVal);
                }
            }
            sRow   = sRow.TrimEnd(",".ToCharArray());
            sRow   = "{" + sRow + "},";
            sData += sRow;
        }
        sData = sData.TrimEnd(",".ToCharArray());
        sData = "[" + sData + "]";
        string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}"
                                     , sData, lstObj.Count);

        Response.Write(sJson);
    }
Example #27
0
    void PostData()
    {
        string id       = Request["id"];
        string Name     = Request["Name"];
        string Code     = Request["Code"];
        string IsSystem = Request["IsSystem"];
        string GridData = Request["GridData"];

        CUser user = (CUser)Session["User"];

        if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Code))
        {
            Response.Write("数据不完整!");
            return;
        }
        else
        {
            if (Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.FindByName(Name) != null)
            {
                Response.Write("相同名称的表已经存在!");
                return;
            }
            if (Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.FindByCode(Code) != null)
            {
                Response.Write("相同编码的表已经存在!");
                return;
            }

            CTable table = new CTable();
            table.Ctx      = Global.GetCtx(Session["TopCompany"].ToString());
            table.Id       = new Guid(id);
            table.Name     = Name;
            table.Code     = Code;
            table.IsSystem = Convert.ToBoolean(IsSystem);
            table.IsFinish = true;
            table.Creator  = user.Id;
            //系统字段
            {
                CColumn col = new CColumn();
                col.Ctx         = table.Ctx;
                col.FW_Table_id = table.Id;
                col.Name        = "id";
                col.Code        = "id";
                col.ColType     = ColumnType.guid_type;
                col.ColLen      = 16;
                col.AllowNull   = false;
                col.IsSystem    = true;
                col.IsUnique    = true;
                col.IsVisible   = false;
                col.Idx         = 0;
                col.Creator     = user.Id;
                table.ColumnMgr.AddNew(col);

                col             = new CColumn();
                col.Ctx         = table.Ctx;
                col.FW_Table_id = table.Id;
                col.Name        = "创建时间";
                col.Code        = "Created";
                col.ColType     = ColumnType.datetime_type;
                col.ColLen      = 8;
                //col.DefaultValue = "getdate()";
                col.AllowNull = true;
                col.IsSystem  = true;
                col.IsUnique  = false;
                col.IsVisible = false;
                col.Idx       = 1;
                col.Creator   = user.Id;
                table.ColumnMgr.AddNew(col);

                col             = new CColumn();
                col.Ctx         = table.Ctx;
                col.FW_Table_id = table.Id;
                col.Name        = "创建者";
                col.Code        = "Creator";
                col.ColType     = ColumnType.ref_type;
                CTable tableUser = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.FindByCode("B_User");
                Guid   guidUid   = Guid.Empty;
                Guid   guidUname = Guid.Empty;
                if (tableUser != null)
                {
                    col.RefTable = tableUser.Id;
                    CColumn colUid = tableUser.ColumnMgr.FindByCode("id");
                    col.RefCol = colUid.Id;
                    guidUid    = col.RefCol;
                    CColumn colUname = tableUser.ColumnMgr.FindByCode("name");
                    col.RefShowCol = colUname.Id;
                    guidUname      = col.RefShowCol;
                }
                col.ColLen = 16;
                //col.DefaultValue = "0";
                col.AllowNull = true;
                col.IsSystem  = true;
                col.IsUnique  = false;
                col.IsVisible = false;
                col.Idx       = 2;
                col.Creator   = user.Id;
                table.ColumnMgr.AddNew(col);

                col             = new CColumn();
                col.Ctx         = table.Ctx;
                col.FW_Table_id = table.Id;
                col.Name        = "修改时间";
                col.Code        = "Updated";
                col.ColType     = ColumnType.datetime_type;
                col.ColLen      = 8;
                //col.DefaultValue = "getdate()";
                col.AllowNull = true;
                col.IsSystem  = true;
                col.IsUnique  = false;
                col.IsVisible = false;
                col.Idx       = 3;
                col.Creator   = user.Id;
                table.ColumnMgr.AddNew(col);

                col             = new CColumn();
                col.Ctx         = table.Ctx;
                col.FW_Table_id = table.Id;
                col.Name        = "修改者";
                col.Code        = "Updator";
                col.ColType     = ColumnType.ref_type;
                if (tableUser != null)
                {
                    col.RefTable   = tableUser.Id;
                    col.RefCol     = guidUid;
                    col.RefShowCol = guidUname;
                }
                col.ColLen = 16;
                //col.DefaultValue = "0";
                col.AllowNull = true;
                col.IsSystem  = true;
                col.IsUnique  = false;
                col.IsVisible = false;
                col.Idx       = 4;
                col.Creator   = user.Id;
                table.ColumnMgr.AddNew(col);
            }
            //自定义字段
            int      iLastIdx = 4;
            string[] arr1     = Regex.Split(GridData, ";");
            foreach (string str1 in arr1)
            {
                if (str1.Length == 0)
                {
                    continue;
                }
                iLastIdx++;

                string[] arr2 = Regex.Split(str1, ",");
                CColumn  col  = new CColumn();
                col.Ctx          = table.Ctx;
                col.FW_Table_id  = table.Id;
                col.Id           = new Guid(arr2[0]);
                col.Name         = arr2[1];
                col.Code         = arr2[2];
                col.ColType      = CColumn.ConvertStringToColType(arr2[3]);
                col.ColLen       = Convert.ToInt32(arr2[4]);
                col.AllowNull    = (arr2[5] == "1")?true:false;
                col.IsSystem     = (arr2[6] == "1") ? true : false;
                col.IsUnique     = (arr2[17] == "1") ? true : false;
                col.IsVisible    = true;
                col.DefaultValue = arr2[7];
                col.ColDecimal   = (arr2[8] != "") ? Convert.ToInt32(arr2[8]) : 0;
                col.Formula      = arr2[9];
                if (col.ColType == ColumnType.ref_type)
                {
                    col.RefTable   = new Guid(arr2[10]);
                    col.RefCol     = new Guid(arr2[12]);
                    col.RefShowCol = new Guid(arr2[14]);
                }
                if (arr2[16].Trim() != "")
                {
                    col.ColumnEnumValMgr.RemoveAll();
                    string[] arrEnum = Regex.Split(arr2[16].Trim(), "/");
                    for (int i = 0; i < arrEnum.Length; i++)
                    {
                        string         sEnumVal = arrEnum[i];
                        CColumnEnumVal ev       = new CColumnEnumVal();
                        ev.Ctx          = col.Ctx;
                        ev.FW_Column_id = col.Id;
                        ev.Val          = sEnumVal;
                        ev.Idx          = i;
                        col.ColumnEnumValMgr.AddNew(ev);
                    }
                }
                col.Idx     = iLastIdx;
                col.Creator = user.Id;
                table.ColumnMgr.AddNew(col);
            }

            Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.AddNew(table);

            if (!CTable.CreateDataTable(table))
            {
                Response.Write("创建表失败!");
                return;
            }
            if (!Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Save(true))
            {
                Response.Write("添加失败!");
                return;
            }
        }
    }
Example #28
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            String tmpPrevKey = prevProject;
            int    rowcount   = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            ArrayList keepTotal1 = copyTotalArray(projSums);
            ArrayList keepTotal2 = copyTotalArray(sums);

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            if (newh > 0)
            {
                filterDrCrAmount(o);
                populatePaymentIndex(o);

                String projCd = o.GetFieldValue(getGroupKey());
                if (row == 0)
                {
                    prevProject = projCd;
                }

                String rptType = Parameter.GetFieldValue("REPORT_TYPE");
                if (!projCd.Equals(prevProject))
                {
                    prevProject = projCd;

                    CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr = ft.Clone();

                    ArrayList projTotals = displayTotalTexts("L1", projSums, 1, "total");
                    ftr.FillColumnsText(projTotals);

                    if (rptType.Equals("2") || rptType.Equals("3"))
                    {
                        //Only by project report
                        rpp.AddReportRow(ftr);
                        newh = newh - ftr.GetHeight();
                    }

                    //Reset
                    projSums = new ArrayList();
                }

                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums     = sumDataTexts("L1", sums, temps);
                projSums = sumDataTexts("L1", projSums, temps);

                if (row == rowcount - 1)
                {
                    //=== Project
                    CRow ft0  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr0 = ft0.Clone();

                    ArrayList projTotals = displayTotalTexts("L1", projSums, 1, "total");
                    ftr0.FillColumnsText(projTotals);

                    if (rptType.Equals("2") || rptType.Equals("3"))
                    {
                        //Only by project report
                        rpp.AddReportRow(ftr0);
                        newh = newh - ftr0.GetHeight();
                    }

                    //=== End row
                    CRow ft1  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr1 = ft1.Clone();

                    ArrayList totals = displayTotalTexts("L1", sums, 1, "total");
                    ftr1.FillColumnsText(totals);

                    rpp.AddReportRow(ftr1);
                    newh = newh - ftr1.GetHeight();
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                projSums    = keepTotal1;
                sums        = keepTotal2;
                prevProject = tmpPrevKey;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #29
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            if (cbTable.SelectedIndex == -1)
            {
                MessageBox.Show("请选择表!");
                return;
            }
            if (cbColumn.SelectedIndex == -1)
            {
                MessageBox.Show("请选择字段!");
                return;
            }
            if (cbSign.SelectedIndex == -1)
            {
                MessageBox.Show("请选择条件符号!");
                return;
            }
            if (txtVal.Text.Trim() == "")
            {
                MessageBox.Show("请输入值!");
                return;
            }
            DataItem itTb   = (DataItem)cbTable.SelectedItem;
            CTable   table  = (CTable)itTb.Data;
            DataItem itCol  = (DataItem)cbColumn.SelectedItem;
            CColumn  column = (CColumn)itCol.Data;

            string sVal = txtVal.Text.Trim();

            if (column.ColType == ColumnType.guid_type ||
                column.ColType == ColumnType.datetime_type ||
                column.ColType == ColumnType.ref_type ||
                column.ColType == ColumnType.string_type ||
                column.ColType == ColumnType.text_type)
            {
                if (sVal[0] != '\'' || sVal[sVal.Length - 1] != '\'')
                {
                    sVal = "'" + sVal + "'";
                }
            }

            string sCond = string.Format("[{0}].[{1}]{2}{3}",
                                         table.Code,
                                         column.Code,
                                         cbSign.SelectedItem.ToString(),
                                         sVal);

            if (txtFilter.Text.Trim() == "")
            {
                txtFilter.Text = sCond;
            }
            else
            {
                if (rdAnd.Checked)
                {
                    sCond = " and " + sCond;
                }
                else
                {
                    sCond = " or " + sCond;
                }

                txtFilter.Text += sCond;
            }
        }
        private Boolean SaveData(String approveFlag)
        {
            if (!CHelper.VerifyAccessRight(getAccessRightEdit()))
            {
                return(false);
            }

            vw.DocumentType = ((int)dt).ToString();
            vw.ConstructWhDefinitionFromCrDr();
            vw.CalculateARAmountForDrCr();

            if (approveFlag.Equals("Y"))
            {
                Boolean result = SaveToView();
                if (!result)
                {
                    return(false);
                }

                CUtil.EnableForm(false, this);
                CTable t = OnixWebServiceAPI.ApproveAccountDoc(vw.GetDbObject().Clone());
                CUtil.EnableForm(true, this);
                if (t != null)
                {
                    MInventoryDoc vcd = new MInventoryDoc(t);
                    vcd.InitErrorItem();
                    if (vcd.ErrorItems.Count > 0)
                    {
                        WinErrorDetails w = new WinErrorDetails(vcd.ErrorItems, "InventoryDoc");
                        w.Title = CLanguage.getValue("approve_error");
                        w.ShowDialog();
                    }
                    else
                    {
                        if (Mode.Equals("A"))
                        {
                            vw.SetDbObject(t);
                            vw.DocumentStatus = ((int)CashDocumentStatus.CashDocApproved).ToString();
                            (vw as MAccountDoc).NotifyAllPropertiesChanged();

                            if (itemAddedHandler != null)
                            {
                                itemAddedHandler(vw, null);
                            }
                            else
                            {
                                //Will be obsoleted soon
                                parentItemsSource.Insert(0, vw);
                            }
                        }
                        else if (Mode.Equals("E"))
                        {
                            actualView.SetDbObject(t);
                            actualView.DocumentStatus = ((int)CashDocumentStatus.CashDocApproved).ToString();
                            (actualView as MAccountDoc).NotifyAllPropertiesChanged();
                        }

                        vw.IsModified = false;
                        this.Close();
                    }
                }
            }

            else if (Mode.Equals("A"))
            {
                //Not used
            }
            else if (Mode.Equals("E"))
            {
                if (vw.IsModified)
                {
                    Boolean result = SaveToView();
                    if (result)
                    {
                        CUtil.EnableForm(false, this);
                        CTable t = OnixWebServiceAPI.AdjustApproveAccountDoc(vw.GetDbObject());
                        CUtil.EnableForm(true, this);
                        if (t != null)
                        {
                            actualView.SetDbObject(t);
                            actualView.NotifyAllPropertiesChanged();

                            return(true);
                        }

                        CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_EDIT", null);
                    }

                    return(false);
                }

                return(true);
            }

            return(false);
        }
Example #31
0
 public void OnNavigatedTo(object sender)
 {
     NewCTable = new CTable();
 }
Example #32
0
        static bool TryReadMetaData(MemoryMappedFile file, long size, out Metadata metadata, out string error)
        {
            if (size < FeatherMagic.MAGIC_HEADER_SIZE * 2)
            {
                metadata = default(Metadata);
                error    = $"File too small ({size:N0} bytes) to be a valid feather file";
                return(false);
            }

            using (var accessor = file.CreateViewAccessor())
            {
                var leadingHeader = accessor.ReadInt32(0);

                if (leadingHeader != FeatherMagic.MAGIC_HEADER)
                {
                    metadata = default(Metadata);
                    error    = $"Magic header malformed";
                    return(false);
                }

                var trailingHeader = accessor.ReadInt32(size - FeatherMagic.MAGIC_HEADER_SIZE);

                if (trailingHeader != FeatherMagic.MAGIC_HEADER)
                {
                    metadata = default(Metadata);
                    error    = $"Magic footer malformed";
                    return(false);
                }

                var metadataSize = accessor.ReadUInt32(size - FeatherMagic.MAGIC_HEADER_SIZE - sizeof(uint));

                var metadataStart = size - FeatherMagic.MAGIC_HEADER_SIZE - sizeof(uint) - metadataSize;
                if (metadataStart < FeatherMagic.MAGIC_HEADER_SIZE || metadataSize > int.MaxValue)
                {
                    metadata = default(Metadata);
                    error    = $"Metadata size ({metadataSize:N0}) is invalid";
                    return(false);
                }

                var metadataBytes = new byte[metadataSize];
                accessor.ReadArray(metadataStart, metadataBytes, 0, (int)metadataSize);

                // note: It'd be nice to not actually use flatbuffers for this,
                //   kind of a heavy (re)build dependency for reading, like, 4
                //   things
                var metadataBuffer = new ByteBuffer(metadataBytes);
                var metadataCTable = CTable.GetRootAsCTable(metadataBuffer);

                if (metadataCTable.Version != FeatherMagic.FEATHER_VERSION)
                {
                    error    = $"Unexpected version {metadataCTable.Version}, only {FeatherMagic.FEATHER_VERSION} is supported";
                    metadata = default(Metadata);
                    return(false);
                }

                if (metadataCTable.ColumnsLength <= 0)
                {
                    error    = $"Invalid number of columns: {metadataCTable.ColumnsLength:N0}";
                    metadata = default(Metadata);
                    return(false);
                }

                var columnSpecs = new ColumnSpec[metadataCTable.ColumnsLength];
                for (var i = 0; i < columnSpecs.Length; i++)
                {
                    var metadataColumn = metadataCTable.Columns(i).Value;
                    var name           = metadataColumn.Name;
                    var metadataType   = metadataColumn.MetadataType;

                    string[] categoryLevels         = null;
                    DateTimePrecisionType precision = default(DateTimePrecisionType);

                    var arrayDetails  = metadataColumn.Values.Value;
                    var effectiveType = arrayDetails.Type;

                    switch (metadataType)
                    {
                    case TypeMetadata.CategoryMetadata:
                        if (!TryReadCategoryLevels(accessor, ref metadataColumn, out categoryLevels, out error))
                        {
                            metadata = default(Metadata);
                            return(false);
                        }
                        break;

                    case TypeMetadata.TimestampMetadata:
                        if (arrayDetails.Type != feather.fbs.Type.INT64)
                        {
                            metadata = default(Metadata);
                            error    = $"Column {name} has Timestamp metadata, but isn't backed by an Int64 array";
                            return(false);
                        }

                        if (!TryReadTimestampPrecision(ref metadataColumn, out precision, out error))
                        {
                            metadata = default(Metadata);
                            return(false);
                        }

                        // note: this type is spec'd (https://github.com/wesm/feather/blob/master/cpp/src/feather/metadata.fbs#L25),
                        //  but it looks like R always writes it as an int64?
                        // Possibly a bug.
                        effectiveType = feather.fbs.Type.TIMESTAMP;

                        break;

                    case TypeMetadata.TimeMetadata:
                        if (arrayDetails.Type != feather.fbs.Type.INT64)
                        {
                            metadata = default(Metadata);
                            error    = $"Column {name} has Time metadata, but isn't backed by an Int64 array";
                            return(false);
                        }

                        if (!TryReadTimePrecision(ref metadataColumn, out precision, out error))
                        {
                            metadata = default(Metadata);
                            return(false);
                        }

                        // note: this type is spec'd (https://github.com/wesm/feather/blob/master/cpp/src/feather/metadata.fbs#L27),
                        //  but it looks like R always writes it as an int64?
                        // Possibly a bug.
                        effectiveType = feather.fbs.Type.TIME;

                        break;

                    case TypeMetadata.DateMetadata:
                        if (arrayDetails.Type != feather.fbs.Type.INT32)
                        {
                            metadata = default(Metadata);
                            error    = $"Column {name} has Time metadata, but isn't backed by an Int32 array";
                            return(false);
                        }

                        // note: this type is spec'd (https://github.com/wesm/feather/blob/master/cpp/src/feather/metadata.fbs#L26),
                        //  but it looks like R always writes it as an int32?
                        // Possibly a bug.
                        effectiveType = feather.fbs.Type.DATE;

                        break;

                    case TypeMetadata.NONE: break;
                    }

                    ColumnSpec column;
                    if (!TryMakeColumnSpec(name, effectiveType, ref arrayDetails, categoryLevels, precision, out column, out error))
                    {
                        metadata = default(Metadata);
                        return(false);
                    }

                    columnSpecs[i] = column;
                }

                metadata =
                    new Metadata
                {
                    Columns = columnSpecs,
                    NumRows = metadataCTable.NumRows
                };
                error = null;
                return(true);
            }
        }
Example #33
0
 public MVOrgChart(CTable obj) : base(obj)
 {
 }
Example #34
0
 public MVTaxFormPRV3_53(CTable o) : base(o)
 {
 }
        Control ColumnMapControl(CColumn col)
        {
            //自扩展类优先
            if (!string.IsNullOrEmpty(col.UIControl))
            {
                try
                {
                    object      obj  = Activator.CreateInstance(Type.GetType(col.UIControl));
                    IColumnCtrl ctrl = (IColumnCtrl)obj;
                    ctrl.SetCaption(col.Name + ":");
                    if (BaseObject != null)
                    {
                        ctrl.SetValue(BaseObject.GetColValue(col));
                    }
                    return((Control)ctrl);
                }
                catch
                {
                }
            }
            switch (col.ColType)
            {
            case ColumnType.string_type:
            {
                ExTextBox ctrl = new ExTextBox();
                ctrl.Width = 300;
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.text_type:
            {
                ExTextBox ctrl = new ExTextBox();
                ctrl.textBox.Multiline  = true;
                ctrl.textBox.ScrollBars = ScrollBars.Both;
                ctrl.Width  = 300;
                ctrl.Height = 100;
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.int_type:
            {
                ExTextBox ctrl = new ExTextBox();
                ctrl.Width = 300;
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.ref_type:
            {
                ExComboBox ctrl = new ExComboBox();
                ctrl.Width = 300;
                CTable         table         = (CTable)Program.Ctx.TableMgr.Find(col.RefTable);
                CBaseObjectMgr BaseObjectMgr = new CBaseObjectMgr();
                BaseObjectMgr.TbCode = table.Code;
                BaseObjectMgr.Ctx    = Program.Ctx;

                CColumn            RefCol     = (CColumn)table.ColumnMgr.Find(col.RefCol);
                CColumn            RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol);
                List <CBaseObject> lstObj     = BaseObjectMgr.GetList();
                foreach (CBaseObject obj in lstObj)
                {
                    DataItem item = new DataItem();
                    item.name = obj.GetColValue(RefShowCol).ToString();
                    item.Data = obj.GetColValue(RefCol);

                    ctrl.comboBox.Items.Add(item);
                }
                ctrl.comboBox.DropDownStyle = ComboBoxStyle.DropDownList;


                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.enum_type:
            {
                ExComboBox ctrl = new ExComboBox();
                ctrl.Width = 300;
                //引用显示字段优先
                if (col.RefShowCol != Guid.Empty)
                {
                    CTable         table         = (CTable)Program.Ctx.TableMgr.Find(col.RefTable);
                    CBaseObjectMgr BaseObjectMgr = new CBaseObjectMgr();
                    BaseObjectMgr.TbCode = table.Code;
                    BaseObjectMgr.Ctx    = Program.Ctx;

                    CColumn            RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol);
                    List <CBaseObject> lstObj     = BaseObjectMgr.GetList();
                    foreach (CBaseObject obj in lstObj)
                    {
                        DataItem item = new DataItem();
                        item.name = obj.GetColValue(RefShowCol).ToString();

                        ctrl.comboBox.Items.Add(item);
                    }
                }
                else
                {
                    List <CBaseObject> lstObj = col.ColumnEnumValMgr.GetList();
                    foreach (CBaseObject obj in lstObj)
                    {
                        CColumnEnumVal cev  = (CColumnEnumVal)obj;
                        DataItem       item = new DataItem();
                        item.name = cev.Val;
                        item.Data = cev.Val;

                        ctrl.comboBox.Items.Add(item);
                    }
                }
                ctrl.comboBox.DropDownStyle = ComboBoxStyle.DropDown;

                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.long_type:
            {
                ExTextBox ctrl = new ExTextBox();
                ctrl.Width = 300;
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);
            }

            case ColumnType.bool_type:
            {
                ExCheckBox ctrl = new ExCheckBox();
                ctrl.Width = 300;
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.numeric_type:
            {
                ExTextBox ctrl = new ExTextBox();
                ctrl.Width = 300;
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.datetime_type:
            {
                ExDateTimePicker ctrl = new ExDateTimePicker();
                ctrl.Width = 300;
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }

            case ColumnType.object_type:
            {
                BinaryCtrl ctrl = new BinaryCtrl();
                ctrl.SetCaption(col.Name + ":");
                if (BaseObject != null)
                {
                    ctrl.SetValue(BaseObject.GetColValue(col));
                }
                return(ctrl);

                break;
            }
            }
            return(new ExTextBox());
        }
Example #36
0
 public MVOTDocument(CTable obj) : base(obj)
 {
 }
Example #37
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;

            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
            CRow ftr = ft.Clone();

            MInventoryTransaction v = new MInventoryTransaction(o);

            double newh = AvailableSpace - nr.GetHeight();

            if (Parameter.GetFieldValue("COSTING_TYPE").Equals("IMPORT"))
            {
                nr.FillColumnsText((row + 1).ToString(), v.DocumentDateFmt, v.DocumentNo, v.LocationName, v.ItemCode, v.ItemNameThai
                                   , CUtil.FormatNumber(v.InQuantityFmt, "-"), CUtil.FormatNumber(v.UIItemUnitPrice, "-"), CUtil.FormatNumber(v.UIItemAmount, "-"));

                totals += CUtil.StringToDouble(v.UIItemAmount);
            }
            else if (Parameter.GetFieldValue("COSTING_TYPE").Equals("EXPORT"))
            {
                nr.FillColumnsText((row + 1).ToString(), v.DocumentDateFmt, v.DocumentNo, v.LocationName, v.ItemCode, v.ItemNameThai
                                   , CUtil.FormatNumber(v.OutQuantityFmt, "-"), CUtil.FormatNumber(v.ItemPrice, "-"), CUtil.FormatNumber(v.ItemAmount, "-"));

                totals += CUtil.StringToDouble(v.ItemAmount);
            }
            else if (Parameter.GetFieldValue("COSTING_TYPE").Equals("ADJUST"))
            {
                nr.FillColumnsText((row + 1).ToString(), v.DocumentDateFmt, v.DocumentNo, v.LocationName, v.ItemCode, v.ItemNameThai
                                   , CUtil.FormatNumber(v.ItemAdjQuantity, "-"), CUtil.FormatNumber(v.ItemPrice, "-"), CUtil.FormatNumber(v.ItemAmount, "-"));

                totals += CUtil.StringToDouble(v.ItemAmount);
            }

            rpp.AddReportRow(nr);

            if (row == rowcount - 1)
            {
                newh = newh - ftr.GetHeight();
                if (newh > 0)
                {
                    ftr.FillColumnsText("", CLanguage.getValue("total"), "", "", "", "", "", "", CUtil.FormatNumber(totals.ToString(), "-"));
                    rpp.AddReportRow(ftr);

                    totals = 0;
                }
            }

            if (newh < 0)
            {
                rpp.IsNewPageRequired = true;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
 public MInventoryBarcodeItem(CTable obj) : base(obj)
 {
     ExtFlag = "A";
 }
Example #39
0
		public static string InsertTable(CTable table)
		{
			string query = @"INSERT INTO Conf_Dyn_Tables(Id, Name) VALUES('{0}', '{1}');";
			return string.Format(query, table.Id, table.Name);
		}