protected override void InitializeForm()
        {
            XML form = FormHelper.LoadGladeXML("Dialogs.EditNewAdvancePayment.glade", "dlgEditNewAdvancePayment");

            form.Autoconnect(this);

            dlgEditNewAdvancePayment.Icon = FormHelper.LoadImage("Icons.TradePoint32.png").Pixbuf;
            btnOK.SetChildImage(FormHelper.LoadImage("Icons.Ok24.png"));
            btnCancel.SetChildImage(FormHelper.LoadImage("Icons.Cancel24.png"));

            btnAdd          = new Button();
            btnAdd.Clicked += btnAdd_Clicked;
            uint columns = ++paymentWidget.TablePayments.NColumns;

            paymentWidget.TablePayments.Attach(btnAdd, columns - 1, columns, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            btnAdd.SetChildImage(FormHelper.LoadImage("Icons.Add16.png"));
            btnAdd.Show();

            base.InitializeForm();
            InitializeFormStrings();
            paymentWidget.RefreshGrid();
        }
Пример #2
0
        protected override void InitializeForm()
        {
            XML form = FormHelper.LoadGladeXML("Dialogs.EditNewPayment.glade", "dlgEditNewPayment");

            form.Autoconnect(this);

            dlgEditNewPayment.Icon = FormHelper.LoadImage("Icons.TradePoint32.png").Pixbuf;
            btnOK.SetChildImage(FormHelper.LoadImage("Icons.Ok24.png"));
            btnCancel.SetChildImage(FormHelper.LoadImage("Icons.Cancel24.png"));

            txtDueDate.Text = BusinessDomain.GetFormattedDate(GetDueDate());

            base.InitializeForm();
            InitializeFormStrings();
            paymentWidget.RefreshGrid();

            chkUseAdvances.Visible = operation.UseAdvancePayments && operation.Id < 0;
            if (!chkUseAdvances.Visible)
            {
                return;
            }

            advances.AddRange(Payment.GetAdvances(operation.PartnerId));
            foreach (Payment payment in advances)
            {
                payment.Type.BaseType = BasePaymentType.Advance;
            }

            if (advances.Count == 0)
            {
                chkUseAdvances.Visible = false;
            }
            else
            {
                chkUseAdvances.Label = string.Format("{0} {1}",
                                                     Translator.GetString("Use Advance Payments"),
                                                     string.Format(Translator.GetString("(total: {0})"), Currency.ToString(advances.Sum(p => p.Quantity), operation.TotalsPriceType)));
            }
        }