Exemplo n.º 1
0
 void makeRadio(FieldAttribute f, JObjectEnumerable values = null)
 {
     if (f == null)
     {
         return;
     }
     if (values != null)
     {
         f.MakeSelectable(values);
     }
     f.Type = "radioInput";
 }
Exemplo n.º 2
0
        void makeContactAutoComplete(FieldAttribute f, string field, int type, params string[] extras)
        {
            if (f == null)
            {
                return;
            }
            string moreFields = string.Join(", ", extras);

            if (!string.IsNullOrEmpty(moreFields))
            {
                moreFields = ", " + moreFields;
            }
            f.MakeSelectable(Database.Query($"SELECT {field} AS value{moreFields} FROM Contact WHERE RepairCafe = {Cafe} AND Type = {type} ORDER BY {field}"));
            f.Type = "autoComplete";
            f.Options["matchBeginning"] = true;
            f.Options["autoFill"]       = true;
        }
Exemplo n.º 3
0
        public void Document(int id)
        {
            Extended_Document header = Database.Get <Extended_Document>(id);

            if (header.idDocument == null)
            {
                header.DocumentTypeId = (int)DocType.Subscriptions;
                header.DocType        = "Subscriptions";
                header.DocumentDate   = Utils.Today;
                header.DocumentName   = "";
                if (GetParameters["acct"].IsInteger())
                {
                    header.DocumentAccountId = int.Parse(GetParameters["acct"]);
                }
                else if (Settings.DefaultBankAccount > 0)
                {
                    Account acc = Database.QueryOne <Account>("*", "WHERE idAccount = " + Settings.DefaultBankAccount, "Account");
                    if (acc.idAccount != null)
                    {
                        header.DocumentAccountId   = (int)acc.idAccount;
                        header.DocumentAccountName = acc.AccountName;
                    }
                }
            }
            else
            {
                checkDocType(header.DocumentTypeId, DocType.Subscriptions);
            }
            JObject          record = getSubscriptionJournal(header);
            HeaderDetailForm form   = new HeaderDetailForm(this, typeof(SubscriptionJournal), typeof(SubscriptionPayment));

            form.Header.Options["table"]     = "Document";
            form.Header.Options["canDelete"] = string.IsNullOrEmpty(header.Clr);
            // Following fields will be auto-generated as readonly - we want to edit them
            form.Header["DocumentAccountId"].MakeSelectable(SelectBankAccounts());
            FieldAttribute member = form.Detail["Member"];

            member.MakeSelectable(SelectMembers());
            member.Type = "autoComplete";
            member.Options["mustExist"] = true;
            Form   = form;
            Record = record;
        }