Пример #1
0
        private void SetInputControlInfo()
        {
            for (var i = 0; i < InputControlList.Count; i++)
            {
                var inputControl = InputControlList[i];

                var checkBoxCell = (CheckBoxCell)grid.Rows[i].Cells[0];
                inputControl.TabStop = Convert.ToInt32(checkBoxCell.Value);

                var numberCell = (GcNumberCell)grid.Rows[i].Cells[2];
                inputControl.TabIndex = Convert.ToInt32(numberCell.Value);
            }

            if (InputGridTypeId != InputGridType.Billing)
            {
                return;
            }

            var discountIndex = InputControlList.FindIndex(
                x => x.ColumnName.Equals(DiscountName) &&
                x.ColumnNameJp.Equals(DiscountJpName));

            if (discountIndex < 0 &&
                InputGridTypeId == InputGridType.Billing)
            {
                var index = InputControlList.FindIndex(
                    x => x.ColumnName.Equals("DebitAccountTitle"));

                InputControlList.Insert(index + 1, new InputControl()
                {
                    CompanyId       = CompanyId,
                    LoginUserId     = Login.UserId,
                    InputGridTypeId = InputGridType.Billing,
                    ColumnName      = DiscountName,
                    ColumnNameJp    = DiscountJpName,
                    ColumnOrder     = 0,
                    TabStop         = 0,
                    TabIndex        = 1
                });
            }

            var contractIndex = InputControlList.FindIndex(
                x => x.ColumnName.Equals(ContractName) &&
                x.ColumnNameJp.Equals(ContractJpName));

            if (contractIndex < 0 &&
                InputGridTypeId == InputGridType.Billing)
            {
                var index = InputControlList.FindIndex(
                    x => x.ColumnName.Equals("Note1"));

                InputControlList.Insert(index + 1, new InputControl()
                {
                    CompanyId       = Login.CompanyId,
                    LoginUserId     = Login.UserId,
                    InputGridTypeId = InputGridType.Billing,
                    ColumnName      = ContractName,
                    ColumnNameJp    = ContractJpName,
                    ColumnOrder     = 0,
                    TabStop         = 0,
                    TabIndex        = 1
                });
            }

            var order = 1;

            foreach (var inputControl in InputControlList)
            {
                inputControl.ColumnOrder = order;
                order++;
            }
        }
Пример #2
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);
                }
            }
        }