Ejemplo n.º 1
0
        public void setNextData()
        {
            int index         = ConnsignmentNumber.SelectedIndex;
            int connsigmentNo = int.Parse(new string(ConnsignmentNumber.Text.ToCharArray().Where(x => char.IsDigit(x)).ToArray()));

            connsigmentNo++;
            string start = ConnsignmentNumber.Text.Substring(0, ConnsignmentNumber.Text.Length - connsigmentNo.ToString().Length);

            start = start + connsigmentNo.ToString();
            ConnsignmentNumber.Text = start;
            fillAllElements(ConnsignmentNumber.Text);
            CustomerSelected.Focus();
        }
Ejemplo n.º 2
0
        private void SetDateInformation()
        {
            ClearStatusMessage();

            var cycleSelecteted  = (cmbCycle.SelectedIndex >= 0);
            var startSelected    = datStartMonth.Value.HasValue;
            var daySelected      = !string.IsNullOrEmpty(txtBilledDay.Text);
            var customerSelected = CustomerSelected != null;

            if (!startSelected || !daySelected || !customerSelected)
            {
                datBilledAt.Clear();
                datSalesAt.Clear();
                datClosingAt.Clear();
                datDueAt.Clear();
                lblDisplayRepeatCount.Clear();
            }
            else
            {
                var ym       = datStartMonth.Value.Value.Date;
                var day      = int.Parse(txtBilledDay.Text);
                var billedAt = new DateTime(ym.Year, ym.Month,
                                            ((28 < day) ? DateTime.DaysInMonth(ym.Year, ym.Month) : day));
                datBilledAt.Value = billedAt;
                datSalesAt.Value  = billedAt;
                var closingAt = CustomerSelected.GetClosingAt(billedAt);
                datClosingAt.Value = closingAt;
                if (closingAt.HasValue)
                {
                    datDueAt.Value = CustomerSelected.GetDueAt(closingAt.Value, Holidays);
                }

                if (datEndMonth.Value.HasValue &&
                    daySelected && cycleSelecteted &&
                    datStartMonth.Value.Value <= datEndMonth.Value.Value)
                {
                    var end    = datEndMonth.Value.Value;
                    var start  = datStartMonth.Value.Value;
                    var months = (end.Year * 12 + end.Month) - (start.Year * 12 + start.Month);
                    var cycle  = GetSelectedBilledCycle();
                    var count  = (months / cycle) + 1;
                    lblDisplayRepeatCount.Text = count.ToString();
                }
                else
                {
                    lblDisplayRepeatCount.Clear();
                }
            }

            btnDetail.Enabled = cycleSelecteted && startSelected && daySelected && customerSelected;
        }