Пример #1
0
        private void InitializeFormControls(TenderYear year)
        {
            InitializeComponent();

            button1.Visible = UserSession.IsAuthorized;

            using (TenderContext tc = new TenderContext())
            {
                contractorCBList.DataSource    = tc.Contractors.OrderBy(p => p.ShortName).ToList();
                contractorCBList.DisplayMember = "ShortName";
                contractorCBList.ValueMember   = "Id";
            }

            isPossibleToChangeContractMainData = true;
            locker      = new object();
            label8.Text = string.Empty;
            contractUsedSumLabel.Text      = contractRemainLabel.Text = string.Empty;
            filesTable.AutoGenerateColumns = contractChangesTable.AutoGenerateColumns = contractInvoicesTable.AutoGenerateColumns = false;

            deletingFiles         = new List <UploadedFile>();
            relatedFiles          = new BindingList <UploadedFile>();
            filesTable.DataSource = relatedFiles;
            DataGridViewHelper.ConfigureFileTable(filesTable, relatedFiles, deletingFiles, linkLabel1, linkLabel2, linkLabel3);

            dateOfSigning.Value = dateOfStart.Value = dateOfEnd.Value =
                new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddYears(Convert.ToInt32(year.Year) - DateTime.Now.Year);
            dateOfSigning.MinDate = dateOfStart.MinDate = dateOfEnd.MinDate = new DateTime(Convert.ToInt32(year.Year), 1, 1, 0, 0, 0);
            dateOfSigning.MaxDate = dateOfStart.MaxDate = dateOfEnd.MaxDate = new DateTime(Convert.ToInt32(year.Year), 12, 31, 0, 0, 0);
            dateOfEnd.Value       = new DateTime(Convert.ToInt32(year.Year), 12, 31, 0, 0, 0);

            hiddenPagesList = new List <TabPage>();

            contractChangesTable.RowsAdded  += (sender, e) => DataGridViewHelper.CalculateNewRowNumber(contractChangesTable, 0, e.RowIndex, e.RowCount);
            contractInvoicesTable.RowsAdded += (sender, e) => DataGridViewHelper.CalculateNewRowNumber(contractInvoicesTable, 0, e.RowIndex, e.RowCount);
        }
Пример #2
0
        private void InitializeFormControls()
        {
            InitializeComponent();

            // Отключаем переключатель просмотра остатков по разным системам (оставляем доработку этого функционала в будущих версиях)
            newSystemRButton.Visible = oldSystemRButton.Visible = false;

            saveEstimateDataButton.Visible = UserSession.IsAuthorized;

            wasDbChanged = false;

            estimateMoneyList = new List <EstimateMoneyOnSourceTable>();
            deletingFiles     = new List <UploadedFile>();

            monthes = new string[]
            {
                "Січень", "Лютий", "Березень",
                "Квітень", "Травень", "Червень",
                "Липень", "Серпень", "Вересень",
                "Жовтень", "Листопад", "Грудень"
            };

            using (TenderContext tc = new TenderContext())
            {
                kekvsList   = tc.KekvCodes.OrderBy(p => p.Code).ToList();
                sourcesList = new BindingList <MoneySource>(tc.MoneySources.OrderBy(p => p.ViewPriority).ToList());
            }

            moneySourceCBList.DataSource    = sourcesList;
            moneySourceCBList.DisplayMember = "Name";
            moneySourceCBList.ValueMember   = "Id";

            filesTable.AutoGenerateColumns = false;

            DataGridViewHelper.DrawMoneyTotalsTableSchema <KekvCode, string>(estimateTotalsTable,
                                                                             kekvsList, monthes.ToList(), t => t.Code, t => t);
            estimateTotalsTable.SortCompare += (sender, e) => DataGridViewHelper.SortCompareForMoneyTable(estimateTotalsTable, e);

            tableDataWasChangedByUser = false;
            for (int i = 0; i < estimateTotalsTable.RowCount; i++)
            {
                for (int k = 0; k < estimateTotalsTable.ColumnCount; k++)
                {
                    estimateTotalsTable.Rows[i].Cells[k].Value = 0.00;
                }
            }
            tableDataWasChangedByUser = true;

            relatedFiles          = new BindingList <UploadedFile>();
            filesTable.DataSource = relatedFiles;
            DataGridViewHelper.ConfigureFileTable(filesTable, relatedFiles, deletingFiles, linkLabel1, linkLabel2, linkLabel3);
        }
Пример #3
0
        private void InitializeFormControls()
        {
            InitializeComponent();
            button1.Visible   = UserSession.IsAuthorized;
            wasDbUpdated      = false;
            deletingFilesList = new List <UploadedFile>();
            relatedFiles      = new BindingList <UploadedFile>();
            contactsList      = new BindingList <ContactPerson>();
            deletingContacts  = new List <ContactPerson>();

            contactsTable.RowsAdded += (sender, e) => DataGridViewHelper.CalculateNewRowNumber(contactsTable, 0, e.RowIndex, e.RowCount);
            DataGridViewHelper.ConfigureFileTable(filesTable, relatedFiles, deletingFilesList, linkLabel5, linkLabel4, linkLabel3);

            contactsTable.AutoGenerateColumns = false;
            contactsTable.DataSource          = contactsList;
            filesTable.DataSource             = relatedFiles;
        }
Пример #4
0
        private void InitializeControls()
        {
            InitializeComponent();
            filesTable.AutoGenerateColumns = false;
            dbWasChanged          = false;
            moneyRemainLabel.Text = string.Empty;
            LoadProcedureTypesCBList();

            button1.Visible = UserSession.IsAuthorized;

            tenderBeginDate.Value = protocolDate.Value =
                new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddYears(Convert.ToInt32(year.Year) - DateTime.Now.Year);
            tenderBeginDate.MinDate = new DateTime(Convert.ToInt32(year.Year), 1, 1, 0, 0, 0);
            protocolDate.MinDate    = new DateTime(Convert.ToInt32(year.Year - 1), 1, 1, 0, 0, 0);
            tenderBeginDate.MaxDate = protocolDate.MaxDate = new DateTime(Convert.ToInt32(year.Year), 12, 31, 0, 0, 0);

            deletingFiles         = new List <UploadedFile>();
            relatedFiles          = new BindingList <UploadedFile>();
            filesTable.DataSource = relatedFiles;
            DataGridViewHelper.ConfigureFileTable(filesTable, relatedFiles, deletingFiles, linkLabel1, linkLabel2, linkLabel3);

            using (TenderContext tc = new TenderContext())
            {
                estimateList                  = tc.Estimates.Where(p => p.TenderYearId == this.year.Id).ToList();
                controlWasChangedByUser       = false;
                estimatesCBList.DataSource    = estimateList;
                controlWasChangedByUser       = true;
                estimatesCBList.DisplayMember = "Name";
                estimatesCBList.ValueMember   = "Id";

                altKekvList = tc.KekvCodes.OrderBy(p => p.Code).Select(p => new KekvRemain {
                    Kekv = p
                }).ToList();
                altKekv.DataSource = altKekvList;

                mainKekv.DisplayMember = altKekv.DisplayMember = "Kekv";
                mainKekv.ValueMember   = altKekv.ValueMember = "Id";
            }

            LoadKekvsOnEstimate();
        }
Пример #5
0
        private void InitializeFormControls(TenderYear year)
        {
            InitializeComponent();

            button1.Visible = UserSession.IsAuthorized;

            label6.Text = string.Empty;
            this.year   = year;
            controlValueWasChangedByUser = false;
            locker          = new object();
            kekvRemains     = new List <decimal>();
            moneysOnSources = new List <decimal>();
            relatedFiles    = new BindingList <UploadedFile>();
            deletingFiles   = new BindingList <UploadedFile>();
            DataGridViewHelper.ConfigureFileTable(filesTable, relatedFiles, deletingFiles, linkLabel1, linkLabel2, linkLabel3);

            filesTable.DataSource = relatedFiles;

            spendingDescription.Text = spendingRecord.Description;
            spendingFullSum.Value    = spendingRecord.Sum;

            if (spendingRecord.Id == 0)
            {
                dateTimePicker1.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddYears(Convert.ToInt32(year.Year) - DateTime.Now.Year);
            }
            else
            {
                dateTimePicker1.Value = spendingRecord.CreationDate;
            }

            dateTimePicker1.MinDate = new DateTime(Convert.ToInt32(year.Year), 1, 1, 0, 0, 0);
            dateTimePicker1.MaxDate = new DateTime(Convert.ToInt32(year.Year), 12, 31, 0, 0, 0);

            switch (spendingRecord.Status)
            {
            case PaymentStatus.New:
                newStatusRButton.Checked = true;
                break;

            case PaymentStatus.OnPayment:
                onPayStatusRButton.Checked = true;
                break;

            case PaymentStatus.Payed:
                paidStatusRButton.Checked = true;
                break;
            }

            using (TenderContext tc = new TenderContext())
            {
                sourcesList = tc.MoneySources.OrderBy(p => p.ViewPriority).ToList();
                estimateCBList.DataSource = tc.Estimates
                                            .Where(t => (t.TenderYearId == year.Id) && (t.Changes.Sum(p => p.PrimaryKekvSum) > 0))
                                            .OrderBy(t => t.Id)
                                            .ToList();

                Estimate selectedEstimate = estimateCBList.SelectedItem as Estimate;

                altKekvCBList.DataSource = tc.KekvCodes.OrderBy(p => p.Code).ToList();
            }

            for (int i = 0; i <= sourcesList.Count; i++)
            {
                DataGridViewRow newRow = new DataGridViewRow();
                newRow.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                newRow.DefaultCellStyle.WrapMode  = DataGridViewTriState.True;
                if (i < sourcesList.Count)
                {
                    newRow.HeaderCell.Value = sourcesList[i].Name.ToString();
                }
                else
                {
                    newRow.HeaderCell.Value      = "ВСЬОГО";
                    newRow.DefaultCellStyle.Font = FormStyles.MoneyTotalsFont;
                    newRow.ReadOnly = true;
                }
                balanceChangesTable.Rows.Add(newRow);
            }

            for (int i = 0; i < balanceChangesTable.ColumnCount; i++)
            {
                balanceChangesTable.Columns[i].ValueType = typeof(decimal);
                balanceChangesTable.Columns[i].SortMode  = DataGridViewColumnSortMode.NotSortable;
            }

            for (int i = 0; i < (balanceChangesTable.RowCount - 1); i++)
            {
                balanceChangesTable.Rows[i].Cells[0].Value = 0;
                balanceChangesTable.Rows[i].Cells[1].Value = 0;
                moneysOnSources.Add(0);
            }
            controlValueWasChangedByUser = true;
        }
Пример #6
0
        private void InitializeFormControls(TenderYear year)
        {
            InitializeComponent();

            button1.Visible = UserSession.IsAuthorized;

            label6.Text = estimateNameLabel.Text = string.Empty;
            this.year   = year;
            controlValueWasChangedByUser = false;
            locker           = new object();
            contractsRemains = new List <decimal>();
            moneysOnSources  = new List <decimal>();

            relatedFiles  = new BindingList <UploadedFile>();
            deletingFiles = new BindingList <UploadedFile>();
            DataGridViewHelper.ConfigureFileTable(filesTable, relatedFiles, deletingFiles, linkLabel1, linkLabel2, linkLabel3);
            filesTable.DataSource = relatedFiles;

            numberTextBox.Text       = invoiceRecord.Number;
            descriptionTextBox.Text  = invoiceRecord.Description;
            invoiceFullSum.Value     = invoiceRecord.Sum;
            IsCreditCheckBox.Checked = invoiceRecord.IsCredit;

            switch (invoiceRecord.Status)
            {
            case PaymentStatus.New:
                newStatusRButton.Checked = true;
                break;

            case PaymentStatus.OnPayment:
                onPayStatusRButton.Checked = true;
                break;

            case PaymentStatus.Payed:
                paidStatusRButton.Checked = true;
                break;
            }

            if (invoiceRecord.Id == 0)
            {
                invoiceDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0).AddYears(Convert.ToInt32(year.Year) - DateTime.Now.Year);
            }
            else
            {
                invoiceDate.Value = invoiceRecord.Date;
            }

            invoiceDate.MaxDate = new DateTime(Convert.ToInt32(year.Year), 12, 31, 0, 0, 0);
            invoiceDate.MinDate = new DateTime(Convert.ToInt32(year.Year), 1, 1, 0, 0, 0);

            using (TenderContext tc = new TenderContext())
            {
                sourcesList = tc.MoneySources.OrderBy(p => p.ViewPriority).ToList();
                contractorsCBList.DataSource = tc.Contracts.ToList()
                                               .Where(p => (p.RecordInPlan.Estimate.TenderYearId == year.Id) && (p.Status == ContractStatus.Active))
                                               .Select(p => p.Contractor).Distinct().OrderBy(p => p.ShortName)
                                               .ToList();
                contractorsCBList.ValueMember   = "Id";
                contractorsCBList.DisplayMember = "ShortName";

                contractsCBList.ValueMember   = "Id";
                contractsCBList.DisplayMember = "FullName";
            }

            for (int i = 0; i <= sourcesList.Count; i++)
            {
                DataGridViewRow newRow = new DataGridViewRow();
                newRow.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                newRow.DefaultCellStyle.WrapMode  = DataGridViewTriState.True;
                if (i < sourcesList.Count)
                {
                    newRow.HeaderCell.Value = sourcesList[i].Name.ToString();
                }
                else
                {
                    newRow.HeaderCell.Value      = "ВСЬОГО";
                    newRow.DefaultCellStyle.Font = FormStyles.MoneyTotalsFont;
                    newRow.ReadOnly = true;
                }
                balanceChangesTable.Rows.Add(newRow);
            }

            for (int i = 0; i < balanceChangesTable.ColumnCount; i++)
            {
                balanceChangesTable.Columns[i].ValueType = typeof(decimal);
                balanceChangesTable.Columns[i].SortMode  = DataGridViewColumnSortMode.NotSortable;
            }

            controlValueWasChangedByUser = false;
            for (int i = 0; i < (balanceChangesTable.RowCount - 1); i++)
            {
                balanceChangesTable.Rows[i].Cells[0].Value = 0;
                balanceChangesTable.Rows[i].Cells[1].Value = 0;
                moneysOnSources.Add(0);
            }
            controlValueWasChangedByUser = true;
        }