예제 #1
0
        public GcNumberCell GetNumberCell(MultiRowContentAlignment align = MultiRowContentAlignment.MiddleRight,
                                          string fieldFormat             = "#,###,###,###,###", string displayFormat = "#,###,###,###,##0")
        {
            var cell = new GcNumberCell();

            cell.ExitOnArrowKey = true;
            cell.Fields.SetFields(fieldFormat, "", "", "-", "");
            cell.DisplayFields.AddRange(displayFormat, "", "", "-", "");
            cell.Fields.IntegerPart.MinDigits = 1;
            cell.FlatStyle      = FlatStyle.Flat;
            cell.Spin.AllowSpin = false;
            cell.ShortcutKeys.Remove(Keys.F2);
            cell.ShortcutKeys.Remove(Keys.F4);
            cell.Style = GetDefaultCellStyle(align);
            cell.SideButtons.Clear();
            cell.MaxValue       = 9999999999999M;
            cell.MinValue       = -9999999999999M;
            cell.MaxMinBehavior = GrapeCity.Win.Editors.MaxMinBehavior.AdjustToMaxMin;
            return(cell);
        }
예제 #2
0
        private void OnCheckedChanged(int rowIndex, int cellIndex, int numberCellIndex)
        {
            var checkCell = new CheckBoxCell();

            checkCell = (CheckBoxCell)grid.Rows[rowIndex].Cells[cellIndex];

            var numberCell = new GcNumberCell();

            numberCell = (GcNumberCell)grid.Rows[rowIndex].Cells[numberCellIndex];

            bool checkValue = Convert.ToBoolean(checkCell.EditedFormattedValue);

            if (checkValue)
            {
                numberCell.Enabled = true;
            }
            else
            {
                numberCell.Enabled = false;
            }
        }
예제 #3
0
        private void SetGridData()
        {
            var checkCell         = new CheckBoxCell();
            var textCellName      = new GcTextBoxCell();
            var numberCellOrder   = new GcNumberCell();
            var checkCellIndex    = 0;
            var numberCellIndex   = 2;
            var useContractNumber = UseLongTermAdvanceReceived && RegisterContractInAdvance;
            var tableName         = InputGridTypeId == InputGridType.Billing ? nameof(Billing) : nameof(Receipt);

            var note1 = "備考1";
            var note2 = "備考2";
            var note3 = "備考3";
            var note4 = "備考4";

            foreach (var names in ColumnNameList.Where(x => x.TableName == tableName))
            {
                if (names.ColumnName == "Note1")
                {
                    note1 = names.DisplayColumnName;
                }
                if (names.ColumnName == "Note2")
                {
                    note2 = names.DisplayColumnName;
                }
                if (names.ColumnName == "Note3")
                {
                    note3 = names.DisplayColumnName;
                }
                if (names.ColumnName == "Note4")
                {
                    note4 = names.DisplayColumnName;
                }
            }

            if (InputControlList.Count > 0)
            {
                foreach (var input in InputControlList)
                {
                    if (input.ColumnName == "Note1")
                    {
                        input.ColumnNameJp = note1;
                    }
                    if (input.ColumnName == "Note2")
                    {
                        input.ColumnNameJp = note2;
                    }
                    if (input.ColumnName == "Note3")
                    {
                        input.ColumnNameJp = note3;
                    }
                    if (input.ColumnName == "Note4")
                    {
                        input.ColumnNameJp = note4;
                    }
                }

                if (!UseDiscount && InputGridTypeId.Equals(InputGridType.Billing))
                {
                    var discountIndex = InputControlList.FindIndex(
                        x => x.ColumnName.Equals(DiscountName) &&
                        x.ColumnNameJp.Equals(DiscountJpName));

                    InputControlList.RemoveAt(discountIndex);
                }

                if (!useContractNumber && InputGridTypeId.Equals(InputGridType.Billing))
                {
                    var contractIndex = InputControlList.FindIndex(
                        x => x.ColumnName.Equals(ContractName) &&
                        x.ColumnNameJp.Equals(ContractJpName));

                    InputControlList.RemoveAt(contractIndex);
                }

                grid.RowCount = InputControlList.Count;

                for (var i = 0; i < InputControlList.Count; i++)
                {
                    var inputControl = new InputControl();
                    inputControl = InputControlList[i];

                    checkCell       = (CheckBoxCell)grid.Rows[i].Cells[0];
                    checkCell.Value = inputControl.TabStop;

                    textCellName       = (GcTextBoxCell)grid.Rows[i].Cells[1];
                    textCellName.Value = inputControl.ColumnNameJp;

                    numberCellOrder       = (GcNumberCell)grid.Rows[i].Cells[2];
                    numberCellOrder.Value = inputControl.TabIndex;

                    OnCheckedChanged(i, checkCellIndex, numberCellIndex);
                }
            }
            else
            {
                var columnBillingName = new List <string> {
                    nameof(Billing.SalesAt),
                    nameof(Billing.BillingCategoryId),
                    nameof(Billing.TaxClassId),
                    nameof(Billing.DebitAccountTitleId),
                    nameof(Billing.UseDiscount),
                    nameof(Billing.Note1),
                    nameof(Billing.ContractNumber),
                    nameof(Billing.Quantity),
                    nameof(Billing.UnitSymbol),
                    nameof(Billing.UnitPrice),
                    nameof(Billing.Price),
                    nameof(Billing.TaxAmount),
                    nameof(Billing.BillingAmount),
                };

                var columnBillingNameJp = new List <string>
                {
                    "売上日", "請求区分", "税区", "債権科目", "歩引計算",
                    note1, "契約番号", "数量", "単位", "単価",
                    "金額(抜)", "消費税", "請求額"
                };

                var columnReceiptName = new List <string>
                {
                    "ReceiptCategory", "Note1", "DueAt", "ReceiptAmount", "BillNumber",
                    "BillBankCode", "BillBranchCode", "BillDrawAt", "BillDrawer",
                    "Note2", "Note3", "Note4"
                };

                var columnReceiptNameJp = new List <string>
                {
                    "入金区分", note1, "期日", "金額", "手形番号",
                    "銀行コード", "支店コード", "振出日", "振出人",
                    note2, note3, note4
                };

                if (!UseDiscount && InputGridTypeId == InputGridType.Billing)
                {
                    var nameIndex   = columnBillingName.FindIndex(x => x.Equals(DiscountName));
                    var jpNameIndex = columnBillingNameJp.FindIndex(x => x.Equals(DiscountJpName));
                    columnBillingName.RemoveAt(nameIndex);
                    columnBillingNameJp.RemoveAt(jpNameIndex);
                }

                if (!useContractNumber && InputGridTypeId == InputGridType.Billing)
                {
                    var nameIndex   = columnBillingName.FindIndex(x => x.Equals(ContractName));
                    var jpNameIndex = columnBillingNameJp.FindIndex(x => x.Equals(ContractJpName));
                    columnBillingName.RemoveAt(nameIndex);
                    columnBillingNameJp.RemoveAt(jpNameIndex);
                }

                var columnName = InputGridTypeId == InputGridType.Billing
                    ? columnBillingName : columnReceiptName;
                var columnNameJp = InputGridTypeId == InputGridType.Billing
                    ? columnBillingNameJp : columnReceiptNameJp;

                grid.RowCount = columnName.Count;

                for (var i = 0; i < grid.RowCount; i++)
                {
                    checkCell       = (CheckBoxCell)grid.Rows[i].Cells[0];
                    checkCell.Value = true;

                    textCellName       = (GcTextBoxCell)grid.Rows[i].Cells[1];
                    textCellName.Value = columnNameJp[i];

                    numberCellOrder       = (GcNumberCell)grid.Rows[i].Cells[2];
                    numberCellOrder.Value = i + 1;

                    OnCheckedChanged(i, checkCellIndex, numberCellIndex);

                    var inputControl = new InputControl();
                    inputControl.CompanyId       = CompanyId;
                    inputControl.LoginUserId     = Login.UserId;
                    inputControl.InputGridTypeId = InputGridTypeId;
                    inputControl.ColumnName      = columnName[i];
                    inputControl.ColumnNameJp    = columnNameJp[i];
                    inputControl.ColumnOrder     = i + 1;
                    inputControl.TabIndex        = i + 1;
                    inputControl.TabStop         = 1;
                    InputControlList.Add(inputControl);
                }
            }
        }